Class ClassificationServiceImpl
- java.lang.Object
-
- pro.taskana.classification.internal.ClassificationServiceImpl
-
- All Implemented Interfaces:
ClassificationService
public class ClassificationServiceImpl extends Object implements ClassificationService
This is the implementation of ClassificationService.
-
-
Constructor Summary
Constructors Constructor Description ClassificationServiceImpl(InternalTaskanaEngine taskanaEngine, ClassificationMapper classificationMapper, TaskMapper taskMapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClassificationcreateClassification(Classification classification)Inserts a new Classification after adding default values.ClassificationQuerycreateClassificationQuery()This method provides a query builder for querying the database.voiddeleteClassification(String classificationId)Delete a classification with all child classifications.voiddeleteClassification(String classificationKey, String domain)Delete a classification with all child classifications.ClassificationgetClassification(String id)Get the Classification by id.ClassificationgetClassification(String key, String domain)Get the Classification for key and domain.ClassificationnewClassification(String key, String domain, String type)Creating a newClassificationwith unchangeable default values.ClassificationupdateClassification(Classification classification)Updates a Classification.
-
-
-
Constructor Detail
-
ClassificationServiceImpl
public ClassificationServiceImpl(InternalTaskanaEngine taskanaEngine, ClassificationMapper classificationMapper, TaskMapper taskMapper)
-
-
Method Detail
-
getClassification
public Classification getClassification(String key, String domain) throws ClassificationNotFoundException
Description copied from interface:ClassificationServiceGet the Classification for key and domain. If there's no Classification in the given domain, return the Classification from the master domain.- Specified by:
getClassificationin interfaceClassificationService- Parameters:
key- the key of the searched-for classificationsdomain- the domain of the searched-for classifications- Returns:
- If exist: domain-specific classification, else master classification
- Throws:
ClassificationNotFoundException- if no classification is found that matches the key either in domain or in the master domain.
-
getClassification
public Classification getClassification(String id) throws ClassificationNotFoundException
Description copied from interface:ClassificationServiceGet the Classification by id.- Specified by:
getClassificationin interfaceClassificationService- Parameters:
id- the id of the searched-for classifications- Returns:
- the classification identified by id
- Throws:
ClassificationNotFoundException- if no classification is found that matches the id.
-
deleteClassification
public void deleteClassification(String classificationId) throws ClassificationInUseException, ClassificationNotFoundException, NotAuthorizedException
Description copied from interface:ClassificationServiceDelete a classification with all child classifications.- Specified by:
deleteClassificationin interfaceClassificationService- Parameters:
classificationId- the id of the searched-for classifications- Throws:
ClassificationInUseException- if there are Task existing, which refer to this classification.ClassificationNotFoundException- if for an domain no classification specification is found.NotAuthorizedException- if the current user is not member of role BUSINESS_ADMIN or ADMIN
-
deleteClassification
public void deleteClassification(String classificationKey, String domain) throws ClassificationInUseException, ClassificationNotFoundException, NotAuthorizedException
Description copied from interface:ClassificationServiceDelete a classification with all child classifications.- Specified by:
deleteClassificationin interfaceClassificationService- Parameters:
classificationKey- the key of the classification you want to delete.domain- the domains for which you want to delete the classification. if "", the function tries to delete the "master domain" classification and any other classification with this key.- Throws:
ClassificationInUseException- if there are Task existing, which refer to this classification.ClassificationNotFoundException- if for an domain no classification specification is found.NotAuthorizedException- if the current user is not member of role BUSINESS_ADMIN or ADMIN
-
createClassification
public Classification createClassification(Classification classification) throws ClassificationAlreadyExistException, NotAuthorizedException, DomainNotFoundException, InvalidArgumentException
Description copied from interface:ClassificationServiceInserts a new Classification after adding default values.
The Classification will be added to master-domain, too - if not already existing.
The default values are:- id - generated by IdGenerator
- parentId - ""
- parentKey - ""
- serviceLevel - "P0D"
- isValidInDomain -
true
ifdomainan empty string thanfalse
- Specified by:
createClassificationin interfaceClassificationService- Parameters:
classification- the Classification to insert- Returns:
- Classification which is equipped with unique ID.
- Throws:
ClassificationAlreadyExistException- if the Classification does already exists at the given domain.NotAuthorizedException- if the current user is not member of role BUSINESS_ADMIN or ADMINDomainNotFoundException- if thedomaindoes not exist in the configurationInvalidArgumentException- if theserviceLevelproperty does not comply with the ISO 8601 specification
-
updateClassification
public Classification updateClassification(Classification classification) throws NotAuthorizedException, ConcurrencyException, ClassificationNotFoundException, InvalidArgumentException
Description copied from interface:ClassificationServiceUpdates a Classification.- Specified by:
updateClassificationin interfaceClassificationService- Parameters:
classification- the Classification to update- Returns:
- the updated Classification.
- Throws:
NotAuthorizedException- if the caller got no ADMIN or BUSINESS_ADMIN permissions.ConcurrencyException- If the classification was modified in the meantime and is not the most up to date anymore.ClassificationNotFoundException- if the classification OR it´s parent does not exist.InvalidArgumentException- if the ServiceLevel property does not comply with the ISO 8601 specification
-
createClassificationQuery
public ClassificationQuery createClassificationQuery()
Description copied from interface:ClassificationServiceThis method provides a query builder for querying the database.- Specified by:
createClassificationQueryin interfaceClassificationService- Returns:
- a
ClassificationQuery
-
newClassification
public Classification newClassification(String key, String domain, String type)
Description copied from interface:ClassificationServiceCreating a newClassificationwith unchangeable default values. It will be only generated and is not inserted until CREATE-call.- Specified by:
newClassificationin interfaceClassificationService- Parameters:
key- the key of the classificationdomain- the domain of the new classificationtype- the type of the new classification- Returns:
- classification to specify
-
-