org.jbpm.process.audit

## Class JPAAuditLogService

- java.lang.Object
- - org.jbpm.process.audit.JPAAuditLogService

- All Implemented Interfaces:
    AuditLogService, org.kie.api.runtime.manager.audit.AuditService
  Direct Known Subclasses:
    TaskJPAAuditService

      public class JPAAuditLogService
      extends Object
      implements AuditLogService

  The idea here is that we have a entity manager factory (similar to a session factory) that we repeatedly use to generate an entity manager (which is a persistence context) for the specific service command. While ProcessInstanceLog (and other *Log) entities do not contain LOB's (which sometimes necessitate the use of tx's even in read situations), we use transactions here none-the-less, just to be safe. Obviously, if there is already a running transaction present, we don't do anything to it. At the end of every command, we make sure to close the entity manager we've been using -- which also means that we detach any entities that might be associated with the entity manager/persistence context. After all, this is a service which means our philosophy here is to provide a real interface, and not a leaky one.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Map<String,Class<?>>` | `criteriaFieldClasses`
    `static Map<String,String>` | `criteriaFields`
    `static String` | `NODE_INSTANCE_LOG_DELETE`
    `static String` | `NODE_INSTANCE_LOG_QUERY`
    `protected PersistenceStrategy` | `persistenceStrategy`
    `static String` | `PROCESS_INSTANCE_LOG_DELETE`
    `static String` | `PROCESS_INSTANCE_LOG_QUERY`
    `static String` | `VARIABLE_INSTANCE_LOG_DELETE`
    `static String` | `VARIABLE_INSTANCE_LOG_QUERY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JPAAuditLogService()`
    `JPAAuditLogService(javax.persistence.EntityManagerFactory emf)`
    `JPAAuditLogService(javax.persistence.EntityManagerFactory emf, PersistenceStrategyType type)`
    `JPAAuditLogService(org.kie.api.runtime.Environment env)`
    `JPAAuditLogService(org.kie.api.runtime.Environment env, PersistenceStrategyType type)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected static void` | `addCriteria(String listId, String fieldName, Class type)`
    `static void` | `addVarValCriteria(boolean addWhereClause, org.jbpm.query.jpa.impl.QueryAndParameterAppender queryAppender, String tableId, List<Object[]> varValCriteriaList)`
    `static void` | `checkVarValCriteria(List<String> varValList, boolean union, boolean regex, List<Object[]> varValCriteriaList)`
    `void` | `clear()`
    `protected <C,I> List<I>` | `convertListToInterfaceList(List<C> internalResult, Class<I> interfaceType)`
    `void` | `dispose()`
    `int` | `doDelete(org.kie.internal.query.data.QueryData queryData, Class<?> resultType)`
    `int` | `doDelete(String queryBase, org.kie.internal.query.data.QueryData queryData, Class<?> resultType)`
    `<T> List<T>` | `doQuery(org.kie.internal.query.data.QueryData queryData, Class<T> resultType)`
    `<T> List<T>` | `doQuery(String queryBase, org.kie.internal.query.data.QueryData queryData, Class<T> resultType)`
    `List<ProcessInstanceLog>` | `findActiveProcessInstances()`
    `List<ProcessInstanceLog>` | `findActiveProcessInstances(String processId)`
    `List<NodeInstanceLog>` | `findNodeInstances(long processInstanceId)`
    `List<NodeInstanceLog>` | `findNodeInstances(long processInstanceId, String nodeId)`
    `ProcessInstanceLog` | `findProcessInstance(long processInstanceId)`
    `List<ProcessInstanceLog>` | `findProcessInstances()` Service methods
    `List<ProcessInstanceLog>` | `findProcessInstances(String processId)`
    `List<ProcessInstanceLog>` | `findSubProcessInstances(long processInstanceId)`
    `List<VariableInstanceLog>` | `findVariableInstances(long processInstanceId)`
    `List<VariableInstanceLog>` | `findVariableInstances(long processInstanceId, String variableId)`
    `List<VariableInstanceLog>` | `findVariableInstancesByName(String variableId, boolean onlyActiveProcesses)`
    `List<VariableInstanceLog>` | `findVariableInstancesByNameAndValue(String variableId, String value, boolean onlyActiveProcesses)`
    `String` | `getPersistenceUnitName()`
    `org.kie.internal.runtime.manager.audit.query.NodeInstanceLogDeleteBuilder` | `nodeInstanceLogDelete()`
    `org.kie.internal.runtime.manager.audit.query.NodeInstanceLogQueryBuilder` | `nodeInstanceLogQuery()` Creates a "query builder" instance that allows the user to specify the specific query criteria to retrieve `NodeInstanceLog` instances.
    `org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogDeleteBuilder` | `processInstanceLogDelete()`
    `org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogQueryBuilder` | `processInstanceLogQuery()` Creates a "query builder" instance that allows the user to specify the specific query criteria to retrieve `ProcessInstanceLog` instances.
    `List<org.kie.api.runtime.manager.audit.NodeInstanceLog>` | `queryNodeInstanceLogs(org.kie.internal.query.data.QueryData queryData)`
    `List<org.kie.api.runtime.manager.audit.ProcessInstanceLog>` | `queryProcessInstanceLogs(org.kie.internal.query.data.QueryData queryData)`
    `List<org.kie.api.runtime.manager.audit.VariableInstanceLog>` | `queryVariableInstanceLogs(org.kie.internal.query.data.QueryData queryData)`
    `void` | `setPersistenceUnitName(String persistenceUnitName)`
    `org.kie.internal.runtime.manager.audit.query.VariableInstanceLogDeleteBuilder` | `variableInstanceLogDelete()`
    `org.kie.internal.runtime.manager.audit.query.VariableInstanceLogQueryBuilder` | `variableInstanceLogQuery()` Creates a "query builder" instance that allows the user to specify the specific query criteria to retrieve `VariableInstanceLog` instances.

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

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

- - ### Field Detail

    - #### persistenceStrategy

          protected PersistenceStrategy persistenceStrategy

    - #### NODE_INSTANCE_LOG_QUERY

          public static String NODE_INSTANCE_LOG_QUERY

    - #### VARIABLE_INSTANCE_LOG_QUERY

          public static String VARIABLE_INSTANCE_LOG_QUERY

    - #### PROCESS_INSTANCE_LOG_QUERY

          public static String PROCESS_INSTANCE_LOG_QUERY

    - #### NODE_INSTANCE_LOG_DELETE

          public static String NODE_INSTANCE_LOG_DELETE

    - #### VARIABLE_INSTANCE_LOG_DELETE

          public static String VARIABLE_INSTANCE_LOG_DELETE

    - #### PROCESS_INSTANCE_LOG_DELETE

          public static String PROCESS_INSTANCE_LOG_DELETE

    - #### criteriaFields

          public static Map<String,String> criteriaFields

    - #### criteriaFieldClasses

          public static Map<String,Class<?>> criteriaFieldClasses

  - ### Constructor Detail

    - #### JPAAuditLogService

          public JPAAuditLogService()

    - #### JPAAuditLogService

          public JPAAuditLogService(org.kie.api.runtime.Environment env,
                            PersistenceStrategyType type)

    - #### JPAAuditLogService

          public JPAAuditLogService(org.kie.api.runtime.Environment env)

    - #### JPAAuditLogService

          public JPAAuditLogService(javax.persistence.EntityManagerFactory emf)

    - #### JPAAuditLogService

          public JPAAuditLogService(javax.persistence.EntityManagerFactory emf,
                            PersistenceStrategyType type)

  - ### Method Detail

    - #### setPersistenceUnitName

          public void setPersistenceUnitName(String persistenceUnitName)

    - #### getPersistenceUnitName

          public String getPersistenceUnitName()

    - #### findProcessInstances

          public List<ProcessInstanceLog> findProcessInstances()

      Description copied from interface: `AuditLogService`
      Service methods
      Specified by:
        `findProcessInstances` in interface `AuditLogService`
      Specified by:
        `findProcessInstances` in interface `org.kie.api.runtime.manager.audit.AuditService`

    - #### findActiveProcessInstances

          public List<ProcessInstanceLog> findActiveProcessInstances()

      Specified by:
        `findActiveProcessInstances` in interface `AuditLogService`

    - #### findProcessInstances

          public List<ProcessInstanceLog> findProcessInstances(String processId)

      Specified by:
        `findProcessInstances` in interface `AuditLogService`
      Specified by:
        `findProcessInstances` in interface `org.kie.api.runtime.manager.audit.AuditService`

    - #### findActiveProcessInstances

          public List<ProcessInstanceLog> findActiveProcessInstances(String processId)

      Specified by:
        `findActiveProcessInstances` in interface `AuditLogService`
      Specified by:
        `findActiveProcessInstances` in interface `org.kie.api.runtime.manager.audit.AuditService`

    - #### findProcessInstance

          public ProcessInstanceLog findProcessInstance(long processInstanceId)

      Specified by:
        `findProcessInstance` in interface `AuditLogService`
      Specified by:
        `findProcessInstance` in interface `org.kie.api.runtime.manager.audit.AuditService`

    - #### findSubProcessInstances

          public List<ProcessInstanceLog> findSubProcessInstances(long processInstanceId)

      Specified by:
        `findSubProcessInstances` in interface `AuditLogService`
      Specified by:
        `findSubProcessInstances` in interface `org.kie.api.runtime.manager.audit.AuditService`

    - #### findNodeInstances

          public List<NodeInstanceLog> findNodeInstances(long processInstanceId)

      Specified by:
        `findNodeInstances` in interface `AuditLogService`
      Specified by:
        `findNodeInstances` in interface `org.kie.api.runtime.manager.audit.AuditService`

    - #### findNodeInstances

          public List<NodeInstanceLog> findNodeInstances(long processInstanceId,
                                                String nodeId)

      Specified by:
        `findNodeInstances` in interface `AuditLogService`
      Specified by:
        `findNodeInstances` in interface `org.kie.api.runtime.manager.audit.AuditService`

    - #### findVariableInstances

          public List<VariableInstanceLog> findVariableInstances(long processInstanceId)

      Specified by:
        `findVariableInstances` in interface `AuditLogService`
      Specified by:
        `findVariableInstances` in interface `org.kie.api.runtime.manager.audit.AuditService`

    - #### findVariableInstances

          public List<VariableInstanceLog> findVariableInstances(long processInstanceId,
                                                        String variableId)

      Specified by:
        `findVariableInstances` in interface `AuditLogService`
      Specified by:
        `findVariableInstances` in interface `org.kie.api.runtime.manager.audit.AuditService`

    - #### findVariableInstancesByName

          public List<VariableInstanceLog> findVariableInstancesByName(String variableId,
                                                              boolean onlyActiveProcesses)

      Specified by:
        `findVariableInstancesByName` in interface `AuditLogService`
      Specified by:
        `findVariableInstancesByName` in interface `org.kie.api.runtime.manager.audit.AuditService`

    - #### findVariableInstancesByNameAndValue

          public List<VariableInstanceLog> findVariableInstancesByNameAndValue(String variableId,
                                                                      String value,
                                                                      boolean onlyActiveProcesses)

      Specified by:
        `findVariableInstancesByNameAndValue` in interface `AuditLogService`
      Specified by:
        `findVariableInstancesByNameAndValue` in interface `org.kie.api.runtime.manager.audit.AuditService`

    - #### clear

          public void clear()

      Specified by:
        `clear` in interface `org.kie.api.runtime.manager.audit.AuditService`

    - #### dispose

          public void dispose()

      Specified by:
        `dispose` in interface `org.kie.api.runtime.manager.audit.AuditService`

    - #### nodeInstanceLogQuery

          public org.kie.internal.runtime.manager.audit.query.NodeInstanceLogQueryBuilder nodeInstanceLogQuery()

      Description copied from interface: `AuditLogService`
      Creates a "query builder" instance that allows the user to specify the specific query criteria to retrieve `NodeInstanceLog` instances.
      Specified by:
        `nodeInstanceLogQuery` in interface `AuditLogService`
      Returns:
        a `NodeInstanceLogQueryBuilder` instance

    - #### variableInstanceLogQuery

          public org.kie.internal.runtime.manager.audit.query.VariableInstanceLogQueryBuilder variableInstanceLogQuery()

      Description copied from interface: `AuditLogService`
      Creates a "query builder" instance that allows the user to specify the specific query criteria to retrieve `VariableInstanceLog` instances.
      Specified by:
        `variableInstanceLogQuery` in interface `AuditLogService`
      Returns:
        a `VariableInstanceLogQueryBuilder` instance

    - #### processInstanceLogQuery

          public org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogQueryBuilder processInstanceLogQuery()

      Description copied from interface: `AuditLogService`
      Creates a "query builder" instance that allows the user to specify the specific query criteria to retrieve `ProcessInstanceLog` instances.
      Specified by:
        `processInstanceLogQuery` in interface `AuditLogService`
      Returns:
        a `ProcessInstanceLogQueryBuilder` instance

    - #### processInstanceLogDelete

          public org.kie.internal.runtime.manager.audit.query.ProcessInstanceLogDeleteBuilder processInstanceLogDelete()

      Specified by:
        `processInstanceLogDelete` in interface `AuditLogService`

    - #### nodeInstanceLogDelete

          public org.kie.internal.runtime.manager.audit.query.NodeInstanceLogDeleteBuilder nodeInstanceLogDelete()

      Specified by:
        `nodeInstanceLogDelete` in interface `AuditLogService`

    - #### variableInstanceLogDelete

          public org.kie.internal.runtime.manager.audit.query.VariableInstanceLogDeleteBuilder variableInstanceLogDelete()

      Specified by:
        `variableInstanceLogDelete` in interface `AuditLogService`

    - #### queryNodeInstanceLogs

          public List<org.kie.api.runtime.manager.audit.NodeInstanceLog> queryNodeInstanceLogs(org.kie.internal.query.data.QueryData queryData)

      Specified by:
        `queryNodeInstanceLogs` in interface `AuditLogService`

    - #### queryVariableInstanceLogs

          public List<org.kie.api.runtime.manager.audit.VariableInstanceLog> queryVariableInstanceLogs(org.kie.internal.query.data.QueryData queryData)

      Specified by:
        `queryVariableInstanceLogs` in interface `AuditLogService`

    - #### queryProcessInstanceLogs

          public List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> queryProcessInstanceLogs(org.kie.internal.query.data.QueryData queryData)

      Specified by:
        `queryProcessInstanceLogs` in interface `AuditLogService`

    - #### convertListToInterfaceList

          protected <C,I> List<I> convertListToInterfaceList(List<C> internalResult,
                                                 Class<I> interfaceType)

    - #### addCriteria

          protected static void addCriteria(String listId,
                         String fieldName,
                         Class type)

    - #### doQuery

          public <T> List<T> doQuery(org.kie.internal.query.data.QueryData queryData,
                            Class<T> resultType)

      Parameters:
        `queryData` -
        `resultType` -
      Returns:

    - #### doQuery

          public <T> List<T> doQuery(String queryBase,
                            org.kie.internal.query.data.QueryData queryData,
                            Class<T> resultType)

    - #### doDelete

          public int doDelete(org.kie.internal.query.data.QueryData queryData,
                     Class<?> resultType)

    - #### doDelete

          public int doDelete(String queryBase,
                     org.kie.internal.query.data.QueryData queryData,
                     Class<?> resultType)

    - #### checkVarValCriteria

          public static void checkVarValCriteria(List<String> varValList,
                                 boolean union,
                                 boolean regex,
                                 List<Object[]> varValCriteriaList)

    - #### addVarValCriteria

          public static void addVarValCriteria(boolean addWhereClause,
                               org.jbpm.query.jpa.impl.QueryAndParameterAppender queryAppender,
                               String tableId,
                               List<Object[]> varValCriteriaList)

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