Package de.espirit.firstspirit.common
Interface GidAgent
public interface GidAgent
Agent providing means to set/adapt
Attention: This agent can only be used by admins.
gids for entities.Attention: This agent can only be used by admins.
- Since:
- 5.0.509
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceAdaptation result object. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SpecialistType<GidAgent>The agent's technical type to be used to request the agent from aSpecialistsBroker. -
Method Summary
Modifier and TypeMethodDescription@NotNull GidAgent.GidAdaptationResultAdapts the given elements GIDs.
Attention:
CallmigrateSchema(Schema)before calling this method if given schema doesn't not support fs_gid's yet This method will execute acommiton the OR session to persist the changes made during the execution of this method and all changes made on the session before calling this method. If an error occurs asession rollbackwill be called@NotNull GidAgent.GidAdaptationResultAdapts the given elements GIDs to the mapping defined one.
Attention:
CallmigrateSchema(Schema)before calling this method if given schema doesn't not support fs_gid's yet This method will execute acommiton the OR session to persist the changes made during the execution of this method and all changes made on the session before calling this method. If an error occurs asession rollbackwill be called@Nullable DatasetfindDataset(@NotNull UUID gid, boolean release) Finds an entity by its global identifier (GID) and returns it asDataset.@Nullable EntityfindEntity(@NotNull String gid) Finds aEntityby its globalId (gid).@Nullable EntityfindEntity(@NotNull String gid, boolean release) Finds aEntityby its globalId (gid).@Nullable EntityfindEntity(@NotNull UUID gid, boolean release) Finds anEntityby its globalId (gid).@Nullable IDProviderfindIDProvider(@NotNull String gid, boolean release) Finds aIDProviderby its globalId (gid).@Nullable IDProviderfindIDProvider(@NotNull UUID gid, boolean release) Finds aIDProviderby its globalId (gid).@Nullable UUIDgetGid(@NotNull IDProvider idProvider) Returns thegidfor the givenIDProvider.booleanisGidInUse(@NotNull UUID gid) Checks whether the givengidis currently in use.@NotNull SessionmigrateSchema(@NotNull Schema schema) Migrates the given schema to supportfs_gid'sif necessary.
Attention:
Ensure to use the returnedor sessionto request entities which should be passed to theadaptGid()methods (adaptGid(Schema, List, boolean)&adaptGid(Schema, Map, boolean))
-
Field Details
-
TYPE
The agent's technical type to be used to request the agent from aSpecialistsBroker.- Since:
- 5.0.509
-
-
Method Details
-
migrateSchema
@NotNull @NotNull Session migrateSchema(@NotNull @NotNull Schema schema) throws LockException, ElementDeletedException Migrates the given schema to supportfs_gid'sif necessary.
Attention:
Ensure to use the returnedor sessionto request entities which should be passed to theadaptGid()methods (adaptGid(Schema, List, boolean)&adaptGid(Schema, Map, boolean))- Parameters:
schema- the schema to migrate- Returns:
- the updated or session. Use this session to request entities which should be passed to adapt methods.
- Throws:
LockExceptionElementDeletedException- Since:
- 5.0.509
-
adaptGid
@NotNull @NotNull GidAgent.GidAdaptationResult adaptGid(@NotNull @NotNull Schema schema, @NotNull @NotNull List<Entity> elements, boolean force) Adapts the given elements GIDs.
Attention:
- Call
migrateSchema(Schema)before calling this method if given schema doesn't not support fs_gid's yet - This method will execute a
commiton the OR session to persist the changes made during the execution of this method and all changes made on the session before calling this method. - If an error occurs a
session rollbackwill be called
- Parameters:
schema- the entity bound schemaelements- the elements to adaptforce- adapt the entity gid no matter if it exists already- Returns:
- GidAdaptationResult the result object including changed ↔ GID mapping and list of unchanged elements.
- Throws:
IllegalStateException- if session is temporal or read onlyIllegalArgumentException- if given schema isn'tmigratedyet to supportfs_gid's- Since:
- 5.0.509
- Call
-
adaptGid
@NotNull @NotNull GidAgent.GidAdaptationResult adaptGid(@NotNull @NotNull Schema schema, @NotNull @NotNull Map<Entity, UUID> elementsMapping, boolean force) Adapts the given elements GIDs to the mapping defined one.
Attention:
- Call
migrateSchema(Schema)before calling this method if given schema doesn't not support fs_gid's yet - This method will execute a
commiton the OR session to persist the changes made during the execution of this method and all changes made on the session before calling this method. - If an error occurs a
session rollbackwill be called
- Parameters:
schema- the entity bound schemaelementsMapping- the element to gid mapping. The Entity will be updated to the given UUID.force- adapt the entity gid no matter if it exists already- Returns:
- GidAdaptationResult the result object including changed ↔ GID mapping and list of unchanged elements.
- Throws:
IllegalStateException- if session is temporal or read onlyIllegalArgumentException- if given schema isn'tmigratedyet to supportfs_gid's- Since:
- 5.0.509
- Call
-
findEntity
Finds aEntityby its globalId (gid).- Parameters:
gid- A string that specifies aUUID- Returns:
- an Entity or
null - Throws:
IllegalArgumentException- If gid does not conform to the string representation as described inUUID.toString()- Since:
- 5.0.509
-
findEntity
@Nullable @Nullable Entity findEntity(@NotNull @NotNull String gid, boolean release) throws IllegalArgumentException Finds aEntityby its globalId (gid).- Parameters:
gid- TheUUIDto lookup.release-falsefor current (work) ortruefor release state.- Returns:
- the entity or
nullif the entity could not be found. - Throws:
IllegalArgumentException- If gid does not conform to the string representation as described inUUID.toString().- Since:
- 5.2.251206
-
findEntity
@Nullable @Nullable Entity findEntity(@NotNull @NotNull UUID gid, boolean release) throws IllegalArgumentException Finds anEntityby its globalId (gid).- Parameters:
gid- TheUUIDto lookup.release-falsefor current (work) ortruefor release state.- Returns:
- the entity or
nullif the entity could not be found. - Throws:
IllegalArgumentException- If gid does not conform to the string representation as described inUUID.toString().- Since:
- 5.2.251206
-
findDataset
Finds an entity by its global identifier (GID) and returns it asDataset.- Parameters:
gid- The GID of the entity to look for.release-falsefor the current,truefor the release version.- Returns:
- The resolved dataset, or
nullif not found. - Since:
- 5.2.251206
-
findIDProvider
Finds a
IDProviderby its globalId (gid).Note: This method does not resolve
datasets. Please usefindDataset(UUID, boolean)in this case.- Parameters:
gid- TheUUIDto lookup.release-falsefor current (work) ortruefor release state.- Returns:
- an
IDProviderornullif no element could be found - Throws:
IllegalArgumentException- If name does not conform to the string representation as described inUUID.toString()- Since:
- 5.2.251206
-
findIDProvider
Finds aIDProviderby its globalId (gid).Note: This method does not resolve
datasets. Please usefindDataset(UUID, boolean)in this case.- Parameters:
gid- theUUIDto lookuprelease-falsefor current (work) ortruefor release state.- Returns:
- an
IDProviderornullif no element could be found - Since:
- 5.2.251206
-
isGidInUse
Checks whether the givengidis currently in use. The method may also returntruefor deleted elements.- Parameters:
gid- the gid to lookup, must not benull.- Returns:
trueif the givengidis in use,falseotherwise- Since:
- 5.2.251206
-
getGid
Returns thegidfor the givenIDProvider.- Parameters:
idProvider- theIDProviderto get the gid for, must not benull- Returns:
- the
gidfor the givenIDProvider - Since:
- 5.2.251206
-