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

## org.jbpm.task.service.persistence
Class TaskPersistenceManager

    java.lang.Object
      org.jbpm.task.service.persistence.TaskPersistenceManager

    public class TaskPersistenceManager

extends Object

From the Hibernate docs:

     An EntityManager is an inexpensive, non-threadsafe object that
     should be used once, for a single business process, a single unit
     of work, and then discarded. An EntityManager will not obtain
     a JDBC Connection (or a Datasource) unless it is needed, so
     you may safely open and close an EntityManager even if you are
     not sure that data access will be needed to serve a particular request.

This class is a wrapper around the entity manager that handles all persistence operations. This way, the persistence functionality can be isolated from the human-task server functionality. This class is only mean to be used in one thread: with every request handled by the human-task server, a TaskServiceSession is created with an instance of this class. Once the request has been handled, the TaskServiceSession instance and the TaskPersistenceManager instance are disposed of.

Field Summary
`static String` | `FIRST_RESULT`
`static String` | `MAX_RESULTS`

Method Summary
`static HashMap<String,Object>` | `addParametersToMap(Object... parameterValues)`
`boolean` | `beginTransaction()`
`javax.persistence.Query` | `createNewQuery(String queryString)` It is strongly suggested that you only use this method within a transaction!!
`void` | `deleteEntity(Object entity)`
`void` | `dispose()`
`void` | `endPersistenceContext()`
`void` | `endTransaction(boolean txOwner)`
`Object` | `findEntity(Class<?> entityClass, Object primaryKey)`
`List<DeadlineSummary>` | `getUnescalatedDeadlines()` Special onetime method
`List<DeadlineSummary>` | `getUnescalatedDeadlinesList()`
`boolean` | `groupExists(String groupId)`
`boolean` | `isSharedEntityManager()`
`Object` | `queryInTransaction(String queryName)`
`List<TaskSummary>` | `queryTasksWithUserIdAndLanguage(String queryName, String userId, String language)`
`List<TaskSummary>` | `queryTasksWithUserIdGroupsAndLanguage(String queryName, String userId, List<String> groupIds, String language)`
`List<TaskSummary>` | `queryTasksWithUserIdStatusAndLanguage(String queryName, String userId, List<Status> status, String language)`
`Object` | `queryWithParametersInTransaction(String queryName, Map<String,Object> params)`
`Object` | `queryWithParametersInTransaction(String queryName, Map<String,Object> params, boolean singleResult)` This method runs a query within a transaction and returns the result.
`void` | `rollBackTransaction(boolean txOwner)`
`void` | `saveEntity(Object entity)`
`void` | `setTaskStatusInTransaction(Object taskId, Status taskStatus)` Special onetime method
`void` | `setUseSharedEntityManager(boolean sharedEntityManager)`
`boolean` | `userExists(String userId)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### FIRST_RESULT

    public static final String FIRST_RESULT

See Also:
  Constant Field Values

### MAX_RESULTS

    public static final String MAX_RESULTS

See Also:
  Constant Field Values

Method Detail

### setUseSharedEntityManager

    public void setUseSharedEntityManager(boolean sharedEntityManager)

### isSharedEntityManager

    public boolean isSharedEntityManager()

### beginTransaction

    public boolean beginTransaction()

### endTransaction

    public void endTransaction(boolean txOwner)

### rollBackTransaction

    public void rollBackTransaction(boolean txOwner)

### dispose

    public void dispose()

### endPersistenceContext

    public void endPersistenceContext()

### getUnescalatedDeadlines

    public List<DeadlineSummary> getUnescalatedDeadlines()

  Special onetime method

  Returns:

### setTaskStatusInTransaction

    public void setTaskStatusInTransaction(Object taskId,
                                           Status taskStatus)

  Special onetime method

  Parameters:
    `taskId` -
    `taskStatus` -

### getUnescalatedDeadlinesList

    public List<DeadlineSummary> getUnescalatedDeadlinesList()

### findEntity

    public Object findEntity(Class<?> entityClass,
                             Object primaryKey)

### deleteEntity

    public void deleteEntity(Object entity)

### saveEntity

    public void saveEntity(Object entity)

### createNewQuery

    public javax.persistence.Query createNewQuery(String queryString)

  It is strongly suggested that you only use this method within a transaction!! PostgreSQL and DB2 are 2 databases which, depending on your situation, will probably require this.

  Parameters:
    `queryString` - The JPQL query string to execute.
  Returns:
    The result of the query.

### userExists

    public boolean userExists(String userId)

### groupExists

    public boolean groupExists(String groupId)

### queryTasksWithUserIdAndLanguage

    public List<TaskSummary> queryTasksWithUserIdAndLanguage(String queryName,
                                                             String userId,
                                                             String language)

### queryTasksWithUserIdStatusAndLanguage

    public List<TaskSummary> queryTasksWithUserIdStatusAndLanguage(String queryName,
                                                                   String userId,
                                                                   List<Status> status,
                                                                   String language)

### queryTasksWithUserIdGroupsAndLanguage

    public List<TaskSummary> queryTasksWithUserIdGroupsAndLanguage(String queryName,
                                                                   String userId,
                                                                   List<String> groupIds,
                                                                   String language)

### queryWithParametersInTransaction

    public Object queryWithParametersInTransaction(String queryName,
                                                   Map<String,Object> params,
                                                   boolean singleResult)

  This method runs a query within a transaction and returns the result. This logic is unfortunately duplicated in `TaskServiceSession.doOperationInTransaction(org.jbpm.task.service.TaskServiceSession.TransactedOperation)`. If you change the logic here, please make sure to change the logic there as well (and vice versa).

  Parameters:
    `queryName` -
    `params` -
  Returns:

### queryWithParametersInTransaction

    public Object queryWithParametersInTransaction(String queryName,
                                                   Map<String,Object> params)

### queryInTransaction

    public Object queryInTransaction(String queryName)

### addParametersToMap

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

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

Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.