From 24314dc1699c7e73048fa24e33729f1aa1ec0e86 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Fri, 6 Jul 2012 11:00:24 +0200 Subject: Modules serialize with Castor. Just about to remove the parsing. CastorXMLUtility is now a static member of gateway. Domain specific instances can be used by domain applications, but the maps do not interfere with the kernel. --- .../instance/predefined/CreateItemFromDescription.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/main/java/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java') diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java index 8c55f3a..71495c0 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java @@ -37,7 +37,6 @@ import com.c2kernel.property.Property; import com.c2kernel.property.PropertyArrayList; import com.c2kernel.property.PropertyDescriptionList; import com.c2kernel.property.PropertyUtility; -import com.c2kernel.utils.CastorXMLUtility; import com.c2kernel.utils.LocalObjectLoader; import com.c2kernel.utils.Logger; @@ -63,6 +62,7 @@ public class CreateItemFromDescription extends PredefinedStep String domPath = input[1]; CompositeActivityDef wfDef; String wfDefName = null; + String wfDefVer = null; if (input.length > 2) // override wf wfDefName = input[2]; @@ -90,13 +90,14 @@ public class CreateItemFromDescription extends PredefinedStep Collection thisCol = (Collection)storage.get(myPath.getSysKey(), ClusterStorage.COLLECTION+"/"+collName, null); if (thisCol instanceof CollectionDescription) { CollectionDescription thisDesc = (CollectionDescription)thisCol; - collections.add(CastorXMLUtility.marshall(thisDesc.newInstance())); + collections.add(Gateway.getMarshaller().marshall(thisDesc.newInstance())); } else if (thisCol.getName().equalsIgnoreCase("workflow") && wfDefName == null) { ArrayList members = thisCol.getMembers().list; // get the first member from the wf collection CollectionMember wfMember = members.get(0); wfDefName = wfMember.resolveEntity().getName(); + wfDefVer = (String)wfMember.getProperties().get("Version"); } } @@ -105,7 +106,7 @@ public class CreateItemFromDescription extends PredefinedStep throw new InvalidDataException("No workflow given or defined", ""); try { - wfDef = (CompositeActivityDef)LocalObjectLoader.getActDef(wfDefName, "last"); + wfDef = (CompositeActivityDef)LocalObjectLoader.getActDef(wfDefName, wfDefVer); } catch (ObjectNotFoundException ex) { throw new InvalidDataException("Workflow def '"+wfDefName+"' item not found", ""); } catch (ClassCastException ex) { @@ -150,8 +151,8 @@ public class CreateItemFromDescription extends PredefinedStep newItem.initialise( agent.getSysKey(), - CastorXMLUtility.marshall(props), - CastorXMLUtility.marshall(wfDef.instantiate())); + Gateway.getMarshaller().marshall(props), + Gateway.getMarshaller().marshall(wfDef.instantiate())); // add collections if (collections.size() > 0) { -- cgit v1.2.3