public Processor createConstant(Workflow workflow, Profile profile, String name) { Processor processor = new Processor(null, name); workflow.getProcessors().addWithUniqueName(processor); processor.setParent(workflow); OutputProcessorPort valuePort = new OutputProcessorPort(processor, CONSTANT_VALUE_PORT); valuePort.setDepth(0); valuePort.setGranularDepth(0); Activity activity = createActivityFromProcessor(processor, profile); activity.setType(CONSTANT); createConfigurationFor(activity, CONSTANT_CONFIG); return processor; }
public void createProcessorPortsFromActivity(Processor processor, Activity activity) { for (InputActivityPort activityPort : activity.getInputPorts()) { new InputProcessorPort(processor, activityPort.getName()) .setDepth(activityPort.getDepth()); } for (OutputActivityPort activityPort : activity.getOutputPorts()) { OutputProcessorPort procPort = new OutputProcessorPort(processor, activityPort.getName()); procPort.setDepth(activityPort.getDepth()); procPort.setGranularDepth(activityPort.getGranularDepth()); } }
protected void processorOutputProcessorPort( uk.org.taverna.scufl2.rdfxml.jaxb.OutputProcessorPort original) { uk.org.taverna.scufl2.api.port.OutputProcessorPort port = new uk.org.taverna.scufl2.api.port.OutputProcessorPort(); port.setName(original.getName()); if (original.getPortDepth() != null) { port.setDepth(original.getPortDepth().getValue()); } if (original.getGranularPortDepth() != null) { port.setGranularDepth(original.getGranularPortDepth().getValue()); } port.setParent(getParserState().getCurrent( uk.org.taverna.scufl2.api.core.Processor.class)); mapBean(getParserState().getCurrentBase().resolve(original.getAbout()), port); }
public Processor makeProcessor() { processor = new Processor(workflow, "Hello"); processorName = new InputProcessorPort(processor, "name"); processorName.setDepth(0); processorGreeting = new OutputProcessorPort(processor, "greeting"); processorGreeting.setDepth(0); processorGreeting.setGranularDepth(0); // FIXME: Should not need to make default iteration stack makeIterationStrategyStack(processorName).setParent(processor); return processor; }
@Test public void createActivityFromProcessor() throws Exception { Processor p = new Processor(); new InputProcessorPort(p, "in1"); new InputProcessorPort(p, "in2").setDepth(1); new OutputProcessorPort(p, "out1"); new OutputProcessorPort(p, "out2").setDepth(0); OutputProcessorPort pOut3 = new OutputProcessorPort(p, "out3"); pOut3.setDepth(2); pOut3.setGranularDepth(1); Profile profile = new Profile(); Activity a = scufl2Tools.createActivityFromProcessor(p, profile); assertEquals(profile, a.getParent()); ProcessorBinding binding = scufl2Tools.processorBindingForProcessor(p, profile); assertEquals(2, a.getInputPorts().size()); assertEquals(3, a.getOutputPorts().size()); assertEquals(2, binding.getInputPortBindings().size()); assertEquals(3, binding.getOutputPortBindings().size()); assertEquals(a, binding.getBoundActivity()); assertEquals(p, binding.getBoundProcessor()); }