Search in sources :

Example 6 with Transition

use of org.cristalise.kernel.lifecycle.instance.stateMachine.Transition in project kernel by cristal-ise.

the class CompositeActivity method request.

@Override
public String request(AgentPath agent, AgentPath delegator, ItemPath itemPath, int transitionID, String requestData, Object locker) throws AccessRightsException, InvalidTransitionException, InvalidDataException, ObjectNotFoundException, PersistencyException, ObjectAlreadyExistsException, ObjectCannotBeUpdated, CannotManageException, InvalidCollectionModification {
    Transition trans = getStateMachine().getTransition(transitionID);
    if (trans.isFinishing() && hasActive()) {
        if ((Boolean) getBuiltInProperty(ABORTABLE))
            abort();
        else
            throw new InvalidTransitionException("Attempted to finish a composite activity that had active children but was not Abortable");
    }
    if (getStateMachine().getTransition(transitionID).reinitializes()) {
        int preserveState = state;
        reinit(getID());
        setState(preserveState);
    }
    if (getChildrenGraphModel().getStartVertex() != null && (getStateMachine().getState(state).equals(getStateMachine().getInitialState()) || getStateMachine().getTransition(transitionID).reinitializes())) {
        ((WfVertex) getChildrenGraphModel().getStartVertex()).run(agent, itemPath, locker);
    }
    return super.request(agent, delegator, itemPath, transitionID, requestData, locker);
}
Also used : InvalidTransitionException(org.cristalise.kernel.common.InvalidTransitionException) Transition(org.cristalise.kernel.lifecycle.instance.stateMachine.Transition) GraphPoint(org.cristalise.kernel.graph.model.GraphPoint)

Aggregations

Transition (org.cristalise.kernel.lifecycle.instance.stateMachine.Transition)6 InvalidDataException (org.cristalise.kernel.common.InvalidDataException)4 InvalidTransitionException (org.cristalise.kernel.common.InvalidTransitionException)3 ObjectNotFoundException (org.cristalise.kernel.common.ObjectNotFoundException)3 PersistencyException (org.cristalise.kernel.common.PersistencyException)3 AccessRightsException (org.cristalise.kernel.common.AccessRightsException)2 CannotManageException (org.cristalise.kernel.common.CannotManageException)2 ObjectAlreadyExistsException (org.cristalise.kernel.common.ObjectAlreadyExistsException)2 InvalidAgentPathException (org.cristalise.kernel.lookup.InvalidAgentPathException)2 ArrayList (java.util.ArrayList)1 TreeSet (java.util.TreeSet)1 Job (org.cristalise.kernel.entity.agent.Job)1 History (org.cristalise.kernel.events.History)1 GraphPoint (org.cristalise.kernel.graph.model.GraphPoint)1 State (org.cristalise.kernel.lifecycle.instance.stateMachine.State)1 Outcome (org.cristalise.kernel.persistency.outcome.Outcome)1 Schema (org.cristalise.kernel.persistency.outcome.Schema)1 Viewpoint (org.cristalise.kernel.persistency.outcome.Viewpoint)1