com.bigbross.bossa.wfnet
Class CaseType

java.lang.Object
  extended bycom.bigbross.bossa.wfnet.CaseType
All Implemented Interfaces:
Serializable

public class CaseType
extends Object
implements Serializable

This class represents the definition of a process (case type). It also keeps track of all current cases of this case type.

Author:
BigBross Team
See Also:
Serialized Form

Constructor Summary
CaseType(String id)
          Creates a new case type, without any places or transitions.
 
Method Summary
 void buildTemplate(Map attributes)
          Builds the template case that will spawn all other cases.
 List getActivities()
          Returns the list of all activities of the cases of this case type.
 Case getCase(int id)
          Returns a case by its id.
 List getCases()
          Returns all cases of this case type.
 String getId()
          Returns the id of this case type.
 Place getPlace(String id)
          Returns the place of this case type that has the specified id.
 List getResources()
          Returns all resource groups of this case type.
 Transition getTransition(String id)
          Returns the transition of this case type that has the specified id.
 List getWorkItems()
          Returns the list of all work items of the cases of this case type.
 List getWorkItems(boolean getInitial)
          Returns the list of all work items of the cases of this case type.
 Case openCase()
          Creates a new case using the state of the case type template.
 Case openCase(Map state)
          Creates a new case using the provided state as the initial token count.
 Place registerPlace(String id)
          Creates a place with the specified id and initial marking set to zero in this case type.
 Place registerPlace(String id, int initialMarking)
          Creates a place with the specified id and initial marking in this case type.
 Transition registerTransition(String id, String resource)
          Creates a transition with the specified id and resource expression, but with no timeout, in this case type.
 Transition registerTransition(String id, String resource, long timeout)
          Creates a transition with the specified id, resource expression and timeout in this case type.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CaseType

public CaseType(String id)
Creates a new case type, without any places or transitions.

Parameters:
id - the id of the new case type.
Method Detail

getId

public String getId()
Returns the id of this case type.

Returns:
the id of this case type.

registerPlace

public Place registerPlace(String id,
                           int initialMarking)
Creates a place with the specified id and initial marking in this case type.

Parameters:
id - the place id.
initialMarking - the initial marking, the number of tokens in this place when a new case starts.
Returns:
the created place.

registerPlace

public Place registerPlace(String id)
Creates a place with the specified id and initial marking set to zero in this case type.

Parameters:
id - the place id.
Returns:
the created place.

getPlace

public Place getPlace(String id)
Returns the place of this case type that has the specified id.

Parameters:
id - the place id.
Returns:
the place, or null if there is no such a place.

registerTransition

public Transition registerTransition(String id,
                                     String resource,
                                     long timeout)
Creates a transition with the specified id, resource expression and timeout in this case type.

The resource expression defines which resources can perform work items associated with this transition. If it is null or an empty string, every resource can do it.

The timeout sets a number of milliseconds this transition will wait before it fires automatically. If the timeout is negative, the transition will never fire automatically. If it is zero, this transition will fire immediately.

NOTICE: As of this version of Bossa, the only timeout possible is zero or no timeout.

Parameters:
id - the transition id.
resource - the expression to select the resource responsible by this transition.
timeout - the number of milliseconds this transition will wait before it fires automatically.
Returns:
the created transition.
See Also:
Expression

registerTransition

public Transition registerTransition(String id,
                                     String resource)
Creates a transition with the specified id and resource expression, but with no timeout, in this case type.

NOTICE: As of this version of Bossa, the only timeout possible is zero or no timeout.

Parameters:
id - the transition id.
resource - the expression to select the resource responsible by this transition.
Returns:
the created transition.
See Also:
Expression

getTransition

public Transition getTransition(String id)
Returns the transition of this case type that has the specified id.

Parameters:
id - the transition id.
Returns:
the transition, or null if there is no such transition.

getResources

public List getResources()
Returns all resource groups of this case type. Use these resources to associate (by includes and excludes) system resources with case type resources.

Returns:
a list of all resource groups of this case type.

openCase

public Case openCase()
              throws BossaException
Creates a new case using the state of the case type template.

This method bypasses the usual case opening process and should be used with caution to override the normal way a case is created.

Returns:
the newly created case.
Throws:
SetAttributeException - if the underlying expression evaluation system has problems setting an attribute.
BossaException

openCase

public Case openCase(Map state)
              throws BossaException
Creates a new case using the provided state as the initial token count. If the state is null, the state of the case type template is used instead.

This method bypasses the usual case opening process and should be used with caution to override the normal way a case is created.

Parameters:
state - the initial token count as a map (String, Integer), indexed by the place id. This state map must have a token count for every place.
Returns:
the newly created case.
Throws:
SetAttributeException - if the underlying expression evaluation system has problems setting an attribute.
BossaException

buildTemplate

public void buildTemplate(Map attributes)
                   throws BossaException
Builds the template case that will spawn all other cases. Call this method after you have finished building the case type.

Parameters:
attributes - the attributes of the template case.
Throws:
SetAttributeException - if the underlying expression evaluation system has problems setting an attribute.
EvaluationException - if an expression evaluation error occurs.
BossaException

getCase

public Case getCase(int id)
Returns a case by its id.

Parameters:
id - the case id.
Returns:
the case with the provided id, null if this case does not exist.

getCases

public List getCases()
Returns all cases of this case type.

Returns:
a list of all active cases.

getWorkItems

public List getWorkItems()
Returns the list of all work items of the cases of this case type.

Returns:
the list of work itens of this case type.

getWorkItems

public List getWorkItems(boolean getInitial)
Returns the list of all work items of the cases of this case type. If desired, the initial work item(s) can be returned. Opening an initial work item will create a new case.

Parameters:
getInitial - set to true to get the initial work items and to false to only get the standard work items.
Returns:
the list of work itens of this case type.

getActivities

public List getActivities()
Returns the list of all activities of the cases of this case type.

Returns:
the list of activities of this case type.


Copyright © 2003,2004 OpenBR Sistemas S/C Ltda.