net.sf.taverna.t2.workflowmodel.processor.activity.Activity.getOutputPorts()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(16.6k)|赞(0)|评价(0)|浏览(150)

本文整理了Java中net.sf.taverna.t2.workflowmodel.processor.activity.Activity.getOutputPorts()方法的一些代码示例,展示了Activity.getOutputPorts()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.getOutputPorts()方法的具体详情如下:
包路径:net.sf.taverna.t2.workflowmodel.processor.activity.Activity
类名称:Activity
方法名:getOutputPorts

Activity.getOutputPorts介绍

[英]An Activity contains a set of named output ports. As with input ports names must be unique within the set.
[中]活动包含一组命名的输出端口。与输入端口一样,名称在集合中必须是唯一的。

代码示例

代码示例来源:origin: net.sf.taverna.t2.ui-components/graph-model

private boolean isSingleOutputProcessor(Object dataflowObject) {
  if (!(dataflowObject instanceof Processor)) {
    return false;
  }
  Processor p = (Processor) dataflowObject;
  List<? extends Activity<?>> activities = p.getActivityList();
  if (activities.size() > 0) {
    Set<OutputPort> ports = activities.get(0).getOutputPorts();
    return (ports.size() == 1);
  }
  return false;
}

代码示例来源:origin: net.sf.taverna.t2.core/workflowmodel-api

public static OutputPort getActivityOutputPort(Activity<?> activity,
    String portName) {
  OutputPort activityOutputPort = null;
  for (OutputPort outputPort : activity.getOutputPorts()) {
    if (outputPort.getName().equals(portName)) {
      activityOutputPort = outputPort;
      break;
    }
  }
  return activityOutputPort;
}

代码示例来源:origin: net.sf.taverna.t2/workflowmodel-impl

public static OutputPort getActivityOutputPort(Activity<?> activity,
    String portName) {
  OutputPort activityOutputPort = null;
  for (OutputPort outputPort : activity.getOutputPorts()) {
    if (outputPort.getName().equals(portName)) {
      activityOutputPort = outputPort;
      break;
    }
  }
  return activityOutputPort;
}

代码示例来源:origin: net.sf.taverna.t2.ui-exts/loop-ui

private List<String> getActivityOutputPorts() {
  // TODO: Support multiple activities
  Activity<?> activity = getFirstProcessorActivity();
  if (activity == null) {
    return new ArrayList<String>();
  }
  List<String> ports = new ArrayList<String>();
  for (OutputPort outPort : activity.getOutputPorts()) {
    if (outPort.getDepth() == 0) {
      ports.add(outPort.getName());
    }
  }
  Collections.sort(ports);
  return ports;
}

代码示例来源:origin: net.sf.taverna.t2.activities/external-tool-activity

private static ActivityOutputPort getActivityOutputPort(
    Activity<?> activity, ProcessorPort processorOutputPort) {
  ProcessorInputPort result = null;
  for (Entry<String, String> mapEntry : activity.getOutputPortMapping()
      .entrySet()) {
    if (mapEntry.getKey().equals(processorOutputPort.getName())) {
      for (OutputPort activityOutputPort : activity
          .getOutputPorts()) {
        if (activityOutputPort.getName().equals(mapEntry.getValue())) {
          return (ActivityOutputPort) activityOutputPort;
        }
      }
      break;
    }
  }
  return null;
}

代码示例来源:origin: net.sf.taverna.t2/workflowmodel-impl

public static Collection<Processor> getProcessorsWithActivityOutputPort(Dataflow dataflow, OutputPort outputPort) {
  Set<Processor> processors = new HashSet<Processor>();
  for (Processor processor : dataflow.getProcessors()) {	
    
    // Does it contain a nested workflow?
    if (containsNestedWorkflow(processor)) {
      // Get the nested workflow and check all its nested processors
      Dataflow nestedWorkflow = ((NestedDataflow) processor.getActivityList().get(0))
          .getNestedDataflow();
      Collection<Processor> nested_processors = getProcessorsWithActivityOutputPort(
          nestedWorkflow, outputPort);
      if (!nested_processors.isEmpty())
        processors.addAll(nested_processors);
    }
    
    // Check all processor's activities (even if the processor contained a nested workflow,
    // as its dataflow activity still contains input and output ports)
    for (Activity<?> activity : processor.getActivityList()) {
      if (activity.getOutputPorts().contains(outputPort)) {
        processors.add(processor);
      }
    }
  }
  return processors;
}

代码示例来源:origin: net.sf.taverna.t2.core/workflowmodel-api

public static Collection<Processor> getProcessorsWithActivityOutputPort(
    Dataflow dataflow, OutputPort outputPort) {
  Set<Processor> processors = new HashSet<Processor>();
  for (Processor processor : dataflow.getProcessors()) {
    // Does it contain a nested workflow?
    if (containsNestedWorkflow(processor)) {
      // Get the nested workflow and check all its nested processors
      Dataflow nestedWorkflow = ((NestedDataflow) processor
          .getActivityList().get(0)).getNestedDataflow();
      Collection<Processor> nested_processors = getProcessorsWithActivityOutputPort(
          nestedWorkflow, outputPort);
      if (!nested_processors.isEmpty())
        processors.addAll(nested_processors);
    }
    // Check all processor's activities (even if the processor contained
    // a nested workflow,
    // as its dataflow activity still contains input and output ports)
    for (Activity<?> activity : processor.getActivityList()) {
      if (activity.getOutputPorts().contains(outputPort)) {
        processors.add(processor);
      }
    }
  }
  return processors;
}

代码示例来源:origin: net.sf.taverna.t2.ui-exts/loop-ui

private HashSet<String> findFeedbackPorts() {
    HashSet<String> incoming = new HashSet<String>();
    for (InputPort inputPort : activityToCompare.getInputPorts()) {
      String activityPortName = inputPort.getName();
      String processorPortName = activityToCompare.getInputPortMapping()
          .get(activityPortName);
      if (processorPortName == null) {
        // We'll need to map it later
        processorPortName = activityPortName;
      }
      incoming.add(processorPortName);
    }

    HashSet<String> outgoing = new HashSet<String>();
    for (OutputPort outputPort : activityToCompare.getOutputPorts()) {
      String activityPortName = outputPort.getName();
      String processorPortName = activityToCompare.getOutputPortMapping()
          .get(activityPortName);
      if (processorPortName == null) {
        // We'll need to map it later
        processorPortName = activityPortName;
      }
      outgoing.add(processorPortName);
    }

    // Return the port names that are common
    incoming.retainAll(outgoing);
    return incoming;
  }
}

代码示例来源:origin: net.sf.taverna.t2.core/workflowmodel-impl

private List<ProcessorOutputPort> determineOutputPortsForRemoval(Processor p,Activity<?>a) {
  List<ProcessorOutputPort> result = new ArrayList<ProcessorOutputPort>();
  for (ProcessorOutputPort pPort : p.getOutputPorts()) {
    boolean found=false;
    for (OutputPort aPort : a.getOutputPorts()) {
      if (aPort.getName().equals(pPort.getName())) {
        if (pPort.getDepth() == aPort.getDepth() && pPort.getGranularDepth() == aPort.getGranularDepth()) {
          found=true;
        }
        break;
      }
    }
    if (!found) {
      result.add(pPort);
    }
  }
  return result;
}

代码示例来源:origin: net.sf.taverna.t2/workflowmodel-impl

private List<ProcessorOutputPort> determineOutputPortsForRemoval(Processor p,Activity<?>a) {
  List<ProcessorOutputPort> result = new ArrayList<ProcessorOutputPort>();
  for (ProcessorOutputPort pPort : p.getOutputPorts()) {
    boolean found=false;
    for (OutputPort aPort : a.getOutputPorts()) {
      if (aPort.getName().equals(pPort.getName())) {
        if (pPort.getDepth() == aPort.getDepth() && pPort.getGranularDepth() == aPort.getGranularDepth()) {
          found=true;
        }
        break;
      }
    }
    if (!found) {
      result.add(pPort);
    }
  }
  return result;
}

代码示例来源:origin: net.sf.taverna.t2/cyclone-impl

/**
 * @param activity
 * @param t2Processor
 * @throws EditException
 */
private void addOutputPorts(Activity<?> activity, Processor t2Processor)
    throws EditException {
  Set<OutputPort> outputPorts = activity.getOutputPorts();
  for (OutputPort outputPort : outputPorts) {
    Edit<Processor> addOutputPortEdit = edits
        .getCreateProcessorOutputPortEdit(t2Processor, outputPort
            .getName(), outputPort.getDepth(), outputPort
            .getGranularDepth());
    addOutputPortEdit.doEdit();
    activity.getOutputPortMapping().put(outputPort.getName(),
        outputPort.getName());
  }
}

代码示例来源:origin: net.sf.taverna.t2/compatibility-impl

/**
 * @param activity
 * @param t2Processor
 * @throws EditException
 */
private void addOutputPorts(Activity<?> activity, Processor t2Processor)
    throws EditException {
  Set<OutputPort> outputPorts = activity.getOutputPorts();
  for (OutputPort outputPort : outputPorts) {
    ProcessorOutputPort port = edits.createProcessorOutputPort(
        t2Processor, outputPort.getName(), outputPort.getDepth(),
        outputPort.getGranularDepth());
    Edit<Processor> addOutputPortEdit = edits
        .getAddProcessorOutputPortEdit(t2Processor, port);
    addOutputPortEdit.doEdit();
    activity.getOutputPortMapping().put(outputPort.getName(),
        outputPort.getName());
  }
}

代码示例来源:origin: net.sf.taverna.t2/wsdl-activity-translator

@Test
public void testSimplePorts() throws Exception {
  WSDLActivityTranslator translator = new WSDLActivityTranslator();
  Activity<?> activity = translator.doTranslation(processor);
  assertEquals("no inputs were expected",0,activity.getInputPorts().size());
  assertEquals("2 outputs were expected (remember 1 extra for attachment list!).",2,activity.getOutputPorts().size());
    List<String> portNames = new ArrayList<String>();
  portNames.add("attachmentList");
  portNames.add("getSupportedDBsReturn");
  boolean found=false;
  for (OutputPort port : activity.getOutputPorts()) {
    if (port.getName().equals("getSupportedDBsReturn")) {
      found=true;
    }
    assertEquals("the port '"+port.getName()+"' should have a depth of 1 (i.e. a list)",1,port.getDepth());
  }
  if (!found) {
    fail("There should be an output port named getSupportedDBsReturn");
  }
}

代码示例来源:origin: net.sf.taverna.t2.compatibility/compatibility-impl

@Test
public void testAlternateProcessorTranslation() throws Exception {
  Dataflow dataflow = translateScuflFile("alternate_test_workflow.xml");
  
  assertEquals(1, dataflow.getProcessors().size());
  Processor processor = dataflow.getProcessors().get(0);
  assertEquals(2, processor.getActivityList().size());
  
  assertEquals(1, processor.getActivityList().get(0).getInputPorts().size());
  assertEquals("input", processor.getActivityList().get(0).getInputPorts().iterator().next().getName());
  assertEquals(1, processor.getActivityList().get(0).getOutputPorts().size());
  assertEquals("output", processor.getActivityList().get(0).getOutputPorts().iterator().next().getName());
  assertEquals(1, processor.getActivityList().get(1).getInputPorts().size());
  assertEquals("in", processor.getActivityList().get(1).getInputPorts().iterator().next().getName());
  assertEquals(1, processor.getActivityList().get(1).getOutputPorts().size());
  assertEquals("out", processor.getActivityList().get(1).getOutputPorts().iterator().next().getName());
  
  assertEquals(1, processor.getActivityList().get(1).getInputPortMapping().keySet().size());
  assertEquals("input", processor.getActivityList().get(1).getInputPortMapping().keySet().iterator().next());
  assertEquals(1, processor.getActivityList().get(1).getInputPortMapping().values().size());
  assertEquals("in", processor.getActivityList().get(1).getInputPortMapping().values().iterator().next());
  assertEquals(1, processor.getActivityList().get(1).getOutputPortMapping().keySet().size());
  assertEquals("output", processor.getActivityList().get(1).getOutputPortMapping().keySet().iterator().next());
  assertEquals(1, processor.getActivityList().get(1).getOutputPortMapping().values().size());
  assertEquals("out", processor.getActivityList().get(1).getOutputPortMapping().values().iterator().next());
}

代码示例来源:origin: net.sf.taverna.t2/compatibility-impl

@Test
public void testAlternateProcessorTranslation() throws Exception {
  Dataflow dataflow = translateScuflFile("alternate_test_workflow.xml");
  
  assertEquals(1, dataflow.getProcessors().size());
  Processor processor = dataflow.getProcessors().get(0);
  assertEquals(2, processor.getActivityList().size());
  
  assertEquals(1, processor.getActivityList().get(0).getInputPorts().size());
  assertEquals("input", processor.getActivityList().get(0).getInputPorts().iterator().next().getName());
  assertEquals(1, processor.getActivityList().get(0).getOutputPorts().size());
  assertEquals("output", processor.getActivityList().get(0).getOutputPorts().iterator().next().getName());
  assertEquals(1, processor.getActivityList().get(1).getInputPorts().size());
  assertEquals("in", processor.getActivityList().get(1).getInputPorts().iterator().next().getName());
  assertEquals(1, processor.getActivityList().get(1).getOutputPorts().size());
  assertEquals("out", processor.getActivityList().get(1).getOutputPorts().iterator().next().getName());
  
  assertEquals(1, processor.getActivityList().get(1).getInputPortMapping().keySet().size());
  assertEquals("input", processor.getActivityList().get(1).getInputPortMapping().keySet().iterator().next());
  assertEquals(1, processor.getActivityList().get(1).getInputPortMapping().values().size());
  assertEquals("in", processor.getActivityList().get(1).getInputPortMapping().values().iterator().next());
  assertEquals(1, processor.getActivityList().get(1).getOutputPortMapping().keySet().size());
  assertEquals("output", processor.getActivityList().get(1).getOutputPortMapping().keySet().iterator().next());
  assertEquals(1, processor.getActivityList().get(1).getOutputPortMapping().values().size());
  assertEquals("out", processor.getActivityList().get(1).getOutputPortMapping().values().iterator().next());
}

代码示例来源:origin: net.sf.taverna.t2/cyclone-impl

@Test
public void testAlternateProcessorTranslation() throws Exception {
  Dataflow dataflow = translateScuflFile("alternate_test_workflow.xml");
  
  assertEquals(1, dataflow.getProcessors().size());
  Processor processor = dataflow.getProcessors().get(0);
  assertEquals(2, processor.getActivityList().size());
  
  assertEquals(1, processor.getActivityList().get(0).getInputPorts().size());
  assertEquals("input", processor.getActivityList().get(0).getInputPorts().iterator().next().getName());
  assertEquals(1, processor.getActivityList().get(0).getOutputPorts().size());
  assertEquals("output", processor.getActivityList().get(0).getOutputPorts().iterator().next().getName());
  assertEquals(1, processor.getActivityList().get(1).getInputPorts().size());
  assertEquals("in", processor.getActivityList().get(1).getInputPorts().iterator().next().getName());
  assertEquals(1, processor.getActivityList().get(1).getOutputPorts().size());
  assertEquals("out", processor.getActivityList().get(1).getOutputPorts().iterator().next().getName());
  
  assertEquals(1, processor.getActivityList().get(1).getInputPortMapping().keySet().size());
  assertEquals("input", processor.getActivityList().get(1).getInputPortMapping().keySet().iterator().next());
  assertEquals(1, processor.getActivityList().get(1).getInputPortMapping().values().size());
  assertEquals("in", processor.getActivityList().get(1).getInputPortMapping().values().iterator().next());
  assertEquals(1, processor.getActivityList().get(1).getOutputPortMapping().keySet().size());
  assertEquals("out", processor.getActivityList().get(1).getOutputPortMapping().keySet().iterator().next());
  assertEquals(1, processor.getActivityList().get(1).getOutputPortMapping().values().size());
  assertEquals("output", processor.getActivityList().get(1).getOutputPortMapping().values().iterator().next());
}

代码示例来源:origin: net.sf.taverna.t2.core/workflowmodel-api

/**
 * Create a DisabledActivity that represents a specific Activity that is now
 * disabled e.g. by its remote endpoint going offline. Note that in this
 * case, the ports of the DisabledActivity and their mapping to the
 * containing Processor's ports can be inherited from the Activity that is
 * now disabled.
 * 
 * @param activity The Activity that is now disabled.
 */
public DisabledActivity(Activity<?> activity) {
  this(activity, activity.getConfiguration());
  for (ActivityInputPort aip : activity.getInputPorts()) {
    this.addInput(aip.getName(), aip.getDepth(), aip
        .allowsLiteralValues(), aip.getHandledReferenceSchemes(),
        aip.getTranslatedElementClass());
  }
  for (OutputPort op : activity.getOutputPorts()) {
    this.addOutput(op.getName(), op.getDepth(), op.getGranularDepth());
  }
  this.getInputPortMapping().clear();
  this.getInputPortMapping().putAll(activity.getInputPortMapping());
  this.getOutputPortMapping().clear();
  this.getOutputPortMapping().putAll(activity.getOutputPortMapping());
}

代码示例来源:origin: uk.org.taverna.platform/taverna-capability-impl

@Override
public void addDynamicPorts(uk.org.taverna.scufl2.api.activity.Activity scufl2Activity,
    Configuration configuration) throws ActivityNotFoundException,
    ActivityConfigurationException {
  Activity<?> activity = createActivity(scufl2Activity.getConfigurableType(), configuration);
  Set<ActivityInputPort> inputPorts = activity.getInputPorts();
  for (ActivityInputPort inputPort : inputPorts) {
    InputActivityPort inputActivityPort = new InputActivityPort(scufl2Activity,
        inputPort.getName());
    inputActivityPort.setDepth(inputPort.getDepth());
  }
  Set<OutputPort> outputPorts = activity.getOutputPorts();
  for (OutputPort outputPort : outputPorts) {
    OutputActivityPort outputActivityPort = new OutputActivityPort(scufl2Activity,
        outputPort.getName());
    outputActivityPort.setDepth(outputPort.getDepth());
    outputActivityPort.setGranularDepth(outputPort.getGranularDepth());
  }
}

代码示例来源:origin: net.sf.taverna.t2/compatibility-impl

assertEquals(1, activity.getOutputPorts().size());
assertNotNull("No input named input2 found", in2);
Port out1 = (Port) activity.getOutputPorts().toArray()[0];

代码示例来源:origin: net.sf.taverna.t2/cyclone-impl

assertEquals(1, activity.getOutputPorts().size());
assertNotNull("No input named input2 found", in2);
Port out1 = (Port) activity.getOutputPorts().toArray()[0];

相关文章