Package de.xima.fc.importer.util
Class EntityImportHelper
java.lang.Object
de.xima.fc.importer.util.EntityImportHelper
Helper class for importing entities
- Author:
- XIMA MEDIA GmbH
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
TaddValueToEntityField(IEntityContext ec, T entity, String fieldDescriptor, Object value) Adds/sets the given value to the field property of the entity.static <T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
TaddValueToEntityField(T entity, String fieldDescriptor, Object value) Adds/sets the given value to the field property of the entity.static final booleancheckEntityNameExists(IEntityContext ec, String name, de.xima.cmn.dao.interfaces.IEntity<Long> entity, de.xima.cmn.dao.interfaces.IEntity<Long> excludeEntity) static final intcompareByEntityClass(Object o1, Object o2) static final StringgetDisplayName(de.xima.cmn.dao.interfaces.IEntity<Long> entity) Returns a String representation of the entity for displaying to the userstatic final StringgetDisplayName(de.xima.cmn.dao.interfaces.IEntity<Long> entity, Locale locale) Returns a String representation of the entity for displaying to the userstatic final de.xima.cmn.dao.interfaces.IEntity<Long>getEntity(UUID uuid, Class<? extends de.xima.cmn.dao.interfaces.IEntity<Long>> entityClass, List<IEntityImportConfig<?>> importConfigs) Looks for entity with the given uuid and class in the list of import configs and returns it.static final FieldgetEntityField(Class<?> clazz, String fieldName) Gets the class field by name.getEntityName(UUID uuid, Class<T> entityClass, List<IEntityImportConfig<?>> importConfigs) Looks for entity with the given uuid and class in the list of import configs and returns its name if there is any.static final ExportMetadatastatic final <T extends INameProviding & de.xima.cmn.dao.interfaces.IEntity<Long>>
StringgetUniqueEntityName(IEntityContext ec, T entity, T excludeEntity) Gets a unique entity name for the given entitystatic final StringgetUniqueProjectAlias(IEntityContext ec, Projekt project, boolean excludeSelf) static final StringgetUniqueProjectTitle(IEntityContext ec, Projekt project, boolean excludeSelf) Gets a unique project title for the given projectstatic final List<BenutzerGruppe>getUserGroups(IEntityContext ec, List<UUID> uuids, Mandant client, List<IEntityImportConfig<?>> importConfigs) Gets a list of user groups in the given client with the given uuidsstatic final booleanisEntityNameExists(IEntityContext ec, String name, de.xima.cmn.dao.interfaces.IEntity<Long> entity, boolean excludeSelf) Checks whether or not the name of the entity is used by any other entity in its contextstatic final booleanisIdentical(de.xima.cmn.dao.interfaces.IEntity<Long> e1, de.xima.cmn.dao.interfaces.IEntity<Long> e2) Compares to entities and checks if they are "identical"static final booleanisProjectTitleExists(IEntityContext ec, String title, Projekt project, boolean excludeSelf) Checks whether or not the given title is used by any other project of this clientstatic final voidremoveConfig(UUID uuid, Class<? extends de.xima.cmn.dao.interfaces.IEntity<Long>> clazz, List<IEntityImportConfig<?>> configs) static final IEntityDependencyremoveDependency(IEntityImportConfig<?> config, String fieldDescriptor) Removes the first dependency from the given config with the given field descriptorstatic voidsetEntityField(de.xima.cmn.dao.interfaces.IEntity<Long> entity, String fieldDescriptor, Object value) Sets the field property of the entity with the given valuestatic final voidupdateInboxRef(IInboxDependent proc, Postfach inbox) Deprecated.
-
Method Details
-
addValueToEntityField
public static <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> T addValueToEntityField(T entity, String fieldDescriptor, Object value) throws Exception Adds/sets the given value to the field property of the entity. -
addValueToEntityField
public static <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> T addValueToEntityField(IEntityContext ec, T entity, String fieldDescriptor, Object value) throws Exception Adds/sets the given value to the field property of the entity. The entity will be reloaded from DAO if possible- Parameters:
ec-IEntityContextto useentity-IEntityentity for which the field value should be added/setfieldDescriptor-Stringdescriptor of the field to set e.g 'bedingung#folgeAktion'value-Objectto set for the field or add to the field (if list)- Throws:
Exception- on errors during setting the value
-
setEntityField
public static void setEntityField(de.xima.cmn.dao.interfaces.IEntity<Long> entity, String fieldDescriptor, Object value) throws IllegalArgumentException, IllegalAccessException Sets the field property of the entity with the given value- Parameters:
entity-IEntityentity for which the field should be setfieldDescriptor-Stringdescriptor of the field to set e.g 'bedingung#folgeAktion'value-Objectto set for the field- Throws:
IllegalAccessException- When the field is inaccssible.IllegalArgumentException- When the type of the field is incompatible with the givenvalue.
-
getEntityField
Gets the class field by name. If none is found and the class has a superclass, this method will recursively call itself with the superclass -
getUniqueProjectTitle
public static final String getUniqueProjectTitle(IEntityContext ec, Projekt project, boolean excludeSelf) throws LimitExceededException Gets a unique project title for the given project- Parameters:
ec-IEntityContextto be usedproject-Projektto get unique title forexcludeSelf-Booleanwhether to include this project's title (based on UUID)- Returns:
Stringunique project title- Throws:
LimitExceededException
-
getUniqueProjectAlias
public static final String getUniqueProjectAlias(IEntityContext ec, Projekt project, boolean excludeSelf) throws LimitExceededException - Throws:
LimitExceededException
-
getUniqueEntityName
public static final <T extends INameProviding & de.xima.cmn.dao.interfaces.IEntity<Long>> String getUniqueEntityName(IEntityContext ec, T entity, T excludeEntity) Gets a unique entity name for the given entity- Type Parameters:
T- type of entity- Parameters:
ec-IEntityContextto be usedentity-to get unique name for excludeEntity-to be excluded in search for a unique name - Returns:
Stringunique entity name
-
checkEntityNameExists
public static final boolean checkEntityNameExists(IEntityContext ec, String name, de.xima.cmn.dao.interfaces.IEntity<Long> entity, de.xima.cmn.dao.interfaces.IEntity<Long> excludeEntity) -
isEntityNameExists
public static final boolean isEntityNameExists(IEntityContext ec, String name, de.xima.cmn.dao.interfaces.IEntity<Long> entity, boolean excludeSelf) Checks whether or not the name of the entity is used by any other entity in its context- Parameters:
ec-IEntityContextto be usedname-Stringto check forentity-IEntityto check forexcludeSelf-Booleanwhether to include this entity's name (based on UUID if existing, otherwise based on ID)- Returns:
trueif another entity has the given entity's name within its context.falseotherwise
-
isProjectTitleExists
public static final boolean isProjectTitleExists(IEntityContext ec, String title, Projekt project, boolean excludeSelf) Checks whether or not the given title is used by any other project of this client- Parameters:
ec-IEntityContextto be usedtitle-Stringto check forproject-Projektto check forexcludeSelf-Booleanwhether to include this project's title (based on UUID)- Returns:
trueif another entity has the given entity's name within its context.falseotherwise
-
getExportMetaData
- Throws:
Exception
-
getDisplayName
public static final String getDisplayName(de.xima.cmn.dao.interfaces.IEntity<Long> entity, Locale locale) Returns a String representation of the entity for displaying to the user -
getDisplayName
Returns a String representation of the entity for displaying to the user- Parameters:
entity-IEntityto get a display name for- Returns:
Stringname representing the entity for messaging
-
compareByEntityClass
-
isIdentical
public static final boolean isIdentical(de.xima.cmn.dao.interfaces.IEntity<Long> e1, de.xima.cmn.dao.interfaces.IEntity<Long> e2) Compares to entities and checks if they are "identical"- Parameters:
e1-IEntitye2-IEntity- Returns:
Boolean
-
getUserGroups
public static final List<BenutzerGruppe> getUserGroups(IEntityContext ec, List<UUID> uuids, Mandant client, List<IEntityImportConfig<?>> importConfigs) Gets a list of user groups in the given client with the given uuids- Parameters:
ec-IEntityContextto useuuids-ListofUUIDs to look forclient-Mandantto look inimportConfigs-Listof import configs used for getting the names of the user groups- Returns:
ListofBenutzerGruppe
-
removeDependency
public static final IEntityDependency removeDependency(IEntityImportConfig<?> config, String fieldDescriptor) Removes the first dependency from the given config with the given field descriptor- Parameters:
config-IEntityImportConfigconfig to remove dependency fromfieldDescriptor-Stringdescribing the dependency- Returns:
IEntityDependencythat has been removed
-
removeConfig
public static final void removeConfig(UUID uuid, Class<? extends de.xima.cmn.dao.interfaces.IEntity<Long>> clazz, List<IEntityImportConfig<?>> configs) -
updateInboxRef
Deprecated.Sets the inbox reference in the given inbox dependent processing to the given inbox. An invalid refernce will be set if the inbox isnull- Parameters:
proc-IInboxDependentprocessing to set reference forinbox-Postfachto set reference to
-
getEntityName
public static final <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> String getEntityName(UUID uuid, Class<T> entityClass, List<IEntityImportConfig<?>> importConfigs) Looks for entity with the given uuid and class in the list of import configs and returns its name if there is any. -
getEntity
public static final de.xima.cmn.dao.interfaces.IEntity<Long> getEntity(UUID uuid, Class<? extends de.xima.cmn.dao.interfaces.IEntity<Long>> entityClass, List<IEntityImportConfig<?>> importConfigs) Looks for entity with the given uuid and class in the list of import configs and returns it.
-