public class GenericDaoUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> |
getEntities(IEntityContext ec,
List<UUID> uuids,
Object context,
Class<T> entityClass) |
static <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> |
getEntity(IEntityContext ec,
String name,
Object context,
Class<T> entityClass)
Gets the entity with the given name in the given context
|
static <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> |
getEntity(IEntityContext ec,
UUID uuid,
Object context,
Class<T> entityClass)
Gets the entity with the given UUID in the given context
|
static Long |
getIdFromUUID(IEntityContext ec,
UUID uuid,
Object context,
Class<?> entityClass)
Translates an entity UUID to its corresponding ID if it exists
|
static List<Long> |
getIdsFromUUIDs(IEntityContext ec,
List<UUID> uuids,
Object context,
Class<?> entityClass)
Translates the list of UUIDs to a list of IDs
|
static List<Long> |
getIdsFromUUIDStrings(IEntityContext ec,
List<String> strUuids,
Object context,
Class<?> entityClass)
Translates the list of UUID strings to a list of IDs
|
static Object |
getUuidContextValue(de.xima.cmn.dao.interfaces.IEntity<Long> contextEntity,
Class<?> entityClass) |
static <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> |
loadPersistedEntity(IEntityContext ec,
T entity)
Returns entity that is persisted in the database (fully initialized) based on its UUID and CONTEXT (client,
project, ...)
|
static <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> |
merge(IEntityContext ec,
T entity,
T persisted) |
public static final List<Long> getIdsFromUUIDStrings(IEntityContext ec, List<String> strUuids, Object context, Class<?> entityClass)
ec
- IEntityContext
to usestrUuids
- List
entity UUID stringscontext
- Object
entity to use as contextentityClass
- Class
of the entitiesList
of entity IDspublic static final List<Long> getIdsFromUUIDs(IEntityContext ec, List<UUID> uuids, Object context, Class<?> entityClass)
ec
- IEntityContext
to useuuids
- List
entity UUIDscontext
- Object
entity to use as contextentityClass
- Class
of the entitiesList
of entity IDs. If no entity could be found for a UUID in the list, it will be omitted.public static final Long getIdFromUUID(IEntityContext ec, UUID uuid, Object context, Class<?> entityClass)
ec
- IEntityContext
to useuuid
- String
entity UUIDcontext
- Object
entity to use as contextentityClass
- Class
of the entityLong
ID of the entity if it exists. Otherwise null
public static final <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> List<T> getEntities(IEntityContext ec, List<UUID> uuids, Object context, Class<T> entityClass)
public static final <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> T getEntity(IEntityContext ec, UUID uuid, Object context, Class<T> entityClass)
T
- the entity typeec
- IEntityContext
to useuuid
- String
entity UUIDcontext
- Object
entity to use as contextentityClass
- Class
of the entitypublic static final <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> T getEntity(IEntityContext ec, String name, Object context, Class<T> entityClass)
T
- the entity typeec
- IEntityContext
to usename
- String
entity UUIDcontext
- Object
entity to use as contextentityClass
- Class
of the entitypublic static final Object getUuidContextValue(de.xima.cmn.dao.interfaces.IEntity<Long> contextEntity, Class<?> entityClass)
public static final <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> T loadPersistedEntity(IEntityContext ec, T entity)
T
- IEntity
base entity interfaceec
- IEntityContext
to be usedentity
- IEntity
to check if it exists in the databaseIEntity
that is persisted in the database or null
if none could be foundpublic static final <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> T merge(IEntityContext ec, T entity, T persisted)
Copyright © 2021 XIMA MEDIA GmbH. All rights reserved.