Package org.jbpm.services.task.persistence

## Class JPATaskPersistenceContext

- java.lang.Object
- - org.jbpm.services.task.persistence.JPATaskPersistenceContext

- All Implemented Interfaces:
    `org.kie.internal.task.api.TaskPersistenceContext`

      public class JPATaskPersistenceContext
      extends Object
      implements org.kie.internal.task.api.TaskPersistenceContext

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected javax.persistence.EntityManager` | `em` |
    `protected boolean` | `isJTA` |
    `protected javax.persistence.LockModeType` | `lockMode` |
    `protected boolean` | `pessimisticLocking` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `JPATaskPersistenceContext​(javax.persistence.EntityManager em)` |
    `JPATaskPersistenceContext​(javax.persistence.EntityManager em, boolean isJTA)` |
    `JPATaskPersistenceContext​(javax.persistence.EntityManager em, boolean isJTA, boolean locking, String lockingMode)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `org.kie.api.task.model.Attachment` | `addAttachmentToTask​(org.kie.api.task.model.Attachment attachment, org.kie.api.task.model.Task task)` |
    `org.kie.api.task.model.Comment` | `addCommentToTask​(org.kie.api.task.model.Comment comment, org.kie.api.task.model.Task task)` |
    `HashMap<String,​Object>` | `addParametersToMap​(Object... parameterValues)` |
    `protected void` | `check()` |
    `void` | `close()` |
    `List<org.kie.api.task.model.TaskSummary>` | `doTaskSummaryCriteriaQuery​(String userId, org.kie.api.task.UserGroupCallback userGroupCallback, Object queryWhere)` |
    `int` | `executeUpdate​(String queryName, Map<String,​Object> params)` |
    `int` | `executeUpdateString​(String updateString)` |
    `<T> T` | `find​(Class<T> entityClass, Object primaryKey)` |
    `org.kie.api.task.model.Attachment` | `findAttachment​(Long attachmentId)` |
    `org.kie.api.task.model.Comment` | `findComment​(Long commentId)` |
    `org.kie.api.task.model.Content` | `findContent​(Long contentId)` |
    `org.kie.internal.task.api.model.Deadline` | `findDeadline​(Long deadlineId)` |
    `org.kie.api.task.model.Email` | `findEmail​(String emailId)` |
    `org.kie.api.task.model.Group` | `findGroup​(String groupId)` |
    `org.kie.api.task.model.OrganizationalEntity` | `findOrgEntity​(String orgEntityId)` |
    `org.kie.api.task.model.Task` | `findTask​(Long taskId)` |
    `Long` | `findTaskIdByContentId​(Long contentId)` |
    `org.kie.api.task.model.User` | `findUser​(String userId)` |
    `javax.persistence.EntityManager` | `getEntityManager()` |
    `protected javax.persistence.Query` | `getQueryByName​(String queryName, Map<String,​Object> params)` |
    `boolean` | `isOpen()` |
    `void` | `joinTransaction()` |
    `<T> T` | `merge​(T entity)` |
    `<T> T` | `persist​(T object)` |
    `org.kie.api.task.model.Attachment` | `persistAttachment​(org.kie.api.task.model.Attachment attachment)` |
    `org.kie.api.task.model.Comment` | `persistComment​(org.kie.api.task.model.Comment comment)` |
    `org.kie.api.task.model.Content` | `persistContent​(org.kie.api.task.model.Content content)` |
    `org.kie.internal.task.api.model.Deadline` | `persistDeadline​(org.kie.internal.task.api.model.Deadline deadline)` |
    `org.kie.api.task.model.Email` | `persistEmail​(org.kie.api.task.model.Email email)` |
    `org.kie.api.task.model.Group` | `persistGroup​(org.kie.api.task.model.Group group)` |
    `org.kie.api.task.model.OrganizationalEntity` | `persistOrgEntity​(org.kie.api.task.model.OrganizationalEntity orgEntity)` |
    `org.kie.api.task.model.Task` | `persistTask​(org.kie.api.task.model.Task task)` |
    `org.kie.api.task.model.User` | `persistUser​(org.kie.api.task.model.User user)` |
    `<T> T` | `queryAndLockStringWithParametersInTransaction​(String queryName, Map<String,​Object> params, boolean singleResult, Class<T> clazz)` |
    `<T> T` | `queryAndLockWithParametersInTransaction​(String queryName, Map<String,​Object> params, boolean singleResult, Class<T> clazz)` |
    `<T> T` | `queryInTransaction​(String queryName, Class<T> clazz)` |
    `<T> T` | `queryStringInTransaction​(String queryString, Class<T> clazz)` |
    `<T> T` | `queryStringWithParametersInTransaction​(String queryString, boolean singleResult, Map<String,​Object> params, Class<T> clazz)` |
    `<T> T` | `queryStringWithParametersInTransaction​(String queryString, Map<String,​Object> params, Class<T> clazz)` |
    `<T> T` | `queryWithParametersInTransaction​(String queryName, boolean singleResult, Map<String,​Object> params, Class<T> clazz)` |
    `<T> T` | `queryWithParametersInTransaction​(String queryName, Map<String,​Object> params, Class<T> clazz)` |
    `<T> T` | `remove​(T entity)` |
    `org.kie.api.task.model.Attachment` | `removeAttachment​(org.kie.api.task.model.Attachment attachment)` |
    `org.kie.api.task.model.Attachment` | `removeAttachmentFromTask​(org.kie.api.task.model.Task task, long attachmentId)` |
    `org.kie.api.task.model.Comment` | `removeComment​(org.kie.api.task.model.Comment comment)` |
    `org.kie.api.task.model.Comment` | `removeCommentFromTask​(org.kie.api.task.model.Comment comment, org.kie.api.task.model.Task task)` |
    `org.kie.api.task.model.Content` | `removeContent​(org.kie.api.task.model.Content content)` |
    `org.kie.internal.task.api.model.Deadline` | `removeDeadline​(org.kie.internal.task.api.model.Deadline deadline)` |
    `org.kie.api.task.model.Email` | `removeEmail​(org.kie.api.task.model.Email email)` |
    `org.kie.api.task.model.Group` | `removeGroup​(org.kie.api.task.model.Group group)` |
    `org.kie.api.task.model.OrganizationalEntity` | `removeOrgEntity​(org.kie.api.task.model.OrganizationalEntity orgEntity)` |
    `org.kie.api.task.model.Task` | `removeTask​(org.kie.api.task.model.Task task)` |
    `org.kie.api.task.model.User` | `removeUser​(org.kie.api.task.model.User user)` |
    `org.kie.api.task.model.Task` | `setDocumentToTask​(org.kie.api.task.model.Content content, org.kie.internal.task.api.model.ContentData contentData, org.kie.api.task.model.Task task)` |
    `org.kie.api.task.model.Task` | `setFaultToTask​(org.kie.api.task.model.Content content, org.kie.internal.task.api.model.FaultData faultData, org.kie.api.task.model.Task task)` |
    `org.kie.api.task.model.Task` | `setOutputToTask​(org.kie.api.task.model.Content content, org.kie.internal.task.api.model.ContentData contentData, org.kie.api.task.model.Task task)` |
    `org.kie.api.task.model.Attachment` | `updateAttachment​(org.kie.api.task.model.Attachment attachment)` |
    `org.kie.api.task.model.Comment` | `updateComment​(org.kie.api.task.model.Comment comment)` |
    `org.kie.api.task.model.Content` | `updateContent​(org.kie.api.task.model.Content content)` |
    `org.kie.internal.task.api.model.Deadline` | `updateDeadline​(org.kie.internal.task.api.model.Deadline deadline)` |
    `org.kie.api.task.model.Email` | `updateEmail​(org.kie.api.task.model.Email email)` |
    `org.kie.api.task.model.Group` | `updateGroup​(org.kie.api.task.model.Group group)` |
    `org.kie.api.task.model.OrganizationalEntity` | `updateOrgEntity​(org.kie.api.task.model.OrganizationalEntity orgEntity)` |
    `org.kie.api.task.model.Task` | `updateTask​(org.kie.api.task.model.Task task)` |
    `org.kie.api.task.model.User` | `updateUser​(org.kie.api.task.model.User user)` |

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

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

- - ### Field Detail

    - #### em

          protected javax.persistence.EntityManager em

    - #### isJTA

          protected final boolean isJTA

    - #### pessimisticLocking

          protected final boolean pessimisticLocking

    - #### lockMode

          protected javax.persistence.LockModeType lockMode

  - ### Constructor Detail

    - #### JPATaskPersistenceContext

          public JPATaskPersistenceContext​(javax.persistence.EntityManager em)

    - #### JPATaskPersistenceContext

          public JPATaskPersistenceContext​(javax.persistence.EntityManager em,
                                           boolean isJTA)

    - #### JPATaskPersistenceContext

          public JPATaskPersistenceContext​(javax.persistence.EntityManager em,
                                           boolean isJTA,
                                           boolean locking,
                                           String lockingMode)

  - ### Method Detail

    - #### getEntityManager

          public javax.persistence.EntityManager getEntityManager()

    - #### findTask

          public org.kie.api.task.model.Task findTask​(Long taskId)

      Specified by:
        `findTask` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### persistTask

          public org.kie.api.task.model.Task persistTask​(org.kie.api.task.model.Task task)

      Specified by:
        `persistTask` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### updateTask

          public org.kie.api.task.model.Task updateTask​(org.kie.api.task.model.Task task)

      Specified by:
        `updateTask` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### removeTask

          public org.kie.api.task.model.Task removeTask​(org.kie.api.task.model.Task task)

      Specified by:
        `removeTask` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### findGroup

          public org.kie.api.task.model.Group findGroup​(String groupId)

      Specified by:
        `findGroup` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### persistGroup

          public org.kie.api.task.model.Group persistGroup​(org.kie.api.task.model.Group group)

      Specified by:
        `persistGroup` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### updateGroup

          public org.kie.api.task.model.Group updateGroup​(org.kie.api.task.model.Group group)

      Specified by:
        `updateGroup` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### removeGroup

          public org.kie.api.task.model.Group removeGroup​(org.kie.api.task.model.Group group)

      Specified by:
        `removeGroup` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### findUser

          public org.kie.api.task.model.User findUser​(String userId)

      Specified by:
        `findUser` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### persistUser

          public org.kie.api.task.model.User persistUser​(org.kie.api.task.model.User user)

      Specified by:
        `persistUser` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### updateUser

          public org.kie.api.task.model.User updateUser​(org.kie.api.task.model.User user)

      Specified by:
        `updateUser` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### removeUser

          public org.kie.api.task.model.User removeUser​(org.kie.api.task.model.User user)

      Specified by:
        `removeUser` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### findEmail

          public org.kie.api.task.model.Email findEmail​(String emailId)

      Specified by:
        `findEmail` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### persistEmail

          public org.kie.api.task.model.Email persistEmail​(org.kie.api.task.model.Email email)

      Specified by:
        `persistEmail` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### updateEmail

          public org.kie.api.task.model.Email updateEmail​(org.kie.api.task.model.Email email)

      Specified by:
        `updateEmail` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### removeEmail

          public org.kie.api.task.model.Email removeEmail​(org.kie.api.task.model.Email email)

      Specified by:
        `removeEmail` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### findOrgEntity

          public org.kie.api.task.model.OrganizationalEntity findOrgEntity​(String orgEntityId)

      Specified by:
        `findOrgEntity` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### persistOrgEntity

          public org.kie.api.task.model.OrganizationalEntity persistOrgEntity​(org.kie.api.task.model.OrganizationalEntity orgEntity)

      Specified by:
        `persistOrgEntity` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### updateOrgEntity

          public org.kie.api.task.model.OrganizationalEntity updateOrgEntity​(org.kie.api.task.model.OrganizationalEntity orgEntity)

      Specified by:
        `updateOrgEntity` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### removeOrgEntity

          public org.kie.api.task.model.OrganizationalEntity removeOrgEntity​(org.kie.api.task.model.OrganizationalEntity orgEntity)

      Specified by:
        `removeOrgEntity` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### findContent

          public org.kie.api.task.model.Content findContent​(Long contentId)

      Specified by:
        `findContent` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### persistContent

          public org.kie.api.task.model.Content persistContent​(org.kie.api.task.model.Content content)

      Specified by:
        `persistContent` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### updateContent

          public org.kie.api.task.model.Content updateContent​(org.kie.api.task.model.Content content)

      Specified by:
        `updateContent` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### removeContent

          public org.kie.api.task.model.Content removeContent​(org.kie.api.task.model.Content content)

      Specified by:
        `removeContent` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### setDocumentToTask

          public org.kie.api.task.model.Task setDocumentToTask​(org.kie.api.task.model.Content content,
                                                               org.kie.internal.task.api.model.ContentData contentData,
                                                               org.kie.api.task.model.Task task)

      Specified by:
        `setDocumentToTask` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### setFaultToTask

          public org.kie.api.task.model.Task setFaultToTask​(org.kie.api.task.model.Content content,
                                                            org.kie.internal.task.api.model.FaultData faultData,
                                                            org.kie.api.task.model.Task task)

      Specified by:
        `setFaultToTask` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### setOutputToTask

          public org.kie.api.task.model.Task setOutputToTask​(org.kie.api.task.model.Content content,
                                                             org.kie.internal.task.api.model.ContentData contentData,
                                                             org.kie.api.task.model.Task task)

      Specified by:
        `setOutputToTask` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### findAttachment

          public org.kie.api.task.model.Attachment findAttachment​(Long attachmentId)

      Specified by:
        `findAttachment` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### persistAttachment

          public org.kie.api.task.model.Attachment persistAttachment​(org.kie.api.task.model.Attachment attachment)

      Specified by:
        `persistAttachment` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### updateAttachment

          public org.kie.api.task.model.Attachment updateAttachment​(org.kie.api.task.model.Attachment attachment)

      Specified by:
        `updateAttachment` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### removeAttachment

          public org.kie.api.task.model.Attachment removeAttachment​(org.kie.api.task.model.Attachment attachment)

      Specified by:
        `removeAttachment` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### removeAttachmentFromTask

          public org.kie.api.task.model.Attachment removeAttachmentFromTask​(org.kie.api.task.model.Task task,
                                                                            long attachmentId)

      Specified by:
        `removeAttachmentFromTask` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### addAttachmentToTask

          public org.kie.api.task.model.Attachment addAttachmentToTask​(org.kie.api.task.model.Attachment attachment,
                                                                       org.kie.api.task.model.Task task)

      Specified by:
        `addAttachmentToTask` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### findComment

          public org.kie.api.task.model.Comment findComment​(Long commentId)

      Specified by:
        `findComment` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### persistComment

          public org.kie.api.task.model.Comment persistComment​(org.kie.api.task.model.Comment comment)

      Specified by:
        `persistComment` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### updateComment

          public org.kie.api.task.model.Comment updateComment​(org.kie.api.task.model.Comment comment)

      Specified by:
        `updateComment` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### removeComment

          public org.kie.api.task.model.Comment removeComment​(org.kie.api.task.model.Comment comment)

      Specified by:
        `removeComment` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### removeCommentFromTask

          public org.kie.api.task.model.Comment removeCommentFromTask​(org.kie.api.task.model.Comment comment,
                                                                      org.kie.api.task.model.Task task)

      Specified by:
        `removeCommentFromTask` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### addCommentToTask

          public org.kie.api.task.model.Comment addCommentToTask​(org.kie.api.task.model.Comment comment,
                                                                 org.kie.api.task.model.Task task)

      Specified by:
        `addCommentToTask` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### findDeadline

          public org.kie.internal.task.api.model.Deadline findDeadline​(Long deadlineId)

      Specified by:
        `findDeadline` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### persistDeadline

          public org.kie.internal.task.api.model.Deadline persistDeadline​(org.kie.internal.task.api.model.Deadline deadline)

      Specified by:
        `persistDeadline` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### updateDeadline

          public org.kie.internal.task.api.model.Deadline updateDeadline​(org.kie.internal.task.api.model.Deadline deadline)

      Specified by:
        `updateDeadline` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### removeDeadline

          public org.kie.internal.task.api.model.Deadline removeDeadline​(org.kie.internal.task.api.model.Deadline deadline)

      Specified by:
        `removeDeadline` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### queryWithParametersInTransaction

          public <T> T queryWithParametersInTransaction​(String queryName,
                                                        Map<String,​Object> params,
                                                        Class<T> clazz)

      Specified by:
        `queryWithParametersInTransaction` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### queryWithParametersInTransaction

          public <T> T queryWithParametersInTransaction​(String queryName,
                                                        boolean singleResult,
                                                        Map<String,​Object> params,
                                                        Class<T> clazz)

      Specified by:
        `queryWithParametersInTransaction` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### queryAndLockWithParametersInTransaction

          public <T> T queryAndLockWithParametersInTransaction​(String queryName,
                                                               Map<String,​Object> params,
                                                               boolean singleResult,
                                                               Class<T> clazz)

      Specified by:
        `queryAndLockWithParametersInTransaction` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### queryInTransaction

          public <T> T queryInTransaction​(String queryName,
                                          Class<T> clazz)

      Specified by:
        `queryInTransaction` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### queryStringInTransaction

          public <T> T queryStringInTransaction​(String queryString,
                                                Class<T> clazz)

      Specified by:
        `queryStringInTransaction` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### queryStringWithParametersInTransaction

          public <T> T queryStringWithParametersInTransaction​(String queryString,
                                                              Map<String,​Object> params,
                                                              Class<T> clazz)

      Specified by:
        `queryStringWithParametersInTransaction` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### queryStringWithParametersInTransaction

          public <T> T queryStringWithParametersInTransaction​(String queryString,
                                                              boolean singleResult,
                                                              Map<String,​Object> params,
                                                              Class<T> clazz)

      Specified by:
        `queryStringWithParametersInTransaction` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### queryAndLockStringWithParametersInTransaction

          public <T> T queryAndLockStringWithParametersInTransaction​(String queryName,
                                                                     Map<String,​Object> params,
                                                                     boolean singleResult,
                                                                     Class<T> clazz)

      Specified by:
        `queryAndLockStringWithParametersInTransaction` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### executeUpdateString

          public int executeUpdateString​(String updateString)

      Specified by:
        `executeUpdateString` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### executeUpdate

          public int executeUpdate​(String queryName,
                                   Map<String,​Object> params)

      Specified by:
        `executeUpdate` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### addParametersToMap

          public HashMap<String,​Object> addParametersToMap​(Object... parameterValues)

      Specified by:
        `addParametersToMap` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### persist

          public <T> T persist​(T object)

      Specified by:
        `persist` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### find

          public <T> T find​(Class<T> entityClass,
                            Object primaryKey)

      Specified by:
        `find` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### remove

          public <T> T remove​(T entity)

      Specified by:
        `remove` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### merge

          public <T> T merge​(T entity)

      Specified by:
        `merge` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### isOpen

          public boolean isOpen()

      Specified by:
        `isOpen` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### joinTransaction

          public void joinTransaction()

      Specified by:
        `joinTransaction` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### close

          public void close()

      Specified by:
        `close` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### check

          protected void check()

    - #### getQueryByName

          protected javax.persistence.Query getQueryByName​(String queryName,
                                                           Map<String,​Object> params)

    - #### findTaskIdByContentId

          public Long findTaskIdByContentId​(Long contentId)

      Specified by:
        `findTaskIdByContentId` in interface `org.kie.internal.task.api.TaskPersistenceContext`

    - #### doTaskSummaryCriteriaQuery

          public List<org.kie.api.task.model.TaskSummary> doTaskSummaryCriteriaQuery​(String userId,
                                                                                     org.kie.api.task.UserGroupCallback userGroupCallback,
                                                                                     Object queryWhere)

      Specified by:
        `doTaskSummaryCriteriaQuery` in interface `org.kie.internal.task.api.TaskPersistenceContext`