org.camunda.bpm.engine.impl.persistence.entity
Class ProcessDefinitionManager

java.lang.Object
  extended by org.camunda.bpm.engine.impl.persistence.AbstractManager
      extended by org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionManager
All Implemented Interfaces:
Session, AbstractResourceDefinitionManager<ProcessDefinitionEntity>

public class ProcessDefinitionManager
extends AbstractManager
implements AbstractResourceDefinitionManager<ProcessDefinitionEntity>

Author:
Tom Baeyens, Falko Menge, Saeid Mirzaei, Christopher Zell

Field Summary
protected static EnginePersistenceLogger LOG
           
 
Constructor Summary
ProcessDefinitionManager()
           
 
Method Summary
protected  void cascadeDeleteHistoryForProcessDefinition(String processDefinitionId)
          Cascades the deletion of a process definition to the history, deletes the history.
protected  void cascadeDeleteProcessInstancesForProcessDefinition(String processDefinitionId, boolean skipCustomListeners)
          Cascades the deletion of the process definition to the process instances.
protected  ListQueryParameterObject configureParameterizedQuery(Object parameter)
           
protected  void configureProcessDefinitionQuery(ProcessDefinitionQueryImpl query)
           
protected  void createDefaultAuthorizations(ProcessDefinition processDefinition)
           
 void deleteProcessDefinition(ProcessDefinition processDefinition, String processDefinitionId, boolean cascadeToHistory, boolean cascadeToInstances, boolean skipCustomListeners)
          Deletes the given process definition from the database and cache.
 void deleteSubscriptionsForProcessDefinition(String processDefinitionId)
          Deletes the subscriptions for the process definition, which is identified by the given process definition id.
protected  void deleteTimerStartEventsForProcessDefinition(ProcessDefinition processDefinition)
          Deletes the timer start events for the given process definition.
 ProcessDefinitionEntity findDefinitionByDeploymentAndKey(String deploymentId, String definitionKey)
           
 ProcessDefinitionEntity findDefinitionByKeyVersionAndTenantId(String definitionKey, Integer definitionVersion, String tenantId)
           
 List<ProcessDefinition> findDefinitionsByIds(List<String> processDefinitionIds)
           
 List<ProcessDefinition> findDefinitionsByKeyAndTenantId(String processDefinitionKey, String tenantId, boolean isTenantIdSet)
           
 ProcessDefinitionEntity findLatestDefinitionById(String id)
           
 ProcessDefinitionEntity findLatestDefinitionByKey(String key)
           
 ProcessDefinitionEntity findLatestDefinitionByKeyAndTenantId(String definitionKey, String tenantId)
           
 ProcessDefinitionEntity findLatestProcessDefinitionById(String processDefinitionId)
           
 ProcessDefinitionEntity findLatestProcessDefinitionByKey(String processDefinitionKey)
           
 ProcessDefinitionEntity findLatestProcessDefinitionByKeyAndTenantId(String processDefinitionKey, String tenantId)
           
 String findPreviousProcessDefinitionId(String processDefinitionKey, Integer version, String tenantId)
           
 ProcessDefinitionEntity findProcessDefinitionByDeploymentAndKey(String deploymentId, String processDefinitionKey)
           
 ProcessDefinitionEntity findProcessDefinitionByKeyVersionAndTenantId(String processDefinitionKey, Integer processDefinitionVersion, String tenantId)
           
 long findProcessDefinitionCountByQueryCriteria(ProcessDefinitionQueryImpl processDefinitionQuery)
           
 List<ProcessDefinition> findProcessDefinitionsByDeploymentId(String deploymentId)
           
 List<ProcessDefinition> findProcessDefinitionsByKey(String processDefinitionKey)
           
 List<ProcessDefinition> findProcessDefinitionsByKeyIn(String... keys)
           
 List<ProcessDefinition> findProcessDefinitionsByQueryCriteria(ProcessDefinitionQueryImpl processDefinitionQuery, Page page)
           
 List<ProcessDefinition> findProcessDefinitionsStartableByUser(String user)
           
 ProcessDefinitionEntity getCachedResourceDefinitionEntity(String definitionId)
           
 void insertProcessDefinition(ProcessDefinitionEntity processDefinition)
           
 void updateProcessDefinitionSuspensionStateById(String processDefinitionId, SuspensionState suspensionState)
           
 void updateProcessDefinitionSuspensionStateByKey(String processDefinitionKey, SuspensionState suspensionState)
           
 void updateProcessDefinitionSuspensionStateByKeyAndTenantId(String processDefinitionKey, String tenantId, SuspensionState suspensionState)
           
 
Methods inherited from class org.camunda.bpm.engine.impl.persistence.AbstractManager
checkAuthorization, close, configureQuery, delete, deleteAuthorizations, deleteAuthorizationsForGroup, deleteAuthorizationsForUser, deleteDefaultAuthorizations, flush, getAttachmentManager, getAuthorizationManager, getBatchManager, getByteArrayManager, getCaseDefinitionManager, getCaseExecutionManager, getCaseInstanceManager, getCommandContext, getCurrentAuthentication, getDbEntityManager, getDbSqlSession, getDecisionDefinitionManager, getDecisionRequirementsDefinitionManager, getDeploymentManager, getEventSubscriptionManager, getHistoricActivityInstanceManager, getHistoricBatchManager, getHistoricCaseActivityInstanceManager, getHistoricCaseInstanceManager, getHistoricDecisionInstanceManager, getHistoricDetailManager, getHistoricExternalTaskLogManager, getHistoricIdentityLinkManager, getHistoricIncidentManager, getHistoricJobLogManager, getHistoricProcessInstanceManager, getHistoricReportManager, getHistoricTaskInstanceManager, getHistoricVariableInstanceManager, getIdentityInfoManager, getIdentityLinkManager, getJobDefinitionManager, getJobManager, getProcessDefinitionManager, getProcessInstanceManager, getResourceAuthorizationProvider, getResourceManager, getSession, getTaskManager, getTaskReportManager, getTenantManager, getUserOperationLogManager, getVariableInstanceManager, insert, isAuthorizationEnabled, saveDefaultAuthorizations
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final EnginePersistenceLogger LOG
Constructor Detail

ProcessDefinitionManager

public ProcessDefinitionManager()
Method Detail

insertProcessDefinition

public void insertProcessDefinition(ProcessDefinitionEntity processDefinition)

findLatestProcessDefinitionByKey

public ProcessDefinitionEntity findLatestProcessDefinitionByKey(String processDefinitionKey)
Returns:
the latest version of the process definition with the given key (from any tenant)
Throws:
ProcessEngineException - if more than one tenant has a process definition with the given key
See Also:
findLatestProcessDefinitionByKeyAndTenantId(String, String)

findLatestProcessDefinitionByKeyAndTenantId

public ProcessDefinitionEntity findLatestProcessDefinitionByKeyAndTenantId(String processDefinitionKey,
                                                                           String tenantId)
Returns:
the latest version of the process definition with the given key and tenant id
See Also:
findLatestProcessDefinitionByKeyAndTenantId(String, String)

findLatestProcessDefinitionById

public ProcessDefinitionEntity findLatestProcessDefinitionById(String processDefinitionId)

findProcessDefinitionsByQueryCriteria

public List<ProcessDefinition> findProcessDefinitionsByQueryCriteria(ProcessDefinitionQueryImpl processDefinitionQuery,
                                                                     Page page)

findProcessDefinitionCountByQueryCriteria

public long findProcessDefinitionCountByQueryCriteria(ProcessDefinitionQueryImpl processDefinitionQuery)

findProcessDefinitionByDeploymentAndKey

public ProcessDefinitionEntity findProcessDefinitionByDeploymentAndKey(String deploymentId,
                                                                       String processDefinitionKey)

findProcessDefinitionByKeyVersionAndTenantId

public ProcessDefinitionEntity findProcessDefinitionByKeyVersionAndTenantId(String processDefinitionKey,
                                                                            Integer processDefinitionVersion,
                                                                            String tenantId)

findProcessDefinitionsByKey

public List<ProcessDefinition> findProcessDefinitionsByKey(String processDefinitionKey)

findProcessDefinitionsStartableByUser

public List<ProcessDefinition> findProcessDefinitionsStartableByUser(String user)

findPreviousProcessDefinitionId

public String findPreviousProcessDefinitionId(String processDefinitionKey,
                                              Integer version,
                                              String tenantId)

findProcessDefinitionsByDeploymentId

public List<ProcessDefinition> findProcessDefinitionsByDeploymentId(String deploymentId)

findProcessDefinitionsByKeyIn

public List<ProcessDefinition> findProcessDefinitionsByKeyIn(String... keys)

findDefinitionsByKeyAndTenantId

public List<ProcessDefinition> findDefinitionsByKeyAndTenantId(String processDefinitionKey,
                                                               String tenantId,
                                                               boolean isTenantIdSet)

findDefinitionsByIds

public List<ProcessDefinition> findDefinitionsByIds(List<String> processDefinitionIds)

updateProcessDefinitionSuspensionStateById

public void updateProcessDefinitionSuspensionStateById(String processDefinitionId,
                                                       SuspensionState suspensionState)

updateProcessDefinitionSuspensionStateByKey

public void updateProcessDefinitionSuspensionStateByKey(String processDefinitionKey,
                                                        SuspensionState suspensionState)

updateProcessDefinitionSuspensionStateByKeyAndTenantId

public void updateProcessDefinitionSuspensionStateByKeyAndTenantId(String processDefinitionKey,
                                                                   String tenantId,
                                                                   SuspensionState suspensionState)

cascadeDeleteProcessInstancesForProcessDefinition

protected void cascadeDeleteProcessInstancesForProcessDefinition(String processDefinitionId,
                                                                 boolean skipCustomListeners)
Cascades the deletion of the process definition to the process instances. Skips the custom listeners if the flag was set to true.

Parameters:
processDefinitionId - the process definition id
skipCustomListeners - true if the custom listeners should be skipped at process instance deletion

cascadeDeleteHistoryForProcessDefinition

protected void cascadeDeleteHistoryForProcessDefinition(String processDefinitionId)
Cascades the deletion of a process definition to the history, deletes the history.

Parameters:
processDefinitionId - the process definition id

deleteTimerStartEventsForProcessDefinition

protected void deleteTimerStartEventsForProcessDefinition(ProcessDefinition processDefinition)
Deletes the timer start events for the given process definition.

Parameters:
processDefinition - the process definition

deleteSubscriptionsForProcessDefinition

public void deleteSubscriptionsForProcessDefinition(String processDefinitionId)
Deletes the subscriptions for the process definition, which is identified by the given process definition id.

Parameters:
processDefinitionId - the id of the process definition

deleteProcessDefinition

public void deleteProcessDefinition(ProcessDefinition processDefinition,
                                    String processDefinitionId,
                                    boolean cascadeToHistory,
                                    boolean cascadeToInstances,
                                    boolean skipCustomListeners)
Deletes the given process definition from the database and cache. If cascadeToHistory and cascadeToInstances is set to true it deletes the history and the process instances. *Note*: If more than one process definition, from one deployment, is deleted in a single transaction and the cascadeToHistory and cascadeToInstances flag was set to true it can cause a dirty deployment cache. The process instances of ALL process definitions must be deleted, before every process definition can be deleted! In such cases the cascadeToInstances flag have to set to false! On deletion of all process instances, the task listeners will be deleted as well. Deletion of tasks and listeners needs the redeployment of deployments. It can cause to problems if is done sequential with the deletion of process definition in a single transaction. *For example*: Deployment contains two process definition. First process definition and instances will be removed, also cleared from the cache. Second process definition will be removed and his instances. Deletion of instances will cause redeployment this deploys again first into the cache. Only the second will be removed from cache and first remains in the cache after the deletion process.

Parameters:
processDefinition - the process definition which should be deleted
processDefinitionId - the id of the process definition
cascadeToHistory - if true the history will deleted as well
cascadeToInstances - if true the process instances are deleted as well
skipCustomListeners - if true skips the custom listeners on deletion of instances

createDefaultAuthorizations

protected void createDefaultAuthorizations(ProcessDefinition processDefinition)

configureProcessDefinitionQuery

protected void configureProcessDefinitionQuery(ProcessDefinitionQueryImpl query)

configureParameterizedQuery

protected ListQueryParameterObject configureParameterizedQuery(Object parameter)

findLatestDefinitionByKey

public ProcessDefinitionEntity findLatestDefinitionByKey(String key)
Specified by:
findLatestDefinitionByKey in interface AbstractResourceDefinitionManager<ProcessDefinitionEntity>

findLatestDefinitionById

public ProcessDefinitionEntity findLatestDefinitionById(String id)
Specified by:
findLatestDefinitionById in interface AbstractResourceDefinitionManager<ProcessDefinitionEntity>

getCachedResourceDefinitionEntity

public ProcessDefinitionEntity getCachedResourceDefinitionEntity(String definitionId)
Specified by:
getCachedResourceDefinitionEntity in interface AbstractResourceDefinitionManager<ProcessDefinitionEntity>

findLatestDefinitionByKeyAndTenantId

public ProcessDefinitionEntity findLatestDefinitionByKeyAndTenantId(String definitionKey,
                                                                    String tenantId)
Specified by:
findLatestDefinitionByKeyAndTenantId in interface AbstractResourceDefinitionManager<ProcessDefinitionEntity>

findDefinitionByKeyVersionAndTenantId

public ProcessDefinitionEntity findDefinitionByKeyVersionAndTenantId(String definitionKey,
                                                                     Integer definitionVersion,
                                                                     String tenantId)
Specified by:
findDefinitionByKeyVersionAndTenantId in interface AbstractResourceDefinitionManager<ProcessDefinitionEntity>

findDefinitionByDeploymentAndKey

public ProcessDefinitionEntity findDefinitionByDeploymentAndKey(String deploymentId,
                                                                String definitionKey)
Specified by:
findDefinitionByDeploymentAndKey in interface AbstractResourceDefinitionManager<ProcessDefinitionEntity>


Copyright © 2017 camunda services GmbH. All rights reserved.