summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/c2kernel/lifecycle/instance/Workflow.java')
-rw-r--r--src/main/java/com/c2kernel/lifecycle/instance/Workflow.java45
1 files changed, 29 insertions, 16 deletions
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java b/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java
index 451d7fd..33c80a4 100644
--- a/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java
+++ b/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java
@@ -1,5 +1,6 @@
package com.c2kernel.lifecycle.instance;
import java.util.ArrayList;
+import java.util.UUID;
import com.c2kernel.common.AccessRightsException;
import com.c2kernel.common.InvalidDataException;
@@ -14,6 +15,8 @@ import com.c2kernel.graph.model.GraphPoint;
import com.c2kernel.graph.model.TypeNameAndConstructionInfo;
import com.c2kernel.lifecycle.instance.predefined.PredefinedStepContainer;
import com.c2kernel.lookup.AgentPath;
+import com.c2kernel.lookup.InvalidAgentPathException;
+import com.c2kernel.lookup.ItemPath;
import com.c2kernel.persistency.ClusterStorage;
import com.c2kernel.utils.Language;
import com.c2kernel.utils.Logger;
@@ -24,7 +27,7 @@ import com.c2kernel.utils.Logger;
public class Workflow extends CompositeActivity implements C2KLocalObject
{
public History history;
- private Integer itemSysKey = null;
+ private ItemPath itemPath = null;
/** TypeNameAndConstructionInfo[] variables added by Steve */
private final TypeNameAndConstructionInfo[] mVertexTypeNameAndConstructionInfo =
@@ -57,9 +60,9 @@ public class Workflow extends CompositeActivity implements C2KLocalObject
public History getHistory() throws InvalidDataException {
if (history == null) {
- if (itemSysKey == null)
+ if (itemPath == null)
throw new InvalidDataException("Workflow not initialized.", "");
- history = new History(itemSysKey, this);
+ history = new History(itemPath, this);
}
return history;
}
@@ -98,12 +101,12 @@ public class Workflow extends CompositeActivity implements C2KLocalObject
* @throws PersistencyException
*/
//requestData is xmlstring
- public String requestAction(AgentPath agent, String stepPath, int itemSysKey, int transitionID, String requestData)
+ public String requestAction(AgentPath agent, String stepPath, ItemPath itemPath, int transitionID, String requestData)
throws ObjectNotFoundException, AccessRightsException, InvalidTransitionException, InvalidDataException, ObjectAlreadyExistsException, PersistencyException
{
- Logger.msg(3, "Action: " + transitionID + " " + stepPath + " by " + agent.getAgentName());
+ Logger.msg(3, "Action: " + transitionID + " " + stepPath + " by " + agent);
if (search(stepPath) != null)
- return ((Activity) search(stepPath)).request(agent, itemSysKey, transitionID, requestData);
+ return ((Activity) search(stepPath)).request(agent, itemPath, transitionID, requestData);
else
throw new ObjectNotFoundException(stepPath + " not found", "");
}
@@ -172,12 +175,12 @@ public class Workflow extends CompositeActivity implements C2KLocalObject
* @throws AccessRightsException
* @throws InvalidTransitionException
*/
- public void initialise(int systemKey, AgentPath agent) throws InvalidDataException, InvalidTransitionException, AccessRightsException, ObjectNotFoundException
+ public void initialise(ItemPath itemPath, AgentPath agent) throws InvalidDataException, InvalidTransitionException, AccessRightsException, ObjectNotFoundException
{
- itemSysKey = systemKey;
+ setItemPath(itemPath);
try
{
- runFirst(agent, systemKey);
+ runFirst(agent, itemPath);
}
catch (InvalidDataException ex)
{
@@ -188,13 +191,22 @@ public class Workflow extends CompositeActivity implements C2KLocalObject
}
}
- public Integer getItemSysKey() {
- return itemSysKey;
+ public ItemPath getItemPath() {
+ return itemPath;
}
- public void setItemSysKey(Integer itemSysKey) {
- this.itemSysKey = itemSysKey;
+ public void setItemPath(ItemPath itemPath) {
+ this.itemPath = itemPath;
}
+
+ public void setItemUUID( String uuid )
+ {
+ setItemPath(new ItemPath(UUID.fromString(uuid)));
+ }
+
+ public String getItemUUID() {
+ return getItemPath().getUUID().toString();
+ }
/**
* if type = 0 only domain steps will be queried if type = 1 only predefined steps will be queried else both will be queried
@@ -204,14 +216,15 @@ public class Workflow extends CompositeActivity implements C2KLocalObject
* @return
* @throws ObjectNotFoundException
* @throws InvalidDataException
+ * @throws InvalidAgentPathException
*/
- public ArrayList<Job> calculateJobs(AgentPath agent, int itemSysKey, int type) throws ObjectNotFoundException, InvalidDataException
+ public ArrayList<Job> calculateJobs(AgentPath agent, ItemPath itemPath, int type) throws ObjectNotFoundException, InvalidDataException, InvalidAgentPathException
{
ArrayList<Job> jobs = new ArrayList<Job>();
if (type != 1)
- jobs.addAll(((CompositeActivity) search("workflow/domain")).calculateJobs(agent, itemSysKey, true));
+ jobs.addAll(((CompositeActivity) search("workflow/domain")).calculateJobs(agent, itemPath, true));
if (type != 0)
- jobs.addAll(((CompositeActivity) search("workflow/predefined")).calculateJobs(agent, itemSysKey, true));
+ jobs.addAll(((CompositeActivity) search("workflow/predefined")).calculateJobs(agent, itemPath, true));
return jobs;
}
/**