summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/lifecycle
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2012-05-30 08:37:45 +0200
committerAndrew Branson <andrew.branson@cern.ch>2012-05-30 08:37:45 +0200
commitb086f57f56bf0eb9dab9cf321a0f69aaaae84347 (patch)
tree8e6e26e8b7eed6abad7a17b093bdbb55c5e6b1ba /source/com/c2kernel/lifecycle
parent22088ae8d2d5ff390518dbe1c4372325ffb3a647 (diff)
Initial Maven Conversion
Diffstat (limited to 'source/com/c2kernel/lifecycle')
-rw-r--r--source/com/c2kernel/lifecycle/ActivityDef.java143
-rw-r--r--source/com/c2kernel/lifecycle/ActivitySlotDef.java156
-rw-r--r--source/com/c2kernel/lifecycle/AndSplitDef.java114
-rw-r--r--source/com/c2kernel/lifecycle/CompositeActivityDef.java227
-rw-r--r--source/com/c2kernel/lifecycle/JoinDef.java68
-rw-r--r--source/com/c2kernel/lifecycle/LoopDef.java78
-rw-r--r--source/com/c2kernel/lifecycle/NextDef.java95
-rw-r--r--source/com/c2kernel/lifecycle/OrSplitDef.java24
-rw-r--r--source/com/c2kernel/lifecycle/WfCastorHashMap.java33
-rw-r--r--source/com/c2kernel/lifecycle/WfVertexDef.java83
-rw-r--r--source/com/c2kernel/lifecycle/XOrSplitDef.java29
-rw-r--r--source/com/c2kernel/lifecycle/chooser/ActivityChooser.java194
-rw-r--r--source/com/c2kernel/lifecycle/chooser/LDAPEntryChooser.java70
-rw-r--r--source/com/c2kernel/lifecycle/chooser/LDAPFileChooser.java121
-rw-r--r--source/com/c2kernel/lifecycle/chooser/WorkflowDialogue.java20
-rw-r--r--source/com/c2kernel/lifecycle/gui/model/WfDefGraphPanel.java59
-rw-r--r--source/com/c2kernel/lifecycle/gui/model/WfEdgeDefFactory.java30
-rw-r--r--source/com/c2kernel/lifecycle/gui/model/WfVertexDefFactory.java97
-rw-r--r--source/com/c2kernel/lifecycle/gui/model/WfVertexDefOutlineCreator.java51
-rw-r--r--source/com/c2kernel/lifecycle/gui/view/ActivitySlotDefRenderer.java71
-rw-r--r--source/com/c2kernel/lifecycle/gui/view/CompActDefOutcomeHandler.java233
-rw-r--r--source/com/c2kernel/lifecycle/gui/view/ElemActDefOutcomeHandler.java161
-rw-r--r--source/com/c2kernel/lifecycle/gui/view/SplitJoinDefRenderer.java138
-rw-r--r--source/com/c2kernel/lifecycle/gui/view/WfDirectedEdgeDefRenderer.java134
-rw-r--r--source/com/c2kernel/lifecycle/gui/view/WfVertexDefRenderer.java30
-rw-r--r--source/com/c2kernel/lifecycle/instance/Activity.java689
-rw-r--r--source/com/c2kernel/lifecycle/instance/AdvancementCalculator.java225
-rw-r--r--source/com/c2kernel/lifecycle/instance/AndSplit.java27
-rw-r--r--source/com/c2kernel/lifecycle/instance/CompositeActivity.java458
-rwxr-xr-xsource/com/c2kernel/lifecycle/instance/EventList.java19
-rw-r--r--source/com/c2kernel/lifecycle/instance/EventStorage.java24
-rw-r--r--source/com/c2kernel/lifecycle/instance/JobPusher.java70
-rw-r--r--source/com/c2kernel/lifecycle/instance/Join.java216
-rw-r--r--source/com/c2kernel/lifecycle/instance/Loop.java107
-rw-r--r--source/com/c2kernel/lifecycle/instance/Next.java83
-rw-r--r--source/com/c2kernel/lifecycle/instance/OrSplit.java62
-rw-r--r--source/com/c2kernel/lifecycle/instance/ParserWF.java356
-rw-r--r--source/com/c2kernel/lifecycle/instance/Split.java225
-rw-r--r--source/com/c2kernel/lifecycle/instance/WfVertex.java180
-rw-r--r--source/com/c2kernel/lifecycle/instance/Workflow.java208
-rw-r--r--source/com/c2kernel/lifecycle/instance/XOrSplit.java54
-rw-r--r--source/com/c2kernel/lifecycle/instance/gui/model/WfEdgeFactory.java35
-rw-r--r--source/com/c2kernel/lifecycle/instance/gui/model/WfGraphPanel.java59
-rw-r--r--source/com/c2kernel/lifecycle/instance/gui/model/WfVertexFactory.java92
-rw-r--r--source/com/c2kernel/lifecycle/instance/gui/model/WfVertexOutlineCreator.java52
-rw-r--r--source/com/c2kernel/lifecycle/instance/gui/view/ActivityRenderer.java117
-rw-r--r--source/com/c2kernel/lifecycle/instance/gui/view/FindActDefPanel.java72
-rw-r--r--source/com/c2kernel/lifecycle/instance/gui/view/SplitJoinRenderer.java142
-rw-r--r--source/com/c2kernel/lifecycle/instance/gui/view/TransitionPanel.java187
-rw-r--r--source/com/c2kernel/lifecycle/instance/gui/view/WfDirectedEdgeRenderer.java130
-rw-r--r--source/com/c2kernel/lifecycle/instance/gui/view/WfVertexRenderer.java23
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/AddC2KObject.java75
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/AddDomainPath.java67
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/AddStepsFromDescription.java56
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/AssignItemToSlot.java116
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java183
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/Erase.java85
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/Import.java71
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/PredefinedStep.java156
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/PredefinedStepContainer.java61
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/RemoveC2KObject.java67
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java59
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/ReplaceDomainWorkflow.java53
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/ServerPredefinedStepContainer.java41
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/WriteProperty.java77
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Aggregation.java25
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/entitycreation/AggregationMember.java21
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/entitycreation/CreateNewAgent.java49
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/entitycreation/CreateNewItem.java46
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Dependency.java44
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/entitycreation/DependencyMember.java18
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Geometry.java29
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java63
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewItem.java141
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Property.java26
-rw-r--r--source/com/c2kernel/lifecycle/instance/stateMachine/StateMachine.java142
-rw-r--r--source/com/c2kernel/lifecycle/instance/stateMachine/States.java40
-rw-r--r--source/com/c2kernel/lifecycle/instance/stateMachine/Transitions.java41
-rw-r--r--source/com/c2kernel/lifecycle/routingHelpers/ViewpointDataHelper.java79
79 files changed, 0 insertions, 8302 deletions
diff --git a/source/com/c2kernel/lifecycle/ActivityDef.java b/source/com/c2kernel/lifecycle/ActivityDef.java
deleted file mode 100644
index 235275f..0000000
--- a/source/com/c2kernel/lifecycle/ActivityDef.java
+++ /dev/null
@@ -1,143 +0,0 @@
-package com.c2kernel.lifecycle;
-import java.util.Vector;
-
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.ObjectNotFoundException;
-import com.c2kernel.entity.C2KLocalObject;
-import com.c2kernel.lifecycle.instance.Activity;
-import com.c2kernel.lifecycle.instance.WfVertex;
-import com.c2kernel.lifecycle.instance.stateMachine.StateMachine;
-import com.c2kernel.utils.FileStringUtility;
-/**
- * @version $Revision: 1.45 $ $Date: 2005/10/05 07:39:36 $
- * @author $Author: abranson $
- */
-public class ActivityDef extends WfVertexDef implements C2KLocalObject
-{
- private int mId = -1;
- private String mName = "";
- private String mVersion = "";
- public boolean changed = false;
- /**
- * @see java.lang.Object#Object()
- */
- public ActivityDef()
- {
- mErrors = new Vector<String>(0, 1);
- setProperties(new WfCastorHashMap());
- setIsLayoutable(false);
- getProperties().put(StateMachine.SKIPPABLE, new Boolean(false));
- getProperties().put(StateMachine.REPEATABLE, new Boolean(false));
- getProperties().put(StateMachine.IGNORABLE, new Boolean(false));
- }
- /**
- * @see com.c2kernel.graph.model.Vertex#setID(int)
- */
- @Override
- public void setID(int id)
- {
- mId = id;
- if (mName.equals(""))
- setName(String.valueOf(id));
- }
- /**
- * @see com.c2kernel.graph.model.Vertex#getID()
- */
- @Override
- public int getID()
- {
- return mId;
- }
- /**
- * @see com.c2kernel.graph.model.Vertex#setName(java.lang.String)
- */
- @Override
- public void setName(String n)
- {
- mName = n;
- }
- /**
- * @see com.c2kernel.graph.model.Vertex#getName()
- */
- @Override
- public String getName()
- {
- return mName;
- }
-
- public void setVersion(String v)
- {
- mVersion = v;
- }
- /**
- * @see com.c2kernel.graph.model.Vertex#getName()
- */
- public String getVersion()
- {
- return mVersion;
- }
- /**
- * @see com.c2kernel.lifecycle.WfVertexDef#getErrors()
- */
- @Override
- public String getErrors()
- {
- return super.getErrors();
- }
- /**
- * Method linkToSlot.
- *
- * @param actSl
- * @param name
- */
- public void linkToSlot(ActivitySlotDef actSl, String name, String name2)
- {
- actSl.setActivityDef(FileStringUtility.convert(name));
- actSl.getProperties().put("Name", name2.replace('/', '_'));
- actSl.setName(name+" slot");
- setName(FileStringUtility.convert(name));
- }
- /**
- * @see com.c2kernel.lifecycle.WfVertexDef#verify()
- */
- @Override
- public boolean verify()
- {
- return true;
- }
- /**
- * @see com.c2kernel.entity.C2KLocalObject#getClusterType()
- */
- @Override
- public String getClusterType()
- {
- return null;
- }
- public String getActName()
- {
- return getName();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.c2kernel.lifecycle.commonInterface.ActType#getDescName()
- */
- public String getDescName()
- {
- return getName();
- }
-
- @Override
- public WfVertex instantiate() throws ObjectNotFoundException, InvalidDataException{
- return instantiate(getName());
- }
- public WfVertex instantiate(String name) throws ObjectNotFoundException, InvalidDataException
- {
- Activity act = new Activity();
- configureInstance(act);
- act.setName(name);
- act.setType(getName());
- return act;
- }
-}
diff --git a/source/com/c2kernel/lifecycle/ActivitySlotDef.java b/source/com/c2kernel/lifecycle/ActivitySlotDef.java
deleted file mode 100644
index 74d8305..0000000
--- a/source/com/c2kernel/lifecycle/ActivitySlotDef.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package com.c2kernel.lifecycle;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.ObjectNotFoundException;
-import com.c2kernel.graph.model.Vertex;
-import com.c2kernel.graph.traversal.GraphTraversal;
-import com.c2kernel.lifecycle.instance.Activity;
-import com.c2kernel.lifecycle.instance.WfVertex;
-import com.c2kernel.utils.KeyValuePair;
-import com.c2kernel.utils.LocalObjectLoader;
-/**
- * @version $Revision: 1.46 $ $Date: 2005/10/05 07:39:36 $
- * @author $Author: abranson $
- */
-public class ActivitySlotDef extends WfVertexDef
-{
- private String activityDef;
-
- /**
- * Method setActivityDef.
- *
- * @param oActivityDef
- */
- public void setActivityDef(String oActivityDef)
- {
- activityDef = oActivityDef;
- }
- /**
- * Method getActivityDef.
- *
- * @return String
- */
- public String getActivityDef()
- {
- return activityDef;
- }
- /**
- * @see java.lang.Object#Object()
- */
- public ActivitySlotDef()
- {
- getProperties().put("Name", "");
- getProperties().put("Version", "last");
- }
-
- public ActivityDef getTheActivityDef() throws ObjectNotFoundException, InvalidDataException
- {
- ActivityDef actDef = LocalObjectLoader.getActDef(getActivityDef(), getActVersion());
- if (actDef instanceof CompositeActivityDef)
- mIsComposite = true;
- return actDef;
- }
- /**
- * @see com.c2kernel.lifecycle.WfVertexDef#verify()
- */
- /** launch the verification of the ActivityDef */
- @Override
- public boolean verify()
- {
- mErrors.removeAllElements();
- boolean err = true;
- int nbInEdgres = getInEdges().length;
- int nbOutEdges = getOutEdges().length;
- if (nbInEdgres == 0 && this.getID() != getParent().getChildrenGraphModel().getStartVertexId())
- {
- mErrors.add("Unreachable");
- err = false;
- }
- else if (nbInEdgres > 1)
- {
- mErrors.add("Bad nb of previous");
- err = false;
- }
- else if (nbOutEdges > 1)
- {
- mErrors.add("too many next");
- err = false;
- }
- else if (nbOutEdges == 0)
- {
- if (!((CompositeActivityDef) getParent()).hasGoodNumberOfActivity())
- {
- mErrors.add("too many endpoints");
- err = false;
- }
- }
- else
- {
- Vertex[] outV = getOutGraphables();
- Vertex[] anteVertices = GraphTraversal.getTraversal(getParent().getChildrenGraphModel(), this, GraphTraversal.kUp, false);
- boolean errInLoop = false;
- for (Vertex element : outV) {
- for (Vertex anteVertice : anteVertices)
- if (!loop() && element.getID() == anteVertice.getID())
- errInLoop = true;
- }
- if (errInLoop)
- {
- mErrors.add("Problem in Loop");
- err = false;
- }
- }
- return err;
- }
- /**
- * Method getNextWfVertices.
- *
- * @return WfVertexDef[]
- */
- public WfVertexDef[] getNextWfVertices()
- {
- return (WfVertexDef[]) getOutGraphables();
- }
- /**
- * @see com.c2kernel.graph.model.GraphableVertex#isLayoutable()
- */
- /**
- * @see com.c2kernel.graph.model.GraphableVertex#getIsLayoutable()
- */
- public boolean isLayoutable()
- {
- return true;
- }
- /**
- * Method getInfo.
- *
- * @return CastorHashMap
- */
- public void configureInstance(Activity act)
- {
- KeyValuePair[] k = getProperties().getKeyValuePairs();
- for (KeyValuePair element : k)
- act.getProperties().put(element.getKey(), element.getValue());
- act.setCentrePoint(getCentrePoint());
- act.setOutlinePoints(getOutlinePoints());
- act.setInEdgeIds(getInEdgeIds());
- act.setOutEdgeIds(getOutEdgeIds());
- act.setName(getActName());
- act.setID(getID());
- }
-
- public String getActName()
- {
- return (String) getProperties().get("Name");
- }
- public String getActVersion()
- {
- return (String) getProperties().get("Version");
- }
-
- @Override
- public WfVertex instantiate() throws ObjectNotFoundException, InvalidDataException {
- Activity newActivity = (Activity)getTheActivityDef().instantiate();
- configureInstance(newActivity);
- return newActivity;
- }
-}
diff --git a/source/com/c2kernel/lifecycle/AndSplitDef.java b/source/com/c2kernel/lifecycle/AndSplitDef.java
deleted file mode 100644
index af87b18..0000000
--- a/source/com/c2kernel/lifecycle/AndSplitDef.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package com.c2kernel.lifecycle;
-
-import java.util.Vector;
-
-import com.c2kernel.graph.model.Vertex;
-import com.c2kernel.graph.traversal.GraphTraversal;
-import com.c2kernel.lifecycle.instance.AndSplit;
-import com.c2kernel.lifecycle.instance.WfVertex;
-/**
- * @version $Revision: 1.19 $ $Date: 2005/09/29 10:18:31 $
- * @author $Author: abranson $
- */
-
-public class AndSplitDef extends WfVertexDef
-{
- /**
- * @see java.lang.Object#Object()
- */
- public AndSplitDef()
- {
- mErrors = new Vector<String>(0, 1);
- getProperties().put("RoutingScriptName", "");
- getProperties().put("RoutingScriptVersion", "");
- }
-
- /**
- * @see com.c2kernel.lifecycle.WfVertexDef#verify()
- */
- @Override
- public boolean verify()
- {
- mErrors.removeAllElements();
- boolean err = true;
- int nbInEdges = getInEdges().length;
- if (nbInEdges == 0 && this.getID() != getParent().getChildrenGraphModel().getStartVertexId())
- {
- mErrors.add("Unreachable");
- err = false;
- }
- else if (nbInEdges > 1)
- {
- mErrors.add("Bad nb of previous");
- err = false;
- }
- else
- {
- if (getOutEdges().length <= 1)
- {
- mErrors.add("not enough next");
- err = false;
- }
- else if (!(this instanceof LoopDef))
- {
- Vertex[] outV = getOutGraphables();
- Vertex[] anteVertices =
- GraphTraversal.getTraversal(getParent().getChildrenGraphModel(), this, GraphTraversal.kUp, false);
- boolean loop = false;
- boolean errInLoop = true;
- for (int i = 0; i < outV.length; i++)
- {
- for (int j = 0; j < anteVertices.length; j++)
- if (!loop && outV[i].getID() == anteVertices[j].getID())
- {
- if (outV[i] instanceof LoopDef)
- {
- loop = true;
- j = anteVertices.length;
- i = outV.length;
- }
- else
- {
- errInLoop = false;
- }
- }
- }
- if (errInLoop && loop)
- {
- mErrors.add("Problem in Loop");
- err = false;
- }
- }
- }
- return err;
- }
-
- @Override
- public boolean loop()
- {
- boolean loop2 = false;
- if (!loopTested)
- {
- loopTested = true;
- if (getOutGraphables().length != 0)
- {
- Vertex[] outVertices = getOutGraphables();
- for (int i = 0; i < outVertices.length; i++)
- {
- WfVertexDef tmp = (WfVertexDef) getOutGraphables()[i];
- loop2 = loop2 || tmp.loop();
- }
- }
- }
- loopTested = false;
- return loop2;
- }
-
- @Override
- public WfVertex instantiate() {
- AndSplit newSplit = new AndSplit();
- configureInstance(newSplit);
- return newSplit;
- }
-
-}
diff --git a/source/com/c2kernel/lifecycle/CompositeActivityDef.java b/source/com/c2kernel/lifecycle/CompositeActivityDef.java
deleted file mode 100644
index 86b6f88..0000000
--- a/source/com/c2kernel/lifecycle/CompositeActivityDef.java
+++ /dev/null
@@ -1,227 +0,0 @@
-package com.c2kernel.lifecycle;
-import java.awt.Point;
-
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.ObjectNotFoundException;
-import com.c2kernel.graph.model.GraphModel;
-import com.c2kernel.graph.model.GraphPoint;
-import com.c2kernel.graph.model.GraphableVertex;
-import com.c2kernel.graph.model.TypeNameAndConstructionInfo;
-import com.c2kernel.lifecycle.gui.model.WfVertexDefOutlineCreator;
-import com.c2kernel.lifecycle.instance.CompositeActivity;
-import com.c2kernel.lifecycle.instance.Next;
-import com.c2kernel.lifecycle.instance.WfVertex;
-import com.c2kernel.utils.Language;
-import com.c2kernel.utils.Logger;
-/**
- * @version $Revision: 1.93 $ $Date: 2005/10/05 07:39:36 $
- * @author $Author: abranson $
- */
-public class CompositeActivityDef extends ActivityDef
-{
- private final TypeNameAndConstructionInfo[] mVertexTypeNameAndConstructionInfo =
- {
- new TypeNameAndConstructionInfo(Language.translate("Atomic"), "Atomic"),
- new TypeNameAndConstructionInfo(Language.translate("Composite"), "Composite"),
- new TypeNameAndConstructionInfo(Language.translate("AND Split"), "And"),
- new TypeNameAndConstructionInfo(Language.translate("OR Split"), "Or"),
- new TypeNameAndConstructionInfo(Language.translate("XOR Split"), "XOr"),
- new TypeNameAndConstructionInfo(Language.translate("Junction"), "Join"),
- new TypeNameAndConstructionInfo(Language.translate("Loop"), "Loop"),
- };
- private final TypeNameAndConstructionInfo[] mEdgeTypeNameAndConstructionInfo =
- {
- new TypeNameAndConstructionInfo(Language.translate("Next Edge"), "Next")
- };
- public TypeNameAndConstructionInfo[] getVertexTypeNameAndConstructionInfo()
- {
- return mVertexTypeNameAndConstructionInfo;
- }
- public TypeNameAndConstructionInfo[] getEdgeTypeNameAndConstructionInfo()
- {
- return mEdgeTypeNameAndConstructionInfo;
- }
-
- public CompositeActivityDef()
- {
- super();
- setChildrenGraphModel(new GraphModel(new WfVertexDefOutlineCreator()));
- setIsComposite(true);
- }
-
- /**
- * Method addNextDef.
- *
- * @param origin
- * @param terminus
- * @return NextDef
- */
- public NextDef addNextDef(WfVertexDef origin, WfVertexDef terminus)
- {
- NextDef returnNxt = new NextDef(origin, terminus);
- getChildrenGraphModel().addEdgeAndCreateId(returnNxt, origin, terminus);
- return returnNxt;
- }
- /**
- * Method addExistingActivityDef.
- *
- * @param actDef
- * @param point
- */
- public ActivitySlotDef addExistingActivityDef(String name, ActivityDef actDef, GraphPoint point)
- {
- changed = true;
- ActivitySlotDef child = new ActivitySlotDef();
- addChild(child, point);
- actDef.linkToSlot(child, actDef.getName(), name);
- return child;
- }
- /**
- * Method newChild.
- *
- * @param Name
- * @param Type
- * @param location
- * @return WfVertexDef
- */
- public WfVertexDef newChild(String Name, String Type, Point location)
- {
- changed = true;
- WfVertexDef child;
- if (Type.equals("Or"))
- {
- child = new OrSplitDef();
- addChild(child, location);
- Logger.msg(5, Type + " " + child.getID() + " added to " + this.getID());
- }
- else if (Type.equals("XOr"))
- {
- child = new XOrSplitDef();
- addChild(child, location);
- Logger.msg(5, Type + " " + child.getID() + " added to " + this.getID());
- }
- else if (Type.equals("And"))
- {
- child = new AndSplitDef();
- addChild(child, location);
- Logger.msg(5, Type + " " + child.getID() + " added to " + this.getID());
- }
- else if (Type.equals("Loop"))
- {
- child = new LoopDef();
- addChild(child, location);
- Logger.msg(5, Type + " " + child.getID() + " added to " + this.getID());
- }
- else if (Type.equals("Atomic"))
- {
- child = new ActivitySlotDef();
- ActivityDef act = new ActivityDef();
- act.changed = true;
- addChild(child, location);
- act.linkToSlot((ActivitySlotDef) child, Name, Name);
- act.getProperties().put("Description", Name);
- Logger.msg(5, Type + " " + child.getID() + " added to " + this.getID());
- }
- else if (Type.equals("Join"))
- {
- child = new JoinDef();
- child.getProperties().put("Type", "Join");
- addChild(child, location);
- Logger.msg(5, Type + " " + child.getID() + " added to " + this.getID());
- }
- else if (Type.equals("Route"))
- {
- child = new JoinDef();
- child.getProperties().put("Type", "Route");
- addChild(child, location);
- Logger.msg(5, Type + " " + child.getID() + " added to " + this.getID());
- }
- else
- {
- child = new ActivitySlotDef();
- CompositeActivityDef act = new CompositeActivityDef();
- act.changed = true;
- addChild(child, location);
- act.linkToSlot((ActivitySlotDef) child, Name, Name);
- Logger.msg(5, Type + " " + child.getID() + " added to " + this.getID());
- }
- return child;
- }
- /**
- * Method instantiateAct.
- *
- * @return CompositeActivity
- */
- @Override
- public WfVertex instantiate() throws ObjectNotFoundException, InvalidDataException {
- return instantiate(getName());
- }
-
- @Override
- public WfVertex instantiate(String name) throws ObjectNotFoundException, InvalidDataException
- {
- CompositeActivity cAct = new CompositeActivity();
- cAct.setType(getName());
- cAct.setName(name);
- GraphableVertex[] vertexDefs = getLayoutableChildren();
- WfVertex[] wfVertices = new WfVertex[vertexDefs.length];
- for (int i = 0; i < vertexDefs.length; i++)
- {
- WfVertexDef vertDef = (WfVertexDef)vertexDefs[i];
- wfVertices[i] = vertDef.instantiate();
- wfVertices[i].setParent(cAct);
- }
- Next[] nexts = new Next[getChildrenGraphModel().getEdges().length];
- for (int i = 0; i < getChildrenGraphModel().getEdges().length; i++)
- {
- NextDef nextDef = (NextDef) getChildrenGraphModel().getEdges()[i];
- nexts[i] = nextDef.instantiate();
- nexts[i].setParent(cAct);
- }
- cAct.getChildrenGraphModel().setStartVertexId(getChildrenGraphModel().getStartVertexId());
- cAct.getChildrenGraphModel().setEdges(nexts);
- cAct.getChildrenGraphModel().setVertices(wfVertices);
- cAct.getChildrenGraphModel().setNextId(getChildrenGraphModel().getNextId());
- cAct.getChildrenGraphModel().resetVertexOutlines();
- return cAct;
- }
-
- /**
- * Method hasGoodNumberOfActivity.
- *
- * @return boolean
- */
-
- public boolean hasGoodNumberOfActivity()
- {
- int endingAct = 0;
- GraphableVertex[] graphableVertices = this.getLayoutableChildren();
- if (graphableVertices != null)
- for (GraphableVertex graphableVertice : graphableVertices) {
- WfVertexDef vertex = (WfVertexDef) graphableVertice;
- if (getChildrenGraphModel().getOutEdges(vertex).length == 0)
- endingAct++;
- }
- if (endingAct > 1)
- return false;
- return true;
- }
-
- /**
- * @see com.c2kernel.graph.model.GraphableVertex#getPath()
- */
- @Override
- public String getPath()
- {
- if (getParent() == null)
- return getName();
- return super.getPath();
- }
-
- //deprecated
- public String[] getCastorNonLayoutableChildren() {
- return new String[0];
- }
-
- public void setCastorNonLayoutableChildren(String[] dummy) { }
-}
diff --git a/source/com/c2kernel/lifecycle/JoinDef.java b/source/com/c2kernel/lifecycle/JoinDef.java
deleted file mode 100644
index 95e2ec4..0000000
--- a/source/com/c2kernel/lifecycle/JoinDef.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.c2kernel.lifecycle;
-
-import com.c2kernel.lifecycle.instance.Join;
-import com.c2kernel.lifecycle.instance.WfVertex;
-
-/**
- * @version $Revision: 1.18 $ $Date: 2005/09/29 10:18:31 $
- * @author $Author: abranson $
- */
-public class JoinDef extends WfVertexDef
-{
- /**
- * @see java.lang.Object#Object()
- */
- public JoinDef()
- {
- }
- /**
- * @see com.c2kernel.lifecycle.WfVertexDef#verify()
- */
- @Override
- public boolean verify()
- {
- mErrors.removeAllElements();
- int nbOutEdges = getOutEdges().length;
- int nbInEdges = getInEdges().length;
- String type = (String) getProperties().get("Type");
- if (nbInEdges < 1)
- {
- mErrors.add("not enough previous");
- return false;
- }
- if (type != null && type.equals("Route"))
- {
- if (nbInEdges > 1)
- {
- mErrors.add("Bad nb of previous");
- return false;
- }
- }
- if (nbOutEdges > 1)
- {
- mErrors.add("too many next");
- return false;
- }
- if (nbOutEdges == 0)
- {
- if (!((CompositeActivityDef) getParent()).hasGoodNumberOfActivity())
- {
- mErrors.add("too many endpoints");
- return false;
- }
- }
- return true;
- }
- @Override
- public boolean isJoin()
- {
- return true;
- }
-
- @Override
- public WfVertex instantiate() {
- Join newJoin = new Join();
- configureInstance(newJoin);
- return newJoin;
- }
-}
diff --git a/source/com/c2kernel/lifecycle/LoopDef.java b/source/com/c2kernel/lifecycle/LoopDef.java
deleted file mode 100644
index 36108ad..0000000
--- a/source/com/c2kernel/lifecycle/LoopDef.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package com.c2kernel.lifecycle;
-
-import com.c2kernel.graph.model.Vertex;
-import com.c2kernel.graph.traversal.GraphTraversal;
-import com.c2kernel.lifecycle.instance.Loop;
-import com.c2kernel.lifecycle.instance.WfVertex;
-
-/**
- * @version $Revision: 1.19 $ $Date: 2005/09/29 10:18:31 $
- * @author $Author: abranson $
- */
-
-public class LoopDef extends XOrSplitDef
-{
- public boolean hasLoop = false;
- public int isNext = 0;
-
- /**
- * @see java.lang.Object#Object()
- */
- public LoopDef()
- {
- super();
- }
-
- /**
- * @see com.c2kernel.lifecycle.WfVertexDef#loop()
- */
- @Override
- public boolean loop()
- {
- return true;
- }
-
- /**
- * @see com.c2kernel.lifecycle.WfVertexDef#verify()
- */
- @Override
- public boolean verify()
- {
- if (!super.verify()) return false;
- Vertex[] nexts = getOutGraphables();
- Vertex[] anteVertices =
- GraphTraversal.getTraversal(this.getParent().getChildrenGraphModel(), this, GraphTraversal.kUp, false);
- int k = 0;
- int l = 0;
- Vertex[] brothers = getParent().getChildren();
- for (Vertex brother : brothers)
- if (brother instanceof LoopDef) l++;
- for (Vertex next : nexts)
- for (Vertex anteVertice : anteVertices)
- if (next.equals(anteVertice))
- k++;
- if (k != 1 && !(l>1))
- {
- mErrors.add("bad number of pointing back nexts");
- return false;
- }
-// if (nexts.length>2) {
-// mErrors.add("you must only have 2 nexts");
-// return false;
-// }
- return true;
- }
-
- @Override
- public boolean isLoop() {
- return true;
- }
-
- @Override
- public WfVertex instantiate() {
- Loop newLoop = new Loop();
- configureInstance(newLoop);
- return newLoop;
- }
-
-}
diff --git a/source/com/c2kernel/lifecycle/NextDef.java b/source/com/c2kernel/lifecycle/NextDef.java
deleted file mode 100644
index d196066..0000000
--- a/source/com/c2kernel/lifecycle/NextDef.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package com.c2kernel.lifecycle;
-import com.c2kernel.graph.model.GraphPoint;
-import com.c2kernel.graph.model.GraphableEdge;
-import com.c2kernel.lifecycle.instance.Next;
-/**
- * @version $Revision: 1.32 $ $Date: 2006/03/03 13:52:21 $
- * @author $Author: abranson $
- */
-public class NextDef extends GraphableEdge
-{
- /**
- * @see java.lang.Object#Object()
- */
- public NextDef()
- {
- }
- /**
- * Method verify.
- *
- * @return boolean
- */
- public boolean verify()
- {
- return true;
- }
- /**
- * Method NextDef.
- *
- * @param pre
- * @param nex
- */
- /** create and initialize a link between an Activities */
- public NextDef(WfVertexDef pre, WfVertexDef nex)
- {
- setParent(pre.getParent());
- if (pre instanceof OrSplitDef || pre instanceof XOrSplitDef)
- {
- int num = pre.getOutGraphables().length;
- try
- {
- num = Integer.parseInt((String) pre.getProperties().get("LastNum"));
- }
- catch (Exception e)
- {
- }
- getProperties().put("Alias", String.valueOf(num));
- pre.getProperties().put("LastNum", String.valueOf(num + 1));
- }
- }
- @Override
- public boolean containsPoint(GraphPoint p)
- {
- GraphPoint originPoint = getOriginPoint();
- GraphPoint terminusPoint = getTerminusPoint();
- GraphPoint midPoint = new GraphPoint();
- if (("Broken +".equals(getProperties().get("Type"))))
- {
- midPoint.x = (originPoint.x + terminusPoint.x) / 2;
- midPoint.y = (originPoint.y + terminusPoint.y) / 2;
- }
- else if (("Broken -".equals(getProperties().get("Type"))))
- {
- boolean arrowOnY = !(originPoint.y - terminusPoint.y < 60 && originPoint.y - terminusPoint.y > -60);
- midPoint.x = arrowOnY ? terminusPoint.x : (originPoint.x + terminusPoint.x) / 2;
- midPoint.y = arrowOnY ? (originPoint.y + terminusPoint.y) / 2 : originPoint.y;
- }
- else if (("Broken |".equals(getProperties().get("Type"))))
- {
- boolean arrowOnY = !(originPoint.y - terminusPoint.y < 60 && originPoint.y - terminusPoint.y > -60);
- midPoint.x = arrowOnY ? originPoint.x : (originPoint.x + terminusPoint.x) / 2;
- midPoint.y = arrowOnY ? (originPoint.y + terminusPoint.y) / 2 : terminusPoint.y;
- }
- else
- {
- midPoint.x = originPoint.x + (terminusPoint.x - originPoint.x) / 2;
- midPoint.y = originPoint.y + (terminusPoint.y - originPoint.y) / 2;
- }
- int minX = midPoint.x - 10;
- int minY = midPoint.y - 10;
- int maxX = midPoint.x + 10;
- int maxY = midPoint.y + 10;
- return (p.x >= minX) && (p.x <= maxX) && (p.y >= minY) && (p.y <= maxY);
- }
-
- public Next instantiate() {
- Next next = new Next();
- next.setID(getID());
- next.setOriginVertexId(getOriginVertexId());
- next.setTerminusVertexId(getTerminusVertexId());
- next.setProperties(getProperties());
- next.setOriginPoint(getOriginPoint());
- next.setTerminusPoint(getTerminusPoint());
- return next;
- }
-}
diff --git a/source/com/c2kernel/lifecycle/OrSplitDef.java b/source/com/c2kernel/lifecycle/OrSplitDef.java
deleted file mode 100644
index df68f22..0000000
--- a/source/com/c2kernel/lifecycle/OrSplitDef.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.c2kernel.lifecycle;
-import com.c2kernel.lifecycle.instance.OrSplit;
-import com.c2kernel.lifecycle.instance.WfVertex;
-/**
- * @version $Revision: 1.13 $ $Date: 2005/12/01 14:23:15 $
- * @author $Author: abranson $
- */
-public class OrSplitDef extends AndSplitDef
-{
- /**
- * @see java.lang.Object#Object()
- */
- public OrSplitDef()
- {
- super();
- }
-
- @Override
- public WfVertex instantiate() {
- OrSplit newSplit = new OrSplit();
- configureInstance(newSplit);
- return newSplit;
- }
-}
diff --git a/source/com/c2kernel/lifecycle/WfCastorHashMap.java b/source/com/c2kernel/lifecycle/WfCastorHashMap.java
deleted file mode 100644
index 7d88ea9..0000000
--- a/source/com/c2kernel/lifecycle/WfCastorHashMap.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.c2kernel.lifecycle;
-import com.c2kernel.lifecycle.instance.stateMachine.StateMachine;
-import com.c2kernel.utils.CastorHashMap;
-/**
- * @version $Revision: 1.29 $ $Date: 2005/05/20 13:07:13 $
- * @author $Author: abranson $
- */
-public class WfCastorHashMap extends CastorHashMap
-{
- /**
- * @see java.lang.Object#Object()
- */
- public WfCastorHashMap()
- {
- put(StateMachine.AUTOSTART, new Boolean(true));
- put(StateMachine.SKIPPABLE, new Boolean(true));
- put(StateMachine.REPEATABLE, new Boolean(true));
- put(StateMachine.IGNORABLE, new Boolean(false));
- put("AlwaysUseOutcome", new Boolean(false));
- put("Viewpoint", "");
- put("Show time", new Boolean(true));
- put("Description", "");
- put("Mail Message", "");
- put("Mail event", "");
- put("Agent Role", "");
- put("Agent Name", "");
- put("SchemaType", "");
- put("SchemaVersion", "");
- put("ScriptName", "");
- put("ScriptVersion", "");
- put("Viewpoint", "");
- }
-}
diff --git a/source/com/c2kernel/lifecycle/WfVertexDef.java b/source/com/c2kernel/lifecycle/WfVertexDef.java
deleted file mode 100644
index 6a46bee..0000000
--- a/source/com/c2kernel/lifecycle/WfVertexDef.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package com.c2kernel.lifecycle;
-
-import java.util.Vector;
-
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.ObjectNotFoundException;
-import com.c2kernel.graph.model.GraphableVertex;
-import com.c2kernel.lifecycle.instance.WfVertex;
-import com.c2kernel.utils.KeyValuePair;
-
-/**
- * @version $Revision: 1.22 $ $Date: 2005/11/15 15:56:38 $
- * @author $Author: abranson $
- */
-public abstract class WfVertexDef extends GraphableVertex
-{
- public Vector<String> mErrors;
-
- protected boolean loopTested;
-
- /**
- * @see java.lang.Object#Object()
- */
- /** @label wf */
- public WfVertexDef()
- {
- mErrors = new Vector<String>(0, 1);
- setIsLayoutable(true);
- }
-
- public abstract WfVertex instantiate() throws ObjectNotFoundException, InvalidDataException;
-
- public void configureInstance(WfVertex newVertex) {
- KeyValuePair[] k = getProperties().getKeyValuePairs();
- for (KeyValuePair element : k)
- newVertex.getProperties().put(element.getKey(), element.getValue());
- newVertex.setID(getID());
- if (getIsLayoutable()) {
- newVertex.setInEdgeIds(getInEdgeIds());
- newVertex.setOutEdgeIds(getOutEdgeIds());
- newVertex.setCentrePoint(getCentrePoint());
- newVertex.setOutlinePoints(getOutlinePoints());
- }
- }
-
- /**
- * Method verify.
- *
- * @return boolean
- */
- public abstract boolean verify();
-
- /**
- * Method getErrors.
- *
- * @return String
- */
- public String getErrors()
- {
- if (mErrors.size() == 0)
- return "No error";
- else
- return mErrors.elementAt(0);
- }
-
- /**
- * Method loop.
- *
- * @return boolean
- */
- public boolean loop()
- {
- boolean loop2 = false;
- if (!loopTested)
- {
- loopTested = true;
- if (getOutGraphables().length != 0)
- loop2 = ((WfVertexDef) getOutGraphables()[0]).loop();
- }
- loopTested = false;
- return loop2;
- }
-} \ No newline at end of file
diff --git a/source/com/c2kernel/lifecycle/XOrSplitDef.java b/source/com/c2kernel/lifecycle/XOrSplitDef.java
deleted file mode 100644
index 73c578f..0000000
--- a/source/com/c2kernel/lifecycle/XOrSplitDef.java
+++ /dev/null
@@ -1,29 +0,0 @@
-
-package com.c2kernel.lifecycle;
-
-import com.c2kernel.lifecycle.instance.WfVertex;
-import com.c2kernel.lifecycle.instance.XOrSplit;
-
-
-/**
- * @version $Revision: 1.14 $ $Date: 2005/09/29 10:18:31 $
- * @author $Author: abranson $
- */
-
-public class XOrSplitDef extends AndSplitDef
-{
- /**
- * @see java.lang.Object#Object()
- */
- public XOrSplitDef()
- {
- super();
- }
-
- @Override
- public WfVertex instantiate() {
- XOrSplit newSplit = new XOrSplit();
- configureInstance(newSplit);
- return newSplit;
- }
-}
diff --git a/source/com/c2kernel/lifecycle/chooser/ActivityChooser.java b/source/com/c2kernel/lifecycle/chooser/ActivityChooser.java
deleted file mode 100644
index d5f62a0..0000000
--- a/source/com/c2kernel/lifecycle/chooser/ActivityChooser.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Created on 1 sept. 2003
- *
- * To change the template for this generated file go to Window>Preferences>Java>Code Generation>Code and Comments
- */
-package com.c2kernel.lifecycle.chooser;
-
-import java.awt.Container;
-import java.awt.Cursor;
-import java.awt.Dimension;
-import java.awt.Image;
-import java.awt.Toolkit;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.HashMap;
-
-import javax.swing.BorderFactory;
-import javax.swing.Box;
-import javax.swing.BoxLayout;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
-import com.c2kernel.utils.Language;
-import com.c2kernel.utils.Logger;
-import com.c2kernel.utils.Resource;
-
-/**
- * @author Developpement
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class ActivityChooser extends JFrame
-{
- private LDAPFileChooser mLDAPFileChooserActivity = null;
-
- private JButton mButtonOK = null;
-
- private JButton mButtonCancel = null;
-
- private JPanel mJPanelVertical = null;
-
- private JPanel mJPanelHorizontal = null;
-
- private String mMessage = "Choose or modify";
-
- private WorkflowDialogue mParent = null;
-
- private JLabel label = null;
-
- HashMap<?, ?> mhashmap = null;
-
- public ActivityChooser(String message, String title, Image img, WorkflowDialogue parent, HashMap<?, ?> hashmap)
- {
- super(title);
- mMessage = message;
- img = Resource.findImage("graph/newvertex_large.png").getImage();
- setIconImage(img);
- mParent = parent;
- mhashmap = hashmap;
- initialize();
- }
-
- private JButton getJButtonOK()
- {
- if (mButtonOK == null)
- mButtonOK = new JButton(Language.translate("OK"));
- return mButtonOK;
- }
-
- private JButton getJButtonCancel()
- {
- if (mButtonCancel == null)
- mButtonCancel = new JButton(Language.translate("Cancel"));
- return mButtonCancel;
- }
-
- private LDAPFileChooser getLDAPFileChooserActivity()
- {
- if (mLDAPFileChooserActivity == null)
- {
- try
- {
- mLDAPFileChooserActivity = new LDAPFileChooser(LDAPFileChooser.ACTIVITY_CHOOSER);
- mLDAPFileChooserActivity.setName("LDAPFileChooserRouting");
- mLDAPFileChooserActivity.setEditable(false);
- //mLDAPFileChooserActivity.setBounds(125, 13, 400, 19);
- } catch (Exception mExc)
- {
- Logger.error(mExc);
- }
- }
- return mLDAPFileChooserActivity;
- }
-
- private void initialize()
- {
- getJButtonOK().addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- Logger.debug(5, "mLDAPFileChooserActivity.getEntryName()" + mLDAPFileChooserActivity.getEntryName());
- setCursor(new Cursor(Cursor.WAIT_CURSOR));
- mParent.loadThisWorkflow(mLDAPFileChooserActivity.getEntryName(), mhashmap);
- setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
- close();
- }
- });
- getJButtonCancel().addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- close();
- }
- });
- //getContentPane().add(getJPanelVertical());
- Container contentPane = getContentPane();
- contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
- contentPane.add(getJPanelVertical());
- contentPane.add(getJPanelHorizontal());
- contentPane.add(Box.createGlue());
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- setLocation((d.width - getWidth()) / 2, (d.height - getHeight()) / 2);
- setResizable(true);
- pack();
- setSize(new Dimension(getWidth(), getJButtonCancel().getHeight() + getLDAPFileChooserActivity().getHeight() + label.getHeight() + 100));
- setVisible(true);
- setVisible(true);
- }
-
- private void close()
- {
- mParent = null;
- this.setEnabled(false);
- this.setVisible(false);
- }
-
- private JPanel getJPanelVertical()
- {
- if (mJPanelVertical == null)
- {
- try
- {
- Logger.debug(8, "Panel button");
- mJPanelVertical = new JPanel();
- mJPanelVertical.setName("JPanelV");
- mJPanelVertical.setLayout(new BoxLayout(mJPanelVertical, BoxLayout.Y_AXIS));
- label = new JLabel(mMessage);
- JPanel labelP = new JPanel();
- labelP.setLayout(new BoxLayout(labelP, BoxLayout.X_AXIS));
- labelP.add(label);
- labelP.add(Box.createGlue());
- mJPanelVertical.add(labelP);
- mJPanelVertical.add(Box.createRigidArea(new Dimension(0, 5)));
- mJPanelVertical.add(getLDAPFileChooserActivity(), getLDAPFileChooserActivity().getName());
- //mJPanelVertical.add(Box.createRigidArea(new Dimension(0,
- // 10)));
- mJPanelVertical.add(Box.createGlue());
- mJPanelVertical.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
- mJPanelVertical.setVisible(true);
- } catch (java.lang.Throwable mExc)
- {
- //handleException(mExc);
- }
- }
- return mJPanelVertical;
- }
-
- private JPanel getJPanelHorizontal()
- {
- if (mJPanelHorizontal == null)
- {
- try
- {
- Logger.debug(8, "Panel button");
- mJPanelHorizontal = new JPanel();
- mJPanelHorizontal.setName("JPanelH");
- mJPanelHorizontal.setLayout(new BoxLayout(mJPanelHorizontal, BoxLayout.X_AXIS));
- mJPanelHorizontal.add(getJButtonOK(), getJButtonOK().getName());
- mJPanelHorizontal.add(Box.createRigidArea(new Dimension(10, 0)));
- mJPanelHorizontal.add(getJButtonCancel(), getJButtonCancel().getName());
- mJPanelHorizontal.setVisible(true);
- } catch (java.lang.Throwable mExc)
- {
- //handleException(mExc);
- }
- }
- return mJPanelHorizontal;
- }
-} \ No newline at end of file
diff --git a/source/com/c2kernel/lifecycle/chooser/LDAPEntryChooser.java b/source/com/c2kernel/lifecycle/chooser/LDAPEntryChooser.java
deleted file mode 100644
index d21f6d5..0000000
--- a/source/com/c2kernel/lifecycle/chooser/LDAPEntryChooser.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.c2kernel.lifecycle.chooser;
-/**
- * @version $Revision: 1.2 $ $Date: 2005/12/01 14:23:15 $
- * @author $Author: abranson $
- */
-
-import java.awt.Dimension;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-
-import javax.swing.JComboBox;
-
-import com.c2kernel.lookup.DomainPath;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.utils.Logger;
-
-public class LDAPEntryChooser extends JComboBox
-{
-
- DomainPath mDomainPath = null;
- ArrayList<String> allItems = new ArrayList<String>();
-
- public LDAPEntryChooser(DomainPath domPath, boolean editable)
- {
- super();
- setEditable(editable);
- mDomainPath = domPath;
- initialise();
- }
-
- private void initialise()
- {
- try
- {
- Enumeration<?> children = Gateway.getLDAPLookup().searchAliases(mDomainPath);
- while (children.hasMoreElements())
- {
- DomainPath domPath = (DomainPath)children.nextElement();
- allItems.add(domPath.getName());
- }
- }
- catch (Exception ex)
- {
- Logger.exceptionDialog(ex);
- }
-
- Collections.sort(allItems);
- addItem("");
- for (String element : allItems) {
- addItem(element);
- }
-
- }
-
- public void reload()
- {
- removeAllItems();
- initialise();
- }
-
- @Override
- public synchronized Dimension getSize()
- {
- if ("1".equals(Gateway.getProperty("ResizeCombo")))
- return new Dimension(super.getSize().width<400?400:super.getSize().width,super.getSize().height);
- return super.getSize();
- }
-
-}
diff --git a/source/com/c2kernel/lifecycle/chooser/LDAPFileChooser.java b/source/com/c2kernel/lifecycle/chooser/LDAPFileChooser.java
deleted file mode 100644
index 9843d61..0000000
--- a/source/com/c2kernel/lifecycle/chooser/LDAPFileChooser.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package com.c2kernel.lifecycle.chooser;
-import java.awt.Dimension;
-import java.awt.event.ItemListener;
-import java.util.HashMap;
-
-import javax.swing.BoxLayout;
-import javax.swing.JPanel;
-
-import com.c2kernel.lookup.DomainPath;
-import com.c2kernel.persistency.ClusterStorage;
-import com.c2kernel.utils.Logger;
-
-//import fr.agilium.gui.tabs.wfPropertiesViewer.JPanelTabbedProperties;
-/**
- * @version $Revision: 1.2 $ $Date: 2005/06/27 15:16:12 $
- * @author $Author: abranson $
- */
-
-public class LDAPFileChooser extends JPanel
-{
- public static String SCRIPT_CHOOSER = "Script";
- public static String SCHEMA_CHOOSER = "Schema";
- public static String ACTIVITY_CHOOSER = "Activity";
- private String chooserMode = null;
- private HashMap<?, ?> mHashList = null;
- public LDAPEntryChooser mLec;
- private boolean mEditable = false;
- DomainPath domainPath;
- String itemQuery = null;
- boolean showversion = true;
-
- public LDAPFileChooser(String choose)
- {
- super();
- chooserMode = choose;
- initialise();
- }
-
- private void initialise()
- {
- if (chooserMode.equals(SCHEMA_CHOOSER))
- {
- itemQuery = ClusterStorage.VIEWPOINT + "/Schema/all";
- domainPath = new DomainPath("/desc/OutcomeDesc/");
- }
- else if (chooserMode.equals(SCRIPT_CHOOSER))
- {
- itemQuery = ClusterStorage.VIEWPOINT + "/Script/all";
- domainPath = new DomainPath("/desc/Script/");
- }
- else if (chooserMode.equals(ACTIVITY_CHOOSER))
- {
- domainPath = new DomainPath("/desc/ActivityDesc/");
- showversion = false;
- }
- else
- return;
- mLec = new LDAPEntryChooser(domainPath, mEditable);
-
- mLec.setPreferredSize(new Dimension(220, 19));
- mLec.setMaximumSize(new Dimension(3000, 22));
- mLec.setMinimumSize(new Dimension(50, 19));
- //mLec.getRenderer().getListCellRendererComponent();
-
- BoxLayout blyt = new BoxLayout(this, BoxLayout.X_AXIS);
- setLayout(blyt);
- add(mLec);
- mLec.setVisible(true);
- this.validate();
- this.setVisible(true);
-
- }
-
- public String getEntryName()
- {
- return (String) mLec.getSelectedItem();
- }
-
- public void addItemListener(ItemListener il)
- {
- mLec.addItemListener(il);
- }
- public void setSelectedItem(String name, String version)
- {
- Logger.debug(5,"setSelectedItem " + name + " " + version);
- if (name == null||name.equals("-1")) name="";
- mLec.setSelectedItem(name);
- }
-
- public void reload()
- {
- mLec.reload();
- }
-
- public void removeAllItems()
- {
- mLec.removeAllItems();
- }
-
- /**
- * @param b
- */
- public void setEditable(boolean b)
- {
- mEditable = b;
- mLec.setEditable(b);
- }
-
- @Override
- public void updateUI()
- {
- if (mLec!=null) mLec.updateUI();
- super.updateUI();
- }
-
- @Override
- public void setEnabled(boolean enabled)
- {
- mLec.setEnabled(enabled);
- }
-}
diff --git a/source/com/c2kernel/lifecycle/chooser/WorkflowDialogue.java b/source/com/c2kernel/lifecycle/chooser/WorkflowDialogue.java
deleted file mode 100644
index 2ddd489..0000000
--- a/source/com/c2kernel/lifecycle/chooser/WorkflowDialogue.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Created on 2 sept. 2003
- *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-package com.c2kernel.lifecycle.chooser;
-
-import java.util.HashMap;
-
-/**
- * @author Developpement
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public interface WorkflowDialogue
-{
- public void loadThisWorkflow(String name, HashMap<?, ?> hashMap);
-}
diff --git a/source/com/c2kernel/lifecycle/gui/model/WfDefGraphPanel.java b/source/com/c2kernel/lifecycle/gui/model/WfDefGraphPanel.java
deleted file mode 100644
index e0f4f65..0000000
--- a/source/com/c2kernel/lifecycle/gui/model/WfDefGraphPanel.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*Created on 21 nov. 2003 */
-package com.c2kernel.lifecycle.gui.model;
-
-import java.awt.Graphics2D;
-
-import com.c2kernel.graph.model.DirectedEdge;
-import com.c2kernel.graph.model.GraphPoint;
-import com.c2kernel.graph.view.DirectedEdgeRenderer;
-import com.c2kernel.graph.view.GraphPanel;
-import com.c2kernel.graph.view.VertexRenderer;
-import com.c2kernel.lifecycle.NextDef;
-
-/** @author XSeb74*/
-public class WfDefGraphPanel extends GraphPanel
-{
- public WfDefGraphPanel(DirectedEdgeRenderer d,VertexRenderer v)
- {
- super(d,v);
- }
- // Draws the highlight of the specified edge
- @Override
- protected void drawEdgeHighlight(Graphics2D g2d, DirectedEdge edge)
- {
- GraphPoint originPoint = edge.getOriginPoint();
- GraphPoint terminusPoint = edge.getTerminusPoint();
- GraphPoint midPoint = new GraphPoint();
-
- if ("Straight".equals(((NextDef)edge).getProperties().get("Type")) || ((NextDef)edge).getProperties().get("Type") == null)
- {
- midPoint.x = originPoint.x + (terminusPoint.x - originPoint.x) / 2;
- midPoint.y = originPoint.y + (terminusPoint.y - originPoint.y) / 2;
- }
- else if (("Broken +".equals(((NextDef)edge).getProperties().get("Type"))))
- {
- midPoint.x = (originPoint.x + terminusPoint.x) / 2;
- midPoint.y = (originPoint.y + terminusPoint.y) / 2;
- }
- else if (("Broken -".equals(((NextDef)edge).getProperties().get("Type"))))
- {
- boolean arrowOnY = !(originPoint.y - terminusPoint.y < 60 && originPoint.y - terminusPoint.y > -60);
- midPoint.x = arrowOnY ? terminusPoint.x : (originPoint.x + terminusPoint.x) / 2;
- midPoint.y = arrowOnY ? (originPoint.y + terminusPoint.y) / 2 : originPoint.y;
- }
- else if (("Broken |".equals(((NextDef)edge).getProperties().get("Type"))))
- {
- boolean arrowOnY = !(originPoint.y - terminusPoint.y < 60 && originPoint.y - terminusPoint.y > -60);
- midPoint.x = arrowOnY ? originPoint.x : (originPoint.x + terminusPoint.x) / 2;
- midPoint.y = arrowOnY ? (originPoint.y + terminusPoint.y) / 2 : terminusPoint.y;
- }
- int minX = midPoint.x - 10;
- int minY = midPoint.y - 10;
- int maxX = midPoint.x + 10;
- int maxY = midPoint.y + 10;
- g2d.drawLine(minX, minY, maxX, minY);
- g2d.drawLine(maxX, minY, maxX, maxY);
- g2d.drawLine(maxX, maxY, minX, maxY);
- g2d.drawLine(minX, maxY, minX, minY);
- }
-}
diff --git a/source/com/c2kernel/lifecycle/gui/model/WfEdgeDefFactory.java b/source/com/c2kernel/lifecycle/gui/model/WfEdgeDefFactory.java
deleted file mode 100644
index 6e6727a..0000000
--- a/source/com/c2kernel/lifecycle/gui/model/WfEdgeDefFactory.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.c2kernel.lifecycle.gui.model;
-import com.c2kernel.graph.model.DirectedEdge;
-import com.c2kernel.graph.model.EdgeFactory;
-import com.c2kernel.graph.model.GraphModelManager;
-import com.c2kernel.graph.model.TypeNameAndConstructionInfo;
-import com.c2kernel.graph.model.Vertex;
-import com.c2kernel.lifecycle.NextDef;
-import com.c2kernel.lifecycle.WfVertexDef;
-public class WfEdgeDefFactory implements EdgeFactory
-{
- @Override
- public void create(
- GraphModelManager graphModelManager,
- Vertex origin,
- Vertex terminus,
- TypeNameAndConstructionInfo typeNameAndConstructionInfo)
- {
- if (validCreation(graphModelManager, origin, terminus))
- {
- NextDef nextDef = new NextDef((WfVertexDef) origin, (WfVertexDef) terminus);
- graphModelManager.getModel().addEdgeAndCreateId(nextDef, origin, terminus);
- }
- }
- private static boolean validCreation(GraphModelManager graphModelManager, Vertex origin, Vertex terminus)
- {
- DirectedEdge[] connectingEdgesAToB = graphModelManager.getModel().getConnectingEdges(origin.getID(), terminus.getID());
- DirectedEdge[] connectingEdgesBToA = graphModelManager.getModel().getConnectingEdges(terminus.getID(), origin.getID());
- return (origin != terminus) && (connectingEdgesAToB.length == 0) && (connectingEdgesBToA.length == 0);
- }
-}
diff --git a/source/com/c2kernel/lifecycle/gui/model/WfVertexDefFactory.java b/source/com/c2kernel/lifecycle/gui/model/WfVertexDefFactory.java
deleted file mode 100644
index 132fdcf..0000000
--- a/source/com/c2kernel/lifecycle/gui/model/WfVertexDefFactory.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package com.c2kernel.lifecycle.gui.model;
-import java.awt.Point;
-import java.io.Serializable;
-import java.util.HashMap;
-
-import javax.swing.JOptionPane;
-
-import com.c2kernel.graph.model.GraphModelManager;
-import com.c2kernel.graph.model.GraphPoint;
-import com.c2kernel.graph.model.TypeNameAndConstructionInfo;
-import com.c2kernel.graph.model.VertexFactory;
-import com.c2kernel.lifecycle.ActivityDef;
-import com.c2kernel.lifecycle.CompositeActivityDef;
-import com.c2kernel.lifecycle.chooser.ActivityChooser;
-import com.c2kernel.lifecycle.chooser.WorkflowDialogue;
-import com.c2kernel.utils.Language;
-import com.c2kernel.utils.LocalObjectLoader;
-import com.c2kernel.utils.Logger;
-import com.c2kernel.utils.Resource;
-public class WfVertexDefFactory implements VertexFactory, WorkflowDialogue
-{
- protected CompositeActivityDef mCompositeActivityDef = null;
- @Override
- public void create(GraphModelManager graphModelManager, Point location, TypeNameAndConstructionInfo typeNameAndConstructionInfo)
- {
- String vertexTypeId = null;
- if (mCompositeActivityDef != null && typeNameAndConstructionInfo.mInfo instanceof String)
- {
- vertexTypeId = (String) typeNameAndConstructionInfo.mInfo;
- if (vertexTypeId.equals("Atomic") || vertexTypeId.equals("Composite"))
- {
- // ask for a name
- HashMap<String, Serializable> mhm = new HashMap<String, Serializable>();
- mhm.put("P1", vertexTypeId);
- mhm.put("P2", location);
- //************************************************
- ActivityChooser a =
- new ActivityChooser(
- Language.translate("Please enter a Type for the new activityDef"),
- Language.translate("New " + vertexTypeId + " Activity"),
- Resource.findImage("graph/newvertex_large.png").getImage(),
- this,
- mhm);
- a.setVisible(true);
- }
- else
- mCompositeActivityDef.newChild("", vertexTypeId, location);
- }
- }
- @Override
- public void loadThisWorkflow(String newName, HashMap<?, ?> hashMap)
- {
- String vertexTypeId = (String) hashMap.get("P1");
- Point location = (Point) hashMap.get("P2");
- if (newName == null || newName.equals(""))
- return;
- Logger.debug(5, newName);
- ActivityDef act = (ActivityDef) mCompositeActivityDef.search(mCompositeActivityDef.getID() + "/" + newName);
- if (act != null)
- {
- String unicName = newName;
- while (unicName == null
- || unicName == ""
- || mCompositeActivityDef.search(mCompositeActivityDef.getID() + "/" + unicName) != null)
- unicName =
- (String) JOptionPane.showInputDialog(
- null,
- Language.translate("Please type a Name"),
- Language.translate("New " + vertexTypeId + " Activity"),
- JOptionPane.QUESTION_MESSAGE,
- Resource.findImage("graph/newvertex_large.png"),
- null,
- null);
- act = (ActivityDef) mCompositeActivityDef.search(mCompositeActivityDef.getID() + "/" + newName);
- mCompositeActivityDef.addExistingActivityDef(unicName, act, new GraphPoint(location.x, location.y));
- }
- else
- {
- try
- {
- act = LocalObjectLoader.getActDef(newName, "last");
- }
- catch (Exception ex)
- {
- Logger.exceptionDialog(ex);
- return;
- }
- mCompositeActivityDef.newChild(newName, vertexTypeId, location);
- }
- }
- @Override
- public void setCreationContext(Object newContext)
- {
- if (newContext != null && newContext instanceof CompositeActivityDef)
- mCompositeActivityDef = (CompositeActivityDef) newContext;
- }
-}
diff --git a/source/com/c2kernel/lifecycle/gui/model/WfVertexDefOutlineCreator.java b/source/com/c2kernel/lifecycle/gui/model/WfVertexDefOutlineCreator.java
deleted file mode 100644
index 63d3b2f..0000000
--- a/source/com/c2kernel/lifecycle/gui/model/WfVertexDefOutlineCreator.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.c2kernel.lifecycle.gui.model;
-
-import com.c2kernel.graph.model.GraphPoint;
-import com.c2kernel.graph.model.Vertex;
-import com.c2kernel.graph.model.VertexOutlineCreator;
-import com.c2kernel.lifecycle.ActivitySlotDef;
-
-public class WfVertexDefOutlineCreator implements VertexOutlineCreator
-{
- private final int mActivityWidth = 130;
- private final int mActivityHeight = 60;
- private final int mSplitJoinWidth = 60;
- private final int mSplitJoinHeight = 25;
-
- @Override
- public void setOutline(Vertex vertex)
- {
- GraphPoint centrePoint = vertex.getCentrePoint();
- GraphPoint[] outlinePoints = new GraphPoint[ 4 ];
- int vertexWidth = 0;
- int vertexHeight = 0;
-
-
- if ( vertex instanceof ActivitySlotDef )
- {
- vertexWidth = mActivityWidth;
- vertexHeight = mActivityHeight;
- }
- else
- {
- vertexWidth = mSplitJoinWidth;
- vertexHeight = mSplitJoinHeight;
- }
-
- outlinePoints[ 0 ] = new GraphPoint();
- outlinePoints[ 0 ].x = centrePoint.x - vertexWidth / 2;
- outlinePoints[ 0 ].y = centrePoint.y - vertexHeight / 2;
- outlinePoints[ 1 ] = new GraphPoint();
- outlinePoints[ 1 ].x = centrePoint.x + vertexWidth / 2;
- outlinePoints[ 1 ].y = centrePoint.y - vertexHeight / 2;
- outlinePoints[ 2 ] = new GraphPoint();
- outlinePoints[ 2 ].x = centrePoint.x + vertexWidth / 2;
- outlinePoints[ 2 ].y = centrePoint.y + vertexHeight / 2;
- outlinePoints[ 3 ] = new GraphPoint();
- outlinePoints[ 3 ].x = centrePoint.x - vertexWidth / 2;
- outlinePoints[ 3 ].y = centrePoint.y + vertexHeight / 2;
-
- vertex.setOutlinePoints( outlinePoints );
- }
-}
-
diff --git a/source/com/c2kernel/lifecycle/gui/view/ActivitySlotDefRenderer.java b/source/com/c2kernel/lifecycle/gui/view/ActivitySlotDefRenderer.java
deleted file mode 100644
index c4309ee..0000000
--- a/source/com/c2kernel/lifecycle/gui/view/ActivitySlotDefRenderer.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.c2kernel.lifecycle.gui.view;
-
-import java.awt.Color;
-import java.awt.FontMetrics;
-import java.awt.Graphics2D;
-import java.awt.Paint;
-
-import com.c2kernel.graph.model.GraphPoint;
-import com.c2kernel.graph.model.Vertex;
-import com.c2kernel.graph.view.VertexRenderer;
-import com.c2kernel.lifecycle.ActivitySlotDef;
-import com.c2kernel.utils.Language;
-
-public class ActivitySlotDefRenderer implements VertexRenderer
-{
- private Paint mInactivePaint = new Color(255, 255, 255);
- private Paint mErrorPaint = new Color( 255, 50, 0 );
- private Paint mCompositePaint= new Color(200, 200, 255);
- private Paint mTextPaint = Color.black;
-
-
- @Override
- public void draw( Graphics2D g2d, Vertex vertex)
- {
- ActivitySlotDef activitySlotDef = ( ActivitySlotDef )vertex;
- boolean hasError = activitySlotDef.verify();
- boolean isComposite = false;
- isComposite = activitySlotDef.getIsComposite();
- GraphPoint centrePoint = activitySlotDef.getCentrePoint();
- int vertexHeight = activitySlotDef.getHeight();
- int vertexWidth = activitySlotDef.getWidth();
-
- String[] linesOfText = new String[2+(hasError?0:1)];
- FontMetrics metrics = g2d.getFontMetrics();
- int lineWidth = 0;
- int lineHeight = metrics.getHeight();
- int linesHeight = lineHeight * linesOfText.length;
- int linesStartY = centrePoint.y - linesHeight / 2 + lineHeight * 2 / 3;
- int x = 0;
- int y = 0;
- int i = 0;
-
- linesOfText[0]="("+activitySlotDef.getActivityDef()+")";
- linesOfText[1]=(String)activitySlotDef.getProperties().get("Name");
-
- if (!hasError)linesOfText[2]=Language.translate(activitySlotDef.getErrors());
-
- g2d.setPaint( !hasError ? mErrorPaint : isComposite ? mCompositePaint : mInactivePaint );
- g2d.fill3DRect
- (
- centrePoint.x - vertexWidth / 2,
- centrePoint.y - vertexHeight / 2,
- vertexWidth,
- vertexHeight,
- true
- );
-
- g2d.setPaint( mTextPaint );
-
- // Draw the lines of text
- for ( i = 0; i < linesOfText.length; i++ )
- {
- if (linesOfText[i] == null) linesOfText[i] = "";
- lineWidth = metrics.stringWidth( linesOfText[ i ] );
- x = centrePoint.x - lineWidth / 2;
- y = linesStartY + i * lineHeight;
- g2d.drawString( linesOfText[ i ], x, y );
- }
- }
-}
-
diff --git a/source/com/c2kernel/lifecycle/gui/view/CompActDefOutcomeHandler.java b/source/com/c2kernel/lifecycle/gui/view/CompActDefOutcomeHandler.java
deleted file mode 100644
index 4c69f15..0000000
--- a/source/com/c2kernel/lifecycle/gui/view/CompActDefOutcomeHandler.java
+++ /dev/null
@@ -1,233 +0,0 @@
-package com.c2kernel.lifecycle.gui.view;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.File;
-
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JPanel;
-import javax.swing.JSplitPane;
-
-import com.c2kernel.graph.layout.DefaultGraphLayoutGenerator;
-import com.c2kernel.graph.view.EditorPanel;
-import com.c2kernel.graph.view.VertexPropertyPanel;
-import com.c2kernel.gui.MainFrame;
-import com.c2kernel.gui.tabs.outcome.InvalidOutcomeException;
-import com.c2kernel.gui.tabs.outcome.InvalidSchemaException;
-import com.c2kernel.gui.tabs.outcome.OutcomeException;
-import com.c2kernel.gui.tabs.outcome.OutcomeHandler;
-import com.c2kernel.gui.tabs.outcome.OutcomeNotInitialisedException;
-import com.c2kernel.lifecycle.CompositeActivityDef;
-import com.c2kernel.lifecycle.gui.model.WfDefGraphPanel;
-import com.c2kernel.lifecycle.gui.model.WfEdgeDefFactory;
-import com.c2kernel.lifecycle.gui.model.WfVertexDefFactory;
-import com.c2kernel.lifecycle.gui.model.WfVertexDefOutlineCreator;
-import com.c2kernel.lifecycle.instance.gui.view.FindActDefPanel;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.utils.CastorXMLUtility;
-import com.c2kernel.utils.FileStringUtility;
-import com.c2kernel.utils.Logger;
-import com.c2kernel.utils.Resource;
-
-/**************************************************************************
- *
- * $Revision: 1.14 $
- * $Date: 2005/09/07 13:46:31 $
- *
- * Copyright (C) 2003 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-public class CompActDefOutcomeHandler
- extends JPanel
- implements OutcomeHandler {
-
- protected JButton mLoadButton = new JButton(Resource.findImage("graph/load.png"));
- protected JButton mLayoutButton = new JButton(Resource.findImage("graph/autolayout.png"));
- protected JButton[] mOtherToolBarButtons = { mLayoutButton, mLoadButton };
-
- protected CompositeActivityDef mCompActDef = null;
- protected WfEdgeDefFactory mWfEdgeDefFactory = new WfEdgeDefFactory();
- protected WfVertexDefFactory mWfVertexDefFactory = new WfVertexDefFactory();
-
- protected EditorPanel mEditorPanel;
- protected VertexPropertyPanel mPropertyPanel;
- protected JSplitPane mSplitPane;
- boolean unsaved;
-
- public CompActDefOutcomeHandler() {
- super();
- mPropertyPanel = loadPropertyPanel();
- mPropertyPanel.createLayout(new FindActDefPanel());
- mEditorPanel =
- new EditorPanel(
- mWfEdgeDefFactory,
- mWfVertexDefFactory,
- new WfVertexDefOutlineCreator(),
- true,
- mOtherToolBarButtons,
- new WfDefGraphPanel(new WfDirectedEdgeDefRenderer(),
- new WfVertexDefRenderer()));
- }
-
- protected void createLayout()
- {
- mLoadButton.setToolTipText("Load from local disc");
- mLayoutButton.setToolTipText("Auto-Layout");
-
- // Add the editor pane
- GridBagLayout gridbag = new GridBagLayout();
- setLayout(gridbag);
- GridBagConstraints c = new GridBagConstraints();
- c.gridx = 0;
- c.gridy = 1;
- c.fill = GridBagConstraints.BOTH;
- c.weighty = 2.0;
- c.weightx = 2.0;
- mSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, mEditorPanel, mPropertyPanel);
- mSplitPane.setDividerSize(5);
- gridbag.setConstraints(mSplitPane, c);
- add(mSplitPane);
- }
-
- protected void createListeners()
- {
- mLoadButton.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent ae) {
- File selectedFile = null;
-
- int returnValue = MainFrame.xmlChooser.showOpenDialog(null);
-
- switch (returnValue)
- {
- case JFileChooser.APPROVE_OPTION :
- selectedFile = MainFrame.xmlChooser.getSelectedFile();
- try {
- String newWf = FileStringUtility.file2String(selectedFile);
- setOutcome(newWf);
- setUpGraphEditor();
- } catch (Exception e) {
- Logger.exceptionDialog(e);
- }
- case JFileChooser.CANCEL_OPTION :
- case JFileChooser.ERROR_OPTION :
-
- default :
- }
- }
- });
-
- mLayoutButton.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent ae) {
- DefaultGraphLayoutGenerator.layoutGraph(mEditorPanel.mGraphModelManager.getModel());
- }
- });
- }
-
- public void setUpGraphEditor() {
- mEditorPanel.mGraphModelManager.setModel(mCompActDef.getChildrenGraphModel());
- // Give the editor panel the edge and vertex types
- mEditorPanel.updateVertexTypes(mCompActDef.getVertexTypeNameAndConstructionInfo());
- mEditorPanel.updateEdgeTypes(mCompActDef.getEdgeTypeNameAndConstructionInfo());
- mEditorPanel.enterSelectMode();
- mWfVertexDefFactory.setCreationContext(mCompActDef);
- }
-
- /**
- *
- */
- @Override
- public void setOutcome(String outcome) throws InvalidOutcomeException {
- try {
- CompositeActivityDef newAct = (CompositeActivityDef)CastorXMLUtility.unmarshall(outcome);
- if (mCompActDef != null)
- newAct.setName(mCompActDef.getName());
- mCompActDef = newAct;
- } catch (Exception ex) {
- Logger.error(ex);
- throw new InvalidOutcomeException(ex.getMessage());
- }
- }
- /**
- *
- */
- @Override
- public void setDescription(String description)
- throws InvalidSchemaException {
- // ignore - always the same
- }
- /**
- *
- */
- @Override
- public void setReadOnly(boolean readOnly) {
- mLayoutButton.setEnabled(!readOnly);
- mLoadButton.setEnabled(!readOnly);
- mEditorPanel.setEditable(!readOnly);
- mPropertyPanel.setEditable(!readOnly);
- }
- /**
- *
- */
- @Override
- public JPanel getPanel() throws OutcomeNotInitialisedException {
- return this;
- }
- /**
- *
- */
- @Override
- public String getOutcome() throws OutcomeException {
- try {
- return CastorXMLUtility.marshall(mCompActDef);
- } catch (Exception ex) {
- throw new OutcomeException(ex.getMessage());
- }
- }
- /**
- *
- */
- @Override
- public void run() {
- Thread.currentThread().setName("Composite Act Def Viewer");
- createLayout();
- createListeners();
- mPropertyPanel.setGraphModelManager(mEditorPanel.mGraphModelManager);
- setUpGraphEditor();
- }
-
- public VertexPropertyPanel loadPropertyPanel()
- {
- String wfPanelClass = Gateway.getProperty("WfPropertyPanel");
- if (wfPanelClass != null) {
- try {
- Class<?> panelClass = Class.forName(wfPanelClass);
- return (VertexPropertyPanel)panelClass.newInstance();
- } catch (Exception ex) {
- Logger.error("Could not load wf props panel:"+wfPanelClass);
- Logger.error(ex);
- }
- }
- return new VertexPropertyPanel();
- }
-
- @Override
- public boolean isUnsaved() {
- return unsaved;
- }
-
- @Override
- public void saved() {
- unsaved = false;
- }
-
- @Override
- public void export(File targetFile) throws Exception {
- ElemActDefOutcomeHandler.exportAct(targetFile.getParentFile(), mCompActDef);
- }
-}
diff --git a/source/com/c2kernel/lifecycle/gui/view/ElemActDefOutcomeHandler.java b/source/com/c2kernel/lifecycle/gui/view/ElemActDefOutcomeHandler.java
deleted file mode 100644
index c37e5a7..0000000
--- a/source/com/c2kernel/lifecycle/gui/view/ElemActDefOutcomeHandler.java
+++ /dev/null
@@ -1,161 +0,0 @@
-package com.c2kernel.lifecycle.gui.view;
-
-import java.io.File;
-
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-
-import com.c2kernel.graph.model.GraphableVertex;
-import com.c2kernel.graph.view.VertexPropertyPanel;
-import com.c2kernel.gui.tabs.outcome.InvalidOutcomeException;
-import com.c2kernel.gui.tabs.outcome.InvalidSchemaException;
-import com.c2kernel.gui.tabs.outcome.OutcomeException;
-import com.c2kernel.gui.tabs.outcome.OutcomeHandler;
-import com.c2kernel.gui.tabs.outcome.OutcomeNotInitialisedException;
-import com.c2kernel.lifecycle.ActivityDef;
-import com.c2kernel.lifecycle.ActivitySlotDef;
-import com.c2kernel.lifecycle.CompositeActivityDef;
-import com.c2kernel.utils.CastorXMLUtility;
-import com.c2kernel.utils.FileStringUtility;
-import com.c2kernel.utils.LocalObjectLoader;
-import com.c2kernel.utils.Logger;
-
-/**************************************************************************
- *
- * $Revision: 1.5 $
- * $Date: 2005/10/05 07:39:37 $
- *
- * Copyright (C) 2003 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-public class ElemActDefOutcomeHandler extends VertexPropertyPanel implements OutcomeHandler {
-
- ActivityDef act;
- boolean unsaved;
- public ElemActDefOutcomeHandler() {
- super();
- createLayout(null);
- }
-
- /**
- *
- */
- @Override
- public void setOutcome(String outcome) throws InvalidOutcomeException {
- try {
- act = (ActivityDef)CastorXMLUtility.unmarshall(outcome);
- setVertex(act);
- } catch (Exception ex) {
- Logger.error(ex);
- throw new InvalidOutcomeException();
- }
- }
-
- /**
- *
- */
- @Override
- public void setDescription(String description)
- throws InvalidSchemaException {
- // ignore
- }
-
- /**
- *
- */
- @Override
- public void setReadOnly(boolean readOnly) {
- setEditable(!readOnly);
-
- }
-
- /**
- *
- */
- @Override
- public JPanel getPanel() throws OutcomeNotInitialisedException {
- return this;
- }
-
- /**
- *
- */
- @Override
- public String getOutcome() throws OutcomeException {
- try {
- return CastorXMLUtility.marshall(act);
- } catch (Exception ex) {
- Logger.error(ex);
- throw new OutcomeException();
- }
- }
-
- /**
- *
- */
- @Override
- public void run() {
- validate();
- }
-
- @Override
- public boolean isUnsaved() {
- return unsaved;
- }
-
- @Override
- public void saved() {
- unsaved = false;
- }
-
- @Override
- public void export(File targetFile) throws Exception {
- exportAct(targetFile.getParentFile(), act);
- }
-
- public static void exportAct(File dir, ActivityDef actDef) throws Exception {
- FileStringUtility.string2File(new File(dir, actDef.getActName()+".xml"), CastorXMLUtility.marshall(actDef));
- // Export associated schema
- exportSchema((String)actDef.getProperties().get("SchemaType"), (String)actDef.getProperties().get("SchemaVersion"), dir);
- // Export associated script
- exportScript((String)actDef.getProperties().get("ScriptName"), (String)actDef.getProperties().get("ScriptVersion"), dir);
-
- //Export child act if composite
- if (actDef instanceof CompositeActivityDef) {
- CompositeActivityDef compActDef = (CompositeActivityDef)actDef;
- for (int i=0; i<compActDef.getChildren().length; i++) {
- GraphableVertex vert = compActDef.getChildren()[i];
- exportScript((String)vert.getProperties().get("ScriptName"), (String)vert.getProperties().get("ScriptVersion"), dir);
- exportScript((String)vert.getProperties().get("RoutingScriptName"), (String)vert.getProperties().get("RoutingScriptVersion"), dir);
- }
- GraphableVertex[] childDefs = compActDef.getLayoutableChildren();
- for (GraphableVertex childDef : childDefs) {
- if (childDef instanceof ActivitySlotDef)
- exportAct(dir, ((ActivitySlotDef)childDef).getTheActivityDef());
- }
- }
- }
-
- public static void exportScript(String name, String version, File dir) {
- if (name == null || name.length()==0) return;
- try {
- FileStringUtility.string2File(new File(dir, name+"_"+version+".xml"),
- LocalObjectLoader.getScript(name, version));
- } catch (Exception ex) {
- Logger.error(ex);
- JOptionPane.showMessageDialog(null, "Could not export script "+name+"_"+version, "Error", JOptionPane.ERROR_MESSAGE);
- }
- }
-
- public static void exportSchema(String name, String version, File dir) {
- if (name == null || name.length()==0) return;
- try {
- FileStringUtility.string2File(new File(dir, name+"_"+version+".xsd"),
- LocalObjectLoader.getSchema(name, Integer.parseInt(version)).schema);
- } catch (Exception ex) {
- Logger.error(ex);
- JOptionPane.showMessageDialog(null, "Could not export schema "+name+"_"+version, "Error", JOptionPane.ERROR_MESSAGE);
- }
- }
-}
diff --git a/source/com/c2kernel/lifecycle/gui/view/SplitJoinDefRenderer.java b/source/com/c2kernel/lifecycle/gui/view/SplitJoinDefRenderer.java
deleted file mode 100644
index 84be70c..0000000
--- a/source/com/c2kernel/lifecycle/gui/view/SplitJoinDefRenderer.java
+++ /dev/null
@@ -1,138 +0,0 @@
-package com.c2kernel.lifecycle.gui.view;
-
-import java.awt.Color;
-import java.awt.FontMetrics;
-import java.awt.Graphics2D;
-import java.awt.Paint;
-
-import com.c2kernel.graph.model.GraphPoint;
-import com.c2kernel.graph.model.Vertex;
-import com.c2kernel.graph.view.VertexRenderer;
-import com.c2kernel.lifecycle.AndSplitDef;
-import com.c2kernel.lifecycle.JoinDef;
-import com.c2kernel.lifecycle.LoopDef;
-import com.c2kernel.lifecycle.OrSplitDef;
-import com.c2kernel.lifecycle.WfVertexDef;
-import com.c2kernel.lifecycle.XOrSplitDef;
-import com.c2kernel.utils.Language;
-
-
-public class SplitJoinDefRenderer implements VertexRenderer
-{
- private Paint mTextPaint = Color.black;
- private Paint mBoxPaint = new Color( 204, 204, 204 );
- private Paint mErrorPaint = new Color( 255, 50, 0 );
- private boolean mTextOffsetsNotInitialised = true;
- private int mTextYOffset = 0;
- private String mAndText = "And";
- private int mAndTextXOffset = 0;
- private String mOrText = "Or";
- private int mOrTextXOffset = 0;
- private String mXOrText = "XOr";
- private int mXOrTextXOffset = 0;
- private String mJoinText = "Join";
- private int mJoinTextXOffset = 0;
- private String mLoopText = "Loop";
- private int mLoopTextXOffset = 0;
- private String mRouteText = "";
- private int mRouteTextXOffset = 0;
- private String mXXXText = "XXX";
- private int mXXXTextXOffset = 0;
-
- @Override
- public void draw( Graphics2D g2d, Vertex vertex)
- {
- GraphPoint centrePoint = vertex.getCentrePoint();
- String text = null;
- int textXOffset = 0;
- int vertexHeight = vertex.getHeight();
- int vertexWidth = vertex.getWidth();
- boolean hasError = !((WfVertexDef)vertex).verify();
-
-
- if ( mTextOffsetsNotInitialised )
- {
- initialiseTextOffsets( g2d );
- mTextOffsetsNotInitialised = false;
- }
- if ( vertex instanceof LoopDef )
- {
- text = Language.translate(mLoopText);
- textXOffset = mLoopTextXOffset;
- }
- else if ( vertex instanceof XOrSplitDef )
- {
- text = Language.translate(mXOrText);
- textXOffset = mXOrTextXOffset;
- }
- else if ( vertex instanceof OrSplitDef )
- {
- text = Language.translate(mOrText);
- textXOffset = mOrTextXOffset;
- }
- else if ( vertex instanceof AndSplitDef )
- {
- text = Language.translate(mAndText);
- textXOffset = mAndTextXOffset;
- }
- else if ( vertex instanceof JoinDef)
- {
- String type= (String)((JoinDef)vertex).getProperties().get("Type");
- if (type!=null && type.equals("Route"))
- {
- text = mRouteText;
- textXOffset = mRouteTextXOffset;
- }
- else
- {
- text = Language.translate(mJoinText);
- textXOffset = mJoinTextXOffset;
- }
- }
- else
- {
- text = mXXXText;
- textXOffset = mXXXTextXOffset;
- }
-
-
- g2d.setPaint( hasError ? mErrorPaint : mBoxPaint );
- g2d.fillRect
- (
- centrePoint.x - vertexWidth / 2,
- centrePoint.y - vertexHeight / 2,
- vertexWidth,
- vertexHeight
- );
- g2d.setPaint( mTextPaint );
- g2d.drawRect
- (
- centrePoint.x - vertexWidth / 2,
- centrePoint.y - vertexHeight / 2,
- vertexWidth,
- vertexHeight
- );
- g2d.drawString( text, centrePoint.x - textXOffset, centrePoint.y + mTextYOffset );
- if (hasError) {
- g2d.setPaint( mErrorPaint );
- String errors = Language.translate(((WfVertexDef)vertex).getErrors());
- int errorWidth = g2d.getFontMetrics().stringWidth( errors );
- g2d.drawString( errors, centrePoint.x - ( errorWidth / 2), centrePoint.y + vertexHeight );
- }
- }
-
- private void initialiseTextOffsets( Graphics2D g2d )
- {
- FontMetrics metrics = g2d.getFontMetrics();
-
-
- mTextYOffset = metrics.getHeight() / 3;
- mAndTextXOffset = metrics.stringWidth( Language.translate(mAndText) ) / 2;
- mOrTextXOffset = metrics.stringWidth( Language.translate(mOrText) ) / 2;
- mXOrTextXOffset = metrics.stringWidth( Language.translate(mXOrText) ) / 2;
- mJoinTextXOffset = metrics.stringWidth( Language.translate(mJoinText) ) / 2;
- mLoopTextXOffset = metrics.stringWidth( Language.translate(mJoinText) ) / 2;
- mRouteTextXOffset = metrics.stringWidth( Language.translate(mRouteText) ) / 2;
- }
-}
-
diff --git a/source/com/c2kernel/lifecycle/gui/view/WfDirectedEdgeDefRenderer.java b/source/com/c2kernel/lifecycle/gui/view/WfDirectedEdgeDefRenderer.java
deleted file mode 100644
index 12df7a1..0000000
--- a/source/com/c2kernel/lifecycle/gui/view/WfDirectedEdgeDefRenderer.java
+++ /dev/null
@@ -1,134 +0,0 @@
-package com.c2kernel.lifecycle.gui.view;
-import java.awt.Color;
-import java.awt.Graphics2D;
-import java.awt.Shape;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.GeneralPath;
-
-import com.c2kernel.graph.model.DirectedEdge;
-import com.c2kernel.graph.model.GraphPoint;
-import com.c2kernel.graph.view.DirectedEdgeRenderer;
-import com.c2kernel.lifecycle.NextDef;
-public class WfDirectedEdgeDefRenderer implements DirectedEdgeRenderer
-{
- private GeneralPath mArrowTemplate = new GeneralPath();
- public WfDirectedEdgeDefRenderer()
- {
- mArrowTemplate.moveTo(-5, 5);
- mArrowTemplate.lineTo(0, 0);
- mArrowTemplate.lineTo(5, 5);
- }
- @Override
- public void draw(Graphics2D g2d, DirectedEdge directedEdge)
- {
- GraphPoint originPoint = directedEdge.getOriginPoint();
- GraphPoint terminusPoint = directedEdge.getTerminusPoint();
- GraphPoint midPoint = new GraphPoint();
- AffineTransform transform = new AffineTransform();
- Shape arrow = null;
- NextDef nextDef = (NextDef) directedEdge;
- boolean hasError = !nextDef.verify();
- String text = (String) nextDef.getProperties().get("Alias");
- g2d.setPaint(hasError ? Color.red : Color.black);
- if (("Broken +".equals(nextDef.getProperties().get("Type"))))
- {
- g2d.drawLine(originPoint.x, originPoint.y, originPoint.x, (originPoint.y + terminusPoint.y) / 2);
- g2d.drawLine(originPoint.x, (originPoint.y + terminusPoint.y) / 2, terminusPoint.x, (originPoint.y + terminusPoint.y) / 2);
- g2d.drawLine(terminusPoint.x, (originPoint.y + terminusPoint.y) / 2, terminusPoint.x, terminusPoint.y);
- midPoint.x = (originPoint.x + terminusPoint.x) / 2;
- midPoint.y = (originPoint.y + terminusPoint.y) / 2;
- transform.translate(midPoint.x, midPoint.y);
- transform.rotate(
- calcArrowAngle(
- originPoint.x,
- originPoint.x - terminusPoint.x > -5
- && originPoint.x - terminusPoint.x < 5 ? originPoint.y : (originPoint.y + terminusPoint.y) / 2,
- terminusPoint.x,
- originPoint.x - terminusPoint.x > -5
- && originPoint.x - terminusPoint.x < 5 ? terminusPoint.y : (originPoint.y + terminusPoint.y) / 2));
- }
- else if (("Broken -".equals(nextDef.getProperties().get("Type"))))
- {
- g2d.drawLine(originPoint.x, originPoint.y, terminusPoint.x, originPoint.y);
- g2d.drawLine(terminusPoint.x, originPoint.y, terminusPoint.x, terminusPoint.y);
- boolean arrowOnY = !(originPoint.y - terminusPoint.y < 60 && originPoint.y - terminusPoint.y > -60);
- midPoint.x = arrowOnY ? terminusPoint.x : (originPoint.x + terminusPoint.x) / 2;
- midPoint.y = arrowOnY ? (originPoint.y + terminusPoint.y) / 2 : originPoint.y;
- transform.translate(midPoint.x, midPoint.y);
- transform
- .rotate(
- calcArrowAngle(
- arrowOnY ? terminusPoint.x : originPoint.x,
- arrowOnY ? originPoint.y : originPoint.y,
- arrowOnY ? terminusPoint.x : terminusPoint.x,
- arrowOnY ? terminusPoint.y : originPoint.y));
- }
- else if (("Broken |".equals(nextDef.getProperties().get("Type"))))
- {
- g2d.drawLine(originPoint.x, originPoint.y, originPoint.x, terminusPoint.y);
- g2d.drawLine(originPoint.x, terminusPoint.y, terminusPoint.x, terminusPoint.y);
- boolean arrowOnY = !(originPoint.y - terminusPoint.y < 60 && originPoint.y - terminusPoint.y > -60);
- midPoint.x = arrowOnY ? originPoint.x : (originPoint.x + terminusPoint.x) / 2;
- midPoint.y = arrowOnY ? (originPoint.y + terminusPoint.y) / 2 : terminusPoint.y;
- transform.translate(midPoint.x, midPoint.y);
- transform
- .rotate(
- calcArrowAngle(
- arrowOnY ? terminusPoint.x : originPoint.x,
- arrowOnY ? originPoint.y : originPoint.y,
- arrowOnY ? terminusPoint.x : terminusPoint.x,
- arrowOnY ? terminusPoint.y : originPoint.y));
- }
- else
- {
- g2d.drawLine(originPoint.x, originPoint.y, terminusPoint.x, terminusPoint.y);
- midPoint.x = originPoint.x + (terminusPoint.x - originPoint.x) / 2;
- midPoint.y = originPoint.y + (terminusPoint.y - originPoint.y) / 2;
- transform.translate(midPoint.x, midPoint.y);
- transform.rotate(calcArrowAngle(originPoint.x, originPoint.y, terminusPoint.x, terminusPoint.y));
- }
-
- arrow = mArrowTemplate.createTransformedShape(transform);
- g2d.draw(arrow);
- if (text != null)
- g2d.drawString(text, midPoint.x + 10, midPoint.y);
- }
- private static double calcArrowAngle(int originX, int originY, int terminusX, int terminusY)
- {
- double width = terminusX - originX;
- double height = terminusY - originY;
- if ((width == 0) && (height > 0))
- {
- return Math.PI;
- }
- if ((width == 0) && (height < 0))
- {
- return 0;
- }
- if ((width > 0) && (height == 0))
- {
- return Math.PI / 2.0;
- }
- if ((width < 0) && (height == 0))
- {
- return -1.0 * Math.PI / 2.0;
- }
- if ((width > 0) && (height > 0))
- {
- return Math.PI / 2.0 + Math.atan(Math.abs(height) / Math.abs(width));
- }
- if ((width > 0) && (height < 0))
- {
- return Math.atan(Math.abs(width) / Math.abs(height));
- }
- if ((width < 0) && (height < 0))
- {
- return -1.0 * Math.atan(Math.abs(width) / Math.abs(height));
- }
- if ((width < 0) && (height > 0))
- {
- return -1.0 * (Math.PI / 2.0 + Math.atan(Math.abs(height) / Math.abs(width)));
- }
- return 0.0;
- }
-}
diff --git a/source/com/c2kernel/lifecycle/gui/view/WfVertexDefRenderer.java b/source/com/c2kernel/lifecycle/gui/view/WfVertexDefRenderer.java
deleted file mode 100644
index 9199615..0000000
--- a/source/com/c2kernel/lifecycle/gui/view/WfVertexDefRenderer.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.c2kernel.lifecycle.gui.view;
-
-import java.awt.Graphics2D;
-
-import com.c2kernel.graph.model.Vertex;
-import com.c2kernel.graph.view.VertexRenderer;
-import com.c2kernel.lifecycle.ActivitySlotDef;
-import com.c2kernel.lifecycle.AndSplitDef;
-import com.c2kernel.lifecycle.JoinDef;
-
-public class WfVertexDefRenderer implements VertexRenderer
-{
- protected ActivitySlotDefRenderer mActivitySlotDefRenderer = new ActivitySlotDefRenderer();
- protected SplitJoinDefRenderer mSplitJoinDefRenderer = new SplitJoinDefRenderer();
-
-
- @Override
- public void draw( Graphics2D g2d, Vertex vertex)
- {
- if ( vertex instanceof ActivitySlotDef )
- {
- mActivitySlotDefRenderer.draw( g2d, vertex);
- }
- else if ( ( vertex instanceof AndSplitDef ) || ( vertex instanceof JoinDef ) )
- {
- mSplitJoinDefRenderer.draw( g2d, vertex);
- }
- }
-}
-
diff --git a/source/com/c2kernel/lifecycle/instance/Activity.java b/source/com/c2kernel/lifecycle/instance/Activity.java
deleted file mode 100644
index 8a07d15..0000000
--- a/source/com/c2kernel/lifecycle/instance/Activity.java
+++ /dev/null
@@ -1,689 +0,0 @@
-package com.c2kernel.lifecycle.instance;
-import java.util.ArrayList;
-import java.util.Vector;
-
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.GTimeStamp;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.common.ObjectAlreadyExistsException;
-import com.c2kernel.common.ObjectNotFoundException;
-import com.c2kernel.entity.agent.Job;
-import com.c2kernel.events.Event;
-import com.c2kernel.events.History;
-import com.c2kernel.graph.model.Vertex;
-import com.c2kernel.lifecycle.WfCastorHashMap;
-import com.c2kernel.lifecycle.instance.stateMachine.StateMachine;
-import com.c2kernel.lifecycle.instance.stateMachine.States;
-import com.c2kernel.lifecycle.instance.stateMachine.Transitions;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.lookup.InvalidEntityPathException;
-import com.c2kernel.lookup.LDAPRoleManager;
-import com.c2kernel.lookup.RolePath;
-import com.c2kernel.persistency.ClusterStorage;
-import com.c2kernel.persistency.TransactionManager;
-import com.c2kernel.persistency.outcome.Outcome;
-import com.c2kernel.persistency.outcome.Viewpoint;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.scripting.ScriptingEngineException;
-import com.c2kernel.utils.DateUtility;
-import com.c2kernel.utils.Logger;
-/**
- * @version $Revision: 1.222 $ $Date: 2005/10/05 07:39:37 $
- * @author $Author: abranson $
- */
-public class Activity extends WfVertex
-{
- /**
- * vector of errors (Strings) that is constructed each time verify() is launched
- */
- protected Vector<String> mErrors;
- /** @associates a State machine engine */
- private StateMachine machine;
- /** true is avalaibe to be executed */
- public boolean active = false;
- /** used in verify() */
- private boolean loopTested;
- //public Vector eventIds;
- /** Storage of eventIds thrown by the Activity */
- public EventStorage eventIds;
- private GTimeStamp mStartDate;
- private GTimeStamp mActiveDate;
- private String mType;
- private EntityPath mEntityPath;
- public Activity()
- {
- super();
- setProperties(new WfCastorHashMap());
- mErrors = new Vector<String>(0, 1);
- machine = new StateMachine(this);
- eventIds = new EventStorage();
- mStartDate = new GTimeStamp();
- mActiveDate = new GTimeStamp();
- DateUtility.setToNow(mActiveDate);
- DateUtility.setToNow(mStartDate);
- }
- /** @return the SystemKey of the item that contains the workflow */
- public EntityPath getItemEntityPath()
- {
- if (mEntityPath == null)
- try
- {
- Integer i = (Integer) (getWf().getProperties().get("ItemSystemKey"));
- if (i == null)
- return null; // no item yet
- EntityPath entityPath = new EntityPath(i.intValue());
- mEntityPath = entityPath;
- }
- catch (InvalidEntityPathException ex)
- {
- Logger.error("InvalidEntityPathException::Activity::getItemSystemKey() " + ex.toString());
- return null;
- }
- return mEntityPath;
- }
- /** @return the StateMachine */
- public StateMachine getMachine()
- {
- return machine;
- }
- /** sets the StateMachine (Only for Serialisation) */
- public void setMachine(StateMachine sm)
- {
- machine = sm;
- }
- /** add the activity which id is idNext as next of the current one */
- void addNext(String idNext)
- {
- new Next(this, (WfVertex) getParent().search(idNext));
- }
- /**
- * adds a New link between the current Activity and the WfVertex passed in param
- */
- @Override
- public Next addNext(WfVertex vertex)
- {
- return new Next(this, vertex);
- }
- /** return the current State of the State machine */
- public int getCurrentState()
- {
- return machine.getCurrentState();
- }
- /** return the current State of the State machine (Used in Serialisation) */
- public int getState()
- {
- if (machine == null)
- machine = new StateMachine(this);
- return getCurrentState();
- }
- /** Sets a new State in a State machine */
- public void setState(int stat)
- {
- if (machine == null)
- machine = new StateMachine(this);
- machine.state = stat;
- }
- /** check the abiltity of the agent passed in param to act on the activity */
- //return's the agentName
- public String checkAccessRights(AgentPath agent) throws AccessRightsException
- {
- String agentID = getCurrentAgentName();
- boolean authorised = agentID.equals(agent.getAgentName());
- String actRole = getCurrentAgentRole();
- if (!authorised)
- {
- authorised = actRole == null || actRole.equals("") || actRole.equals("all");
- }
- if (!authorised)
- {
- RolePath[] roles = agent.getRoles();
- for (int i = 0; !authorised && i < roles.length; i++)
- {
- if (roles[i].getName().equalsIgnoreCase("Admin"))
- authorised = true;
- if (roles[i].getName().equalsIgnoreCase(actRole))
- authorised = true;
- if (roles[i].getName().equalsIgnoreCase("Guest"))
- throw new AccessRightsException("Guest execution forbidden");
- }
- }
- if (!authorised)
- throw new AccessRightsException("Activity::checkAccessRights() - Agent does not hold the correct role.");
- return agent.getAgentName();
- }
- /** cf Item request */
- public void request(AgentPath agent, int transitionID, String requestData) throws AccessRightsException, InvalidTransitionException, InvalidDataException, ObjectAlreadyExistsException
- {
- int state = getState();
- String agentName = checkAccessRights(agent);
- if (machine.traverse(transitionID))
- {
- setReservation(transitionID, agentName);
- sendEventStoreOutcome(transitionID, requestData, agent);
- if (transitionID == Transitions.REPEAT)
- {
- setActive(true);
- if (getIsComposite())
- {
- WfVertex v = (WfVertex) ((CompositeActivity) this).search(getPath() + "/" + ((CompositeActivity) this).getChildGraphModel().getStartVertexId());
- v.reinit(getID());
- try
- {
- runfirst(agent);
- }
- catch (ScriptingEngineException e)
- {
- Logger.error(e);
- }
- }
- }
- if (transitionID == Transitions.COMPLETE && state == States.RSTARTED)
- setActive(false);
- if (transitionID == Transitions.START)
- start();
- if ((transitionID == Transitions.SKIP && getActive())
- || transitionID == Transitions.DONE
- || (transitionID == Transitions.COMPLETE && state == States.STARTED)
- || transitionID == Transitions.PROCEED)
- try
- {
- runNext(agent);
- }
- catch (ScriptingEngineException e)
- {
- Logger.error(e);
- }
- // run post execution script now
- try
- {
- String postSubmitScr = (String) getProperties().get("PostExecScriptName");
- String postSubmitVer = (String) getProperties().get("PostExecScriptVersion");
- if (postSubmitScr != null && (transitionID == Transitions.COMPLETE || transitionID == Transitions.DONE))
- evaluateScript(postSubmitScr, postSubmitVer);
- }
- catch (ScriptingEngineException ex)
- {
- Logger.error(ex);
- }
- //refresh all the job lists
- pushJobsToAgents();
- }
- else
- throw new InvalidTransitionException("Activity is in the wrong state.");
- }
- public void setReservation(int transitionID, String agentName)
- {
- String actAgentName = (String) getProperties().get("Agent Name");
- switch (transitionID)
- {
- // these transition reserve the activity
- case Transitions.REASSIGN :
- case Transitions.RESERVE :
- case Transitions.START :
- actAgentName = agentName;
- break;
- // these clear any current reservation
- case Transitions.COMPLETE :
- case Transitions.DONE :
- case Transitions.IGNORE :
- case Transitions.SKIP :
- actAgentName = "";
- // other transitions have no effect on the reservations
- default :
- }
- getProperties().put("Agent Name", actAgentName);
- }
- public String getTransitions()
- {
- String result = "<PossibleTransitions>";
- int i;
- for (i = 0; i < machine.possibleTransition().length; i++)
- {
- result += machine.possibleTransition()[i] + ",";
- }
- //cuts out the last comma(',') if required
- if (i > 0)
- {
- result = result.substring(0, result.length() - 1);
- }
- result += "</PossibleTransitions>";
- return result;
- }
- /** launch the verification of the activity */
- @Override
- public boolean verify()
- {
- mErrors.removeAllElements();
- int nbInEdgres = getInEdges().length;
- int nbOutEdges = getOutEdges().length;
- if (nbInEdgres == 0 && this.getID() != getParent().getChildrenGraphModel().getStartVertexId())
- {
- mErrors.add("Unreachable");
- return false;
- }
- else if (nbInEdgres > 1)
- {
- mErrors.add("Bad nb of previous");
- return false;
- }
- else if (nbOutEdges > 1)
- {
- mErrors.add("too many next");
- return false;
- }
- else if (nbOutEdges == 0)
- {
- if (!((CompositeActivity) getParent()).hasGoodNumberOfActivity())
- {
- mErrors.add("too many endpoints");
- return false;
- }
- }
-// else
-// {
-// Vertex[] outV = getOutGraphables();
-// Vertex[] anteVertices = GraphTraversal.getTraversal(getParent().getChildrenGraphModel(), this, GraphTraversal.kUp, false);
-// boolean errInLoop = false;
-// for (int i = 0; i < outV.length; i++)
-// {
-// for (int j = 0; j < anteVertices.length; j++)
-// if (!loop() && outV[i].getID() == anteVertices[j].getID())
-// errInLoop = true;
-// }
-// if (errInLoop)
-// {
-// mErrors.add("Error In Loop");
-// return false;
-// }
-// }
- return true;
- }
- /** Used in verify() */
- @Override
- public boolean loop()
- {
- boolean loop2 = false;
- if (!loopTested)
- {
- loopTested = true;
- if (getOutGraphables().length != 0)
- loop2 = ((WfVertex) getOutGraphables()[0]).loop();
- }
- loopTested = false;
- return loop2;
- }
- /** sets the next activity available if possible */
- @Override
- public void runNext(AgentPath agent) throws ScriptingEngineException
- {
- setActive(false);
- try
- {
- Vertex[] outVertices = getOutGraphables();
- Vertex[] outVertices2 = getOutGraphables();
- boolean hasNoNext = false;
- boolean out = false;
- while (!out)
- if (outVertices2.length > 0)
- {
- if (outVertices2[0] instanceof Join)
- outVertices2 = ((WfVertex) outVertices2[0]).getOutGraphables();
- else
- out = true;
- }
- else
- {
- hasNoNext = true;
- out = true;
- }
- Logger.debug(8, outVertices + " " + outVertices2);
- if (!hasNoNext)
- ((WfVertex) outVertices[0]).run(agent);
- else
- {
- if (getParent() != null && getParent().getName().equals("domain")) // workflow
- // finished
- setActive(true);
- else
- {
- CompositeActivity parent = (CompositeActivity) getParent();
- if (parent != null)
- parent.runNext(agent);
- }
- }
- }
- catch (ScriptingEngineException s)
- {
- setActive(true);
- throw s;
- }
- }
- /** @return the only Next of the Activity */
- public Next getNext()
- {
- if (getOutEdges().length > 0)
- return (Next) getOutEdges()[0];
- else
- return null;
- }
- /** reinitialises the Activity and propagate (for Loop) */
- @Override
- public void reinit(int idLoop)
- {
- Logger.debug(7, "reinit " + getItemEntityPath().getSysKey() + " " + getPath());
- Vertex[] outVertices = getOutGraphables();
- machine.state = States.WAITING;
- if (outVertices.length > 0)
- {
- WfVertex nextAct = (WfVertex) outVertices[0];
- nextAct.reinit(idLoop);
- }
- }
- /** return the String that identifies the errors found in th activity */
- @Override
- public String getErrors()
- {
- if (mErrors.size() == 0)
- return "No error";
- return mErrors.elementAt(0);
- }
- /**
- * called by precedent Activity runNext() for setting the activity able to be executed
- */
- @Override
- public void run(AgentPath agent) throws ScriptingEngineException
- {
- Logger.debug(8, getPath() + " run " + getCurrentState());
- if (!getActive())
- setActive(true);
-
- if (getMachine().getCurrentState() == States.FINISHED)
- {
- runNext(agent);
- }
- else
- {
- DateUtility.setToNow(mActiveDate);
- if (((Boolean) getProperties().get(StateMachine.AUTOSTART)).booleanValue() && machine.state == States.WAITING)
- {
- machine.traverse(Transitions.START);
- start();
- }
- pushJobsToAgents();
- }
- }
- /**
- * sets the activity available to be executed on start of Workflow or composite activity (when it is the first one of the (sub)process
- */
- @Override
- public void runfirst(AgentPath agent) throws ScriptingEngineException
- {
- Logger.debug(8, getPath() + " runfirst");
- run(agent);
- }
- /** @return the current ability to be executed */
- public boolean getActive()
- {
- return active;
- }
- /** sets the ability to be executed */
- public void setActive(boolean acti)
- {
- active = acti;
- }
- /** @return the Description field of properties */
- public String getDescription()
- {
- if (getProperties().containsKey("Description"))
- return (String) (getProperties().get("Description"));
- return "No description";
- }
- public String getCurrentAgentName()
- {
- return (String) getProperties().get("Agent Name");
- }
- public String getCurrentAgentRole()
- {
- return (String) getProperties().get("Agent Role");
- }
- /**
- * @return an array of Steps that matches the querry
- * @param agentID
- * Agent concerned by the query
- * @param agentRole
- * Agent concerned by the query @int stateID state to test in the query, use -1 for all
- * @param filter
- * if tru will be filtered by agent, else won't
- */
- public Activity[] query(AgentPath agent, int stateID, boolean filter)
- {
- if (getCurrentState() == stateID || stateID == -1)
- {
- Activity[] steps = { this };
- if (!filter)
- return steps;
- else
- {
- try
- {
- checkAccessRights(agent);
- return steps;
- }
- catch (AccessRightsException e)
- {
- //case that agent is not allowed
- Logger.msg(7, "Activity :: AccessRightsException in " + this.getItemEntityPath() + "/" + this.getPath());
- }
- }
- }
- return new Activity[0];
- }
- /**
- * returns the lists of jobs for the activity and children (cf com.c2kernel.entity.Job)
- */
- public ArrayList<Job> calculateJobs(AgentPath agent, boolean recurse)
- {
- return calculateJobsBase(agent, false);
- } //
- public ArrayList<Job> calculateAllJobs(AgentPath agent, boolean recurse)
- {
- return calculateJobsBase(agent, true);
- }
- private ArrayList<Job> calculateJobsBase(AgentPath agent, boolean all)
- {
- Logger.msg(7, "calculateJobs - " + getPath());
- int[] transitions = {
- };
- ArrayList<Job> jobs = new ArrayList<Job>();
- try
- {
- String agentName = checkAccessRights(agent);
- String currentAgentName = getCurrentAgentName();
- boolean isCurrent = currentAgentName == null || currentAgentName.equals("") || agentName.equals(currentAgentName);
- if ((all || getActive()) && !getName().equals("domain"))
- transitions = machine.possibleTransition();
- Logger.msg(7, "Activity.calculateJobs() - Got " + transitions.length + " transitions.");
- for (int i = 0; i < transitions.length; i++)
- {
- Logger.msg(7, "Creating Job object for transition " + transitions[i]);
- if ((isCurrent && !(transitions[i] == Transitions.REASSIGN && agentName.equals(currentAgentName))) || (transitions[i] == Transitions.REASSIGN && !agentName.equals(currentAgentName)))
- jobs.add(new Job(getItemEntityPath().getSysKey(), getPath(), transitions[i], getCurrentState(), machine.simulate(transitions[i]), getName(), getProperties(), getType(), agentName));
- }
- }
- catch (AccessRightsException ex)
- {
- Logger.msg(6, "Agent "+ agent.getAgentName() +" is not allowed to interact with "+getItemEntityPath().getSysKey()+":"+getPath());
- } // empty joblist then
- return jobs;
- }
- //
- //methods written by kovax
- //
- /** Adds an event to the AuditTrail of the Item if any */
- private Event auditEvent(int transitionID, AgentPath agent)
- {
- EntityPath entityPath = getItemEntityPath();
- if (entityPath != null)
- {
- Event event = null;
- History hist = null;
- try
- {
- hist = (History) Gateway.getStorage().get(entityPath.getSysKey(), ClusterStorage.HISTORY, this);
- event = hist.addEvent(agent.getAgentName(), getCurrentAgentRole(), transitionID, getName(), getPath(), getType(), getCurrentState());
- Logger.msg(7, "Activity::auditEvent() - Event:" + event.getName() + " was added to the AuditTrail");
- }
- catch (Exception ex)
- {
- Logger.error("Activity::auditEvent() - Item '" + entityPath.toString() + "'!");
- Logger.error(ex);
- }
- return event;
- }
- else
- return null;
- } /**
- * Stores the request data as an outcome of the Item It does a great deal of storing outcomes in different configuration
- */ //requestdata is xmlstring
- private String storeOutcome(int eventID, String requestData)
- {
- EntityPath entityPath = getItemEntityPath();
- if (entityPath != null)
- {
- String schemaType = (String) getProperties().get("SchemaType");
- if (schemaType == null || schemaType.length() == 0) // no
- // outcome
- // required
- return null;
- int schemaVersion = 0;
- String versionString = (String) getProperties().get("SchemaVersion");
- try
- {
- schemaVersion = Integer.parseInt(versionString);
- }
- catch (Exception e)
- {
- Logger.error("Activity.storeOutcome() - invalid schemaVersion " + versionString);
- }
- Logger.msg(5, "Activity::storeOutcome() - type:" + schemaType + " version:" + schemaVersion);
- try
- {
- Outcome newOutcome = new Outcome(eventID, requestData, schemaType, schemaVersion);
- Gateway.getStorage().put(entityPath.getSysKey(), newOutcome, this);
- // update specific view if defined
- String specificView = (String) getProperties().get("Viewpoint");
- if (specificView != null && !specificView.equals(""))
- {
- Viewpoint currentView = new Viewpoint(entityPath.getSysKey(), schemaType, specificView, schemaVersion, eventID);
- Gateway.getStorage().put(entityPath.getSysKey(), currentView, this);
- } // update last view
- Viewpoint currentView = new Viewpoint(entityPath.getSysKey(), schemaType, "last", schemaVersion, eventID);
- Gateway.getStorage().put(entityPath.getSysKey(), currentView, this);
- return schemaType + "/" + schemaVersion + "/" + eventID;
- }
- catch (Exception ex)
- {
- Logger.error("ActivityBase::storeOutcome() - Item '" + entityPath.toString() + "'!");
- Logger.error(ex);
- }
- return null;
- }
- else
- return null;
- } /** the method to be called by the requestAction() method */
- public void sendEventStoreOutcome(int transitionID, String requestData, AgentPath agent)
- {
- int eventID = -1;
- Event event = null;
- event = auditEvent(transitionID, agent);
- if (event != null)
- eventID = event.getID();
- if (transitionID == Transitions.DONE || transitionID == Transitions.COMPLETE)
- storeOutcome(eventID, requestData);
- EntityPath entityPath = getItemEntityPath();
- TransactionManager storage = Gateway.getStorage();
- if (entityPath != null)
- {
- storage.commit(this);
- }
- }
- public void pushJobsToAgents()
- {
- String agentRole = getCurrentAgentRole();
- if (agentRole == null || agentRole.length()==0) return;
-
- LDAPRoleManager roleMan = Gateway.getLDAPLookup().getRoleManager();
- RolePath myRole;
- try {
- myRole = roleMan.getRolePath(agentRole);
- } catch (ObjectNotFoundException ex) { // non-existent role
- Logger.msg(7, "Activity.pushJobsToAgents() - Activity role '"+agentRole+" not found.");
- return;
- }
-
- if (myRole.hasJobList())
- new JobPusher(this, myRole).start();
- }
-
-
- /**
- * Returns the activeDate.
- *
- * @return GTimeStamp
- */
- public GTimeStamp getActiveDate()
- {
- return mActiveDate;
- } /**
- * Returns the startDate.
- *
- * @return GTimeStamp
- */
- public GTimeStamp getStartDate()
- {
- return mStartDate;
- } /**
- * Sets the activeDate.
- *
- * @param activeDate
- * The activeDate to set
- */
- public void setActiveDate(GTimeStamp activeDate)
- {
- mActiveDate = activeDate;
- } /**
- * Sets the startDate.
- *
- * @param startDate
- * The startDate to set
- */
- public void setStartDate(GTimeStamp startDate)
- {
- mStartDate = startDate;
- } /**
- * Returns the type.
- *
- * @return String
- */
- public String getType()
- {
- return mType;
- } /**
- * Sets the type.
- *
- * @param type
- * The type to set
- */
- public void setType(String type)
- {
- mType = type;
- }
- private void start()
- {
- Logger.debug(8, getPath() + " start");
- DateUtility.setToNow(mStartDate);
- }
-
-}
diff --git a/source/com/c2kernel/lifecycle/instance/AdvancementCalculator.java b/source/com/c2kernel/lifecycle/instance/AdvancementCalculator.java
deleted file mode 100644
index 6a3abe7..0000000
--- a/source/com/c2kernel/lifecycle/instance/AdvancementCalculator.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/* Created on 11 mars 2004 */
-package com.c2kernel.lifecycle.instance;
-import java.io.Serializable;
-import java.util.Hashtable;
-
-import com.c2kernel.graph.model.Vertex;
-import com.c2kernel.lifecycle.instance.stateMachine.States;
-//import com.c2kernel.utils.Logger;
-/** @author XSeb74 */
-public class AdvancementCalculator implements Serializable
-{
- private CompositeActivity activity;
- private Hashtable<Vertex, Serializable> isMarked;
- private Hashtable<Vertex, Vertex> HasNextMarked;
- public Hashtable<String, Vertex> hasprevActive;
- private long mCurrentNbActExp = 0;
- private long mMaximuNbActexp = 0;
- private long mNbActpassed = 0;
- private long mNbActpassedWithCurrent = 0;
- private long mNbActLeftWithCurrent = 0;
- private long mNbActLeftWithoutCurrent = 0;
- private boolean mIsbranchActive = false;
- private boolean mIsbranchFinished = true;
- private boolean mHasPrevActive = false;
- public AdvancementCalculator()
- {
- isMarked = new Hashtable<Vertex, Serializable>();
- HasNextMarked = new Hashtable<Vertex, Vertex>();
- hasprevActive = new Hashtable<String, Vertex>();
- }
- public void calculate(CompositeActivity act)
- {
-// Logger.debug(0, act.getName()+" >>>>>>>>>");
- if (act instanceof Workflow)
- {
- calculate((CompositeActivity) act.search("workflow/domain"));
- return;
- }
- activity = act;
- Vertex v = activity.getChildGraphModel().getStartVertex();
- check(v, this);
- isMarked = new Hashtable<Vertex, Serializable>();
- calc(v, this);
-// Logger.debug(0, act.getName()+" <<<<<<<<<");
- }
- private void check(Vertex v, AdvancementCalculator current)
- {
- current.isMarked.put(v, "");
- Vertex[] nexts = current.activity.getChildGraphModel().getOutVertices(v);
- for (Vertex next : nexts)
- if (current.isMarked.get(next) != null)
- current.HasNextMarked.put(v, next);
- else
- check(next, current);
- int j=0;
- for (Vertex next : nexts)
- if (current.HasNextMarked.get(next) != null)
- j++;
- if (j != 0 && j==nexts.length) current.HasNextMarked.put(v, nexts[0]);
- }
- private void calc(Vertex v, AdvancementCalculator current)
- {
- if (current.isMarked.get(v) != null && !(v instanceof Join))
- return;
- if (v instanceof Activity)
- {
- current.isMarked.put(v, current);
- Activity act = (Activity) v;
- if (v instanceof CompositeActivity)
- {
- CompositeActivity cact = (CompositeActivity) v;
- AdvancementCalculator adv = new AdvancementCalculator();
- adv.isMarked = current.isMarked;
- adv.HasNextMarked = current.HasNextMarked;
- adv.calculate(cact);
- current.mCurrentNbActExp += adv.mCurrentNbActExp;
- current.mMaximuNbActexp += adv.mMaximuNbActexp;
- current.mNbActpassed += adv.mNbActpassed;
- current.mNbActpassedWithCurrent += adv.mNbActpassedWithCurrent;
- current.mIsbranchActive = current.mIsbranchActive || adv.mIsbranchActive||act.getActive();
- current.mNbActLeftWithCurrent += adv.mNbActLeftWithCurrent;
- current.mNbActLeftWithoutCurrent += adv.mNbActLeftWithoutCurrent;
- current.mHasPrevActive = adv.mHasPrevActive||act.getActive();
- if (adv.hasprevActive.size()!=0) current.mHasPrevActive=true;
- }
- else
- {
- current.mCurrentNbActExp += 1;
- current.mMaximuNbActexp += 1;
- if (act.getCurrentState() == States.FINISHED)
- {
- current.mNbActpassed += 1;
- current.mNbActpassedWithCurrent += 1;
- }
- else if (act.getActive()&&act.getState()<States.REPEATSTATESTART)
- {
- current.mIsbranchActive = true;
- current.mIsbranchFinished = false;
- current.mHasPrevActive = true;
-// Logger.debug(0, "set HasprevActive to true " + act.getName());
- current.mNbActpassedWithCurrent += 1;
- current.mNbActLeftWithCurrent += 1;
- }
- else
- {
- current.mIsbranchFinished = false;
- current.mNbActLeftWithCurrent += 1;
- current.mNbActLeftWithoutCurrent += 1;
- }
- }
- }
- Vertex[] nexts = current.activity.getChildGraphModel().getOutVertices(v);
- if (v instanceof Split)
- {
- current.isMarked.put(v, current);
- AdvancementCalculator[] advs = new AdvancementCalculator[nexts.length];
- for (int i = 0; i < nexts.length; i++)
- {
- advs[i] = new AdvancementCalculator();
- advs[i].mHasPrevActive = current.mHasPrevActive;
- advs[i].isMarked = current.isMarked;
- advs[i].HasNextMarked = current.HasNextMarked;
- advs[i].activity = current.activity;
- if ((v instanceof Loop) && (current.HasNextMarked.get(nexts[i]) != null))
-// Logger.debug(0, v.getID() + " " + nexts[i].getID() + " HasNextMarked")
- ;
- else
- calc(nexts[i], advs[i]);
- }
- long maximuNbActexp = 0;
- long currentNbActExp = 0;
- long NbActpassed = 0;
- long NbActpassedWithCurrent = 0;
- long NbActLeftWithCurrent = 0;
- long NbActLeftWithoutCurrent = 0;
- boolean hasNobranchFinished = true;
- boolean hasNoBranchActive = true;
- for (AdvancementCalculator adv : advs) {
- if (adv.mIsbranchActive)
- hasNoBranchActive = false;
- if (adv.mIsbranchFinished)
- hasNobranchFinished = false;
- }
- for (AdvancementCalculator adv : advs) {
-
- if (maximuNbActexp < adv.mMaximuNbActexp)
- maximuNbActexp = adv.mMaximuNbActexp;
- if (adv.mIsbranchActive || adv.mIsbranchFinished || (hasNoBranchActive && hasNobranchFinished))
- {
- if (NbActpassed < adv.mNbActpassed)
- NbActpassed = adv.mNbActpassed;
- if (NbActpassedWithCurrent < adv.mNbActpassedWithCurrent)
- NbActpassedWithCurrent = adv.mNbActpassedWithCurrent;
- if (NbActLeftWithCurrent < adv.mNbActLeftWithCurrent)
- NbActLeftWithCurrent = adv.mNbActLeftWithCurrent;
- if (NbActLeftWithoutCurrent < adv.mNbActLeftWithoutCurrent)
- NbActLeftWithoutCurrent += adv.mNbActLeftWithoutCurrent;
- if (currentNbActExp < adv.mCurrentNbActExp)
- currentNbActExp = adv.mCurrentNbActExp;
- }
- }
- current.mCurrentNbActExp += currentNbActExp;
- current.mNbActpassedWithCurrent += NbActpassedWithCurrent;
- current.mMaximuNbActexp += maximuNbActexp;
- current.mNbActpassed += NbActpassed;
- current.mIsbranchActive = current.mIsbranchActive || !hasNoBranchActive;
- current.mNbActLeftWithCurrent += NbActLeftWithCurrent;
- current.mNbActLeftWithoutCurrent += NbActLeftWithoutCurrent;
- return;
- }
- if (v instanceof Join)
- {
- AdvancementCalculator adv;
- if (current.isMarked.get(v) == null)
- {
- adv = new AdvancementCalculator();
- adv.isMarked = current.isMarked;
- adv.HasNextMarked = current.HasNextMarked;
- adv.activity = current.activity;
- adv.mHasPrevActive = current.mHasPrevActive;
- current.isMarked.put(v, adv);
- if (nexts.length == 1)
- calc(nexts[0], adv);
- }
- else
- adv = (AdvancementCalculator) current.isMarked.get(v);
- current.mCurrentNbActExp += adv.mCurrentNbActExp;
- current.mMaximuNbActexp += adv.mMaximuNbActexp;
- current.mNbActpassed += adv.mNbActpassed;
- current.mNbActpassedWithCurrent += adv.mNbActpassedWithCurrent;
- current.mIsbranchActive = current.mIsbranchActive || (current.mMaximuNbActexp == 0 && adv.mIsbranchActive);
- if (current.mHasPrevActive)
- hasprevActive.put(String.valueOf(v.getID()), v);
- current.mNbActLeftWithCurrent += adv.mNbActLeftWithCurrent;
- current.mNbActLeftWithoutCurrent += adv.mNbActLeftWithoutCurrent;
- return;
- }
- if (nexts.length != 0)
- calc(nexts[0], current);
- }
- public long getLongestWayInAct()
- {
- return mMaximuNbActexp;
- }
- public long getCurrentLongestWayInAct()
- {
- return mCurrentNbActExp;
- }
- public long getNbActLeftWithActive()
- {
- return mNbActLeftWithCurrent;
- }
- public long getNbActLeftWithoutActive()
- {
- return mNbActLeftWithoutCurrent;
- }
- public long getNbActPassedWithoutActive()
- {
- return mNbActpassed;
- }
- public long getNbActPassedWithActive()
- {
- return mNbActpassedWithCurrent;
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/AndSplit.java b/source/com/c2kernel/lifecycle/instance/AndSplit.java
deleted file mode 100644
index 63b5640..0000000
--- a/source/com/c2kernel/lifecycle/instance/AndSplit.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.c2kernel.lifecycle.instance;
-import com.c2kernel.graph.model.Vertex;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.scripting.ScriptingEngineException;
-/**
- * @version $Revision: 1.16 $ $Date: 2005/05/10 15:14:54 $
- * @author $Author: abranson $
- */
-public class AndSplit extends Split
-{
- /**
- * @see java.lang.Object#Object()
- */
- public AndSplit()
- {
- super();
- }
- @Override
- public void runNext(AgentPath agent) throws ScriptingEngineException
- {
- AdvancementCalculator adv = new AdvancementCalculator();
- adv.calculate((CompositeActivity) getParent());
- Vertex[] outVertices = getOutGraphables();
- for (Vertex outVertice : outVertices)
- ((WfVertex) outVertice).run(agent);
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/CompositeActivity.java b/source/com/c2kernel/lifecycle/instance/CompositeActivity.java
deleted file mode 100644
index c080a37..0000000
--- a/source/com/c2kernel/lifecycle/instance/CompositeActivity.java
+++ /dev/null
@@ -1,458 +0,0 @@
-package com.c2kernel.lifecycle.instance;
-
-import java.awt.Point;
-import java.util.ArrayList;
-import java.util.Vector;
-
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.common.ObjectAlreadyExistsException;
-import com.c2kernel.entity.agent.Job;
-import com.c2kernel.graph.model.GraphModel;
-import com.c2kernel.graph.model.GraphPoint;
-import com.c2kernel.graph.model.GraphableVertex;
-import com.c2kernel.lifecycle.instance.gui.model.WfVertexOutlineCreator;
-import com.c2kernel.lifecycle.instance.stateMachine.StateMachine;
-import com.c2kernel.lifecycle.instance.stateMachine.States;
-import com.c2kernel.lifecycle.instance.stateMachine.Transitions;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.scripting.ScriptingEngineException;
-import com.c2kernel.utils.Logger;
-
-/**
- * @version $Revision: 1.86 $ $Date: 2005/10/05 07:39:37 $
- * @author $Author: abranson $
- */
-public class CompositeActivity extends Activity
-{
- /**
- * @see java.lang.Object#Object()
- */
- /*
- * --------------------------------------------
- * ----------------CONSTRUCTOR-----------------
- * --------------------------------------------
- */
- public CompositeActivity()
- {
- super();
- setChildrenGraphModel(new GraphModel(new WfVertexOutlineCreator()));
- setIsComposite(true);
- }
-
- /**
- * @see com.c2kernel.lifecycle.instance.WfVertex#verify()
- */
- /*
- * -------------------------------------------- --------------Other
- * Functions--------------- --------------------------------------------
- */
- /** launch the verification of the subprocess() */
- @Override
- public boolean verify()
- {
- boolean err = super.verify();
- GraphableVertex[] vChildren = getChildren();
- for (int i = 0; i < vChildren.length; i++)
- {
- if (!((WfVertex) vChildren[i]).verify())
- {
- mErrors.add("error in children");
- return false;
- }
- }
- return err;
- }
-
- /**
- * Method initChild.
- *
- * @param act
- * @param first
- * @param point
- */
- /**
- * Create an initialize a Activity attached to the current activity
- *
- * @param first :
- * if true, the activity Waiting will be one of the first
- * launched by the parent activity
- */
- public void initChild(Activity act, boolean first, Point point)
- {
- this.addChild(act, new GraphPoint(point.x, point.y));
- if (first)
- {
- getChildrenGraphModel().setStartVertexId(act.getID());
- Logger.msg(5, "com.c2kernel.lifecycle.CompositeActivity :: " + getID() + " is first");
- }
- }
-
- /**
- * Method newChild.
- *
- * @param Name
- * @param Type
- * @param point
- * @return WfVertex
- */
- public WfVertex newExistingChild(Activity child, String Name, Point point)
- {
- child.setName(Name);
- addChild(child, new GraphPoint(point.x, point.y));
- return child;
- }
-
- /**
- * Method newChild.
- *
- * @param Name
- * @param Type
- * @param point
- * @return WfVertex
- */
- public WfVertex newChild(String Name, String Type, Point point)
- {
- WfVertex v = newChild(Type, point);
- v.setName(Name);
- return v;
- }
-
- /**
- * Method newChild.
- *
- * @param vertexTypeId
- * @param point
- * @return WfVertex
- */
- public WfVertex newChild(String vertexTypeId, Point point)
- {
- WfVertex wfVertex = null;
- if (vertexTypeId.equals("Atomic"))
- {
- wfVertex = newAtomChild("False id", false, point);
- } else if (vertexTypeId.equals("Composite"))
- {
- wfVertex = newCompChild("False id", false, point);
- } else if (vertexTypeId.endsWith("Split"))
- {
- if (vertexTypeId.startsWith("Or"))
- {
- wfVertex = newSplitChild("Or", point);
- } else if (vertexTypeId.startsWith("XOr"))
- {
- wfVertex = newSplitChild("XOr", point);
- } else if (vertexTypeId.startsWith("Loop"))
- {
- wfVertex = newSplitChild("Loop", point);
- } else
- {
- wfVertex = newSplitChild("And", point);
- }
- } else if (vertexTypeId.equals("Join"))
- {
- wfVertex = newJoinChild(point);
- } else if (vertexTypeId.equals("Route"))
- {
- wfVertex = newRouteChild(point);
- }
- return wfVertex;
- }
-
- /**
- * Method newCompChild.
- *
- * @param id
- * @param first
- * @param point
- * @return CompositeActivity Create an initialize a composite Activity
- * attached to the current activity
- */
- public CompositeActivity newCompChild(String id, boolean first, Point point)
- {
- CompositeActivity act = new CompositeActivity();
- initChild(act, first, point);
- act.setName(id);
- return act;
- }
-
- /**
- * Method newAtomChild.
- *
- * @param id
- * @param first
- * @param point
- * @return Activity Create an initialize an Atomic Activity attached to the
- * current activity
- *
- */
- public Activity newAtomChild(String id, boolean first, Point point)
- {
- Activity act = new Activity();
- initChild(act, first, point);
- act.setName(id);
- return act;
- }
-
- /**
- * Method newSplitChild.
- *
- * @param Type
- * @param point
- * @return Split
- */
- public Split newSplitChild(String Type, Point point)
- {
- Split split;
- if (Type.equals("Or"))
- {
- split = new OrSplit();
- } else if (Type.equals("XOr"))
- {
- split = new XOrSplit();
- } else if (Type.equals("Loop"))
- {
- split = new Loop();
- } else
- {
- split = new AndSplit();
- }
- addChild(split, new GraphPoint(point.x, point.y));
- return split;
- }
-
- /**
- * Method newJoinChild.
- *
- * @param point
- * @return Join
- */
- public Join newJoinChild(Point point)
- {
- Join join = new Join();
- join.getProperties().put("Type", "Join");
- addChild(join, new GraphPoint(point.x, point.y));
- return join;
- }
-
- public Join newRouteChild(Point point)
- {
- Join join = new Join();
- join.getProperties().put("Type", "Route");
- addChild(join, new GraphPoint(point.x, point.y));
- return join;
- }
-
- /**
- * Method search.
- *
- * @param ids
- * @return WfVertex
- */
- WfVertex search(int ids)
- {
- for (int i = 0; i < getChildren().length; i++)
- {
- WfVertex ver = (WfVertex) getChildren()[i];
- if (ver instanceof Split)
- {
- if (ver.getID() == ids)
- {
- return ver;
- }
- }
- if (ver instanceof Join)
- {
- if (ver.getID() == ids)
- {
- return ver;
- }
- }
- }
- return null;
- }
-
- /**
- * @see com.c2kernel.lifecycle.instance.WfVertex#run()
- */
- @Override
- public void run(AgentPath agent) throws ScriptingEngineException
- {
- super.run(agent);
- if (getChildrenGraphModel().getStartVertex() != null && getMachine().getCurrentState() != States.FINISHED && ((Boolean) getProperties().get(StateMachine.AUTOSTART)).booleanValue())
- {
- WfVertex first = (WfVertex) getChildrenGraphModel().getStartVertex();
- first.run(agent);
- }
- }
-
- @Override
- public void runNext(AgentPath agent) throws ScriptingEngineException
- {
- if (getMachine().state != States.FINISHED)
- getMachine().traverse(Transitions.COMPLETE);
- super.runNext(agent);
- }
-
- /**
- * @see com.c2kernel.lifecycle.instance.Activity#query(com.c2kernel.common.AgentInfo,
- * java.lang.String, boolean)
- */
- @Override
- public Activity[] query(AgentPath agent, int stateID, boolean filter)
- {
- Vector<Activity[]> steps = new Vector<Activity[]>();
- Activity[] returnArray = null;
- for (int i = 0; i < getChildren().length; i++)
- {
- if (getChildren()[i] instanceof Activity)
- steps.addElement(((Activity) getChildren()[i]).query(agent, stateID, filter));
- }
- int j = 0;
- for (int i = 0; i < steps.size(); i++)
- j += steps.elementAt(i).length;
- Activity[] tmp = super.query(agent, stateID, filter);
- if (tmp.length == 1)
- {
- returnArray = new Activity[j + 1];
- returnArray[j] = tmp[0];
- } else
- returnArray = new Activity[j];
- j = 0;
- for (int i = 0; i < steps.size(); i++)
- {
- Activity[] stepArray = steps.elementAt(i);
- for (Activity element : stepArray)
- returnArray[j++] = element;
- }
- return returnArray;
- }
-
- /**
- * @see com.c2kernel.lifecycle.instance.Activity#calculateJobs()
- */
- @Override
- public ArrayList<Job> calculateJobs(AgentPath agent, boolean recurse)
- {
- ArrayList<Job> jobs = new ArrayList<Job>();
- boolean childActive = false;
- if (recurse)
- for (int i = 0; i < getChildren().length; i++)
- if (getChildren()[i] instanceof Activity)
- {
- Activity child = (Activity) getChildren()[i];
- jobs.addAll(child.calculateJobs(agent, recurse));
- childActive |= child.active;
- }
- if (!childActive)
- jobs.addAll(super.calculateJobs(agent, recurse));
- return jobs;
- }
-
- @Override
- public ArrayList<Job> calculateAllJobs(AgentPath agent, boolean recurse)
- {
- ArrayList<Job> jobs = new ArrayList<Job>();
- if (recurse)
- for (int i = 0; i < getChildren().length; i++)
- if (getChildren()[i] instanceof Activity)
- {
- Activity child = (Activity) getChildren()[i];
- jobs.addAll(child.calculateAllJobs(agent, recurse));
- }
- jobs.addAll(super.calculateAllJobs(agent, recurse));
- return jobs;
- }
-
- /**
- * Method addNext.
- *
- * @param origin
- * @param terminus
- * @return Next
- */
- public Next addNext(WfVertex origin, WfVertex terminus)
- {
- return new Next(origin, terminus);
- }
-
- /**
- * Method addNext.
- *
- * @param originID
- * @param terminusID
- * @return Next
- */
- public Next addNext(int originID, int terminusID)
- {
- Next n = new Next();
- n.setParent(this);
- getChildrenGraphModel().addEdgeAndCreateId(n, originID, terminusID);
- return n;
- }
-
- /**
- * Method hasGoodNumberOfActivity.
- *
- * @return boolean
- */
- public boolean hasGoodNumberOfActivity()
- {
- int endingAct = 0;
- for (int i = 0; i < getChildren().length; i++)
- {
- WfVertex vertex = (WfVertex) getChildren()[i];
- if (getChildrenGraphModel().getOutEdges(vertex).length == 0)
- endingAct++;
- }
- if (endingAct > 1)
- return false;
- return true;
- }
-
- /**
- * @see com.c2kernel.lifecycle.instance.Activity#getType()
- */
- @Override
- public String getType()
- {
- if (getName().equals("domain"))
- return "domain";
- return super.getType();
- }
-
- /**
- *
- */
- @Override
- public void reinit(int idLoop)
- {
- super.reinit(idLoop);
- if (getChildrenGraphModel().getStartVertex() != null && getMachine().getCurrentState() != States.FINISHED)
- ((WfVertex) getChildrenGraphModel().getStartVertex()).reinit(idLoop);
- }
-
- @Override
- public void request(AgentPath agent, int transitionID, String requestData) throws AccessRightsException, InvalidTransitionException, InvalidDataException, ObjectAlreadyExistsException
- {
- if (getChildrenGraphModel().getStartVertex() != null && getMachine().getCurrentState() != States.FINISHED && transitionID == Transitions.START)
- try
- {
- ((WfVertex) getChildrenGraphModel().getStartVertex()).run(agent);
- } catch (ScriptingEngineException e)
- {
- Logger.error(e);
- }
- super.request(agent, transitionID, requestData);
- }
- public void refreshJobs()
- {
- GraphableVertex[] children = getChildren();
- for (GraphableVertex element : children)
- if (element instanceof CompositeActivity)
- ((CompositeActivity) element).refreshJobs();
- else if (element instanceof Activity)
- ((Activity) element).pushJobsToAgents();
- }
-} \ No newline at end of file
diff --git a/source/com/c2kernel/lifecycle/instance/EventList.java b/source/com/c2kernel/lifecycle/instance/EventList.java
deleted file mode 100755
index be255fb..0000000
--- a/source/com/c2kernel/lifecycle/instance/EventList.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.c2kernel.lifecycle.instance;
-
-import java.io.Serializable;
-
-/**
- * @version $Revision: 1.9 $ $Date: 2005/06/08 19:47:59 $
- * @author $Author: abranson $
- */
-public class EventList implements Serializable {
- private int[] dummy = new int[0];
- public int transition=-1;
-
- public int[] getNums() {
- return dummy;
- }
-
- public void setNums(int[] nums) {
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/EventStorage.java b/source/com/c2kernel/lifecycle/instance/EventStorage.java
deleted file mode 100644
index 40cffaf..0000000
--- a/source/com/c2kernel/lifecycle/instance/EventStorage.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.c2kernel.lifecycle.instance;
-import java.io.Serializable;
-import java.util.Hashtable;
-
-/**
- * @version $Revision: 1.15 $ $Date: 2005/06/08 19:48:00 $
- * @author $Author: abranson $
- */
-public class EventStorage implements Serializable
-{
- private Hashtable<?, ?> mLists;
- private EventList[] dummy = new EventList[0];
- public Integer lastTransitionStored;
-
- public EventList[] getLists()
- {
- return dummy;
- }
-
- public void setLists(EventList[] lists)
- {
- }
-
-}
diff --git a/source/com/c2kernel/lifecycle/instance/JobPusher.java b/source/com/c2kernel/lifecycle/instance/JobPusher.java
deleted file mode 100644
index 5b8be63..0000000
--- a/source/com/c2kernel/lifecycle/instance/JobPusher.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.c2kernel.lifecycle.instance;
-
-import java.util.Enumeration;
-import java.util.Iterator;
-
-import com.c2kernel.entity.Agent;
-import com.c2kernel.entity.AgentHelper;
-import com.c2kernel.entity.agent.Job;
-import com.c2kernel.entity.agent.JobArrayList;
-import com.c2kernel.lifecycle.instance.stateMachine.Transitions;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.RolePath;
-import com.c2kernel.utils.CastorXMLUtility;
-import com.c2kernel.utils.Logger;
-
-final class JobPusher extends Thread {
- private final Activity activity;
- private final RolePath myRole;
-
- JobPusher(Activity activity, RolePath role) {
- this.activity = activity;
- this.myRole = role;
- }
-
- @Override
- public void run()
- {
- Thread.currentThread().setName("Agent job pusher for "+activity.getName()+" to role "+myRole);
- for (Enumeration<AgentPath> e = myRole.getChildren(); e.hasMoreElements();)
- {
- AgentPath nextAgent = e.nextElement();
- Logger.msg(7, "Activity.pushJobsToAgents() - Calculating jobs for " + nextAgent.getAgentName());
- try
- {
- // get joblist for user
- JobArrayList jobList = new JobArrayList(this.activity.calculateJobs(nextAgent, false));
- // only transmit start, complete and resume jobs
- for (Iterator<Job> element = jobList.list.iterator(); element.hasNext();)
- {
- Job thisJob = element.next();
- if (thisJob.getPossibleTransition() != Transitions.START
- && thisJob.getPossibleTransition() != Transitions.COMPLETE
- && thisJob.getPossibleTransition() != Transitions.RESUME
- && thisJob.getPossibleTransition() != Transitions.SUSPEND
- && thisJob.getPossibleTransition() != Transitions.REASSIGN)
- element.remove();
- }
- Logger.msg(7, "Activity.pushJobsToAgents() - User will receive " + jobList.list.size() + " jobs");
- String stringJobs = CastorXMLUtility.marshall(jobList);
- // push it to the agent
- org.omg.CORBA.Object agentIOR = nextAgent.getIOR();
- Agent thisAgent = AgentHelper.narrow(agentIOR);
- Logger.debug("Calling agent "+thisAgent.getSystemKey()+" from "+activity.getPath());
- thisAgent.refreshJobList(this.activity.getItemEntityPath().getSysKey(), activity.getPath(), stringJobs);
- }
- catch (Exception ex)
- {
- Logger.error(
- "Agent "
- + nextAgent.getAgentName()
- + " of role "
- + myRole
- + " could not be found to be informed of a change in "
- + this.activity.getItemEntityPath().getSysKey());
- Logger.error(ex);
- }
- }
-
- }
-} \ No newline at end of file
diff --git a/source/com/c2kernel/lifecycle/instance/Join.java b/source/com/c2kernel/lifecycle/instance/Join.java
deleted file mode 100644
index 3a4fd7d..0000000
--- a/source/com/c2kernel/lifecycle/instance/Join.java
+++ /dev/null
@@ -1,216 +0,0 @@
-package com.c2kernel.lifecycle.instance;
-import java.util.Vector;
-
-import com.c2kernel.graph.model.Vertex;
-import com.c2kernel.graph.traversal.GraphTraversal;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.scripting.ScriptingEngineException;
-/**
- * @version $Revision: 1.52 $ $Date: 2005/05/10 15:14:54 $
- * @author $Author: abranson $
- */
-public class Join extends WfVertex
-{
- public Vector<String> mErrors;
- /**
- * @see java.lang.Object#Object()
- */
- public Join()
- {
- super();
- mErrors = new Vector<String>(0, 1);
- }
- private boolean loopTested;
- public int counter = 0;
- private String mItemSystemKey = "";
- /**
- * @see com.c2kernel.lifecycle.instance.WfVertex#runNext()
- */
- @Override
- public void runNext(AgentPath agent) throws ScriptingEngineException
- {
- AdvancementCalculator adv = new AdvancementCalculator();
- adv.calculate((CompositeActivity) getParent());
- if (adv.hasprevActive.get(String.valueOf(getID())) == null)
- {
- Vertex[] outVertices = getOutGraphables();
- if (outVertices.length > 0)
- {
- WfVertex nextAct = (WfVertex) outVertices[0];
- nextAct.run(agent);
- }
- else
- super.runNext(agent);
- }
- }
- /**
- * Method addNext.
- *
- * @param idNext
- */
- public void addNext(String idNext)
- {
- new Next(this, (WfVertex) getParent().search(idNext));
- }
- /**
- * @see com.c2kernel.lifecycle.instance.WfVertex#reinit(int)
- */
- @Override
- public void reinit(int idLoop)
- {
- Vertex[] outVertices = getOutGraphables();
- if (outVertices.length == 1)
- {
- WfVertex nextAct = (WfVertex) outVertices[0];
- nextAct.reinit(idLoop);
- }
- }
- /**
- * Method getItemSystemKey.
- *
- * @return String
- */
- /*
- * public CompositeActivity process() { return parent.process(); }
- */
- public String getItemSystemKey()
- {
- return mItemSystemKey;
- }
- /**
- * Method setItemSystemKey.
- *
- * @param itemSystemKey
- */
- public void setItemSystemKey(String itemSystemKey)
- {
- mItemSystemKey = itemSystemKey;
- }
- /**
- * @see com.c2kernel.lifecycle.instance.WfVertex#verify()
- */
- // public void initItemSystemKey(String systemKey) {
- // this.setItemSystemKey(systemKey);
- // }
- @Override
- public boolean verify()
- {
- mErrors.removeAllElements();
- int nbOutEdges = getOutEdges().length;
- int nbInEdges = getInEdges().length;
- String type = (String) getProperties().get("Type");
- if (nbInEdges < 1)
- {
- mErrors.add("not enough previous");
- return false;
- }
- if (type != null && type.equals("Route"))
- {
- if (nbInEdges > 1)
- {
- mErrors.add("Bad nb of previous");
- return false;
- }
- }
- if (nbOutEdges > 1)
- {
- mErrors.add("too many next");
- return false;
- }
- if (nbOutEdges == 0)
- {
- if (!((CompositeActivity) getParent()).hasGoodNumberOfActivity())
- {
- mErrors.add("too many endpoints");
- return false;
- }
- }
- Vertex[] outV = getOutGraphables();
- Vertex[] anteVertices = GraphTraversal.getTraversal(getParent().getChildrenGraphModel(), this, GraphTraversal.kUp, false);
- boolean loop = false;
- boolean errInLoop = false;
- for (int i = 0; i < outV.length; i++)
- {
- for (int j = 0; j < anteVertices.length; j++)
- if (!loop && outV[i].getID() == anteVertices[j].getID())
- {
- if (outV[i] instanceof Loop)
- {
- loop = true;
- j = anteVertices.length;
- i = outV.length;
- }
- else
- {
- errInLoop = true;
- }
- }
- }
- if (errInLoop && loop)
- {
- mErrors.add("Problem in Loop");
- return false;
- }
- return true;
- }
- /**
- * @see com.c2kernel.lifecycle.instance.WfVertex#getErrors()
- */
- @Override
- public String getErrors()
- {
- if (mErrors.size() == 0)
- return "No error";
- else
- return mErrors.elementAt(0);
- }
- /**
- * @see com.c2kernel.lifecycle.instance.WfVertex#run()
- */
- @Override
- public void run(AgentPath agent) throws ScriptingEngineException
- {
- runNext(agent);
- }
- /**
- * @see com.c2kernel.lifecycle.instance.WfVertex#addNext(com.c2kernel.lifecycle.instance.WfVertex)
- */
- @Override
- public Next addNext(WfVertex vertex)
- {
- return new Next(this, vertex);
- }
- /**
- * @see com.c2kernel.lifecycle.instance.WfVertex#loop()
- */
- @Override
- public boolean loop()
- {
- boolean loop2 = false;
- if (!loopTested)
- {
- loopTested = true;
- if (getOutGraphables().length != 0)
- loop2 = ((WfVertex) getOutGraphables()[0]).loop();
- }
- else
- loop2 = true;
- loopTested = false;
- return loop2;
- }
- @Override
- public void runfirst(AgentPath agent) throws ScriptingEngineException
- {
- runNext(agent);
- }
- /*
- * (non-Javadoc)
- *
- * @see com.c2kernel.graph.model.Vertex#isJoin()
- */
- @Override
- public boolean isJoin()
- {
- return true;
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/Loop.java b/source/com/c2kernel/lifecycle/instance/Loop.java
deleted file mode 100644
index 8228ba9..0000000
--- a/source/com/c2kernel/lifecycle/instance/Loop.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package com.c2kernel.lifecycle.instance;
-import com.c2kernel.graph.model.Vertex;
-import com.c2kernel.graph.traversal.GraphTraversal;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.scripting.ScriptingEngineException;
-import com.c2kernel.utils.Logger;
-/**
- * @version $Revision: 1.35 $ $Date: 2005/05/10 15:14:54 $
- * @author $Author: abranson $
- */
-public class Loop extends XOrSplit
-{
- /**
- * @see java.lang.Object#Object()
- */
- public Loop()
- {
- super();
- }
- /**
- * @see com.c2kernel.lifecycle.instance.WfVertex#loop()
- */
- @Override
- public boolean loop()
- {
- return true;
- }
- @Override
- public void followNext(Next activeNext, AgentPath agent) throws ScriptingEngineException
- {
- WfVertex v = activeNext.getTerminusVertex();
- if (!isInPrev(v))
- v.run(agent);
- else
- {
- v.reinit(getID());
- v.run(agent);
- }
- }
- /**
- * @see com.c2kernel.lifecycle.instance.WfVertex#reinit(int)
- */
- @Override
- public void reinit(int idLoop)
- {
- Logger.msg(8, "Loop.reinit");
- if (idLoop == getID())
- return;
- else
- {
- Vertex[] outVertices = getOutGraphables();
- for (int j = 0; j < outVertices.length; j++)
- {
- if (!isInPrev(outVertices[j]))
- ((WfVertex) outVertices[j]).reinit(idLoop);
- }
- }
- }
- /**
- * @see com.c2kernel.lifecycle.instance.WfVertex#verify()
- */
- @Override
- public boolean verify()
- {
- boolean err = super.verify();
- Vertex[] nexts = getOutGraphables();
- Vertex[] anteVertices = GraphTraversal.getTraversal(getParent().getChildrenGraphModel(), this, GraphTraversal.kUp, false);
- int k = 0;
- int l = 0;
- Vertex[] brothers = getParent().getChildren();
- for (Vertex brother : brothers)
- if (brother instanceof Loop)
- l++;
- for (Vertex next : nexts) {
- for (Vertex anteVertice : anteVertices)
- if (next.getID() == anteVertice.getID())
- k++;
- }
- if (k != 1 && !(l > 1))
- {
- mErrors.add("bad number of pointing back nexts");
- return false;
- }
- // if (nexts.length>2) {
- // mErrors.add("you must only have 2 nexts");
- // return false;
- // }
- return err;
- }
- private boolean isInPrev(Vertex vertex)
- {
- int id = vertex.getID();
- Vertex[] anteVertices = GraphTraversal.getTraversal(getParent().getChildrenGraphModel(), this, GraphTraversal.kUp, false);
- for (Vertex anteVertice : anteVertices) {
- if (anteVertice.getID() == id)
- {
- return true;
- }
- }
- return false;
- }
- @Override
- public boolean isLoop()
- {
- return true;
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/Next.java b/source/com/c2kernel/lifecycle/instance/Next.java
deleted file mode 100644
index 4df775c..0000000
--- a/source/com/c2kernel/lifecycle/instance/Next.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package com.c2kernel.lifecycle.instance;
-
-import com.c2kernel.graph.model.GraphPoint;
-import com.c2kernel.graph.model.GraphableEdge;
-
-/**
- * @version $Revision: 1.58 $ $Date: 2005/05/10 15:14:54 $
- * @author $Author: abranson $
- */
-/** this class represents the link between 2 successive activities */
-public class Next extends GraphableEdge
-{
- /**
- * @see java.lang.Object#Object()
- */
- public Next()
- {
- super();
- }
-
- /**
- * Method Next.
- * @param pre
- * @param nex
- */
- /** create and initialize a link between an Activities */
- public Next(WfVertex pre, WfVertex nex)
- {
- super(pre, nex);
- getProperties().put("Alias","");
- getProperties().put("Type","Straight");
- }
-
- /**
- * Method verify.
- * @return boolean
- */
- public boolean verify()
- {
- return true;
- }
- public WfVertex getTerminusVertex()
- {
- return (WfVertex)((CompositeActivity)getParent()).getWf().search(getParent().getPath()+"/"+this.getTerminusVertexId());
- }
- @Override
- public boolean containsPoint(GraphPoint p)
- {
- GraphPoint originPoint = getOriginPoint();
- GraphPoint terminusPoint = getTerminusPoint();
- GraphPoint midPoint = new GraphPoint();
-
- if (("Broken +".equals(getProperties().get("Type"))))
- {
- midPoint.x = (originPoint.x + terminusPoint.x) / 2;
- midPoint.y = (originPoint.y + terminusPoint.y) / 2;
- }
- else if (("Broken -".equals(getProperties().get("Type"))))
- {
- boolean arrowOnY = !(originPoint.y - terminusPoint.y < 60 && originPoint.y - terminusPoint.y > -60);
- midPoint.x = arrowOnY ? terminusPoint.x : (originPoint.x + terminusPoint.x) / 2;
- midPoint.y = arrowOnY ? (originPoint.y + terminusPoint.y) / 2 : originPoint.y;
- }
- else if (("Broken |".equals(getProperties().get("Type"))))
- {
- boolean arrowOnY = !(originPoint.y - terminusPoint.y < 60 && originPoint.y - terminusPoint.y > -60);
- midPoint.x = arrowOnY ? originPoint.x : (originPoint.x + terminusPoint.x) / 2;
- midPoint.y = arrowOnY ? (originPoint.y + terminusPoint.y) / 2 : terminusPoint.y;
- }
- else
- {
- midPoint.x = originPoint.x + (terminusPoint.x - originPoint.x) / 2;
- midPoint.y = originPoint.y + (terminusPoint.y - originPoint.y) / 2;
- }
-
- int minX = midPoint.x - 10;
- int minY = midPoint.y - 10;
- int maxX = midPoint.x + 10;
- int maxY = midPoint.y + 10;
-
- return (p.x >= minX) && (p.x <= maxX) && (p.y >= minY) && (p.y <= maxY);
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/OrSplit.java b/source/com/c2kernel/lifecycle/instance/OrSplit.java
deleted file mode 100644
index aea34b2..0000000
--- a/source/com/c2kernel/lifecycle/instance/OrSplit.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.c2kernel.lifecycle.instance;
-import java.util.StringTokenizer;
-
-import com.c2kernel.graph.model.DirectedEdge;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.scripting.ScriptingEngineException;
-import com.c2kernel.utils.Logger;
-/**
- * @version $Revision: 1.22 $ $Date: 2005/05/10 15:14:54 $
- * @author $Author: abranson $
- */
-public class OrSplit extends Split
-{
- /**
- * @see java.lang.Object#Object()
- */
- public OrSplit()
- {
- super();
- }
- @Override
- public void runNext(AgentPath agent) throws ScriptingEngineException
- {
- String nexts =
- this
- .evaluateScript((String) getProperties().get("RoutingScriptName"), (String) getProperties().get("RoutingScriptVersion"))
- .toString();
- StringTokenizer tok = new StringTokenizer(nexts, ",");
- Logger.msg(7, tok.countTokens() + " nexts to activate:" + nexts);
- int active = 0;
- try
- {
- DirectedEdge[] outEdges = getOutEdges();
- AdvancementCalculator adv = new AdvancementCalculator();
- adv.calculate((CompositeActivity)getParent());
- while (tok.hasMoreTokens())
- {
- String thisNext = tok.nextToken();
- Logger.msg(7, "Finding next " + thisNext);
- for (DirectedEdge outEdge : outEdges) {
- Next nextEdge = (Next) outEdge;
- if (thisNext != null && thisNext.equals(nextEdge.getProperties().get("Alias")))
- {
- WfVertex term = nextEdge.getTerminusVertex();
- term.run(agent);
- Logger.msg(7, "Running " + nextEdge.getProperties().get("Alias"));
- active++;
- }
- }
- }
- // if no active nexts throw exception
- }
- catch (Exception e)
- {
- Logger.error(e);
- }
- if (active == 0)
- throw new ScriptingEngineException("No nexts were activated!");
- }
-
-
-}
diff --git a/source/com/c2kernel/lifecycle/instance/ParserWF.java b/source/com/c2kernel/lifecycle/instance/ParserWF.java
deleted file mode 100644
index 02a0c6d..0000000
--- a/source/com/c2kernel/lifecycle/instance/ParserWF.java
+++ /dev/null
@@ -1,356 +0,0 @@
-package com.c2kernel.lifecycle.instance;
-
-import java.awt.Point;
-import java.io.IOException;
-import java.util.Vector;
-
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.utils.CastorHashMap;
-import com.c2kernel.utils.Logger;
-
-/**
- * @version $Revision: 1.26 $ $Date: 2006/03/03 13:52:21 $
- * @author $Author: abranson $
- */
-public class ParserWF
-{
- static Vector<String[]> nexts;
- static String file = "";
- static int i;
- static CastorHashMap mInfo = new CastorHashMap();
-
- /**
- * Method addStep.
- * @param act
- * @param xmlfile
- * @return CompositeActivity
- * @throws IOException
- */
- /**
- * @associates <{com.c2kernel.lifecycle.instance.Workflow}>
- * @label creates
- */
- public static CompositeActivity addStep(CompositeActivity act, String xmlfile, AgentPath agent) throws IOException
- {
- nexts = new Vector<String[]>(1, 1);
- i = 0;
- file = xmlfile;
- while (i < file.length() - 5)
- {
- if (file.substring(i, i + 5).equals("<STEP"))
- {
- readStep(act);
- }
- else
- {
- i++;
- }
- }
- boolean flag = false;
- for (int j = 0; j < nexts.size(); j++)
- {
- for (int k = j + 1; k < nexts.size(); k++)
- {
- if (nexts.elementAt(j)[0].equals(nexts.elementAt(k)[0]))
- {
- int tmp = act.newSplitChild("And", new Point(0, 0)).getID();
- ((WfVertex) act.search(nexts.elementAt(k)[0])).addNext(act.search(tmp));
- ((Split) act.search(tmp)).addNext((WfVertex) act.search(nexts.elementAt(k)[1]));
- ((Split) act.search(tmp)).addNext((WfVertex) act.search(nexts.elementAt(j)[1]));
- nexts.removeElementAt(k--);
- flag = true;
- }
- }
- if (flag)
- {
- nexts.removeElementAt(j--);
- }
- flag = false;
- }
- for (int j = 0; j < nexts.size(); j++)
- {
- for (int k = j + 1; k < nexts.size(); k++)
- {
- if (nexts.elementAt(j)[1].equals(nexts.elementAt(k)[1]))
- {
- int tmp = act.newJoinChild(new Point(0, 0)).getID();
- ((WfVertex) act.search(nexts.elementAt(j)[0])).addNext(act.search(tmp));
- ((WfVertex) act.search(nexts.elementAt(k)[0])).addNext(act.search(tmp));
- ((Join) act.search(tmp)).addNext(nexts.elementAt(j)[1]);
- nexts.removeElementAt(k--);
- flag = true;
- }
- }
- if (flag)
- {
- nexts.removeElementAt(j--);
- }
- flag = false;
- }
- for (int j = 0; j < nexts.size(); j++)
- {
- Logger.msg(
- 7,
- "try to add next " + nexts.elementAt(j)[1] + " to " + nexts.elementAt(j)[0]);
- ((Activity) act.search(nexts.elementAt(j)[0])).addNext(nexts.elementAt(j)[1]);
- }
- if (act instanceof Workflow)
- try
- {
- act.run(agent);
- }
- catch (Exception ex)
- {
- Logger.error(ex);
- }
- return act;
- }
-
- private static void readStep(CompositeActivity parent)
- {
- Activity act = null;
- String[] step = new String[15];
- for (int j = 0; j < 15; j++)
- {
- step[j] = "";
- }
- i += 5;
- while (!file.substring(i, i + 7).equals("</STEP>"))
- {
- if (file.substring(i, i + 5).equals("<STEP"))
- {
- Logger.msg(7, "<STEP");
- if (!step[14].equals("done"))
- {
- act = parent.newCompChild(step[0], step[12].startsWith("true"), new Point(0, 0));
- }
- readStep((CompositeActivity) act);
- step[14] = "done";
- }
- else if (file.substring(i, i + 3).equals("Id="))
- {
- Logger.msg(7, "Id=");
- i += 4;
- int j = 0;
- while (file.charAt(i + j) != '"')
- {
- j++;
- }
- step[0] = file.substring(i, i + j);
- i += (j + 1);
- }
- else if (file.substring(i, i + 6).equals("Alias="))
- {
- Logger.msg(7, "Alias=");
- i += 7;
- int j = 0;
- while (file.charAt(i + j) != '"')
- {
- j++;
- }
- step[10] = file.substring(i, i + j);
- i += (j + 1);
- }
- else if (file.substring(i, i + 9).equals("Resource="))
- {
- Logger.msg(7, "Ressource=");
- i += 10;
- int j = 0;
- while (file.charAt(i + j) != '"')
- {
- j++;
- }
- step[1] = file.substring(i, i + j);
- i += (j + 1);
- }
- else if (file.substring(i, i + 6).equals("First="))
- {
- Logger.msg(7, "First=");
- i += 7;
- int j = 0;
- ;
- while (file.charAt(i + j) != '"')
- {
- j++;
- }
- step[12] = file.substring(i, i + j);
- i += (j + 1);
- }
- else if (file.substring(i, i + 3).equals("LC="))
- {
- Logger.msg(7, "LC=");
- i += 4;
- int j = 0;
- ;
- while (file.charAt(i + j) != '"')
- {
- j++;
- }
- step[2] = file.substring(i, i + j);
- i += (j + 1);
- }
- else if (file.substring(i, i + 3).equals("WC="))
- {
- Logger.msg(7, "WC=");
- i += 4;
- int j = 0;
- ;
- while (file.charAt(i + j) != '"')
- {
- j++;
- }
- step[3] = file.substring(i, i + j);
- i += (j + 1);
- }
- else if (file.substring(i, i + 6).equals("Posts="))
- {
- Logger.msg(7, "Posts=");
- i += 7;
- int j = 0;
- ;
- while (file.charAt(i + j) != '"')
- {
- j++;
- }
- step[4] = file.substring(i, i + j);
- i += (j + 1);
- }
- else if (file.substring(i, i + 17).equals("Preparation-Time="))
- {
- Logger.msg(7, "Preparation-Time=");
- i += 18;
- int j = 0;
- ;
- while (file.charAt(i + j) != '"')
- {
- j++;
- }
- step[5] = file.substring(i, i + j);
- i += (j + 1);
- }
- else if (file.substring(i, i + 12).equals("Active-Time="))
- {
- Logger.msg(7, "Active-Time=");
- i += 13;
- int j = 0;
- ;
- while (file.charAt(i + j) != '"')
- {
- j++;
- }
- step[6] = file.substring(i, i + j);
- i += (j + 1);
- }
- else if (file.substring(i, i + 13).equals("OP-Startdate="))
- {
- Logger.msg(7, "OP-Startdate=");
- i += 14;
- int j = 0;
- ;
- while (file.charAt(i + j) != '"')
- {
- j++;
- }
- step[7] = file.substring(i, i + j);
- i += (j + 1);
- }
- else if (file.substring(i, i + 11).equals("OP-Enddate="))
- {
- Logger.msg(7, "OP-Enddate=");
- i += 12;
- int j = 0;
- ;
- while (file.charAt(i + j) != '"')
- {
- j++;
- }
- step[8] = file.substring(i, i + j);
- i += (j + 1);
- }
- else if (file.substring(i, i + 13).equals("<DESCRIPTION>"))
- {
- Logger.msg(7, "<DESCRIPTION>");
- i += 13;
- int j = 0;
- ;
- while (file.charAt(i + j) != '<')
- {
- j++;
- }
- step[9] = file.substring(i, i + j);
- i += (j + 14);
- }
- else if (file.substring(i, i + 6).equals("<NEXT>"))
- {
- Logger.msg(7, "<NEXT>");
- i += 6;
- int j = 0;
- ;
- String[] tmp = new String[2];
- while (file.charAt(i + j) != '<')
- {
- j++;
- }
- tmp[0] = step[0];
- tmp[0] = parent.getPath() + "/" + tmp[0];
- tmp[1] = file.substring(i, i + j);
- tmp[1] = parent.getPath() + "/" + tmp[1];
- nexts.addElement(tmp);
- i += (j + 8);
- Logger.msg(7, "</NEXT>");
- }
- else if (file.substring(i, i + 5).equals("Path="))
- {
- Logger.msg(7, "Path=");
- i += 6;
- int j = 0;
- ;
- step[11] = file.substring(i, i + j);
- while (file.charAt(i + j) != '"')
- {
- j++;
- }
- i += (j + 1);
- }
- else
- {
- i++;
- }
- }
- i += 7;
- if (!step[14].equals("done"))
- act = parent.newAtomChild(step[0], step[12].startsWith("true"), new Point(0, 0));
- Logger.msg(7, "Step Created");
-
- try
- {
- Logger.msg(7, "Starting to create info");
- if (!step[1].equals(""))
- act.getProperties().put("Agent ID", step[1]);
- if (!step[2].equals(""))
- act.getProperties().put("Lc", step[2]);
- if (!step[3].equals(""))
- act.getProperties().put("Wc", step[3]);
- if (!step[4].equals(""))
- act.getProperties().put("Posts", step[4]);
- if (!step[5].equals(""))
- act.getProperties().put("PreparationTime", step[5]);
- if (!step[6].equals(""))
- act.getProperties().put("ActiveTime", step[6]);
- if (!step[7].equals(""))
- act.getProperties().put("OpStartdate", step[7]);
- if (!step[8].equals(""))
- act.getProperties().put("OpEnddate", step[8]);
- if (!step[9].equals(""))
- act.getProperties().put("Description", step[9]);
- Logger.msg(7, "create info for " + act.getID());
- Logger.msg(7, "Finished to create info");
- }
- catch (Exception e)
- {
- Logger.error(e);
- }
- file = file.substring(i);
- i = 0;
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/Split.java b/source/com/c2kernel/lifecycle/instance/Split.java
deleted file mode 100644
index 4fe1bfc..0000000
--- a/source/com/c2kernel/lifecycle/instance/Split.java
+++ /dev/null
@@ -1,225 +0,0 @@
-package com.c2kernel.lifecycle.instance;
-
-import java.util.Vector;
-
-import com.c2kernel.graph.model.Vertex;
-import com.c2kernel.graph.traversal.GraphTraversal;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.scripting.ScriptingEngineException;
-
-/**
- * @version $Revision: 1.47 $ $Date: 2006/05/29 13:17:45 $
- * @author $Author: abranson $
- */
-public abstract class Split extends WfVertex
-{
- public Vector<String> mErrors;
-
- /**
- * @see java.lang.Object#Object()
- */
- public Split()
- {
- mErrors = new Vector<String>(0, 1);
- getProperties().put("RoutingScriptName", "");
- getProperties().put("RoutingScriptVersion", "");
- }
-
- private boolean loopTested;
-
- private int mItemSystemKey = -1;
-
- /**
- * @see com.c2kernel.lifecycle.instance.WfVertex#runNext()
- */
- @Override
- public abstract void runNext(AgentPath agent) throws ScriptingEngineException;
-
- /**
- * Method addNext.
- *
- * @param idNext
- */
- void addNext(String idNext)
- {
- new Next(this, (WfVertex) getParent().search(idNext));
- }
-
- /**
- * @see com.c2kernel.lifecycle.instance.WfVertex#addNext(com.c2kernel.lifecycle.instance.WfVertex)
- */
- @Override
- public Next addNext(WfVertex vertex)
- {
- Next nxt = new Next(this, vertex);
- int num = getOutGraphables().length;
- try
- {
- num = Integer.parseInt((String) getProperties().get("LastNum"));
- } catch (Exception e)
- {
- }
- nxt.getProperties().put("Alias", String.valueOf(num));
- getProperties().put("LastNum", String.valueOf(num + 1));
- return nxt;
- }
-
- /**
- * Method getItemSystemKey.
- *
- * @return int
- */
- public int getItemSystemKey()
- {
- return mItemSystemKey;
- }
-
- /**
- * Method setItemSystemKey.
- *
- * @param itemSystemKey
- */
- public void setItemSystemKey(int itemSystemKey)
- {
- mItemSystemKey = itemSystemKey;
- }
-
- /**
- * @see com.c2kernel.lifecycle.instance.WfVertex#reinit(int)
- */
- // public void initItemSystemKey(String systemKey) {
- // setItemSystemKey(systemKey);
- // }
- @Override
- public void reinit(int idLoop)
- {
- Vertex[] outVertices = getOutGraphables();
- for (Vertex outVertice : outVertices)
- ((WfVertex) outVertice).reinit(idLoop);
- }
-
- /**
- * @see com.c2kernel.lifecycle.instance.WfVertex#verify()
- */
- @Override
- public boolean verify()
- {
- mErrors.removeAllElements();
- int nbInEdgres = getParent().getChildrenGraphModel().getInEdges(this).length;
- if (nbInEdgres == 0 && this.getID() != getParent().getChildrenGraphModel().getStartVertexId())
- {
- mErrors.add("not enough previous");
- return false;
- }
- if (nbInEdgres > 1)
- {
- mErrors.add("Bad nb of previous");
- return false;
- }
- if (getOutEdges().length <= 1 && !(this instanceof Loop))
- {
- mErrors.add("not enough next");
- return false;
- }
- if (!(this instanceof Loop))
- {
- Vertex[] outV = getOutGraphables();
- Vertex[] anteVertices = GraphTraversal.getTraversal(getParent().getChildrenGraphModel(), this, GraphTraversal.kUp, false);
- boolean loop = false;
- boolean errInLoop = true;
- for (int i = 0; i < outV.length; i++)
- {
- for (int j = 0; j < anteVertices.length; j++)
- if (!loop && outV[i].getID() == anteVertices[j].getID())
- {
- if (outV[i] instanceof Loop)
- {
- loop = true;
- j = anteVertices.length;
- i = outV.length;
- } else
- {
- errInLoop = false;
- }
- }
- }
- if (errInLoop && loop)
- {
- mErrors.add("Problem in Loop");
- return false;
- }
- }
- return true;
- }
-
- /**
- * @see com.c2kernel.lifecycle.instance.WfVertex#getErrors()
- */
- @Override
- public String getErrors()
- {
- if (mErrors.size() == 0)
- return "No error";
- else
- return mErrors.elementAt(0);
- }
-
- /**
- * @see com.c2kernel.lifecycle.instance.WfVertex#run()
- */
- @Override
- public void run(AgentPath agent) throws ScriptingEngineException
- {
- runNext(agent);
- }
-
- /**
- * @see com.c2kernel.lifecycle.instance.WfVertex#loop()
- */
- @Override
- public boolean loop()
- {
- boolean loop2 = false;
- if (!loopTested)
- {
- loopTested = true;
- if (getOutGraphables().length != 0)
- {
- Vertex[] outVertices = getOutGraphables();
- for (int i = 0; i < outVertices.length; i++)
- {
- WfVertex tmp = (WfVertex) getOutGraphables()[i];
- loop2 = loop2 || tmp.loop();
- }
- }
- }
- loopTested = false;
- return loop2;
- }
-
- public String[] nextNames()
- {
- Vertex[] vs = getOutGraphables();
- String[] result = new String[vs.length];
- for (int i = 0; i < vs.length; i++)
- result[i] = vs[i].getName();
- return result;
- }
-
- protected boolean isInTable(String test, String[] list)
- {
- if (test == null)
- return false;
- for (String element : list)
- if (test.equals(element))
- return true;
- return false;
- }
-
- @Override
- public void runfirst(AgentPath agent) throws ScriptingEngineException
- {
- runNext(agent);
- }
-
-} \ No newline at end of file
diff --git a/source/com/c2kernel/lifecycle/instance/WfVertex.java b/source/com/c2kernel/lifecycle/instance/WfVertex.java
deleted file mode 100644
index f6cec33..0000000
--- a/source/com/c2kernel/lifecycle/instance/WfVertex.java
+++ /dev/null
@@ -1,180 +0,0 @@
-package com.c2kernel.lifecycle.instance;
-
-
-
-import java.util.HashMap;
-
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.ObjectNotFoundException;
-import com.c2kernel.graph.model.GraphableVertex;
-import com.c2kernel.lifecycle.instance.stateMachine.Transitions;
-import com.c2kernel.lifecycle.routingHelpers.ViewpointDataHelper;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.persistency.ClusterStorage;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.scripting.Script;
-import com.c2kernel.scripting.ScriptingEngineException;
-import com.c2kernel.utils.KeyValuePair;
-import com.c2kernel.utils.Logger;
-
-/**
- * @version $Revision: 1.38 $ $Date: 2005/09/07 13:46:31 $
- * @author $Author: abranson $
- */
-public abstract class WfVertex extends GraphableVertex
-{
- /**sets the activity available to be executed on start of Workflow or composite activity (when it is the first one of the
- * (sub)process*/
- public abstract void runfirst(AgentPath agent) throws ScriptingEngineException;
-
- /**
- * @see java.lang.Object#Object()
- */
- public WfVertex()
- {
- super();
- setIsLayoutable(true);
- setIsComposite(false);
- }
-
- /**
- * Method runNext.
- */
- public void runNext(AgentPath agent) throws ScriptingEngineException
- {
- try
- {
- ((CompositeActivity)getParent()).request(agent, Transitions.COMPLETE, null);
- }
- catch (Exception e)
- {
- //Logger.error(e);
- }
-
- }
-
- /**
- * Method reinit.
- * @param idLoop
- */
- public abstract void reinit( int idLoop );
-
- /**
- * Method verify.
- * @return boolean
- */
- public abstract boolean verify();
-
- /**
- * Method getErrors.
- * @return String
- */
- public abstract String getErrors();
-
- /**
- * Method run.
- */
- public abstract void run(AgentPath agent) throws ScriptingEngineException;
-
- /**
- * Method loop.
- * @return boolean
- */
- public abstract boolean loop();
-
- /**
- * Method addNext.
- * @param vertex
- */
- public abstract Next addNext(WfVertex vertex);
-
- protected Object evaluateScript(String scriptName, String scriptVersion) throws ScriptingEngineException
- {
-
- try
- {
- EntityPath entity = ((CompositeActivity) getParent()).getWf().getItemEntityPath();
- Script script = getScript(scriptName, scriptVersion);
-
- KeyValuePair[] k = getProperties().getKeyValuePairs();
- HashMap<?, ?> requiredInput = script.getAllInputParams();
- for (KeyValuePair element : k) {
- if (requiredInput.containsKey(element.getKey()))
- {
- String value = element.getStringValue();
- Object inputParam = value;
-
- if (value.startsWith("viewpoint//"))
- {
- value = value.substring(11);
- if (value.startsWith("."))
- value = entity.getSysKey() + value.substring(1);
- try {
- inputParam = ViewpointDataHelper.get(value)[0];
- } catch (ArrayIndexOutOfBoundsException ex) {
- throw new InvalidDataException("Could not retrieve data from viewpoint: "+value, "");
- }
- }
- if (value.startsWith("property//"))
- {
- value = value.substring(10);
- try {
- inputParam = Gateway.getStorage().get(entity.getSysKey(), ClusterStorage.PROPERTY+"/"+value, null);
- } catch (ObjectNotFoundException ex) {
- inputParam = null;
- }
- }
- Logger.msg(5, "Split.evaluateScript() - Setting param " + element.getKey() + " to " + inputParam.toString());
- script.setInputParamValue(element.getKey(), inputParam);
- }
- }
-
- if (requiredInput.containsKey("item")) {
- script.setInputParamValue("item", Gateway.getProxyManager().getProxy(entity));
- }
- if (requiredInput.containsKey("agent")) {
- AgentPath systemAgent = Gateway.getLDAPLookup().getRoleManager().getAgentPath("system");
- script.setInputParamValue("agent", Gateway.getProxyManager().getProxy(systemAgent));
- }
- Object retVal = script.execute();
- Logger.msg(2, "Split.evaluateScript() - Script returned "+retVal);
- if (retVal == null) retVal = "";
- return retVal;
- }
- catch (Exception e)
- {
- Logger.msg(1, "Split.evaluateScript() - Error: Script " + scriptName);
- Logger.error(e);
- throw new ScriptingEngineException();
- }
- }
-
- private static Script getScript(String name, String version) throws ScriptingEngineException
- {
- Script script;
- try
- {
- script = new Script(name, Integer.parseInt(version));
- }
- catch (NumberFormatException e)
- { // version not valid
- int split = name.indexOf(":");
- if (split > -1)
- {
- script = new Script(name.substring(0, split), name.substring(split + 1));
- }
- else
- throw new ScriptingEngineException("Could not find script " + name + " v" + version);
- }
-
- return script;
- }
-
-
- public Workflow getWf()
- {
- return ((CompositeActivity)getParent()).getWf();
- }
-}
-
diff --git a/source/com/c2kernel/lifecycle/instance/Workflow.java b/source/com/c2kernel/lifecycle/instance/Workflow.java
deleted file mode 100644
index 1d12ee6..0000000
--- a/source/com/c2kernel/lifecycle/instance/Workflow.java
+++ /dev/null
@@ -1,208 +0,0 @@
-package com.c2kernel.lifecycle.instance;
-import java.awt.Point;
-import java.util.ArrayList;
-
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.common.ObjectAlreadyExistsException;
-import com.c2kernel.common.ObjectNotFoundException;
-import com.c2kernel.entity.C2KLocalObject;
-import com.c2kernel.entity.agent.Job;
-import com.c2kernel.graph.model.GraphPoint;
-import com.c2kernel.graph.model.TypeNameAndConstructionInfo;
-import com.c2kernel.lifecycle.instance.predefined.PredefinedStepContainer;
-import com.c2kernel.lifecycle.instance.stateMachine.Transitions;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.persistency.ClusterStorage;
-import com.c2kernel.scripting.ScriptingEngineException;
-import com.c2kernel.utils.Language;
-import com.c2kernel.utils.Logger;
-/**
- * @version $Revision: 1.64 $ $Date: 2005/09/30 07:09:48 $
- * @author $Author: abranson $
- */
-public class Workflow extends CompositeActivity implements C2KLocalObject
-{
- /** TypeNameAndConstructionInfo[] variables added by Steve */
- private final TypeNameAndConstructionInfo[] mVertexTypeNameAndConstructionInfo =
- {
- new TypeNameAndConstructionInfo(Language.translate("AND Split"), "AndSplit"),
- new TypeNameAndConstructionInfo(Language.translate("OR Split"), "OrSplit"),
- new TypeNameAndConstructionInfo(Language.translate("XOR Split"), "XOrSplit"),
- new TypeNameAndConstructionInfo(Language.translate("Join"), "Join"),
- new TypeNameAndConstructionInfo(Language.translate("Loop"), "LoopSplit"),
- new TypeNameAndConstructionInfo(Language.translate("Atomic"), "Atomic"),
- new TypeNameAndConstructionInfo(Language.translate("Composite"), "Composite")
- };
- private final TypeNameAndConstructionInfo[] mEdgeTypeNameAndConstructionInfo =
- {
- new TypeNameAndConstructionInfo(Language.translate("Next Edge"), "Next")
- };
- /**
- * @see java.lang.Object#Object()
- */
- public Workflow()
- {
- getProperties().put("ItemSystemKey", null);
- }
-
- public Workflow(CompositeActivity domain) {
- this();
- domain.setName("domain");
- initChild(domain, true, new Point(150, 100));
- PredefinedStepContainer act = new PredefinedStepContainer();
- addChild(act, new GraphPoint(300, 100));
- }
-
- /**
- * Method getVertexTypeNameAndConstructionInfo.
- *
- * @return TypeNameAndConstructionInfo[]
- */
- /** getVertexTypeNameAndConstructionInfo() added by Steve */
- public TypeNameAndConstructionInfo[] getVertexTypeNameAndConstructionInfo()
- {
- return mVertexTypeNameAndConstructionInfo;
- }
- /**
- * Method getEdgeTypeNameAndConstructionInfo.
- *
- * @return TypeNameAndConstructionInfo[]
- */
- /** getVertexTypeNameAndConstructionInfo() added by Steve */
- public TypeNameAndConstructionInfo[] getEdgeTypeNameAndConstructionInfo()
- {
- return mEdgeTypeNameAndConstructionInfo;
- }
- /**
- * Method requestAction.
- *
- * @param agentInfo
- * @param stepPath
- * @param transitionID
- * @param reguestData
- * @throws ObjectNotFoundException
- * @throws AccessRightsException
- * @throws InvalidTransitionException
- * @throws InvalidDataException
- */
- //requestData is xmlstring
- public void requestAction(AgentPath agent, String stepPath, int transitionID, String requestData)
- throws ObjectNotFoundException, AccessRightsException, InvalidTransitionException, InvalidDataException, ObjectAlreadyExistsException
- {
- Logger.msg(3, "Action: " + Transitions.getTransitionName(transitionID) + " " + stepPath + " by " + agent.getAgentName());
- if (search(stepPath) != null)
- ((Activity) search(stepPath)).request(agent, transitionID, requestData);
- else
- throw new ObjectNotFoundException(stepPath + " not found", "");
- }
-
- /**
- * @see com.c2kernel.graph.model.GraphableVertex#getPath()
- */
- @Override
- public String getPath()
- {
- return "workflow";
- }
- /**
- * @see com.c2kernel.graph.model.Vertex#getName()
- */
- @Override
- public String getName()
- {
- return "workflow";
- }
- /**
- * @see com.c2kernel.lifecycle.instance.Activity#getType()
- */
- @Override
- public String getType()
- {
- return "workflow";
- }
- /**
- * @see com.c2kernel.graph.model.Vertex#setName(java.lang.String)
- */
- @Override
- public void setName(String name)
- {
- }
- /**
- * @see com.c2kernel.lifecycle.instance.WfVertex#verify()
- */
- @Override
- public boolean verify()
- {
- for (int i = 0; i < getChildren().length; i++)
- {
- if (!((WfVertex) getChildren()[i]).verify())
- {
- mErrors.add("error in children");
- return false;
- }
- }
- return true;
- }
- /**
- * @see com.c2kernel.lifecycle.instance.Activity#getWf()
- */
- @Override
- public Workflow getWf()
- {
- return this;
- }
- /**
- * Method initialise.
- *
- * @param systemKey
- */
- public void initialise(int systemKey, AgentPath agent)
- {
- this.getProperties().put("ItemSystemKey", new Integer(systemKey));
- try
- {
- runfirst(agent);
- }
- catch (ScriptingEngineException ex)
- {
- Logger.error(ex);
- }
- }
- /**
- * Method calculateJobs.
- *
- * @param type
- * @return JobList
- */
- /**
- * if type = 0 only domain steps will be queried if type = 1 only predefined steps will be queried else both will be queried
- */
- public ArrayList<Job> calculateJobs(AgentPath agent, int type)
- {
- ArrayList<Job> jobs = new ArrayList<Job>();
- if (type != 1)
- jobs.addAll(((CompositeActivity) search("workflow/domain")).calculateJobs(agent, true));
- if (type != 0)
- jobs.addAll(((CompositeActivity) search("workflow/predefined")).calculateJobs(agent, true));
- return jobs;
- }
- /**
- * @see com.c2kernel.lifecycle.instance.CompositeActivity#hasGoodNumberOfActivity()
- */
- @Override
- public boolean hasGoodNumberOfActivity()
- {
- return true;
- }
- /**
- * @see com.c2kernel.entity.C2KLocalObject#getClusterType()
- */
- @Override
- public String getClusterType()
- {
- return ClusterStorage.LIFECYCLE;
- }
-
-}
diff --git a/source/com/c2kernel/lifecycle/instance/XOrSplit.java b/source/com/c2kernel/lifecycle/instance/XOrSplit.java
deleted file mode 100644
index 25baf0b..0000000
--- a/source/com/c2kernel/lifecycle/instance/XOrSplit.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.c2kernel.lifecycle.instance;
-
-import java.util.ArrayList;
-import java.util.StringTokenizer;
-
-import com.c2kernel.graph.model.DirectedEdge;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.scripting.ScriptingEngineException;
-
-/**
- * @version $Revision: 1.23 $ $Date: 2006/03/03 13:52:21 $
- * @author $Author: abranson $
- */
-public class XOrSplit extends Split
-{
- /**
- * @see java.lang.Object#Object()
- */
- public XOrSplit()
- {
- super();
- }
-
- @Override
- public void runNext(AgentPath agent) throws ScriptingEngineException
- {
- ArrayList<DirectedEdge> nextsToFollow = new ArrayList<DirectedEdge>();
- String nexts = this.evaluateScript(
- (String) getProperties().get("RoutingScriptName"),
- (String) getProperties().get("RoutingScriptVersion")).toString();
-
- StringTokenizer tok = new StringTokenizer(nexts,",");
- String[] nextsTab = new String[tok.countTokens()];
- for (int i=0;i<nextsTab.length;i++)
- nextsTab[i] = tok.nextToken();
-
- DirectedEdge[] outEdges = getOutEdges();
- for (DirectedEdge outEdge : outEdges) {
- if (isInTable((String)((Next)outEdge).getProperties().get("Alias"), nextsTab))
- nextsToFollow.add(outEdge);
- }
-// Logger.debug(0, getID()+" following "+nexts);
- if (nextsToFollow.size() != 1)
- throw new ScriptingEngineException("not good number of active next");
-
- followNext((Next)nextsToFollow.get(0), agent);
-
- }
-
- public void followNext(Next activeNext, AgentPath agent) throws ScriptingEngineException {
- activeNext.getTerminusVertex().run(agent);
- }
-
-}
diff --git a/source/com/c2kernel/lifecycle/instance/gui/model/WfEdgeFactory.java b/source/com/c2kernel/lifecycle/instance/gui/model/WfEdgeFactory.java
deleted file mode 100644
index e96ef37..0000000
--- a/source/com/c2kernel/lifecycle/instance/gui/model/WfEdgeFactory.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.c2kernel.lifecycle.instance.gui.model;
-
-import com.c2kernel.graph.model.DirectedEdge;
-import com.c2kernel.graph.model.EdgeFactory;
-import com.c2kernel.graph.model.GraphModelManager;
-import com.c2kernel.graph.model.TypeNameAndConstructionInfo;
-import com.c2kernel.graph.model.Vertex;
-import com.c2kernel.lifecycle.instance.WfVertex;
-
-public class WfEdgeFactory implements EdgeFactory
-{
- @Override
- public void create
- (
- GraphModelManager graphModelManager,
- Vertex origin,
- Vertex terminus,
- TypeNameAndConstructionInfo typeNameAndConstructionInfo
- )
- {
- if ( validCreation( graphModelManager, origin, terminus ) )
- ((WfVertex)origin).addNext((WfVertex)terminus);
-
- }
-
- private static boolean validCreation( GraphModelManager graphModelManager, Vertex origin, Vertex terminus )
- {
- DirectedEdge[] connectingEdgesAToB = graphModelManager.getModel().getConnectingEdges( origin.getID() , terminus.getID() );
- DirectedEdge[] connectingEdgesBToA = graphModelManager.getModel().getConnectingEdges( terminus.getID(), origin.getID() );
-
-
- return ( origin != terminus ) && ( connectingEdgesAToB.length == 0 ) && ( connectingEdgesBToA.length == 0 );
- }
-}
-
diff --git a/source/com/c2kernel/lifecycle/instance/gui/model/WfGraphPanel.java b/source/com/c2kernel/lifecycle/instance/gui/model/WfGraphPanel.java
deleted file mode 100644
index 16c8e16..0000000
--- a/source/com/c2kernel/lifecycle/instance/gui/model/WfGraphPanel.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*Created on 21 nov. 2003 */
-package com.c2kernel.lifecycle.instance.gui.model;
-
-import java.awt.Graphics2D;
-
-import com.c2kernel.graph.model.DirectedEdge;
-import com.c2kernel.graph.model.GraphPoint;
-import com.c2kernel.graph.view.DirectedEdgeRenderer;
-import com.c2kernel.graph.view.GraphPanel;
-import com.c2kernel.graph.view.VertexRenderer;
-import com.c2kernel.lifecycle.instance.Next;
-
-/** @author XSeb74*/
-public class WfGraphPanel extends GraphPanel
-{
- public WfGraphPanel(DirectedEdgeRenderer d,VertexRenderer v)
- {
- super(d,v);
- }
- // Draws the highlight of the specified edge
- @Override
- protected void drawEdgeHighlight(Graphics2D g2d, DirectedEdge edge)
- {
- GraphPoint originPoint = edge.getOriginPoint();
- GraphPoint terminusPoint = edge.getTerminusPoint();
- GraphPoint midPoint = new GraphPoint();
-
- if ("Straight".equals(((Next)edge).getProperties().get("Type")) || ((Next)edge).getProperties().get("Type") == null)
- {
- midPoint.x = originPoint.x + (terminusPoint.x - originPoint.x) / 2;
- midPoint.y = originPoint.y + (terminusPoint.y - originPoint.y) / 2;
- }
- else if (("Broken +".equals(((Next)edge).getProperties().get("Type"))))
- {
- midPoint.x = (originPoint.x + terminusPoint.x) / 2;
- midPoint.y = (originPoint.y + terminusPoint.y) / 2;
- }
- else if (("Broken -".equals(((Next)edge).getProperties().get("Type"))))
- {
- boolean arrowOnY = !(originPoint.y - terminusPoint.y < 60 && originPoint.y - terminusPoint.y > -60);
- midPoint.x = arrowOnY ? terminusPoint.x : (originPoint.x + terminusPoint.x) / 2;
- midPoint.y = arrowOnY ? (originPoint.y + terminusPoint.y) / 2 : originPoint.y;
- }
- else if (("Broken |".equals(((Next)edge).getProperties().get("Type"))))
- {
- boolean arrowOnY = !(originPoint.y - terminusPoint.y < 60 && originPoint.y - terminusPoint.y > -60);
- midPoint.x = arrowOnY ? originPoint.x : (originPoint.x + terminusPoint.x) / 2;
- midPoint.y = arrowOnY ? (originPoint.y + terminusPoint.y) / 2 : terminusPoint.y;
- }
- int minX = midPoint.x - 10;
- int minY = midPoint.y - 10;
- int maxX = midPoint.x + 10;
- int maxY = midPoint.y + 10;
- g2d.drawLine(minX, minY, maxX, minY);
- g2d.drawLine(maxX, minY, maxX, maxY);
- g2d.drawLine(maxX, maxY, minX, maxY);
- g2d.drawLine(minX, maxY, minX, minY);
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/gui/model/WfVertexFactory.java b/source/com/c2kernel/lifecycle/instance/gui/model/WfVertexFactory.java
deleted file mode 100644
index 39e7ee9..0000000
--- a/source/com/c2kernel/lifecycle/instance/gui/model/WfVertexFactory.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package com.c2kernel.lifecycle.instance.gui.model;
-import java.awt.Point;
-import java.io.Serializable;
-import java.util.HashMap;
-
-import javax.swing.JOptionPane;
-
-import com.c2kernel.graph.model.GraphModelManager;
-import com.c2kernel.graph.model.TypeNameAndConstructionInfo;
-import com.c2kernel.graph.model.VertexFactory;
-import com.c2kernel.lifecycle.ActivityDef;
-import com.c2kernel.lifecycle.chooser.ActivityChooser;
-import com.c2kernel.lifecycle.chooser.WorkflowDialogue;
-import com.c2kernel.lifecycle.instance.Activity;
-import com.c2kernel.lifecycle.instance.CompositeActivity;
-import com.c2kernel.utils.Language;
-import com.c2kernel.utils.LocalObjectLoader;
-import com.c2kernel.utils.Resource;
-public class WfVertexFactory implements VertexFactory, WorkflowDialogue
-{
- protected CompositeActivity mRootAct = null;
- @Override
- public void create(GraphModelManager graphModelManager, Point location, TypeNameAndConstructionInfo typeNameAndConstructionInfo)
- {
- String vertexTypeId = null;
- if (mRootAct != null && typeNameAndConstructionInfo.mInfo instanceof String)
- {
- vertexTypeId = (String) typeNameAndConstructionInfo.mInfo;
- if (vertexTypeId.equals("Atomic") || vertexTypeId.equals("Composite"))
- {
- HashMap<String, Serializable> mhm = new HashMap<String, Serializable>();
- mhm.put("P1", vertexTypeId);
- mhm.put("P2", location);
- //************************************************
- ActivityChooser a =
- new ActivityChooser(
- Language.translate("Please enter a Type for the new activity"),
- Language.translate("New " + vertexTypeId + " Activity"),
- Resource.findImage("graph/newvertex_large.png").getImage(),
- this,
- mhm);
- a.setVisible(true);
- }
- else
- mRootAct.newChild(vertexTypeId, location);
- }
- }
- @Override
- public void setCreationContext(Object newContext)
- {
- if (newContext != null && newContext instanceof CompositeActivity)
- mRootAct = (CompositeActivity) newContext;
- }
- @Override
- public void loadThisWorkflow(String newName, HashMap<?, ?> hashMap)
- {
- String vertexTypeId = (String) hashMap.get("P1");
- Point location = (Point) hashMap.get("P2");
- if (newName == null)
- return;
-
-
- String unicName = newName;
- while (mRootAct.search(mRootAct.getPath() + "/" + unicName) != null)
- {
- unicName =
- (String) JOptionPane.showInputDialog(
- null,
- Language.translate("Activity name not unique. Please give another."),
- Language.translate("New " + vertexTypeId + " Activity"),
- JOptionPane.QUESTION_MESSAGE,
- Resource.findImage("graph/newvertex_large.png"),
- null,
- null);
- if (newName.equals(""))
- return;
- }
- Activity act = null;
- try
- {
- ActivityDef actD = LocalObjectLoader.getActDef(newName, "last");
- act = (Activity)actD.instantiate(unicName);
- }
- catch (Exception e)
- {
- }
- if (act == null)
- mRootAct.newChild(unicName, vertexTypeId, location);
- else
- mRootAct.newExistingChild(act, unicName, location);
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/gui/model/WfVertexOutlineCreator.java b/source/com/c2kernel/lifecycle/instance/gui/model/WfVertexOutlineCreator.java
deleted file mode 100644
index e8cb303..0000000
--- a/source/com/c2kernel/lifecycle/instance/gui/model/WfVertexOutlineCreator.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.c2kernel.lifecycle.instance.gui.model;
-
-import java.io.Serializable;
-
-import com.c2kernel.graph.model.GraphPoint;
-import com.c2kernel.graph.model.Vertex;
-import com.c2kernel.graph.model.VertexOutlineCreator;
-import com.c2kernel.lifecycle.instance.Activity;
-
-public class WfVertexOutlineCreator implements VertexOutlineCreator,Serializable
-{
- private final int mActivityWidth = 130;
- private final int mActivityHeight = 60;
- private final int mSplitJoinWidth = 60;
- private final int mSplitJoinHeight = 25;
-
- @Override
- public void setOutline(Vertex vertex)
- {
- GraphPoint centrePoint = vertex.getCentrePoint();
- GraphPoint[] outlinePoints = new GraphPoint[ 4 ];
- int vertexWidth = 0;
- int vertexHeight = 0;
-
- if(vertex instanceof Activity)
- {
- vertexWidth = mActivityWidth;
- vertexHeight = mActivityHeight;
- }
- else
- {
- vertexWidth = mSplitJoinWidth;
- vertexHeight = mSplitJoinHeight;
- }
-
- outlinePoints[ 0 ] = new GraphPoint();
- outlinePoints[ 0 ].x = centrePoint.x - vertexWidth / 2;
- outlinePoints[ 0 ].y = centrePoint.y - vertexHeight / 2;
- outlinePoints[ 1 ] = new GraphPoint();
- outlinePoints[ 1 ].x = centrePoint.x + vertexWidth / 2;
- outlinePoints[ 1 ].y = centrePoint.y - vertexHeight / 2;
- outlinePoints[ 2 ] = new GraphPoint();
- outlinePoints[ 2 ].x = centrePoint.x + vertexWidth / 2;
- outlinePoints[ 2 ].y = centrePoint.y + vertexHeight / 2;
- outlinePoints[ 3 ] = new GraphPoint();
- outlinePoints[ 3 ].x = centrePoint.x - vertexWidth / 2;
- outlinePoints[ 3 ].y = centrePoint.y + vertexHeight / 2;
-
- vertex.setOutlinePoints( outlinePoints );
- }
-}
-
diff --git a/source/com/c2kernel/lifecycle/instance/gui/view/ActivityRenderer.java b/source/com/c2kernel/lifecycle/instance/gui/view/ActivityRenderer.java
deleted file mode 100644
index 046ed7c..0000000
--- a/source/com/c2kernel/lifecycle/instance/gui/view/ActivityRenderer.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package com.c2kernel.lifecycle.instance.gui.view;
-import java.awt.Color;
-import java.awt.FontMetrics;
-import java.awt.Graphics2D;
-import java.awt.Paint;
-import java.awt.Polygon;
-
-import com.c2kernel.common.GTimeStamp;
-import com.c2kernel.graph.model.GraphPoint;
-import com.c2kernel.graph.model.Vertex;
-import com.c2kernel.graph.view.VertexRenderer;
-import com.c2kernel.lifecycle.instance.Activity;
-import com.c2kernel.lifecycle.instance.stateMachine.States;
-import com.c2kernel.utils.DateUtility;
-import com.c2kernel.utils.Language;
-public class ActivityRenderer implements VertexRenderer
-{
- private Paint mActivePaint = new Color(100, 255, 100);
- private Paint mActiveCompPaint = new Color(100, 255, 255);
- private Paint mInactivePaint = new Color(255, 255, 255);
- private Paint mInactiveCompPaint = new Color(200, 200, 255);
- private Paint mErrorPaint = new Color(255, 50, 0);
- private Paint mTextPaint = Color.black;
- @Override
- public void draw(Graphics2D g2d, Vertex vertex)
- {
- Activity activity = (Activity) vertex;
- boolean active = activity.getActive();
- boolean hasError = !activity.verify();
- boolean isComposite = activity.getIsComposite();
- GraphPoint centrePoint = activity.getCentrePoint();
- //String description = activity.getDescription();
- String[] linesOfText = new String[3];
- linesOfText[0] = "(" + activity.getType() + ")";
- linesOfText[1] = activity.getName();
- if (hasError)
- linesOfText[2] = Language.translate(activity.getErrors());
- else
- {
- int cs = activity.getCurrentState();
- if (cs == States.WAITING && activity.getActive())
- linesOfText[2] =
- Language.translate(States.getStateName(cs))
- + (((Boolean) activity.getProperties().get("Show time")).booleanValue()
- ? " " + getWaitTime(activity.getActiveDate())
- : "");
- else if (cs == States.STARTED)
- linesOfText[2] =
- Language.translate(States.getStateName(cs))
- + (((Boolean) activity.getProperties().get("Show time")).booleanValue()
- ? " " + getWaitTime(activity.getStartDate())
- : "");
- else
- linesOfText[2] = Language.translate(States.getStateName(cs));
- }
-
- FontMetrics metrics = g2d.getFontMetrics();
- int lineWidth = 0;
- int lineHeight = metrics.getHeight();
- int linesHeight = lineHeight * linesOfText.length;
- int linesStartY = centrePoint.y - linesHeight / 2 + lineHeight * 2 / 3;
- int x = 0;
- int y = 0;
- int i = 0;
- GraphPoint[] outline = vertex.getOutlinePoints();
- Paint actColour;
- if (hasError)
- actColour = mErrorPaint;
- else if (active)
- if (isComposite)
- actColour = mActiveCompPaint;
- else
- actColour = mActivePaint;
- else if (isComposite)
- actColour = mInactiveCompPaint;
- else
- actColour = mInactivePaint;
- g2d.setPaint(actColour);
- //g2d.fill3DRect( centrePoint.x - mSize.width / 2, centrePoint.y - mSize.height / 2, mSize.width, mSize.height, true );
- g2d.fill(graphPointsToPolygon(outline));
- g2d.setPaint(mTextPaint);
- for (i = 0; i < linesOfText.length; i++)
- {
- lineWidth = metrics.stringWidth(linesOfText[i]);
- x = centrePoint.x - lineWidth / 2;
- y = linesStartY + i * lineHeight;
- g2d.drawString(linesOfText[i], x, y);
- }
- }
- private static Polygon graphPointsToPolygon(GraphPoint[] points)
- {
- Polygon polygon = new Polygon();
- int i = 0;
- for (i = 0; i < points.length; i++)
- {
- polygon.addPoint(points[i].x, points[i].y);
- }
- return polygon;
- }
- private static String getWaitTime(GTimeStamp date)
- {
- GTimeStamp now = new GTimeStamp();
- DateUtility.setToNow(now);
- long diff = DateUtility.diff(now, date);
- long secondes = diff % 60;
- long minutes = (diff / 60) % 60;
- long hours = (diff / 3600) % 24;
- long days = (diff / 3600 / 24);
- if (days > 0)
- return days + " " + Language.translate("d") + " " + hours + " " + Language.translate("h");
- if (hours > 0)
- return hours + " " + Language.translate("h") + " " + minutes + " " + Language.translate("min");
- if (minutes > 0)
- return minutes + " " + Language.translate("min");
- return secondes + " " + Language.translate("sec");
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/gui/view/FindActDefPanel.java b/source/com/c2kernel/lifecycle/instance/gui/view/FindActDefPanel.java
deleted file mode 100644
index 4c1a148..0000000
--- a/source/com/c2kernel/lifecycle/instance/gui/view/FindActDefPanel.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package com.c2kernel.lifecycle.instance.gui.view;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.JButton;
-
-import com.c2kernel.common.ObjectNotFoundException;
-import com.c2kernel.graph.model.Vertex;
-import com.c2kernel.graph.view.SelectedVertexPanel;
-import com.c2kernel.gui.MainFrame;
-import com.c2kernel.lifecycle.ActivitySlotDef;
-import com.c2kernel.lookup.DomainPath;
-
-/**************************************************************************
- *
- * $Revision: 1.3 $
- * $Date: 2005/12/01 14:23:15 $
- *
- * Copyright (C) 2003 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-public class FindActDefPanel extends SelectedVertexPanel {
-
- JButton findButton;
- ActivitySlotDef currentAct;
-
- public FindActDefPanel() {
- super();
- findButton = new JButton("Open Definition");
- findButton.setEnabled(false);
- add(findButton);
- findButton.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- try {
- DomainPath actPath = (DomainPath)new DomainPath("/desc/ActivityDesc/").find(currentAct.getActivityDef());
- MainFrame.treeBrowser.push(actPath);
- } catch (ObjectNotFoundException e1) { }
- }
- });
- }
-
- /**
- *
- */
-
- @Override
- public void select(Vertex vert) {
- if (vert instanceof ActivitySlotDef) {
- findButton.setEnabled(true);
- currentAct = (ActivitySlotDef)vert;
- }
- else
- clear();
-
- }
-
- /**
- *
- */
-
- @Override
- public void clear() {
- findButton.setEnabled(false);
- currentAct = null;
- }
-
-}
diff --git a/source/com/c2kernel/lifecycle/instance/gui/view/SplitJoinRenderer.java b/source/com/c2kernel/lifecycle/instance/gui/view/SplitJoinRenderer.java
deleted file mode 100644
index 036f79a..0000000
--- a/source/com/c2kernel/lifecycle/instance/gui/view/SplitJoinRenderer.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package com.c2kernel.lifecycle.instance.gui.view;
-
-import java.awt.Color;
-import java.awt.FontMetrics;
-import java.awt.Graphics2D;
-import java.awt.Paint;
-
-import com.c2kernel.graph.model.GraphPoint;
-import com.c2kernel.graph.model.Vertex;
-import com.c2kernel.graph.view.VertexRenderer;
-import com.c2kernel.lifecycle.instance.AndSplit;
-import com.c2kernel.lifecycle.instance.Join;
-import com.c2kernel.lifecycle.instance.Loop;
-import com.c2kernel.lifecycle.instance.OrSplit;
-import com.c2kernel.lifecycle.instance.WfVertex;
-import com.c2kernel.lifecycle.instance.XOrSplit;
-import com.c2kernel.utils.Language;
-
-public class SplitJoinRenderer implements VertexRenderer
-{
- private Paint mTextPaint = Color.black;
- private Paint mBoxPaint = new Color( 204, 204, 204 );
- private Paint mErrorPaint = new Color( 255, 0, 0 );
- private boolean mTextOffsetsNotInitialised = true;
- private int mTextYOffset = 0;
- private String mAndText = "And";
- private int mAndTextXOffset = 0;
- private String mOrText = "Or";
- private int mOrTextXOffset = 0;
- private String mLoopText = "Loop";
- private int mLoopTextXOffset = 0;
- private String mXOrText = "XOr";
- private int mXOrTextXOffset = 0;
- private String mJoinText = "Join";
- private int mJoinTextXOffset = 0;
- private String mRouteText = "";
- private int mRouteTextXOffset = 0;
- private String mXXXText = "XXX";
- private int mXXXTextXOffset = 0;
-
-
- @Override
- public void draw( Graphics2D g2d, Vertex vertex)
- {
- GraphPoint centrePoint = vertex.getCentrePoint();
- String text = null;
- int textXOffset = 0;
- int vertexHeight = vertex.getHeight();
- int vertexWidth = vertex.getWidth();
-
-
- if ( mTextOffsetsNotInitialised )
- {
- initialiseTextOffsets( g2d );
- mTextOffsetsNotInitialised = false;
- }
- if ( vertex instanceof AndSplit )
- {
- text = Language.translate(mAndText);
- textXOffset = mAndTextXOffset;
- }
- else if ( vertex instanceof OrSplit )
- {
- text = Language.translate(mOrText);
- textXOffset = mOrTextXOffset;
- }
- else if ( vertex instanceof Loop )
- {
- text = Language.translate(mLoopText);
- textXOffset = mLoopTextXOffset;
- }
- else if ( vertex instanceof XOrSplit )
- {
- text = Language.translate(mXOrText);
- textXOffset = mXOrTextXOffset;
- }
- else if ( vertex instanceof Join )
- {
- text = Language.translate(mJoinText);
- textXOffset = mJoinTextXOffset;
- }
- else if ( vertex instanceof Join)
- {
- String type= (String)((Join)vertex).getProperties().get("Type");
- if (type!=null && type.equals("Route"))
- {
- text = mRouteText;
- textXOffset = mRouteTextXOffset;
- }
- else
- {
- text = Language.translate(mJoinText);
- textXOffset = mJoinTextXOffset;
- }
- }
- else
- {
- text = mXXXText;
- textXOffset = mXXXTextXOffset;
- }
-
- boolean hasErrors = ((WfVertex)vertex).verify();
- g2d.setPaint( hasErrors ? mBoxPaint : mErrorPaint );
- g2d.fillRect
- (
- centrePoint.x - vertexWidth / 2,
- centrePoint.y - vertexHeight / 2,
- vertexWidth,
- vertexHeight
- );
- g2d.setPaint( mTextPaint );
- g2d.drawRect
- (
- centrePoint.x - vertexWidth / 2,
- centrePoint.y - vertexHeight / 2,
- vertexWidth,
- vertexHeight
- );
- g2d.drawString( text, centrePoint.x - textXOffset, centrePoint.y + mTextYOffset );
-
- if (!hasErrors) {
- g2d.setPaint( mErrorPaint );
- String errors = Language.translate(((WfVertex)vertex).getErrors());
- int errorWidth = g2d.getFontMetrics().stringWidth( errors );
- g2d.drawString( errors, centrePoint.x - ( errorWidth / 2), centrePoint.y + vertexHeight );
- }
- }
-
- private void initialiseTextOffsets( Graphics2D g2d )
- {
- FontMetrics metrics = g2d.getFontMetrics();
-
-
- mTextYOffset = metrics.getHeight() / 3;
- mAndTextXOffset = metrics.stringWidth( Language.translate(mAndText) ) / 2;
- mOrTextXOffset = metrics.stringWidth( Language.translate(mOrText) ) / 2;
- mXOrTextXOffset = metrics.stringWidth( Language.translate(mXOrText) ) / 2;
- mJoinTextXOffset = metrics.stringWidth( Language.translate(mJoinText) ) / 2;
- mLoopTextXOffset = metrics.stringWidth( Language.translate(mLoopText) ) / 2;
- }
-}
-
diff --git a/source/com/c2kernel/lifecycle/instance/gui/view/TransitionPanel.java b/source/com/c2kernel/lifecycle/instance/gui/view/TransitionPanel.java
deleted file mode 100644
index 094f900..0000000
--- a/source/com/c2kernel/lifecycle/instance/gui/view/TransitionPanel.java
+++ /dev/null
@@ -1,187 +0,0 @@
-package com.c2kernel.lifecycle.instance.gui.view;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.Box;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-
-import com.c2kernel.entity.agent.Job;
-import com.c2kernel.entity.proxy.ItemProxy;
-import com.c2kernel.graph.model.Vertex;
-import com.c2kernel.graph.view.SelectedVertexPanel;
-import com.c2kernel.gui.MainFrame;
-import com.c2kernel.gui.tabs.EntityTabPane;
-import com.c2kernel.gui.tabs.execution.Executor;
-import com.c2kernel.lifecycle.instance.Activity;
-import com.c2kernel.lifecycle.instance.stateMachine.StateMachine;
-import com.c2kernel.lifecycle.instance.stateMachine.States;
-import com.c2kernel.lifecycle.instance.stateMachine.Transitions;
-import com.c2kernel.utils.Logger;
-
-/**************************************************************************
- *
- * $Revision: 1.8 $
- * $Date: 2005/09/07 13:46:31 $
- *
- * Copyright (C) 2003 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-public class TransitionPanel extends SelectedVertexPanel implements ActionListener {
- protected Activity mCurrentAct;
- protected GridBagLayout gridbag;
- protected GridBagConstraints c;
- protected Box transBox;
- protected JComboBox executors;
- protected JComboBox states = new JComboBox(States.states);
- protected JCheckBox active = new JCheckBox();
- protected JLabel status = new JLabel();
- protected ItemProxy mItem;
-
- public TransitionPanel() {
- super();
- gridbag = new GridBagLayout();
- setLayout(gridbag);
- c = new GridBagConstraints();
- c.gridx=0; c.gridy=0;
- c.weightx=1; c.weighty=0;
- c.fill=GridBagConstraints.HORIZONTAL;
-
- JLabel title = new JLabel("Available Transitions");
- title.setFont(EntityTabPane.titleFont);
- gridbag.setConstraints(title, c);
- add(title);
-
- c.gridy++;
- gridbag.setConstraints(status, c);
- add(status);
- c.gridy++;
-
- transBox = Box.createHorizontalBox();
- gridbag.setConstraints(transBox, c);
- add(transBox);
-
- c.weightx=0; c.gridx++;
- executors = MainFrame.getExecutionPlugins();
- if (executors.getItemCount() > 1) {
- gridbag.setConstraints(executors, c);
- add(executors);
- }
-
-
-
- if (MainFrame.isAdmin) {
- c.gridx=0; c.gridy++;
- title = new JLabel("State Hacking");
- title.setFont(EntityTabPane.titleFont);
- gridbag.setConstraints(title, c);
- add(title);
- Box hackBox = Box.createHorizontalBox();
- hackBox.add(states);
- hackBox.add(Box.createHorizontalGlue());
- hackBox.add(new JLabel("Active:"));
- hackBox.add(active);
- c.gridy++;
- gridbag.setConstraints(hackBox, c);
- add(hackBox);
- states.addActionListener(this);
- active.addActionListener(this);
- }
-
- clear();
-
- }
- /**
- *
- */
- @Override
- public void select(Vertex vert) {
- clear();
- if (!(vert instanceof Activity)) return;
- mCurrentAct = (Activity)vert;
- states.setSelectedIndex(mCurrentAct.getCurrentState());
- states.setEnabled(true);
- active.setSelected(mCurrentAct.active);
- active.setEnabled(true);
- Logger.msg("Retrieving possible transitions for activity "+mCurrentAct.getName());
- int[] transitions = mCurrentAct.getMachine().possibleTransition();
- if (transitions.length == 0) {
- status.setText("None");
- return;
- }
- for (int i = 0; i < transitions.length; i++) {
- String trans= Transitions.getTransitionName(transitions[i]);
- if (!(transitions[i]==Transitions.DONE) && !(transitions[i]==Transitions.COMPLETE)) {
- String buttonLabel = trans.substring(0,1).toUpperCase()+trans.substring(1);
- JButton thisTrans = new JButton(buttonLabel);
- thisTrans.setActionCommand("Trans:"+String.valueOf(transitions[i]));
- thisTrans.addActionListener(this);
- transBox.add(thisTrans);
- transBox.add(Box.createHorizontalGlue());
- }
- status.setText(transitions.length+" transitions possible.");
- }
- revalidate();
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- if (e.getSource() == active && mCurrentAct != null) {
- mCurrentAct.active = active.isSelected();
- return;
- }
- if (e.getSource() == states && mCurrentAct != null) {
- mCurrentAct.getMachine().state = states.getSelectedIndex();
- return;
- }
- if (!e.getActionCommand().startsWith("Trans:")) return;
- int transition = Integer.parseInt(e.getActionCommand().substring(6));
- Logger.msg("Requesting transition "+transition);
- Job thisJob = new Job(mItem.getSystemKey(),
- mCurrentAct.getPath(),
- transition,
- new StateMachine(mCurrentAct).simulate(transition),
- mCurrentAct.getCurrentState(),
- mCurrentAct.getName(),
- mCurrentAct.getProperties(),
- mCurrentAct.getType(),
- MainFrame.userAgent.getName());
- try {
- Executor selectedExecutor = (Executor)executors.getSelectedItem();
- selectedExecutor.execute(thisJob, status);
- } catch (Exception ex) {
- String className = ex.getClass().getName();
- className = className.substring(className.lastIndexOf('.')+1);
- Logger.error(ex);
- JOptionPane.showMessageDialog(null, ex.getMessage(), className, JOptionPane.ERROR_MESSAGE);
- }
-
- }
-
- @Override
- public void clear() {
- mCurrentAct = null;
- transBox.removeAll();
- status.setText("No activity selected");
- states.setSelectedIndex(0);
- states.setEnabled(false);
- active.setSelected(false);
- active.setEnabled(false);
- revalidate();
- }
-
-
- /**
- * @param item The mItem to set.
- */
- public void setItem(ItemProxy item) {
- mItem = item;
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/gui/view/WfDirectedEdgeRenderer.java b/source/com/c2kernel/lifecycle/instance/gui/view/WfDirectedEdgeRenderer.java
deleted file mode 100644
index f39d9a6..0000000
--- a/source/com/c2kernel/lifecycle/instance/gui/view/WfDirectedEdgeRenderer.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package com.c2kernel.lifecycle.instance.gui.view;
-import java.awt.Color;
-import java.awt.Graphics2D;
-import java.awt.Shape;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.GeneralPath;
-
-import com.c2kernel.graph.model.DirectedEdge;
-import com.c2kernel.graph.model.GraphPoint;
-import com.c2kernel.graph.view.DirectedEdgeRenderer;
-import com.c2kernel.lifecycle.instance.Next;
-public class WfDirectedEdgeRenderer implements DirectedEdgeRenderer
-{
- private GeneralPath mArrowTemplate = new GeneralPath();
- public WfDirectedEdgeRenderer()
- {
- mArrowTemplate.moveTo(-5, 5);
- mArrowTemplate.lineTo(0, 0);
- mArrowTemplate.lineTo(5, 5);
- }
- @Override
- public void draw(Graphics2D g2d, DirectedEdge directedEdge)
- {
- GraphPoint originPoint = directedEdge.getOriginPoint();
- GraphPoint terminusPoint = directedEdge.getTerminusPoint();
- GraphPoint midPoint = new GraphPoint();
- AffineTransform transform = new AffineTransform();
- Shape arrow = null;
- Next next = (Next) directedEdge;
- String text = (String) next.getProperties().get("Alias");
- g2d.setPaint(Color.black);
- if (("Broken +".equals(next.getProperties().get("Type"))))
- {
- g2d.drawLine(originPoint.x, originPoint.y, originPoint.x, (originPoint.y + terminusPoint.y) / 2);
- g2d.drawLine(originPoint.x, (originPoint.y + terminusPoint.y) / 2, terminusPoint.x, (originPoint.y + terminusPoint.y) / 2);
- g2d.drawLine(terminusPoint.x, (originPoint.y + terminusPoint.y) / 2, terminusPoint.x, terminusPoint.y);
- midPoint.x = (originPoint.x + terminusPoint.x) / 2;
- midPoint.y = (originPoint.y + terminusPoint.y) / 2;
- transform.translate(midPoint.x, midPoint.y);
- transform.rotate(
- calcArrowAngle(
- originPoint.x,
- originPoint.x - terminusPoint.x > -5
- && originPoint.x - terminusPoint.x < 5 ? originPoint.y : (originPoint.y + terminusPoint.y) / 2,
- terminusPoint.x,
- originPoint.x - terminusPoint.x > -5
- && originPoint.x - terminusPoint.x < 5 ? terminusPoint.y : (originPoint.y + terminusPoint.y) / 2));
- }
- else if (("Broken -".equals(next.getProperties().get("Type"))))
- {
- g2d.drawLine(originPoint.x, originPoint.y, terminusPoint.x, originPoint.y);
- g2d.drawLine(terminusPoint.x, originPoint.y, terminusPoint.x, terminusPoint.y);
- boolean arrowOnY = !(originPoint.y - terminusPoint.y < 60 && originPoint.y - terminusPoint.y > -60);
- midPoint.x = arrowOnY ? terminusPoint.x : (originPoint.x + terminusPoint.x) / 2;
- midPoint.y = arrowOnY ? (originPoint.y + terminusPoint.y) / 2 : originPoint.y;
- transform.translate(midPoint.x, midPoint.y);
- transform.rotate(
- calcArrowAngle(
- arrowOnY ? terminusPoint.x : originPoint.x,
- arrowOnY ? originPoint.y : originPoint.y,
- arrowOnY ? terminusPoint.x : terminusPoint.x,
- arrowOnY ? terminusPoint.y : originPoint.y));
- }
- else if (("Broken |".equals(next.getProperties().get("Type"))))
- {
- g2d.drawLine(originPoint.x, originPoint.y, originPoint.x, terminusPoint.y);
- g2d.drawLine(originPoint.x, terminusPoint.y, terminusPoint.x, terminusPoint.y);
- boolean arrowOnY = !(originPoint.y - terminusPoint.y < 60 && originPoint.y - terminusPoint.y > -60);
- midPoint.x = arrowOnY ? originPoint.x : (originPoint.x + terminusPoint.x) / 2;
- midPoint.y = arrowOnY ? (originPoint.y + terminusPoint.y) / 2 : terminusPoint.y;
- transform.translate(midPoint.x, midPoint.y);
- transform.rotate(
- calcArrowAngle(
- arrowOnY ? terminusPoint.x : originPoint.x,
- arrowOnY ? originPoint.y : originPoint.y,
- arrowOnY ? terminusPoint.x : terminusPoint.x,
- arrowOnY ? terminusPoint.y : originPoint.y));
- }
- else
- {
- g2d.drawLine(originPoint.x, originPoint.y, terminusPoint.x, terminusPoint.y);
- midPoint.x = originPoint.x + (terminusPoint.x - originPoint.x) / 2;
- midPoint.y = originPoint.y + (terminusPoint.y - originPoint.y) / 2;
- transform.translate(midPoint.x, midPoint.y);
- transform.rotate(calcArrowAngle(originPoint.x, originPoint.y, terminusPoint.x, terminusPoint.y));
- }
- arrow = mArrowTemplate.createTransformedShape(transform);
- g2d.draw(arrow);
- if (text != null)
- g2d.drawString(text, midPoint.x + 10, midPoint.y);
- }
- private static double calcArrowAngle(int originX, int originY, int terminusX, int terminusY)
- {
- double width = terminusX - originX;
- double height = terminusY - originY;
- if ((width == 0) && (height > 0))
- {
- return Math.PI;
- }
- if ((width == 0) && (height < 0))
- {
- return 0;
- }
- if ((width > 0) && (height == 0))
- {
- return Math.PI / 2.0;
- }
- if ((width < 0) && (height == 0))
- {
- return -1.0 * Math.PI / 2.0;
- }
- if ((width > 0) && (height > 0))
- {
- return Math.PI / 2.0 + Math.atan(Math.abs(height) / Math.abs(width));
- }
- if ((width > 0) && (height < 0))
- {
- return Math.atan(Math.abs(width) / Math.abs(height));
- }
- if ((width < 0) && (height < 0))
- {
- return -1.0 * Math.atan(Math.abs(width) / Math.abs(height));
- }
- if ((width < 0) && (height > 0))
- {
- return -1.0 * (Math.PI / 2.0 + Math.atan(Math.abs(height) / Math.abs(width)));
- }
- return 0.0;
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/gui/view/WfVertexRenderer.java b/source/com/c2kernel/lifecycle/instance/gui/view/WfVertexRenderer.java
deleted file mode 100644
index 92a1021..0000000
--- a/source/com/c2kernel/lifecycle/instance/gui/view/WfVertexRenderer.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.c2kernel.lifecycle.instance.gui.view;
-
-import java.awt.Graphics2D;
-
-import com.c2kernel.graph.model.Vertex;
-import com.c2kernel.graph.view.VertexRenderer;
-import com.c2kernel.lifecycle.instance.Activity;
-import com.c2kernel.lifecycle.instance.Join;
-import com.c2kernel.lifecycle.instance.Split;
-
-public class WfVertexRenderer implements VertexRenderer
-{
- protected ActivityRenderer mActivityRenderer = new ActivityRenderer();
- protected SplitJoinRenderer mSplitJoinRenderer = new SplitJoinRenderer();
-
- @Override
- public void draw( Graphics2D g2d, Vertex vertex)
- {
- if ( vertex instanceof Activity ) { mActivityRenderer.draw( g2d, vertex); }
- else if ( ( vertex instanceof Split ) || ( vertex instanceof Join ) ) { mSplitJoinRenderer.draw( g2d, vertex ); }
- }
-}
-
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/AddC2KObject.java b/source/com/c2kernel/lifecycle/instance/predefined/AddC2KObject.java
deleted file mode 100644
index b61187c..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/AddC2KObject.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**************************************************************************
- * AddC2KObject
- *
- * $Workfile$
- * $Revision: 1.31 $
- * $Date: 2004/10/21 08:02:19 $
- *
- * Copyright (C) 2001 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-package com.c2kernel.lifecycle.instance.predefined;
-
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.entity.C2KLocalObject;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.utils.CastorXMLUtility;
-import com.c2kernel.utils.Logger;
-
-/**************************************************************************
- *
- * @author $Author: abranson $ $Date: 2004/10/21 08:02:19 $
- * @version $Revision: 1.31 $
- **************************************************************************/
-public class AddC2KObject extends PredefinedStep
-{
- /**************************************************************************
- * Constructor for Castror
- **************************************************************************/
- public AddC2KObject()
- {
- super();
- }
-
- //requestdata is xmlstring
- @Override
- public void request( AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException,
- InvalidTransitionException,
- InvalidDataException
- {
-
- Logger.msg(1, "AddC2KObject::request() - Starting.");
-
- checkAccessRights(agent);
- EntityPath entityPath = getItemEntityPath();
-
- if (entityPath!=null)
- {
- try
- {
-
- Logger.msg(5, "AddC2KObject::request() - data:" + getDataList(requestData)[0]);
-
- C2KLocalObject obj = (C2KLocalObject)CastorXMLUtility.unmarshall(getDataList(requestData)[0]);
- Gateway.getStorage().put(entityPath.getSysKey(), obj, null );
- sendEventStoreOutcome(transitionID, requestData, agent);
- }
- catch( Exception ex )
- {
- Logger.error("AddC2KObject::request() - during unmarshall.");
- Logger.error(ex);
- throw new InvalidDataException(ex.toString(), "");
- }
-
- Logger.msg(1, "AddC2KObject::request() - DONE.");
- }
- else
- throw new InvalidDataException("EntityPath is null.", "");
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/AddDomainPath.java b/source/com/c2kernel/lifecycle/instance/predefined/AddDomainPath.java
deleted file mode 100644
index 2cf619e..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/AddDomainPath.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/**************************************************************************
- * AddDomainPath
- *
- * Copyright (C) 2001 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-package com.c2kernel.lifecycle.instance.predefined;
-
-
-
-
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.DomainPath;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.lookup.InvalidEntityPathException;
-import com.c2kernel.lookup.LDAPLookup;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.utils.Logger;
-
-public class AddDomainPath extends PredefinedStep
-{
- public AddDomainPath()
- {
- super();
- }
-
- //requestdata is xmlstring
- @Override
- public void request( AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException,
- InvalidTransitionException,
- InvalidDataException
- {
- Logger.msg(8,"AddAlias::request()");
- LDAPLookup lookupManager = Gateway.getLDAPLookup();
-
- Logger.msg(1,"AddAlias::request() - Starting.");
-
- checkAccessRights(agent);
-
- try
- {
- EntityPath entityPath = getItemEntityPath();
- DomainPath domainPath = new DomainPath(getDataList(requestData)[0], entityPath);
- lookupManager.add(domainPath);
- Logger.msg(8,"AddDomainPath::request() - systemKey:" + entityPath.getSysKey() +
- ". Adding dompath. DONE.");
- }
- catch (InvalidEntityPathException ex)
- {
- Logger.error(ex);
- throw new InvalidDataException(ex.toString(), "");
- }
- catch( Exception ex )
- {
- Logger.error("AddDomainPath::request() - during anyHelper.extract.");
- Logger.error(ex);
- throw new InvalidDataException(ex.toString(), "");
- }
-
- sendEventStoreOutcome(transitionID, requestData, agent);
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/AddStepsFromDescription.java b/source/com/c2kernel/lifecycle/instance/predefined/AddStepsFromDescription.java
deleted file mode 100644
index f70c053..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/AddStepsFromDescription.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.c2kernel.lifecycle.instance.predefined;
-
-//Java
-import java.awt.Point;
-
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.lifecycle.CompositeActivityDef;
-import com.c2kernel.lifecycle.instance.CompositeActivity;
-import com.c2kernel.lifecycle.instance.Workflow;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.utils.CastorXMLUtility;
-import com.c2kernel.utils.Logger;
-
-public class AddStepsFromDescription extends PredefinedStep
-{
- public AddStepsFromDescription()
- {
- super();
- }
-
- @Override
- public void request( AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException, InvalidTransitionException, InvalidDataException
- {
- Workflow lifeCycle = getWf();
-
- Logger.msg(1, "AddStepsFromDescription::request() - Starting ");
-
- checkAccessRights(agent);
-
- try
- {
-
- Logger.msg(8, "AddStepsFromDescription::request() - data:" + getDataList(requestData)[0]);
- lifeCycle.getChildGraphModel().removeVertex(lifeCycle.search("workflow/domain"));
- CompositeActivityDef actDef = (CompositeActivityDef) CastorXMLUtility.unmarshall(getDataList(requestData)[0]);
- CompositeActivity domain = (CompositeActivity)actDef.instantiate();
- lifeCycle.initChild(domain, true, new Point(150, 100));
- domain.setName("domain");
- domain.setType(actDef.getName());
- lifeCycle.run(agent);
- Gateway.getStorage().put(getItemEntityPath().getSysKey(), lifeCycle, null);
- Logger.msg(1, "AddStepsFromDescription::request() - DONE.");
- sendEventStoreOutcome(transitionID, requestData, agent);
- }
- catch (Exception ex)
- {
- Logger.error("AddStepsFromDescription::request() - during unmarshall.");
- Logger.error(ex);
- throw new InvalidDataException("AddStepsFromDescription::request() - during unmarshall.", "");
- }
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/AssignItemToSlot.java b/source/com/c2kernel/lifecycle/instance/predefined/AssignItemToSlot.java
deleted file mode 100644
index 0ad5adc..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/AssignItemToSlot.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/**************************************************************************
- * AssignItemToSlot
- *
- * $Workfile$
- * $Revision: 1.8 $
- * $Date: 2004/10/21 08:02:19 $
- *
- * Copyright (C) 2001 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-package com.c2kernel.lifecycle.instance.predefined;
-
-
-import com.c2kernel.collection.Collection;
-import com.c2kernel.collection.CollectionMember;
-import com.c2kernel.collection.MembershipException;
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.persistency.ClusterStorage;
-import com.c2kernel.persistency.ClusterStorageException;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.utils.Logger;
-
-/**************************************************************************
- *
- * @author $Author: abranson $ $Date: 2004/10/21 08:02:19 $
- * @version $Revision: 1.8 $
- **************************************************************************/
-public class AssignItemToSlot extends PredefinedStep
-{
- /**************************************************************************
- * Constructor for Castor
- **************************************************************************/
- public AssignItemToSlot()
- {
- super();
- }
-
-
- /**
- * Params:
- * 0 - collection name
- * 1 - slot number
- * 2 - target entity key
- */
- @Override
- public void request(AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException,
- InvalidTransitionException,
- InvalidDataException
- {
- EntityPath entityPath = getItemEntityPath();
- String collName;
- int slotNo;
- int entityKey;
- Collection<? extends CollectionMember> coll;
-
- Logger.msg(1, "AssignItemToSlot::request() - Starting.");
-
- checkAccessRights(agent);
-
- // extract parameters
- try {
- entityPath = getItemEntityPath();
- String[] params = getDataList(requestData);
- collName = params[0];
- slotNo = Integer.parseInt(params[1]);
- entityKey = Integer.parseInt(params[2]);
- } catch (Exception e) {
- throw new InvalidDataException("Invalid parameters", "");
- }
-
- // load collection
- try {
- coll = (Collection<? extends CollectionMember>)Gateway.getStorage().get(entityPath.getSysKey(), ClusterStorage.COLLECTION+"/"+collName, null);
- } catch (Exception e) {
- Logger.error(e);
- throw new InvalidDataException("Error loading collection "+collName, "");
- }
-
- // find member and assign entity
- boolean stored = false;
- for (Object name : coll.getMembers().list) {
- CollectionMember member = (CollectionMember)name;
- if (member.getID() == slotNo) {
- if (member.getEntityKey() > -1)
- throw new InvalidDataException("Member slot not empty", "");
- try {
- member.assignEntity(entityKey);
- } catch (MembershipException e) {
- throw new InvalidDataException("Entity "+entityKey+" does not fit in this slot", "");
- }
- stored = true;
- break;
- }
- }
- if (!stored) {
- throw new InvalidDataException("Member slot "+slotNo+" not found.", "");
- }
-
-
- try {
- Gateway.getStorage().put(entityPath.getSysKey(), coll, null);
- } catch (ClusterStorageException e) {
- Logger.error(e);
- throw new InvalidDataException("Error storing collection", "");
- }
- sendEventStoreOutcome(transitionID, requestData, agent);
-
- Logger.msg(1, "AssignItemToSlot::request() - DONE.");
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java b/source/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java
deleted file mode 100644
index 8c55f3a..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/**************************************************************************
- * CreateItemFromDescription
- *
- * $Workfile$
- * $Revision: 1.47 $
- * $Date: 2005/10/13 08:13:58 $
- *
- * Copyright (C) 2001 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-package com.c2kernel.lifecycle.instance.predefined;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import com.c2kernel.collection.Collection;
-import com.c2kernel.collection.CollectionDescription;
-import com.c2kernel.collection.CollectionMember;
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.common.ObjectAlreadyExistsException;
-import com.c2kernel.common.ObjectNotFoundException;
-import com.c2kernel.entity.CorbaServer;
-import com.c2kernel.entity.TraceableEntity;
-import com.c2kernel.lifecycle.CompositeActivityDef;
-import com.c2kernel.lifecycle.instance.stateMachine.Transitions;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.DomainPath;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.lookup.LDAPLookup;
-import com.c2kernel.persistency.ClusterStorage;
-import com.c2kernel.persistency.TransactionManager;
-import com.c2kernel.process.Gateway;
-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;
-
-/**************************************************************************
- *
- * @author $Author: abranson $ $Date: 2005/10/13 08:13:58 $
- * @version $Revision: 1.47 $
- **************************************************************************/
-public class CreateItemFromDescription extends PredefinedStep
-{
- public CreateItemFromDescription()
- {
- super();
- }
-
- //requestdata is xmlstring
- @Override
- public void request(AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException, InvalidTransitionException, InvalidDataException,ObjectAlreadyExistsException
- {
- String[] input = getDataList(requestData);
- String newName = input[0];
- String domPath = input[1];
- CompositeActivityDef wfDef;
- String wfDefName = null;
- if (input.length > 2) // override wf
- wfDefName = input[2];
-
- PropertyArrayList props = new PropertyArrayList();
- Logger.msg(1, "AddNewItem::request() - Starting.");
- TransactionManager storage = Gateway.getStorage();
- LDAPLookup lookup = Gateway.getLDAPLookup();
- EntityPath myPath = getItemEntityPath();
- checkAccessRights(agent);
-
- try {
- // check if the path is already taken
- DomainPath context = new DomainPath(new DomainPath(domPath), newName);
- Logger.debug(8,"context "+context.getSysKey()+" "+context.getPath()+" "+context.getString());
- if (context.getSysKey()!=-1)
- throw new ObjectAlreadyExistsException("The item name " +newName+ " exists already.");
-
- // get init objects
- String[] collNames = storage.getClusterContents(myPath.getSysKey(), ClusterStorage.COLLECTION);
- ArrayList<String> collections = new ArrayList<String>();
-
-
- // loop through collections to instantiate
- for (String collName : collNames) {
- Collection<? extends CollectionMember> thisCol = (Collection<? extends CollectionMember>)storage.get(myPath.getSysKey(), ClusterStorage.COLLECTION+"/"+collName, null);
- if (thisCol instanceof CollectionDescription) {
- CollectionDescription<? extends CollectionMember> thisDesc = (CollectionDescription<? extends CollectionMember>)thisCol;
- collections.add(CastorXMLUtility.marshall(thisDesc.newInstance()));
- }
- else if (thisCol.getName().equalsIgnoreCase("workflow") && wfDefName == null) {
- ArrayList<? extends CollectionMember> members = thisCol.getMembers().list;
- // get the first member from the wf collection
- CollectionMember wfMember = members.get(0);
- wfDefName = wfMember.resolveEntity().getName();
- }
- }
-
- // load workflow def
- if (wfDefName == null)
- throw new InvalidDataException("No workflow given or defined", "");
-
- try {
- wfDef = (CompositeActivityDef)LocalObjectLoader.getActDef(wfDefName, "last");
- } catch (ObjectNotFoundException ex) {
- throw new InvalidDataException("Workflow def '"+wfDefName+"' item not found", "");
- } catch (ClassCastException ex) {
- throw new InvalidDataException("Activity def '"+wfDefName+"' was not Composite", "");
- }
-
-
- // copy properties -- intend to create from propdesc
- PropertyDescriptionList pdList = PropertyUtility.getPropertyDescriptionOutcome(myPath.getSysKey());
- props = pdList.instanciate();
- // set Name prop or create if not present
- boolean foundName = false;
- for (Property prop : props.list) {
- if (prop.getName().equals("Name")) {
- foundName = true;
- prop.setValue(newName);
- }
- }
- if (!foundName) props.list.add(new Property("Name", newName));
- props.list.add( new Property("Creator", agent.getAgentName()));
-
- /* ITEM CREATION */
-
- // generate new entity key
- Logger.msg(6, "CreateItemFromDescription - Requesting new sysKey");
- EntityPath entityPath = lookup.getNextKeyManager().generateNextEntityKey();
-
- // resolve the item factory
- Logger.msg(6, "CreateItemFromDescription - Resolving item factory");
-
- // create the Item object
- Logger.msg(3, "CreateItemFromDescription - Creating Item");
- CorbaServer factory = Gateway.getCorbaServer();
- if (factory == null) throw new AccessRightsException("This process cannot create new Items", "");
- TraceableEntity newItem = (TraceableEntity)factory.createEntity(entityPath);
- Gateway.getLDAPLookup().add(entityPath);
-
-
- // initialise it with its properties and workflow
-
- Logger.msg(3, "CreateItemFromDescription - Initializing Item");
-
- newItem.initialise(
- agent.getSysKey(),
- CastorXMLUtility.marshall(props),
- CastorXMLUtility.marshall(wfDef.instantiate()));
-
- // add collections
- if (collections.size() > 0) {
- Logger.msg(6, "CreateItemFromDescription - Adding Collections");
- String[] colls = new String[1];
- for (Iterator<String> iter = collections.iterator(); iter.hasNext();) {
- colls[0] = iter.next();
- newItem.requestAction(agent.getSysKey(), "workflow/predefined/AddC2KObject", Transitions.COMPLETE, PredefinedStep.bundleData(colls));
- }
- }
-
- // add its domain path
- Logger.msg(3, "CreateItemFromDescription - Creating "+context);
- context.setEntity(entityPath);
- Gateway.getLDAPLookup().add(context);
- } catch (ObjectAlreadyExistsException e) {
- Logger.error(e);
- throw e;
- } catch (AccessRightsException e) {
- Logger.error(e);
- throw e;
- } catch (Exception e) {
- Logger.error(e);
- throw new InvalidDataException(e.getMessage(), "");
- }
-
- sendEventStoreOutcome(transitionID, requestData, agent);
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/Erase.java b/source/com/c2kernel/lifecycle/instance/predefined/Erase.java
deleted file mode 100644
index ffdb07c..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/Erase.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**************************************************************************
- * RemoveC2KObject
- *
- * $Workfile$
- * $Revision: 1.10 $
- * $Date: 2005/11/15 15:56:38 $
- *
- * Copyright (C) 2001 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-package com.c2kernel.lifecycle.instance.predefined;
-
-
-
-import java.util.Enumeration;
-
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.DomainPath;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.lookup.Path;
-import com.c2kernel.persistency.ClusterStorage;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.property.Property;
-import com.c2kernel.utils.Logger;
-
-
-/**************************************************************************
- *
- * @author $Author: abranson $ $Date: 2005/11/15 15:56:38 $
- * @version $Revision: 1.10 $
- **************************************************************************/
-public class Erase extends PredefinedStep
-{
- public Erase()
- {
- super();
- }
-
- //requestdata is xmlstring
- @Override
- public void request(AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException,
- InvalidTransitionException,
- InvalidDataException
- {
- Logger.msg(1, "Erase::request() - Starting.");
-
- checkAccessRights(agent);
- try
- {
- EntityPath entityPath = getItemEntityPath();
-
- // find entity name
- Property name = (Property)Gateway.getStorage().get(entityPath.getSysKey(), ClusterStorage.PROPERTY+"/Name", null);
-
- // get all domain paths
- Enumeration<Path> domPaths = Gateway.getLDAPLookup().search(new DomainPath(), name.getValue());
- while (domPaths.hasMoreElements()) {
- DomainPath path = (DomainPath)domPaths.nextElement();
- // delete them
- if (path.getSysKey() == entityPath.getSysKey())
- Gateway.getLDAPLookup().delete(path);
- }
-
- //clear out all storages
- Gateway.getStorage().removeCluster(entityPath.getSysKey(), "", null);
-
- //remove domain path
- Gateway.getLDAPLookup().delete(entityPath);
- }
- catch( Exception ex )
- {
-
- Logger.error(ex);
- throw new InvalidDataException(ex.toString(), "");
- }
-
- Logger.msg(1, "Erase::request() - DONE.");
- }
-
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/Import.java b/source/com/c2kernel/lifecycle/instance/predefined/Import.java
deleted file mode 100644
index 2f99937..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/Import.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/**************************************************************************
- * AddDomainPath
- *
- * Copyright (C) 2001 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-package com.c2kernel.lifecycle.instance.predefined;
-
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.utils.Logger;
-
-/**************************************************************************
- *
- * $Revision: 1.21 $
- * $Date: 2005/06/02 12:17:22 $
- *
- * Params: Schemaname_version:Viewpoint (optional), Outcome
- *
- * Copyright (C) 2003 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-public class Import extends PredefinedStep
-{
- public Import()
- {
- super();
- }
-
- //requestdata is xmlstring
- @Override
- public void request( AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException,
- InvalidTransitionException,
- InvalidDataException
- {
- Logger.msg(8,"Import::request()");
-
- Logger.msg(1,"Import::request() - Starting.");
-
- checkAccessRights(agent);
-
- String[] params = getDataList(requestData);
-
-
- int split1 = params[0].indexOf('_');
- int split2 = params[0].indexOf(':');
-
- String schemaName = params[0].substring(0, split1);
- String viewpoint = "last";
- int schemaVersion;
- if (split2 > -1) {
- schemaVersion = Integer.parseInt(params[0].substring(split1+1, split2));
- viewpoint = params[0].substring(split2+1);
- }
- else
- schemaVersion = Integer.parseInt(params[0].substring(split1+1));
-
- // set type & ver
- getProperties().put("SchemaType", schemaName);
- getProperties().put("SchemaVersion", String.valueOf(schemaVersion));
- getProperties().put("Viewpoint", viewpoint);
-
- requestData = params[1];
-
- sendEventStoreOutcome(transitionID, requestData, agent);
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/PredefinedStep.java b/source/com/c2kernel/lifecycle/instance/predefined/PredefinedStep.java
deleted file mode 100644
index 8aec993..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/PredefinedStep.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package com.c2kernel.lifecycle.instance.predefined;
-import java.io.StringReader;
-import java.io.StringWriter;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.apache.xml.serialize.Method;
-import org.apache.xml.serialize.OutputFormat;
-import org.apache.xml.serialize.XMLSerializer;
-import org.w3c.dom.CDATASection;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
-import org.xml.sax.InputSource;
-
-import com.c2kernel.lifecycle.instance.Activity;
-import com.c2kernel.utils.Logger;
-/***********************************************************************************************************************************************************************************************************************************************************************************************************
- * @author $Author: sgaspard $ $Date: 2004/09/21 10:32:17 $
- * @version $Revision: 1.14 $
- **********************************************************************************************************************************************************************************************************************************************************************************************************/
-public class PredefinedStep extends Activity
-{
- /*******************************************************************************************************************************************************************************************************************************************************************************************************
- * predefined Steps are always Active, and have only one transition subclasses could override this method (if necessary)
- ******************************************************************************************************************************************************************************************************************************************************************************************************/
- private boolean isPredefined = false;
- @Override
- public boolean getActive()
- {
- if (isPredefined)
- return true;
- else
- return super.getActive();
- }
- @Override
- public String getTransitions()
- {
- if (isPredefined)
- return "<PossibleTransitions>done</PossibleTransitions>";
- else
- return super.getTransitions();
- }
- @Override
- public String getErrors()
- {
- if (isPredefined)
- return getName();
- else
- return super.getErrors();
- }
- @Override
- public boolean verify()
- {
- if (isPredefined)
- return true;
- else
- return super.verify();
- }
- /**
- * Returns the isPredefined.
- *
- * @return boolean
- */
- public boolean getIsPredefined()
- {
- return isPredefined;
- }
- /**
- * Sets the isPredefined.
- *
- * @param isPredefined
- * The isPredefined to set
- */
- public void setIsPredefined(boolean isPredefined)
- {
- this.isPredefined = isPredefined;
- }
- @Override
- public String getType()
- {
- return getName();
- }
- // generic bundling of parameters
- static public String bundleData(String[] data)
- {
- try
- {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document dom = builder.newDocument();
- Element root = dom.createElement("PredefinedStepOutcome");
- dom.appendChild(root);
- for (String element : data) {
- Element param = dom.createElement("param");
- Text t = dom.createTextNode(element);
- param.appendChild(t);
- root.appendChild(param);
- }
- // xalan method - use internal xerces one instead
-// TransformerFactory transFactory = TransformerFactory.newInstance();
-// Transformer transformer = transFactory.newTransformer();
-// StringWriter stringOut = new StringWriter();
-// transformer.transform(new DOMSource(dom), new StreamResult(stringOut));
-// return stringOut.toString();
-
- OutputFormat format = new OutputFormat(Method.XML, null, false);
- StringWriter stringOut = new StringWriter();
- XMLSerializer serial = new XMLSerializer(stringOut, format);
- serial.asDOMSerializer();
- serial.serialize(dom);
- return stringOut.toString();
- }
- catch (Exception e)
- {
- Logger.error(e);
- StringBuffer xmlData = new StringBuffer().append("<PredefinedStepOutcome>");
- for (String element : data)
- xmlData.append("<param><![CDATA[").append(element).append("]]></param>");
- xmlData.append("</PredefinedStepOutcome>");
- return xmlData.toString();
- }
- }
- // generic bundling of single parameter
- static public String bundleData(String data)
- {
- return "<PredefinedStepOutcome><param><![CDATA[" + data + "]]></param></PredefinedStepOutcome>";
- }
- static public String[] getDataList(String xmlData)
- {
- try
- {
- Document scriptDoc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(xmlData)));
- NodeList nodeList = scriptDoc.getElementsByTagName("param");
- String[] result = new String[nodeList.getLength()];
- for (int i = 0; i < nodeList.getLength(); i++)
- {
- Node n = nodeList.item(i).getFirstChild();
- if (n instanceof CDATASection)
- result[i] = ((CDATASection) n).getData();
- else if (n instanceof Text)
- result[i] = ((Text) n).getData();
- }
- return result;
- }
- catch (Exception ex)
- {
- Logger.error("Exception::PredefinedStep::getDataList()");
- Logger.error(ex);
- }
- return null;
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/PredefinedStepContainer.java b/source/com/c2kernel/lifecycle/instance/predefined/PredefinedStepContainer.java
deleted file mode 100644
index d065afb..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/PredefinedStepContainer.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.c2kernel.lifecycle.instance.predefined;
-import com.c2kernel.graph.model.GraphPoint;
-import com.c2kernel.lifecycle.instance.CompositeActivity;
-public class PredefinedStepContainer extends CompositeActivity
-{
- protected int num = 0;
-
- public PredefinedStepContainer()
- {
- super();
- setName("predefined");
- getProperties().put("Description", "Contains all predefined Steps");
- createChildren();
- }
- public void createChildren()
- {
- predInit("CreateItemFromDescription", "Create a new item using this item as its description", new CreateItemFromDescription());
- predInit("AddDomainPath", "Adds a new path to this entity in the LDAP domain tree", new AddDomainPath());
- predInit("RemoveDomainPath", "Removes an existing path to this Entity from the LDAP domain tree", new RemoveDomainPath());
- predInit("AddStepsFromDescription", "Creates the domain-specific LifeCycle from a description", new AddStepsFromDescription());
- predInit("ReplaceDomainWorkflow", "Replaces the domain CA with the supplied one. Used by the GUI to save new Wf layout", new ReplaceDomainWorkflow());
- predInit("AddC2KObject", "Adds a new named C2Kernel object to this Item", new AddC2KObject());
- predInit("WriteProperty", "Writes a property to the Item", new WriteProperty());
- predInit("RemoveC2KObject", "Removes the named C2Kernel object from this Item.", new RemoveC2KObject());
- predInit("AssignItemToSlot", "Assigns the referenced entity to a pre-existing slot in a collection of this one", new AssignItemToSlot());
- predInit("Erase", "Deletes all objects and domain paths for this item.", new Erase());
- predInit("Import", "Imports an outcome into the Item, with a given schema and viewpoint", new Import());
- }
-
- public void predInit(String alias, String Description, PredefinedStep act)
- {
- act.setName(alias);
- act.setType(alias);
- act.getProperties().put("Description", Description);
- act.getProperties().put("SchemaType", "PredefinedStepOutcome");
- act.getProperties().put("SchemaVersion", "0");
- act.setCentrePoint(new GraphPoint());
- act.setIsPredefined(true);
- addChild(act, new GraphPoint(100, 75 * ++num));
- }
- @Override
- public boolean verify()
- {
- return true;
- }
- @Override
- public String getErrors()
- {
- return "predefined";
- }
- @Override
- public boolean getActive()
- {
- return true;
- }
- @Override
- public String getTransitions()
- {
- return "<PossibleTransitions></PossibleTransitions>";
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/RemoveC2KObject.java b/source/com/c2kernel/lifecycle/instance/predefined/RemoveC2KObject.java
deleted file mode 100644
index c9513a8..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/RemoveC2KObject.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/**************************************************************************
- * RemoveC2KObject
- *
- * $Workfile$
- * $Revision: 1.28 $
- * $Date: 2005/11/15 15:56:38 $
- *
- * Copyright (C) 2001 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-package com.c2kernel.lifecycle.instance.predefined;
-
-
-
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.utils.Logger;
-
-
-/**************************************************************************
- *
- * @author $Author: abranson $ $Date: 2005/11/15 15:56:38 $
- * @version $Revision: 1.28 $
- **************************************************************************/
-public class RemoveC2KObject extends PredefinedStep
-{
- public RemoveC2KObject()
- {
- super();
- }
-
- //requestdata is xmlstring
- @Override
- public void request(AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException,
- InvalidTransitionException,
- InvalidDataException
- {
- Logger.msg(1, "RemoveC2KObject::request() - Starting.");
-
- checkAccessRights(agent);
- String path = null;
- try
- {
- path = getDataList(requestData)[0];
- EntityPath entityPath = getItemEntityPath();
-
- Logger.msg(5, "RemoveC2KObject::request() - path:"+path);
-
- Gateway.getStorage().remove( entityPath.getSysKey(), path, null );
- sendEventStoreOutcome(transitionID, requestData, agent);
- }
- catch( Exception ex )
- {
- Logger.error("RemoveC2KObject::request() - invalid data - path:"+path);
- Logger.error(ex);
- throw new InvalidDataException(ex.toString(), "");
- }
-
- Logger.msg(1, "RemoveC2KObject::request() - DONE.");
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java b/source/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java
deleted file mode 100644
index 19ff7c6..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**************************************************************************
- * AddDomainPath
- *
- * Copyright (C) 2001 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-package com.c2kernel.lifecycle.instance.predefined;
-
-
-
-
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.DomainPath;
-import com.c2kernel.lookup.LDAPLookup;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.utils.Logger;
-
-public class RemoveDomainPath extends PredefinedStep
-{
- public RemoveDomainPath()
- {
- super();
- }
-
- //requestdata is xmlstring
- @Override
- public void request( AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException,
- InvalidTransitionException,
- InvalidDataException
- {
- Logger.msg(8,"RemoveDomainPath::request()");
- LDAPLookup lookupManager = Gateway.getLDAPLookup();
-
- Logger.msg(1,"RemoveDomainPath::request() - Starting.");
-
- checkAccessRights(agent);
-
- try
- {
- DomainPath domainPath = new DomainPath(getDataList(requestData)[0]);
- lookupManager.delete(domainPath);
- Logger.msg(8,"AddAlias::request() - context:" + domainPath.toString() + " DONE.");
-
- }
- catch( Exception ex )
- {
- Logger.error("AddAlias::request() - during anyHelper.extract.");
- Logger.error(ex);
- throw new InvalidDataException(ex.toString(), "");
- }
-
- sendEventStoreOutcome(transitionID, requestData, agent);
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/ReplaceDomainWorkflow.java b/source/com/c2kernel/lifecycle/instance/predefined/ReplaceDomainWorkflow.java
deleted file mode 100644
index ba3e6c6..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/ReplaceDomainWorkflow.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.c2kernel.lifecycle.instance.predefined;
-
-//Java
-import java.awt.Point;
-
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.lifecycle.instance.CompositeActivity;
-import com.c2kernel.lifecycle.instance.Workflow;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.utils.CastorXMLUtility;
-import com.c2kernel.utils.Logger;
-
-public class ReplaceDomainWorkflow extends PredefinedStep
-{
- public ReplaceDomainWorkflow()
- {
- super();
- }
-
- @Override
- public void request( AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException, InvalidTransitionException, InvalidDataException
- {
- Workflow lifeCycle = getWf();
-
- Logger.msg(1, "ReplaceDomainWorkflow::request() - Starting ");
-
- checkAccessRights(agent);
-
- try
- {
-
- Logger.msg(8, "ReplaceDomainWorkflow::request() - data:" + getDataList(requestData)[0]);
- lifeCycle.getChildGraphModel().removeVertex(lifeCycle.search("workflow/domain"));
- CompositeActivity domain = (CompositeActivity) CastorXMLUtility.unmarshall(getDataList(requestData)[0]);
- lifeCycle.initChild(domain, true, new Point(150, 100));
- Gateway.getStorage().put(getItemEntityPath().getSysKey(), lifeCycle, null);
- Logger.msg(1, "ReplaceDomainWorkflow::request() - DONE.");
- sendEventStoreOutcome(transitionID, requestData, agent);
- // refresh jobs
- lifeCycle.refreshJobs();
- }
- catch (Exception ex)
- {
- Logger.error("ReplaceDomainWorkflow::request() - during unmarshall.");
- Logger.error(ex);
- throw new InvalidDataException("ReplaceDomainWorkflow::request() - during unmarshall.", null);
- }
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/ServerPredefinedStepContainer.java b/source/com/c2kernel/lifecycle/instance/predefined/ServerPredefinedStepContainer.java
deleted file mode 100644
index 21eacda..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/ServerPredefinedStepContainer.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.c2kernel.lifecycle.instance.predefined;
-
-import com.c2kernel.graph.model.GraphPoint;
-import com.c2kernel.lifecycle.instance.predefined.entitycreation.CreateNewAgent;
-import com.c2kernel.lifecycle.instance.predefined.entitycreation.CreateNewItem;
-
-/**************************************************************************
- *
- * $Revision: 1.2 $
- * $Date: 2005/06/02 10:19:33 $
- *
- * Copyright (C) 2003 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-// public static final String codeRevision = "$Revision: 1.2 $ $Date: 2005/06/02 10:19:33 $ $Author: abranson $";
-public class ServerPredefinedStepContainer extends PredefinedStepContainer {
-
-
- @Override
- public void createChildren()
- {
- super.createChildren();
- serverPredInit("CreateNewItem", "Creates a new Item in this Server without description.", new CreateNewItem(), "NewItem");
- serverPredInit("CreateNewAgent", "Creates a new Item in this Server without description.", new CreateNewAgent(), "NewAgent");
- }
-
- public void serverPredInit(String alias, String Description, PredefinedStep act, String schema)
- {
- act.setName(alias);
- act.setType(alias);
- act.getProperties().put("Description", Description);
- act.getProperties().put("SchemaType", schema);
- act.getProperties().put("SchemaVersion", "0");
- act.getProperties().put("AgentRole", "Admin");
- act.setCentrePoint(new GraphPoint());
- act.setIsPredefined(true);
- addChild(act, new GraphPoint(100, 75 * ++num));
- }
-
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/WriteProperty.java b/source/com/c2kernel/lifecycle/instance/predefined/WriteProperty.java
deleted file mode 100644
index 77a0b43..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/WriteProperty.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**************************************************************************
- * WriteProperty
- *
- * $Workfile$
- * $Revision: 1.3 $
- * $Date: 2004/10/21 08:02:19 $
- *
- * Copyright (C) 2001 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-package com.c2kernel.lifecycle.instance.predefined;
-
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.property.Property;
-import com.c2kernel.utils.Logger;
-
-/**************************************************************************
- *
- * @author $Author: abranson $ $Date: 2004/10/21 08:02:19 $
- * @version $Revision: 1.3 $
- **************************************************************************/
-public class WriteProperty extends PredefinedStep
-{
- /**************************************************************************
- * Constructor for Castror
- **************************************************************************/
- public WriteProperty()
- {
- super();
- }
-
- //requestdata is xmlstring
- @Override
- public void request( AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException,
- InvalidTransitionException,
- InvalidDataException
- {
-
- Logger.msg(1, "WriteProperty::request() - Starting.");
-
- checkAccessRights(agent);
- EntityPath entityPath = getItemEntityPath();
-
- if (entityPath!=null)
- {
- String[] params = getDataList(requestData);
- if (params.length != 2)
- throw new InvalidDataException("WriteProperty::request() - need 2 params - name and value", "");
- try
- {
-
- Logger.msg(5, "WriteProperty::request() - name:" + params[0] +" val:"+params[1]);
-
- Property newProp = new Property(params[0], params[1]);
- Gateway.getStorage().put(entityPath.getSysKey(), newProp, null );
- sendEventStoreOutcome(transitionID, requestData, agent);
- }
- catch( Exception ex )
- {
- Logger.error("WriteProperty::request() - during unmarshall.");
- Logger.error(ex);
- throw new InvalidDataException(ex.toString(), "");
- }
-
- Logger.msg(1, "WriteProperty::request() - DONE.");
- }
- else
- throw new InvalidDataException("EntityPath is null.", "");
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Aggregation.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Aggregation.java
deleted file mode 100644
index 2de12e0..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Aggregation.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.c2kernel.lifecycle.instance.predefined.entitycreation;
-
-import java.util.ArrayList;
-
-public class Aggregation implements java.io.Serializable {
-
- public boolean isDescription;
- public ArrayList<AggregationMember> aggregationMemberList;
- public String name;
-
- public Aggregation() {
- super();
- aggregationMemberList = new ArrayList<AggregationMember>();
- }
-
- public Aggregation(String name, boolean isDescription) {
- this();
- this.name = name;
- this.isDescription = isDescription;
- }
-
- public com.c2kernel.collection.Aggregation create() {
- return new com.c2kernel.collection.AggregationInstance();
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/AggregationMember.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/AggregationMember.java
deleted file mode 100644
index 29d3cf9..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/AggregationMember.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.c2kernel.lifecycle.instance.predefined.entitycreation;
-
-public class AggregationMember implements java.io.Serializable {
-
- public int slotNo;
- public String itemDescriptionPath;
- public String itemPath;
- public Geometry geometry;
-
-
- public AggregationMember() {
- super();
- }
-
- public AggregationMember(int slotNo, String itemDescPath, String itemPath, Geometry geometry) {
- this.slotNo = slotNo;
- this.itemDescriptionPath = itemDescPath;
- this.itemPath = itemPath;
- this.geometry = geometry;
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/CreateNewAgent.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/CreateNewAgent.java
deleted file mode 100644
index aa30677..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/CreateNewAgent.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**************************************************************************
- * AddDomainPath
- *
- * Copyright (C) 2001 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-package com.c2kernel.lifecycle.instance.predefined.entitycreation;
-
-
-
-
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.lifecycle.instance.predefined.PredefinedStep;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.utils.CastorXMLUtility;
-import com.c2kernel.utils.Logger;
-
-public class CreateNewAgent extends PredefinedStep
-{
- public CreateNewAgent()
- {
- super();
- }
-
- //requestdata is xmlstring
- @Override
- public void request( AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException,
- InvalidTransitionException,
- InvalidDataException
- {
- checkAccessRights(agent);
- String redactedRequestData;
- try {
- NewAgent newAgent = (NewAgent)CastorXMLUtility.unmarshall(requestData);
- newAgent.create(agent.getSysKey());
- newAgent.password = "REDACTED";
- redactedRequestData = CastorXMLUtility.marshall(newAgent);
- } catch (Exception ex) {
- Logger.error(ex);
- throw new InvalidDataException("Error creating agent", "");
- }
-
- sendEventStoreOutcome(transitionID, redactedRequestData, agent);
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/CreateNewItem.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/CreateNewItem.java
deleted file mode 100644
index a66b062..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/CreateNewItem.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**************************************************************************
- * CreateNewItem
- *
- * Copyright (C) 2005 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-package com.c2kernel.lifecycle.instance.predefined.entitycreation;
-
-
-
-
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.lifecycle.instance.predefined.PredefinedStep;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.utils.CastorXMLUtility;
-import com.c2kernel.utils.Logger;
-
-public class CreateNewItem extends PredefinedStep
-{
- public CreateNewItem()
- {
- super();
- }
-
- //requestdata is xmlstring
- @Override
- public void request( AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException,
- InvalidTransitionException,
- InvalidDataException
- {
- checkAccessRights(agent);
-
- try {
- NewItem item = (NewItem)CastorXMLUtility.unmarshall(requestData);
- item.create(agent.getSysKey());
- } catch (Exception ex) {
- Logger.error(ex);
- throw new InvalidDataException("Error creating item", "");
- }
- sendEventStoreOutcome(transitionID, requestData, agent);
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Dependency.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Dependency.java
deleted file mode 100644
index 1124ede..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Dependency.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.c2kernel.lifecycle.instance.predefined.entitycreation;
-
-import java.util.ArrayList;
-
-import com.c2kernel.collection.MembershipException;
-import com.c2kernel.lookup.DomainPath;
-import com.c2kernel.property.PropertyUtility;
-
-public class Dependency implements java.io.Serializable {
-
- public String name;
- public boolean isDescription;
- public String itemDescriptionPath;
- public ArrayList<DependencyMember> dependencyMemberList;
-
- public Dependency() {
- super();
- dependencyMemberList = new ArrayList<DependencyMember>();
- }
-
- public Dependency(String itemDesc) {
- this();
- this.itemDescriptionPath = itemDesc;
- }
-
- /**
- * @return
- */
- public com.c2kernel.collection.Dependency create() throws MembershipException{
- com.c2kernel.collection.Dependency newDep = isDescription?new com.c2kernel.collection.DependencyDescription(name):new com.c2kernel.collection.Dependency(name);
- if (itemDescriptionPath != null && itemDescriptionPath.length()>0) {
- PropertyUtility.getPropertyDescriptionOutcome(new DomainPath(itemDescriptionPath).getSysKey());
- //TODO: set props and class identifiers
- }
- for (DependencyMember thisMem : dependencyMemberList) {
- int syskey = new DomainPath(thisMem.itemPath).getSysKey();
- if (syskey == -1)
- throw new MembershipException("Cannot find "+thisMem.itemPath+" specified for collection.");
- newDep.addMember(syskey);
- }
- return newDep;
- }
-
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/DependencyMember.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/DependencyMember.java
deleted file mode 100644
index b70619f..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/DependencyMember.java
+++ /dev/null
@@ -1,18 +0,0 @@
-
-package com.c2kernel.lifecycle.instance.predefined.entitycreation;
-
-public class DependencyMember implements java.io.Serializable {
-
-
- public String itemPath;
-
- public DependencyMember() {
- super();
- }
-
- public DependencyMember(String itemPath) {
- this.itemPath = itemPath;
-
- }
-
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Geometry.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Geometry.java
deleted file mode 100644
index f18b6d4..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Geometry.java
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-package com.c2kernel.lifecycle.instance.predefined.entitycreation;
-
-
-
-public class Geometry implements java.io.Serializable {
-
-
- public int x;
-
- public int y;
-
- public int width;
-
- public int height;
-
- public Geometry() {
- super();
- }
-
- public Geometry(int x, int y, int width, int height) {
- this.x = x;
- this.y = y;
- this.width = width;
- this.height = height;
- }
-
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java
deleted file mode 100644
index 540a6fc..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.c2kernel.lifecycle.instance.predefined.entitycreation;
-
-import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
-
-import com.c2kernel.common.CannotManageException;
-import com.c2kernel.common.ObjectAlreadyExistsException;
-import com.c2kernel.common.ObjectCannotBeUpdated;
-import com.c2kernel.common.ObjectNotFoundException;
-import com.c2kernel.entity.agent.ActiveEntity;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.RolePath;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.property.PropertyArrayList;
-import com.c2kernel.utils.CastorXMLUtility;
-import com.c2kernel.utils.Logger;
-
-public class NewAgent implements java.io.Serializable {
-
- public String name;
-
- public String password;
-
- public ArrayList<String> roles;
-
- public NewAgent() {
- super();
- roles = new ArrayList<String>();
- }
-
- public NewAgent(String name, String password) {
- this.name = name;
- this.password = password;
- }
-
- protected void create(int agentId) throws ObjectNotFoundException, ObjectCannotBeUpdated, NoSuchAlgorithmException, CannotManageException, ObjectAlreadyExistsException {
- AgentPath newAgent = Gateway.getLDAPLookup().getNextKeyManager().generateNextAgentKey();
- newAgent.setAgentName(name);
- newAgent.setPassword(password);
- ActiveEntity newAgentEnt = (ActiveEntity)Gateway.getCorbaServer().createEntity(newAgent);
- Gateway.getLDAPLookup().add(newAgent);
- // assemble properties
- PropertyArrayList propList = new PropertyArrayList();
- propList.list.add(new com.c2kernel.property.Property("Name", name));
- propList.list.add(new com.c2kernel.property.Property("Type", "Agent"));
- try {
- newAgentEnt.initialise(CastorXMLUtility.marshall(propList));
- } catch (Exception ex) {
- Logger.error(ex);
- throw new CannotManageException("Error initialising new agent");
- }
- for (String role : roles) {
- RolePath thisRole;
- try {
- thisRole = Gateway.getLDAPLookup().getRoleManager().getRolePath(role);
- } catch (ObjectNotFoundException ex) {
- thisRole = Gateway.getLDAPLookup().getRoleManager().createRole(role, false);
- }
- thisRole.addAgent(newAgent);
- }
-
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewItem.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewItem.java
deleted file mode 100644
index f155ced..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewItem.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package com.c2kernel.lifecycle.instance.predefined.entitycreation;
-
-
-import java.util.ArrayList;
-
-import com.c2kernel.collection.MembershipException;
-import com.c2kernel.common.CannotManageException;
-import com.c2kernel.common.ObjectAlreadyExistsException;
-import com.c2kernel.common.ObjectCannotBeUpdated;
-import com.c2kernel.common.ObjectNotFoundException;
-import com.c2kernel.entity.TraceableEntity;
-import com.c2kernel.lifecycle.CompositeActivityDef;
-import com.c2kernel.lookup.DomainPath;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.persistency.ClusterStorageException;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.property.PropertyArrayList;
-import com.c2kernel.utils.CastorXMLUtility;
-import com.c2kernel.utils.LocalObjectLoader;
-import com.c2kernel.utils.Logger;
-
-/**
- * Complete Structure for new item
- *
- * @version $Revision: 1.8 $ $Date: 2006/03/03 13:52:21 $
- */
-
-public class NewItem {
-
- public String name;
-
- /**
- * The initial Domain Path to be created for this Item.
- */
- public String initialPath;
-
- /**
- * The name of the Composite Activity Definition to be
- * instantiated for the workflow of this Item
- */
- public String workflow;
-
- /**
- * New Properties for the item
- */
- public ArrayList<Property> propertyList;
-
- /**
- * Field _aggregationList
- */
- public ArrayList<Aggregation> aggregationList;
-
- /**
- * Field _dependencyList
- */
- public ArrayList<Dependency> dependencyList;
-
-
- public NewItem() {
- super();
- propertyList = new ArrayList<Property>();
- aggregationList = new ArrayList<Aggregation>();
- dependencyList = new ArrayList<Dependency>();
- }
-
- public NewItem(String name, String initialPath, String wf) {
- this();
- this.name = name;
- this.initialPath = initialPath;
- this.workflow = wf;
- }
-
- public void setProperty(String name, String value) {
- for (Property prop : propertyList) {
- if (prop.name.equals(name)) {
- prop.value = value;
- return;
- }
- }
- propertyList.add(new Property(name, value));
- }
-
- protected void create(int agentId) throws ObjectCannotBeUpdated, ObjectNotFoundException, CannotManageException, ObjectAlreadyExistsException {
- DomainPath domPath = new DomainPath(new DomainPath(initialPath), name);
- if (domPath.exists())
- throw new ObjectAlreadyExistsException(domPath+" already exists!", "");
-
- // create item
- EntityPath entPath = Gateway.getLDAPLookup().getNextKeyManager().generateNextEntityKey();
- TraceableEntity newItem = (TraceableEntity)Gateway.getCorbaServer().createEntity(entPath);
- Gateway.getLDAPLookup().add(entPath);
-
- // assemble properties
- PropertyArrayList propList = new PropertyArrayList();
- propList.list.add(new com.c2kernel.property.Property("Name", name));
- for (Property element : propertyList) {
- propList.list.add(new com.c2kernel.property.Property(element.name, element.value));
- }
- // init the new item
- try {
-
- // find workflow def
- CompositeActivityDef compact = (CompositeActivityDef)LocalObjectLoader.getActDef(workflow, "last");
-
- newItem.initialise(
- agentId,
- CastorXMLUtility.marshall(propList),
- CastorXMLUtility.marshall(compact.instantiate()));
- } catch (Exception ex) {
- Logger.error("Error initialising new item");
- Logger.error(ex);
- throw new CannotManageException("Problem initialising new item. See server log.", "");
- }
-
- // create collections
-
- for (Dependency element: dependencyList) {
- try {
- Gateway.getStorage().put(entPath.getSysKey(), element.create(), null);
- } catch (ClusterStorageException ex) {
- Logger.error(ex);
- throw new CannotManageException("Could not create Dependency "+element.name, "");
- } catch (MembershipException ex) {
- Logger.error(ex);
- throw new CannotManageException("A specified member is not of the correct type in "+element.name, "");
- }
- }
-
- for (Aggregation element : aggregationList) {
- try {
- Gateway.getStorage().put(entPath.getSysKey(), element.create(), null);
- } catch (ClusterStorageException ex) {
- Logger.error(ex);
- throw new CannotManageException("Could not create Aggregation "+element.name, "");
- }
- }
- // register domain path
- domPath.setEntity(entPath);
- Gateway.getLDAPLookup().add(domPath);
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Property.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Property.java
deleted file mode 100644
index e2d214c..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Property.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.c2kernel.lifecycle.instance.predefined.entitycreation;
-/**
- * New Properties for the item
- *
- * @version $Revision: 1.1 $ $Date: 2005/04/28 13:48:26 $
- */
-public class Property implements java.io.Serializable {
-
- public String name;
- public String value;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Property() {
- super();
- }
-
- public Property(String name, String value) {
- super();
- this.name = name;
- this.value = value;
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/stateMachine/StateMachine.java b/source/com/c2kernel/lifecycle/instance/stateMachine/StateMachine.java
deleted file mode 100644
index 8159106..0000000
--- a/source/com/c2kernel/lifecycle/instance/stateMachine/StateMachine.java
+++ /dev/null
@@ -1,142 +0,0 @@
-
-package com.c2kernel.lifecycle.instance.stateMachine;
-
-import java.io.Serializable;
-
-import com.c2kernel.lifecycle.instance.Activity;
-import com.c2kernel.utils.Logger;
-
-/**
- * @version $Revision: 1.30 $ $Date: 2004/06/04 09:39:19 $
- * @author $Author: sgaspard $
- */
-/** this class represents the link between 2 successive activities */
-public class StateMachine implements Serializable
-{
- public int state = 0;
- private Activity activity;
-
- public static final String SKIPPABLE = "Skippable";
- public static final String REPEATABLE = "Repeatable";
- public static final String IGNORABLE = "Ignorable";
- public static final String AUTOSTART = "Autostart";
-
-
- /**
- * Method StateMachine.
- * @param act
- */
- public StateMachine(Activity act)
- {
- activity = act;
- }
-
- /** row : States from (WAITING,RESERVED,STARTED,SUSPENDED,FINISHED,RWAITING,RRESERVED,RSTARTED,RSUSPENDED)
- * collumn : transition (RESERVE,START,SKIP,DONE,COMPLETE,SUSPEND,REASIGN,RESUME,REPEAT,IGNORE,PROCEED)
- * cell : State that is reached (-1 if transition not allowed)
- */
- private int[][] getCurrentMachine()
- {
- int [][] returnArray =
- { /*RESERVE, START, SKIP, DONE,COMPLETE,SUSPEND,REASIGN,RESUME, REPEAT, IGNORE, PROCEED*/
- /*0 WAITING*/ { 1,getActive()?2:-1,getSkippable()?4:-1,getActive()?4:-1, -1, -1, -1, -1, -1, -1, -1},/*0 WAITING*/
- /*1 RESERVED*/ { -1,getActive()?2:-1,getSkippable()?4:-1,getActive()?4:-1, -1, -1, -1, -1, -1, 0, -1},/*1 RESERVED*/
- /*2 STARTED*/ { -1, -1, -1, -1, 4, 3, -1, -1, -1,getIgnorable()?0:-1, -1},/*2 STARTED*/
- /*3 SUSPENDED*/ { -1, -1, -1, -1, -1, -1, 2, 2, -1,getIgnorable()?0:-1, -1},/*3 SUSPENDED*/
- /*4 FINISHED*/ { -1, -1, -1, -1, -1, -1, -1, -1,getRepeatable()?!getAutoStart()?5:7:-1, -1,getActive()?4:-1},/*4 FINISHED*/
- /*5 RWAITING*/ { 6,getActive()?7:-1,getSkippable()?4:-1,getActive()?4:-1, -1, -1, -1, -1, -1, -1, -1},/*5 RWAITING*/
- /*6 RRESERVED*/ { -1,getActive()?7:-1,getSkippable()?4:-1,getActive()?4:-1, -1, -1, -1, -1, -1, -1, -1},/*6 RRESERVED*/
- /*7 RSTARTED*/ { -1, -1, -1, -1, 4, 8, -1, -1, -1,getIgnorable()?5:-1, -1},/*7 RSTARTED*/
- /*8 RSUSPENDED*/ { -1, -1, -1, -1, -1, -1, 8, 7, -1, -1, -1} /*8 RSUSPENDED*/
- };
- return returnArray;
- }
-
- /**
- * @see java.lang.Object#Object()
- */
- public StateMachine()
- {
- }
-
- /**
- * Method getCurrentState.
- * @return String
- */
- public int getCurrentState()
- {
- return state;
- }
-
- /**
- * Method possibleTransition.
- * @return String[]
- */
- public int[] possibleTransition()
- {
- int[] trans = new int[9];
- int cmpt = 0;
- for (int i=0; i< getCurrentMachine()[state].length;i++)
- if (getCurrentMachine()[state][i]!=-1) trans[cmpt++]=i;
-
- int [] result = new int[cmpt];
- for (int i=0;i<cmpt;i++) result[i] = trans[i];
- return result;
- }
-
- /**
- * Method traverse.
- * @param transition
- * @return boolean
- */
- public boolean traverse(int transition)
- {
- int newState = getCurrentMachine()[state][transition];
- if (newState > -1) {
- state=newState;
- return true;
- }
- Logger.msg("StateMachine.traverse() - Illegal transition "+Transitions.getTransitionName(transition)+" from "+States.getStateName(state));
- return false;
- }
- public int simulate(int transition)
- {
- return getCurrentMachine()[state][transition];
- }
- /**
- * Returns the ignorable.
- * @return boolean
- */
- public boolean getIgnorable()
- {
- return ((Boolean)activity.getProperties().get(IGNORABLE)).booleanValue();
- }
-
- /**
- * Returns the repeatable.
- * @return boolean
- */
- public boolean getRepeatable()
- {
- return ((Boolean)activity.getProperties().get(REPEATABLE)).booleanValue();
- }
-
- /**
- * Returns the skippable.
- * @return boolean
- */
- public boolean getSkippable()
- {
- return ((Boolean)activity.getProperties().get(SKIPPABLE)).booleanValue();
- }
-
- public boolean getAutoStart()
- {
- return ((Boolean)activity.getProperties().get(AUTOSTART)).booleanValue();
- }
- public boolean getActive()
- {
- return activity.getActive();
- }
-
-}
diff --git a/source/com/c2kernel/lifecycle/instance/stateMachine/States.java b/source/com/c2kernel/lifecycle/instance/stateMachine/States.java
deleted file mode 100644
index b142e35..0000000
--- a/source/com/c2kernel/lifecycle/instance/stateMachine/States.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.c2kernel.lifecycle.instance.stateMachine;
-
-
-/**
- * @author XSeb74
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-public class States
-{
- public final static int WAITING = 0;
- public final static int RESERVED = 1;
- public final static int STARTED = 2;
- public final static int SUSPENDED = 3;
- public final static int FINISHED = 4;
- public final static int RWAITING = 5;
- public final static int RRESERVED = 6;
- public final static int RSTARTED = 7;
- public final static int RSUSPENDED = 8;
-
- //everything less that this constant is NOT a repeating state
- public final static int REPEATSTATESTART = 5;
-
- public static final String[] states = { "Waiting", "Reserved", "Started", "Suspended", "Finished", "Waiting(R)", "Reserved(R)", "Started(R)", "Suspended(R)" };
-
- public static String getStateName(int state)
- {
- try
- {
- return states[state];
- }
- catch (ArrayIndexOutOfBoundsException ex)
- {
- return "Invalid State: " + state;
- }
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/stateMachine/Transitions.java b/source/com/c2kernel/lifecycle/instance/stateMachine/Transitions.java
deleted file mode 100644
index 4239baa..0000000
--- a/source/com/c2kernel/lifecycle/instance/stateMachine/Transitions.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.c2kernel.lifecycle.instance.stateMachine;
-
-import com.c2kernel.utils.Language;
-
-/**
- * @author XSeb74
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-public class Transitions
-{
- public final static int RESERVE = 0;
- public final static int START = 1;
- public final static int SKIP = 2;
- public final static int DONE = 3;
- public final static int COMPLETE = 4;
- public final static int SUSPEND = 5;
- public final static int REASSIGN = 6;
- public final static int RESUME = 7;
- public final static int REPEAT = 8;
- public final static int IGNORE = 9;
- public final static int PROCEED = 10;
- public final static int ACTIVATION = 11;
-
- private static String[] transitions = { "reserve", "start", "skip", "done", "complete", "suspend", "reassign", "resume", "repeat","ignore","proceed","activation" };
-
- public static String getTransitionName(int trans)
- {
- try
- {
- return Language.translate(transitions[trans]);
- }
- catch (ArrayIndexOutOfBoundsException ex)
- {
- return "Invalid Transition: " + trans;
- }
- }
-}
diff --git a/source/com/c2kernel/lifecycle/routingHelpers/ViewpointDataHelper.java b/source/com/c2kernel/lifecycle/routingHelpers/ViewpointDataHelper.java
deleted file mode 100644
index 0258347..0000000
--- a/source/com/c2kernel/lifecycle/routingHelpers/ViewpointDataHelper.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package com.c2kernel.lifecycle.routingHelpers;
-
-import com.c2kernel.common.ObjectNotFoundException;
-import com.c2kernel.entity.proxy.ItemProxy;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.persistency.ClusterStorage;
-import com.c2kernel.persistency.outcome.Outcome;
-import com.c2kernel.persistency.outcome.Viewpoint;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.utils.XmlElementParser;
-
-/**
- * @author XSeb74
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-public class ViewpointDataHelper
-{
- static Object[] errArr = { "" };
- /**
- * Method get.
- * @param value
- * @return String[]
- * @throws Exception
- */
- /**@param value : EntityPath:ActivityPath:XPathInOutcome*/
- public static Object [] get(String value) throws Exception
- {
- //Syntax of search : <EntityPath>/<ViewpointPath>:<XPathinOutcome>
- String entityPath;
- String viewpoint;
- String xpath;
- Object[] retArr;
-
- // find syskey, viewname, xpath
- int firstSlash = value.indexOf("/");
- if (firstSlash > 0) {
- entityPath = value.substring(0, firstSlash);
- int startXPath = value.indexOf(":");
- if (startXPath==-1) {
- viewpoint = value.substring(firstSlash + 1);
- xpath = null;
- } else {
- viewpoint = value.substring(firstSlash + 1, startXPath);
- xpath = value.substring(startXPath+1);
- }
- }
- else return errArr;
-
- // find entity
- EntityPath sourcePath;
- try
- {
- sourcePath = new EntityPath(Integer.parseInt(entityPath));
- } catch (Exception e) {
- sourcePath = new EntityPath(entityPath);
- }
-
- try {
- // load viewpoint
- ItemProxy dataSource = (ItemProxy)Gateway.getProxyManager().getProxy(sourcePath);
- Viewpoint view = (Viewpoint)dataSource.getObject(ClusterStorage.VIEWPOINT + "/" + viewpoint);
- Outcome outcome = view.getOutcome();
- if (xpath == null) {
- retArr = new Object[1];
- retArr[0] = outcome;
- }
- else
- retArr = XmlElementParser.parse(outcome.getData(), xpath);
- return retArr;
-
- } catch (ObjectNotFoundException e) {
- return errArr;
- }
- }
-}