Interface GidAgent


public interface GidAgent
Agent providing means to set/adapt gids for entities.
Attention: This agent can only be used by admins.
Since:
5.0.509
  • Field Details

  • Method Details

    • migrateSchema

      @NotNull @NotNull Session migrateSchema(@NotNull @NotNull Schema schema) throws LockException, ElementDeletedException
      Migrates the given schema to support fs_gid's if necessary.
      Attention:
      Ensure to use the returned or session to request entities which should be passed to the adaptGid() 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 during the 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 schema
      elements - the elements to adapt
      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 only
      IllegalArgumentException - if given schema isn't migrated yet to support fs_gid's
      Since:
      5.0.509
    • 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 during the 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 schema
      elementsMapping - 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 only
      IllegalArgumentException - if given schema isn't migrated yet to support fs_gid's
      Since:
      5.0.509
    • findEntity

      @Nullable @Nullable Entity findEntity(@NotNull @NotNull String gid) throws IllegalArgumentException
      Finds a Entity by its globalId (gid).
      Parameters:
      gid - A string that specifies a UUID
      Returns:
      an Entity or null
      Throws:
      IllegalArgumentException - If name does not conform to the string representation as described in UUID.toString()
      Since:
      5.0.509
    • getGid

      @Nullable @Nullable UUID getGid(@NotNull @NotNull IDProvider idProvider)
      Returns the gid for the given IDProvider.
      Parameters:
      idProvider - the IDProvider to get the gid for
      Returns:
      the gid for the given IDProvider
      Throws:
      IllegalArgumentException - if the given IDProvider is null
      Since:
      5.2.220102