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, PriorityServiceManager priorityServiceManager, 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 applying default values.ClassificationQuerycreateClassificationQuery()Creates an empty ClassificationQuery.voiddeleteClassification(String classificationId)Deletes a Classification with all child Classifications.voiddeleteClassification(String classificationKey, String domain)Deletes the Classification identified by the provided key and domain with all its child Classifications.ClassificationgetClassification(String id)Gets the Classification identified by the provided id.ClassificationgetClassification(String key, String domain)ClassificationnewClassification(String key, String domain, String type)Instantiates a non-persistent/non-inserted Classification.ClassificationupdateClassification(Classification classification)Updates the specified Classification.
-
-
-
Constructor Detail
-
ClassificationServiceImpl
public ClassificationServiceImpl(InternalTaskanaEngine taskanaEngine, PriorityServiceManager priorityServiceManager, ClassificationMapper classificationMapper, TaskMapper taskMapper)
-
-
Method Detail
-
getClassification
public Classification getClassification(String key, String domain) throws ClassificationNotFoundException
Description copied from interface:ClassificationServiceGets the Classification identified by the provided key and domain. If there's no Classification in the given domain, returns the Classification from the master domain.- Specified by:
getClassificationin interfaceClassificationService- Parameters:
key- the key of the searched-for Classificationdomain- the domain of the searched-for Classification- Returns:
- if exists: domain-specific Classification, else master Classification
- Throws:
ClassificationNotFoundException- if no Classification with specified key was found neither in the specified domain nor in the master domain
-
getClassification
public Classification getClassification(String id) throws ClassificationNotFoundException
Description copied from interface:ClassificationServiceGets the Classification identified by the provided id.- Specified by:
getClassificationin interfaceClassificationService- Parameters:
id- the id of the searched-for Classification- Returns:
- the Classification identified by id
- Throws:
ClassificationNotFoundException- if no Classification with the specified id was found
-
deleteClassification
public void deleteClassification(String classificationId) throws ClassificationInUseException, ClassificationNotFoundException, NotAuthorizedException
Description copied from interface:ClassificationServiceDeletes a Classification with all child Classifications.- Specified by:
deleteClassificationin interfaceClassificationService- Parameters:
classificationId- the id of the searched-for Classification- Throws:
ClassificationInUseException- if there are Tasks which refer to this ClassificationClassificationNotFoundException- if no Classification with the specified id was foundNotAuthorizedException- if the current user is not member of TaskanaRole.BUSINESS_ADMIN or TaskanaRole.ADMIN
-
deleteClassification
public void deleteClassification(String classificationKey, String domain) throws ClassificationInUseException, ClassificationNotFoundException, NotAuthorizedException
Description copied from interface:ClassificationServiceDeletes the Classification identified by the provided key and domain with all its child Classifications.- Specified by:
deleteClassificationin interfaceClassificationService- Parameters:
classificationKey- the key of the Classification you want to delete.domain- the domain of the the Classification you want to delete. if "", the function tries to delete the Classification from the master domain and any other Classification with this key- Throws:
ClassificationInUseException- if there are Tasks which refer to this ClassificationClassificationNotFoundException- if no Classification with the specified key and domain was foundNotAuthorizedException- if the current user is not member of TaskanaRole.BUSINESS_ADMIN or TaskanaRole.ADMIN
-
createClassification
public Classification createClassification(Classification classification) throws ClassificationAlreadyExistException, DomainNotFoundException, InvalidArgumentException, MalformedServiceLevelException, NotAuthorizedException
Description copied from interface:ClassificationServiceInserts a new Classification after applying default values.The Classification will be added to master-domain, too - if not already existing.
The default values are:- id - generated automatically
- parentId - ""
- parentKey - ""
- serviceLevel - "P0D"
- isValidInDomain - true
if domain is the master domain: false
- Specified by:
createClassificationin interfaceClassificationService- Parameters:
classification- the Classification to insert- Returns:
- the inserted Classification with unique id.
- Throws:
ClassificationAlreadyExistException- if the Classification already exists in the given domain.DomainNotFoundException- if the domain does not exist in the configurationInvalidArgumentException- if the Classification contains invalid propertiesMalformedServiceLevelException- if the serviceLevel does not comply with the ISO 8601 specificationNotAuthorizedException- if the current user is not member of TaskanaRole.BUSINESS_ADMIN or TaskanaRole.ADMIN
-
updateClassification
public Classification updateClassification(Classification classification) throws ConcurrencyException, ClassificationNotFoundException, InvalidArgumentException, MalformedServiceLevelException, NotAuthorizedException
Description copied from interface:ClassificationServiceUpdates the specified Classification.- Specified by:
updateClassificationin interfaceClassificationService- Parameters:
classification- the Classification to update- Returns:
- the updated Classification.
- Throws:
ConcurrencyException- if the Classification was modified in the meantime and is not the most up to date anymore; that's the case if the given modified timestamp differs from the one in the databaseClassificationNotFoundException- if the specified Classification or its parent does not existInvalidArgumentException- if the Classification contains invalid propertiesMalformedServiceLevelException- if the serviceLevel does not comply with the ISO 8601 specificationNotAuthorizedException- if the caller is neither member ofTaskanaRole.BUSINESS_ADMIN nor TaskanaRole.ADMIN
-
createClassificationQuery
public ClassificationQuery createClassificationQuery()
Description copied from interface:ClassificationServiceCreates an empty ClassificationQuery.- Specified by:
createClassificationQueryin interfaceClassificationService- Returns:
- a ClassificationQuery
-
newClassification
public Classification newClassification(String key, String domain, String type)
Description copied from interface:ClassificationServiceInstantiates a non-persistent/non-inserted Classification.The Classification is initialized with unchangeable values for key, domain and type. The Classification will not be inserted into the database until ClassificationService.createClassification(Classification) 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:
- the instantiated Classification
-
-