From 0ec8481c10cd8277d84c7c1a785483a0a739e5a0 Mon Sep 17 00:00:00 2001 From: abranson Date: Thu, 4 Aug 2011 00:42:34 +0200 Subject: More code cleanup: Refactored Entity Proxy Subscription to handle generics better Rewrote RemoteMap to use TreeMap instead of the internal array for order. It now sorts its keys by number if they parse, else as strings. Removed a no-longer-in-progress outcome form class --- source/com/c2kernel/entity/proxy/ItemProxy.java | 53 +++++++++++++------------ 1 file changed, 28 insertions(+), 25 deletions(-) (limited to 'source/com/c2kernel/entity/proxy/ItemProxy.java') diff --git a/source/com/c2kernel/entity/proxy/ItemProxy.java b/source/com/c2kernel/entity/proxy/ItemProxy.java index 702dd26..658e0c8 100644 --- a/source/com/c2kernel/entity/proxy/ItemProxy.java +++ b/source/com/c2kernel/entity/proxy/ItemProxy.java @@ -18,7 +18,9 @@ import com.c2kernel.common.InvalidTransitionException; import com.c2kernel.common.ObjectAlreadyExistsException; import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; -import com.c2kernel.entity.*; +import com.c2kernel.entity.Item; +import com.c2kernel.entity.ItemHelper; +import com.c2kernel.entity.ManageableEntity; import com.c2kernel.entity.agent.Job; import com.c2kernel.entity.agent.JobArrayList; import com.c2kernel.lifecycle.instance.stateMachine.Transitions; @@ -43,10 +45,11 @@ public class ItemProxy extends EntityProxy throws ObjectNotFoundException { super(ior, systemKey); - + } - public ManageableEntity narrow() throws ObjectNotFoundException + @Override + public ManageableEntity narrow() throws ObjectNotFoundException { try { return ItemHelper.narrow(mIOR); @@ -86,29 +89,29 @@ public class ItemProxy extends EntityProxy } catch (Exception e) { Logger.error(e); throw new PersistencyException("Could not store property"); - } + } } /************************************************************************** * **************************************************************************/ - protected void requestAction( Job thisJob ) - throws AccessRightsException, - InvalidTransitionException, - ObjectNotFoundException, - InvalidDataException, + protected void requestAction( Job thisJob ) + throws AccessRightsException, + InvalidTransitionException, + ObjectNotFoundException, + InvalidDataException, PersistencyException, ObjectAlreadyExistsException { - String outcome = thisJob.getOutcomeString(); + String outcome = thisJob.getOutcomeString(); // check fields that should have been filled in - if (outcome==null) - if (thisJob.isOutcomeUsed()) + if (outcome==null) + if (thisJob.isOutcomeUsed()) throw new InvalidDataException("Outcome is required.", ""); else - outcome=""; - - if (thisJob.getAgentId() == -1) - throw new InvalidDataException("No Agent specified.", ""); + outcome=""; + + if (thisJob.getAgentId() == -1) + throw new InvalidDataException("No Agent specified.", ""); Logger.msg(7, "ItemProxy - executing "+thisJob.getStepPath()+" for "+thisJob.getAgentName()); requestAction (thisJob.getAgentId(), thisJob.getStepPath(), @@ -128,7 +131,7 @@ public class ItemProxy extends EntityProxy PersistencyException, ObjectAlreadyExistsException { - ((Item)getEntity()).requestAction( agentId, + ((Item)getEntity()).requestAction( agentId, stepPath, transitionID, requestData ); @@ -139,9 +142,9 @@ public class ItemProxy extends EntityProxy **************************************************************************/ public String queryLifeCycle( int agentId, boolean filter - ) - throws AccessRightsException, - ObjectNotFoundException, + ) + throws AccessRightsException, + ObjectNotFoundException, PersistencyException { return ((Item)getEntity()).queryLifeCycle( agentId, @@ -168,15 +171,15 @@ public class ItemProxy extends EntityProxy } return thisJobList.list; } - + public ArrayList getJobList(AgentProxy agent) throws AccessRightsException, ObjectNotFoundException, PersistencyException { - return getJobList(agent.getSystemKey()); + return getJobList(agent.getSystemKey()); } - + private ArrayList getJobList(int agentId) throws AccessRightsException, ObjectNotFoundException, @@ -189,7 +192,7 @@ public class ItemProxy extends EntityProxy throws AccessRightsException, ObjectNotFoundException, PersistencyException { - + ArrayList jobList = getJobList(agentId); for (Job job : jobList) { int transition = job.getPossibleTransition(); @@ -200,7 +203,7 @@ public class ItemProxy extends EntityProxy return null; } - + public Job getJobByName(String actName, AgentProxy agent) throws AccessRightsException, ObjectNotFoundException, -- cgit v1.2.3