Class AEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>

    • Field Detail

      • LOG

        protected static final org.slf4j.Logger LOG
        Logger
      • formcycleVersion

        protected final com.vdurmont.semver4j.Semver formcycleVersion
      • entity

        protected T extends de.xima.cmn.dao.interfaces.IEntity<Long> entity
        The entity to be imported.
      • persisted

        protected T extends de.xima.cmn.dao.interfaces.IEntity<Long> persisted
        The existing entity. If the entity to be imported already exists, based on the UUID, this property holds the already existing entity.
      • persistedName

        protected String persistedName
        Name of the existing entity.
      • unresolvedDependencies

        protected final Map<de.xima.cmn.dao.interfaces.IEntity<Long>,​List<IEntityDependency>> unresolvedDependencies
        Dependencies of the entity, referenced by UUID, to be resolved.
      • importJson

        protected String importJson
        The serialized representation of the import.
      • originalID

        protected Long originalID
        ID of the entity to be imported.
      • originalUUID

        protected UUID originalUUID
        UUID of the entity to be imported.
      • originalName

        protected String originalName
        Name of the entity to be imported.
      • alternative

        protected Object alternative
        Alternative of the entity to be imported. If an alternative is selected, the entity to be imported is skipped.
      • conflictResolveAction

        protected EEntityConflictResolveAction conflictResolveAction
        Behavior of resolving a conflict. A conflict arises, if the entity to be imported already exists, based on UUID.
    • Method Detail

      • getEntity

        public T getEntity()
        Specified by:
        getEntity in interface IEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
        Returns:
        The entity that should be imported
      • setEntity

        @Deprecated
        public void setEntity​(T entity)
        Deprecated.
        Specified by:
        setEntity in interface IEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
        Parameters:
        entity - The entity that should be imported
      • getPersisted

        public T getPersisted()
        Specified by:
        getPersisted in interface IEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
        Returns:
        The persisted entity that may be overridden
      • setPersisted

        public void setPersisted​(T persisted)
        Specified by:
        setPersisted in interface IEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
        Parameters:
        persisted - The persisted entity that may be overridden
      • getUnresolvedDependencies

        public Map<de.xima.cmn.dao.interfaces.IEntity<Long>,​List<IEntityDependency>> getUnresolvedDependencies()
        Specified by:
        getUnresolvedDependencies in interface IEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
        Returns:
        a map of all the entities of this import config that have unresolved dependencies. This includes not only entity dependencies of this import config entity but also dependencies of its children, e.g.: a ProjectImportConfig might have unresolved dependencies for one of its WorkflowStates.
      • isEntityExists

        public boolean isEntityExists()
        Specified by:
        isEntityExists in interface IEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
        Returns:
        true if the given entity already exists (based on UUID and its context)
      • isImported

        public boolean isImported()
        Specified by:
        isImported in interface IEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
        Returns:
        Whether the entity has been imported yet
      • setImported

        @Deprecated
        public void setImported​(boolean imported)
        Deprecated.
        Description copied from interface: IEntityImportConfig
        Sets whether the entity has been imported.
        Specified by:
        setImported in interface IEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
        Parameters:
        imported - Whether the entity has been imported.
      • getOriginal

        public Object getOriginal()
        Description copied from interface: IEntityImportConfig
        Gets the reference to the original object referenced in the import file. The exact type of the object depends on the type of import config. For example, for client form theme import configs, this might be the FormThemeReference of a plugin form theme.
        Specified by:
        getOriginal in interface IEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
        Returns:
        original A reference to the original object referenced in the import file.
      • setOriginal

        public void setOriginal​(Object original)
        Specified by:
        setOriginal in interface IEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
        Parameters:
        original - A reference to the original object referenced in the import file.
      • getOriginalName

        public String getOriginalName()
        Specified by:
        getOriginalName in interface IEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
        Returns:
        original name of the entity before import (and possible name change)
      • getEntityToOverride

        @Deprecated
        public de.xima.cmn.dao.interfaces.IEntity<Long> getEntityToOverride()
        Deprecated.
        Specified by:
        getEntityToOverride in interface IEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
        Returns:
        IEntity that should be overridden instead of the persisted
      • setEntityToOverride

        @Deprecated
        public void setEntityToOverride​(de.xima.cmn.dao.interfaces.IEntity<Long> entityToOverride)
        Deprecated.
        Specified by:
        setEntityToOverride in interface IEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
        Parameters:
        entityToOverride - IEntity that should be overridden instead of the persisted
      • setAlternative

        public void setAlternative​(Object alternative)
        Description copied from interface: IEntityImportConfig
        Sets a reference to the alternative that should be used instead of the entity represented by this import config. The type of object depends on the entity type of this import config. IEntityImportConfig.loadAlternative(IEntityContext) must be able to use this object to load the alternative. Often, this will be a Long, representing the ID of an existing entity to use instead.
        Specified by:
        setAlternative in interface IEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
        Parameters:
        alternative - An object referencing the alternative to use.
      • loadAlternative

        public Object loadAlternative​(IEntityContext ec)
        Description copied from interface: IEntityImportConfig
        Loads the alternative that should be used instead of the entity represented by this import config. The alternative must have been set via IEntityImportConfig.setAlternative(Object) before. If it was not set, this method should return null.
        Specified by:
        loadAlternative in interface IEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
        Parameters:
        ec - The entity context to use for accessing the database.
        Returns:
        Alternative that should be used instead. Often, this will be an IEntity with the same type as the entity represented by this import config.
      • getDao

        protected abstract IGenericDao<T> getDao()
        Returns the data access object of the entity to be imported.
        Returns:
        data access object
      • isUuidExisting

        protected boolean isUuidExisting​(IEntityContext ec)
      • makeEntityUnique

        protected abstract void makeEntityUnique​(IEntityContext ec)
                                          throws Exception
        Makes the entity to be imported unique with respect to database constraints. If the name is unique, this method should make the entity's name unique.
        Parameters:
        ec - entity context
        Throws:
        Exception - if an error occurs
      • postCreate

        protected void postCreate​(IEntityContext ec)
                           throws Exception
        Is called after creating the entity to be imported.
        Parameters:
        ec - entity context
        Throws:
        Exception - if an error occurs
      • postUpdate

        protected void postUpdate​(IEntityContext ec)
                           throws Exception
        Is called after overriding the entity to be imported. If the existing entity is overridden, it is being updated.
        Parameters:
        ec - entity context
        Throws:
        Exception - if an error occurs
      • preCreate

        protected void preCreate​(IEntityContext ec)
                          throws Exception
        Is called before the entity to be imported is created.
        Parameters:
        ec - entity context
        Throws:
        Exception - if an error occurs
      • preUpdate

        protected void preUpdate​(IEntityContext ec)
                          throws Exception
        Is called before the entity to be imported is overridden.
        Parameters:
        ec - entity context
        Throws:
        Exception - if an error occurs
      • getUuidEntityValue

        protected static String getUuidEntityValue​(com.google.gson.JsonObject authConfig,
                                                   String key)