Skip to content
This repository has been archived by the owner on Mar 31, 2019. It is now read-only.
Zsolt Kovács edited this page Jul 26, 2018 · 5 revisions

A Job object represents a possible transition by a particular Agent of an Activity of the Workflow of an Item. There are two types found in the CRISTAL kernel:

  1. Agent-Active Job: This is a non-persistent Job, calculated for an Agent by an Item's Workflow at a particular point in time, using ItemProxy.getJobs(AgentProxy) in the Client API, which in turn calls queryLifeCycle on the remote Item. GetJobs returns a JobArrayList containing the relevant Jobs. There is no notification if the Activities change state after the query, so attempted executions could return an InvalidTransitionException if the Workflow has advanced since that time.
  2. Item-Active Job: These are persistent Jobs which are stored in the JobList ClusterStorage of the Agent. For Activities that are assigned to a Role that requires Job pushing, the JobLists of Agent who hold that role will be populated with Jobs whenever those Activities are active, and their state changes. Agent implementations can then subscribe to those clusters, and be informed whenever Jobs are added or removed.

Jobs contain the full properties of the Activity that generated it. This is main mechanism for passing parameters from the original Activity description to the executing Agent. An Agent may use the hasOutcome and isOutcomeRequired methods to check, respectively, if the transition can have an Outcome, and if one is required for successful execution. This Any outcome from the work performed may be provided with setOutcome(String). Outcomes may have a initial non-empty state, such as when their Activities reference a Viewpoint to be editing, or the OutcomeInitiator is set, so the Outcome should be initialized by retrieving it from the Job first, though this outcome may be discarded by the Agent if required. If an error occurred during the execution, and the transition is set to accept an Outcome of the Errors schema (for instance, the suspend transition of the default state machine), then it may be set as an ErrorInfo object with the setErrors method.

For an Agent client process to execute the Job, the AgentProxy.execute method should be called with the Job as a parameter. This performs the following actions:

  1. If an Outcome is set, an OutcomeValidator for the Activity's declared XMLSchema is obtained.
  2. If the Activity specified that a Script should be run, then the Script is loaded and executed, and finally the Outcome is validated (the Script could manipulate an incomplete Outcome)
  3. The outcome is validated.
  4. The requestAction method on the remote Item is called, with the Agent id, Activity path, Transition id and Outcome as parameters.
Clone this wiki locally