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 createActivityPortsFromProcessor(Activity activity, Processor processor) { for (InputProcessorPort processorPort : processor.getInputPorts()) { new InputActivityPort(activity, processorPort.getName()) .setDepth(processorPort.getDepth()); } for (OutputProcessorPort processorPort : processor.getOutputPorts()) { OutputActivityPort activityPort = new OutputActivityPort(activity, processorPort.getName()); activityPort.setDepth(processorPort.getDepth()); activityPort.setGranularDepth(processorPort.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); }
@Test public void testCorrectnessOfInScopeProcessorPort() { ProcessorBinding pb = new ProcessorBinding(); Processor processor = new Processor(); pb.setBoundProcessor(processor); ProcessorOutputPortBinding pipb = new ProcessorOutputPortBinding(); pipb.setParent(pb); OutputProcessorPort port = new OutputProcessorPort(); port.setParent(processor); pipb.setBoundProcessorPort(port); CorrectnessValidator cv = new CorrectnessValidator(); ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener(); cv.checkCorrectness(pipb, false, rcvl); Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems(); boolean problem = false; for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) { if (nlp.getBean().equals(pipb) && nlp.getFieldName().equals("boundProcessorPort") && nlp.getValue().equals(port)) { problem = true; } } assertFalse(problem); }
@Test public void createProcessorPortsFromActivityWithOverwrite() throws Exception { Activity a = new Activity(); new InputActivityPort(a, "in1"); new OutputActivityPort(a, "out1"); new OutputActivityPort(a, "out2").setDepth(1); Processor p = new Processor(); new InputProcessorPort(p, "other"); OutputProcessorPort toBeOverWritten = new OutputProcessorPort(p, "out1"); toBeOverWritten.setDepth(1); assertEquals(p, toBeOverWritten.getParent()); scufl2Tools.createProcessorPortsFromActivity(p, a); // Still there assertNotNull(p.getInputPorts().getByName("other")); // but out1 has been overwritten OutputProcessorPort pOut1 = p.getOutputPorts().getByName("out1"); assertNull(pOut1.getDepth()); assertNotSame(toBeOverWritten, pOut1); }
@Test public void createActivityPortsFromProcessorWithOverwrite() throws Exception { Processor p = new Processor(); new InputProcessorPort(p, "in1"); new OutputProcessorPort(p, "out1"); new OutputProcessorPort(p, "out2").setDepth(1); Activity a = new Activity(); new InputActivityPort(a, "other"); OutputActivityPort toBeOverWritten = new OutputActivityPort(a, "out1"); toBeOverWritten.setDepth(1); assertEquals(a, toBeOverWritten.getParent()); scufl2Tools.createActivityPortsFromProcessor(a, p); // Still there assertNotNull(a.getInputPorts().getByName("other")); // but out1 has been overwritten OutputActivityPort aOut1 = a.getOutputPorts().getByName("out1"); assertNull(aOut1.getDepth()); assertNotSame(toBeOverWritten, aOut1); }
new InputProcessorPort(processor, portName); } else { new OutputProcessorPort(processor, portName);
new InputProcessorPort(p, "in1"); new InputProcessorPort(p, "in2"); new OutputProcessorPort(p, "out1"); new OutputProcessorPort(p, "out2"); new OutputProcessorPort(p, "out3"); outBinding.getBoundProcessorPort().getName()); assertEquals(a, outBinding.getBoundActivityPort().getParent()); assertEquals(p, outBinding.getBoundProcessorPort().getParent());
assertEquals(null, pOut1.getDepth()); assertEquals(null, pOut1.getGranularDepth()); assertEquals(0, pOut2.getDepth().intValue()); assertEquals(null, pOut2.getGranularDepth()); assertEquals(2, pOut3.getDepth().intValue()); assertEquals(1, pOut3.getGranularDepth().intValue());
Integer portDepth = output.getDepth(); Integer resolvedDepth = portDepth + resultWrappingDepth; validatorState.get().getEventListener().depthResolution(output, resolvedDepth);
public void bindActivityToProcessorByMatchingPorts(ProcessorBinding binding) { Activity activity = binding.getBoundActivity(); Processor processor = binding.getBoundProcessor(); for (InputActivityPort activityPort : activity.getInputPorts()) { InputProcessorPort processorPort = processor.getInputPorts() .getByName(activityPort.getName()); if (processorPort != null && processorPortBindingInternalInBinding(processorPort, binding) == null) { new ProcessorInputPortBinding(binding, processorPort, activityPort); } } for (OutputProcessorPort processorPort : processor.getOutputPorts()) { OutputActivityPort activityPort = activity.getOutputPorts() .getByName(processorPort.getName()); if (activityPort != null && processorPortBindingInternalInBinding(activityPort, binding) == null) { new ProcessorOutputPortBinding(binding, activityPort, processorPort); } } }
/** * Constructs an <code>OutputProcessorPort</code> for the specified <code>Processor</code> with the * specified name. * <p> * The <code>OutputPort</code> is added to the <code>Processor</code> (if the * <code>Processor</code> is not <code>null</code>). * * @param parent * the <code>Processor</code> to add this <code>Port</code> to. Can be * <code>null</code> * @param name * the name of the <code>Port</code>. <strong>Must not</strong> be <code>null</code> * or an empty String. */ public OutputProcessorPort(Processor parent, String name) { super(name); setParent(parent); }
.getParent(); if (!upStream.contains(upstreamProc)) { upStream.add(upstreamProc);
OutputProcessorPort elsewherePort = new OutputProcessorPort(); elsewherePort.setParent(otherProcessor);
ipp.setDepth(0); OutputProcessorPort opp = new OutputProcessorPort(p, "out"); opp.setDepth(3);
@Test public void testCompletenessOfSpecifiedBoundProcessorPort() { ProcessorOutputPortBinding pipb = new ProcessorOutputPortBinding(); pipb.setBoundProcessorPort(new OutputProcessorPort()); CorrectnessValidator cv = new CorrectnessValidator(); ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener(); cv.checkCorrectness(pipb, true, rcvl); Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems(); boolean problem = false; for (NullFieldProblem nlp : nullFieldProblems) { if (nlp.getBean().equals(pipb) && nlp.getFieldName().equals("boundProcessorPort")) { problem = true; } } assertFalse(problem); }
+ escapeName(ip.getBoundProcessorPort().getName()) + "'");
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()); } }
p2.setParent(w); OutputProcessorPort opp = new OutputProcessorPort(); opp.setParent(p2);
port = objectFactory.createOutputProcessorPort(); port.setAbout(uri.toASCIIString()); port.setName(outPort.getName()); port.setPortDepth(makePortDepth(outPort.getDepth())); port.setGranularPortDepth(makeGranularPortDepth(outPort .getGranularDepth()));