From f09e07e3314bb9c0cb7a6da7055ecb01da3ed722 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Fri, 11 Apr 2014 17:03:38 +0200 Subject: OutcomeInitiator based description initialization. Absorbs all description editing from the kernel. Module.debug functionality missing - kernel now creates all imported module descriptions with NoWorkflow. Need a way to patch them in later (must be part of this module) --- .../c2kernel/dev/DevObjectOutcomeInitiator.java | 70 +++++++ .../resources/boot/CA/ManageCompositeActDef.xml | 208 ++++++++++++++++++++ .../resources/boot/CA/ManageElementaryActDef.xml | 208 ++++++++++++++++++++ src/main/resources/boot/CA/ManageSchema.xml | 213 ++++++++++++++++++++ src/main/resources/boot/CA/ManageScript.xml | 214 +++++++++++++++++++++ src/main/resources/boot/CA/ManageStateMachine.xml | 213 ++++++++++++++++++++ src/main/resources/boot/CA/SchemaFactoryWf.xml | 3 +- src/main/resources/boot/CA/ScriptFactoryWf.xml | 3 +- .../resources/boot/CA/StateMachineFactoryWf.xml | 113 +++++++++++ .../resources/boot/EA/AssignNewVersionFromLast.xml | 20 ++ src/main/resources/boot/EA/EditDefinition.xml | 14 ++ src/main/resources/boot/OD/NewLocalObjectDef.xsd | 24 --- .../boot/SC/CreateNewNumberedVersionFromLast.xml | 31 +++ .../resources/boot/SC/LocalObjectDefCreator.xml | 34 +--- src/main/resources/boot/property/SMProp.xml | 6 + src/main/resources/module.xml | 32 ++- 16 files changed, 1349 insertions(+), 57 deletions(-) create mode 100644 src/main/java/com/c2kernel/dev/DevObjectOutcomeInitiator.java create mode 100644 src/main/resources/boot/CA/ManageCompositeActDef.xml create mode 100644 src/main/resources/boot/CA/ManageElementaryActDef.xml create mode 100644 src/main/resources/boot/CA/ManageSchema.xml create mode 100644 src/main/resources/boot/CA/ManageScript.xml create mode 100644 src/main/resources/boot/CA/ManageStateMachine.xml create mode 100644 src/main/resources/boot/CA/StateMachineFactoryWf.xml create mode 100644 src/main/resources/boot/EA/AssignNewVersionFromLast.xml create mode 100644 src/main/resources/boot/EA/EditDefinition.xml delete mode 100644 src/main/resources/boot/OD/NewLocalObjectDef.xsd create mode 100644 src/main/resources/boot/SC/CreateNewNumberedVersionFromLast.xml create mode 100644 src/main/resources/boot/property/SMProp.xml (limited to 'src') diff --git a/src/main/java/com/c2kernel/dev/DevObjectOutcomeInitiator.java b/src/main/java/com/c2kernel/dev/DevObjectOutcomeInitiator.java new file mode 100644 index 0000000..be0c996 --- /dev/null +++ b/src/main/java/com/c2kernel/dev/DevObjectOutcomeInitiator.java @@ -0,0 +1,70 @@ +package com.c2kernel.dev; + +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.entity.agent.Job; +import com.c2kernel.entity.proxy.ItemProxy; +import com.c2kernel.lifecycle.ActivityDef; +import com.c2kernel.lifecycle.CompositeActivityDef; +import com.c2kernel.lifecycle.instance.stateMachine.StateMachine; +import com.c2kernel.lookup.DomainPath; +import com.c2kernel.persistency.outcome.OutcomeInitiator; +import com.c2kernel.persistency.outcome.Viewpoint; +import com.c2kernel.process.Gateway; +import com.c2kernel.utils.DescriptionObject; +import com.c2kernel.utils.Logger; + +public class DevObjectOutcomeInitiator implements OutcomeInitiator { + + public DevObjectOutcomeInitiator() { + } + + @Override + public String initOutcome(Job job) throws InvalidDataException { + String type = job.getActPropString("SchemaType"); + + // create empty object for activities and state machine + DescriptionObject emptyObj = null; + if (type.equals("CompositeActivityDef")) + emptyObj = new CompositeActivityDef(); + else if (type.equals("ElementaryActivityDef")) + emptyObj = new ActivityDef(); + else if (type.equals("StateMachine")) + emptyObj = new StateMachine(); + + if (emptyObj != null) { + try { + emptyObj.setName(job.getItemProxy().getName()); + return Gateway.getMarshaller().marshall(emptyObj); + } catch (Exception e) { + Logger.error("Error creating empty "+type); + Logger.error(e); + return null; + } + } + + // else load empty one from factory + DomainPath factoryPath; String schema; + if (type.equals("Schema")) { + factoryPath = new DomainPath("/desc/dev/SchemaFactory"); + schema = "Schema"; + } + else if (type.equals("Script")) { + factoryPath = new DomainPath("/desc/dev/ScriptFactory"); + schema = "Script"; + } + else + throw new InvalidDataException("Unknown dev object type: "+type, ""); + ItemProxy factory; + Viewpoint newInstance; + try { + factory = (ItemProxy) Gateway.getProxyManager().getProxy(factoryPath); + newInstance = factory.getViewpoint(schema, "last"); + return newInstance.getOutcome().getData(); + } catch (Exception e) { + Logger.error(e); + throw new InvalidDataException("Error loading new "+schema); + } + + } + +} diff --git a/src/main/resources/boot/CA/ManageCompositeActDef.xml b/src/main/resources/boot/CA/ManageCompositeActDef.xml new file mode 100644 index 0000000..ea0655a --- /dev/null +++ b/src/main/resources/boot/CA/ManageCompositeActDef.xml @@ -0,0 +1,208 @@ + + + + + + + + + + 19 + 20 + 21 + + + + + + + + + + + + 17 + 20 + 18 + + + + + + + + + + + 16 + 17 + + + + + + + + + 8 + 21 + + + + + + + + + + + 25 + 7 + 8 + + + + + + + + + + + + 18 + 19 + + + + + AssignNewVersionFromLast + + + + + + + + 7 + 16 + 24 + + + + + + + + + + + 24 + 25 + + + + + EditDefinition + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/boot/CA/ManageElementaryActDef.xml b/src/main/resources/boot/CA/ManageElementaryActDef.xml new file mode 100644 index 0000000..a1ba712 --- /dev/null +++ b/src/main/resources/boot/CA/ManageElementaryActDef.xml @@ -0,0 +1,208 @@ + + + + + + + + + + 19 + 20 + 21 + + + + + + + + + + + + 17 + 20 + 18 + + + + + + + + + + + 8 + 21 + + + + + + + + + + + 16 + 17 + + + + + + + + + 25 + 7 + 8 + + + + + + + + + + + + 7 + 16 + 24 + + + + + + + + + + + 18 + 19 + + + + + AssignNewVersionFromLast + + + + + + + + 24 + 25 + + + + + EditDefinition + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/boot/CA/ManageSchema.xml b/src/main/resources/boot/CA/ManageSchema.xml new file mode 100644 index 0000000..cee6b33 --- /dev/null +++ b/src/main/resources/boot/CA/ManageSchema.xml @@ -0,0 +1,213 @@ + + + + + + + + + + 19 + 20 + 21 + + + + + + + + + + + + + 17 + 20 + 18 + + + + + + + + + + + 16 + 17 + + + + + + + + + + + + 8 + 21 + + + + + + + + + + + 6 + 7 + 8 + + + + + + + + + + + + + 18 + 19 + + + + + AssignNewVersionFromLast + + + + + + + + 7 + 16 + 5 + + + + + + + + + + + 5 + 6 + + + + + EditDefinition + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/boot/CA/ManageScript.xml b/src/main/resources/boot/CA/ManageScript.xml new file mode 100644 index 0000000..f42d1b7 --- /dev/null +++ b/src/main/resources/boot/CA/ManageScript.xml @@ -0,0 +1,214 @@ + + + + + + + + + + 24 + 25 + 26 + + + + + + + + + + + + + 21 + 22 + 23 + + + + + + + + + + + + + 18 + 25 + 20 + + + + + + + + + + + 17 + 23 + 19 + + + + + + + + + + + 17 + 18 + + + + + + + + + + + + 19 + 21 + + + + + EditDefinition + + + + + + + + 20 + 24 + + + + + AssignNewVersionFromLast + + + + + + + + 22 + 26 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/boot/CA/ManageStateMachine.xml b/src/main/resources/boot/CA/ManageStateMachine.xml new file mode 100644 index 0000000..16b5de7 --- /dev/null +++ b/src/main/resources/boot/CA/ManageStateMachine.xml @@ -0,0 +1,213 @@ + + + + + + + + + + 19 + 20 + 21 + + + + + + + + + + + + + 17 + 20 + 18 + + + + + + + + + + + 16 + 17 + + + + + + + + + + + + 8 + 21 + + + + + + + + + + + 6 + 7 + 8 + + + + + + + + + + + + + 18 + 19 + + + + + AssignNewVersionFromLast + + + + + + + + 7 + 16 + 5 + + + + + + + + + + + 5 + 6 + + + + + EditDefinition + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/boot/CA/SchemaFactoryWf.xml b/src/main/resources/boot/CA/SchemaFactoryWf.xml index 9b709fd..fc5928b 100644 --- a/src/main/resources/boot/CA/SchemaFactoryWf.xml +++ b/src/main/resources/boot/CA/SchemaFactoryWf.xml @@ -54,8 +54,9 @@ + - EditSchema + EditDefinition diff --git a/src/main/resources/boot/CA/ScriptFactoryWf.xml b/src/main/resources/boot/CA/ScriptFactoryWf.xml index 0eb7cb6..7f2e203 100644 --- a/src/main/resources/boot/CA/ScriptFactoryWf.xml +++ b/src/main/resources/boot/CA/ScriptFactoryWf.xml @@ -101,8 +101,9 @@ + - EditScriptDefinition + EditDefinition diff --git a/src/main/resources/boot/CA/StateMachineFactoryWf.xml b/src/main/resources/boot/CA/StateMachineFactoryWf.xml new file mode 100644 index 0000000..07a5af1 --- /dev/null +++ b/src/main/resources/boot/CA/StateMachineFactoryWf.xml @@ -0,0 +1,113 @@ + + + + + + + + + + 9 + + + + + + + + + + + 7 + 12 + + + + + + + + + + + 13 + 7 + 9 + + + + + + + + + + + + 12 + 13 + + + + + + CreateNewLocalObjectDef + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CreateNewLocalObjectDef + diff --git a/src/main/resources/boot/EA/AssignNewVersionFromLast.xml b/src/main/resources/boot/EA/AssignNewVersionFromLast.xml new file mode 100644 index 0000000..248dfee --- /dev/null +++ b/src/main/resources/boot/EA/AssignNewVersionFromLast.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/boot/EA/EditDefinition.xml b/src/main/resources/boot/EA/EditDefinition.xml new file mode 100644 index 0000000..8fbe25b --- /dev/null +++ b/src/main/resources/boot/EA/EditDefinition.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/main/resources/boot/OD/NewLocalObjectDef.xsd b/src/main/resources/boot/OD/NewLocalObjectDef.xsd deleted file mode 100644 index 2df4037..0000000 --- a/src/main/resources/boot/OD/NewLocalObjectDef.xsd +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - Please give a name for your new object. - - - - - - If you want to store your object in a subfolder, - give the subpath here. - - - - - - diff --git a/src/main/resources/boot/SC/CreateNewNumberedVersionFromLast.xml b/src/main/resources/boot/SC/CreateNewNumberedVersionFromLast.xml new file mode 100644 index 0000000..7a63b76 --- /dev/null +++ b/src/main/resources/boot/SC/CreateNewNumberedVersionFromLast.xml @@ -0,0 +1,31 @@ + + + + + diff --git a/src/main/resources/boot/SC/LocalObjectDefCreator.xml b/src/main/resources/boot/SC/LocalObjectDefCreator.xml index de082dc..28eac12 100644 --- a/src/main/resources/boot/SC/LocalObjectDefCreator.xml +++ b/src/main/resources/boot/SC/LocalObjectDefCreator.xml @@ -2,16 +2,17 @@