All Superinterfaces:
UniqueObjectService<de.digitalcollections.model.identifiable.alias.UrlAlias>
All Known Implementing Classes:
UrlAliasServiceImpl

public interface UrlAliasService extends UniqueObjectService<de.digitalcollections.model.identifiable.alias.UrlAlias>
Service for UrlAliasses
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    deleteByIdentifiable(de.digitalcollections.model.identifiable.Identifiable targetIdentifiable)
    Delete all UrlAliases targetting the passed Identifiable except those that have already been published.
    boolean
    deleteByIdentifiable(de.digitalcollections.model.identifiable.Identifiable targetIdentifiable, boolean force)
    Delete all UrlAliases targetting the passed UUID except those that have already been published.
    de.digitalcollections.model.list.paging.PageResponse<de.digitalcollections.model.identifiable.alias.LocalizedUrlAliases>
    findLocalizedUrlAliases(de.digitalcollections.model.list.paging.PageRequest pageRequest)
    Find UrlAliases
    generateSlug(Locale pLocale, String label, de.digitalcollections.model.identifiable.entity.Website website)
    Generates a not yet existing slug for the provided label, language and websiteUuid.
    de.digitalcollections.model.identifiable.alias.LocalizedUrlAliases
    getByIdentifiable(de.digitalcollections.model.identifiable.Identifiable identifiable)
    Returns the LocalizedUrlAliases for an identifiable, identified by its UUID
    de.digitalcollections.model.identifiable.alias.LocalizedUrlAliases
    getPrimaryUrlAliases(de.digitalcollections.model.identifiable.entity.Website website, String slug, Locale pLocale)
    Returns the primary Links (one per language) as LocalizedUrlAliases for a given slug for a given website (identified by its uuid).
    List<de.digitalcollections.model.identifiable.alias.UrlAlias>
    getPrimaryUrlAliasesByIdentifiable(de.digitalcollections.model.identifiable.Identifiable identifiable)
    Returns all primary links of the passed target identifiable.
    default void
    save(de.digitalcollections.model.identifiable.alias.UrlAlias urlAlias)
    Persist an UniqueObject (with validation)
    void
    save(de.digitalcollections.model.identifiable.alias.UrlAlias urlAlias, boolean skipValidation)
    Persist an UrlAlias (with optional validation)
    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

    Methods inherited from interface de.digitalcollections.cudami.server.business.api.service.UniqueObjectService

    count, create, delete, delete, find, getAll, getByExample, getByExampleAndLocale, getByExamples, getByExamplesAndFiltering, getRandom, update
  • Method Details

    • deleteByIdentifiable

      default boolean deleteByIdentifiable(de.digitalcollections.model.identifiable.Identifiable targetIdentifiable) throws ServiceException, ConflictException
      Delete all UrlAliases targetting the passed Identifiable except those that have already been published.
      Parameters:
      targetIdentifiable - the identifiable with 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:
      ServiceException
      ConflictException
    • deleteByIdentifiable

      boolean deleteByIdentifiable(de.digitalcollections.model.identifiable.Identifiable targetIdentifiable, boolean force) throws ServiceException, ConflictException
      Delete all UrlAliases targetting the passed UUID except those that have already been published.
      Parameters:
      targetIdentifiable - the identifiable with 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:
      ServiceException
      ConflictException
    • findLocalizedUrlAliases

      de.digitalcollections.model.list.paging.PageResponse<de.digitalcollections.model.identifiable.alias.LocalizedUrlAliases> findLocalizedUrlAliases(de.digitalcollections.model.list.paging.PageRequest pageRequest) throws ServiceException
      Find UrlAliases
      Parameters:
      pageRequest - the PageRequest
      Returns:
      a SearchPageResponse with the found LocalizedUrlAliases as paged content
      Throws:
      ServiceException - in case of an error
    • generateSlug

      String generateSlug(Locale pLocale, String label, de.digitalcollections.model.identifiable.entity.Website website) throws ServiceException
      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
      website - 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:
      ServiceException
    • getByIdentifiable

      de.digitalcollections.model.identifiable.alias.LocalizedUrlAliases getByIdentifiable(de.digitalcollections.model.identifiable.Identifiable identifiable) throws ServiceException
      Returns the LocalizedUrlAliases for an identifiable, identified by its UUID
      Parameters:
      identifiable - the identifiable
      Returns:
      the LocalizedUrlAliases, if found, or null
      Throws:
      ServiceException - in case of an error
    • getPrimaryUrlAliases

      de.digitalcollections.model.identifiable.alias.LocalizedUrlAliases getPrimaryUrlAliases(de.digitalcollections.model.identifiable.entity.Website website, String slug, Locale pLocale) throws ServiceException
      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. Additionally you can provide a Locale language to retrieve primary links of this particular target language only.
      Parameters:
      website - 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:
      ServiceException - in case of an error
    • getPrimaryUrlAliasesByIdentifiable

      List<de.digitalcollections.model.identifiable.alias.UrlAlias> getPrimaryUrlAliasesByIdentifiable(de.digitalcollections.model.identifiable.Identifiable identifiable) throws ServiceException
      Returns all primary links of the passed target identifiable.
      Parameters:
      identifiable - the identifiable that the primaries should be found for
      Returns:
      List, not null
      Throws:
      ServiceException - in case of an error
    • save

      default void save(de.digitalcollections.model.identifiable.alias.UrlAlias urlAlias) throws ValidationException, ServiceException
      Persist an UniqueObject (with validation)
      Specified by:
      save in interface UniqueObjectService<de.digitalcollections.model.identifiable.alias.UrlAlias>
      Parameters:
      urlAlias - the UniqueObject (not yet stored)
      Throws:
      ServiceException - in case of an error
      ValidationException - in case of a validation error
    • save

      void save(de.digitalcollections.model.identifiable.alias.UrlAlias urlAlias, boolean skipValidation) throws ValidationException, ServiceException
      Persist an UrlAlias (with optional validation)
      Parameters:
      urlAlias - the UrlAlias (not yet stored)
      Throws:
      ServiceException - in case of an error
      ValidationException - in case of a validation error
    • validate

      void validate(de.digitalcollections.model.identifiable.alias.LocalizedUrlAliases localizedUrlAliases) throws ServiceException, 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
      ServiceException