Github user stain commented on a diff in the pull request:
https://github.com/apache/incubator-taverna-language/pull/41#discussion_r207915625
--- Diff:
taverna-scufl2-api/src/main/java/org/apache/taverna/scufl2/api/common/Scufl2Tools.java
---
@@ -752,6 +753,30 @@ public Activity createActivityFromProcessor(Processor
processor,
return activity;
}
+ public Configuration createNestedRelationship(Processor processor,
Workflow childWorkflow, Profile profile) {
+ if(processor.getParent() == null) {
+ throw new IllegalStateException("Processor " +
processor + " has no parent");
+ }
+ if(processor.getParent().getParent() !=
childWorkflow.getParent()) {
+ throw new IllegalStateException(
+ "Processor " + processor + " and
workflow " + childWorkflow + " are not in the same Workflow bundle");
+ }
+ if(nestedWorkflowForProcessor(processor, profile) != null) {
--- End diff --
These are good guards, but they should also be verified by separate
`@Test`s.
`nestedWorkflowForProcessor()` will detect if it's already a nested
workflow, but not if there's another activity on the processor. Although SCUFL2
allows multiple activities on the same processor (e.g. for `Failover`) this has
in practice not been used, so perhaps this test can check instead for any
existing activity on the processor, regardless of activity type?
---