Package de.xima.fc.importer.interfaces
Interface IEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
-
- Type Parameters:
T
- Type of entity to import.
- All Superinterfaces:
Comparable<IEntityImportConfig<?>>
,Serializable
- All Known Implementing Classes:
ActionImportConfig
,AEntityImportConfig
,AppointmentTemplateImportConfig
,ClientCounterImportConfig
,ClientFormThemeImportConfig
,ClientResourceImportConfig
,DataSourceImportConfig
,EntityImportConfig
,FormVersionImportConfig
,InboxImportConfig
,ProjectDoiDataImportConfig
,ProjectIdentityCheckDataImportConfig
,ProjectImportConfig
,ProjectInviteDataImportConfig
,ProjectPortalDataImportConfig
,ProjectResourceImportConfig
,StateImportConfig
,TemplateImportConfig
,UserGroupImportConfig
public interface IEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>> extends Serializable, Comparable<IEntityImportConfig<?>>
Interface for entity import configurations- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default int
compareTo(IEntityImportConfig<?> o)
List<DependencyDescriptor>
finalize(IEntityContext ec, String fcVersion, String exportVersion)
Finish the import.List<IEntityImportConfig<?>>
getAllChildrenFlat()
List<IEntityImportConfig<?>>
getChildren()
EEntityConflictResolveAction
getConflictResolveAction()
default List<IEntityDependency>
getDependencies()
Deprecated.UsegetUnresolvedDependencies()
instead.T
getEntity()
Class<?>
getEntityClass()
de.xima.cmn.dao.interfaces.IEntity<Long>
getEntityToOverride()
Deprecated.String
getImportJson()
Deprecated.Object
getOriginal()
Gets the reference to the original object referenced in the import file.Long
getOriginalExportId()
Long
getOriginalID()
String
getOriginalName()
UUID
getOriginalUUID()
T
getPersisted()
Map<de.xima.cmn.dao.interfaces.IEntity<Long>,List<IEntityDependency>>
getUnresolvedDependencies()
boolean
isEntityExists()
boolean
isImported()
default boolean
isRelevantForImport()
Whether importing this entity is actually relevant.Object
loadAlternative(IEntityContext ec)
Loads the alternative that should be used instead of the entity represented by this import config.void
resolveDependencies(IEntityContext ec)
Deprecated.void
setAlternative(Object alternative)
Sets a reference to the alternative that should be used instead of the entity represented by this import config.default void
setAlternativeId(Long alternativeId)
Deprecated.UsesetAlternative(Object)
instead.void
setConflictResolveAction(EEntityConflictResolveAction conflictResolveAction)
void
setEntity(T entity)
void
setEntityToOverride(de.xima.cmn.dao.interfaces.IEntity<Long> entityToOverride)
Deprecated.void
setImported(boolean imported)
Deprecated.void
setOriginal(Object original)
void
setPersisted(T entity)
void
stage(IEntityContext ec)
Stages the import for execution based on the given configurationvoid
updatePersisted(IEntityContext ec)
Updates the persisted entity if existing based on the entity represented by this config
-
-
-
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.
-
getConflictResolveAction
EEntityConflictResolveAction getConflictResolveAction()
- Returns:
EEntityConflictResolveAction
specifying what to do if the entity already exists
-
setConflictResolveAction
void setConflictResolveAction(EEntityConflictResolveAction conflictResolveAction)
- Parameters:
conflictResolveAction
-EEntityConflictResolveAction
specifying what to do if the entity already exists
-
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 noIUUIDEntity
-
getOriginalExportId
Long getOriginalExportId()
- Returns:
- The original ID of the entity from the export file. Note that
getOriginalID()
may benull
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 theFormThemeReference
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.
-
getChildren
List<IEntityImportConfig<?>> getChildren()
- Returns:
- all child importConfigs
-
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 aLong
, representing theID
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 viasetAlternative(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.
-
stage
void stage(IEntityContext ec) throws Exception
Stages the import for execution based on the given configuration- Parameters:
ec
-IEntityContext
to be used- Throws:
Exception
- When the entity could not be staged.
-
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 usedfcVersion
- 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
ofDependencyDescriptor
s 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.
-
compareTo
default int compareTo(IEntityImportConfig<?> o)
- Specified by:
compareTo
in interfaceComparable<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
-
getDependencies
@Deprecated default List<IEntityDependency> getDependencies()
Deprecated.UsegetUnresolvedDependencies()
instead.- Returns:
List
of all the dependencies to this entity
-
resolveDependencies
@Deprecated void resolveDependencies(IEntityContext ec)
Deprecated.Resolves the dependencies of this entity- Parameters:
ec
-IEntityContext
to be used
-
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.UsesetAlternative(Object)
instead.- Parameters:
alternativeId
- of an existing entity of typeT
that should be used instead
-
-