From b086f57f56bf0eb9dab9cf321a0f69aaaae84347 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Wed, 30 May 2012 08:37:45 +0200 Subject: Initial Maven Conversion --- source/com/c2kernel/entity/agent/Job.java | 346 ------------------------------ 1 file changed, 346 deletions(-) delete mode 100644 source/com/c2kernel/entity/agent/Job.java (limited to 'source/com/c2kernel/entity/agent/Job.java') diff --git a/source/com/c2kernel/entity/agent/Job.java b/source/com/c2kernel/entity/agent/Job.java deleted file mode 100644 index b5274ec..0000000 --- a/source/com/c2kernel/entity/agent/Job.java +++ /dev/null @@ -1,346 +0,0 @@ -package com.c2kernel.entity.agent; - -import com.c2kernel.common.ObjectNotFoundException; -import com.c2kernel.entity.C2KLocalObject; -import com.c2kernel.entity.proxy.AgentProxy; -import com.c2kernel.entity.proxy.ItemProxy; -import com.c2kernel.lifecycle.instance.stateMachine.Transitions; -import com.c2kernel.lookup.EntityPath; -import com.c2kernel.lookup.InvalidEntityPathException; -import com.c2kernel.persistency.ClusterStorage; -import com.c2kernel.persistency.outcome.Outcome; -import com.c2kernel.persistency.outcome.Viewpoint; -import com.c2kernel.process.Gateway; -import com.c2kernel.utils.CastorHashMap; -import com.c2kernel.utils.KeyValuePair; -import com.c2kernel.utils.Logger; - -/******************************************************************************* - * @author $Author: abranson $ $Date: 2005/05/20 13:07:49 $ - * @version $Revision: 1.62 $ - ******************************************************************************/ -public class Job implements C2KLocalObject -{ - private int mID; - - private String mName; - - private int mItemSysKey; - - private String mStepPath; - - private int mPossibleTransition; - - private int mCurrentState; - - private int mTargetState; - - private String mStepName; - - private int mAgentId = -1; - - private String mAgentName; - - private String mAgentRole; - - private CastorHashMap mActProps = new CastorHashMap(); - - private String mOutcome; - - private String mStepType; - - private ItemProxy item = null; - - private AgentProxy agent = null; - - /*************************************************************************** - * Empty constructor for Castor - **************************************************************************/ - public Job() - { - } - - /*************************************************************************** - * - **************************************************************************/ - public Job(int sysKey, String path, int transition, int currState, int targState, String stepName, CastorHashMap actProps, String stepType, String agentName) - { - setItemSysKey(sysKey); - setStepPath(path); - setPossibleTransition(transition); - setCurrentState(currState); - setTargetState(targState); - setStepName(stepName); - setActProps(actProps); - setStepType(stepType); - setAgentName(agentName); - } - - public int getItemSysKey() - { - return mItemSysKey; - } - - public ItemProxy getItemProxy() throws ObjectNotFoundException, InvalidEntityPathException - { - if (item == null) - item = (ItemProxy) Gateway.getProxyManager().getProxy(new EntityPath(mItemSysKey)); - return item; - } - - public AgentProxy getAgentProxy() throws ObjectNotFoundException, InvalidEntityPathException - { - if (agent == null) - agent = (AgentProxy) Gateway.getProxyManager().getProxy(new EntityPath(getAgentId())); - return agent; - } - - public String getDescription() - { - String desc = (String) mActProps.get("Description"); - if (desc == null) - desc = "No Description"; - return desc; - } - - public String getSchemaType() - { - return (String) mActProps.get("SchemaType"); - } - - public int getSchemaVersion() - { - try - { - return Integer.parseInt((String) mActProps.get("SchemaVersion")); - } catch (NumberFormatException ex) - { - return -1; - } - } - - public void setOutcome(String outcome) - { - mOutcome = outcome; - } - - public String getOutcomeString() - { - Logger.debug(8, "getOutcomeString() " + (mOutcome == null && isOutcomeUsed())); - if (mOutcome == null && isOutcomeUsed()) - { - String viewName = (String) getActProp("Viewpoint"); - mOutcome = null; - if (viewName.length() > 0) - try - { - Viewpoint view = (Viewpoint) Gateway.getStorage().get(getItemSysKey(), ClusterStorage.VIEWPOINT + "/" + getSchemaType() + "/" + viewName, null); - mOutcome = view.getOutcome().getData(); - } catch (Exception ex) - { // not found, return null - } - } - return mOutcome; - } - - public Outcome getOutcome() - { - Logger.msg(1, "Get outcome"); - return new Outcome(-1, getOutcomeString(), getSchemaType(), getSchemaVersion()); - } - - public int getAgentId() throws ObjectNotFoundException - { - if (mAgentId == -1) - mAgentId = Gateway.getLDAPLookup().getRoleManager().getAgentPath(getAgentName()).getSysKey(); - return mAgentId; - } - - public void setAgentId(int id) - { - mAgentId = id; - agent = null; - } - - public String getAgentName() - { - if (mAgentName == null) - mAgentName = (String) mActProps.get("AgentName"); - return mAgentName; - } - - public void setAgentName(String agentName) - { - mAgentName = agentName; - } - - public String getAgentRole() - { - if (mAgentRole == null) - mAgentRole = (String) mActProps.get("Agent Role"); - return mAgentRole; - } - - public void setAgentRole(String role) - { - mAgentRole = role; - } - - public boolean isOutcomeUsed() - { - String schemaType = getSchemaType(); - return (Boolean.TRUE.equals(getActProp("AlwaysUseOutcome")) || mPossibleTransition == Transitions.DONE || mPossibleTransition == Transitions.COMPLETE) && !(schemaType == null || schemaType.equals("")); - } - - public int getID() - { - return mID; - } - - @Override - public String getName() - { - return mName; - } - - public void setID(int id) - { - mID = id; - mName = String.valueOf(id); - } - - @Override - public void setName(String name) - { - mName = name; - try - { - mID = Integer.parseInt(name); - } catch (NumberFormatException ex) - { - mID = -1; - } - } - - public void setItemSysKey(int sysKey) - { - mItemSysKey = sysKey; - item = null; - } - - @Override - public String getClusterType() - { - return ClusterStorage.JOB; - } - - public boolean equals(Job job) - { - return (getItemSysKey() == job.getItemSysKey()) && this.mStepPath.equals(job.mStepPath) && this.mPossibleTransition == job.mPossibleTransition; - } - - public Object getActProp(String name) - { - return mActProps.get(name); - } - - public String getActPropString(String name) - { - try - { - return mActProps.get(name).toString(); - } catch (NullPointerException ex) - { - return null; - } - } - - public String getStepName() - { - return mStepName; - } - - public void setStepName(String string) - { - mStepName = string; - } - - public String getStepPath() - { - return mStepPath; - } - - public void setStepPath(String string) - { - mStepPath = string; - } - - public int getPossibleTransition() - { - return mPossibleTransition; - } - - public void setPossibleTransition(int lint) - { - mPossibleTransition = lint; - } - - public CastorHashMap getActProps() - { - return mActProps; - } - - public void setActProps(CastorHashMap map) - { - mActProps = map; - } - - public KeyValuePair[] getKeyValuePairs() - { - return mActProps.getKeyValuePairs(); - } - - public void setKeyValuePairs(KeyValuePair[] pairs) - { - mActProps.setKeyValuePairs(pairs); - } - - public int getCurrentState() - { - return mCurrentState; - } - - public void setCurrentState(int string) - { - mCurrentState = string; - } - - public int getTargetState() { - return mTargetState; - } - - public void setTargetState(int mTargetState) { - this.mTargetState = mTargetState; - } - - /** - * Returns the actType. - * - * @return String - */ - public String getStepType() - { - return mStepType; - } - - /** - * Sets the actType. - * - * @param actType - * The actType to set - */ - public void setStepType(String actType) - { - mStepType = actType; - } -} \ No newline at end of file -- cgit v1.2.3