Package org.jbpm.casemgmt.impl.wih

## Class StartCaseWorkItemHandler

- java.lang.Object
- - org.jbpm.casemgmt.impl.wih.StartCaseWorkItemHandler

- All Implemented Interfaces:
    `org.kie.api.runtime.process.WorkItemHandler`

      public class StartCaseWorkItemHandler
      extends Object
      implements org.kie.api.runtime.process.WorkItemHandler

  Work item handler that allows to start new case instance based on following parameters:
  - DeploymentId - deployment id where that case definition belongs to (if not given deployment id of the work item will be used)
  - CaseDefinitionId - identifier of the case definition a new case instance should be started for
  - Data_NAME - case file data to be given when starting a case - NAME is the name of the case file input, can be given as many times as needed
  - UserRole_NAME - case role assignment as user entity where NAME is the name of the role that given user should be assigned to
  - GroupRole_NAME - case role assignment as group entity where NAME is the name of the role that given group should be assigned to
  - DataAccess_NAME - case file data access restriction where NAME is the name of the data that given roles should have access to, supports list of roles (comma separated)
  - Independent - indicates if the case instance is independent of the node that starts it - default is false
  - DestroyOnAbort - indicates if the case instance should be destroyed in case the work item is aborted, defaults to true
  This work item allows to be executed in independent mode which means once the case instance is started it will complete work item without waiting for case instance completion. In this scenario work item is completed with data taken from the case instance - data from case file plus case id that is stored under CaseId name in the result map.
  If the work item is (as by default) in the dependent mode, this work item will not be completed until case instance completes - either being closed or canceled/destroyed.
  Regardless of the mode in which this handler executes work items CaseId is always returned as part of the result of work item completion. Additionally case file data are also returned on completion - data that are available at the time when work item is being completed.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `StartCaseWorkItemHandler​(org.kie.api.runtime.KieSession ksession)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `abortWorkItem​(org.kie.api.runtime.process.WorkItem workItem, org.kie.api.runtime.process.WorkItemManager manager)` |
    `void` | `executeWorkItem​(org.kie.api.runtime.process.WorkItem workItem, org.kie.api.runtime.process.WorkItemManager manager)` |
    `protected CaseFileInstance` | `getCaseFile​(org.kie.api.runtime.KieSession ksession)` |
    `protected void` | `parseParameters​(org.kie.api.runtime.process.WorkItem workItem, Map<String,​Object> caseFileData, Map<String,​org.kie.api.task.model.OrganizationalEntity> roleAssignments, Map<String,​List<String>> accessRestrictions)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### StartCaseWorkItemHandler

          public StartCaseWorkItemHandler​(org.kie.api.runtime.KieSession ksession)

  - ### Method Detail

    - #### executeWorkItem

          public void executeWorkItem​(org.kie.api.runtime.process.WorkItem workItem,
                                      org.kie.api.runtime.process.WorkItemManager manager)

      Specified by:
        `executeWorkItem` in interface `org.kie.api.runtime.process.WorkItemHandler`

    - #### abortWorkItem

          public void abortWorkItem​(org.kie.api.runtime.process.WorkItem workItem,
                                    org.kie.api.runtime.process.WorkItemManager manager)

      Specified by:
        `abortWorkItem` in interface `org.kie.api.runtime.process.WorkItemHandler`

    - #### getCaseFile

          protected CaseFileInstance getCaseFile​(org.kie.api.runtime.KieSession ksession)

    - #### parseParameters

          protected void parseParameters​(org.kie.api.runtime.process.WorkItem workItem,
                                         Map<String,​Object> caseFileData,
                                         Map<String,​org.kie.api.task.model.OrganizationalEntity> roleAssignments,
                                         Map<String,​List<String>> accessRestrictions)