|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Defines the interface for a process instance in the Process Manager world. The interface provides for the management of data dictionary elements (that is, fields) and the instance itself (for example, suspension and resumption).
The ProcessInstance object that implements this interface may not be instantiated manually, rather the IPMApplication and IFinder interfaces may be used to obtain a handle on a ProcessInstance object.
// The localName is the name of the application, "myApp" for instance. // javax.naming.Context cxt = new javax.naming.InitialContext(); String jndiName = "java:comp/env/" + IPMApplication.DEFAULT_JNDI_ROOT + "/" + localName; IPMApplicationHome home = (IPMApplicationHome) cxt.lookup( jndiName ); IPMApplication app = home.create(); // Initiate a new process instance // INodeElement entryNode = app.getProcessDefinition() .getProcessMap() .getNodeElement( "EntryPoint1" ); IWorkitem wi = app.initiateProcessInstance( entryNode ); // Fetch a handle to a process instance for update // IProcessInstancePK pk = ProcessInstancePKFactory.create( 100 ); pk.setEditable( true ); IProcessInstance pi = app.findProcessInstance( pk );
IFinder
,
IPMApplication
Field Summary | |
static int |
DEFAULT_PRIORITY_VALUE
The default priority value for an instance if none has been specified. |
static int |
STATE_CLOSED_COMPLETED
State value for an instance that has finished normally without manual intervention; the instance no longer contains any workitems. |
static int |
STATE_CLOSED_TERMINATED
State value for an instance that has been aborted before its normal completion. |
static int |
STATE_OPEN_INITIATED
State value for an instance that has just been created. |
static int |
STATE_OPEN_RUNNING
State value for an instance that has been created and is executing according to the process map. |
static int |
STATE_OPEN_SUSPENDED
State value for an instance that is unavailable. |
Method Summary | |
void |
addHistoryEvent(IHistoryEvent event)
Add an event to the history/audit log of this process instance. |
void |
archive(java.io.OutputStream os)
Archive the contents of the current process instance to an output stream. |
java.lang.String |
getApplicationName()
Returns the common name of the application this instance belongs to. |
IParticipant |
getAuthenticatedUser()
Returns the authenticated user id for this session. |
java.lang.String |
getClusterName()
Returns the name of the cluster this instance belongs to. |
java.util.Date |
getCreationDate()
Returns the creation date of this instance. |
IParticipant |
getCreatorUser()
Returns the creator of this instance in the form of an IParticipant object. |
java.lang.Object |
getData(java.lang.String name)
Returns the value of the specified data dictionary field. |
java.lang.String |
getEntityKey(java.lang.String name)
Returns the primary key for the specified custom field. |
INodeElement |
getEntryNode()
Returns the entry point node where the current process instance was initiated from. |
INodeElement |
getExitNode()
Returns the exit node where this current process instance has completed at. |
java.util.Vector |
getHistoryEvents()
Fetch all of the history events logged for this process instance. |
long |
getInstanceId()
Returns the id (primary key) of this instance. |
java.util.Date |
getLastModifiedDate()
Returns the date this instance was last modified. |
IWorkItemPK |
getParentPrimaryKey()
Returns the primary key of the parent workitem from which this instance was spawned from. |
IProcessInstancePK |
getPrimaryKey()
Returns the primary key for this instance. |
int |
getPriority()
Returns the priority assigned to this instance. |
IParticipant |
getRoleUser(java.lang.String roleName)
Returns the user that is contained in the defined role. |
int |
getState()
Returns the state of the process instance. |
java.lang.String |
getTitle()
Returns the title of this process instance. |
boolean |
hasBeenArchived()
Returns true if this process instance has already been archived. |
boolean |
isEntityLoaded(java.lang.String name)
Check if the specified custom field has been loaded. |
void |
release(boolean commit)
Commit/rollback the process instance changes to the back-end store. |
void |
resume()
Resumes the process instance; all workitems that belong to this instance are also resumed. |
void |
save()
Save the process instance and its associated instance data; this method should be called when the desired effect is to just save the changes made to the process instance and not to the workitems associated with the process instance. |
void |
setAuthenticatedUser(IParticipant au)
Sets the authenticated user id for this session. |
void |
setData(java.lang.String name,
java.lang.Object value)
Sets/updates the value of the specified data dictionary field with the specified Java value. |
void |
setEntityKey(java.lang.String name,
java.lang.String value)
Updates the primary key for the specified custom field. |
void |
setRoleUser(java.lang.String roleName,
IParticipant roleUser)
Sets the value of a role with the specified user. |
void |
suspend()
Suspends the process instance; all workitems that belong to this instance are also suspended as a result of this operation. |
void |
terminate(INodeElement exitNode)
Terminates the process instance at the given exit node. |
Field Detail |
public static final int STATE_OPEN_INITIATED
IPMApplication.initiateProcessInstance(com.netscape.pm.model.INodeElement)
public static final int STATE_OPEN_RUNNING
public static final int STATE_OPEN_SUSPENDED
suspend()
,
resume()
public static final int STATE_CLOSED_COMPLETED
public static final int STATE_CLOSED_TERMINATED
public static final int DEFAULT_PRIORITY_VALUE
getPriority()
Method Detail |
public long getInstanceId()
public IProcessInstancePK getPrimaryKey()
IProcessInstancePK
public java.util.Date getCreationDate()
public IParticipant getCreatorUser() throws PMException
PMException
- if there is a problem retrieving the
creator's entry from the corporate directory.IParticipant
public IParticipant getRoleUser(java.lang.String roleName) throws PMException
roleName
- the name of the role for which content needs to
be returned. This role must be defined in the
process definition as a field rolePMException
- if there is a problem loading the process
instance data dictionary values.IParticipant
public void setRoleUser(java.lang.String roleName, IParticipant roleUser) throws PMException
roleName
- the name of the role which is to be modified.
This role must be defined in the process
definition as a field roleroleUser
- user to be set as the current role playerPMException
- if the field specified by roleName has not
been defined as a role field in the process
definition.ICorporateDirectory
,
IParticipant
public void addHistoryEvent(IHistoryEvent event)
event
- history event to be loggedHistoryEventFactory
,
IHistoryEvent
public java.util.Vector getHistoryEvents() throws PMException
PMException
- if unable to load all of the history events
logged for this process instance.IHistoryEvent
public java.lang.Object getData(java.lang.String name) throws PMException
name
is null, null will be returned.
The value returned will depend upon the type of the data dictionary field. The values returned for built-in data fields are well-defined; the values returned for custom fields will depend entirely upon the field's implementation.
name
- name of the field whose value is to be returnedPMException
- if there is a problem loading the process
instance data dictionary values.IDataElement
,
IProcessMap
public void setData(java.lang.String name, java.lang.Object value) throws PMException
The proper value to pass in will depend upon the type of the data dictionary field. The values required for built-in data fields are well-defined; the values required for custom fields will depend entirely upon the field's implementation.
name
- name of the field whose value is to be modifiedvalue
- the value to associate with the fieldPMException
- if there is a type mismatch between the
expected data type for the field value and
the actual data type for the passed value.IDataElement
,
IProcessMap
public java.lang.String getEntityKey(java.lang.String name) throws PMException
name
is null
null is returned.name
- the name of the custom field to fetch the entity
key forPMException
- if there is a problem loading the process
instance data dictionary values.setEntityKey(java.lang.String, java.lang.String)
,
IDataElement
public void setEntityKey(java.lang.String name, java.lang.String value)
name
is null,
nothing is done.name
- the name of the custom field to modifyvalue
- the value to set as the custom field's entity keygetEntityKey(java.lang.String)
,
IDataElement
public boolean isEntityLoaded(java.lang.String name)
Note: if a custom field has been loaded during a request session, it must be re-loaded when starting another request session. After the handle to a process instance has been discarded, the handle to the custom field data value is lost as well.
name
- the name of the custom field to checktrue
if the custom field has been loaded;
false
otherwise.getData(java.lang.String)
,
IDataElement
public int getState()
STATE_OPEN_INITIATED
,
STATE_OPEN_RUNNING
,
STATE_OPEN_SUSPENDED
,
STATE_CLOSED_COMPLETED
,
STATE_CLOSED_TERMINATED
public void suspend() throws PMException
There is no effect by calling this method if the process instance is already suspended.
PMException
- if there is a problem accessing the back-end
database where the process instance is
stored.STATE_OPEN_SUSPENDED
,
resume()
public void resume() throws PMException
There is no effect by calling this method if the process instance is not currently suspended.
PMException
- if there is a problem accessing the back-end
database where the process instance is
stored.STATE_OPEN_RUNNING
,
STATE_OPEN_SUSPENDED
,
suspend
public void terminate(INodeElement exitNode) throws PMException
exitNode
- the exit node to terminate this instance atPMException
- if there is a problem accessing the back-end
database where the process instance is
stored; or if the specified node is not
actually an exit node.STATE_CLOSED_TERMINATED
,
INodeElement
,
IProcessMap
public void save() throws PMException
PMException
- if there is a problem accessing the back-end
database where the process instance is
storedIWorkItem.save()
public void release(boolean commit) throws PMException
The effect this method will have on the process instance depends upon two factors: the value of the commit parameter and whether the process instance has been loaded for update or read-only.
commit | |||
---|---|---|---|
editable | T | F | |
T | commit | rollback | |
F | noop | noop |
Note: this method cannot be called in lieu of the
IWorkItem method commit
. Calling release from IWorkItem
will cause newly generated workitems to be routed internally in the
engine, while this version of release will simply release database
resources.
commit
- set to true
if want to commit
instance changes; otherwise false
to rollback changesPMException
- is a problem accessing the back-end
database where the process instance is
storedIWorkItem.release(boolean)
public java.lang.String getTitle()
getData(java.lang.String)
,
IDataElement.getType()
,
IProcessDefinition.getTitleFieldName()
public int getPriority()
getData(java.lang.String)
,
IDataElement.getType()
,
IProcessDefinition.getPriorityFieldName()
public INodeElement getEntryNode() throws PMException
INodeElement
,
IProcessMap
public INodeElement getExitNode() throws PMException
INodeElement
,
IProcessMap
public java.lang.String getClusterName()
IPMApplication
public java.lang.String getApplicationName()
IPMApplication
public java.util.Date getLastModifiedDate()
public IParticipant getAuthenticatedUser()
IParticipant
public void setAuthenticatedUser(IParticipant au)
au
- the authenticated user for the current sessionIParticipant
public boolean hasBeenArchived()
true
if this process instance has already been
archived; false
otherwise.archive(java.io.OutputStream)
public void archive(java.io.OutputStream os) throws PMException
os
- the output stream to which the archived data should
be written toPMException
- if there is a problem writing to the output
stream during the archival process; or if
there is a problem accessing the back-end
database where the process instance is
storedpublic IWorkItemPK getParentPrimaryKey()
IWorkItemPK
,
IWorkItem.getChildPrimaryKey()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |