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 EntityfindEntity(@NotNull String gid) Finds aEntityby its globalId (gid).@Nullable UUIDgetGid(@NotNull IDProvider idProvider) Returns thegidfor the givenIDProvider.@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 name does not conform to the string representation as described inUUID.toString()- Since:
- 5.0.509
-
getGid
Returns thegidfor the givenIDProvider.- Parameters:
idProvider- theIDProviderto get the gid for- Returns:
- the
gidfor the givenIDProvider - Throws:
IllegalArgumentException- if the givenIDProviderisnull- Since:
- 5.2.220102
-