summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2014-09-09 12:13:21 +0200
committerAndrew Branson <andrew.branson@cern.ch>2014-09-09 12:13:21 +0200
commitda731d2bb81666b9c697d9099da632e7dfcdc0f7 (patch)
tree567693c3c48f3d15ecbb2dac4f9db03bb6e58c72 /src/main/java/com/c2kernel/lifecycle/instance/Workflow.java
parentae1e79e33fd30e3d8bcedbef8891a14a048276d7 (diff)
Replaced int sysKey Item identifier with UUID, which is now portable.
ItemPath objects are now used to identify Items throughout the kernel, replacing ints and Integers.
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;
}
/**