summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2014-04-04 17:26:10 +0200
committerAndrew Branson <andrew.branson@cern.ch>2014-04-04 17:26:10 +0200
commit11e7a9aaed7c22ec93a791ea752e159b4b120e4e (patch)
tree8d8870aeeca417c3989312214ccf99818d143d65 /src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation
parentc672fa9d426beb92d9149ebc32c9cdf9bece7845 (diff)
Module XML now supports a workflowVer attribute for the Item element. If
not given, it assumed version 0, as per the previous behaviour. Fixes #180
Diffstat (limited to 'src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation')
-rw-r--r--src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewItem.java23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewItem.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewItem.java
index 5f8cf12..07b8462 100644
--- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewItem.java
+++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewItem.java
@@ -39,6 +39,7 @@ public class NewItem extends ModuleImport {
public String initialPath;
public String workflow;
+ public Integer workflowVer;
public ArrayList<Property> properties = new ArrayList<Property>();
public ArrayList<Aggregation> aggregationList = new ArrayList<Aggregation>();
public ArrayList<Dependency> dependencyList = new ArrayList<Dependency>();
@@ -48,11 +49,12 @@ public class NewItem extends ModuleImport {
public NewItem() {
}
- public NewItem(String name, String initialPath, String wf) {
+ public NewItem(String name, String initialPath, String wf, int wfVer) {
this();
this.name = name;
this.initialPath = initialPath;
this.workflow = wf;
+ this.workflowVer = wfVer;
}
public void setNamespace(String ns) {
@@ -82,11 +84,22 @@ public class NewItem extends ModuleImport {
// set the name property
properties.add(new Property("Name", name, true));
- // init the new item
+ // find workflow def
+ CompositeActivityDef compact;
+ // default workflow version is 0 if not given
+ int usedWfVer;
+ if (workflowVer == null) usedWfVer = 0;
+ else usedWfVer = workflowVer.intValue();
try {
-
- // find workflow def
- CompositeActivityDef compact = (CompositeActivityDef)LocalObjectLoader.getActDef(workflow, 0);
+ compact = (CompositeActivityDef)LocalObjectLoader.getActDef(workflow, usedWfVer);
+ } catch (ObjectNotFoundException ex) {
+ throw new CannotManageException("Could not find workflow "+workflow+"v"+usedWfVer+" for item "+domPath, "");
+ } catch (InvalidDataException e) {
+ throw new CannotManageException("Workflow def "+workflow+" v"+usedWfVer+" for item "+domPath+" was not valid", "");
+ }
+
+ try {
+ // initialise the new item with workflow and properties
newItem.initialise(
agentId,
Gateway.getMarshaller().marshall(new PropertyArrayList(properties)),