Interface IEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>

    • Method Detail

      • getEntity

        T getEntity()
        Returns:
        The entity that should be imported
      • setEntity

        void setEntity​(T entity)
        Parameters:
        entity - The entity that should be imported
      • getPersisted

        T getPersisted()
        Returns:
        The persisted entity that may be overridden
      • setPersisted

        void setPersisted​(T entity)
        Parameters:
        entity - The persisted entity that may be overridden
      • getEntityClass

        Class<?> getEntityClass()
        Returns:
        the class of the entity
      • getUnresolvedDependencies

        Map<de.xima.cmn.dao.interfaces.IEntity<Long>,​List<IEntityDependency>> getUnresolvedDependencies()
        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

        boolean isEntityExists()
        Returns:
        true if the given entity already exists (based on UUID and its context)
      • isImported

        boolean isImported()
        Returns:
        Whether the entity has been imported yet
      • getOriginalID

        Long getOriginalID()
        Returns:
        original ID of the entity
      • getOriginalUUID

        UUID getOriginalUUID()
        Returns:
        original UUID of the entity or null if the entity is no IUUIDEntity
      • getOriginalExportId

        Long getOriginalExportId()
        Returns:
        The original ID of the entity from the export file. Note that getOriginalID() may be null when the IDs are not preserved, this will always be set to the original ID from the export file.
      • getOriginalName

        String getOriginalName()
        Returns:
        original name of the entity before import (and possible name change)
      • getOriginal

        Object getOriginal()
        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.
        Returns:
        original A reference to the original object referenced in the import file.
      • setOriginal

        void setOriginal​(Object original)
        Parameters:
        original - A reference to the original object referenced in the import file.
      • getAllChildrenFlat

        List<IEntityImportConfig<?>> getAllChildrenFlat()
        Returns:
        all child importConfigs. Including the children of children
      • updatePersisted

        void updatePersisted​(IEntityContext ec)
        Updates the persisted entity if existing based on the entity represented by this config
        Parameters:
        ec - IEntityContext to be used for updating the persisted entity
      • setAlternative

        void setAlternative​(Object alternative)
        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. 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.
        Parameters:
        alternative - An object referencing the alternative to use.
      • loadAlternative

        Object loadAlternative​(IEntityContext ec)
        Loads the alternative that should be used instead of the entity represented by this import config. The alternative must have been set via setAlternative(Object) before. If it was not set, this method should return null.
        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.
      • finalize

        List<DependencyDescriptor> finalize​(IEntityContext ec,
                                            String fcVersion,
                                            String exportVersion)
                                     throws Exception
        Finish the import. Should be called after every import config has been staged for import and deprecated fields have been handled.
        Parameters:
        ec - IEntityContext to be used
        fcVersion - The current formcycle version where the entity is imported.
        exportVersion - The formcycle version that was used to create the export file with the entity.
        Returns:
        List of DependencyDescriptors of missing dependencies
        Throws:
        Exception - When the entity import could not be finalized.
      • isRelevantForImport

        default boolean isRelevantForImport()
        Whether importing this entity is actually relevant. When false, this entity should not be suggested to the user and should be skipped. Note that entities may become relevant depending on whether other entities are imported or not.
        Returns:
        Whether the entity wrapped by this import config is relevant for the import.
      • getEntityToOverride

        @Deprecated
        de.xima.cmn.dao.interfaces.IEntity<Long> getEntityToOverride()
        Deprecated.
        Returns:
        IEntity that should be overridden instead of the persisted
      • setEntityToOverride

        @Deprecated
        void setEntityToOverride​(de.xima.cmn.dao.interfaces.IEntity<Long> entityToOverride)
        Deprecated.
        Parameters:
        entityToOverride - IEntity that should be overridden instead of the persisted
      • setImported

        @Deprecated
        void setImported​(boolean imported)
        Deprecated.
        Sets whether the entity has been imported.
        Parameters:
        imported - Whether the entity has been imported.
      • getImportJson

        @Deprecated
        String getImportJson()
        Deprecated.
        Returns:
        the original JSON String of the import entity
      • setAlternativeId

        @Deprecated
        default void setAlternativeId​(Long alternativeId)
        Deprecated.
        Parameters:
        alternativeId - of an existing entity of type T that should be used instead