Class AEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
java.lang.Object
de.xima.fc.importer.config.AEntityImportConfig<T>
- Type Parameters:
T- Type of entity to import
- All Implemented Interfaces:
IEntityImportConfig<T>, Serializable, Comparable<IEntityImportConfig<?>>
- Direct Known Subclasses:
ActionImportConfig, AppointmentTemplateImportConfig, ClientCounterImportConfig, ClientFormThemeImportConfig, ClientResourceImportConfig, DataSourceImportConfig, EntityImportConfig, FormVersionImportConfig, InboxImportConfig, ProjectDoiDataImportConfig, ProjectIdentityCheckDataImportConfig, ProjectImportConfig, ProjectInviteDataImportConfig, ProjectPortalDataImportConfig, 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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Objectprotected EEntityConflictResolveActionprotected de.xima.cmn.dao.interfaces.IEntity<Long> protected Tprotected final com.vdurmont.semver4j.Semverprotected Stringprotected static final org.slf4j.Loggerprotected static final Stringprotected Longprotected Stringprotected UUIDprotected Tprotected Stringprotected final Map<de.xima.cmn.dao.interfaces.IEntity<Long>, List<IEntityDependency>> -
Constructor Summary
ConstructorsConstructorDescriptionAEntityImportConfig(IEntityContext ec, de.xima.cmn.dao.interfaces.IEntity<Long> context, T entity, Set<IEntityDependency> dependencies, String importJson) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionfinalize(IEntityContext ec, String fcVersion, String exportVersion) Finish the import.protected Tprotected abstract IGenericDao<T> getDao()protected static UUIDgetDependencyUuid(IEntityImportConfig<?> config, String fieldDescriptor) Class<?> de.xima.cmn.dao.interfaces.IEntity<Long> Deprecated.Deprecated.Gets the reference to the original object referenced in the import file.Map<de.xima.cmn.dao.interfaces.IEntity<Long>, List<IEntityDependency>> protected static StringgetUuidEntityValue(com.google.gson.JsonObject authConfig, String key) booleanbooleanprotected booleanLoads the alternative that should be used instead of the entity represented by this import config.protected abstract voidprotected voidprotected voidprotected voidprotected voidvoidDeprecated.voidsetAlternative(Object alternative) Sets a reference to the alternative that should be used instead of the entity represented by this import config.voidsetConflictResolveAction(EEntityConflictResolveAction conflictResolveAction) voidDeprecated.voidsetEntityToOverride(de.xima.cmn.dao.interfaces.IEntity<Long> entityToOverride) Deprecated.voidsetImported(boolean imported) Deprecated.voidsetOriginal(Object original) voidsetPersisted(T persisted) voidstage(IEntityContext ec) Stages the import for execution based on the given configurationtoString()voidUpdates the persisted entity if existing based on the entity represented by this configprotected voidMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface IEntityImportConfig
compareTo, getDependencies, isRelevantForImport, setAlternativeId
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG -
LOG_PREFIX
- See Also:
-
formcycleVersion
protected final com.vdurmont.semver4j.Semver formcycleVersion -
entity
-
persisted
-
persistedName
-
unresolvedDependencies
protected final Map<de.xima.cmn.dao.interfaces.IEntity<Long>, List<IEntityDependency>> unresolvedDependencies -
importJson
-
originalID
-
originalUUID
-
originalName
-
context
-
alternative
-
conflictResolveAction
-
-
Constructor Details
-
AEntityImportConfig
@Deprecated public AEntityImportConfig(IEntityContext ec, de.xima.cmn.dao.interfaces.IEntity<Long> context, T entity, Set<IEntityDependency> dependencies, String importJson) Deprecated.
-
-
Method Details
-
getEntity
- Specified by:
getEntityin interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>- Returns:
- The entity that should be imported
-
setEntity
Deprecated.- Specified by:
setEntityin interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>- Parameters:
entity- The entity that should be imported
-
getPersisted
- Specified by:
getPersistedin interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>- Returns:
- The persisted entity that may be overridden
-
setPersisted
- Specified by:
setPersistedin interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>- Parameters:
persisted- The persisted entity that may be overridden
-
getEntityClass
- Specified by:
getEntityClassin 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:
getUnresolvedDependenciesin 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 config entity but also dependencies of its children, e.g.: a ProjectImportConfig might have unresolved dependencies for one of its WorkflowStates.
-
getConflictResolveAction
- Specified by:
getConflictResolveActionin interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>- Returns:
EEntityConflictResolveActionspecifying what to do if the entity already exists
-
setConflictResolveAction
- Specified by:
setConflictResolveActionin interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>- Parameters:
conflictResolveAction-EEntityConflictResolveActionspecifying what to do if the entity already exists
-
isEntityExists
public boolean isEntityExists()- Specified by:
isEntityExistsin interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>- Returns:
trueif the given entity already exists (based on UUID and its context)
-
isImported
public boolean isImported()- Specified by:
isImportedin interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>- Returns:
- Whether the entity has been imported yet
-
setImported
Deprecated.Description copied from interface:IEntityImportConfigSets whether the entity has been imported.- Specified by:
setImportedin interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>- Parameters:
imported- Whether the entity has been imported.
-
getOriginal
Description copied from interface:IEntityImportConfigGets 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 theFormThemeReferenceof a plugin form theme.- Specified by:
getOriginalin interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>- Returns:
- original A reference to the original object referenced in the import file.
-
setOriginal
- Specified by:
setOriginalin interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>- Parameters:
original- A reference to the original object referenced in the import file.
-
getOriginalID
- Specified by:
getOriginalIDin interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>- Returns:
- original ID of the entity
-
getOriginalExportId
- Specified by:
getOriginalExportIdin 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 benullwhen the IDs are not preserved, this will always be set to the original ID from the export file.
-
getOriginalUUID
- Specified by:
getOriginalUUIDin interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>- Returns:
- original UUID of the entity or
nullif the entity is noIUUIDEntity
-
getOriginalName
- Specified by:
getOriginalNamein interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>- Returns:
- original name of the entity before import (and possible name change)
-
getChildren
- Specified by:
getChildrenin interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>- Returns:
- all child importConfigs
-
getAllChildrenFlat
- Specified by:
getAllChildrenFlatin interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>- Returns:
- all child importConfigs. Including the children of children
-
getEntityToOverride
Deprecated.- Specified by:
getEntityToOverridein interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>- Returns:
IEntitythat should be overridden instead of the persisted
-
setEntityToOverride
@Deprecated public void setEntityToOverride(de.xima.cmn.dao.interfaces.IEntity<Long> entityToOverride) Deprecated.- Specified by:
setEntityToOverridein interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>- Parameters:
entityToOverride-IEntitythat should be overridden instead of the persisted
-
getImportJson
Deprecated.- Specified by:
getImportJsonin interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>- Returns:
- the original JSON String of the import entity
-
setAlternative
Description copied from interface:IEntityImportConfigSets 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 aLong, representing theIDof an existing entity to use instead.- Specified by:
setAlternativein interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>- Parameters:
alternative- An object referencing the alternative to use.
-
loadAlternative
Description copied from interface:IEntityImportConfigLoads the alternative that should be used instead of the entity represented by this import config. The alternative must have been set viaIEntityImportConfig.setAlternative(Object)before. If it was not set, this method should return null.- Specified by:
loadAlternativein interfaceIEntityImportConfig<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
IEntitywith the same type as the entity represented by this import config.
-
updatePersisted
Description copied from interface:IEntityImportConfigUpdates the persisted entity if existing based on the entity represented by this config- Specified by:
updatePersistedin interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>- Parameters:
ec-IEntityContextto be used for updating the persisted entity
-
stage
Description copied from interface:IEntityImportConfigStages the import for execution based on the given configuration- Specified by:
stagein interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>- Parameters:
ec-IEntityContextto be used- Throws:
Exception- When the entity could not be staged.
-
finalize
public List<DependencyDescriptor> finalize(IEntityContext ec, String fcVersion, String exportVersion) throws Exception Description copied from interface:IEntityImportConfigFinish the import. Should be called after every import config has been staged for import and deprecated fields have been handled.- Specified by:
finalizein interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>- Parameters:
ec-IEntityContextto 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:
ListofDependencyDescriptors of missing dependencies- Throws:
Exception- When the entity import could not be finalized.
-
toString
-
resolveDependencies
Deprecated.Description copied from interface:IEntityImportConfigResolves the dependencies of this entity- Specified by:
resolveDependenciesin interfaceIEntityImportConfig<T extends de.xima.cmn.dao.interfaces.IEntity<Long>>- Parameters:
ec-IEntityContextto be used
-
findPersisted
-
getDao
-
isUuidExisting
-
makeEntityUnique
- Throws:
Exception
-
postCreate
- Throws:
Exception
-
postUpdate
- Throws:
Exception
-
preCreate
- Throws:
Exception
-
preUpdate
- Throws:
Exception
-
validateImport
- Throws:
Exception
-
getDependencyUuid
-
getUuidEntityValue
-