diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2013-07-23 09:41:43 +0200 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2013-09-16 12:44:14 +0200 |
| commit | e99ed30f6cae36c5f3fa03007d991e67894a01bb (patch) | |
| tree | 5fdfe6aab9e31ebd8c282eb16d42c5e2f75b1217 | |
| parent | 0bb38e90ac6e88cb406facbc075983384a2e164f (diff) | |
More
24 files changed, 507 insertions, 505 deletions
diff --git a/src/main/java/com/c2kernel/entity/TraceableEntity.java b/src/main/java/com/c2kernel/entity/TraceableEntity.java index 83c30a2..4152ab5 100644 --- a/src/main/java/com/c2kernel/entity/TraceableEntity.java +++ b/src/main/java/com/c2kernel/entity/TraceableEntity.java @@ -21,7 +21,6 @@ import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.agent.JobArrayList;
import com.c2kernel.lifecycle.instance.CompositeActivity;
import com.c2kernel.lifecycle.instance.Workflow;
-import com.c2kernel.lifecycle.instance.stateMachine.Transitions;
import com.c2kernel.lookup.AgentPath;
import com.c2kernel.lookup.InvalidEntityPathException;
import com.c2kernel.persistency.ClusterStorage;
@@ -183,13 +182,14 @@ public class TraceableEntity extends ItemPOA try {
Logger.msg(1, "TraceableEntity::request("+mSystemKey+") - " +
- Transitions.getTransitionName(transitionID) + " "+stepPath + " by " +agentId );
+ transitionID + " "+stepPath + " by " +agentId );
AgentPath agent = new AgentPath(agentId);
Workflow lifeCycle = (Workflow)mStorage.get(mSystemKey, ClusterStorage.LIFECYCLE+"/workflow", null);
lifeCycle.requestAction( agent,
stepPath,
+ mSystemKey,
transitionID,
requestData );
@@ -251,7 +251,7 @@ public class TraceableEntity extends ItemPOA Workflow wf = (Workflow)mStorage.get(mSystemKey, ClusterStorage.LIFECYCLE+"/workflow", null);
JobArrayList jobBag = new JobArrayList();
CompositeActivity domainWf = (CompositeActivity)wf.search("workflow/domain");
- jobBag.list = filter?domainWf.calculateJobs(agent, true):domainWf.calculateAllJobs(agent, true);
+ jobBag.list = filter?domainWf.calculateJobs(agent, mSystemKey, true):domainWf.calculateAllJobs(agent, mSystemKey, true);
Logger.msg(1, "TraceableEntity::queryLifeCycle("+mSystemKey+") - Returning "+jobBag.list.size()+" jobs.");
return Gateway.getMarshaller().marshall( jobBag );
}
diff --git a/src/main/java/com/c2kernel/entity/agent/ActiveEntity.java b/src/main/java/com/c2kernel/entity/agent/ActiveEntity.java index d20fc1e..4c14cff 100644 --- a/src/main/java/com/c2kernel/entity/agent/ActiveEntity.java +++ b/src/main/java/com/c2kernel/entity/agent/ActiveEntity.java @@ -247,7 +247,7 @@ public class ActiveEntity extends AgentPOA // merge new jobs in
for (Object name : newJobList.list) {
Job newJob = (Job)name;
- Logger.msg(6, "Adding job for "+newJob.getItemSysKey()+"/"+newJob.getStepPath()+":"+newJob.getPossibleTransition());
+ Logger.msg(6, "Adding job for "+newJob.getItemSysKey()+"/"+newJob.getStepPath()+":"+newJob.getTransitionId());
currentJobs.addJob(newJob);
}
diff --git a/src/main/java/com/c2kernel/entity/agent/Job.java b/src/main/java/com/c2kernel/entity/agent/Job.java index f1aa215..f2a401a 100644 --- a/src/main/java/com/c2kernel/entity/agent/Job.java +++ b/src/main/java/com/c2kernel/entity/agent/Job.java @@ -1,14 +1,18 @@ package com.c2kernel.entity.agent;
+import com.c2kernel.common.InvalidDataException;
import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.entity.C2KLocalObject;
import com.c2kernel.entity.proxy.AgentProxy;
import com.c2kernel.entity.proxy.ItemProxy;
-import com.c2kernel.lifecycle.instance.stateMachine.Transitions;
+import com.c2kernel.lifecycle.instance.Activity;
+import com.c2kernel.lifecycle.instance.stateMachine.Transition;
+import com.c2kernel.lookup.AgentPath;
import com.c2kernel.lookup.EntityPath;
import com.c2kernel.lookup.InvalidEntityPathException;
import com.c2kernel.persistency.ClusterStorage;
import com.c2kernel.persistency.outcome.Outcome;
+import com.c2kernel.persistency.outcome.Schema;
import com.c2kernel.persistency.outcome.Viewpoint;
import com.c2kernel.process.Gateway;
import com.c2kernel.scripting.ErrorInfo;
@@ -22,35 +26,49 @@ import com.c2kernel.utils.Logger; ******************************************************************************/
public class Job implements C2KLocalObject
{
- private int mID;
+ // persistent
+
+ private int id;
- private String mName;
+ private int itemSysKey;
- private int mItemSysKey;
-
- private String mStepPath;
-
- private int mPossibleTransition;
-
- private int mCurrentState;
-
- private int mTargetState;
-
- private String mStepName;
+ private String stepName;
+
+ private String stepPath;
+
+ private String stepType;
+
+ private int transitionId;
- private int mAgentId = -1;
+ private int currentStateId;
- private String mAgentName;
+ private int targetStateId;
- private String mAgentRole;
+ private int agentId = -1;
- private CastorHashMap mActProps = new CastorHashMap();
+ private String agentRole;
- private String mOutcome;
+ private String schemaName;
- private ErrorInfo mError;
-
- private String mStepType;
+ private int schemaVersion;
+
+ private boolean outcomeRequired;
+
+ private String scriptName;
+
+ private int scriptVersion;
+
+ private CastorHashMap actProps = new CastorHashMap();
+
+ // non-persistent
+
+ private String name;
+
+ private String agentName;
+
+ private String outcomeData;
+
+ private ErrorInfo error;
private ItemProxy item = null;
@@ -65,36 +83,205 @@ public class Job implements C2KLocalObject {
}
- /***************************************************************************
- *
- **************************************************************************/
- public Job(int sysKey, String path, int transition, int currState, int targState, String stepName, CastorHashMap actProps, String stepType, String agentName)
+ public Job(Activity act, int itemSysKey, Transition transition, AgentPath agent, String role) throws InvalidDataException, ObjectNotFoundException {
+
+ setItemSysKey(itemSysKey);
+ setStepPath(act.getPath());
+ setTransitionId(transition.getId());
+ setCurrentStateId(transition.getOriginStateCode());
+ setTargetStateId(transition.getTerminalStateCode());
+ setStepName(act.getName());
+ setActProps(act.getProperties());
+ setStepType(act.getType());
+ setAgentName(agent.getAgentName());
+ setAgentRole(role);
+
+ if (transition.hasOutcome()) {
+ Schema schema = transition.getSchema(act.getProperties());
+ setSchemaName(schema.docType);
+ setSchemaVersion(schema.docVersion);
+ outcomeRequired = transition.getOutcome().isRequired();
+ }
+
+ if (transition.hasScript()) {
+ setScriptName(transition.getScript().getScriptName());
+ setScriptVersion(Integer.parseInt(transition.getScript().getScriptVersion()));
+ }
+ }
+
+
+ // Castor persistent fields
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ name = String.valueOf(id);
+ }
+
+ public int getItemSysKey() {
+ return itemSysKey;
+ }
+
+ public void setItemSysKey(int sysKey) {
+ itemSysKey = sysKey;
+ item = null;
+ }
+
+ public String getStepName() {
+ return stepName;
+ }
+
+ public void setStepName(String string) {
+ stepName = string;
+ }
+
+ public String getStepPath() {
+ return stepPath;
+ }
+
+ public void setStepPath(String string) {
+ stepPath = string;
+ }
+
+ public String getStepType() {
+ return stepType;
+ }
+
+ public void setStepType(String actType) {
+ stepType = actType;
+ }
+
+ public int getTransitionId() {
+ return transitionId;
+ }
+
+ public void setTransitionId(int tid) {
+ transitionId = tid;
+ }
+
+ public int getCurrentStateId() {
+ return currentStateId;
+ }
+
+ public void setCurrentStateId(int stateId) {
+ currentStateId = stateId;
+ }
+
+ public int getTargetStateId() {
+ return targetStateId;
+ }
+
+ public void setTargetStateId(int targetStateId) {
+ this.targetStateId = targetStateId;
+ }
+
+ public int getAgentId() throws ObjectNotFoundException {
+ if (agentId == -1)
+ agentId = Gateway.getLDAPLookup().getRoleManager().getAgentPath(getAgentName()).getSysKey();
+ return agentId;
+ }
+
+ public void setAgentId(int id) {
+ agentId = id;
+ agent = null;
+ }
+
+ public String getAgentName()
{
- setItemSysKey(sysKey);
- setStepPath(path);
- setPossibleTransition(transition);
- setCurrentState(currState);
- setTargetState(targState);
- setStepName(stepName);
- setActProps(actProps);
- setStepType(stepType);
- setAgentName(agentName);
- }
-
- public int getItemSysKey()
+ if (agentName == null)
+ agentName = (String) actProps.get("Agent Name");
+ return agentName;
+ }
+
+ public void setAgentName(String agentName)
{
- return mItemSysKey;
+ this.agentName = agentName;
+ }
+
+ public String getAgentRole() {
+ return agentRole;
}
- public ItemProxy getItemProxy() throws ObjectNotFoundException, InvalidEntityPathException
+ public void setAgentRole(String role) {
+ agentRole = role;
+ }
+
+ public String getSchemaName() {
+ return schemaName;
+ }
+
+ public void setSchemaName(String schemaName) {
+ this.schemaName = schemaName;
+ }
+
+ public int getSchemaVersion() {
+ return schemaVersion;
+ }
+
+ public void setSchemaVersion(int schemaVersion) {
+ this.schemaVersion = schemaVersion;
+ }
+
+ public boolean isOutcomeRequired()
{
+ return outcomeRequired;
+ }
+
+ public void setOutcomeRequired(boolean outcomeRequired) {
+ this.outcomeRequired = outcomeRequired;
+ }
+
+ public String getScriptName() {
+ return scriptName;
+ }
+
+ public void setScriptName(String scriptName) {
+ this.scriptName = scriptName;
+ }
+
+ public int getScriptVersion() {
+ return scriptVersion;
+ }
+
+ public void setScriptVersion(int scriptVersion) {
+ this.scriptVersion = scriptVersion;
+ }
+
+ public KeyValuePair[] getKeyValuePairs() {
+ return actProps.getKeyValuePairs();
+ }
+
+ public void setKeyValuePairs(KeyValuePair[] pairs) {
+ actProps.setKeyValuePairs(pairs);
+ }
+
+ // Non-persistent fields
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public void setName(String name) {
+ this.name = name;
+ try {
+ id = Integer.parseInt(name);
+ } catch (NumberFormatException ex) {
+ id = -1;
+ }
+ }
+
+ public ItemProxy getItemProxy() throws ObjectNotFoundException, InvalidEntityPathException {
if (item == null)
- item = (ItemProxy) Gateway.getProxyManager().getProxy(new EntityPath(mItemSysKey));
+ item = (ItemProxy) Gateway.getProxyManager().getProxy(new EntityPath(itemSysKey));
return item;
}
- public AgentProxy getAgentProxy() throws ObjectNotFoundException, InvalidEntityPathException
- {
+ public AgentProxy getAgentProxy() throws ObjectNotFoundException, InvalidEntityPathException {
if (agent == null)
agent = (AgentProxy) Gateway.getProxyManager().getProxy(new EntityPath(getAgentId()));
return agent;
@@ -102,42 +289,22 @@ public class Job implements C2KLocalObject public String getDescription()
{
- String desc = (String) mActProps.get("Description");
+ String desc = (String) actProps.get("Description");
if (desc == null)
desc = "No Description";
return desc;
}
-
- public String getSchemaType()
- {
- if (isError()) return "Errors";
- if (requiresOutcome()) return (String)mActProps.get("SchemaType");
- else return null;
- }
-
- public int getSchemaVersion()
- {
- if (isError()) return 0;
- if (requiresOutcome())
- try {
- return Integer.parseInt((String) mActProps.get("SchemaVersion"));
- } catch (NumberFormatException ex) {
- return -1;
- }
- return -1;
- }
-
- public void setOutcome(String outcome)
+ public void setOutcome(String outcome)
{
- mOutcome = outcome;
- outcomeSet = !(mOutcome == null);
+ outcomeData = outcome;
+ outcomeSet = !(outcomeData == null);
}
public void setError(ErrorInfo errors)
{
- mError = errors;
+ error = errors;
try {
- mOutcome = Gateway.getMarshaller().marshall(mError);
+ outcomeData = Gateway.getMarshaller().marshall(error);
} catch (Exception e) {
Logger.error("Error marshalling ErrorInfo in job");
Logger.error(e);
@@ -146,121 +313,42 @@ public class Job implements C2KLocalObject public String getOutcomeString()
{
- if (mOutcome == null && requiresOutcome())
+ if (outcomeData == null && isOutcomeRequired())
{
String viewName = (String) getActProp("Viewpoint");
- mOutcome = null;
+ outcomeData = null;
if (viewName.length() > 0)
try
{
- Viewpoint view = (Viewpoint) Gateway.getStorage().get(getItemSysKey(), ClusterStorage.VIEWPOINT + "/" + getSchemaType() + "/" + viewName, null);
- mOutcome = view.getOutcome().getData();
+ Viewpoint view = (Viewpoint) Gateway.getStorage().get(getItemSysKey(), ClusterStorage.VIEWPOINT + "/" + getSchemaName() + "/" + viewName, null);
+ outcomeData = view.getOutcome().getData();
outcomeSet = true;
} catch (Exception ex)
{
- mOutcome = null;
+ outcomeData = null;
outcomeSet = false;
}
}
- return mOutcome;
+ return outcomeData;
}
public Outcome getOutcome()
{
- return new Outcome(-1, getOutcomeString(), getSchemaType(), getSchemaVersion());
- }
-
- public int getAgentId() throws ObjectNotFoundException
- {
- if (mAgentId == -1)
- mAgentId = Gateway.getLDAPLookup().getRoleManager().getAgentPath(getAgentName()).getSysKey();
- return mAgentId;
- }
-
- public void setAgentId(int id)
- {
- mAgentId = id;
- agent = null;
- }
-
- public String getAgentName()
- {
- if (mAgentName == null)
- mAgentName = (String) mActProps.get("AgentName");
- return mAgentName;
- }
-
- public void setAgentName(String agentName)
- {
- mAgentName = agentName;
- }
-
- public String getAgentRole()
- {
- if (mAgentRole == null)
- mAgentRole = (String) mActProps.get("Agent Role");
- return mAgentRole;
- }
-
- public void setAgentRole(String role)
- {
- mAgentRole = role;
- }
-
- public boolean requiresOutcome()
- {
- String schemaType = (String) mActProps.get("SchemaType");
- return (mPossibleTransition == Transitions.DONE || mPossibleTransition == Transitions.COMPLETE) && !(schemaType == null || schemaType.equals(""));
+ return new Outcome(-1, getOutcomeString(), getSchemaName(), getSchemaVersion());
}
- public boolean isError() {
- return (mPossibleTransition == Transitions.SUSPEND);
+ public boolean hasOutcome() {
+ return schemaName!=null;
}
- public boolean hasOutcome() {
- return requiresOutcome() || isError();
+ public boolean hasScript() {
+ return scriptName!=null;
}
public boolean isOutcomeSet() {
return outcomeSet;
- }
-
- public int getID()
- {
- return mID;
- }
-
- @Override
- public String getName()
- {
- return mName;
- }
-
- public void setID(int id)
- {
- mID = id;
- mName = String.valueOf(id);
- }
-
- @Override
- public void setName(String name)
- {
- mName = name;
- try
- {
- mID = Integer.parseInt(name);
- } catch (NumberFormatException ex)
- {
- mID = -1;
- }
- }
-
- public void setItemSysKey(int sysKey)
- {
- mItemSysKey = sysKey;
- item = null;
- }
+ }
@Override
public String getClusterType()
@@ -270,100 +358,59 @@ public class Job implements C2KLocalObject public boolean equals(Job job)
{
- return (getItemSysKey() == job.getItemSysKey()) && this.mStepPath.equals(job.mStepPath) && this.mPossibleTransition == job.mPossibleTransition;
+ return (getItemSysKey() == job.getItemSysKey()) && this.stepPath.equals(job.stepPath) && this.transitionId == job.transitionId;
+ }
+
+ private void setActProps(CastorHashMap actProps) {
+ this.actProps = actProps;
}
public Object getActProp(String name)
{
- return mActProps.get(name);
+ return actProps.get(name);
}
public String getActPropString(String name)
{
- try
- {
- return mActProps.get(name).toString();
- } catch (NullPointerException ex)
- {
- return null;
- }
- }
-
- public String getStepName()
- {
- return mStepName;
- }
-
- public void setStepName(String string)
- {
- mStepName = string;
+ return String.valueOf(actProps.get(name));
}
- public String getStepPath()
- {
- return mStepPath;
- }
- public void setStepPath(String string)
+ // Deprecated methods from old state machine
+
+ @Deprecated
+ public String getSchemaType()
{
- mStepPath = string;
+ return getSchemaName();
}
-
+
+ @Deprecated
public int getPossibleTransition()
{
- return mPossibleTransition;
+ return transitionId;
}
+ @Deprecated
public void setPossibleTransition(int lint)
{
- mPossibleTransition = lint;
+ transitionId = lint;
}
+ @Deprecated
public CastorHashMap getActProps()
{
- return mActProps;
- }
-
- public void setActProps(CastorHashMap map)
- {
- mActProps = map;
- }
-
- public KeyValuePair[] getKeyValuePairs()
- {
- return mActProps.getKeyValuePairs();
- }
-
- public void setKeyValuePairs(KeyValuePair[] pairs)
- {
- mActProps.setKeyValuePairs(pairs);
+ return actProps;
}
+ @Deprecated
public int getCurrentState()
{
- return mCurrentState;
- }
-
- public void setCurrentState(int string)
- {
- mCurrentState = string;
+ return getCurrentStateId();
}
+ @Deprecated
public int getTargetState() {
- return mTargetState;
- }
-
- public void setTargetState(int mTargetState) {
- this.mTargetState = mTargetState;
+ return getTargetStateId();
}
- public String getStepType()
- {
- return mStepType;
- }
-
- public void setStepType(String actType)
- {
- mStepType = actType;
- }
}
\ No newline at end of file diff --git a/src/main/java/com/c2kernel/entity/agent/JobList.java b/src/main/java/com/c2kernel/entity/agent/JobList.java index 3772c22..271decb 100644 --- a/src/main/java/com/c2kernel/entity/agent/JobList.java +++ b/src/main/java/com/c2kernel/entity/agent/JobList.java @@ -33,7 +33,7 @@ public class JobList extends RemoteMap<Job> {
synchronized(this) {
int jobId = getLastId()+1;
- job.setID(jobId);
+ job.setId(jobId);
put(String.valueOf(jobId), job);
}
}
@@ -65,7 +65,7 @@ public class JobList extends RemoteMap<Job> j = currentMembers.next();
if( j.getItemSysKey() == sysKey )
- remove( String.valueOf(j.getID()) );
+ remove( String.valueOf(j.getId()) );
}
Logger.msg(5, "JobList::removeJobsWithSysKey() - " + sysKey + " DONE." );
diff --git a/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java b/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java index 24172dc..d803079 100644 --- a/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java +++ b/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java @@ -25,7 +25,6 @@ import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.entity.ManageableEntity;
import com.c2kernel.entity.agent.Job;
import com.c2kernel.lifecycle.instance.predefined.PredefinedStep;
-import com.c2kernel.lifecycle.instance.stateMachine.Transitions;
import com.c2kernel.lookup.AgentPath;
import com.c2kernel.lookup.DomainPath;
import com.c2kernel.lookup.EntityPath;
@@ -111,14 +110,13 @@ public class AgentProxy extends EntityProxy ScriptErrorException
{
OutcomeValidator validator = null;
- String scriptName = job.getActPropString("ScriptName");
Date startTime = new Date();
Logger.msg(3, "AgentProxy - executing "+job.getStepPath()+" for "+path.getAgentName());
// get the outcome validator if present
- if (job.requiresOutcome() || job.isError())
+ if (job.hasOutcome())
{
- String schemaName = job.isError()?"Errors":job.getSchemaType();
- int schemaVersion = job.isError()?0:job.getSchemaVersion();
+ String schemaName = job.getSchemaName();
+ int schemaVersion = job.getSchemaVersion();
Logger.msg(5, "AgentProxy - fetching schema "+schemaName+"_"+schemaVersion+" for validation");
// retrieve schema
@@ -134,9 +132,8 @@ public class AgentProxy extends EntityProxy }
}
- if(scriptName != null && scriptName.length() > 0 &&
- (job.getPossibleTransition() == Transitions.DONE || job.getPossibleTransition() == Transitions.COMPLETE)) {
- Logger.msg(3, "AgentProxy - executing script "+scriptName);
+ if(job.hasScript()) {
+ Logger.msg(3, "AgentProxy - executing script "+job.getScriptName()+" v"+job.getScriptVersion());
try {
// pre-validate outcome from script if there is one
@@ -151,7 +148,6 @@ public class AgentProxy extends EntityProxy // load script
ErrorInfo scriptErrors = (ErrorInfo)callScript(item, job);
-
String errorString = scriptErrors.toString();
if (scriptErrors.getFatal()) {
Logger.msg(3, "AgentProxy - fatal script error");
@@ -171,6 +167,7 @@ public class AgentProxy extends EntityProxy if (error.length() > 0)
throw new InvalidDataException(error, "");
}
+ else if (job.isOutcomeRequired())
job.setAgentId(getSystemKey());
Logger.msg(3, "AgentProxy - submitting job to item proxy");
diff --git a/src/main/java/com/c2kernel/entity/proxy/ItemProxy.java b/src/main/java/com/c2kernel/entity/proxy/ItemProxy.java index 67685e7..1740159 100644 --- a/src/main/java/com/c2kernel/entity/proxy/ItemProxy.java +++ b/src/main/java/com/c2kernel/entity/proxy/ItemProxy.java @@ -26,7 +26,6 @@ import com.c2kernel.entity.ManageableEntity; import com.c2kernel.entity.agent.Job;
import com.c2kernel.entity.agent.JobArrayList;
import com.c2kernel.lifecycle.instance.Workflow;
-import com.c2kernel.lifecycle.instance.stateMachine.Transitions;
import com.c2kernel.persistency.ClusterStorage;
import com.c2kernel.persistency.outcome.Viewpoint;
import com.c2kernel.process.Gateway;
@@ -110,7 +109,7 @@ public class ItemProxy extends EntityProxy String outcome = thisJob.getOutcomeString();
// check fields that should have been filled in
if (outcome==null)
- if (thisJob.requiresOutcome())
+ if (thisJob.isOutcomeRequired())
throw new InvalidDataException("Outcome is required.", "");
else
outcome="";
@@ -120,7 +119,7 @@ public class ItemProxy extends EntityProxy Logger.msg(7, "ItemProxy - executing "+thisJob.getStepPath()+" for "+thisJob.getAgentName());
requestAction (thisJob.getAgentId(), thisJob.getStepPath(),
- thisJob.getPossibleTransition(), outcome);
+ thisJob.getTransitionId(), outcome);
}
//requestData is xmlString
@@ -200,9 +199,7 @@ public class ItemProxy extends EntityProxy ArrayList<Job> jobList = getJobList(agentId);
for (Job job : jobList) {
- int transition = job.getPossibleTransition();
- if (job.getStepName().equals(actName))
- if (transition == Transitions.COMPLETE || transition == Transitions.DONE)
+ if (job.getStepName().equals(actName) && job.hasOutcome())
return job;
}
return null;
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/Activity.java b/src/main/java/com/c2kernel/lifecycle/instance/Activity.java index 1fc0c14..71909a5 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/Activity.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/Activity.java @@ -1,5 +1,6 @@ package com.c2kernel.lifecycle.instance;
import java.util.ArrayList;
+import java.util.Map;
import java.util.Vector;
import com.c2kernel.common.AccessRightsException;
@@ -26,7 +27,6 @@ import com.c2kernel.persistency.outcome.Outcome; import com.c2kernel.persistency.outcome.Schema;
import com.c2kernel.persistency.outcome.Viewpoint;
import com.c2kernel.process.Gateway;
-import com.c2kernel.scripting.ScriptingEngineException;
import com.c2kernel.utils.DateUtility;
import com.c2kernel.utils.LocalObjectLoader;
import com.c2kernel.utils.Logger;
@@ -42,7 +42,7 @@ public class Activity extends WfVertex protected Vector<String> mErrors;
/** @associates a State machine engine */
private StateMachine machine;
- private int state = -1;
+ protected int state = -1;
/** true is available to be executed */
public boolean active = false;
/** used in verify() */
@@ -76,11 +76,16 @@ public class Activity extends WfVertex return new Next(this, vertex);
}
- private StateMachine getStateMachine() throws ObjectNotFoundException, InvalidDataException {
+ protected StateMachine getStateMachine() throws InvalidDataException {
if (machine == null) {
String name = (String)getProperties().get("StateMachineName");
String version = (String)getProperties().get("StateMachineVersion");
- machine = LocalObjectLoader.getStateMachine(name, version);
+ try {
+ machine = LocalObjectLoader.getStateMachine(name, version);
+ } catch (ObjectNotFoundException ex) {
+ Logger.error(ex);
+ throw new InvalidDataException("Error loading state machine '"+name+"' v"+version);
+ }
}
return machine;
}
@@ -100,7 +105,7 @@ public class Activity extends WfVertex /** cf Item request
* @throws ObjectNotFoundException
* @throws PersistencyException */
- public final void request(AgentPath agent, int itemSysKey, int transitionID, String requestData) throws AccessRightsException, InvalidTransitionException, InvalidDataException, ObjectAlreadyExistsException, ObjectNotFoundException, PersistencyException
+ public void request(AgentPath agent, int itemSysKey, int transitionID, String requestData) throws AccessRightsException, InvalidTransitionException, InvalidDataException, ObjectAlreadyExistsException, ObjectNotFoundException, PersistencyException
{
// Find requested transition
@@ -162,21 +167,14 @@ public class Activity extends WfVertex throw new PersistencyException("Exception storing event data");
}
- if (newState.isProceeds()) {
- setActive(false);
+ if (newState.isFinished())
if (!getProperties().get("Breakpoint").equals(Boolean.TRUE))
- try {
- runNext(agent);
- } catch (ScriptingEngineException ex) {
- Logger.error("Error calculating next actvity in lifecycle of "+itemSysKey);
- Logger.error(ex);
- }
- }
- else
- DateUtility.setToNow(mStartDate);
+ runNext(agent, itemSysKey);
+ else
+ DateUtility.setToNow(mStartDate);
//refresh all the job lists
- pushJobsToAgents();
+ pushJobsToAgents(itemSysKey);
}
protected String runActivityLogic(AgentPath agent, int itemSysKey,
@@ -249,7 +247,7 @@ public class Activity extends WfVertex }
/** sets the next activity available if possible */
@Override
- public void runNext(AgentPath agent) throws ScriptingEngineException
+ public void runNext(AgentPath agent, int itemSysKey) throws InvalidDataException
{
setActive(false);
try
@@ -273,7 +271,7 @@ public class Activity extends WfVertex }
Logger.debug(8, outVertices + " " + outVertices2);
if (!hasNoNext)
- ((WfVertex) outVertices[0]).run(agent);
+ ((WfVertex) outVertices[0]).run(agent, itemSysKey);
else
{
if (getParent() != null && getParent().getName().equals("domain")) // workflow
@@ -283,11 +281,11 @@ public class Activity extends WfVertex {
CompositeActivity parent = (CompositeActivity) getParent();
if (parent != null)
- parent.runNext(agent);
+ parent.runNext(agent, itemSysKey);
}
}
}
- catch (ScriptingEngineException s)
+ catch (InvalidDataException s)
{
setActive(true);
throw s;
@@ -301,12 +299,14 @@ public class Activity extends WfVertex else
return null;
}
- /** reinitialises the Activity and propagate (for Loop) */
+ /** reinitialises the Activity and propagate (for Loop)
+ * @throws InvalidDataException
+ * @throws ObjectNotFoundException */
@Override
public void reinit(int idLoop)
{
Vertex[] outVertices = getOutGraphables();
- state = getStateMachine().getInitialState();
+ state = getStateMachine().getInitialState().getId();
if (outVertices.length > 0)
{
WfVertex nextAct = (WfVertex) outVertices[0];
@@ -323,32 +323,35 @@ public class Activity extends WfVertex }
/**
* called by precedent Activity runNext() for setting the activity able to be executed
+ * @throws InvalidDataException
+ * @throws ObjectNotFoundException
*/
@Override
- public void run(AgentPath agent) throws ScriptingEngineException
+ public void run(AgentPath agent, int itemSysKey) throws InvalidDataException
{
Logger.debug(8, getPath() + " run " + getState());
- if (!getActive())
- setActive(true);
-
- if (getMachine().getCurrentState() == States.FINISHED)
+
+ if (!getActive()) setActive(true);
+ boolean finished = getStateMachine().getState(state).isFinished();
+ if (finished)
{
- runNext(agent);
+ runNext(agent, itemSysKey);
}
else
{
DateUtility.setToNow(mActiveDate);
- pushJobsToAgents();
+ pushJobsToAgents(itemSysKey);
}
}
/**
* sets the activity available to be executed on start of Workflow or composite activity (when it is the first one of the (sub)process
+ * @throws InvalidDataException
*/
@Override
- public void runfirst(AgentPath agent) throws ScriptingEngineException
+ public void runFirst(AgentPath agent, int itemSysKey) throws InvalidDataException
{
Logger.debug(8, getPath() + " runfirst");
- run(agent);
+ run(agent, itemSysKey);
}
/** @return the current ability to be executed */
public boolean getActive()
@@ -375,78 +378,35 @@ public class Activity extends WfVertex {
return (String) getProperties().get("Agent Role");
}
- /**
- * @return an array of Steps that matches the querry
- * @param agentID
- * Agent concerned by the query
- * @param agentRole
- * Agent concerned by the query @int stateID state to test in the query, use -1 for all
- * @param filter
- * if tru will be filtered by agent, else won't
- */
- public Activity[] query(AgentPath agent, int stateID, boolean filter)
- {
- if (getCurrentState() == stateID || stateID == -1)
- {
- Activity[] steps = { this };
- if (!filter)
- return steps;
- else
- {
- try
- {
- checkAccessRights(agent);
- return steps;
- }
- catch (AccessRightsException e)
- {
- //case that agent is not allowed
- Logger.msg(7, "Activity :: AccessRightsException in " + this.getItemEntityPath() + "/" + this.getPath());
- }
- }
- }
- return new Activity[0];
- }
+
/**
* returns the lists of jobs for the activity and children (cf com.c2kernel.entity.Job)
*/
- public ArrayList<Job> calculateJobs(AgentPath agent, boolean recurse)
+ public ArrayList<Job> calculateJobs(AgentPath agent, int itemSysKey, boolean recurse)
{
- return calculateJobsBase(agent, false);
+ return calculateJobsBase(agent, itemSysKey, false);
} //
- public ArrayList<Job> calculateAllJobs(AgentPath agent, boolean recurse)
+ public ArrayList<Job> calculateAllJobs(AgentPath agent, int itemSysKey, boolean recurse)
{
- return calculateJobsBase(agent, true);
+ return calculateJobsBase(agent, itemSysKey, true);
}
- private ArrayList<Job> calculateJobsBase(AgentPath agent, boolean all)
+ private ArrayList<Job> calculateJobsBase(AgentPath agent, int itemSysKey, boolean includeInactive)
{
Logger.msg(7, "calculateJobs - " + getPath());
- int[] transitions = {
- };
ArrayList<Job> jobs = new ArrayList<Job>();
- try
- {
- String agentName = checkAccessRights(agent);
- String currentAgentName = getCurrentAgentName();
- boolean isCurrent = currentAgentName == null || currentAgentName.equals("") || agentName.equals(currentAgentName);
- if ((all || getActive()) && !getName().equals("domain"))
- transitions = machine.possibleTransition();
- Logger.msg(7, "Activity.calculateJobs() - Got " + transitions.length + " transitions.");
- for (int i = 0; i < transitions.length; i++)
- {
- Logger.msg(7, "Creating Job object for transition " + transitions[i]);
- if ((isCurrent && !(transitions[i] == Transitions.REASSIGN && agentName.equals(currentAgentName))) || (transitions[i] == Transitions.REASSIGN && !agentName.equals(currentAgentName)))
- jobs.add(new Job(getItemEntityPath().getSysKey(), getPath(), transitions[i], getCurrentState(), machine.simulate(transitions[i]), getName(), getProperties(), getType(), agentName));
+ Map<Transition, String> transitions;
+ if ((includeInactive || getActive()) && !getName().equals("domain")) {
+ transitions = getStateMachine().getPossibleTransitions(this, agent);
+ Logger.msg(7, "Activity.calculateJobs() - Got " + transitions.size() + " transitions.");
+ for (Transition transition : transitions.keySet()) {
+ Logger.msg(7, "Creating Job object for transition " + transition);
+ jobs.add(new Job(this, itemSysKey, transition, agent, transitions.get(transition)));
}
}
- catch (AccessRightsException ex)
- {
- Logger.msg(6, "Agent "+ agent.getAgentName() +" is not allowed to interact with "+getItemEntityPath().getSysKey()+":"+getPath());
- } // empty joblist then
return jobs;
} - public void pushJobsToAgents()
+ public void pushJobsToAgents(int itemSysKey)
{
String agentRole = getCurrentAgentRole();
if (agentRole == null || agentRole.length()==0) return;
@@ -461,7 +421,7 @@ public class Activity extends WfVertex }
if (myRole.hasJobList())
- new JobPusher(this, myRole).start();
+ new JobPusher(this, itemSysKey, myRole).start();
}
@@ -517,10 +477,5 @@ public class Activity extends WfVertex {
mType = type;
}
- private void start()
- {
- Logger.debug(8, getPath() + " start");
-
- }
}
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/AndSplit.java b/src/main/java/com/c2kernel/lifecycle/instance/AndSplit.java index 63b5640..3e9ef3c 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/AndSplit.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/AndSplit.java @@ -1,7 +1,7 @@ package com.c2kernel.lifecycle.instance;
+import com.c2kernel.common.InvalidDataException;
import com.c2kernel.graph.model.Vertex;
import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.scripting.ScriptingEngineException;
/**
* @version $Revision: 1.16 $ $Date: 2005/05/10 15:14:54 $
* @author $Author: abranson $
@@ -16,12 +16,12 @@ public class AndSplit extends Split super();
}
@Override
- public void runNext(AgentPath agent) throws ScriptingEngineException
+ public void runNext(AgentPath agent, int itemSysKey) throws InvalidDataException
{
AdvancementCalculator adv = new AdvancementCalculator();
adv.calculate((CompositeActivity) getParent());
Vertex[] outVertices = getOutGraphables();
for (Vertex outVertice : outVertices)
- ((WfVertex) outVertice).run(agent);
+ ((WfVertex) outVertice).run(agent, itemSysKey);
}
}
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/CompositeActivity.java b/src/main/java/com/c2kernel/lifecycle/instance/CompositeActivity.java index 7ab9825..689fbb8 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/CompositeActivity.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/CompositeActivity.java @@ -1,7 +1,6 @@ package com.c2kernel.lifecycle.instance;
import java.util.ArrayList;
-import java.util.Vector;
import com.c2kernel.common.AccessRightsException;
import com.c2kernel.common.InvalidDataException;
@@ -274,66 +273,34 @@ public class CompositeActivity extends Activity }
/**
+ * @throws InvalidDataException
* @see com.c2kernel.lifecycle.instance.WfVertex#run()
*/
@Override
- public void run(AgentPath agent) throws ScriptingEngineException
+ public void run(AgentPath agent, int itemSysKey) throws InvalidDataException
{
- super.run(agent);
- if (getChildrenGraphModel().getStartVertex() != null && getMachine().getCurrentState() != States.FINISHED)
+ super.run(agent, itemSysKey);
+ if (getChildrenGraphModel().getStartVertex() != null && !getStateMachine().getState(state).isFinished())
{
WfVertex first = (WfVertex) getChildrenGraphModel().getStartVertex();
- first.run(agent);
+ first.run(agent, itemSysKey);
}
}
@Override
- public void runNext(AgentPath agent) throws ScriptingEngineException
+ public void runNext(AgentPath agent, int itemSysKey) throws InvalidDataException
{
- if (getMachine().state != States.FINISHED)
+ if (!getStateMachine().getState(state).isFinished())
getMachine().traverse(Transitions.COMPLETE);
- super.runNext(agent);
- }
-
- /**
- * @see com.c2kernel.lifecycle.instance.Activity#query(com.c2kernel.common.AgentInfo,
- * java.lang.String, boolean)
- */
- @Override
- public Activity[] query(AgentPath agent, int stateID, boolean filter)
- {
- Vector<Activity[]> steps = new Vector<Activity[]>();
- Activity[] returnArray = null;
- for (int i = 0; i < getChildren().length; i++)
- {
- if (getChildren()[i] instanceof Activity)
- steps.addElement(((Activity) getChildren()[i]).query(agent, stateID, filter));
- }
- int j = 0;
- for (int i = 0; i < steps.size(); i++)
- j += steps.elementAt(i).length;
- Activity[] tmp = super.query(agent, stateID, filter);
- if (tmp.length == 1)
- {
- returnArray = new Activity[j + 1];
- returnArray[j] = tmp[0];
- } else
- returnArray = new Activity[j];
- j = 0;
- for (int i = 0; i < steps.size(); i++)
- {
- Activity[] stepArray = steps.elementAt(i);
- for (Activity element : stepArray)
- returnArray[j++] = element;
- }
- return returnArray;
+ super.runNext(agent, itemSysKey);
}
+ /**
* @see com.c2kernel.lifecycle.instance.Activity#calculateJobs()
*/
@Override
- public ArrayList<Job> calculateJobs(AgentPath agent, boolean recurse)
+ public ArrayList<Job> calculateJobs(AgentPath agent, int itemSysKey, boolean recurse)
{
ArrayList<Job> jobs = new ArrayList<Job>();
boolean childActive = false;
@@ -342,16 +309,16 @@ public class CompositeActivity extends Activity if (getChildren()[i] instanceof Activity)
{
Activity child = (Activity) getChildren()[i];
- jobs.addAll(child.calculateJobs(agent, recurse));
+ jobs.addAll(child.calculateJobs(agent, itemSysKey, recurse));
childActive |= child.active;
}
if (!childActive)
- jobs.addAll(super.calculateJobs(agent, recurse));
+ jobs.addAll(super.calculateJobs(agent, itemSysKey, recurse));
return jobs;
}
@Override
- public ArrayList<Job> calculateAllJobs(AgentPath agent, boolean recurse)
+ public ArrayList<Job> calculateAllJobs(AgentPath agent, int itemSysKey, boolean recurse)
{
ArrayList<Job> jobs = new ArrayList<Job>();
if (recurse)
@@ -359,9 +326,9 @@ public class CompositeActivity extends Activity if (getChildren()[i] instanceof Activity)
{
Activity child = (Activity) getChildren()[i];
- jobs.addAll(child.calculateAllJobs(agent, recurse));
+ jobs.addAll(child.calculateAllJobs(agent, itemSysKey, recurse));
}
- jobs.addAll(super.calculateAllJobs(agent, recurse));
+ jobs.addAll(super.calculateAllJobs(agent, itemSysKey, recurse));
return jobs;
}
@@ -429,14 +396,14 @@ public class CompositeActivity extends Activity public void reinit(int idLoop)
{
super.reinit(idLoop);
- if (getChildrenGraphModel().getStartVertex() != null && getMachine().getCurrentState() != States.FINISHED)
+ if (getChildrenGraphModel().getStartVertex() != null && !getStateMachine().getState(state).isFinished())
((WfVertex) getChildrenGraphModel().getStartVertex()).reinit(idLoop);
}
@Override
public void request(AgentPath agent, int itemSysKey, int transitionID, String requestData) throws AccessRightsException, InvalidTransitionException, InvalidDataException, ObjectAlreadyExistsException
{
- if (getChildrenGraphModel().getStartVertex() != null && getMachine().getCurrentState() != States.FINISHED && transitionID == Transitions.START)
+ if (getChildrenGraphModel().getStartVertex() != null && !getStateMachine().getState(state).isFinished() && transitionID == Transitions.START)
try
{
((WfVertex) getChildrenGraphModel().getStartVertex()).run(agent);
@@ -446,13 +413,14 @@ public class CompositeActivity extends Activity }
super.request(agent, itemSysKey, transitionID, requestData);
}
- public void refreshJobs()
+
+ public void refreshJobs(int itemSysKey)
{
GraphableVertex[] children = getChildren();
for (GraphableVertex element : children)
if (element instanceof CompositeActivity)
- ((CompositeActivity) element).refreshJobs();
+ ((CompositeActivity) element).refreshJobs(itemSysKey);
else if (element instanceof Activity)
- ((Activity) element).pushJobsToAgents();
+ ((Activity) element).pushJobsToAgents(itemSysKey);
}
}
\ No newline at end of file diff --git a/src/main/java/com/c2kernel/lifecycle/instance/JobPusher.java b/src/main/java/com/c2kernel/lifecycle/instance/JobPusher.java index 190758a..a0a51d0 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/JobPusher.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/JobPusher.java @@ -1,13 +1,10 @@ package com.c2kernel.lifecycle.instance;
import java.util.Enumeration;
-import java.util.Iterator;
import com.c2kernel.entity.Agent;
import com.c2kernel.entity.AgentHelper;
-import com.c2kernel.entity.agent.Job;
import com.c2kernel.entity.agent.JobArrayList;
-import com.c2kernel.lifecycle.instance.stateMachine.Transitions;
import com.c2kernel.lookup.AgentPath;
import com.c2kernel.lookup.RolePath;
import com.c2kernel.process.Gateway;
@@ -16,16 +13,18 @@ import com.c2kernel.utils.Logger; final class JobPusher extends Thread {
private final Activity activity;
private final RolePath myRole;
+ private final int itemSysKey;
- JobPusher(Activity activity, RolePath role) {
+ JobPusher(Activity activity, int itemSysKey, RolePath role) {
this.activity = activity;
+ this.itemSysKey = itemSysKey;
this.myRole = role;
}
@Override
public void run()
{
- Thread.currentThread().setName("Agent job pusher for "+activity.getName()+" to role "+myRole);
+ Thread.currentThread().setName("Agent job pusher for "+itemSysKey+":"+activity.getName()+" to role "+myRole);
for (Enumeration<AgentPath> e = myRole.getChildren(); e.hasMoreElements();)
{
AgentPath nextAgent = e.nextElement();
@@ -33,25 +32,14 @@ final class JobPusher extends Thread { try
{
// get joblist for user
- JobArrayList jobList = new JobArrayList(this.activity.calculateJobs(nextAgent, false));
- // only transmit start, complete and resume jobs
- for (Iterator<Job> element = jobList.list.iterator(); element.hasNext();)
- {
- Job thisJob = element.next();
- if (thisJob.getPossibleTransition() != Transitions.START
- && thisJob.getPossibleTransition() != Transitions.COMPLETE
- && thisJob.getPossibleTransition() != Transitions.RESUME
- && thisJob.getPossibleTransition() != Transitions.SUSPEND
- && thisJob.getPossibleTransition() != Transitions.REASSIGN)
- element.remove();
- }
+ JobArrayList jobList = new JobArrayList(this.activity.calculateJobs(nextAgent, itemSysKey, false));
Logger.msg(7, "Activity.pushJobsToAgents() - User will receive " + jobList.list.size() + " jobs");
String stringJobs = Gateway.getMarshaller().marshall(jobList);
// push it to the agent
org.omg.CORBA.Object agentIOR = nextAgent.getIOR();
Agent thisAgent = AgentHelper.narrow(agentIOR);
Logger.msg(7, "Calling agent "+thisAgent.getSystemKey()+" from "+activity.getPath());
- thisAgent.refreshJobList(this.activity.getItemEntityPath().getSysKey(), activity.getPath(), stringJobs);
+ thisAgent.refreshJobList(itemSysKey, activity.getPath(), stringJobs);
}
catch (Exception ex)
{
@@ -61,7 +49,7 @@ final class JobPusher extends Thread { + " of role "
+ myRole
+ " could not be found to be informed of a change in "
- + this.activity.getItemEntityPath().getSysKey());
+ + itemSysKey);
Logger.error(ex);
}
}
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/Join.java b/src/main/java/com/c2kernel/lifecycle/instance/Join.java index 94f3086..b643ff8 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/Join.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/Join.java @@ -1,10 +1,10 @@ package com.c2kernel.lifecycle.instance;
import java.util.Vector;
+import com.c2kernel.common.InvalidDataException;
import com.c2kernel.graph.model.Vertex;
import com.c2kernel.graph.traversal.GraphTraversal;
import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.scripting.ScriptingEngineException;
/**
* @version $Revision: 1.52 $ $Date: 2005/05/10 15:14:54 $
* @author $Author: abranson $
@@ -24,10 +24,11 @@ public class Join extends WfVertex public int counter = 0;
/**
+ * @throws InvalidDataException
* @see com.c2kernel.lifecycle.instance.WfVertex#runNext()
*/
@Override
- public void runNext(AgentPath agent) throws ScriptingEngineException
+ public void runNext(AgentPath agent, int itemSysKey) throws InvalidDataException
{
AdvancementCalculator adv = new AdvancementCalculator();
adv.calculate((CompositeActivity) getParent());
@@ -37,10 +38,10 @@ public class Join extends WfVertex if (outVertices.length > 0)
{
WfVertex nextAct = (WfVertex) outVertices[0];
- nextAct.run(agent);
+ nextAct.run(agent, itemSysKey);
}
else
- super.runNext(agent);
+ super.runNext(agent, itemSysKey);
}
}
/**
@@ -53,6 +54,7 @@ public class Join extends WfVertex new Next(this, (WfVertex) getParent().search(idNext));
}
/**
+ * @throws InvalidDataException
* @see com.c2kernel.lifecycle.instance.WfVertex#reinit(int)
*/
@Override
@@ -139,12 +141,13 @@ public class Join extends WfVertex return mErrors.elementAt(0);
}
/**
+ * @throws InvalidDataException
* @see com.c2kernel.lifecycle.instance.WfVertex#run()
*/
@Override
- public void run(AgentPath agent) throws ScriptingEngineException
+ public void run(AgentPath agent, int itemSysKey) throws InvalidDataException
{
- runNext(agent);
+ runNext(agent, itemSysKey);
}
/**
* @see com.c2kernel.lifecycle.instance.WfVertex#addNext(com.c2kernel.lifecycle.instance.WfVertex)
@@ -173,9 +176,9 @@ public class Join extends WfVertex return loop2;
}
@Override
- public void runfirst(AgentPath agent) throws ScriptingEngineException
+ public void runFirst(AgentPath agent, int itemSysKey) throws InvalidDataException
{
- runNext(agent);
+ runNext(agent, itemSysKey);
}
/*
* (non-Javadoc)
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/Loop.java b/src/main/java/com/c2kernel/lifecycle/instance/Loop.java index 8228ba9..76ad7d5 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/Loop.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/Loop.java @@ -1,8 +1,8 @@ package com.c2kernel.lifecycle.instance;
+import com.c2kernel.common.InvalidDataException;
import com.c2kernel.graph.model.Vertex;
import com.c2kernel.graph.traversal.GraphTraversal;
import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.scripting.ScriptingEngineException;
import com.c2kernel.utils.Logger;
/**
* @version $Revision: 1.35 $ $Date: 2005/05/10 15:14:54 $
@@ -26,15 +26,15 @@ public class Loop extends XOrSplit return true;
}
@Override
- public void followNext(Next activeNext, AgentPath agent) throws ScriptingEngineException
+ public void followNext(Next activeNext, AgentPath agent, int itemSysKey) throws InvalidDataException
{
WfVertex v = activeNext.getTerminusVertex();
if (!isInPrev(v))
- v.run(agent);
+ v.run(agent, itemSysKey);
else
{
v.reinit(getID());
- v.run(agent);
+ v.run(agent, itemSysKey);
}
}
/**
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/OrSplit.java b/src/main/java/com/c2kernel/lifecycle/instance/OrSplit.java index aea34b2..cadf3a0 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/OrSplit.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/OrSplit.java @@ -1,6 +1,7 @@ package com.c2kernel.lifecycle.instance;
import java.util.StringTokenizer;
+import com.c2kernel.common.InvalidDataException;
import com.c2kernel.graph.model.DirectedEdge;
import com.c2kernel.lookup.AgentPath;
import com.c2kernel.scripting.ScriptingEngineException;
@@ -19,12 +20,17 @@ public class OrSplit extends Split super();
}
@Override
- public void runNext(AgentPath agent) throws ScriptingEngineException
+ public void runNext(AgentPath agent, int itemSysKey) throws InvalidDataException
{
- String nexts =
- this
- .evaluateScript((String) getProperties().get("RoutingScriptName"), (String) getProperties().get("RoutingScriptVersion"))
- .toString();
+ String nexts;
+ String scriptName = (String) getProperties().get("RoutingScriptName");
+ String scriptVersion = (String) getProperties().get("RoutingScriptVersion");
+ try {
+ nexts = this.evaluateScript(scriptName, scriptVersion, itemSysKey).toString();
+ } catch (ScriptingEngineException e) {
+ Logger.error(e);
+ throw new InvalidDataException("Error running routing script "+scriptName+" v"+scriptVersion, null);
+ }
StringTokenizer tok = new StringTokenizer(nexts, ",");
Logger.msg(7, tok.countTokens() + " nexts to activate:" + nexts);
int active = 0;
@@ -42,7 +48,7 @@ public class OrSplit extends Split if (thisNext != null && thisNext.equals(nextEdge.getProperties().get("Alias")))
{
WfVertex term = nextEdge.getTerminusVertex();
- term.run(agent);
+ term.run(agent, itemSysKey);
Logger.msg(7, "Running " + nextEdge.getProperties().get("Alias"));
active++;
}
@@ -55,7 +61,7 @@ public class OrSplit extends Split Logger.error(e);
}
if (active == 0)
- throw new ScriptingEngineException("No nexts were activated!");
+ throw new InvalidDataException("No nexts were activated!", null);
}
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/Split.java b/src/main/java/com/c2kernel/lifecycle/instance/Split.java index e6dab3b..7ba9db3 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/Split.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/Split.java @@ -2,10 +2,10 @@ package com.c2kernel.lifecycle.instance; import java.util.Vector;
+import com.c2kernel.common.InvalidDataException;
import com.c2kernel.graph.model.Vertex;
import com.c2kernel.graph.traversal.GraphTraversal;
import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.scripting.ScriptingEngineException;
/**
* @version $Revision: 1.47 $ $Date: 2006/05/29 13:17:45 $
@@ -28,10 +28,11 @@ public abstract class Split extends WfVertex private boolean loopTested;
/**
+ * @throws InvalidDataException
* @see com.c2kernel.lifecycle.instance.WfVertex#runNext()
*/
@Override
- public abstract void runNext(AgentPath agent) throws ScriptingEngineException;
+ public abstract void runNext(AgentPath agent, int itemSysKey) throws InvalidDataException;
/**
* Method addNext.
@@ -137,12 +138,13 @@ public abstract class Split extends WfVertex }
/**
+ * @throws InvalidDataException
* @see com.c2kernel.lifecycle.instance.WfVertex#run()
*/
@Override
- public void run(AgentPath agent) throws ScriptingEngineException
+ public void run(AgentPath agent, int itemSysKey) throws InvalidDataException
{
- runNext(agent);
+ runNext(agent, itemSysKey);
}
/**
@@ -189,9 +191,9 @@ public abstract class Split extends WfVertex }
@Override
- public void runfirst(AgentPath agent) throws ScriptingEngineException
+ public void runFirst(AgentPath agent, int itemSysKey) throws InvalidDataException
{
- runNext(agent);
+ runNext(agent, itemSysKey);
}
}
\ No newline at end of file diff --git a/src/main/java/com/c2kernel/lifecycle/instance/WfVertex.java b/src/main/java/com/c2kernel/lifecycle/instance/WfVertex.java index b74aac8..fba00b3 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/WfVertex.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/WfVertex.java @@ -7,7 +7,6 @@ import java.util.HashMap; import com.c2kernel.common.InvalidDataException;
import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.graph.model.GraphableVertex;
-import com.c2kernel.lifecycle.instance.stateMachine.Transitions;
import com.c2kernel.lifecycle.routingHelpers.ViewpointDataHelper;
import com.c2kernel.lookup.AgentPath;
import com.c2kernel.lookup.EntityPath;
@@ -25,8 +24,9 @@ import com.c2kernel.utils.Logger; 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;
+ * (sub)process
+ * @throws InvalidDataException */
+ public abstract void runFirst(AgentPath agent, int itemSysKey) throws ScriptingEngineException, InvalidDataException;
/**
* @see java.lang.Object#Object()
@@ -40,8 +40,9 @@ public abstract class WfVertex extends GraphableVertex /**
* Method runNext.
+ * @throws InvalidDataException
*/
- public void runNext(AgentPath agent) throws ScriptingEngineException
+ public void runNext(AgentPath agent, int itemSysKey) throws InvalidDataException
{
try
{
@@ -57,6 +58,8 @@ public abstract class WfVertex extends GraphableVertex /**
* Method reinit.
* @param idLoop
+ * @throws InvalidDataException
+ * @throws ObjectNotFoundException
*/
public abstract void reinit( int idLoop );
@@ -74,8 +77,9 @@ public abstract class WfVertex extends GraphableVertex /**
* Method run.
+ * @throws InvalidDataException
*/
- public abstract void run(AgentPath agent) throws ScriptingEngineException;
+ public abstract void run(AgentPath agent, int itemSysKey) throws InvalidDataException;
/**
* Method loop.
@@ -89,12 +93,11 @@ public abstract class WfVertex extends GraphableVertex */
public abstract Next addNext(WfVertex vertex);
- protected Object evaluateScript(String scriptName, String scriptVersion) throws ScriptingEngineException
+ protected Object evaluateScript(String scriptName, String scriptVersion, int itemSysKey) throws ScriptingEngineException
{
try
{
- EntityPath entity = ((CompositeActivity) getParent()).getWf().getItemEntityPath();
Script script = getScript(scriptName, scriptVersion);
KeyValuePair[] k = getProperties().getKeyValuePairs();
@@ -109,7 +112,7 @@ public abstract class WfVertex extends GraphableVertex {
value = value.substring(11);
if (value.startsWith("."))
- value = entity.getSysKey() + value.substring(1);
+ value = itemSysKey + value.substring(1);
try {
inputParam = ViewpointDataHelper.get(value)[0];
} catch (ArrayIndexOutOfBoundsException ex) {
@@ -120,7 +123,7 @@ public abstract class WfVertex extends GraphableVertex {
value = value.substring(10);
try {
- inputParam = Gateway.getStorage().get(entity.getSysKey(), ClusterStorage.PROPERTY+"/"+value, null);
+ inputParam = Gateway.getStorage().get(itemSysKey, ClusterStorage.PROPERTY+"/"+value, null);
} catch (ObjectNotFoundException ex) {
inputParam = null;
}
@@ -131,7 +134,7 @@ public abstract class WfVertex extends GraphableVertex }
if (requiredInput.containsKey("item")) {
- script.setInputParamValue("item", Gateway.getProxyManager().getProxy(entity));
+ script.setInputParamValue("item", Gateway.getProxyManager().getProxy(new EntityPath(itemSysKey)));
}
if (requiredInput.containsKey("agent")) {
AgentPath systemAgent = Gateway.getLDAPLookup().getRoleManager().getAgentPath("system");
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java b/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java index 083de73..0ead50d 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java @@ -6,6 +6,7 @@ import com.c2kernel.common.InvalidDataException; import com.c2kernel.common.InvalidTransitionException;
import com.c2kernel.common.ObjectAlreadyExistsException;
import com.c2kernel.common.ObjectNotFoundException;
+import com.c2kernel.common.PersistencyException;
import com.c2kernel.entity.C2KLocalObject;
import com.c2kernel.entity.agent.Job;
import com.c2kernel.graph.model.GraphPoint;
@@ -13,7 +14,6 @@ import com.c2kernel.graph.model.TypeNameAndConstructionInfo; import com.c2kernel.lifecycle.instance.predefined.PredefinedStepContainer;
import com.c2kernel.lookup.AgentPath;
import com.c2kernel.persistency.ClusterStorage;
-import com.c2kernel.scripting.ScriptingEngineException;
import com.c2kernel.utils.Language;
import com.c2kernel.utils.Logger;
/**
@@ -83,14 +83,15 @@ public class Workflow extends CompositeActivity implements C2KLocalObject * @throws AccessRightsException
* @throws InvalidTransitionException
* @throws InvalidDataException
+ * @throws PersistencyException
*/
//requestData is xmlstring
- public void requestAction(AgentPath agent, String stepPath, int transitionID, String requestData)
- throws ObjectNotFoundException, AccessRightsException, InvalidTransitionException, InvalidDataException, ObjectAlreadyExistsException
+ public void requestAction(AgentPath agent, String stepPath, int itemSysKey, int transitionID, String requestData)
+ throws ObjectNotFoundException, AccessRightsException, InvalidTransitionException, InvalidDataException, ObjectAlreadyExistsException, PersistencyException
{
- Logger.msg(3, "Action: " + Transitions.getTransitionName(transitionID) + " " + stepPath + " by " + agent.getAgentName());
+ Logger.msg(3, "Action: " + transitionID + " " + stepPath + " by " + agent.getAgentName());
if (search(stepPath) != null)
- ((Activity) search(stepPath)).request(agent, transitionID, requestData);
+ ((Activity) search(stepPath)).request(agent, itemSysKey, transitionID, requestData);
else
throw new ObjectNotFoundException(stepPath + " not found", "");
}
@@ -154,14 +155,15 @@ public class Workflow extends CompositeActivity implements C2KLocalObject * Method initialise.
*
* @param systemKey
+ * @throws InvalidDataException
*/
- public void initialise(int systemKey, AgentPath agent)
+ public void initialise(int systemKey, AgentPath agent) throws InvalidDataException
{
try
{
- runfirst(agent);
+ runFirst(agent, systemKey);
}
- catch (ScriptingEngineException ex)
+ catch (InvalidDataException ex)
{
Logger.error(ex);
}
@@ -175,13 +177,13 @@ public class Workflow extends CompositeActivity implements C2KLocalObject /**
* if type = 0 only domain steps will be queried if type = 1 only predefined steps will be queried else both will be queried
*/
- public ArrayList<Job> calculateJobs(AgentPath agent, int type)
+ public ArrayList<Job> calculateJobs(AgentPath agent, int itemSysKey, int type)
{
ArrayList<Job> jobs = new ArrayList<Job>();
if (type != 1)
- jobs.addAll(((CompositeActivity) search("workflow/domain")).calculateJobs(agent, true));
+ jobs.addAll(((CompositeActivity) search("workflow/domain")).calculateJobs(agent, itemSysKey, true));
if (type != 0)
- jobs.addAll(((CompositeActivity) search("workflow/predefined")).calculateJobs(agent, true));
+ jobs.addAll(((CompositeActivity) search("workflow/predefined")).calculateJobs(agent, itemSysKey, true));
return jobs;
}
/**
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/XOrSplit.java b/src/main/java/com/c2kernel/lifecycle/instance/XOrSplit.java index 25baf0b..6c11e92 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/XOrSplit.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/XOrSplit.java @@ -3,9 +3,11 @@ package com.c2kernel.lifecycle.instance; import java.util.ArrayList;
import java.util.StringTokenizer;
+import com.c2kernel.common.InvalidDataException;
import com.c2kernel.graph.model.DirectedEdge;
import com.c2kernel.lookup.AgentPath;
import com.c2kernel.scripting.ScriptingEngineException;
+import com.c2kernel.utils.Logger;
/**
* @version $Revision: 1.23 $ $Date: 2006/03/03 13:52:21 $
@@ -22,12 +24,18 @@ public class XOrSplit extends Split }
@Override
- public void runNext(AgentPath agent) throws ScriptingEngineException
+ public void runNext(AgentPath agent, int itemSysKey) throws InvalidDataException
{
ArrayList<DirectedEdge> nextsToFollow = new ArrayList<DirectedEdge>();
- String nexts = this.evaluateScript(
- (String) getProperties().get("RoutingScriptName"),
- (String) getProperties().get("RoutingScriptVersion")).toString();
+ String nexts;
+ String scriptName = (String) getProperties().get("RoutingScriptName");
+ String scriptVersion = (String) getProperties().get("RoutingScriptVersion");
+ try {
+ nexts = this.evaluateScript(scriptName, scriptVersion, itemSysKey).toString();
+ } catch (ScriptingEngineException e) {
+ Logger.error(e);
+ throw new InvalidDataException("Error running routing script "+scriptName+" v"+scriptVersion, null);
+ }
StringTokenizer tok = new StringTokenizer(nexts,",");
String[] nextsTab = new String[tok.countTokens()];
@@ -41,14 +49,14 @@ public class XOrSplit extends Split }
// Logger.debug(0, getID()+" following "+nexts);
if (nextsToFollow.size() != 1)
- throw new ScriptingEngineException("not good number of active next");
+ throw new InvalidDataException("not good number of active next", null);
- followNext((Next)nextsToFollow.get(0), agent);
+ followNext((Next)nextsToFollow.get(0), agent, itemSysKey);
}
- public void followNext(Next activeNext, AgentPath agent) throws ScriptingEngineException {
- activeNext.getTerminusVertex().run(agent);
+ public void followNext(Next activeNext, AgentPath agent, int itemSysKey) throws InvalidDataException {
+ activeNext.getTerminusVertex().run(agent, itemSysKey);
}
}
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/ReplaceDomainWorkflow.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/ReplaceDomainWorkflow.java index e2f9840..9b7b3f0 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/ReplaceDomainWorkflow.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/ReplaceDomainWorkflow.java @@ -31,8 +31,8 @@ public class ReplaceDomainWorkflow extends PredefinedStep domain.setName("domain");
lifeCycle.initChild(domain, true, new GraphPoint(150, 100));
// if new workflow, activate it, otherwise refresh the jobs
- if (!domain.active) lifeCycle.run(agent);
- else lifeCycle.refreshJobs();
+ if (!domain.active) lifeCycle.run(agent, itemSysKey);
+ else lifeCycle.refreshJobs(itemSysKey);
// store new wf
Gateway.getStorage().put(itemSysKey, lifeCycle, null);
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/State.java b/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/State.java index 8ad53bb..0325656 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/State.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/State.java @@ -8,7 +8,7 @@ public class State implements Serializable { int id;
String name;
- boolean proceeds = false; // If true, this state deactivates the current activity and the lifecycle proceeds
+ boolean finished = false; // If true, this state deactivates the current activity and the lifecycle proceeds
HashMap<Integer, Transition> possibleTransitions;
@@ -33,12 +33,12 @@ public class State implements Serializable { this.id = id;
}
- public boolean isProceeds() {
- return proceeds;
+ public boolean isFinished() {
+ return finished;
}
- public void setProceeds(boolean proceeds) {
- this.proceeds = proceeds;
+ public void setFinished(boolean finished) {
+ this.finished = finished;
}
public HashMap<Integer, Transition> getPossibleTransitions() {
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/Transition.java b/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/Transition.java index 471e72c..b88ddab 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/Transition.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/Transition.java @@ -29,6 +29,7 @@ public class Transition implements Serializable { // activation properties
boolean requiresActive = true; // Whether the activity must be active for this transition to be available
+ boolean finishing; // whether the terminal state is a finishing state;
// permissions
String roleOverride;
@@ -61,6 +62,7 @@ public class Transition implements Serializable { public void setTerminalState(State terminalState) {
this.terminalState = terminalState;
+ finishing = terminalState.finished;
}
public String getEnabledProp() {
@@ -74,6 +76,10 @@ public class Transition implements Serializable { public boolean isRequiresActive() {
return requiresActive;
}
+
+ public boolean isFinishing() {
+ return finishing;
+ }
public void setRequiresActive(boolean requiresActive) {
this.requiresActive = requiresActive;
@@ -203,7 +209,7 @@ public class Transition implements Serializable { public String getReservation(Activity act, AgentPath agent) {
if (reservation == null || reservation.length() == 0)
- reservation = terminalState.proceeds?"clear":"set";
+ reservation = terminalState.finished?"clear":"set";
String reservedAgent = act.getCurrentAgentName();
if (reservation.equals("set"))
@@ -242,4 +248,8 @@ public class Transition implements Serializable { else
return null;
}
+
+ public boolean hasScript() {
+ return script!=null && script.getScriptName() != null;
+ }
}
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/TransitionScript.java b/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/TransitionScript.java index 80a122a..9585102 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/TransitionScript.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/TransitionScript.java @@ -5,6 +5,9 @@ public class TransitionScript extends TransitionResource { // script properties
String scriptName, scriptVersion; // Name & version of the script to be run by the agent during this transition
+ public TransitionScript() {
+ }
+
public String getScriptName() {
return scriptName;
}
@@ -21,7 +24,4 @@ public class TransitionScript extends TransitionResource { this.scriptVersion = scriptVersion;
}
- public TransitionScript() {
- }
-
}
diff --git a/src/main/resources/boot/OD/StateMachine.xsd b/src/main/resources/boot/OD/StateMachine.xsd index f21e39d..ceeaf22 100644 --- a/src/main/resources/boot/OD/StateMachine.xsd +++ b/src/main/resources/boot/OD/StateMachine.xsd @@ -7,7 +7,7 @@ <xs:complexType>
<xs:attribute name="id" type="xs:int" use="required"/>
<xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="proceeds" type="xs:string"/>
+ <xs:attribute name="finished" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="Transition" maxOccurs="unbounded">
@@ -29,7 +29,7 @@ <xs:attribute name="id" type="xs:int" use="required"/>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="origin" type="xs:int" use="required"/>
- <xs:attribute name="terminus" type="xs:int" use="required"/>
+ <xs:attribute name="target" type="xs:int" use="required"/>
<xs:attribute name="enablingProperty" type="xs:string"/>
<xs:attribute name="roleOverride" type="xs:string"/>
<xs:attribute name="reservation">
@@ -49,3 +49,4 @@ </xs:element>
</xs:schema>
+
diff --git a/src/main/resources/mapFiles/JobListMap.xml b/src/main/resources/mapFiles/JobListMap.xml index 7352248..ee18d48 100644 --- a/src/main/resources/mapFiles/JobListMap.xml +++ b/src/main/resources/mapFiles/JobListMap.xml @@ -2,40 +2,55 @@ <mapping>
<class name="com.c2kernel.entity.agent.Job">
<map-to xml="Job"/>
- <field name="mItemSysKey" type="integer" direct="false" get-method="getItemSysKey" set-method="setItemSysKey">
+ <field name="id" type="integer" direct="false" get-method="getId" set-method="setId">
+ <bind-xml name="Id" node="attribute"/>
+ </field>
+ <field name="itemSysKey" type="integer" direct="false" get-method="getItemSysKey" set-method="setItemSysKey">
<bind-xml name="ItemSysKey" node="attribute"/>
</field>
- <field name="mID" type="integer" direct="false" get-method="getID" set-method="setID">
- <bind-xml name="ID" node="attribute"/>
+ <field name="stepName" type="string" direct="false" get-method="getStepName" set-method="setStepName">
+ <bind-xml name="StepName" node="attribute"/>
+ </field>
+ <field name="stepType" type="string" direct="false" get-method="getStepType" set-method="setStepType">
+ <bind-xml name="StepType" node="attribute"/>
</field>
- <field name="mStepPath" type="string" direct="false" get-method="getStepPath" set-method="setStepPath">
+ <field name="stepPath" type="string" direct="false" get-method="getStepPath" set-method="setStepPath">
<bind-xml name="StepPath" node="attribute"/>
</field>
- <field name="mPossibleTransition" type="integer" direct="false" get-method="getPossibleTransition" set-method="setPossibleTransition">
- <bind-xml name="PossibleTransition" node="attribute"/>
+ <field name="transitionId" type="integer" direct="false" get-method="getTransitionId" set-method="setTransitionId">
+ <bind-xml name="TransitionId" node="attribute"/>
</field>
- <field name="mCurrentState" type="integer" direct="false" get-method="getCurrentState" set-method="setCurrentState">
- <bind-xml name="CurrentState" node="attribute"/>
+ <field name="currentStateId" type="integer" direct="false" get-method="getCurrentStateId" set-method="setCurrentStateId">
+ <bind-xml name="CurrentStateId" node="attribute"/>
</field>
- <field name="mTargetState" type="integer" direct="false" get-method="getTargetState" set-method="setTargetState">
- <bind-xml name="TargetState" node="attribute"/>
- </field>
- <field name="mStepName" type="string" direct="false" get-method="getStepName" set-method="setStepName">
- <bind-xml name="StepName" node="attribute"/>
+ <field name="targetStateId" type="integer" direct="false" get-method="getTargetStateId" set-method="setTargetStateId">
+ <bind-xml name="TargetStateId" node="attribute"/>
</field>
- <field name="mAgentId" type="integer" direct="false" get-method="getAgentId" set-method="setAgentId">
+ <field name="agentId" type="integer" direct="false" get-method="getAgentId" set-method="setAgentId">
<bind-xml name="AgentId" node="attribute"/>
</field>
- <field name="mAgentName" type="string" direct="false" get-method="getAgentName" set-method="setAgentName">
+ <field name="agentName" type="string" direct="false" get-method="getAgentName" set-method="setAgentName">
<bind-xml name="AgentName" node="attribute"/>
</field>
- <field name="mAgentRole" type="string" direct="false" get-method="getAgentRole" set-method="setAgentRole">
+ <field name="agentRole" type="string" direct="false" get-method="getAgentRole" set-method="setAgentRole">
<bind-xml name="AgentRole" node="attribute"/>
</field>
- <field name="mStepType" type="string" direct="false" get-method="getStepType" set-method="setStepType">
- <bind-xml name="StepType" node="attribute"/>
+ <field name="schemaName" type="string" direct="false" get-method="getSchemaName" set-method="setSchemaName">
+ <bind-xml name="SchemaName" node="attribute"/>
+ </field>
+ <field name="schemaVersion" type="integer" direct="false" get-method="getSchemaVersion" set-method="setSchemaVersion">
+ <bind-xml name="SchemaVersion" node="attribute"/>
+ </field>
+ <field name="outcomeRequired" type="boolean" direct="false" get-method="isOutcomeRequired" set-method="setOutcomeRequired">
+ <bind-xml name="OutcomeRequired" node="attribute"/>
+ </field>
+ <field name="scriptName" type="string" direct="false" get-method="getScriptName" set-method="setScriptName">
+ <bind-xml name="ScriptName" node="attribute"/>
+ </field>
+ <field name="scriptVersion" type="integer" direct="false" get-method="getScriptVersion" set-method="setScriptVersion">
+ <bind-xml name="ScriptVersion" node="attribute"/>
</field>
- <field name="mActProps" type="com.c2kernel.utils.KeyValuePair" collection="array" container="false" direct="false" get-method="getKeyValuePairs" set-method="setKeyValuePairs">
+ <field name="actProps" type="com.c2kernel.utils.KeyValuePair" collection="array" container="false" direct="false" get-method="getKeyValuePairs" set-method="setKeyValuePairs">
<bind-xml name="ActProps" node="element"/>
</field>
</class>
diff --git a/src/main/resources/mapFiles/StateMachineMap.xml b/src/main/resources/mapFiles/StateMachineMap.xml index fb13789..7309647 100644 --- a/src/main/resources/mapFiles/StateMachineMap.xml +++ b/src/main/resources/mapFiles/StateMachineMap.xml @@ -22,8 +22,8 @@ <field name="name" type="string" direct="false">
<bind-xml name="name" node="attribute" />
</field>
- <field name="proceeds" type="boolean" direct="false">
- <bind-xml name="proceeds" node="attribute" />
+ <field name="finished" type="boolean" direct="false">
+ <bind-xml name="finishedd" node="attribute" />
</field>
</class>
<class name="com.c2kernel.lifecycle.instance.stateMachine.Transition">
@@ -36,8 +36,8 @@ <field name="originStateCode" type="integer" direct="false">
<bind-xml name="origin" node="attribute" />
</field>
- <field name="terminalStateCode" type="integer" direct="false">
- <bind-xml name="terminus" node="attribute" />
+ <field name="targetStateCode" type="integer" direct="false">
+ <bind-xml name="target" node="attribute" />
</field>
<field name="enabledProp" type="string" direct="false">
<bind-xml name="enablingProperty" node="attribute" />
|
