Package de.xima.fc.utils
Class GenericDaoUtils
java.lang.Object
de.xima.fc.utils.GenericDaoUtils
Utility class for working with entities
- Author:
- XIMA MEDIA GmbH
-
Method Summary
Modifier and TypeMethodDescriptiongetEntities(IEntityContext ec, List<UUID> uuids, Object context, Class<T> entityClass) static final <T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
TgetEntity(IEntityContext ec, String name, Object context, Class<T> entityClass) Gets the entity with the given name in the given contextstatic final <T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
TgetEntity(IEntityContext ec, UUID uuid, Object context, Class<T> entityClass) Gets the entity with the given UUID in the given contextstatic final LonggetIdFromUUID(IEntityContext ec, UUID uuid, Object context, Class<?> entityClass) Translates an entity UUID to its corresponding ID if it existsgetIdsFromUUIDs(IEntityContext ec, List<UUID> uuids, Object context, Class<?> entityClass) Translates the list of UUIDs to a list of IDsgetIdsFromUUIDStrings(IEntityContext ec, List<String> strUuids, Object context, Class<?> entityClass) Translates the list of UUID strings to a list of IDsstatic final ObjectgetUuidContextValue(de.xima.cmn.dao.interfaces.IEntity<Long> contextEntity, Class<?> entityClass) static final <T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
TloadPersistedEntity(IEntityContext ec, T entity) Returns entity that is persisted in the database (fully initialized) based on its UUID and CONTEXT (client, project, ...)static final <T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
Tmerge(IEntityContext ec, T entity, T persisted) Deprecated.static final voidsyncEntities(de.xima.cmn.dao.interfaces.IEntity<Long> entity, de.xima.cmn.dao.interfaces.IEntity<Long> persisted) static final <T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
TsyncEntities(IEntityContext ec, T entity, T persisted)
-
Method Details
-
getIdsFromUUIDStrings
public static final List<Long> getIdsFromUUIDStrings(IEntityContext ec, List<String> strUuids, Object context, Class<?> entityClass) Translates the list of UUID strings to a list of IDs- Parameters:
ec-IEntityContextto usestrUuids-Listentity UUID stringscontext-Objectentity to use as contextentityClass-Classof the entities- Returns:
Listof entity IDs
-
getIdsFromUUIDs
public static final List<Long> getIdsFromUUIDs(IEntityContext ec, List<UUID> uuids, Object context, Class<?> entityClass) Translates the list of UUIDs to a list of IDs- Parameters:
ec-IEntityContextto useuuids-Listentity UUIDscontext-Objectentity to use as contextentityClass-Classof the entities- Returns:
Listof entity IDs. If no entity could be found for a UUID in the list, it will be omitted.
-
getIdFromUUID
public static final Long getIdFromUUID(IEntityContext ec, UUID uuid, Object context, Class<?> entityClass) Translates an entity UUID to its corresponding ID if it exists- Parameters:
ec-IEntityContextto useuuid-Stringentity UUIDcontext-Objectentity to use as contextentityClass-Classof the entity- Returns:
LongID of the entity if it exists. Otherwisenull
-
getEntities
-
getEntity
public static final <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> T getEntity(IEntityContext ec, UUID uuid, Object context, Class<T> entityClass) Gets the entity with the given UUID in the given context- Type Parameters:
T- the entity type- Parameters:
ec-IEntityContextto useuuid-Stringentity UUIDcontext-Objectentity to use as contextentityClass-Classof the entity- Returns:
- the found entity
-
getEntity
public static final <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> T getEntity(IEntityContext ec, String name, Object context, Class<T> entityClass) Gets the entity with the given name in the given context- Type Parameters:
T- the entity type- Parameters:
ec-IEntityContextto usename-Stringentity UUIDcontext-Objectentity to use as contextentityClass-Classof the entity- Returns:
- the found entity
-
getUuidContextValue
-
loadPersistedEntity
public static final <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> T loadPersistedEntity(IEntityContext ec, T entity) Returns entity that is persisted in the database (fully initialized) based on its UUID and CONTEXT (client, project, ...)- Type Parameters:
T-IEntitybase entity interface- Parameters:
ec-IEntityContextto be usedentity-IEntityto check if it exists in the database- Returns:
IEntitythat is persisted in the database ornullif none could be found
-
merge
@Deprecated public static final <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> T merge(IEntityContext ec, T entity, T persisted) Deprecated. -
syncEntities
-
syncEntities
public static final <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> T syncEntities(IEntityContext ec, T entity, T persisted)
-