Interface UrlAliasService
-
- All Known Implementing Classes:
UrlAliasServiceImpl
public interface UrlAliasServiceService for UrlAliasses
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default de.digitalcollections.model.identifiable.alias.UrlAliascreate(de.digitalcollections.model.identifiable.alias.UrlAlias urlAlias)Create an UrlAlias in the database (with validation)de.digitalcollections.model.identifiable.alias.UrlAliascreate(de.digitalcollections.model.identifiable.alias.UrlAlias urlAlias, boolean force)Create an UrlAlias in the databasebooleandelete(List<UUID> uuids)Delete a list of UrlAliases by their UUIDsdefault booleandelete(UUID uuid)Delete a single UrlAlias by its UUIDdefault booleandeleteAllForTarget(UUID uuid)Delete all UrlAliases targetting the passed UUID except those that have already been published.booleandeleteAllForTarget(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 UrlAliasesde.digitalcollections.model.identifiable.alias.LocalizedUrlAliasesfindLocalizedUrlAliases(UUID uuid)Returns the LocalizedUrlAliases for an identifiable, identified by its UUIDde.digitalcollections.model.identifiable.alias.UrlAliasfindOne(UUID uuid)Retrieve one UrlAlias by its UUIDde.digitalcollections.model.identifiable.alias.LocalizedUrlAliasesfindPrimaryLinks(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>findPrimaryLinksForTarget(UUID targetUuid)Returns all primary links of the passed target identifiable.StringgenerateSlug(Locale pLocale, String label, UUID websiteUuid)Generates a not yet existing slug for the provided label, language and websiteUuid.de.digitalcollections.model.identifiable.alias.UrlAliasupdate(de.digitalcollections.model.identifiable.alias.UrlAlias urlAlias)Updates an UrlAlias in the databasevoidvalidate(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
-
findOne
de.digitalcollections.model.identifiable.alias.UrlAlias findOne(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(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- thetargetUuidwhose 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- thetargetUuidwhose UrlAliases should be deletedforce- iftrueremove 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 CudamiServiceExceptionCreate 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 CudamiServiceExceptionCreate 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 CudamiServiceExceptionUpdates 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 CudamiServiceExceptionFind 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(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(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.- Parameters:
websiteUuid- the UUID of the website, the slug belongs to, or nullslug- 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
List<de.digitalcollections.model.identifiable.alias.UrlAlias> findPrimaryLinksForTarget(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, notnull- Throws:
CudamiServiceException
-
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 stringwebsiteUuid- 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 ValidationExceptionValidates 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
-
-