Interface UrlAliasService

  • All Known Implementing Classes:
    UrlAliasServiceImpl

    public interface UrlAliasService
    Service for UrlAliasses
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      boolean delete​(List<UUID> uuids)
      Delete a list of UrlAliases by their UUIDs
      default boolean delete​(UUID uuid)
      Delete a single UrlAlias by its UUID
      default boolean deleteAllForTarget​(UUID uuid)
      Delete all UrlAliases targetting the passed UUID except those that have already been published.
      boolean deleteAllForTarget​(UUID uuid, 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> find​(de.digitalcollections.model.list.paging.PageRequest pageRequest)
      Find UrlAliases
      String generateSlug​(Locale pLocale, String label, UUID websiteUuid)
      Generates a not yet existing slug for the provided label, language and websiteUuid.
      de.digitalcollections.model.identifiable.alias.UrlAlias getByUuid​(UUID uuid)
      Retrieve one UrlAlias by its UUID
      de.digitalcollections.model.identifiable.alias.LocalizedUrlAliases getLocalizedUrlAliases​(UUID uuid)
      Returns the LocalizedUrlAliases for an identifiable, identified by its UUID
      de.digitalcollections.model.identifiable.alias.LocalizedUrlAliases getPrimaryUrlAliases​(UUID websiteUuid, 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> getPrimaryUrlAliasesForTarget​(UUID targetUuid)
      Returns all primary links of the passed target identifiable.
      default de.digitalcollections.model.identifiable.alias.UrlAlias save​(de.digitalcollections.model.identifiable.alias.UrlAlias urlAlias)
      Create an UrlAlias in the database (with validation)
      de.digitalcollections.model.identifiable.alias.UrlAlias save​(de.digitalcollections.model.identifiable.alias.UrlAlias urlAlias, boolean force)
      Create an UrlAlias in the database
      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 Detail

      • save

        default de.digitalcollections.model.identifiable.alias.UrlAlias save​(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
      • save

        de.digitalcollections.model.identifiable.alias.UrlAlias save​(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
      • delete

        default boolean delete​(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​(List<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​(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​(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
      • find

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

        de.digitalcollections.model.identifiable.alias.LocalizedUrlAliases getLocalizedUrlAliases​(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
      • getPrimaryUrlAliases

        de.digitalcollections.model.identifiable.alias.LocalizedUrlAliases getPrimaryUrlAliases​(UUID websiteUuid,
                                                                                                String slug,
                                                                                                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. Additionally you can provide a Locale language to retrieve primary links of this particular target language only.
        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
      • getPrimaryUrlAliasesForTarget

        List<de.digitalcollections.model.identifiable.alias.UrlAlias> getPrimaryUrlAliasesForTarget​(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 - in case of an error
      • generateSlug

        String generateSlug​(Locale pLocale,
                            String label,
                            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
      • getByUuid

        de.digitalcollections.model.identifiable.alias.UrlAlias getByUuid​(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
      • 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
      • 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