Package pro.taskana.classification.api
Interface ClassificationService
-
- All Known Implementing Classes:
ClassificationServiceImpl
public interface ClassificationServiceThe ClassificationService manages all operations on Classifications.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ClassificationcreateClassification(Classification classification)Inserts a new Classification after applying default values.ClassificationQuerycreateClassificationQuery()Creates an empty ClassificationQuery.voiddeleteClassification(String id)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.
-
-
-
Method Detail
-
newClassification
Classification newClassification(String key, String domain, String type)
Instantiates 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 createClassification(Classification) call.
- Parameters:
key- the key of the Classificationdomain- the domain of the new Classificationtype- the type of the new Classification- Returns:
- the instantiated Classification
-
createClassification
Classification createClassification(Classification classification) throws ClassificationAlreadyExistException, NotAuthorizedException, DomainNotFoundException, InvalidArgumentException, MalformedServiceLevelException
Inserts 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
- Parameters:
classification- the Classification to insert- Returns:
- the inserted Classification with unique id.
- Throws:
ClassificationAlreadyExistException- if the Classification already exists in the given domain.NotAuthorizedException- if the current user is not member of TaskanaRole.BUSINESS_ADMIN or TaskanaRole.ADMINDomainNotFoundException- if the domain does not exist in the configurationMalformedServiceLevelException- if the serviceLevel does not comply with the ISO 8601 specificationInvalidArgumentException- if the Classification contains invalid properties
-
getClassification
Classification getClassification(String id) throws ClassificationNotFoundException
Gets the Classification identified by the provided id.- 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
-
getClassification
Classification getClassification(String key, String domain) throws ClassificationNotFoundException
Gets 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.- 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
-
updateClassification
Classification updateClassification(Classification classification) throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException, InvalidArgumentException, MalformedServiceLevelException
Updates the specified Classification.- Parameters:
classification- the Classification to update- Returns:
- the updated Classification.
- Throws:
ClassificationNotFoundException- if the specified Classification or its parent does not existNotAuthorizedException- if the caller is neither member ofTaskanaRole.BUSINESS_ADMIN nor TaskanaRole.ADMINConcurrencyException- 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 databaseMalformedServiceLevelException- if the serviceLevel does not comply with the ISO 8601 specificationInvalidArgumentException- if the Classification contains invalid properties
-
deleteClassification
void deleteClassification(String id) throws ClassificationInUseException, ClassificationNotFoundException, NotAuthorizedException
Deletes a Classification with all child Classifications.- Parameters:
id- 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
void deleteClassification(String classificationKey, String domain) throws ClassificationInUseException, ClassificationNotFoundException, NotAuthorizedException
Deletes the Classification identified by the provided key and domain with all its child Classifications.- 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
-
createClassificationQuery
ClassificationQuery createClassificationQuery()
Creates an empty ClassificationQuery.- Returns:
- a ClassificationQuery
-
-