it.amattioli.workstate.core
Class Machine
java.lang.Object
it.amattioli.workstate.core.State
it.amattioli.workstate.core.RealState
it.amattioli.workstate.core.CompositeState
it.amattioli.workstate.core.SequentialState
it.amattioli.workstate.core.Machine
- All Implemented Interfaces:
- AttributeHandler, AttributeReader, Receiver, Cloneable
public class Machine
- extends SequentialState
- implements Cloneable
CONVERSION_SERVICE_TAG
public static final String CONVERSION_SERVICE_TAG
- See Also:
- Constant Field Values
Machine
public Machine(MetaMachine metastate,
CompositeState parent)
Machine
public Machine(MetaMachine metastate)
setOwner
public void setOwner(Object owner)
throws WorkflowException
- Set the state machine owner. When a state machine is used inside the
business layer, the machine will be often an attribute of an entity. This
method allows to set a back reference to this entity so it is available
to actions and guards as a state machine attribute whose tag is
MetaMachine.OWNER_TAG.
- Parameters:
owner - the owner of this state machine
- Throws:
WorkflowException
getAttribute
public Object getAttribute(String tag)
- Description copied from class:
RealState
- Get the value of an attribute accessible to this state. An attribute is
accessible if it belongs to this state or to one of its ancestors.
- Specified by:
getAttribute in interface AttributeReader- Overrides:
getAttribute in class RealState
- Parameters:
tag - the attribute tag
- Returns:
- the attribute value
addAllAttributes
protected Map<String,Object> addAllAttributes(Map<String,Object> attributes)
- Description copied from class:
RealState
- Add to the passed map all the attributes that are accessible from this
state. If the map contains a key identical to an attribute tag the old
entry will be retained.
- Overrides:
addAllAttributes in class RealState
setAttribute
public void setAttribute(String tag,
Object value)
throws WorkflowException
- Description copied from class:
RealState
- Set the value of an attribute accessible from this state. An attribute is
accessible if it belongs to this state or to one of its ancestors.
- Specified by:
setAttribute in interface AttributeHandler- Overrides:
setAttribute in class RealState
- Parameters:
tag - the attribute tagvalue - the new attribute value
- Throws:
WorkflowException
hasAllowedAttribute
public boolean hasAllowedAttribute(String tag)
- Description copied from class:
RealState
- Check if the passed string is the tag of an attribute that can be
accessed by this state. An attribute is accessible if it belongs to this
state or to one of its ancestors.
- Overrides:
hasAllowedAttribute in class RealState
- Parameters:
tag - the attribute tag
- Returns:
- true if the attribute is accessible, false otherwise
getRootMachine
public Machine getRootMachine()
- Overrides:
getRootMachine in class State
buildEvent
public Event buildEvent(String name,
Map<String,Object> stringParameters)
throws WorkflowException
- Overrides:
buildEvent in class CompositeState
- Throws:
WorkflowException
admitEvent
public boolean admitEvent(String eventName,
Map<String,Object> stringParameters)
throws WorkflowException
- Throws:
WorkflowException
postEvent
public void postEvent(String name,
Map<String,Object> stringParameters)
throws WorkflowException
- Throws:
WorkflowException
postEvent
public void postEvent(String name)
throws WorkflowException
- Throws:
WorkflowException
postEvent
public void postEvent(Event event)
processEvents
public void processEvents()
throws WorkflowException
- Throws:
WorkflowException
isInState
public boolean isInState(MetaState matchingMetaState)
useConversionService
public void useConversionService(ConversionService conversionService)
terminate
public void terminate()
throws WorkflowException
- Overrides:
terminate in class SequentialState
- Throws:
WorkflowException
clone
public Machine clone()
- Overrides:
clone in class Object
Copyright © 2011. All Rights Reserved.