Package pro.taskana.classification.api
Interface ClassificationService
-
- All Known Implementing Classes:
ClassificationServiceImpl
public interface ClassificationServiceThis class manages the classifications.
-
-
Method Summary
All Methods Instance Methods Abstract 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 id)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.
-
-
-
Method Detail
-
getClassification
Classification getClassification(String key, String domain) throws ClassificationNotFoundException
Get the Classification for key and domain. If there's no Classification in the given domain, return the Classification from the master domain.- 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
Classification getClassification(String id) throws ClassificationNotFoundException
Get the Classification by id.- 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
void deleteClassification(String id) throws ClassificationInUseException, ClassificationNotFoundException, NotAuthorizedException
Delete a classification with all child classifications.- Parameters:
id- 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
void deleteClassification(String classificationKey, String domain) throws ClassificationInUseException, ClassificationNotFoundException, NotAuthorizedException
Delete a classification with all child classifications.- 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
Classification createClassification(Classification classification) throws ClassificationAlreadyExistException, NotAuthorizedException, DomainNotFoundException, InvalidArgumentException
Inserts 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
- 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
Classification updateClassification(Classification classification) throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException, InvalidArgumentException
Updates a Classification.- Parameters:
classification- the Classification to update- Returns:
- the updated Classification.
- Throws:
ClassificationNotFoundException- if the classification OR it´s parent does not exist.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.InvalidArgumentException- if the ServiceLevel property does not comply with the ISO 8601 specification
-
createClassificationQuery
ClassificationQuery createClassificationQuery()
This method provides a query builder for querying the database.- Returns:
- a
ClassificationQuery
-
newClassification
Classification newClassification(String key, String domain, String type)
Creating a newClassificationwith unchangeable default values. It will be only generated and is not inserted until CREATE-call.- Parameters:
key- the key of the classificationdomain- the domain of the new classificationtype- the type of the new classification- Returns:
- classification to specify
-
-