From 275d0bbf555c8917be82ce4cc21eb4cabb00f4c5 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Fri, 3 Oct 2014 17:30:41 +0200 Subject: 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. --- .../instance/stateMachine/Transition.java | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/main/java/com/c2kernel/lifecycle/instance/stateMachine/Transition.java') 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 8c6502f..78786da 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/Transition.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/Transition.java @@ -25,8 +25,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import com.c2kernel.common.AccessRightsException; -import com.c2kernel.common.InvalidDataException; -import com.c2kernel.common.ObjectNotFoundException; +import com.c2kernel.common.InvalidData; +import com.c2kernel.common.ObjectNotFound; import com.c2kernel.lifecycle.instance.Activity; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.RolePath; @@ -188,15 +188,15 @@ public class Transition { this.targetStateId = targetStateId; } - public String getPerformingRole(Activity act, AgentPath agent) throws ObjectNotFoundException, AccessRightsException { + public String getPerformingRole(Activity act, AgentPath agent) throws ObjectNotFound, AccessRightsException { // check available if (!isEnabled(act.getProperties())) - throw new AccessRightsException("Transition '"+name+"' is disabled by the '"+enabledProp+"' property.", ""); + throw new AccessRightsException("Transition '"+name+"' is disabled by the '"+enabledProp+"' property."); // check active if (isRequiresActive() && !act.getActive()) - throw new AccessRightsException("Activity must be active to perform this transition", ""); + throw new AccessRightsException("Activity must be active to perform this transition"); RolePath role = null; String overridingRole = resolveValue(roleOverride, act.getProperties()); @@ -224,7 +224,7 @@ public class Transition { // Decide the access if (isOwned && !override && !isOwner) throw new AccessRightsException("Agent '"+agent.getAgentName() - +"' cannot perform this transition because the activity '"+act.getName()+"' is currently owned by "+agentName, ""); + +"' cannot perform this transition because the activity '"+act.getName()+"' is currently owned by "+agentName); if (role != null) { if (agent.hasRole(role)) @@ -233,7 +233,7 @@ public class Transition { return "Admin"; else throw new AccessRightsException("Agent '"+agent.getAgentName() - +"' does not hold a suitable role '"+role.getName()+"' for the activity "+act.getName(), ""); + +"' does not hold a suitable role '"+role.getName()+"' for the activity "+act.getName()); } else return null; @@ -284,13 +284,13 @@ public class Transition { return true; } - public Schema getSchema(CastorHashMap actProps) throws InvalidDataException, ObjectNotFoundException { + public Schema getSchema(CastorHashMap actProps) throws InvalidData, ObjectNotFound { if (hasOutcome(actProps)) try { return LocalObjectLoader.getSchema(resolveValue(outcome.schemaName, actProps), Integer.parseInt(resolveValue(outcome.schemaVersion, actProps))); } catch (NumberFormatException ex) { - throw new InvalidDataException("Bad schema version number: "+outcome.schemaVersion+" ("+resolveValue(outcome.schemaVersion, actProps)+")", ""); + throw new InvalidData("Bad schema version number: "+outcome.schemaVersion+" ("+resolveValue(outcome.schemaVersion, actProps)+")"); } else return null; @@ -300,11 +300,11 @@ public class Transition { return resolveValue(script.scriptName, actProps); } - public int getScriptVersion(CastorHashMap actProps) throws InvalidDataException { + public int getScriptVersion(CastorHashMap actProps) throws InvalidData { try { return Integer.parseInt(resolveValue(script.scriptVersion, actProps)); } catch (NumberFormatException ex) { - throw new InvalidDataException("Bad Script version number: "+script.scriptVersion+" ("+resolveValue(script.scriptVersion, actProps)+")", ""); + throw new InvalidData("Bad Script version number: "+script.scriptVersion+" ("+resolveValue(script.scriptVersion, actProps)+")"); } } -- cgit v1.2.3