summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/entity/proxy/ItemProxy.java
diff options
context:
space:
mode:
authorabranson <andrew.branson@cern.ch>2011-08-04 00:42:34 +0200
committerabranson <andrew.branson@cern.ch>2011-08-04 00:42:34 +0200
commit0ec8481c10cd8277d84c7c1a785483a0a739e5a0 (patch)
tree5f6e5d9ae75193e67e6f3b3dfa488960c5cde1d5 /source/com/c2kernel/entity/proxy/ItemProxy.java
parent036cbdba66f804743c4c838ed598d6972c4b3e17 (diff)
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
Diffstat (limited to 'source/com/c2kernel/entity/proxy/ItemProxy.java')
-rw-r--r--source/com/c2kernel/entity/proxy/ItemProxy.java53
1 files changed, 28 insertions, 25 deletions
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<Job> getJobList(AgentProxy agent)
throws AccessRightsException,
ObjectNotFoundException,
PersistencyException
{
- return getJobList(agent.getSystemKey());
+ return getJobList(agent.getSystemKey());
}
-
+
private ArrayList<Job> getJobList(int agentId)
throws AccessRightsException,
ObjectNotFoundException,
@@ -189,7 +192,7 @@ public class ItemProxy extends EntityProxy
throws AccessRightsException,
ObjectNotFoundException,
PersistencyException {
-
+
ArrayList<Job> 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,