org.jbpm.process.workitem.jpa

## Class JPAWorkItemHandler

- java.lang.Object
- - org.jbpm.process.workitem.AbstractLogOrThrowWorkItemHandler
  - - org.jbpm.process.workitem.jpa.JPAWorkItemHandler

- All Implemented Interfaces:
    org.kie.api.runtime.process.WorkItemHandler, org.kie.internal.runtime.Cacheable

      public class JPAWorkItemHandler
      extends AbstractLogOrThrowWorkItemHandler
      implements org.kie.internal.runtime.Cacheable

  A WorkItemHandler to perform JPA operations.
  An Action must be provided as an input parameter. The supported value for the Action parameters:
  - Create: Persist the object and return the attached entity. TO persist an object you must provide the object using the WIH parameter Entity
  - Update: Update an attached entity and returns the updated entity. You must provide the attached entity using the Entity WIH parameter.
  - Delete: Delete an attached entity. You must provide the attached entity using the Entity WIH parameter.
  - Get: Get an entity by ID. You must provide the return type using the Type parameter with the FQN of the target class and the ID using the Id parameter.
  - Query: Executes a named query and return the list of results (if any). The query must be provided using the Query input parameter and you may provide query parameters in the form of a Map with key String and value Object using the QueryParameters WIH input parameter. The result of the query is put on the output parameter QueryResults.
  When registering the WIH in the deployment descriptor, you must provide the classloader where your mapped entities are and the name of the persistence unit you configured in persistence.xml.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `CREATE_ACTION`
    `static String` | `DELETE_ACTION`
    `static String` | `GET_ACTION`
    `static String` | `P_ACTION`
    `static String` | `P_ENTITY`
    `static String` | `P_ID`
    `static String` | `P_QUERY`
    `static String` | `P_QUERY_PARAMS`
    `static String` | `P_QUERY_RESULTS`
    `static String` | `P_RESULT`
    `static String` | `P_TYPE`
    `static String` | `QUERY_ACTION`
    `static String` | `UPDATE_ACTION`

    - ### Fields inherited from class org.jbpm.process.workitem.AbstractLogOrThrowWorkItemHandler

      `logThrownException`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JPAWorkItemHandler(String persistenceUnit, ClassLoader cl)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `abortWorkItem(org.kie.api.runtime.process.WorkItem wi, org.kie.api.runtime.process.WorkItemManager wim)`
    `void` | `close()`
    `void` | `executeWorkItem(org.kie.api.runtime.process.WorkItem wi, org.kie.api.runtime.process.WorkItemManager wim)`

    - ### Methods inherited from class org.jbpm.process.workitem.AbstractLogOrThrowWorkItemHandler

      `handleException, handleException, setLogThrownException`

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

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

- - ### Field Detail

    - #### P_RESULT

          public static final String P_RESULT

      See Also:
        Constant Field Values

    - #### P_TYPE

          public static final String P_TYPE

      See Also:
        Constant Field Values

    - #### P_ID

          public static final String P_ID

      See Also:
        Constant Field Values

    - #### P_ENTITY

          public static final String P_ENTITY

      See Also:
        Constant Field Values

    - #### P_ACTION

          public static final String P_ACTION

      See Also:
        Constant Field Values

    - #### P_QUERY

          public static final String P_QUERY

      See Also:
        Constant Field Values

    - #### P_QUERY_PARAMS

          public static final String P_QUERY_PARAMS

      See Also:
        Constant Field Values

    - #### P_QUERY_RESULTS

          public static final String P_QUERY_RESULTS

      See Also:
        Constant Field Values

    - #### CREATE_ACTION

          public static final String CREATE_ACTION

      See Also:
        Constant Field Values

    - #### UPDATE_ACTION

          public static final String UPDATE_ACTION

      See Also:
        Constant Field Values

    - #### GET_ACTION

          public static final String GET_ACTION

      See Also:
        Constant Field Values

    - #### DELETE_ACTION

          public static final String DELETE_ACTION

      See Also:
        Constant Field Values

    - #### QUERY_ACTION

          public static final String QUERY_ACTION

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### JPAWorkItemHandler

          public JPAWorkItemHandler(String persistenceUnit,
                                    ClassLoader cl)

  - ### Method Detail

    - #### executeWorkItem

          public void executeWorkItem(org.kie.api.runtime.process.WorkItem wi,
                                      org.kie.api.runtime.process.WorkItemManager wim)

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

    - #### close

          public void close()

      Specified by:
        `close` in interface `org.kie.internal.runtime.Cacheable`

    - #### abortWorkItem

          public void abortWorkItem(org.kie.api.runtime.process.WorkItem wi,
                                    org.kie.api.runtime.process.WorkItemManager wim)

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

Copyright © 2001–2016 JBoss by Red Hat. All rights reserved.