diff options
Diffstat (limited to 'source/com/c2kernel/lifecycle/instance')
52 files changed, 435 insertions, 362 deletions
diff --git a/source/com/c2kernel/lifecycle/instance/Activity.java b/source/com/c2kernel/lifecycle/instance/Activity.java index a0df570..226f0af 100644 --- a/source/com/c2kernel/lifecycle/instance/Activity.java +++ b/source/com/c2kernel/lifecycle/instance/Activity.java @@ -101,6 +101,7 @@ public class Activity extends WfVertex /**
* 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);
@@ -188,13 +189,6 @@ public class Activity extends WfVertex || transitionID == Transitions.PROCEED)
try
{
- try
- {
- GTimeStamp t = DateUtility.setToNow(new GTimeStamp());
- }
- catch (Exception e)
- {
- }
runNext(agent);
}
catch (ScriptingEngineException e)
@@ -258,6 +252,7 @@ public class Activity extends WfVertex return result;
}
/** launch the verification of the activity */
+ @Override
public boolean verify()
{
mErrors.removeAllElements();
@@ -306,6 +301,7 @@ public class Activity extends WfVertex return true;
}
/** Used in verify() */
+ @Override
public boolean loop()
{
boolean loop2 = false;
@@ -319,6 +315,7 @@ public class Activity extends WfVertex return loop2;
}
/** sets the next activity available if possible */
+ @Override
public void runNext(AgentPath agent) throws ScriptingEngineException
{
setActive(false);
@@ -372,6 +369,7 @@ public class Activity extends WfVertex return null;
}
/** reinitialises the Activity and propagate (for Loop) */
+ @Override
public void reinit(int idLoop)
{
Logger.debug(7, "reinit " + getItemEntityPath().getSysKey() + " " + getPath());
@@ -384,16 +382,17 @@ public class Activity extends WfVertex }
}
/** return the String that identifies the errors found in th activity */
+ @Override
public String getErrors()
{
- String errors = "";
if (mErrors.size() == 0)
return "No error";
- return (String) mErrors.elementAt(0);
+ 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());
@@ -418,6 +417,7 @@ public class Activity extends WfVertex /**
* 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");
@@ -613,7 +613,7 @@ public class Activity extends WfVertex {
String agentRole = getCurrentAgentRole();
if (agentRole == null || agentRole.length()==0) return;
-
+
LDAPRoleManager roleMan = Gateway.getLDAPLookup().getRoleManager();
RolePath myRole;
try {
@@ -625,12 +625,12 @@ public class Activity extends WfVertex if (myRole.hasJobList())
new JobPusher(this, myRole).start();
- }
-
+ }
+
/**
* Returns the activeDate.
- *
+ *
* @return GTimeStamp
*/
public GTimeStamp getActiveDate()
@@ -638,7 +638,7 @@ public class Activity extends WfVertex return mActiveDate;
} /**
* Returns the startDate.
- *
+ *
* @return GTimeStamp
*/
public GTimeStamp getStartDate()
@@ -646,7 +646,7 @@ public class Activity extends WfVertex return mStartDate;
} /**
* Sets the activeDate.
- *
+ *
* @param activeDate
* The activeDate to set
*/
@@ -655,7 +655,7 @@ public class Activity extends WfVertex mActiveDate = activeDate;
} /**
* Sets the startDate.
- *
+ *
* @param startDate
* The startDate to set
*/
@@ -664,7 +664,7 @@ public class Activity extends WfVertex mStartDate = startDate;
} /**
* Returns the type.
- *
+ *
* @return String
*/
public String getType()
@@ -672,7 +672,7 @@ public class Activity extends WfVertex return mType;
} /**
* Sets the type.
- *
+ *
* @param type
* The type to set
*/
diff --git a/source/com/c2kernel/lifecycle/instance/AdvancementCalculator.java b/source/com/c2kernel/lifecycle/instance/AdvancementCalculator.java index a0d4aab..6a3abe7 100644 --- a/source/com/c2kernel/lifecycle/instance/AdvancementCalculator.java +++ b/source/com/c2kernel/lifecycle/instance/AdvancementCalculator.java @@ -47,14 +47,14 @@ public class AdvancementCalculator implements Serializable {
current.isMarked.put(v, "");
Vertex[] nexts = current.activity.getChildGraphModel().getOutVertices(v);
- for (int i = 0; i < nexts.length; i++)
- if (current.isMarked.get(nexts[i]) != null)
- current.HasNextMarked.put(v, nexts[i]);
+ for (Vertex next : nexts)
+ if (current.isMarked.get(next) != null)
+ current.HasNextMarked.put(v, next);
else
- check(nexts[i], current);
+ check(next, current);
int j=0;
- for (int i = 0; i < nexts.length; i++)
- if (current.HasNextMarked.get(nexts[i]) != null)
+ for (Vertex next : nexts)
+ if (current.HasNextMarked.get(next) != null)
j++;
if (j != 0 && j==nexts.length) current.HasNextMarked.put(v, nexts[0]);
}
@@ -133,33 +133,30 @@ public class AdvancementCalculator implements Serializable long NbActpassedWithCurrent = 0;
long NbActLeftWithCurrent = 0;
long NbActLeftWithoutCurrent = 0;
- boolean isbranchFinished = true;
boolean hasNobranchFinished = true;
boolean hasNoBranchActive = true;
- for (int i = 0; i < advs.length; i++)
- {
- if (advs[i].mIsbranchActive)
+ for (AdvancementCalculator adv : advs) {
+ if (adv.mIsbranchActive)
hasNoBranchActive = false;
- if (advs[i].mIsbranchFinished)
+ if (adv.mIsbranchFinished)
hasNobranchFinished = false;
}
- for (int i = 0; i < advs.length; i++)
- {
+ for (AdvancementCalculator adv : advs) {
- if (maximuNbActexp < advs[i].mMaximuNbActexp)
- maximuNbActexp = advs[i].mMaximuNbActexp;
- if (advs[i].mIsbranchActive || advs[i].mIsbranchFinished || (hasNoBranchActive && hasNobranchFinished))
+ if (maximuNbActexp < adv.mMaximuNbActexp)
+ maximuNbActexp = adv.mMaximuNbActexp;
+ if (adv.mIsbranchActive || adv.mIsbranchFinished || (hasNoBranchActive && hasNobranchFinished))
{
- if (NbActpassed < advs[i].mNbActpassed)
- NbActpassed = advs[i].mNbActpassed;
- if (NbActpassedWithCurrent < advs[i].mNbActpassedWithCurrent)
- NbActpassedWithCurrent = advs[i].mNbActpassedWithCurrent;
- if (NbActLeftWithCurrent < advs[i].mNbActLeftWithCurrent)
- NbActLeftWithCurrent = advs[i].mNbActLeftWithCurrent;
- if (NbActLeftWithoutCurrent < advs[i].mNbActLeftWithoutCurrent)
- NbActLeftWithoutCurrent += advs[i].mNbActLeftWithoutCurrent;
- if (currentNbActExp < advs[i].mCurrentNbActExp)
- currentNbActExp = advs[i].mCurrentNbActExp;
+ 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;
diff --git a/source/com/c2kernel/lifecycle/instance/AndSplit.java b/source/com/c2kernel/lifecycle/instance/AndSplit.java index 7a2055d..63b5640 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/AndSplit.java +++ b/source/com/c2kernel/lifecycle/instance/AndSplit.java @@ -15,12 +15,13 @@ public class AndSplit extends Split {
super();
}
+ @Override
public void runNext(AgentPath agent) throws ScriptingEngineException
{
AdvancementCalculator adv = new AdvancementCalculator();
adv.calculate((CompositeActivity) getParent());
Vertex[] outVertices = getOutGraphables();
- for (int i = 0; i < outVertices.length; i++)
- ((WfVertex) outVertices[i]).run(agent);
+ 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 index 797a5db..c080a37 100644 --- a/source/com/c2kernel/lifecycle/instance/CompositeActivity.java +++ b/source/com/c2kernel/lifecycle/instance/CompositeActivity.java @@ -49,7 +49,8 @@ public class CompositeActivity extends Activity * Functions--------------- --------------------------------------------
*/
/** launch the verification of the subprocess() */
- public boolean verify()
+ @Override
+ public boolean verify()
{
boolean err = super.verify();
GraphableVertex[] vChildren = getChildren();
@@ -66,14 +67,14 @@ public class CompositeActivity extends Activity /**
* 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
@@ -90,7 +91,7 @@ public class CompositeActivity extends Activity /**
* Method newChild.
- *
+ *
* @param Name
* @param Type
* @param point
@@ -105,7 +106,7 @@ public class CompositeActivity extends Activity /**
* Method newChild.
- *
+ *
* @param Name
* @param Type
* @param point
@@ -120,7 +121,7 @@ public class CompositeActivity extends Activity /**
* Method newChild.
- *
+ *
* @param vertexTypeId
* @param point
* @return WfVertex
@@ -161,7 +162,7 @@ public class CompositeActivity extends Activity /**
* Method newCompChild.
- *
+ *
* @param id
* @param first
* @param point
@@ -178,13 +179,13 @@ public class CompositeActivity extends Activity /**
* 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)
{
@@ -196,7 +197,7 @@ public class CompositeActivity extends Activity /**
* Method newSplitChild.
- *
+ *
* @param Type
* @param point
* @return Split
@@ -223,7 +224,7 @@ public class CompositeActivity extends Activity /**
* Method newJoinChild.
- *
+ *
* @param point
* @return Join
*/
@@ -245,7 +246,7 @@ public class CompositeActivity extends Activity /**
* Method search.
- *
+ *
* @param ids
* @return WfVertex
*/
@@ -275,17 +276,19 @@ public class CompositeActivity extends Activity /**
* @see com.c2kernel.lifecycle.instance.WfVertex#run()
*/
- public void run(AgentPath agent) throws ScriptingEngineException
+ @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();
- ((WfVertex) getChildrenGraphModel().getStartVertex()).run(agent);
+ first.run(agent);
}
}
- public void runNext(AgentPath agent) throws ScriptingEngineException
+ @Override
+ public void runNext(AgentPath agent) throws ScriptingEngineException
{
if (getMachine().state != States.FINISHED)
getMachine().traverse(Transitions.COMPLETE);
@@ -296,7 +299,8 @@ public class CompositeActivity extends Activity * @see com.c2kernel.lifecycle.instance.Activity#query(com.c2kernel.common.AgentInfo,
* java.lang.String, boolean)
*/
- public Activity[] query(AgentPath agent, int stateID, boolean filter)
+ @Override
+ public Activity[] query(AgentPath agent, int stateID, boolean filter)
{
Vector<Activity[]> steps = new Vector<Activity[]>();
Activity[] returnArray = null;
@@ -307,7 +311,7 @@ public class CompositeActivity extends Activity }
int j = 0;
for (int i = 0; i < steps.size(); i++)
- j += ((Activity[]) steps.elementAt(i)).length;
+ j += steps.elementAt(i).length;
Activity[] tmp = super.query(agent, stateID, filter);
if (tmp.length == 1)
{
@@ -318,9 +322,9 @@ public class CompositeActivity extends Activity j = 0;
for (int i = 0; i < steps.size(); i++)
{
- Activity[] stepArray = (Activity[]) steps.elementAt(i);
- for (int k = 0; k < stepArray.length; k++)
- returnArray[j++] = stepArray[k];
+ Activity[] stepArray = steps.elementAt(i);
+ for (Activity element : stepArray)
+ returnArray[j++] = element;
}
return returnArray;
}
@@ -328,7 +332,8 @@ public class CompositeActivity extends Activity /**
* @see com.c2kernel.lifecycle.instance.Activity#calculateJobs()
*/
- public ArrayList<Job> calculateJobs(AgentPath agent, boolean recurse)
+ @Override
+ public ArrayList<Job> calculateJobs(AgentPath agent, boolean recurse)
{
ArrayList<Job> jobs = new ArrayList<Job>();
boolean childActive = false;
@@ -345,7 +350,8 @@ public class CompositeActivity extends Activity return jobs;
}
- public ArrayList<Job> calculateAllJobs(AgentPath agent, boolean recurse)
+ @Override
+ public ArrayList<Job> calculateAllJobs(AgentPath agent, boolean recurse)
{
ArrayList<Job> jobs = new ArrayList<Job>();
if (recurse)
@@ -361,7 +367,7 @@ public class CompositeActivity extends Activity /**
* Method addNext.
- *
+ *
* @param origin
* @param terminus
* @return Next
@@ -373,7 +379,7 @@ public class CompositeActivity extends Activity /**
* Method addNext.
- *
+ *
* @param originID
* @param terminusID
* @return Next
@@ -388,7 +394,7 @@ public class CompositeActivity extends Activity /**
* Method hasGoodNumberOfActivity.
- *
+ *
* @return boolean
*/
public boolean hasGoodNumberOfActivity()
@@ -408,7 +414,8 @@ public class CompositeActivity extends Activity /**
* @see com.c2kernel.lifecycle.instance.Activity#getType()
*/
- public String getType()
+ @Override
+ public String getType()
{
if (getName().equals("domain"))
return "domain";
@@ -416,16 +423,18 @@ public class CompositeActivity extends Activity }
/**
- *
+ *
*/
- public void reinit(int idLoop)
+ @Override
+ public void reinit(int idLoop)
{
super.reinit(idLoop);
if (getChildrenGraphModel().getStartVertex() != null && getMachine().getCurrentState() != States.FINISHED)
((WfVertex) getChildrenGraphModel().getStartVertex()).reinit(idLoop);
}
- public void request(AgentPath agent, int transitionID, String requestData) throws AccessRightsException, InvalidTransitionException, InvalidDataException, ObjectAlreadyExistsException
+ @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
@@ -440,10 +449,10 @@ public class CompositeActivity extends Activity public void refreshJobs()
{
GraphableVertex[] children = getChildren();
- for (int i = 0; i < children.length; i++)
- if (children[i] instanceof CompositeActivity)
- ((CompositeActivity) children[i]).refreshJobs();
- else if (children[i] instanceof Activity)
- ((Activity) children[i]).pushJobsToAgents();
+ 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/EventStorage.java b/source/com/c2kernel/lifecycle/instance/EventStorage.java index a78a2bf..40cffaf 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/EventStorage.java +++ b/source/com/c2kernel/lifecycle/instance/EventStorage.java @@ -8,7 +8,7 @@ import java.util.Hashtable; */
public class EventStorage implements Serializable
{
- private Hashtable mLists;
+ private Hashtable<?, ?> mLists;
private EventList[] dummy = new EventList[0];
public Integer lastTransitionStored;
@@ -16,9 +16,9 @@ public class EventStorage implements Serializable {
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 index e58170d..c6e5d26 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/JobPusher.java +++ b/source/com/c2kernel/lifecycle/instance/JobPusher.java @@ -22,10 +22,11 @@ final class JobPusher extends Thread { this.myRole = role;
}
- public void run()
+ @Override
+ public void run()
{
Thread.currentThread().setName("Agent job pusher for "+activity.getName()+" to role "+myRole);
- for (Enumeration e = myRole.getChildren(); e.hasMoreElements();)
+ for (Enumeration<?> e = myRole.getChildren(); e.hasMoreElements();)
{
AgentPath nextAgent = (AgentPath)e.nextElement();
Logger.msg(7, "Activity.pushJobsToAgents() - Calculating jobs for " + nextAgent.getAgentName());
@@ -34,7 +35,7 @@ final class JobPusher extends Thread { // get joblist for user
JobArrayList jobList = new JobArrayList(this.activity.calculateJobs(nextAgent, false));
// only transmit start, complete and resume jobs
- for (Iterator element = jobList.list.iterator(); element.hasNext();)
+ for (Iterator<?> element = jobList.list.iterator(); element.hasNext();)
{
Job thisJob = (Job) element.next();
if (thisJob.getPossibleTransition() != Transitions.START
@@ -64,6 +65,6 @@ final class JobPusher extends Thread { 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 index b61100e..3a4fd7d 100644 --- a/source/com/c2kernel/lifecycle/instance/Join.java +++ b/source/com/c2kernel/lifecycle/instance/Join.java @@ -26,6 +26,7 @@ public class Join extends WfVertex /**
* @see com.c2kernel.lifecycle.instance.WfVertex#runNext()
*/
+ @Override
public void runNext(AgentPath agent) throws ScriptingEngineException
{
AdvancementCalculator adv = new AdvancementCalculator();
@@ -44,7 +45,7 @@ public class Join extends WfVertex }
/**
* Method addNext.
- *
+ *
* @param idNext
*/
public void addNext(String idNext)
@@ -54,6 +55,7 @@ public class Join extends WfVertex /**
* @see com.c2kernel.lifecycle.instance.WfVertex#reinit(int)
*/
+ @Override
public void reinit(int idLoop)
{
Vertex[] outVertices = getOutGraphables();
@@ -65,7 +67,7 @@ public class Join extends WfVertex }
/**
* Method getItemSystemKey.
- *
+ *
* @return String
*/
/*
@@ -77,7 +79,7 @@ public class Join extends WfVertex }
/**
* Method setItemSystemKey.
- *
+ *
* @param itemSystemKey
*/
public void setItemSystemKey(String itemSystemKey)
@@ -90,6 +92,7 @@ public class Join extends WfVertex // public void initItemSystemKey(String systemKey) {
// this.setItemSystemKey(systemKey);
// }
+ @Override
public boolean verify()
{
mErrors.removeAllElements();
@@ -153,16 +156,18 @@ public class Join extends WfVertex /**
* @see com.c2kernel.lifecycle.instance.WfVertex#getErrors()
*/
+ @Override
public String getErrors()
{
if (mErrors.size() == 0)
return "No error";
else
- return (String) mErrors.elementAt(0);
+ return mErrors.elementAt(0);
}
/**
* @see com.c2kernel.lifecycle.instance.WfVertex#run()
*/
+ @Override
public void run(AgentPath agent) throws ScriptingEngineException
{
runNext(agent);
@@ -170,6 +175,7 @@ public class Join extends WfVertex /**
* @see com.c2kernel.lifecycle.instance.WfVertex#addNext(com.c2kernel.lifecycle.instance.WfVertex)
*/
+ @Override
public Next addNext(WfVertex vertex)
{
return new Next(this, vertex);
@@ -177,6 +183,7 @@ public class Join extends WfVertex /**
* @see com.c2kernel.lifecycle.instance.WfVertex#loop()
*/
+ @Override
public boolean loop()
{
boolean loop2 = false;
@@ -191,15 +198,17 @@ public class Join extends WfVertex 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 index 556a9ca..8228ba9 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/Loop.java +++ b/source/com/c2kernel/lifecycle/instance/Loop.java @@ -20,10 +20,12 @@ public class Loop extends XOrSplit /**
* @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();
@@ -38,6 +40,7 @@ public class Loop extends XOrSplit /**
* @see com.c2kernel.lifecycle.instance.WfVertex#reinit(int)
*/
+ @Override
public void reinit(int idLoop)
{
Logger.msg(8, "Loop.reinit");
@@ -56,6 +59,7 @@ public class Loop extends XOrSplit /**
* @see com.c2kernel.lifecycle.instance.WfVertex#verify()
*/
+ @Override
public boolean verify()
{
boolean err = super.verify();
@@ -64,13 +68,12 @@ public class Loop extends XOrSplit int k = 0;
int l = 0;
Vertex[] brothers = getParent().getChildren();
- for (int i = 0; i < brothers.length; i++)
- if (brothers[i] instanceof Loop)
+ for (Vertex brother : brothers)
+ if (brother instanceof Loop)
l++;
- for (int i = 0; i < nexts.length; i++)
- {
- for (int j = 0; j < anteVertices.length; j++)
- if (nexts[i].getID() == anteVertices[j].getID())
+ for (Vertex next : nexts) {
+ for (Vertex anteVertice : anteVertices)
+ if (next.getID() == anteVertice.getID())
k++;
}
if (k != 1 && !(l > 1))
@@ -88,15 +91,15 @@ public class Loop extends XOrSplit {
int id = vertex.getID();
Vertex[] anteVertices = GraphTraversal.getTraversal(getParent().getChildrenGraphModel(), this, GraphTraversal.kUp, false);
- for (int i = 0; i < anteVertices.length; i++)
- {
- if (anteVertices[i].getID() == id)
+ 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 index 059dbf8..4df775c 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/Next.java +++ b/source/com/c2kernel/lifecycle/instance/Next.java @@ -28,7 +28,7 @@ public class Next extends GraphableEdge {
super(pre, nex);
getProperties().put("Alias","");
- getProperties().put("Type","Straight");
+ getProperties().put("Type","Straight");
}
/**
@@ -43,6 +43,7 @@ public class Next extends GraphableEdge {
return (WfVertex)((CompositeActivity)getParent()).getWf().search(getParent().getPath()+"/"+this.getTerminusVertexId());
}
+ @Override
public boolean containsPoint(GraphPoint p)
{
GraphPoint originPoint = getOriginPoint();
diff --git a/source/com/c2kernel/lifecycle/instance/OrSplit.java b/source/com/c2kernel/lifecycle/instance/OrSplit.java index f0fcdd5..aea34b2 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/OrSplit.java +++ b/source/com/c2kernel/lifecycle/instance/OrSplit.java @@ -18,6 +18,7 @@ public class OrSplit extends Split {
super();
}
+ @Override
public void runNext(AgentPath agent) throws ScriptingEngineException
{
String nexts =
@@ -36,9 +37,8 @@ public class OrSplit extends Split {
String thisNext = tok.nextToken();
Logger.msg(7, "Finding next " + thisNext);
- for (int i = 0; i < outEdges.length; i++)
- {
- Next nextEdge = (Next) outEdges[i];
+ for (DirectedEdge outEdge : outEdges) {
+ Next nextEdge = (Next) outEdge;
if (thisNext != null && thisNext.equals(nextEdge.getProperties().get("Alias")))
{
WfVertex term = nextEdge.getTerminusVertex();
@@ -57,6 +57,6 @@ public class OrSplit extends Split 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 index 35fed90..02a0c6d 100644 --- a/source/com/c2kernel/lifecycle/instance/ParserWF.java +++ b/source/com/c2kernel/lifecycle/instance/ParserWF.java @@ -35,7 +35,6 @@ public class ParserWF nexts = new Vector<String[]>(1, 1);
i = 0;
file = xmlfile;
- int c;
while (i < file.length() - 5)
{
if (file.substring(i, i + 5).equals("<STEP"))
@@ -52,12 +51,12 @@ public class ParserWF {
for (int k = j + 1; k < nexts.size(); k++)
{
- if (((String[]) nexts.elementAt(j))[0].equals(((String[]) nexts.elementAt(k))[0]))
+ if (nexts.elementAt(j)[0].equals(nexts.elementAt(k)[0]))
{
int tmp = act.newSplitChild("And", new Point(0, 0)).getID();
- ((WfVertex) act.search(((String[]) nexts.elementAt(k))[0])).addNext(act.search(tmp));
- ((Split) act.search(tmp)).addNext((WfVertex) act.search(((String[]) nexts.elementAt(k))[1]));
- ((Split) act.search(tmp)).addNext((WfVertex) act.search(((String[]) nexts.elementAt(j))[1]));
+ ((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;
}
@@ -72,12 +71,12 @@ public class ParserWF {
for (int k = j + 1; k < nexts.size(); k++)
{
- if (((String[]) nexts.elementAt(j))[1].equals(((String[]) nexts.elementAt(k))[1]))
+ if (nexts.elementAt(j)[1].equals(nexts.elementAt(k)[1]))
{
int tmp = act.newJoinChild(new Point(0, 0)).getID();
- ((WfVertex) act.search(((String[]) nexts.elementAt(j))[0])).addNext(act.search(tmp));
- ((WfVertex) act.search(((String[]) nexts.elementAt(k))[0])).addNext(act.search(tmp));
- ((Join) act.search(tmp)).addNext(((String[]) nexts.elementAt(j))[1]);
+ ((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;
}
@@ -92,8 +91,8 @@ public class ParserWF {
Logger.msg(
7,
- "try to add next " + ((String[]) nexts.elementAt(j))[1] + " to " + ((String[]) nexts.elementAt(j))[0]);
- ((Activity) act.search(((String[]) nexts.elementAt(j))[0])).addNext(((String[]) nexts.elementAt(j))[1]);
+ "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
diff --git a/source/com/c2kernel/lifecycle/instance/Split.java b/source/com/c2kernel/lifecycle/instance/Split.java index e7b275c..4fe1bfc 100644 --- a/source/com/c2kernel/lifecycle/instance/Split.java +++ b/source/com/c2kernel/lifecycle/instance/Split.java @@ -32,11 +32,12 @@ public abstract class Split extends WfVertex /**
* @see com.c2kernel.lifecycle.instance.WfVertex#runNext()
*/
- public abstract void runNext(AgentPath agent) throws ScriptingEngineException;
+ @Override
+ public abstract void runNext(AgentPath agent) throws ScriptingEngineException;
/**
* Method addNext.
- *
+ *
* @param idNext
*/
void addNext(String idNext)
@@ -47,7 +48,8 @@ public abstract class Split extends WfVertex /**
* @see com.c2kernel.lifecycle.instance.WfVertex#addNext(com.c2kernel.lifecycle.instance.WfVertex)
*/
- public Next addNext(WfVertex vertex)
+ @Override
+ public Next addNext(WfVertex vertex)
{
Next nxt = new Next(this, vertex);
int num = getOutGraphables().length;
@@ -64,7 +66,7 @@ public abstract class Split extends WfVertex /**
* Method getItemSystemKey.
- *
+ *
* @return int
*/
public int getItemSystemKey()
@@ -74,7 +76,7 @@ public abstract class Split extends WfVertex /**
* Method setItemSystemKey.
- *
+ *
* @param itemSystemKey
*/
public void setItemSystemKey(int itemSystemKey)
@@ -88,17 +90,19 @@ public abstract class Split extends WfVertex // public void initItemSystemKey(String systemKey) {
// setItemSystemKey(systemKey);
// }
- public void reinit(int idLoop)
+ @Override
+ public void reinit(int idLoop)
{
Vertex[] outVertices = getOutGraphables();
- for (int i = 0; i < outVertices.length; i++)
- ((WfVertex) outVertices[i]).reinit(idLoop);
+ for (Vertex outVertice : outVertices)
+ ((WfVertex) outVertice).reinit(idLoop);
}
/**
* @see com.c2kernel.lifecycle.instance.WfVertex#verify()
*/
- public boolean verify()
+ @Override
+ public boolean verify()
{
mErrors.removeAllElements();
int nbInEdgres = getParent().getChildrenGraphModel().getInEdges(this).length;
@@ -151,18 +155,20 @@ public abstract class Split extends WfVertex /**
* @see com.c2kernel.lifecycle.instance.WfVertex#getErrors()
*/
- public String getErrors()
+ @Override
+ public String getErrors()
{
if (mErrors.size() == 0)
return "No error";
else
- return (String) mErrors.elementAt(0);
+ return mErrors.elementAt(0);
}
/**
* @see com.c2kernel.lifecycle.instance.WfVertex#run()
*/
- public void run(AgentPath agent) throws ScriptingEngineException
+ @Override
+ public void run(AgentPath agent) throws ScriptingEngineException
{
runNext(agent);
}
@@ -170,7 +176,8 @@ public abstract class Split extends WfVertex /**
* @see com.c2kernel.lifecycle.instance.WfVertex#loop()
*/
- public boolean loop()
+ @Override
+ public boolean loop()
{
boolean loop2 = false;
if (!loopTested)
@@ -203,13 +210,14 @@ public abstract class Split extends WfVertex {
if (test == null)
return false;
- for (int i = 0; i < list.length; i++)
- if (test.equals(list[i]))
+ for (String element : list)
+ if (test.equals(element))
return true;
return false;
}
- public void runfirst(AgentPath agent) throws ScriptingEngineException
+ @Override
+ public void runfirst(AgentPath agent) throws ScriptingEngineException
{
runNext(agent);
}
diff --git a/source/com/c2kernel/lifecycle/instance/WfVertex.java b/source/com/c2kernel/lifecycle/instance/WfVertex.java index 7285916..f6cec33 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/WfVertex.java +++ b/source/com/c2kernel/lifecycle/instance/WfVertex.java @@ -27,7 +27,7 @@ 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()
*/
@@ -88,7 +88,7 @@ public abstract class WfVertex extends GraphableVertex * @param vertex
*/
public abstract Next addNext(WfVertex vertex);
-
+
protected Object evaluateScript(String scriptName, String scriptVersion) throws ScriptingEngineException
{
@@ -98,12 +98,11 @@ public abstract class WfVertex extends GraphableVertex Script script = getScript(scriptName, scriptVersion);
KeyValuePair[] k = getProperties().getKeyValuePairs();
- HashMap requiredInput = script.getAllInputParams();
- for (int i = 0; i < k.length; i++)
- {
- if (requiredInput.containsKey(k[i].getKey()))
+ HashMap<?, ?> requiredInput = script.getAllInputParams();
+ for (KeyValuePair element : k) {
+ if (requiredInput.containsKey(element.getKey()))
{
- String value = k[i].getStringValue();
+ String value = element.getStringValue();
Object inputParam = value;
if (value.startsWith("viewpoint//"))
@@ -126,11 +125,11 @@ public abstract class WfVertex extends GraphableVertex inputParam = null;
}
}
- Logger.msg(5, "Split.evaluateScript() - Setting param " + k[i].getKey() + " to " + inputParam.toString());
- script.setInputParamValue(k[i].getKey(), inputParam);
+ 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));
}
@@ -150,8 +149,8 @@ public abstract class WfVertex extends GraphableVertex throw new ScriptingEngineException();
}
}
-
- private Script getScript(String name, String version) throws ScriptingEngineException
+
+ private static Script getScript(String name, String version) throws ScriptingEngineException
{
Script script;
try
@@ -171,8 +170,8 @@ public abstract class WfVertex extends GraphableVertex 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 index 4c8aa94..1d12ee6 100644 --- a/source/com/c2kernel/lifecycle/instance/Workflow.java +++ b/source/com/c2kernel/lifecycle/instance/Workflow.java @@ -46,7 +46,7 @@ public class Workflow extends CompositeActivity implements C2KLocalObject {
getProperties().put("ItemSystemKey", null);
}
-
+
public Workflow(CompositeActivity domain) {
this();
domain.setName("domain");
@@ -54,10 +54,10 @@ public class Workflow extends CompositeActivity implements C2KLocalObject PredefinedStepContainer act = new PredefinedStepContainer();
addChild(act, new GraphPoint(300, 100));
}
-
+
/**
* Method getVertexTypeNameAndConstructionInfo.
- *
+ *
* @return TypeNameAndConstructionInfo[]
*/
/** getVertexTypeNameAndConstructionInfo() added by Steve */
@@ -67,7 +67,7 @@ public class Workflow extends CompositeActivity implements C2KLocalObject }
/**
* Method getEdgeTypeNameAndConstructionInfo.
- *
+ *
* @return TypeNameAndConstructionInfo[]
*/
/** getVertexTypeNameAndConstructionInfo() added by Steve */
@@ -77,7 +77,7 @@ public class Workflow extends CompositeActivity implements C2KLocalObject }
/**
* Method requestAction.
- *
+ *
* @param agentInfo
* @param stepPath
* @param transitionID
@@ -101,6 +101,7 @@ public class Workflow extends CompositeActivity implements C2KLocalObject /**
* @see com.c2kernel.graph.model.GraphableVertex#getPath()
*/
+ @Override
public String getPath()
{
return "workflow";
@@ -108,6 +109,7 @@ public class Workflow extends CompositeActivity implements C2KLocalObject /**
* @see com.c2kernel.graph.model.Vertex#getName()
*/
+ @Override
public String getName()
{
return "workflow";
@@ -115,6 +117,7 @@ public class Workflow extends CompositeActivity implements C2KLocalObject /**
* @see com.c2kernel.lifecycle.instance.Activity#getType()
*/
+ @Override
public String getType()
{
return "workflow";
@@ -122,12 +125,14 @@ public class Workflow extends CompositeActivity implements C2KLocalObject /**
* @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++)
@@ -143,13 +148,14 @@ public class Workflow extends CompositeActivity implements C2KLocalObject /**
* @see com.c2kernel.lifecycle.instance.Activity#getWf()
*/
+ @Override
public Workflow getWf()
{
return this;
}
/**
* Method initialise.
- *
+ *
* @param systemKey
*/
public void initialise(int systemKey, AgentPath agent)
@@ -166,7 +172,7 @@ public class Workflow extends CompositeActivity implements C2KLocalObject }
/**
* Method calculateJobs.
- *
+ *
* @param type
* @return JobList
*/
@@ -185,6 +191,7 @@ public class Workflow extends CompositeActivity implements C2KLocalObject /**
* @see com.c2kernel.lifecycle.instance.CompositeActivity#hasGoodNumberOfActivity()
*/
+ @Override
public boolean hasGoodNumberOfActivity()
{
return true;
@@ -192,6 +199,7 @@ public class Workflow extends CompositeActivity implements C2KLocalObject /**
* @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 index 108aa61..25baf0b 100644 --- a/source/com/c2kernel/lifecycle/instance/XOrSplit.java +++ b/source/com/c2kernel/lifecycle/instance/XOrSplit.java @@ -21,32 +21,32 @@ public class XOrSplit extends Split super();
}
- public void runNext(AgentPath agent) throws ScriptingEngineException
+ @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("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();
+ nextsTab[i] = tok.nextToken();
DirectedEdge[] outEdges = getOutEdges();
- for (int i = 0; i < outEdges.length; i++)
- {
- if (isInTable((String)((Next)outEdges[i]).getProperties().get("Alias"), nextsTab))
- nextsToFollow.add(outEdges[i]);
+ 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 index f79d312..e96ef37 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/gui/model/WfEdgeFactory.java +++ b/source/com/c2kernel/lifecycle/instance/gui/model/WfEdgeFactory.java @@ -9,7 +9,8 @@ import com.c2kernel.lifecycle.instance.WfVertex; public class WfEdgeFactory implements EdgeFactory
{
- public void create
+ @Override
+ public void create
(
GraphModelManager graphModelManager,
Vertex origin,
@@ -22,7 +23,7 @@ public class WfEdgeFactory implements EdgeFactory }
- private boolean validCreation( GraphModelManager graphModelManager, Vertex origin, Vertex 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() );
diff --git a/source/com/c2kernel/lifecycle/instance/gui/model/WfGraphPanel.java b/source/com/c2kernel/lifecycle/instance/gui/model/WfGraphPanel.java index 752e1fa..16c8e16 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/gui/model/WfGraphPanel.java +++ b/source/com/c2kernel/lifecycle/instance/gui/model/WfGraphPanel.java @@ -18,6 +18,7 @@ public class WfGraphPanel extends GraphPanel super(d,v);
}
// Draws the highlight of the specified edge
+ @Override
protected void drawEdgeHighlight(Graphics2D g2d, DirectedEdge edge)
{
GraphPoint originPoint = edge.getOriginPoint();
@@ -49,7 +50,7 @@ public class WfGraphPanel extends GraphPanel int minX = midPoint.x - 10;
int minY = midPoint.y - 10;
int maxX = midPoint.x + 10;
- int maxY = midPoint.y + 10;
+ int maxY = midPoint.y + 10;
g2d.drawLine(minX, minY, maxX, minY);
g2d.drawLine(maxX, minY, maxX, maxY);
g2d.drawLine(maxX, maxY, minX, maxY);
diff --git a/source/com/c2kernel/lifecycle/instance/gui/model/WfVertexFactory.java b/source/com/c2kernel/lifecycle/instance/gui/model/WfVertexFactory.java index d363dc6..0b6c9e4 100644 --- a/source/com/c2kernel/lifecycle/instance/gui/model/WfVertexFactory.java +++ b/source/com/c2kernel/lifecycle/instance/gui/model/WfVertexFactory.java @@ -19,6 +19,7 @@ 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;
@@ -44,12 +45,14 @@ public class WfVertexFactory implements VertexFactory, WorkflowDialogue mRootAct.newChild(vertexTypeId, location);
}
}
+ @Override
public void setCreationContext(Object newContext)
{
if (newContext != null && newContext instanceof CompositeActivity)
mRootAct = (CompositeActivity) newContext;
}
- public void loadThisWorkflow(String newName, HashMap hashMap)
+ @Override
+ public void loadThisWorkflow(String newName, HashMap<?, ?> hashMap)
{
String vertexTypeId = (String) hashMap.get("P1");
Point location = (Point) hashMap.get("P2");
@@ -69,7 +72,7 @@ public class WfVertexFactory implements VertexFactory, WorkflowDialogue Resource.getImageResource("graph/newvertex_large.png"),
null,
null);
- if (newName == null || newName.equals(""))
+ if (newName.equals(""))
return;
}
Activity act = null;
@@ -80,7 +83,7 @@ public class WfVertexFactory implements VertexFactory, WorkflowDialogue }
catch (Exception e)
{
- }
+ }
if (act == null)
mRootAct.newChild(unicName, vertexTypeId, location);
else
diff --git a/source/com/c2kernel/lifecycle/instance/gui/model/WfVertexOutlineCreator.java b/source/com/c2kernel/lifecycle/instance/gui/model/WfVertexOutlineCreator.java index dd4b8af..e8cb303 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/gui/model/WfVertexOutlineCreator.java +++ b/source/com/c2kernel/lifecycle/instance/gui/model/WfVertexOutlineCreator.java @@ -14,7 +14,8 @@ public class WfVertexOutlineCreator implements VertexOutlineCreator,Serializable private final int mSplitJoinWidth = 60;
private final int mSplitJoinHeight = 25;
- public void setOutline(Vertex vertex)
+ @Override
+ public void setOutline(Vertex vertex)
{
GraphPoint centrePoint = vertex.getCentrePoint();
GraphPoint[] outlinePoints = new GraphPoint[ 4 ];
diff --git a/source/com/c2kernel/lifecycle/instance/gui/view/ActivityRenderer.java b/source/com/c2kernel/lifecycle/instance/gui/view/ActivityRenderer.java index a67b4fd..046ed7c 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/gui/view/ActivityRenderer.java +++ b/source/com/c2kernel/lifecycle/instance/gui/view/ActivityRenderer.java @@ -21,6 +21,7 @@ public class ActivityRenderer implements VertexRenderer 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;
@@ -28,7 +29,7 @@ public class ActivityRenderer implements VertexRenderer boolean hasError = !activity.verify();
boolean isComposite = activity.getIsComposite();
GraphPoint centrePoint = activity.getCentrePoint();
- String description = activity.getDescription();
+ //String description = activity.getDescription();
String[] linesOfText = new String[3];
linesOfText[0] = "(" + activity.getType() + ")";
linesOfText[1] = activity.getName();
@@ -52,7 +53,7 @@ public class ActivityRenderer implements VertexRenderer else
linesOfText[2] = Language.translate(States.getStateName(cs));
}
-
+
FontMetrics metrics = g2d.getFontMetrics();
int lineWidth = 0;
int lineHeight = metrics.getHeight();
@@ -86,7 +87,7 @@ public class ActivityRenderer implements VertexRenderer g2d.drawString(linesOfText[i], x, y);
}
}
- private Polygon graphPointsToPolygon(GraphPoint[] points)
+ private static Polygon graphPointsToPolygon(GraphPoint[] points)
{
Polygon polygon = new Polygon();
int i = 0;
@@ -96,7 +97,7 @@ public class ActivityRenderer implements VertexRenderer }
return polygon;
}
- private String getWaitTime(GTimeStamp date)
+ private static String getWaitTime(GTimeStamp date)
{
GTimeStamp now = new GTimeStamp();
DateUtility.setToNow(now);
diff --git a/source/com/c2kernel/lifecycle/instance/gui/view/FindActDefPanel.java b/source/com/c2kernel/lifecycle/instance/gui/view/FindActDefPanel.java index 5cb00bf..4c1a148 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/gui/view/FindActDefPanel.java +++ b/source/com/c2kernel/lifecycle/instance/gui/view/FindActDefPanel.java @@ -33,7 +33,8 @@ public class FindActDefPanel extends SelectedVertexPanel { add(findButton);
findButton.addActionListener(new ActionListener()
{
- public void actionPerformed(ActionEvent e)
+ @Override
+ public void actionPerformed(ActionEvent e)
{
try {
DomainPath actPath = (DomainPath)new DomainPath("/desc/ActivityDesc/").find(currentAct.getActivityDef());
@@ -47,21 +48,23 @@ public class FindActDefPanel extends SelectedVertexPanel { *
*/
- public void select(Vertex vert) {
+ @Override
+ public void select(Vertex vert) {
if (vert instanceof ActivitySlotDef) {
findButton.setEnabled(true);
currentAct = (ActivitySlotDef)vert;
}
- else
+ else
clear();
-
+
}
/**
*
*/
- public void 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 index 4c3f8bf..036f79a 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/gui/view/SplitJoinRenderer.java +++ b/source/com/c2kernel/lifecycle/instance/gui/view/SplitJoinRenderer.java @@ -39,7 +39,8 @@ public class SplitJoinRenderer implements VertexRenderer private int mXXXTextXOffset = 0;
- public void draw( Graphics2D g2d, Vertex vertex)
+ @Override
+ public void draw( Graphics2D g2d, Vertex vertex)
{
GraphPoint centrePoint = vertex.getCentrePoint();
String text = null;
@@ -79,9 +80,9 @@ public class SplitJoinRenderer implements VertexRenderer textXOffset = mJoinTextXOffset;
}
else if ( vertex instanceof Join)
- {
+ {
String type= (String)((Join)vertex).getProperties().get("Type");
- if (type!=null && type.equals("Route"))
+ if (type!=null && type.equals("Route"))
{
text = mRouteText;
textXOffset = mRouteTextXOffset;
@@ -116,7 +117,7 @@ public class SplitJoinRenderer implements VertexRenderer vertexHeight
);
g2d.drawString( text, centrePoint.x - textXOffset, centrePoint.y + mTextYOffset );
-
+
if (!hasErrors) {
g2d.setPaint( mErrorPaint );
String errors = Language.translate(((WfVertex)vertex).getErrors());
diff --git a/source/com/c2kernel/lifecycle/instance/gui/view/TransitionPanel.java b/source/com/c2kernel/lifecycle/instance/gui/view/TransitionPanel.java index d33b717..32b234e 100644 --- a/source/com/c2kernel/lifecycle/instance/gui/view/TransitionPanel.java +++ b/source/com/c2kernel/lifecycle/instance/gui/view/TransitionPanel.java @@ -39,12 +39,12 @@ public class TransitionPanel extends SelectedVertexPanel implements ActionListen protected GridBagLayout gridbag;
protected GridBagConstraints c;
protected Box transBox;
- protected JComboBox executors;
+ protected JComboBox<?> executors;
protected JComboBox<String> states = new JComboBox<String>(States.states);
protected JCheckBox active = new JCheckBox();
protected JLabel status = new JLabel();
protected ItemProxy mItem;
-
+
public TransitionPanel() {
super();
gridbag = new GridBagLayout();
@@ -53,37 +53,37 @@ public class TransitionPanel extends SelectedVertexPanel implements ActionListen 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++;
+
+ 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();
+ Box hackBox = Box.createHorizontalBox();
hackBox.add(states);
hackBox.add(Box.createHorizontalGlue());
hackBox.add(new JLabel("Active:"));
@@ -94,14 +94,15 @@ public class TransitionPanel extends SelectedVertexPanel implements ActionListen states.addActionListener(this);
active.addActionListener(this);
}
-
+
clear();
-
+
}
/**
*
*/
- public void select(Vertex vert) {
+ @Override
+ public void select(Vertex vert) {
clear();
if (!(vert instanceof Activity)) return;
mCurrentAct = (Activity)vert;
@@ -129,8 +130,9 @@ public class TransitionPanel extends SelectedVertexPanel implements ActionListen }
revalidate();
}
-
- public void actionPerformed(ActionEvent e) {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
if (e.getSource() == active && mCurrentAct != null) {
mCurrentAct.active = active.isSelected();
return;
@@ -142,14 +144,14 @@ public class TransitionPanel extends SelectedVertexPanel implements ActionListen 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(),
+ Job thisJob = new Job(mItem.getSystemKey(),
+ mCurrentAct.getPath(),
transition,
new StateMachine(mCurrentAct).simulate(transition),
mCurrentAct.getCurrentState(),
mCurrentAct.getName(),
mCurrentAct.getProperties(),
- mCurrentAct.getType(),
+ mCurrentAct.getType(),
MainFrame.userAgent.getName());
try {
Executor selectedExecutor = (Executor)executors.getSelectedItem();
@@ -160,10 +162,11 @@ public class TransitionPanel extends SelectedVertexPanel implements ActionListen Logger.error(ex);
JOptionPane.showMessageDialog(null, ex.getMessage(), className, JOptionPane.ERROR_MESSAGE);
}
-
+
}
- public void clear() {
+ @Override
+ public void clear() {
mCurrentAct = null;
transBox.removeAll();
status.setText("No activity selected");
@@ -173,8 +176,8 @@ public class TransitionPanel extends SelectedVertexPanel implements ActionListen active.setEnabled(false);
revalidate();
}
-
-
+
+
/**
* @param item The mItem to set.
*/
diff --git a/source/com/c2kernel/lifecycle/instance/gui/view/WfDirectedEdgeRenderer.java b/source/com/c2kernel/lifecycle/instance/gui/view/WfDirectedEdgeRenderer.java index 09dba77..f39d9a6 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/gui/view/WfDirectedEdgeRenderer.java +++ b/source/com/c2kernel/lifecycle/instance/gui/view/WfDirectedEdgeRenderer.java @@ -4,6 +4,7 @@ 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;
@@ -17,6 +18,7 @@ public class WfDirectedEdgeRenderer implements DirectedEdgeRenderer mArrowTemplate.lineTo(0, 0);
mArrowTemplate.lineTo(5, 5);
}
+ @Override
public void draw(Graphics2D g2d, DirectedEdge directedEdge)
{
GraphPoint originPoint = directedEdge.getOriginPoint();
@@ -87,7 +89,7 @@ public class WfDirectedEdgeRenderer implements DirectedEdgeRenderer if (text != null)
g2d.drawString(text, midPoint.x + 10, midPoint.y);
}
- private double calcArrowAngle(int originX, int originY, int terminusX, int terminusY)
+ private static double calcArrowAngle(int originX, int originY, int terminusX, int terminusY)
{
double width = terminusX - originX;
double height = terminusY - originY;
diff --git a/source/com/c2kernel/lifecycle/instance/gui/view/WfVertexRenderer.java b/source/com/c2kernel/lifecycle/instance/gui/view/WfVertexRenderer.java index 1e731e0..92a1021 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/gui/view/WfVertexRenderer.java +++ b/source/com/c2kernel/lifecycle/instance/gui/view/WfVertexRenderer.java @@ -13,7 +13,8 @@ public class WfVertexRenderer implements VertexRenderer protected ActivityRenderer mActivityRenderer = new ActivityRenderer();
protected SplitJoinRenderer mSplitJoinRenderer = new SplitJoinRenderer();
- public void draw( Graphics2D g2d, Vertex vertex)
+ @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 index 27759be..b61187c 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/AddC2KObject.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/AddC2KObject.java @@ -37,7 +37,8 @@ public class AddC2KObject extends PredefinedStep }
//requestdata is xmlstring
- public void request( AgentPath agent, int transitionID, String requestData)
+ @Override
+ public void request( AgentPath agent, int transitionID, String requestData)
throws AccessRightsException,
InvalidTransitionException,
InvalidDataException
@@ -54,7 +55,7 @@ public class AddC2KObject extends PredefinedStep {
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);
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/AddDomainPath.java b/source/com/c2kernel/lifecycle/instance/predefined/AddDomainPath.java index 6756895..2cf619e 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/AddDomainPath.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/AddDomainPath.java @@ -29,7 +29,8 @@ public class AddDomainPath extends PredefinedStep }
//requestdata is xmlstring
- public void request( AgentPath agent, int transitionID, String requestData)
+ @Override
+ public void request( AgentPath agent, int transitionID, String requestData)
throws AccessRightsException,
InvalidTransitionException,
InvalidDataException
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/AddStepsFromDescription.java b/source/com/c2kernel/lifecycle/instance/predefined/AddStepsFromDescription.java index c4fab0c..f70c053 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/AddStepsFromDescription.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/AddStepsFromDescription.java @@ -21,6 +21,7 @@ public class AddStepsFromDescription extends PredefinedStep super();
}
+ @Override
public void request( AgentPath agent, int transitionID, String requestData)
throws AccessRightsException, InvalidTransitionException, InvalidDataException
{
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/AssignItemToSlot.java b/source/com/c2kernel/lifecycle/instance/predefined/AssignItemToSlot.java index 88f89c3..40fe740 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/AssignItemToSlot.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/AssignItemToSlot.java @@ -11,7 +11,6 @@ package com.c2kernel.lifecycle.instance.predefined;
-import java.util.Iterator;
import com.c2kernel.collection.Collection;
import com.c2kernel.collection.CollectionMember;
@@ -41,14 +40,15 @@ public class AssignItemToSlot extends PredefinedStep super();
}
-
+
/**
* Params:
* 0 - collection name
* 1 - slot number
* 2 - target entity key
*/
- public void request(AgentPath agent, int transitionID, String requestData)
+ @Override
+ public void request(AgentPath agent, int transitionID, String requestData)
throws AccessRightsException,
InvalidTransitionException,
InvalidDataException
@@ -57,35 +57,35 @@ public class AssignItemToSlot extends PredefinedStep String collName;
int slotNo;
int entityKey;
- Collection coll;
+ Collection<?> 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]);
+ entityKey = Integer.parseInt(params[2]);
} catch (Exception e) {
throw new InvalidDataException("Invalid parameters", "");
}
-
+
// load collection
try {
- coll = (Collection)Gateway.getStorage().get(entityPath.getSysKey(), ClusterStorage.COLLECTION+"/"+collName, null);
+ coll = (Collection<?>)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 (Iterator iter = coll.getMembers().list.iterator(); iter.hasNext();) {
- CollectionMember member = (CollectionMember)iter.next();
+ 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", "");
@@ -101,8 +101,8 @@ public class AssignItemToSlot extends PredefinedStep if (!stored) {
throw new InvalidDataException("Member slot "+slotNo+" not found.", "");
}
-
-
+
+
try {
Gateway.getStorage().put(entityPath.getSysKey(), coll, null);
} catch (ClusterStorageException e) {
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java b/source/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java index 7bedc81..ad92052 100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java @@ -55,6 +55,7 @@ public class CreateItemFromDescription extends PredefinedStep }
//requestdata is xmlstring
+ @Override
public void request(AgentPath agent, int transitionID, String requestData)
throws AccessRightsException, InvalidTransitionException, InvalidDataException,ObjectAlreadyExistsException
{
@@ -65,66 +66,66 @@ public class CreateItemFromDescription extends PredefinedStep 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
+ // 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.");
-
+ 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 (int i = 0; i < collNames.length; i++) {
- Collection thisCol = (Collection)storage.get(myPath.getSysKey(), ClusterStorage.COLLECTION+"/"+collNames[i], null);
+ for (String collName : collNames) {
+ Collection<?> thisCol = (Collection<?>)storage.get(myPath.getSysKey(), ClusterStorage.COLLECTION+"/"+collName, null);
if (thisCol instanceof CollectionDescription) {
- CollectionDescription thisDesc = (CollectionDescription)thisCol;
- collections.add(CastorXMLUtility.marshall(thisDesc.newInstance()));
+ CollectionDescription<?> thisDesc = (CollectionDescription<?>)thisCol;
+ collections.add(CastorXMLUtility.marshall(thisDesc.newInstance()));
}
else if (thisCol.getName().equals("Workflow") && wfDefName == null) {
- ArrayList members = thisCol.getMembers().list;
+ ArrayList<?> members = thisCol.getMembers().list;
// get the first member from the wf collection
CollectionMember wfMember = (CollectionMember)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", "");
+ 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());
for (int i = 0; i < pdList.list.size(); i++) {
- PropertyDescription pd = (PropertyDescription) pdList.list.get(i);
+ PropertyDescription pd = pdList.list.get(i);
String propName = pd.getName();
- String propVal = pd.getDefaultValue();
+ String propVal = pd.getDefaultValue();
if (propName.equals("Name"))
propVal = newName;
- props.list.add( new Property(propName, propVal));
+ props.list.add( new Property(propName, propVal));
}
props.list.add( new Property("Creator", agent.getAgentName()));
-
+
/* ITEM CREATION */
// generate new entity key
@@ -132,8 +133,8 @@ public class CreateItemFromDescription extends PredefinedStep EntityPath entityPath = lookup.getNextKeyManager().generateNextEntityKey();
// resolve the item factory
- Logger.msg(6, "CreateItemFromDescription - Resolving item factory");
-
+ Logger.msg(6, "CreateItemFromDescription - Resolving item factory");
+
// create the Item object
Logger.msg(3, "CreateItemFromDescription - Creating Item");
CorbaServer factory = Gateway.getCorbaServer();
@@ -141,26 +142,26 @@ public class CreateItemFromDescription extends PredefinedStep 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 iter = collections.iterator(); iter.hasNext();) {
- colls[0] = (String)iter.next();
- newItem.requestAction(agent.getSysKey(), "workflow/predefined/AddC2KObject", Transitions.COMPLETE, PredefinedStep.bundleData(colls));
+ 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);
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/Erase.java b/source/com/c2kernel/lifecycle/instance/predefined/Erase.java index 5c04f93..07d76b1 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/Erase.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/Erase.java @@ -40,7 +40,8 @@ public class Erase extends PredefinedStep }
//requestdata is xmlstring
- public void request(AgentPath agent, int transitionID, String requestData)
+ @Override
+ public void request(AgentPath agent, int transitionID, String requestData)
throws AccessRightsException,
InvalidTransitionException,
InvalidDataException
@@ -51,22 +52,22 @@ public class Erase extends PredefinedStep try
{
EntityPath entityPath = getItemEntityPath();
-
+
// find entity name
Property name = (Property)Gateway.getStorage().get(entityPath.getSysKey(), ClusterStorage.PROPERTY+"/Name", null);
-
+
// get all domain paths
- Enumeration domPaths = Gateway.getLDAPLookup().search(new DomainPath(), name.getValue());
+ Enumeration<?> 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);
}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/Import.java b/source/com/c2kernel/lifecycle/instance/predefined/Import.java index 36b7fc9..2f99937 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/Import.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/Import.java @@ -7,7 +7,9 @@ package com.c2kernel.lifecycle.instance.predefined;
-import com.c2kernel.common.*;
+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;
@@ -15,7 +17,7 @@ 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
@@ -29,7 +31,8 @@ public class Import extends PredefinedStep }
//requestdata is xmlstring
- public void request( AgentPath agent, int transitionID, String requestData)
+ @Override
+ public void request( AgentPath agent, int transitionID, String requestData)
throws AccessRightsException,
InvalidTransitionException,
InvalidDataException
@@ -41,11 +44,11 @@ public class Import extends PredefinedStep 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;
@@ -55,14 +58,14 @@ public class Import extends PredefinedStep }
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 index 8d95438..8aec993 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/PredefinedStep.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/PredefinedStep.java @@ -1,8 +1,10 @@ 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;
@@ -13,6 +15,7 @@ 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;
/***********************************************************************************************************************************************************************************************************************************************************************************************************
@@ -25,6 +28,7 @@ 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)
@@ -32,6 +36,7 @@ public class PredefinedStep extends Activity else
return super.getActive();
}
+ @Override
public String getTransitions()
{
if (isPredefined)
@@ -39,6 +44,7 @@ public class PredefinedStep extends Activity else
return super.getTransitions();
}
+ @Override
public String getErrors()
{
if (isPredefined)
@@ -46,6 +52,7 @@ public class PredefinedStep extends Activity else
return super.getErrors();
}
+ @Override
public boolean verify()
{
if (isPredefined)
@@ -55,7 +62,7 @@ public class PredefinedStep extends Activity }
/**
* Returns the isPredefined.
- *
+ *
* @return boolean
*/
public boolean getIsPredefined()
@@ -64,7 +71,7 @@ public class PredefinedStep extends Activity }
/**
* Sets the isPredefined.
- *
+ *
* @param isPredefined
* The isPredefined to set
*/
@@ -72,6 +79,7 @@ public class PredefinedStep extends Activity {
this.isPredefined = isPredefined;
}
+ @Override
public String getType()
{
return getName();
@@ -86,10 +94,9 @@ public class PredefinedStep extends Activity Document dom = builder.newDocument();
Element root = dom.createElement("PredefinedStepOutcome");
dom.appendChild(root);
- for (int i = 0; i < data.length; i++)
- {
+ for (String element : data) {
Element param = dom.createElement("param");
- Text t = dom.createTextNode(data[i]);
+ Text t = dom.createTextNode(element);
param.appendChild(t);
root.appendChild(param);
}
@@ -104,15 +111,15 @@ public class PredefinedStep extends Activity StringWriter stringOut = new StringWriter();
XMLSerializer serial = new XMLSerializer(stringOut, format);
serial.asDOMSerializer();
- serial.serialize(dom);
+ serial.serialize(dom);
return stringOut.toString();
}
catch (Exception e)
{
Logger.error(e);
StringBuffer xmlData = new StringBuffer().append("<PredefinedStepOutcome>");
- for (int i = 0; i < data.length; i++)
- xmlData.append("<param><![CDATA[").append(data[i]).append("]]></param>");
+ for (String element : data)
+ xmlData.append("<param><![CDATA[").append(element).append("]]></param>");
xmlData.append("</PredefinedStepOutcome>");
return xmlData.toString();
}
@@ -130,7 +137,7 @@ public class PredefinedStep extends Activity 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();
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/PredefinedStepContainer.java b/source/com/c2kernel/lifecycle/instance/predefined/PredefinedStepContainer.java index 10a9d12..d065afb 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/PredefinedStepContainer.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/PredefinedStepContainer.java @@ -4,12 +4,12 @@ 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");
+ getProperties().put("Description", "Contains all predefined Steps");
createChildren();
}
public void createChildren()
@@ -26,7 +26,7 @@ public class PredefinedStepContainer extends CompositeActivity 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);
@@ -38,18 +38,22 @@ public class PredefinedStepContainer extends CompositeActivity 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 index 8004488..c9513a8 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/RemoveC2KObject.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/RemoveC2KObject.java @@ -35,7 +35,8 @@ public class RemoveC2KObject extends PredefinedStep }
//requestdata is xmlstring
- public void request(AgentPath agent, int transitionID, String requestData)
+ @Override
+ public void request(AgentPath agent, int transitionID, String requestData)
throws AccessRightsException,
InvalidTransitionException,
InvalidDataException
@@ -51,7 +52,7 @@ public class RemoveC2KObject extends PredefinedStep Logger.msg(5, "RemoveC2KObject::request() - path:"+path);
- Gateway.getStorage().remove( entityPath.getSysKey(), path, null );
+ Gateway.getStorage().remove( entityPath.getSysKey(), path, null );
sendEventStoreOutcome(transitionID, requestData, agent);
}
catch( Exception ex )
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java b/source/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java index af118e5..19ff7c6 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java @@ -27,7 +27,8 @@ public class RemoveDomainPath extends PredefinedStep }
//requestdata is xmlstring
- public void request( AgentPath agent, int transitionID, String requestData)
+ @Override
+ public void request( AgentPath agent, int transitionID, String requestData)
throws AccessRightsException,
InvalidTransitionException,
InvalidDataException
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/ReplaceDomainWorkflow.java b/source/com/c2kernel/lifecycle/instance/predefined/ReplaceDomainWorkflow.java index e8c6a6f..ba3e6c6 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/ReplaceDomainWorkflow.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/ReplaceDomainWorkflow.java @@ -20,6 +20,7 @@ public class ReplaceDomainWorkflow extends PredefinedStep super();
}
+ @Override
public void request( AgentPath agent, int transitionID, String requestData)
throws AccessRightsException, InvalidTransitionException, InvalidDataException
{
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/ServerPredefinedStepContainer.java b/source/com/c2kernel/lifecycle/instance/predefined/ServerPredefinedStepContainer.java index 363d1fc..21eacda 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/ServerPredefinedStepContainer.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/ServerPredefinedStepContainer.java @@ -17,13 +17,14 @@ import com.c2kernel.lifecycle.instance.predefined.entitycreation.CreateNewItem; public class ServerPredefinedStepContainer extends PredefinedStepContainer {
- public void createChildren()
+ @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);
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/WriteProperty.java b/source/com/c2kernel/lifecycle/instance/predefined/WriteProperty.java index da526a2..77a0b43 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/WriteProperty.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/WriteProperty.java @@ -36,7 +36,8 @@ public class WriteProperty extends PredefinedStep }
//requestdata is xmlstring
- public void request( AgentPath agent, int transitionID, String requestData)
+ @Override
+ public void request( AgentPath agent, int transitionID, String requestData)
throws AccessRightsException,
InvalidTransitionException,
InvalidDataException
@@ -56,7 +57,7 @@ public class WriteProperty extends PredefinedStep {
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);
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Aggregation.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Aggregation.java index 3677220..073d662 100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Aggregation.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Aggregation.java @@ -5,20 +5,20 @@ import java.util.ArrayList; public class Aggregation implements java.io.Serializable {
public boolean isDescription;
- public ArrayList aggregationMemberList;
+ public ArrayList<?> aggregationMemberList;
public String name;
public Aggregation() {
super();
- aggregationMemberList = new ArrayList();
- }
-
+ aggregationMemberList = new ArrayList<Object>();
+ }
+
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 index 87baa1d..29d3cf9 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/AggregationMember.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/AggregationMember.java @@ -11,7 +11,7 @@ public class AggregationMember implements java.io.Serializable { public AggregationMember() {
super();
}
-
+
public AggregationMember(int slotNo, String itemDescPath, String itemPath, Geometry geometry) {
this.slotNo = slotNo;
this.itemDescriptionPath = itemDescPath;
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/CreateNewAgent.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/CreateNewAgent.java index b0eaaec..96371dd 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/CreateNewAgent.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/CreateNewAgent.java @@ -26,7 +26,8 @@ public class CreateNewAgent extends PredefinedStep }
//requestdata is xmlstring
- public void request( AgentPath agent, int transitionID, String requestData)
+ @Override
+ public void request( AgentPath agent, int transitionID, String requestData)
throws AccessRightsException,
InvalidTransitionException,
InvalidDataException
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/CreateNewItem.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/CreateNewItem.java index 49f8ada..a66b062 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/CreateNewItem.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/CreateNewItem.java @@ -26,7 +26,8 @@ public class CreateNewItem extends PredefinedStep }
//requestdata is xmlstring
- public void request( AgentPath agent, int transitionID, String requestData)
+ @Override
+ public void request( AgentPath agent, int transitionID, String requestData)
throws AccessRightsException,
InvalidTransitionException,
InvalidDataException
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Dependency.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Dependency.java index 0896534..311c108 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Dependency.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Dependency.java @@ -1,7 +1,6 @@ package com.c2kernel.lifecycle.instance.predefined.entitycreation;
import java.util.ArrayList;
-import java.util.Iterator;
import com.c2kernel.collection.MembershipException;
import com.c2kernel.lookup.DomainPath;
@@ -12,13 +11,13 @@ public class Dependency implements java.io.Serializable { public String name;
public boolean isDescription;
public String itemDescriptionPath;
- public ArrayList dependencyMemberList;
+ public ArrayList<?> dependencyMemberList;
public Dependency() {
super();
- dependencyMemberList = new ArrayList();
- }
-
+ dependencyMemberList = new ArrayList<Object>();
+ }
+
public Dependency(String itemDesc) {
this();
this.itemDescriptionPath = itemDesc;
@@ -33,8 +32,8 @@ public class Dependency implements java.io.Serializable { PropertyUtility.getPropertyDescriptionOutcome(new DomainPath(itemDescriptionPath).getSysKey());
//TODO: set props and class identifiers
}
- for (Iterator mems = dependencyMemberList.iterator(); mems.hasNext();) {
- DependencyMember thisMem = (DependencyMember) mems.next();
+ for (Object name2 : dependencyMemberList) {
+ DependencyMember thisMem = (DependencyMember) name2;
int syskey = new DomainPath(thisMem.itemPath).getSysKey();
if (syskey == -1)
throw new MembershipException("Cannot find "+thisMem.itemPath+" specified for collection.");
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/DependencyMember.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/DependencyMember.java index 00ac445..b70619f 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/DependencyMember.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/DependencyMember.java @@ -9,10 +9,10 @@ public class DependencyMember implements java.io.Serializable { 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 index 25a1455..f18b6d4 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Geometry.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Geometry.java @@ -25,5 +25,5 @@ public class Geometry implements java.io.Serializable { 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 index fa575a3..30b80c4 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java @@ -2,7 +2,6 @@ package com.c2kernel.lifecycle.instance.predefined.entitycreation; import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
-import java.util.Iterator;
import com.c2kernel.common.CannotManageException;
import com.c2kernel.common.ObjectAlreadyExistsException;
@@ -21,19 +20,19 @@ public class NewAgent implements java.io.Serializable { public String name;
public String password;
-
- public ArrayList roles;
+
+ public ArrayList<?> roles;
public NewAgent() {
super();
- roles = new ArrayList();
- }
-
+ roles = new ArrayList<Object>();
+ }
+
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);
@@ -50,8 +49,8 @@ public class NewAgent implements java.io.Serializable { Logger.error(ex);
throw new CannotManageException("Error initialising new agent");
}
- for (Iterator iter = roles.iterator(); iter.hasNext();) {
- String role = (String) iter.next();
+ for (Object name2 : roles) {
+ String role = (String) name2;
RolePath thisRole;
try {
thisRole = Gateway.getLDAPLookup().getRoleManager().getRolePath(role);
@@ -60,6 +59,6 @@ public class NewAgent implements java.io.Serializable { }
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 index 32ca623..339e294 100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewItem.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewItem.java @@ -2,7 +2,6 @@ package com.c2kernel.lifecycle.instance.predefined.entitycreation; import java.util.ArrayList;
-import java.util.Iterator;
import com.c2kernel.collection.MembershipException;
import com.c2kernel.common.CannotManageException;
@@ -22,7 +21,7 @@ import com.c2kernel.utils.Logger; /**
* Complete Structure for new item
- *
+ *
* @version $Revision: 1.8 $ $Date: 2006/03/03 13:52:21 $
*/
public class NewItem {
@@ -48,31 +47,30 @@ public class NewItem { /**
* Field _aggregationList
*/
- public ArrayList aggregationList;
+ public ArrayList<?> aggregationList;
/**
* Field _dependencyList
*/
- public ArrayList dependencyList;
+ public ArrayList<?> dependencyList;
public NewItem() {
super();
propertyList = new ArrayList<Property>();
- aggregationList = new ArrayList();
- dependencyList = new ArrayList();
+ aggregationList = new ArrayList<Object>();
+ dependencyList = new ArrayList<Object>();
}
-
+
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 (Iterator iter = propertyList.iterator(); iter.hasNext();) {
- Property prop = (Property) iter.next();
+ for (Property prop : propertyList) {
if (prop.name.equals(name)) {
prop.value = value;
return;
@@ -80,30 +78,29 @@ public class NewItem { }
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 (Iterator iter = propertyList.iterator(); iter.hasNext();) {
- Property element = (Property) iter.next();
+ 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),
@@ -113,11 +110,11 @@ public class NewItem { Logger.error(ex);
throw new CannotManageException("Problem initialising new item. See server log.", "");
}
-
+
// create collections
-
- for (Iterator iter = dependencyList.iterator(); iter.hasNext();) {
- Dependency element = (Dependency) iter.next();
+
+ for (Object name2 : dependencyList) {
+ Dependency element = (Dependency) name2;
try {
Gateway.getStorage().put(entPath.getSysKey(), element.create(), null);
} catch (ClusterStorageException ex) {
@@ -128,9 +125,9 @@ public class NewItem { throw new CannotManageException("A specified member is not of the correct type in "+element.name, "");
}
}
-
- for (Iterator iter = aggregationList.iterator(); iter.hasNext();) {
- Aggregation element = (Aggregation) iter.next();
+
+ for (Object name2 : aggregationList) {
+ Aggregation element = (Aggregation) name2;
try {
Gateway.getStorage().put(entPath.getSysKey(), element.create(), null);
} catch (ClusterStorageException ex) {
@@ -140,6 +137,6 @@ public class NewItem { }
// register domain path
domPath.setEntity(entPath);
- Gateway.getLDAPLookup().add(domPath);
+ 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 index d99a3e3..e2d214c 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Property.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Property.java @@ -1,7 +1,7 @@ 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 {
diff --git a/source/com/c2kernel/lifecycle/instance/stateMachine/StateMachine.java b/source/com/c2kernel/lifecycle/instance/stateMachine/StateMachine.java index da7419c..8159106 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/stateMachine/StateMachine.java +++ b/source/com/c2kernel/lifecycle/instance/stateMachine/StateMachine.java @@ -15,12 +15,12 @@ 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.
@@ -28,11 +28,11 @@ public class StateMachine implements Serializable */
public StateMachine(Activity act)
{
- 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)
+ * 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()
@@ -49,14 +49,14 @@ public class StateMachine implements Serializable /*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;
+ return returnArray;
}
/**
* @see java.lang.Object#Object()
*/
public StateMachine()
- {
+ {
}
/**
@@ -77,10 +77,10 @@ public class StateMachine implements Serializable 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;
-
+ if (getCurrentMachine()[state][i]!=-1) trans[cmpt++]=i;
+
int [] result = new int[cmpt];
- for (int i=0;i<cmpt;i++) result[i] = trans[i];
+ for (int i=0;i<cmpt;i++) result[i] = trans[i];
return result;
}
@@ -93,7 +93,7 @@ public class StateMachine implements Serializable {
int newState = getCurrentMachine()[state][transition];
if (newState > -1) {
- state=newState;
+ state=newState;
return true;
}
Logger.msg("StateMachine.traverse() - Illegal transition "+Transitions.getTransitionName(transition)+" from "+States.getStateName(state));
@@ -138,5 +138,5 @@ public class StateMachine implements Serializable {
return activity.getActive();
}
-
+
}
diff --git a/source/com/c2kernel/lifecycle/instance/stateMachine/States.java b/source/com/c2kernel/lifecycle/instance/stateMachine/States.java index 638a7b0..b142e35 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/stateMachine/States.java +++ b/source/com/c2kernel/lifecycle/instance/stateMachine/States.java @@ -20,7 +20,7 @@ public class States 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;
diff --git a/source/com/c2kernel/lifecycle/instance/stateMachine/Transitions.java b/source/com/c2kernel/lifecycle/instance/stateMachine/Transitions.java index 6597686..4239baa 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/stateMachine/Transitions.java +++ b/source/com/c2kernel/lifecycle/instance/stateMachine/Transitions.java @@ -26,11 +26,11 @@ public class Transitions 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)
|
