diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2014-10-03 17:30:41 +0200 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2014-10-03 17:30:41 +0200 |
| commit | 275d0bbf555c8917be82ce4cc21eb4cabb00f4c5 (patch) | |
| tree | ddcc6b14077d90d1b970b67829f07120547dbb62 /src/main/java/com/c2kernel/lifecycle/instance/Workflow.java | |
| parent | a139f95bfeca603333b8c0310ae09c6805e58584 (diff) | |
Huge exception overhaul: Merged ClusterStorageException with
PersistencyException. Replaced MembershipException with
InvalidCollectionModification CORBA Exception. Made all predef steps
throw more accurate exceptions when they go wrong, and let more
exceptions bubble through from underneath.
Diffstat (limited to 'src/main/java/com/c2kernel/lifecycle/instance/Workflow.java')
| -rw-r--r-- | src/main/java/com/c2kernel/lifecycle/instance/Workflow.java | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java b/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java index abb38cf..f1719f6 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java @@ -22,10 +22,13 @@ package com.c2kernel.lifecycle.instance; import java.util.ArrayList;
import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.common.ObjectAlreadyExistsException;
-import com.c2kernel.common.ObjectNotFoundException;
+import com.c2kernel.common.CannotManage;
+import com.c2kernel.common.InvalidCollectionModification;
+import com.c2kernel.common.InvalidData;
+import com.c2kernel.common.InvalidTransition;
+import com.c2kernel.common.ObjectAlreadyExists;
+import com.c2kernel.common.ObjectCannotBeUpdated;
+import com.c2kernel.common.ObjectNotFound;
import com.c2kernel.common.PersistencyException;
import com.c2kernel.entity.C2KLocalObject;
import com.c2kernel.entity.agent.Job;
@@ -78,10 +81,10 @@ public class Workflow extends CompositeActivity implements C2KLocalObject addChild(predef, new GraphPoint(300, 100));
}
- public History getHistory() throws InvalidDataException {
+ public History getHistory() throws InvalidData {
if (history == null) {
if (itemPath == null)
- throw new InvalidDataException("Workflow not initialized.", "");
+ throw new InvalidData("Workflow not initialized.");
history = new History(itemPath, this);
}
return history;
@@ -114,21 +117,24 @@ public class Workflow extends CompositeActivity implements C2KLocalObject * @param stepPath
* @param transitionID
* @param reguestData
- * @throws ObjectNotFoundException
+ * @throws ObjectNotFound
* @throws AccessRightsException
- * @throws InvalidTransitionException
- * @throws InvalidDataException
+ * @throws InvalidTransition
+ * @throws InvalidData
* @throws PersistencyException
+ * @throws ObjectCannotBeUpdated
+ * @throws CannotManage
+ * @throws InvalidCollectionModification
*/
//requestData is xmlstring
public String requestAction(AgentPath agent, String stepPath, ItemPath itemPath, int transitionID, String requestData)
- throws ObjectNotFoundException, AccessRightsException, InvalidTransitionException, InvalidDataException, ObjectAlreadyExistsException, PersistencyException
+ throws ObjectNotFound, AccessRightsException, InvalidTransition, InvalidData, ObjectAlreadyExists, PersistencyException, ObjectCannotBeUpdated, CannotManage, InvalidCollectionModification
{
Logger.msg(3, "Action: " + transitionID + " " + stepPath + " by " + agent);
if (search(stepPath) != null)
return ((Activity) search(stepPath)).request(agent, itemPath, transitionID, requestData);
else
- throw new ObjectNotFoundException(stepPath + " not found", "");
+ throw new ObjectNotFound(stepPath + " not found");
}
/**
@@ -190,25 +196,17 @@ public class Workflow extends CompositeActivity implements C2KLocalObject * Method initialise.
*
* @param systemKey
- * @throws InvalidDataException
- * @throws ObjectNotFoundException
+ * @throws InvalidData
+ * @throws ObjectNotFound
* @throws AccessRightsException
- * @throws InvalidTransitionException
+ * @throws InvalidTransition
+ * @throws ObjectAlreadyExists
+ * @throws ObjectCannotBeUpdated
*/
- public void initialise(ItemPath itemPath, AgentPath agent) throws InvalidDataException, InvalidTransitionException, AccessRightsException, ObjectNotFoundException
+ public void initialise(ItemPath itemPath, AgentPath agent) throws InvalidData
{
setItemPath(itemPath);
- try
- {
- runFirst(agent, itemPath);
- }
- catch (InvalidDataException ex)
- {
- Logger.error(ex);
- } catch (PersistencyException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ runFirst(agent, itemPath);
}
public ItemPath getItemPath() {
@@ -234,11 +232,11 @@ public class Workflow extends CompositeActivity implements C2KLocalObject * @param itemSysKey
* @param type
* @return
- * @throws ObjectNotFoundException
- * @throws InvalidDataException
+ * @throws ObjectNotFound
+ * @throws InvalidData
* @throws InvalidAgentPathException
*/
- public ArrayList<Job> calculateJobs(AgentPath agent, ItemPath itemPath, int type) throws ObjectNotFoundException, InvalidDataException, InvalidAgentPathException
+ public ArrayList<Job> calculateJobs(AgentPath agent, ItemPath itemPath, int type) throws InvalidAgentPathException, ObjectNotFound, InvalidData
{
ArrayList<Job> jobs = new ArrayList<Job>();
if (type != 1)
|
