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
Modifier and TypeInterfaceDescriptionstatic interface
Adaptation result object. -
Field Summary
Modifier 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.GidAdaptationResult
Adapts the given elements GIDs.
Attention:
CallmigrateSchema(Schema)
before calling this method if given schema doesn't not support fs_gid's yetThis method will execute acommit
on the OR session to persist the changes made duringthe execution of this method and all changes made on the session before calling this method. If an error occurs asession rollback
will be called@NotNull GidAgent.GidAdaptationResult
Adapts 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 yetThis method will execute acommit
on the OR session to persist the changes made duringthe execution of this method and all changes made on the session before calling this method. If an error occurs asession rollback
will be called@Nullable Entity
findEntity
(@NotNull String gid) Finds aEntity
by its globalId (gid).@Nullable UUID
getGid
(@NotNull IDProvider idProvider) Returns thegid
for the givenIDProvider
.@NotNull Session
migrateSchema
(@NotNull Schema schema) Migrates the given schema to supportfs_gid's
if necessary.
Attention:
Ensure to use the returnedor session
to 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's
if necessary.
Attention:
Ensure to use the returnedor session
to 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:
LockException
ElementDeletedException
- 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
commit
on the OR session to persist the changes made duringthe execution of this method and all changes made on the session before calling this method. - If an error occurs a
session rollback
will 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'tmigrated
yet 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
commit
on the OR session to persist the changes made duringthe execution of this method and all changes made on the session before calling this method. - If an error occurs a
session rollback
will 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'tmigrated
yet to supportfs_gid's
- Since:
- 5.0.509
- Call
-
findEntity
Finds aEntity
by 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 thegid
for the givenIDProvider
.- Parameters:
idProvider
- theIDProvider
to get the gid for- Returns:
- the
gid
for the givenIDProvider
- Throws:
IllegalArgumentException
- if the givenIDProvider
isnull
- Since:
- 5.2.220102
-