All Known Implementing Classes:
UrlAliasServiceImpl

public interface UrlAliasService
Service for UrlAliasses
  • Method Summary

    Modifier and Type Method Description
    default de.digitalcollections.model.identifiable.alias.UrlAlias create​(de.digitalcollections.model.identifiable.alias.UrlAlias urlAlias)
    Create an UrlAlias in the database (with validation)
    de.digitalcollections.model.identifiable.alias.UrlAlias create​(de.digitalcollections.model.identifiable.alias.UrlAlias urlAlias, boolean force)
    Create an UrlAlias in the database
    boolean delete​(java.util.List<java.util.UUID> uuids)
    Delete a list of UrlAliases by their UUIDs
    default boolean delete​(java.util.UUID uuid)
    Delete a single UrlAlias by its UUID
    default boolean deleteAllForTarget​(java.util.UUID uuid)
    Delete all UrlAliases targetting the passed UUID except those that have already been published.
    boolean deleteAllForTarget​(java.util.UUID uuid, boolean force)
    Delete all UrlAliases targetting the passed UUID except those that have already been published.
    de.digitalcollections.model.paging.SearchPageResponse<de.digitalcollections.model.identifiable.alias.LocalizedUrlAliases> find​(de.digitalcollections.model.paging.SearchPageRequest pageRequest)
    Find UrlAliases
    de.digitalcollections.model.identifiable.alias.LocalizedUrlAliases findLocalizedUrlAliases​(java.util.UUID uuid)
    Returns the LocalizedUrlAliases for an identifiable, identified by its UUID
    de.digitalcollections.model.identifiable.alias.UrlAlias findOne​(java.util.UUID uuid)
    Retrieve one UrlAlias by its UUID
    de.digitalcollections.model.identifiable.alias.LocalizedUrlAliases findPrimaryLinks​(java.util.UUID websiteUuid, java.lang.String slug, java.util.Locale pLocale)
    Returns the primary Links (one per language) as LocalizedUrlAliases for a given slug for a given website (identified by its uuid).
    java.util.List<de.digitalcollections.model.identifiable.alias.UrlAlias> findPrimaryLinksForTarget​(java.util.UUID targetUuid)
    Returns all primary links of the passed target identifiable.
    java.lang.String generateSlug​(java.util.Locale pLocale, java.lang.String label, java.util.UUID websiteUuid)
    Generates a not yet existing slug for the provided label, language and websiteUuid.
    de.digitalcollections.model.identifiable.alias.UrlAlias update​(de.digitalcollections.model.identifiable.alias.UrlAlias urlAlias)
    Updates an UrlAlias in the database
    void validate​(de.digitalcollections.model.identifiable.alias.LocalizedUrlAliases localizedUrlAliases)
    Validates the given localizedUrlAliases according to the following criteria: For each (website,target,language) tuple, exactly one primary UrlAlias must exist, and as many non primary UrlAliases can exist
  • Method Details

    • findOne

      de.digitalcollections.model.identifiable.alias.UrlAlias findOne​(java.util.UUID uuid) throws CudamiServiceException
      Retrieve one UrlAlias by its UUID
      Parameters:
      uuid - the UUID
      Returns:
      the UrlAlias or null
      Throws:
      CudamiServiceException - in case of an error
    • delete

      default boolean delete​(java.util.UUID uuid) throws CudamiServiceException
      Delete a single UrlAlias by its UUID
      Parameters:
      uuid - the UUID
      Returns:
      true if the UrlAliases existed and could be deleted or false, it it did not exist and thus could not be deleted
      Throws:
      CudamiServiceException - in case of an error
    • delete

      boolean delete​(java.util.List<java.util.UUID> uuids) throws CudamiServiceException
      Delete a list of UrlAliases by their UUIDs
      Parameters:
      uuids - a List of UUIDs
      Returns:
      true if at least one UrlAlias existed and could be deleted or false, if no UrlAlias existed at all and thus nothing could be deleted
      Throws:
      CudamiServiceException
    • deleteAllForTarget

      default boolean deleteAllForTarget​(java.util.UUID uuid) throws CudamiServiceException
      Delete all UrlAliases targetting the passed UUID except those that have already been published.
      Parameters:
      uuid - the targetUuid whose UrlAliases should be deleted
      Returns:
      true if at least one UrlAlias existed and could be deleted or false, if no UrlAlias existed at all and thus nothing could be deleted
      Throws:
      CudamiServiceException
    • deleteAllForTarget

      boolean deleteAllForTarget​(java.util.UUID uuid, boolean force) throws CudamiServiceException
      Delete all UrlAliases targetting the passed UUID except those that have already been published.
      Parameters:
      uuid - the targetUuid whose UrlAliases should be deleted
      force - if true remove published ones as well
      Returns:
      true if at least one UrlAlias existed and could be deleted or false, if no UrlAlias existed at all and thus nothing could be deleted
      Throws:
      CudamiServiceException
    • create

      default de.digitalcollections.model.identifiable.alias.UrlAlias create​(de.digitalcollections.model.identifiable.alias.UrlAlias urlAlias) throws CudamiServiceException
      Create an UrlAlias in the database (with validation)
      Parameters:
      urlAlias - the UrlAlias (with yet empty UUID)
      Returns:
      the persisted UrlAlias with its generated UUID
      Throws:
      CudamiServiceException
    • create

      de.digitalcollections.model.identifiable.alias.UrlAlias create​(de.digitalcollections.model.identifiable.alias.UrlAlias urlAlias, boolean force) throws CudamiServiceException
      Create an UrlAlias in the database
      Parameters:
      urlAlias - the UrlAlias (with yet empty UUID)
      force - if true, do not validate
      Returns:
      the persisted UrlAlias with its generated UUID
      Throws:
      CudamiServiceException
    • update

      de.digitalcollections.model.identifiable.alias.UrlAlias update​(de.digitalcollections.model.identifiable.alias.UrlAlias urlAlias) throws CudamiServiceException
      Updates an UrlAlias in the database
      Parameters:
      urlAlias - the UrlAlias (with set UUID)
      Returns:
      the updated UrlAlias
      Throws:
      CudamiServiceException
    • find

      de.digitalcollections.model.paging.SearchPageResponse<de.digitalcollections.model.identifiable.alias.LocalizedUrlAliases> find​(de.digitalcollections.model.paging.SearchPageRequest pageRequest) throws CudamiServiceException
      Find UrlAliases
      Parameters:
      pageRequest - the PageRequest
      Returns:
      a SearchPageResponse with the found LocalizedUrlAliases as paged content
      Throws:
      CudamiServiceException
    • findLocalizedUrlAliases

      de.digitalcollections.model.identifiable.alias.LocalizedUrlAliases findLocalizedUrlAliases​(java.util.UUID uuid) throws CudamiServiceException
      Returns the LocalizedUrlAliases for an identifiable, identified by its UUID
      Parameters:
      uuid - the UUID of the identifiable
      Returns:
      the LocalizedUrlAliases, if found, or null
      Throws:
      CudamiServiceException - in case of an error
    • findPrimaryLinks

      de.digitalcollections.model.identifiable.alias.LocalizedUrlAliases findPrimaryLinks​(java.util.UUID websiteUuid, java.lang.String slug, java.util.Locale pLocale) throws CudamiServiceException
      Returns the primary Links (one per language) as LocalizedUrlAliases for a given slug for a given website (identified by its uuid). The given website can be null.
      Parameters:
      websiteUuid - the UUID of the website, the slug belongs to, or null
      slug - the slug (=relative path)
      pLocale - the locale for which the result is filtered. Optional.
      Returns:
      LocalizedUrlAliases, if a primary link exists; otherwise: null.
      Throws:
      CudamiServiceException - in case of an error
    • findPrimaryLinksForTarget

      java.util.List<de.digitalcollections.model.identifiable.alias.UrlAlias> findPrimaryLinksForTarget​(java.util.UUID targetUuid) throws CudamiServiceException
      Returns all primary links of the passed target identifiable.
      Parameters:
      targetUuid - UUID of the identifiable that the primaries should be found for
      Returns:
      List, not null
      Throws:
      CudamiServiceException
    • generateSlug

      java.lang.String generateSlug​(java.util.Locale pLocale, java.lang.String label, java.util.UUID websiteUuid) throws CudamiServiceException
      Generates a not yet existing slug for the provided label, language and websiteUuid. If the websiteUuid is empty, the configured default website uuid is used.

      If for the (locale,label,websiteUuid) triple a slug already exists, a new slug is calculated by appending suffixes to it.

      Parameters:
      pLocale - The locale for which the slug is generated.
      label - The label as a string
      websiteUuid - The uuid of the website, for which the slug is generated. If not set, the UUID of the default website is used
      Returns:
      slug as String, or null, if no website under the provided websiteUuid exists
      Throws:
      CudamiServiceException
    • validate

      void validate​(de.digitalcollections.model.identifiable.alias.LocalizedUrlAliases localizedUrlAliases) throws ValidationException
      Validates the given localizedUrlAliases according to the following criteria:
      • For each (website,target,language) tuple, exactly one primary UrlAlias must exist, and as many non primary UrlAliases can exist
      Parameters:
      localizedUrlAliases - the LocalizedUrlAliases to validate
      Throws:
      ValidationException - when the critera are not met