Class AbstractDefinitionDeployer<DefinitionEntity extends ResourceDefinitionEntity>

    • Field Detail


        public static final 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 String[] getResourcesSuffixes()
        the list of resource suffixes for this cacheDeployer
      • transformDefinitions

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

        protected String getDiagramResourceForDefinition​(DeploymentEntity deployment,
                                                         String resourceName,
                                                         DefinitionEntity 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.
        null if no matching image resource is found.
      • stripDefinitionFileSuffix

        protected String stripDefinitionFileSuffix​(String resourceName)
      • getDiagramSuffixes

        protected String[] getDiagramSuffixes()
      • ensureNoDuplicateDefinitionKeys

        protected void ensureNoDuplicateDefinitionKeys​(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.
        deployment - the deployment of the definition
        definition - the definition entity
        persistedDefinition - the loaded definition entity
      • findDefinitionByDeploymentAndKey

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

        protected abstract DefinitionEntity findLatestDefinitionByKeyAndTenantId​(String definitionKey,
                                                                                 String tenantId)
        Find the last deployed definition entity by definition key and tenant id.
        the corresponding definition entity or null if non is found
      • persistDefinition

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

        protected abstract void addDefinitionToDeploymentCache​(DeploymentCache deploymentCache,
                                                               DefinitionEntity definition)
        Add a definition to the deployment cache
        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.
        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 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.