Class CreationWorkItemSpec

java.lang.Object
com.orchestranetworks.workflow.CreationWorkItemSpec

public final class CreationWorkItemSpec extends Object
This class specifies the properties of a work item to be created.
See Also:
  • Method Details

    • forAllocation

      public static CreationWorkItemSpec forAllocation(UserReference allocatedTo)
      Allows to directly create a work item allocated to the specified user.

      The state of the created work item is allocated. The work item is created without an offeredTo value, hence the work item can not be reallocated.

    • forOffer

      public static CreationWorkItemSpec forOffer(Role offeredTo)
      Allows to create a work item offered to the specified role.

      The state of the created work item is offered and all users of the offeredTo role can take the created work item.

    • forOfferring

      public static CreationWorkItemSpec forOfferring(Profile offeredOrAllocatedTo)
      Allows to create a work item offered or allocated to the specified profile.

      If offeredOrAllocatedTo is a Role, this method is equivalent to forOffer(Role): the state of the created work item is offered and all users of the offeredTo role can take the created work item.

      If offeredOrAllocatedTo is a UserReference, this method is equivalent to forAllocation(UserReference): the state of the created work item is allocated; the work item is created without an offeredTo value.

    • forOfferring

      public static CreationWorkItemSpec forOfferring(Collection<Profile> offeredToProfiles)
      Allows to create a work item for a profile list.

      IfofferedToProfiles contains only one profile, this method is equivalent to forOfferring(Profile): If the profile is a user, the created work item is allocated to it, If the profile is as role, the created work item is offered to it.

      If offeredToProfiles contains several profiles, the created work item is offered to all of them.

      This feature should not be used for user tasks in the legacy mode (multi work items) for several profiles. If this method UserTaskCreationContext.createWorkItem(CreationWorkItemSpec) is called for user tasks in legacy mode, an exception is thrown at the work item creation if the work item is specified with more than one offered profiles.

      Since:
      5.7.0
      See Also:
    • forAllocationWithPossibleReallocation

      public static CreationWorkItemSpec forAllocationWithPossibleReallocation(UserReference allocatedTo, Role offeredTo)
      Allows to create a work item allocated to the specified user with the possibility to reallocate it.

      This method is useful to simulate a default allocation:

      1. The work item is automatically allocated to the specified user.
      2. But it can be reallocated to the users of the specified role.

      The state of the created work item is allocated.

      Parameters:
      allocatedTo - the user for the first allocation.
      offeredTo - the authorized role to take the work item, if reallocated.
      See Also:
    • forAllocationWithPossibleReallocation

      public static CreationWorkItemSpec forAllocationWithPossibleReallocation(UserReference allocatedTo, Collection<Profile> offeredToProfiles)
      Allows to create a work item allocated to the specified user with the possibility to reallocate to a profile contained in offeredToProfiles.

      If offeredToProfiles contains only one role, this method is equivalent to forAllocationWithPossibleReallocation(UserReference, Role)

      1. The work item is automatically allocated to the specified user.
      2. But it can be reallocated to a profile referenced in offeredToProfile.

      The state of the created work item is allocated.

      Parameters:
      allocatedTo - the user for the first allocation.
      offeredToProfiles - the authorized profiles to take the work item, if reallocated.
      Since:
      6.0.1
      See Also:
    • forNone

      public static CreationWorkItemSpec forNone()
    • getAllocatedTo

      public UserReference getAllocatedTo()
      Returns the user to whom the work item must be allocated.
    • getOfferedTo

      @Deprecated public Role getOfferedTo()
      Deprecated.
      Since 5.7.0. This method is replaced by getOfferedToProfiles().
      Returns the role to whom the work item must be offered.
      Throws:
      IllegalStateException - If the work item specification offers the work item to several profiles.
    • getOfferedToProfiles

      public final Collection<Profile> getOfferedToProfiles()
      Returns the collection of profiles to whom the work item must be offered.
      Since:
      5.7.0
    • getNotificationMail

      public String getNotificationMail()
    • setNotificationMail

      public void setNotificationMail(String notificationMail)
      Sets the notification mail to be sent when the work item is created.

      If the work item is offered, the mail will be sent to all users of the role. If the work item is allocated, the mail will be sent to the owner.

      If the notification mail is null, no mail will be sent.

      Parameters:
      notificationMail - key (integer) of the notification mail in the technical configuration table in Workflow-Executions of the Administration.
      Throws:
      IllegalArgumentException - if the parameter is not convertible into an integer.
    • getProfileMailCC

      public Profile getProfileMailCC()
    • setProfileMailCC

      public void setProfileMailCC(Profile profileMailCC)
    • setSpecificLabel

      public void setSpecificLabel(UserMessage specificLabel)
      Sets the label of the work item.

      If the specific label contains a data context variable, it would be evaluated.

      If the specific label is empty, the default label will be generated from the label defined in the user task definition.

    • getSpecificLabel

      public UserMessage getSpecificLabel()