Class AbstractDefinitionDeployer<DefinitionEntity extends ResourceDefinitionEntity>

    • Field Detail

      • DIAGRAM_SUFFIXES

        public static final java.lang.String[] DIAGRAM_SUFFIXES
    • Constructor Detail

      • AbstractDefinitionDeployer

        public AbstractDefinitionDeployer()
    • Method Detail

      • setIdGenerator

        public void setIdGenerator​(IdGenerator idGenerator)
      • isResourceHandled

        protected boolean isResourceHandled​(ResourceEntity resource)
      • getResourcesSuffixes

        protected abstract java.lang.String[] getResourcesSuffixes()
        Returns:
        the list of resource suffixes for this cacheDeployer
      • transformDefinitions

        protected abstract java.util.List<DefinitionEntity> transformDefinitions​(DeploymentEntity deployment,
                                                                                 ResourceEntity resource,
                                                                                 Properties properties)
        Transform the resource entity into definition entities.
        Parameters:
        deployment - the deployment the resources belongs to
        resource - the resource to transform
        Returns:
        a list of transformed definition entities
      • getDiagramResourceForDefinition

        protected java.lang.String getDiagramResourceForDefinition​(DeploymentEntity deployment,
                                                                   java.lang.String resourceName,
                                                                   DefinitionEntity definition,
                                                                   java.util.Map<java.lang.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 java.lang.String getDefinitionDiagramResourceName​(java.lang.String resourceName,
                                                                    DefinitionEntity definition,
                                                                    java.lang.String diagramSuffix)
      • getGeneralDiagramResourceName

        protected java.lang.String getGeneralDiagramResourceName​(java.lang.String resourceName,
                                                                 DefinitionEntity definition,
                                                                 java.lang.String diagramSuffix)
      • stripDefinitionFileSuffix

        protected java.lang.String stripDefinitionFileSuffix​(java.lang.String resourceName)
      • getDiagramSuffixes

        protected java.lang.String[] getDiagramSuffixes()
      • ensureNoDuplicateDefinitionKeys

        protected void ensureNoDuplicateDefinitionKeys​(java.util.List<DefinitionEntity> definitions)
      • persistedDefinitionLoaded

        protected void persistedDefinitionLoaded​(DeploymentEntity deployment,
                                                 DefinitionEntity definition,
                                                 DefinitionEntity persistedDefinition)
        Called when a previous version of a definition was loaded from the persistent store.
        Parameters:
        deployment - the deployment of the definition
        definition - the definition entity
        persistedDefinition - the loaded definition entity
      • findDefinitionByDeploymentAndKey

        protected abstract DefinitionEntity findDefinitionByDeploymentAndKey​(java.lang.String deploymentId,
                                                                             java.lang.String definitionKey)
        Find a definition entity by deployment id and definition key.
        Parameters:
        deploymentId - the deployment id
        definitionKey - the definition key
        Returns:
        the corresponding definition entity or null if non is found
      • findLatestDefinitionByKeyAndTenantId

        protected abstract DefinitionEntity findLatestDefinitionByKeyAndTenantId​(java.lang.String definitionKey,
                                                                                 java.lang.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

        protected abstract void persistDefinition​(DefinitionEntity definition)
        Persist definition entity into the database.
        Parameters:
        definition - the definition entity
      • addDefinitionToDeploymentCache

        protected abstract void addDefinitionToDeploymentCache​(DeploymentCache deploymentCache,
                                                               DefinitionEntity definition)
        Add a definition to the deployment cache
        Parameters:
        deploymentCache - the deployment cache
        definition - the definition to add
      • definitionAddedToDeploymentCache

        protected void definitionAddedToDeploymentCache​(DeploymentEntity deployment,
                                                        DefinitionEntity definition,
                                                        Properties properties)
        Called after a definition was added to the deployment cache.
        Parameters:
        deployment - the deployment of the definition
        definition - the definition entity
      • getNextVersion

        protected int getNextVersion​(DeploymentEntity deployment,
                                     DefinitionEntity newDefinition,
                                     DefinitionEntity 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 java.lang.String generateDefinitionId​(DeploymentEntity deployment,
                                                        DefinitionEntity newDefinition,
                                                        DefinitionEntity latestDefinition)
        create an id for the definition. The default is to ask the IdGenerator and add the definition key and version if that does not exceed 64 characters. You might want to hook in your own implementation here.