Skip to content

Commit

Permalink
TSK-81: correced some ClassificationService Methods, Tests and need u…
Browse files Browse the repository at this point in the history
…nique ID for task-join. +Structure fix for CreateClassification (root domain)
  • Loading branch information
MLengl authored and BerndBreier committed Dec 21, 2017
1 parent 193e3c3 commit 5f64242
Show file tree
Hide file tree
Showing 17 changed files with 460 additions and 261 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,57 +13,73 @@ public interface ClassificationService {

/**
* Get all available Classifications as a tree.
*
* @return The List of all Classifications
* @throws NotAuthorizedException TODO
* @throws NotAuthorizedException
* TODO
*/
List<Classification> getClassificationTree() throws NotAuthorizedException;

/**
* Get all Classifications with the given key.
* Returns also older and domain-specific versions of the classification.
* Get all Classifications with the given key. Returns also older and domain-specific versions of the
* classification.
*
* @param key TODO
* @param domain TODO
* @param key
* TODO
* @param domain
* TODO
* @return List with all versions of the Classification
*/
List<Classification> getAllClassificationsWithKey(String key, String domain);

/**
* Get the Classification for key and domain. If there's no specification for the given domain, it returns the root domain.
* @param key TODO
* @param domain TODO
* Get the Classification for key and domain. If there's no specification for the given domain, it returns the root
* domain.
*
* @param key
* TODO
* @param domain
* TODO
* @return If exist: domain-specific classification, else root classification
* @throws ClassificationNotFoundException TODO
* @throws ClassificationNotFoundException
* TODO
*/
Classification getClassification(String key, String domain) throws ClassificationNotFoundException;

/**
* Persist a new classification. If the classification does
* already exist in a domain, it will just be updated.
* Persists a new classification after adding default values. <br >
* The classification will be added to root-domain, too - if not already existing.
*
* @param classification
* the classification to insert
* @return classification which is persisted with unique ID.
* @throws ClassificationAlreadyExistException
* when the classification does already exists with same ID+domain.
* when the classification does already exists at the given domain.
*/
void createClassification(Classification classification) throws ClassificationAlreadyExistException;
Classification createClassification(Classification classification)
throws ClassificationAlreadyExistException;

/**
* Update a Classification.
*
* @param classification
* the Classification to update
* @throws ClassificationNotFoundException when the classification does not exist already.
* @throws ClassificationNotFoundException
* when the classification does not exist already.
*/
void updateClassification(Classification classification) throws ClassificationNotFoundException;

/**
* This method provides a query builder for quering the database.
*
* @return a {@link ClassificationQuery}
*/
ClassificationQuery createClassificationQuery();

/**
* Creating a new {@link Classification} with unchangeable default values.
* It will be only generated and is not persisted until CREATE-call.
* Creating a new {@link Classification} with unchangeable default values. It will be only generated and is not
* persisted until CREATE-call.
*
* @return classification to specify
*/
Classification newClassification();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package pro.taskana.exceptions;

import pro.taskana.Classification;

/**
* Thrown, when a classification does already exits,
* but wanted to create with same ID+domain.
* Thrown, when a classification does already exits, but wanted to create with same ID+domain.
*/
public class ClassificationAlreadyExistException extends NotFoundException {
public class ClassificationAlreadyExistException extends TaskanaException {

private static final long serialVersionUID = 4716611657569005013L;

public ClassificationAlreadyExistException(String classificationId) {
super(classificationId);
public ClassificationAlreadyExistException(Classification classification) {
super("ID='" + classification.getId() + "', KEY=' " + classification.getKey() + "', DOMAIN='"
+ classification.getDomain() + "';");
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pro.taskana.model;
package pro.taskana.impl;

import java.sql.Date;

Expand All @@ -10,51 +10,31 @@
public class ClassificationImpl implements Classification {

private String id;

private String key;

private String parentClassificationKey;

private String category;

private String type;

private String domain;

private Boolean isValidInDomain;

private Date created;

private String name;

private String description;

private int priority;

private String serviceLevel; // PddDThhHmmM

private String applicationEntryPoint;

private String custom1;

private String custom2;

private String custom3;

private String custom4;

private String custom5;

private String custom6;

private String custom7;

private String custom8;

private Date validFrom;

private Date validUntil;

ClassificationImpl() { }

@Override
public String getId() {
return id;
Expand Down
Loading

0 comments on commit 5f64242

Please sign in to comment.