Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.fujitsu.iflow.model.workflow
Interface WorkItem

All Superinterfaces:
  DataAccessor

public interface WorkItem
extends DataAccessor

The `WorkItem` interface provides access to all aspects of a work item. A work item is an activity assigned to a particular user. When an activity node within a workflow becomes active, one work item is generated for every workflow participant that this activity is assigned to.

A work item stays valid until one person submits the related work by calling the method `makeChoice`. In this case, the submitted work item takes on the state `STATE_COMPLETED`. In addition, all related work items are deleted from the system. By accepting (`accept`) a work item, a user can take on the sole responsibility for completing the associated activity. In this case, the work items of all other users become inactive.

The functions inherited from `DataAccessor` allow the owner of a work item to manipulate the User Defined Attributes (UDAs) associated with the activity that this work item was generated from.

Every work item is uniquely identified by the ID of its associated activity node (`NodeInstanceId`) and the person to which the item is assigned (`Assignee`). In addition, the work item carries its own unique identifier. Besides its current state, a work item has an adjustable priority, which the item inherits initially from the process it belongs to.

Exceptions. Three kinds of exceptions are commonly thrown within this class: `WFServerException`, `WFInternalException`, and `ModelInternalException`, all of which are instances of `ModelException`. In the methods that directly throw a `ModelException`, this exception usually wraps one of the above three exceptions. `WFServerException` indicates that the server failed to operate normally. `WFInternalException` indicates a problem in the communication between client and server. `ModelInternalException` indicates other Model API internal problems.

See Also:
  `Node`, `NodeInstance`, `DataItemMappingElement`

Field Summary
`static int` | `MAX_WORK_ITEM_LABEL_LENGTH` Specifies the maximum length of work item names; currently set to 30 characters.
`static long` | `MAX_WORKITEM_DURATION` Specifies the maximum duration of work item for an assignee.
`static int` | `PRIORITY_HIGH` Indicates that this work item is to be treated with high priority.
`static int` | `PRIORITY_LOW` Indicates that this work item is to be treated with low priority.
`static int` | `PRIORITY_MEDIUM` Indicates that this work item is to be treated with medium priority.
`static int` | `STATE_ACCEPTED` Indicates that the assignee of a work item currently assumes the sole responsibility for completing the work item.
`static int` | `STATE_ACTIVE` Indicates that a user is currently working on a work item.
`static int` | `STATE_ASSIGNED` Deprecated. WorkItem does not support this state anymore.
`static int` | `STATE_COMPLETED` Indicates that a work item was submitted successfully.
`static int` | `STATE_DEACTIVE` Indicates that a work item is inactive and cannot be manipulated currently.
`static int` | `STATE_DECLINED` Indicates that the assignee of a work item has refused to work on the item.
`static int` | `STATE_READ` Indicates that the work item is read state.
`static int` | `STATE_SUSPENDED` Indicates that the work item is in a suspended state.
`static int` | `STATE_UNASSIGNED` Deprecated. WorkItem does not support this state anymore.
`static int` | `STATE_VOTED` Indicates that the work item is currently being voted on.
`static int` | `STATE_WAITING_FOR_PROCESS` Deprecated. WorkItem does not support this state anymore.
`static int` | `STATE_WAITING_FOR_SUB_PROCESS` Indicates that the work item is in a state of waiting for a subprocess to complete.

Method Summary
`void` | `accept()` Changes the state of this work item to `STATE_ACCEPTED` if it is in state `STATE_ACTIVE`, and changes the state of all other active work items related to this item's activity node to `STATE_DEACTIVE`.
`AttachmentRef` | `addAttachment(java.lang.String attachmentName, java.lang.String attachmentPath)` Deprecated. Replaced by `getProcessInstance().addAttachment`
`DataItemMappingElement` | `addDataMappingElement(java.lang.String parentDataItemRefName, java.lang.String childDataItemRefName, int direction)` Adds a mapping of a user-defined process attribute (UDA) of this work item's related process ("parent process") to a UDA of the subprocess of this work item's related subprocess node, and returns a `DataItemMappingElement` which encapsulates this mapping.
`void` | `decline()` Changes the state of this work item to `STATE_DECLINED`.
`boolean` | `equals(long nodeInstanceId, java.lang.String assignee)` Checks whether this work item's assignee and the identifier of the related activity node are identical to the given node ID and assignee.
`boolean` | `equals(WorkItem wi)` Deprecated. Use `getId() == wi.getId()` instead.
`java.lang.String` | `getAssignee()` Returns the single, unique assignee of this work item.
`AttachmentRef[]` | `getAttachments()` Deprecated. Replaced by `getProcessInstance().addAttachment`
`java.lang.String[]` | `getChoices()` Returns the names of the choices allowed for this work item.
`long` | `getCreationTime()` Returns the time when this work item was created or, if it is completed, the time it was completed in milliseconds since January 1, 1970, 00:00:00.
`DataItem[]` | `getDataItems()` Deprecated. Replaced by `getProcessInstance().addDataItems`
`DataItemMappingElement[]` | `getDataMappingElements()` Returns all mappings between user-defined attributes (UDAs) related to this work item and UDAs of the associated subprocess as an array of `DataItemMappingElement` objects.
`java.util.Date` | `getDueDate()` Returns the due date of this work item.
`java.lang.String` | `getFormFileName(java.lang.String formName)` Returns the file name of the form with the given name.
`java.lang.String[]` | `getFormNames()` Deprecated. use instead `getForms()` and `FormRef.getName()`
`FormRef[]` | `getForms()` Returns all forms associated with the activity node that this work item represents.
`long` | `getId()` Returns this work item's unique identifier.
`java.lang.String` | `getInitiator()` Deprecated. Replaced by getProcessInstance().getInitiator
`java.lang.String` | `getName()` Returns this work item's name, which is identical to the name of the activity node that this item relates to.
`NodeInstance` | `getNodeInstance()` Returns the node instance in the process that this work item represents.
`long` | `getNodeInstanceId()` Returns the ID of the node instance that this work item represents.
`java.lang.String` | `getPlanDescription()` Returns the description of the process definition that was used to create the process instance that this work item relates to.
`java.lang.String` | `getPlanIdentifier()` Returns the user-defined identifier of the process definition that was used to create the process instance that this work item relates to.
`java.lang.String` | `getPlanName()` Returns the name of the process definition that was used to create the process instance that this work item relates to.
`java.lang.String` | `getPlanTitle()` Returns the title of the process definition that was used to create the process instance that this work item relates to.
`int` | `getPriority()` Returns the priority of the process that this work item belongs to.
`ProcessInstance` | `getProcessInstance()` Returns the process instance that this work item belongs to.
`java.lang.String` | `getProcessInstanceDescription()` Returns the description of the process this work item belongs to.
`long` | `getProcessInstanceId()` Returns the unique identifier of the process instance that this work item belongs to.
`java.lang.String` | `getProcessInstanceName()` Returns the name of the process instance that this work item belongs to.
`java.lang.String[]` | `getProcessInstanceOwners()` Returns the names of the owners of the process this work item belongs to.
`java.lang.String` | `getProcessInstanceTitle()` Returns the title of the process instance that this work item belongs to.
`int` | `getState()` Returns the current state of this work item as defined in the `WorkItem` interface by constants such as `STATE_ACTIVE`.
`long` | `getSubPlanId()` Deprecated. To start a subprocess within this work item, use `startSubProcess(long)` instead.
`long` | `getSubProcessId()` Returns the ID of the subprocess that is associated with this work item's related activity node.
`DataItem[]` | `getWorklistDataItems()` Returns an array of `DataItem` objects.
`void` | `makeChoice(java.lang.String choice)` Allows the assignee of this work item to submit the item by choosing which of the related activity's outgoing arrows the workflow is to continue with.
`void` | `makeChoice(java.lang.String choice, long duration)` Provides the same functionality as `makeChoice(String)`, but accepts an additional argument.
`void` | `markAsRead()` Changes the state of this work item to `STATE_READ` if the item is currently in state `STATE_ACTIVE` or `STATE_READ`.
`void` | `reassignTo(java.lang.String[] newAssignees)` Reassigns a work item to one or more users.
`void` | `recordWorkTime(long duration)` Captures the estimate of how much time (so far) the assignee of this work item spent on working on this activity for use in detailed analysis of processes in general.
`void` | `removeAttachment(java.lang.String attachmentName)` Deprecated. Replaced by `getProcessInstance()` and `ProcessInstance.removeAttachment(String)`
`void` | `removeDataMappingElement(DataItemMappingElement dataItem)` Removes a mapping between a user-defined attribute (UDA) of this work item's related process and the UDA of a subprocess.
`void` | `resume()` Changes the state of this and all of the related activity node's other work items to `STATE_ACTIVE` if this work item is in state `STATE_SUSPENDED`.
`void` | `setName(java.lang.String name)` Deprecated. The name of a work item is just a copy of the name of the node instance that this work item belongs to. Change the name of the node instance to change the name of this work item.
`void` | `setPriority(int priority)` Sets the priority of this work item.
`void` | `setSubPlanId(long subPlanId)` Deprecated. Do not change the subprocess definition ID within a work item. To start the subprocess, use `startSubProcess(long)` instead.
`long` | `startSubProcess()` Deprecated. Use `startSubProcess(long)` instead.
`long` | `startSubProcess(long subPlanId)` Commits all current changes to UDAs and starts a subprocess matching the `subPlanId` parameter after all data mapping considering the mappings for this particular work item object is done.
`void` | `suspend()` Changes the state of this and all of the related activity node's other work items to `STATE_SUSPENDED` if this work item is in state `STATE_ACCEPTED` or `STATE_ACTIVE`.

Methods inherited from interface com.fujitsu.iflow.model.workflow.DataAccessor
`cancelEdit, commitEdit, getDataItem, getDataItemType, getDataItemValue, hasDataItem, isLockedForEdit, setDataItemValues, startEdit`

Field Detail

### PRIORITY_HIGH

    public static final int PRIORITY_HIGH

  Indicates that this work item is to be treated with high priority.

  See Also:
    Constant Field Values

### PRIORITY_MEDIUM

    public static final int PRIORITY_MEDIUM

  Indicates that this work item is to be treated with medium priority.

  See Also:
    Constant Field Values

### PRIORITY_LOW

    public static final int PRIORITY_LOW

  Indicates that this work item is to be treated with low priority.

  See Also:
    Constant Field Values

### MAX_WORK_ITEM_LABEL_LENGTH

    public static final int MAX_WORK_ITEM_LABEL_LENGTH

  Specifies the maximum length of work item names; currently set to 30 characters.

  See Also:
    Constant Field Values

### MAX_WORKITEM_DURATION

    public static final long MAX_WORKITEM_DURATION

  Specifies the maximum duration of work item for an assignee.

  See Also:
    Constant Field Values

### STATE_COMPLETED

    public static final int STATE_COMPLETED

  Indicates that a work item was submitted successfully.

  See Also:
    Constant Field Values

### STATE_ACTIVE

    public static final int STATE_ACTIVE

  Indicates that a user is currently working on a work item.

  See Also:
    Constant Field Values

### STATE_DEACTIVE

    public static final int STATE_DEACTIVE

  Indicates that a work item is inactive and cannot be manipulated currently. A work item w assumes this state when another user explicitly accepts her work item relating to the same activity as w.

  See Also:
    Constant Field Values

### STATE_ASSIGNED

    public static final int STATE_ASSIGNED

  Deprecated. WorkItem does not support this state anymore.

  See Also:
    Constant Field Values

### STATE_DECLINED

    public static final int STATE_DECLINED

  Indicates that the assignee of a work item has refused to work on the item.

  See Also:
    Constant Field Values

### STATE_UNASSIGNED

    public static final int STATE_UNASSIGNED

  Deprecated. WorkItem does not support this state anymore.

  See Also:
    Constant Field Values

### STATE_ACCEPTED

    public static final int STATE_ACCEPTED

  Indicates that the assignee of a work item currently assumes the sole responsibility for completing the work item.

  See Also:
    Constant Field Values

### STATE_WAITING_FOR_PROCESS

    public static final int STATE_WAITING_FOR_PROCESS

  Deprecated. WorkItem does not support this state anymore.

  See Also:
    Constant Field Values

### STATE_WAITING_FOR_SUB_PROCESS

    public static final int STATE_WAITING_FOR_SUB_PROCESS

  Indicates that the work item is in a state of waiting for a subprocess to complete.

  See Also:
    Constant Field Values

### STATE_SUSPENDED

    public static final int STATE_SUSPENDED

  Indicates that the work item is in a suspended state.

  See Also:
    Constant Field Values

### STATE_READ

    public static final int STATE_READ

  Indicates that the work item is read state.

  See Also:
    Constant Field Values

### STATE_VOTED

    public static final int STATE_VOTED

  Indicates that the work item is currently being voted on.

  See Also:
    Constant Field Values

Method Detail

### getId

    public long getId()

  Returns this work item's unique identifier. The ID is allocated automatically by the server when the work item is created.

  Returns:
    This work item's unique identifier.

### getName

    public java.lang.String getName()

  Returns this work item's name, which is identical to the name of the activity node that this item relates to.

  Returns:
    The name of this work item.

### setName

    public void setName(java.lang.String name)
                 throws ModelInternalException

  Deprecated. The name of a work item is just a copy of the name of the node instance that this work item belongs to. Change the name of the node instance to change the name of this work item.

  Sets the name of this work item. The name should be short and descriptive.

  Throws:
    `ModelInternalException`

### getState

    public int getState()
                 throws ModelException

  Returns the current state of this work item as defined in the `WorkItem` interface by constants such as `STATE_ACTIVE`. When a work item is created it has the state `STATE_ACTIVE`.

  Returns:
    The integer constant specifying the current state of this work item.
  Throws:
    `ModelException`

### makeChoice

    public void makeChoice(java.lang.String choice)
                    throws WFInternalException,
                           WFServerException,
                           ModelInternalException

  Allows the assignee of this work item to submit the item by choosing which of the related activity's outgoing arrows the workflow is to continue with. The choice is specified through the name of the outgoing arrow. Making the choice completes the work item.

  A single activity can have multiple related work items, each assigned to a certain user. Unless one of the assignees of the work items explicitly accepts her work item, multiple assignees may submit related work items at the same time. In this case, only one submission will be successful, the other submissions will result in an exception with error code.

  For a group level work item any member of the group can perform make choice on it.

  Parameters:
    `choice` - The name of this work item's related activity's outgoing arrow that the workflow is to continue with.
  Throws:
    `WFServerException`
    `WFInternalException`
    `ModelInternalException` - Thrown when this work item is in edit-mode when calling this method or if the related process instance is in edit- or structural edit-mode. Furthermore this exception is thrown if the supplied choice is invalid. Should be caught as `ModelException` for future compatibility.

### makeChoice

    public void makeChoice(java.lang.String choice,
                           long duration)
                    throws WFInternalException,
                           WFServerException,
                           ModelInternalException

  Provides the same functionality as `makeChoice(String)`, but accepts an additional argument. This argument represents the amount of time that the user submitting this work item has spent with actually working on the item. Note that the entire time between accepting a work item and submitting it by using the `makeChoice` method will typically be longer than the actual time spent on related tasks. This methods allows to report the actual time on which process analyses can then be based.

  The choice value must not be longer than specified by the constant `Arrow.MAX_ARROW_NAME_LENGTH`. The duration is limited to `MAX_WORKITEM_DURATION`.

  Parameters:
    `choice` - The name of this work item's related activity's outgoing arrow that the workflow is to continue with.
    `duration` - The amount of time in seconds that the user submitting this work item has spent with working on the item.
  Throws:
    `WFServerException`
    `WFInternalException`
    `ModelInternalException` - Thrown when this work item is in edit-mode when calling this method or if the related process instance is in edit- or structural edit-mode. Furthermore this exception is thrown when the specified duration exceeds the limitation. Should be caught as `ModelException` for future compatibility.

### getPlanName

    public java.lang.String getPlanName()

  Returns the name of the process definition that was used to create the process instance that this work item relates to.

  Returns:
    The name of the process definition related to this work item.

### getPlanTitle

    public java.lang.String getPlanTitle()

  Returns the title of the process definition that was used to create the process instance that this work item relates to.

  Returns:
    The title of the process definition related to this work item.

### getPlanDescription

    public java.lang.String getPlanDescription()

  Returns the description of the process definition that was used to create the process instance that this work item relates to.

  Returns:
    The description of the process definition related to this work item.

### getPlanIdentifier

    public java.lang.String getPlanIdentifier()

  Returns the user-defined identifier of the process definition that was used to create the process instance that this work item relates to. Note that this is not the unique, numeric identifier that every process definition has.

  Returns:
    The user-defined identifier of the process definition related to this work item.

### getProcessInstance

    public ProcessInstance getProcessInstance()
                                       throws WFInternalException,
                                              WFServerException,
                                              ModelInternalException

  Returns the process instance that this work item belongs to.

  Returns:
    The related process instance of this work item.
  Throws:
    `WFServerException`
    `WFInternalException`
    `ModelInternalException`

### getProcessInstanceId

    public long getProcessInstanceId()

  Returns the unique identifier of the process instance that this work item belongs to.

  Returns:
    The unique identifier of the process instance related to this work item.

### getProcessInstanceName

    public java.lang.String getProcessInstanceName()

  Returns the name of the process instance that this work item belongs to. This method corresponds to `getProcessInstance().getName()`, but is considerably faster and less expensive.

  Returns:
    The name of the process instance related to this work item.

### getProcessInstanceTitle

    public java.lang.String getProcessInstanceTitle()

  Returns the title of the process instance that this work item belongs to. This method corresponds to `getProcessInstance().getTitle()`, but is considerably faster and less expensive.

  Returns:
    The title of the process instance related to this work item.

### getNodeInstance

    public NodeInstance getNodeInstance()

  Returns the node instance in the process that this work item represents. To get the node instance, the entire information about the process must be retrieved from the server. Thus, this is an expensive operation.

  Returns:
    The node instance object that is the parent of this work item.

### getNodeInstanceId

    public long getNodeInstanceId()

  Returns the ID of the node instance that this work item represents. Returns the same value as `getNodeInstance().getNodeId()`, but this method is considerably faster and less expensive.

  Returns:
    The unique identifier of the instance of the activity node that this work item relates to.

### getProcessInstanceDescription

    public java.lang.String getProcessInstanceDescription()

  Returns the description of the process this work item belongs to. This method corresponds to `getProcessInstance().getDescription()`, but is considerably faster and less expensive.

  Returns:
    The description of the process instance related to this work item.

### getAttachments

    public AttachmentRef[] getAttachments()
                                   throws WFInternalException,
                                          WFServerException,
                                          ModelInternalException

  Deprecated. Replaced by `getProcessInstance().addAttachment`

  Returns the array of attachments associated with the process instance this work item belongs to. If there are no attachments, an empty array is returned.

  Returns:
    The array of attachments associated with the process instance this work item belongs to. The array is empty, if the process instance does not have any attachments.
  Throws:
    `WFServerException`
    `WFInternalException`
    `ModelInternalException`

### addAttachment

    public AttachmentRef addAttachment(java.lang.String attachmentName,
                                       java.lang.String attachmentPath)
                                throws WFInternalException,
                                       WFServerException,
                                       ModelInternalException

  Deprecated. Replaced by `getProcessInstance().addAttachment`

  Adds the attachment with the given name and location path to the process instance this work item belongs to.

  Parameters:
    `attachmentName` - The attachment's name.
    `attachmentPath` - The fully qualified path that specifies the attachment's location within the Document Management system used for its storage.
  Returns:
    A reference to the attachment.
  Throws:
    `WFServerException` - When server operation fails or, in particular, the process underlying this work item is suspended and can therefore not be edited.
    `ModelInternalException`
    `WFInternalException`

### removeAttachment

    public void removeAttachment(java.lang.String attachmentName)
                          throws WFInternalException,
                                 WFServerException,
                                 ModelInternalException

  Deprecated. Replaced by `getProcessInstance()` and `ProcessInstance.removeAttachment(String)`

  Removes the specified attachment from the process that this work item belongs to.

  Throws:
    `WFInternalException`
    `WFServerException`
    `ModelInternalException`

### getForms

    public FormRef[] getForms()
                       throws ModelInternalException,
                              WFInternalException,
                              WFServerException

  Returns all forms associated with the activity node that this work item represents.

  Returns:
    An array of form references, which is empty when there are no forms attached to the activity node underlying this work item.
  Throws:
    `WFServerException`
    `ModelInternalException`
    `WFInternalException`

### getFormNames

    public java.lang.String[] getFormNames()
                                    throws ModelInternalException,
                                           WFInternalException,
                                           WFServerException

  Deprecated. use instead `getForms()` and `FormRef.getName()`

  Returns an array of the names of all forms associated with the activity node that this work item represents. If there are no forms, an empty array is returned.

  Returns:
    An array of the names of all forms associated with the activity node that this work item represents. The array is empty, if there are no such forms.
  Throws:
    `WFServerException`
    `ModelInternalException`
    `WFInternalException`

### getFormFileName

    public java.lang.String getFormFileName(java.lang.String formName)
                                     throws ModelInternalException,
                                            WFInternalException,
                                            WFServerException

  Returns the file name of the form with the given name.

  Parameters:
    `formName` - The name of the form.
  Returns:
    The file name of the form with the given name or `null` if no form exists for the specified name.
  Throws:
    `ModelInternalException`
    `WFInternalException`
    `WFServerException`

### getDataItems

    public DataItem[] getDataItems()

  Deprecated. Replaced by `getProcessInstance().addDataItems`

  Returns all user-defined process attributes (UDAs) of this work item's related process instance and the item values as an array of `DataItem` objects. If there are no UDAs, an empty array is returned.

  Specified by:
    `getDataItems` in interface `DataAccessor`
  Returns:
    An array of UDAs with their values, or an empty array, if there are no UDAs.

### getWorklistDataItems

    public DataItem[] getWorklistDataItems()
                                    throws ModelException

  Returns an array of `DataItem` objects. This method returns an array of all worklist User Defined Attributes (UDAs) and their values. If there are none, an empty array is returned.

  Worklist data items are delivered with the work item, and are fast to retrieve and use within worklists. This method does not cause the entire process instance information to be retrieved from the server. It also does not retrieve all the process instance UDA variables, but only those variables that have been designated as worklist variables.

  Only the basic getter methods namely getName(), getType(), and getValue() can be called on the data items retrieved. For getting other information or performing some operations on a particular data item, this one needs to be retrieved from the corresponding process instance.

  Returns:
    An array of UDAs with their values, or an empty array, if there are no UDAs.
  Throws:
    `ModelException`

### getAssignee

    public java.lang.String getAssignee()

  Returns the single, unique assignee of this work item. If an activity is assigned to more than one person, a work item is created for each of them. Therefore, a work item always has just a single assignee. If the role assigned to the related node does not contain any users, the work item is automatically generated for the process owner.

  For a group level work item the assignee matches the role specified for the activity this work item represents.

  Returns:
    This work item's assignee.

### getCreationTime

    public long getCreationTime()

  Returns the time when this work item was created or, if it is completed, the time it was completed in milliseconds since January 1, 1970, 00:00:00. This is the time provided by `Date`.

  Returns:
    The time when this work item was created or completed.

### getPriority

    public int getPriority()

  Returns the priority of the process that this work item belongs to. The priority can be any Java integer value. This method returns the current value for the running process. When the process is created, it inherits the priority of the process definition template it is based on. During the execution of a process, its priority can be changed.

  Returns:
    The priority of this work item's related process.

### getInitiator

    public java.lang.String getInitiator()

  Deprecated. Replaced by getProcessInstance().getInitiator

  Returns the initiator of the process to which this work item belongs.

  Returns:
    The name of the user who initiated the process that this work item belongs to.

### getChoices

    public java.lang.String[] getChoices()
                                  throws WFInternalException,
                                         WFServerException,
                                         ModelInternalException

  Returns the names of the choices allowed for this work item. These names are the names of the outgoing arrows of the activity node this work item belongs to.

  Returns:
    The names of the possible choices for this work item.
  Throws:
    `WFServerException`
    `WFInternalException`
    `ModelInternalException`

### getProcessInstanceOwners

    public java.lang.String[] getProcessInstanceOwners()

  Returns the names of the owners of the process this work item belongs to. If no process instance owners are defined, the returned array has one element, that contains the name of the process definition owner.

  Returns:
    An array containing the names of the owners of this work item's related process.

### equals

    public boolean equals(long nodeInstanceId,
                          java.lang.String assignee)

  Checks whether this work item's assignee and the identifier of the related activity node are identical to the given node ID and assignee.

  Parameters:
    `nodeInstanceId` - The identifier of the activity node instance to check this work item against.
    `assignee` - The assignee to check this work item's assignee against.
  Returns:
    `true`, if this work item has the given assignee and activity node, `false` otherwise.

### equals

    public boolean equals(WorkItem wi)

  Deprecated. Use `getId() == wi.getId()` instead.

### markAsRead

    public void markAsRead()
                    throws ModelException

  Changes the state of this work item to `STATE_READ` if the item is currently in state `STATE_ACTIVE` or `STATE_READ`. Otherwise, an exception is thrown.

  Note, when the group level work item support is activated via the system property SupportGroupWorkItem this operation is not supported.

  Throws:
    `ModelException` - Thrown when this work item is not in state `STATE_ACTIVE` or `STATE_READ`. Furthermore this exception is thrown if the process instance this work item belongs to is in enactment or in structural edit-mode when this method is called.

### suspend

    public void suspend()
                 throws ModelException

  Changes the state of this and all of the related activity node's other work items to `STATE_SUSPENDED` if this work item is in state `STATE_ACCEPTED` or `STATE_ACTIVE`. The only valid action on a suspended work item is `resume()`.

  If the work item is a group level work item the user that wants to change its state to `STATE_SUSPENDED` has to accept the work item before.

  Throws:
    `ModelException` - Thrown if this work item is not in state `STATE_ACCEPTED` or `STATE_ACTIVE`, if it is in edit-mode, if it is a group level work item and has not been accepted by the user before or if another problem occurred within the Model API.

### resume

    public void resume()
                throws ModelException

  Changes the state of this and all of the related activity node's other work items to `STATE_ACTIVE` if this work item is in state `STATE_SUSPENDED`.

  If the work item is a group level work item in state `STATE_SUSPENDED` it can only be resumed by the user who called `WorkItem.suspend()`before.

  Throws:
    `ModelException` - Thrown when this work item is not in state `STATE_SUSPENDED` or `STATE_ACTIVE`. Furthermore this exception is thrown if work item is in edit-mode or the process instance is in edit- or structural-edit mode.

### accept

    public void accept()
                throws ModelException

  Changes the state of this work item to `STATE_ACCEPTED` if it is in state `STATE_ACTIVE`, and changes the state of all other active work items related to this item's activity node to `STATE_DEACTIVE`. For a group level work item, this operation changes the assignee from group name to the name of the user currently working on it. To be able to track this change the work item has to be acquired again.

  Throws:
    `ModelException` - Thrown when this work item is not in state `STATE_ACTIVE`, the work item is in edit-mode or another problem occurred within the Model API.

### decline

    public void decline()
                 throws ModelException

  Changes the state of this work item to `STATE_DECLINED`. For a group level work item, this operation changes the state of this work item to `STATE_ACTIVE` and sets the assignee matching the specified role for the activity this workitem represents. To be able to track this change the work item has to be acquired again.

  Note. If the property SupportGroupWorkItem is set to `true` in the ibpm.properties file, the work item has to be accepted before calling this method on it.

  Throws:
    `ModelException` - Thrown when the work item is in edit-mode when calling this method.

### reassignTo

    public void reassignTo(java.lang.String[] newAssignees)
                    throws ModelException

  Reassigns a work item to one or more users. The new assignees do not need to be members of the role specified in the activity node.

  The length of the new assignee names must not be longer than specified by `DirectoryServices.MAX_DIR_NAME_LENGTH` and must not contain a comma.

  Once a workitem is reassigned, further server operation on this work item will cause an exception. It is recommended not to use this work item for any further server operation after calling this method.

  Parameters:
    `newAssignees` - An array of names of the users to who the activity will be reassigned.
  Throws:
    `ModelException` - Thrown when the work item is in edit-mode when calling this method or when the supplied list of assignees or one of the assignees is `null` .

### getSubProcessId

    public long getSubProcessId()
                         throws ModelException

  Returns the ID of the subprocess that is associated with this work item's related activity node. If enactment has not yet fully created the subprocess, or there is no subprocess associated with this work item's activity node, `-1` is returned. A wait loop should be used to get the ID as soon as it becomes available.

  Note, this method can not be used to get the process id of a sub process node. Work items are only generated for activity nodes but it is possible to specify and start a sub process at run time from within a work item. The Id of that sub process will be returned by this method. To start a sub process at runtime you have to call `startSubProcess(long)`.

  Returns:
    The ID of this work item's related subprocess, or `-1` if such a subprocess does not (yet) exist.
  Throws:
    `ModelException` - Thrown when there is no supporting subprocess for the work item's activity node, or another problem occurred within the Model API.

### setSubPlanId

    public void setSubPlanId(long subPlanId)
                      throws ModelException

  Deprecated. Do not change the subprocess definition ID within a work item. To start the subprocess, use `startSubProcess(long)` instead.

  Assigns a process definition to this work item from which subprocesses will be created.

  Throws:
    `ModelException`

### getSubPlanId

    public long getSubPlanId()
                      throws ModelException

  Deprecated. To start a subprocess within this work item, use `startSubProcess(long)` instead.

  Retrieves the ID of the process definition that was used to create the process this work item belongs to.

  Throws:
    `ModelException`

### startSubProcess

    public long startSubProcess()
                         throws ModelException

  Deprecated. Use `startSubProcess(long)` instead.

  Commits all current changes to UDAs and starts the subprocess attached to this work item. The subprocess is only started after all data mappings have been completed.

  Throws:
    `ModelException`

### setPriority

    public void setPriority(int priority)
                     throws ModelException

  Sets the priority of this work item.

  The work item priorities are separated in three categories: High, Medium, and Low. This categorization of priorities is made according to the following rules:

  - HIGH: Any number greater than or equal to 16.
  - MEDIUM: Any number between eight and 16 (including eight).
  - LOW: Any number less than eight.

  It is recommended to set the priority to one of the three categories by using the constants: `PRIORITY_HIGH`, `PRIORITY_MEDIUM`, or `PRIORITY_LOW`.

  Note. If the property SupportGroupWorkItem is set to `true` in the ibpm.properties file, the work item has to be accepted before calling this method on it.

  Throws:
    `ModelException`

### startSubProcess

    public long startSubProcess(long subPlanId)
                         throws ModelException

  Commits all current changes to UDAs and starts a subprocess matching the `subPlanId` parameter after all data mapping considering the mappings for this particular work item object is done.

  When the sub process started becomes inactive, the state of the work item changes to `#STATE_ACCCEPTED`. The work item has to be retrieved again to observe this change.

  The work item has to be in state `STATE_ACTIVE`, `STATE_ACCEPTED` or `STATE_READ` when this method is called.

  If the work item is a group level work item the user that wants to start the subprocess has to accept the work item before.

  Parameters:
    `subPlanId` - ID of the subprocess to be started
  Throws:
    `ModelException` - Thrown if the work item is in edit-mode when calling this method, if the state of the work item is not `STATE_ACTIVE, STATE_ACCEPTED` or `STATE_READ` or, in case it is a group level work item, if it has not been accepted by the user before.

### addDataMappingElement

    public DataItemMappingElement addDataMappingElement(java.lang.String parentDataItemRefName,
                                                        java.lang.String childDataItemRefName,
                                                        int direction)
                                                 throws ModelException

  Adds a mapping of a user-defined process attribute (UDA) of this work item's related process ("parent process") to a UDA of the subprocess of this work item's related subprocess node, and returns a `DataItemMappingElement` which encapsulates this mapping.

  Each specified mapping only affects the work item object currently assigned to the user executing this method. Furthermore this mapping information is only held withing the user's application memory. So it is not persistent and is lost whenever the user logs out without starting the sub process or tries to retrieve the data of that particular work item from the server again.

  The mapping can have one of the following types, which are defined as constants in `DataItemMappingElement`:

  `IN`
    From parent process to subprocess
  `OUT`
    From subprocess to parent process
  `INOUT`
    In both directions

  The length of `parentDataItemRefName` and `childDataItemRefName` must not be longer than specified by `DataItemRef.MAX_DATA_REF_NAME_LENGTH`.

  Parameters:
    `parentDataItemRefName` - Name of the UDA in the parent process.
    `childDataItemRefName` - Name of the UDA in the subprocess.
    `direction` - The type of the mapping: `IN`, `OUT`, or `INOUT` (defined in `DataItemMappingElement`)
  Returns:
    DataItemMappingElement The object representing the added mapping.
  Throws:
    `ModelException`

### getDataMappingElements

    public DataItemMappingElement[] getDataMappingElements()
                                                    throws ModelException

  Returns all mappings between user-defined attributes (UDAs) related to this work item and UDAs of the associated subprocess as an array of `DataItemMappingElement` objects. If there are no such mappings, an empty array is returned.

  Information on mappings specified by other users for their work item objects corresponding to the same activity are not retrieved.

  Returns:
    An array mapping elements, one for every mapped UDA, or an empty array if there are no mappings.
  Throws:
    `ModelException`
  See Also:
    `addDataMappingElement(String, String, int)`

### removeDataMappingElement

    public void removeDataMappingElement(DataItemMappingElement dataItem)
                                  throws ModelException

  Removes a mapping between a user-defined attribute (UDA) of this work item's related process and the UDA of a subprocess. Data mappings specified for work items of other users are not affected.

  Parameters:
    `dataItem` - The `DataItemMappingElement` object to be removed.
  Throws:
    `ModelException`
  See Also:
    `addDataMappingElement(String, String, int)`

### recordWorkTime

    public void recordWorkTime(long duration)
                        throws ModelException

  Captures the estimate of how much time (so far) the assignee of this work item spent on working on this activity for use in detailed analysis of processes in general.

  An activity may have been assigned on Tuesday, and completed on Wednesday. However, this does not mean that the person spent a whole day working on this activity, because this activity is usually not the only thing that the person is working on.

  This method may be called multiple times to keep adding to the total amount of time that has been spent so far. Specify the actual work duration in seconds.

  The duration is limited to `MAX_WORKITEM_DURATION`.

  Parameters:
    `duration` - The time to be added to the total time that the assignee of this work item has actually worked on the item.
  Throws:
    `ModelException` - Thrown when this work item is in edit-mode when calling this method or if the related process instance is in edit- or structural edit-mode. Furthermore this exception is thrown when the specified duration exceeds the limitation. Should be caught as `ModelException` for future compatibility.

### getDueDate

    public java.util.Date getDueDate()
                              throws ModelException

  Returns the due date of this work item.

  Returns:
    The date when this work item is due, or `null` if no due date is defined for this work item.
  Throws:
    `ModelException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD