diff options
Diffstat (limited to 'src/main/java/com/c2kernel/lifecycle/ActivitySlotDef.java')
| -rw-r--r-- | src/main/java/com/c2kernel/lifecycle/ActivitySlotDef.java | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/src/main/java/com/c2kernel/lifecycle/ActivitySlotDef.java b/src/main/java/com/c2kernel/lifecycle/ActivitySlotDef.java index 514dc72..85c942f 100644 --- a/src/main/java/com/c2kernel/lifecycle/ActivitySlotDef.java +++ b/src/main/java/com/c2kernel/lifecycle/ActivitySlotDef.java @@ -65,17 +65,17 @@ public class ActivitySlotDef extends WfVertexDef mErrors.add("Unreachable");
err = false;
}
- else if (nbInEdgres > 1)
+ if (nbInEdgres > 1)
{
mErrors.add("Bad nb of previous");
err = false;
}
- else if (nbOutEdges > 1)
+ if (nbOutEdges > 1)
{
mErrors.add("too many next");
err = false;
}
- else if (nbOutEdges == 0)
+ if (nbOutEdges == 0)
{
if (!((CompositeActivityDef) getParent()).hasGoodNumberOfActivity())
{
@@ -83,22 +83,35 @@ public class ActivitySlotDef extends WfVertexDef 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;
+
+ Vertex[] allSiblings = getParent().getChildGraphModel().getVertices();
+ String thisName = (String)getProperties().get("Name");
+ if (thisName == null || thisName.length()==0) mErrors.add("Slot name is empty");
+ else for (Vertex v : allSiblings) {
+ if (v instanceof ActivitySlotDef && v.getID()!=getID()) {
+ ActivitySlotDef otherSlot = (ActivitySlotDef)v;
+ String otherName = (String)otherSlot.getProperties().get("Name");
+ if (otherName != null && otherName.equals(thisName)) {
+ mErrors.add("Duplicate slot name");
+ err = false;
+ }
}
}
+
+ // Loop check
+ 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;
}
/**
|
