本文整理汇总了Java中org.apache.taverna.scufl2.api.common.NamedSet.getByName方法的典型用法代码示例。如果您正苦于以下问题:Java NamedSet.getByName方法的具体用法?Java NamedSet.getByName怎么用?Java NamedSet.getByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.taverna.scufl2.api.common.NamedSet
的用法示例。
在下文中一共展示了NamedSet.getByName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: uniqueName
import org.apache.taverna.scufl2.api.common.NamedSet; //导入方法依赖的package包/类
/**
* Pick a name that is unique within the context set. This is done by
* appending "<tt>_<i>n</i></tt>" as necessary, where <tt><i>n</i></tt> is a
* number.
*
* @param name
* The suggested name; this is always checked first.
* @param context
* The set of things that the name will have to be unique within.
* @return A name that is definitely not the name of anything in the given
* set.
*/
public static String uniqueName(String name, NamedSet<? extends Named> context) {
String candidate = SANITIZER_RE.matcher(name).replaceAll("_");
if (context.getByName(candidate) == null)
return candidate;
int counter = 0;
String prefix = candidate;
Matcher m = SUFFIXED_RE.matcher(candidate);
if (m.matches()) {
prefix = m.group(1);
counter = Integer.parseInt(m.group(2));
}
do {
candidate = prefix + "_" + (++counter);
} while (context.getByName(candidate) != null);
return candidate;
}
示例2: showPortOptions
import org.apache.taverna.scufl2.api.common.NamedSet; //导入方法依赖的package包/类
private <T extends Port> T showPortOptions(NamedSet<T> ports,
String portType, Component component, Point point) {
T result = null;
if (ports.size() == 0) {
showMessageDialog(component, "Service has no " + portType
+ " ports to connect to");
} else if (ports.size() == 1)
result = ports.first();
else {
Object[] portNames = ports.getNames().toArray();
String portName = (String) showInputDialog(component, "Select an "
+ portType + " port", "Port Chooser", PLAIN_MESSAGE, null,
portNames, portNames[0]);
if (portName != null)
result = ports.getByName(portName);
}
return result;
}
示例3: parseControlLinks
import org.apache.taverna.scufl2.api.common.NamedSet; //导入方法依赖的package包/类
private Set<ControlLink> parseControlLinks(Conditions conditions)
throws ReaderException {
Set<ControlLink> links = new HashSet<>();
for (Condition condition : conditions.getCondition()) {
NamedSet<Processor> processors = parserState.get()
.getCurrentWorkflow().getProcessors();
String target = condition.getTarget();
Processor block = processors.getByName(target);
if (block == null && isStrict())
throw new ReaderException(
"Unrecognized blocking processor in control link: "
+ target);
String control = condition.getControl();
Processor untilFinished = processors.getByName(control);
if (untilFinished == null && isStrict())
throw new ReaderException(
"Unrecognized untilFinished processor in control link: "
+ control);
BlockingControlLink newLink = new BlockingControlLink(block, untilFinished);
// FIXME: missing from t2flow and schema
//parseAnnotations(newLink, condition.getAnnotations());
links.add(newLink);
}
return links;
}
示例4: parseSimpleTell
import org.apache.taverna.scufl2.api.common.NamedSet; //导入方法依赖的package包/类
@Test
public void parseSimpleTell() throws Exception {
WorkflowBundle researchObj = parseWorkflow(WF_SIMPLE_TELL);
NamedSet<Profile> profiles = researchObj.getProfiles();
Profile profile = profiles.getByName("taverna-biodiversity-2.5.0");
assertNotNull("Could not find profile", profile);
Processor tell = researchObj.getMainWorkflow().getProcessors()
.getByName("tell");
assertNotNull("Could not find processor tell", tell);
Configuration tellConfig = scufl2Tools
.configurationForActivityBoundToProcessor(tell, profile);
Activity tellAct = (Activity) tellConfig.getConfigures();
assertEquals(ACTIVITY_URI, tellAct.getType());
ObjectNode tellResource = tellConfig.getJsonAsObjectNode();
assertEquals(ACTIVITY_URI.resolve("#Config"), tellConfig.getType());
String presentationOrigin = tellResource.get("presentationOrigin").textValue();
assertEquals("tell", presentationOrigin);
String interactionActivityType = tellResource.get("interactionActivityType").textValue();
assertEquals("VelocityTemplate", interactionActivityType);
boolean progressNotification = tellResource.get("progressNotification").booleanValue();
assertFalse(progressNotification);
}
示例5: parseMultipleChoice
import org.apache.taverna.scufl2.api.common.NamedSet; //导入方法依赖的package包/类
@Test
public void parseMultipleChoice() throws Exception {
WorkflowBundle researchObj = parseWorkflow(WF_MULTIPLE_CHOICE);
NamedSet<Profile> profiles = researchObj.getProfiles();
Profile profile = profiles.getByName("taverna-biodiversity-2.5.0");
assertNotNull("Could not find profile", profile);
Processor interaction = researchObj.getMainWorkflow().getProcessors()
.getByName("Interaction");
assertNotNull("Could not find processor Interaction", interaction);
Configuration interactionConfig = scufl2Tools
.configurationForActivityBoundToProcessor(interaction, profile);
Activity interactionAct = (Activity) interactionConfig.getConfigures();
assertEquals(ACTIVITY_URI, interactionAct.getType());
ObjectNode interactionResource = interactionConfig.getJsonAsObjectNode();
assertEquals(ACTIVITY_URI.resolve("#Config"), interactionConfig.getType());
String presentationOrigin = interactionResource.get("presentationOrigin").textValue();
assertEquals("http://build.mygrid.org.uk/taverna/internal/biovel/multiple_selection.html", presentationOrigin);
String interactionActivityType = interactionResource.get("interactionActivityType").textValue();
assertEquals("LocallyPresentedHtml", interactionActivityType);
boolean progressNotification = interactionResource.get("progressNotification").booleanValue();
assertFalse(progressNotification);
}