diff options
Diffstat (limited to 'source/com/c2kernel/lifecycle/ActivitySlotDef.java')
| -rw-r--r-- | source/com/c2kernel/lifecycle/ActivitySlotDef.java | 156 |
1 files changed, 0 insertions, 156 deletions
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;
- }
-}
|
