Package org.operaton.bpm.engine.impl
Class AbstractDefinitionDeployer<DEFINITION_ENTITY extends ResourceDefinitionEntity>
java.lang.Object
org.operaton.bpm.engine.impl.AbstractDefinitionDeployer<DEFINITION_ENTITY>
- All Implemented Interfaces:
Deployer
- Direct Known Subclasses:
BpmnDeployer,CmmnDeployer,DecisionDefinitionDeployer,DecisionRequirementsDefinitionDeployer,OperatonFormDefinitionDeployer
public abstract class AbstractDefinitionDeployer<DEFINITION_ENTITY extends ResourceDefinitionEntity>
extends Object
implements Deployer
Deployer responsible to parse resource files and create the proper entities.
This class is extended by specific resource deployers.
Note: Implementations must be thread-safe. In particular they should not keep deployment-specific state.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidaddDefinitionToDeploymentCache(DeploymentCache deploymentCache, DEFINITION_ENTITY definition) Add a definition to the deployment cacheprotected voiddefinitionAddedToDeploymentCache(DeploymentEntity deployment, DEFINITION_ENTITY definition, Properties properties) Called after a definition was added to the deployment cache.voiddeploy(DeploymentEntity deployment) protected voidensureNoDuplicateDefinitionKeys(List<DEFINITION_ENTITY> definitions) protected abstract DEFINITION_ENTITYfindDefinitionByDeploymentAndKey(String deploymentId, String definitionKey) Find a definition entity by deployment id and definition key.protected abstract DEFINITION_ENTITYfindLatestDefinitionByKeyAndTenantId(String definitionKey, String tenantId) Find the last deployed definition entity by definition key and tenant id.protected StringgenerateDefinitionId(DeploymentEntity deployment, DEFINITION_ENTITY newDefinition, DEFINITION_ENTITY latestDefinition) create an id for the definition.protected CommandContextprotected StringgetDefinitionDiagramResourceName(String resourceName, DEFINITION_ENTITY definition, String diagramSuffix) protected DeploymentCacheprotected StringgetDiagramResourceForDefinition(DeploymentEntity deployment, String resourceName, DEFINITION_ENTITY definition, Map<String, ResourceEntity> resources) Returns the default name of the image resource for a certain definition.protected String[]protected StringgetGeneralDiagramResourceName(String resourceName, DEFINITION_ENTITY definition, String diagramSuffix) protected intgetNextVersion(DeploymentEntity deployment, DEFINITION_ENTITY newDefinition, DEFINITION_ENTITY latestDefinition) per default we increment the latest definition version by one - but you might want to hook in some own logic here, e.g. to align definition versions with deployment / build versions.protected ProcessEngineConfigurationImplprotected abstract String[]protected voidhandlePersistedDefinition(DEFINITION_ENTITY definition, DEFINITION_ENTITY persistedDefinition, DeploymentEntity deployment, Properties properties) protected booleanisResourceHandled(ResourceEntity resource) protected voidloadDefinitions(DeploymentEntity deployment, List<DEFINITION_ENTITY> definitions, Properties properties) protected List<DEFINITION_ENTITY> parseDefinitionResources(DeploymentEntity deployment, Properties properties) protected abstract voidpersistDefinition(DEFINITION_ENTITY definition) Persist definition entity into the database.protected voidpersistDefinitions(DeploymentEntity deployment, List<DEFINITION_ENTITY> definitions, Properties properties) protected voidpersistedDefinitionLoaded(DeploymentEntity deployment, DEFINITION_ENTITY definition, DEFINITION_ENTITY persistedDefinition) Called when a previous version of a definition was loaded from the persistent store.protected voidpostProcessDefinitions(DeploymentEntity deployment, List<DEFINITION_ENTITY> definitions, Properties properties) protected voidregisterDefinition(DeploymentEntity deployment, DEFINITION_ENTITY definition, Properties properties) voidsetIdGenerator(IdGenerator idGenerator) protected StringstripDefinitionFileSuffix(String resourceName) protected abstract List<DEFINITION_ENTITY> transformDefinitions(DeploymentEntity deployment, ResourceEntity resource, Properties properties) Transform the resource entity into definition entities.protected Collection<DEFINITION_ENTITY> transformResource(DeploymentEntity deployment, ResourceEntity resource, Properties properties) protected voidupdateDefinitionByLatestDefinition(DeploymentEntity deployment, DEFINITION_ENTITY definition, DEFINITION_ENTITY latestDefinition) protected voidupdateDefinitionByPersistedDefinition(DeploymentEntity deployment, DEFINITION_ENTITY definition, DEFINITION_ENTITY persistedDefinition)
-
Field Details
-
DIAGRAM_SUFFIXES
-
idGenerator
-
-
Constructor Details
-
AbstractDefinitionDeployer
public AbstractDefinitionDeployer()
-
-
Method Details
-
getIdGenerator
-
setIdGenerator
-
deploy
-
parseDefinitionResources
protected List<DEFINITION_ENTITY> parseDefinitionResources(DeploymentEntity deployment, Properties properties) -
isResourceHandled
-
getResourcesSuffixes
- Returns:
- the list of resource suffixes for this cacheDeployer
-
transformResource
protected Collection<DEFINITION_ENTITY> transformResource(DeploymentEntity deployment, ResourceEntity resource, Properties properties) -
transformDefinitions
protected abstract List<DEFINITION_ENTITY> transformDefinitions(DeploymentEntity deployment, ResourceEntity resource, Properties properties) Transform the resource entity into definition entities.- Parameters:
deployment- the deployment the resources belongs toresource- the resource to transform- Returns:
- a list of transformed definition entities
-
getDiagramResourceForDefinition
protected String getDiagramResourceForDefinition(DeploymentEntity deployment, String resourceName, DEFINITION_ENTITY definition, Map<String, ResourceEntity> resources) Returns the default name of the image resource for a certain definition. It will first look for an image resource which matches the definition specifically, before resorting to an image resource which matches the file containing the definition. Example: if the deployment contains a BPMN 2.0 xml resource called 'abc.bpmn20.xml' containing only one process with key 'myProcess', then this method will look for an image resources called 'abc.myProcess.png' (or .jpg, or .gif, etc.) or 'abc.png' if the previous one wasn't found. Example 2: if the deployment contains a BPMN 2.0 xml resource called 'abc.bpmn20.xml' containing three processes (with keys a, b and c), then this method will first look for an image resource called 'abc.a.png' before looking for 'abc.png' (likewise for b and c). Note that if abc.a.png, abc.b.png and abc.c.png don't exist, all processes will have the same image: abc.png.- Returns:
- null if no matching image resource is found.
-
getDefinitionDiagramResourceName
protected String getDefinitionDiagramResourceName(String resourceName, DEFINITION_ENTITY definition, String diagramSuffix) -
getGeneralDiagramResourceName
protected String getGeneralDiagramResourceName(String resourceName, DEFINITION_ENTITY definition, String diagramSuffix) -
stripDefinitionFileSuffix
-
getDiagramSuffixes
-
ensureNoDuplicateDefinitionKeys
-
postProcessDefinitions
protected void postProcessDefinitions(DeploymentEntity deployment, List<DEFINITION_ENTITY> definitions, Properties properties) -
persistDefinitions
protected void persistDefinitions(DeploymentEntity deployment, List<DEFINITION_ENTITY> definitions, Properties properties) -
updateDefinitionByLatestDefinition
protected void updateDefinitionByLatestDefinition(DeploymentEntity deployment, DEFINITION_ENTITY definition, DEFINITION_ENTITY latestDefinition) -
loadDefinitions
protected void loadDefinitions(DeploymentEntity deployment, List<DEFINITION_ENTITY> definitions, Properties properties) -
handlePersistedDefinition
protected void handlePersistedDefinition(DEFINITION_ENTITY definition, DEFINITION_ENTITY persistedDefinition, DeploymentEntity deployment, Properties properties) -
updateDefinitionByPersistedDefinition
protected void updateDefinitionByPersistedDefinition(DeploymentEntity deployment, DEFINITION_ENTITY definition, DEFINITION_ENTITY persistedDefinition) -
persistedDefinitionLoaded
protected void persistedDefinitionLoaded(DeploymentEntity deployment, DEFINITION_ENTITY definition, DEFINITION_ENTITY persistedDefinition) Called when a previous version of a definition was loaded from the persistent store.- Parameters:
deployment- the deployment of the definitiondefinition- the definition entitypersistedDefinition- the loaded definition entity
-
findDefinitionByDeploymentAndKey
protected abstract DEFINITION_ENTITY findDefinitionByDeploymentAndKey(String deploymentId, String definitionKey) Find a definition entity by deployment id and definition key.- Parameters:
deploymentId- the deployment iddefinitionKey- the definition key- Returns:
- the corresponding definition entity or null if non is found
-
findLatestDefinitionByKeyAndTenantId
protected abstract DEFINITION_ENTITY findLatestDefinitionByKeyAndTenantId(String definitionKey, String tenantId) Find the last deployed definition entity by definition key and tenant id.- Returns:
- the corresponding definition entity or null if non is found
-
persistDefinition
Persist definition entity into the database.- Parameters:
definition- the definition entity
-
registerDefinition
protected void registerDefinition(DeploymentEntity deployment, DEFINITION_ENTITY definition, Properties properties) -
addDefinitionToDeploymentCache
protected abstract void addDefinitionToDeploymentCache(DeploymentCache deploymentCache, DEFINITION_ENTITY definition) Add a definition to the deployment cache- Parameters:
deploymentCache- the deployment cachedefinition- the definition to add
-
definitionAddedToDeploymentCache
protected void definitionAddedToDeploymentCache(DeploymentEntity deployment, DEFINITION_ENTITY definition, Properties properties) Called after a definition was added to the deployment cache.- Parameters:
deployment- the deployment of the definitiondefinition- the definition entity
-
getNextVersion
protected int getNextVersion(DeploymentEntity deployment, DEFINITION_ENTITY newDefinition, DEFINITION_ENTITY latestDefinition) per default we increment the latest definition version by one - but you might want to hook in some own logic here, e.g. to align definition versions with deployment / build versions. -
generateDefinitionId
protected String generateDefinitionId(DeploymentEntity deployment, DEFINITION_ENTITY newDefinition, DEFINITION_ENTITY latestDefinition) create an id for the definition. The default is to ask theIdGeneratorand add the definition key and version if that does not exceed 64 characters. You might want to hook in your own implementation here. -
getProcessEngineConfiguration
-
getCommandContext
-
getDeploymentCache
-