Interface UrlAliasService
- 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 TypeMethodDescriptiondefault booleandeleteByIdentifiable(de.digitalcollections.model.identifiable.Identifiable targetIdentifiable) Delete all UrlAliases targetting the passedIdentifiableexcept those that have already been published.booleandeleteByIdentifiable(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 UrlAliasesgenerateSlug(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.LocalizedUrlAliasesgetByIdentifiable(de.digitalcollections.model.identifiable.Identifiable identifiable) Returns the LocalizedUrlAliases for an identifiable, identified by its UUIDde.digitalcollections.model.identifiable.alias.LocalizedUrlAliasesgetPrimaryUrlAliases(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 voidsave(de.digitalcollections.model.identifiable.alias.UrlAlias urlAlias) Persist anUniqueObject(with validation)voidsave(de.digitalcollections.model.identifiable.alias.UrlAlias urlAlias, boolean skipValidation) Persist anUrlAlias(with optional validation)voidvalidate(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 existMethods 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 passedIdentifiableexcept those that have already been published.- Parameters:
targetIdentifiable- the identifiable with 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:
ServiceExceptionConflictException
-
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 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:
ServiceExceptionConflictException
-
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 stringwebsite- 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 aLocalelanguage to retrieve primary links of this particular target language only.- Parameters:
website- 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:
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, notnull- Throws:
ServiceException- in case of an error
-
save
default void save(de.digitalcollections.model.identifiable.alias.UrlAlias urlAlias) throws ValidationException, ServiceException Persist anUniqueObject(with validation)- Specified by:
savein interfaceUniqueObjectService<de.digitalcollections.model.identifiable.alias.UrlAlias>- Parameters:
urlAlias- theUniqueObject(not yet stored)- Throws:
ServiceException- in case of an errorValidationException- in case of a validation error
-
save
void save(de.digitalcollections.model.identifiable.alias.UrlAlias urlAlias, boolean skipValidation) throws ValidationException, ServiceException Persist anUrlAlias(with optional validation)- Parameters:
urlAlias- theUrlAlias(not yet stored)- Throws:
ServiceException- in case of an errorValidationException- 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 metServiceException
-