Package de.xima.fc.importer.config
Class AEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
- java.lang.Object
-
- de.xima.fc.importer.config.AEntityImportConfig<T>
-
- All Implemented Interfaces:
IEntityImportConfig<T>
,Serializable
,Comparable<IEntityImportConfig<?>>
- Direct Known Subclasses:
ActionImportConfig
,AppointmentTemplateImportConfig
,ClientCounterImportConfig
,ClientResourceImportConfig
,DataSourceImportConfig
,EntityImportConfig
,FormVersionImportConfig
,InboxImportConfig
,ProjectDoiDataImportConfig
,ProjectIdentityCheckDataImportConfig
,ProjectImportConfig
,ProjectInviteDataImportConfig
,ProjectResourceImportConfig
,StateImportConfig
,TemplateImportConfig
,UserGroupImportConfig
public abstract class AEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>> extends Object implements IEntityImportConfig<T>
Configuration class for entity imports- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected de.xima.cmn.dao.interfaces.IEntity<Long>
context
protected T
entity
protected String
importJson
protected static org.slf4j.Logger
LOG
protected static String
LOG_PREFIX
protected Long
originalID
protected String
originalName
protected UUID
originalUUID
protected T
persisted
protected String
persistedName
protected Map<de.xima.cmn.dao.interfaces.IEntity<Long>,List<IEntityDependency>>
unresolvedDependencies
-
Constructor Summary
Constructors Constructor Description AEntityImportConfig(IEntityContext ec, de.xima.cmn.dao.interfaces.IEntity<Long> context, T entity, Set<IEntityDependency> dependencies, String importJson)
Deprecated.
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface de.xima.fc.importer.interfaces.IEntityImportConfig
compareTo, getDependencies
-
-
-
-
Field Detail
-
LOG
protected static final org.slf4j.Logger LOG
-
LOG_PREFIX
protected static final String LOG_PREFIX
- See Also:
- Constant Field Values
-
persistedName
protected String persistedName
-
unresolvedDependencies
protected Map<de.xima.cmn.dao.interfaces.IEntity<Long>,List<IEntityDependency>> unresolvedDependencies
-
importJson
protected String importJson
-
originalID
protected Long originalID
-
originalUUID
protected UUID originalUUID
-
originalName
protected String originalName
-
context
protected de.xima.cmn.dao.interfaces.IEntity<Long> context
-
-
Constructor Detail
-
AEntityImportConfig
@Deprecated public AEntityImportConfig(IEntityContext ec, de.xima.cmn.dao.interfaces.IEntity<Long> context, T entity, Set<IEntityDependency> dependencies, String importJson)
Deprecated.
-
-
Method Detail
-
getEntity
public T getEntity()
- Specified by:
getEntity
in interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
- Returns:
IEntityImportConfig
that should be imported
-
getPersisted
public T getPersisted()
- Specified by:
getPersisted
in interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
- Returns:
IEntityImportConfig
persisted entity that may be overridden
-
setPersisted
public void setPersisted(T persisted)
- Specified by:
setPersisted
in interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
-
getEntityClass
public Class<?> getEntityClass()
- Specified by:
getEntityClass
in interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
- Returns:
- the class of the entity
-
getUnresolvedDependencies
public Map<de.xima.cmn.dao.interfaces.IEntity<Long>,List<IEntityDependency>> getUnresolvedDependencies()
- Specified by:
getUnresolvedDependencies
in interfaceIEntityImportConfig<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 configs entity but also dependencies of its children, e.g.: a ProjectImportConfig might have unresolved dependencies for one of its WorkflowStates.
-
getConflictResolveAction
public EEntityConflictResolveAction getConflictResolveAction()
- Specified by:
getConflictResolveAction
in interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
- Returns:
EEntityConflictResolveAction
specifying what to do if the entity already exists
-
setConflictResolveAction
public void setConflictResolveAction(EEntityConflictResolveAction conflictResolveAction)
- Specified by:
setConflictResolveAction
in interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
- Parameters:
conflictResolveAction
-EEntityConflictResolveAction
specifying what to do if the entity already exists
-
isEntityExists
public boolean isEntityExists()
- Specified by:
isEntityExists
in interfaceIEntityImportConfig<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 interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
- Returns:
- whether or not the entity has been imported yet
-
getOriginalID
public Long getOriginalID()
- Specified by:
getOriginalID
in interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
- Returns:
- original ID of the entity
-
getOriginalExportId
public Long getOriginalExportId()
- Specified by:
getOriginalExportId
in interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
- Returns:
- The original ID of the entity from the export file. Note that
IEntityImportConfig.getOriginalID()
may benull
when the IDs are not preserved, this will always be set to the original ID from the export file.
-
getOriginalUUID
public UUID getOriginalUUID()
- Specified by:
getOriginalUUID
in interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
- Returns:
- original UUID of the entity or
null
if the entity is noIUUIDEntity
-
getOriginalName
public String getOriginalName()
- Specified by:
getOriginalName
in interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
- Returns:
- original name of the entity before import (and possible name change)
-
getChildren
public List<IEntityImportConfig<?>> getChildren()
- Specified by:
getChildren
in interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
- Returns:
- all child importConfigs
-
getAllChildrenFlat
public List<IEntityImportConfig<?>> getAllChildrenFlat()
- Specified by:
getAllChildrenFlat
in interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
- Returns:
- all child importConfigs. Including the children of children
-
setAlternativeId
public void setAlternativeId(Long alternativeId)
- Specified by:
setAlternativeId
in interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
- Parameters:
alternativeId
- of an existing entity of typeIEntityImportConfig
that should be used instead
-
loadAlternative
public T loadAlternative(IEntityContext ec)
- Specified by:
loadAlternative
in interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
- Parameters:
ec
-IEntityContext
to use- Returns:
IEntityImportConfig
entity that should be used instead
-
updatePersisted
public void updatePersisted(IEntityContext ec)
Description copied from interface:IEntityImportConfig
Updates the persisted entity if existing based on the entity represented by this config- Specified by:
updatePersisted
in interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
- Parameters:
ec
-IEntityContext
to be used for updating the persisted entity
-
stage
public void stage(IEntityContext ec) throws Exception
Description copied from interface:IEntityImportConfig
Stages the import for execution based on the given configuration- Specified by:
stage
in interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
- Parameters:
ec
-IEntityContext
to be used- Throws:
Exception
-
finalize
public List<DependencyDescriptor> finalize(IEntityContext ec, String fcVersion, String exportVersion) throws Exception
Description copied from interface:IEntityImportConfig
Finish the import. Should be called after every import config has been staged for import and deprecated fields have been handled.- Specified by:
finalize
in interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
- 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
-
isUuidExisting
protected boolean isUuidExisting(IEntityContext ec)
-
getDao
protected abstract IGenericDao<T> getDao()
-
makeEntityUnique
protected abstract void makeEntityUnique(IEntityContext ec) throws Exception
- Throws:
Exception
-
preCreate
protected void preCreate(IEntityContext ec) throws Exception
- Throws:
Exception
-
preUpdate
protected void preUpdate(IEntityContext ec) throws Exception
- Throws:
Exception
-
postCreate
protected void postCreate(IEntityContext ec) throws Exception
- Throws:
Exception
-
postUpdate
protected void postUpdate(IEntityContext ec) throws Exception
- Throws:
Exception
-
validateImport
protected void validateImport(IEntityContext ec) throws Exception
- Throws:
Exception
-
getDependencyUuid
protected static UUID getDependencyUuid(IEntityImportConfig<?> config, String fieldDescriptor)
-
getUuidEntityValue
protected static String getUuidEntityValue(com.google.gson.JsonObject authConfig, String key)
-
findPersisted
protected T findPersisted(IEntityContext ec)
-
resolveDependencies
@Deprecated public void resolveDependencies(IEntityContext ec)
Deprecated.Description copied from interface:IEntityImportConfig
Resolves the dependencies of this entity- Specified by:
resolveDependencies
in interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
- Parameters:
ec
-IEntityContext
to be used
-
setEntity
@Deprecated public void setEntity(T entity)
Deprecated.- Specified by:
setEntity
in interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
- Parameters:
entity
-IEntityImportConfig
that should be imported
-
getEntityToOverride
@Deprecated public de.xima.cmn.dao.interfaces.IEntity<Long> getEntityToOverride()
Deprecated.- Specified by:
getEntityToOverride
in interfaceIEntityImportConfig<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 interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
- Parameters:
entityToOverride
-IEntity
that should be overridden instead of the persisted
-
setImported
@Deprecated public void setImported(boolean imported)
Deprecated.Description copied from interface:IEntityImportConfig
Set totrue
if the entity has been imported- Specified by:
setImported
in interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
-
getImportJson
@Deprecated public String getImportJson()
Deprecated.- Specified by:
getImportJson
in interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
- Returns:
- the original JSON String of the import entity
-
-