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 gid does not conform to the string representation as described in UUID.toString()
      Since:
      5.0.509
    • findEntity

      @Nullable @Nullable Entity findEntity(@NotNull @NotNull String gid, boolean release) throws IllegalArgumentException
      Finds a Entity by its globalId (gid).
      Parameters:
      gid - The UUID to lookup.
      release - false for current (work) or true for release state.
      Returns:
      the entity or null if the entity could not be found.
      Throws:
      IllegalArgumentException - If gid does not conform to the string representation as described in UUID.toString().
      Since:
      5.2.251206
    • findEntity

      @Nullable @Nullable Entity findEntity(@NotNull @NotNull UUID gid, boolean release) throws IllegalArgumentException
      Finds an Entity by its globalId (gid).
      Parameters:
      gid - The UUID to lookup.
      release - false for current (work) or true for release state.
      Returns:
      the entity or null if the entity could not be found.
      Throws:
      IllegalArgumentException - If gid does not conform to the string representation as described in UUID.toString().
      Since:
      5.2.251206
    • findDataset

      @Nullable @Nullable Dataset findDataset(@NotNull @NotNull UUID gid, boolean release)
      Finds an entity by its global identifier (GID) and returns it as Dataset.
      Parameters:
      gid - The GID of the entity to look for.
      release - false for the current, true for the release version.
      Returns:
      The resolved dataset, or null if not found.
      Since:
      5.2.251206
    • findIDProvider

      @Nullable @Nullable IDProvider findIDProvider(@NotNull @NotNull String gid, boolean release)

      Finds a IDProvider by its globalId (gid).

      Note: This method does not resolve datasets. Please use findDataset(UUID, boolean) in this case.

      Parameters:
      gid - The UUID to lookup.
      release - false for current (work) or true for release state.
      Returns:
      an IDProvider or null if no element could be found
      Throws:
      IllegalArgumentException - If name does not conform to the string representation as described in UUID.toString()
      Since:
      5.2.251206
    • findIDProvider

      @Nullable @Nullable IDProvider findIDProvider(@NotNull @NotNull UUID gid, boolean release)
      Finds a IDProvider by its globalId (gid).

      Note: This method does not resolve datasets. Please use findDataset(UUID, boolean) in this case.

      Parameters:
      gid - the UUID to lookup
      release - false for current (work) or true for release state.
      Returns:
      an IDProvider or null if no element could be found
      Since:
      5.2.251206
    • isGidInUse

      boolean isGidInUse(@NotNull @NotNull UUID gid)
      Checks whether the given gid is currently in use. The method may also return true for deleted elements.
      Parameters:
      gid - the gid to lookup, must not be null.
      Returns:
      true if the given gid is in use, false otherwise
      Since:
      5.2.251206
    • 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, must not be null
      Returns:
      the gid for the given IDProvider
      Since:
      5.2.251206