in taverna-workflowmodel-impl/src/main/java/org/apache/taverna/workflowmodel/impl/ProcessorImpl.java [208:273]
public boolean doTypeCheck() throws IterationTypeMismatchException,
InvalidDataflowException {
// Check for any nested dataflows, they should all be valid
for (Activity<?> activity : getActivityList())
if (activity instanceof NestedDataflow) {
NestedDataflow nestedDataflowActivity = (NestedDataflow) activity;
Dataflow nestedDataflow = nestedDataflowActivity
.getNestedDataflow();
DataflowValidationReport validity = nestedDataflow
.checkValidity();
if (!validity.isValid())
throw new InvalidDataflowException(nestedDataflow, validity);
}
/*
* Check whether all our input ports have inbound links
*/
Map<String, Integer> inputDepths = new HashMap<>();
for (ProcessorInputPortImpl input : inputPorts) {
if (input.getIncomingLink() == null)
return false;
if (input.getIncomingLink().getResolvedDepth() == -1)
/*
* Incoming link hasn't been resolved yet, can't do this
* processor at the moment
*/
return false;
// Get the conceptual resolved depth of the datalink
inputDepths.put(input.getName(), input.getIncomingLink()
.getResolvedDepth());
/*
* Configure the filter with the finest grained item from the link
* source
*/
input.setFilterDepth(input.getIncomingLink().getSource()
.getGranularDepth());
}
/*
* Got here so we have all the inputs, now test whether the iteration
* strategy typechecks correctly
*/
try {
this.resultWrappingDepth = iterationStack
.getIterationDepth(inputDepths);
for (BasicEventForwardingOutputPort output : outputPorts)
for (DatalinkImpl outgoingLink : output.outgoingLinks)
// Set the resolved depth on each output edge
outgoingLink.setResolvedDepth(this.resultWrappingDepth
+ output.getDepth());
} catch (MissingIterationInputException e) {
/*
* This should never happen as we only get here if we've already
* checked that all the inputs have been provided. If it does happen
* we've got some deeper issues.
*/
logger.error(e);
return false;
}
// If we get to here everything has been configured appropriately
return true;
}