refactor category to classification
This commit is contained in:
parent
4274ceaf83
commit
bcecf60164
|
|
@ -1,48 +0,0 @@
|
||||||
package org.taskana;
|
|
||||||
|
|
||||||
import org.taskana.model.Category;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface CategoryService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all available Categories
|
|
||||||
*
|
|
||||||
* @return The List of all Categories
|
|
||||||
*/
|
|
||||||
public List<Category> selectCategories();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all Categories with given parent
|
|
||||||
*
|
|
||||||
* @param parentId
|
|
||||||
* the ID of the parent Category
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public List<Category> selectCategoriesByParentId(String parentId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a Category for a given id
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @return the requested Category
|
|
||||||
*/
|
|
||||||
public Category selectCategoryById(String id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Insert a new Category
|
|
||||||
*
|
|
||||||
* @param category
|
|
||||||
* the category to insert
|
|
||||||
*/
|
|
||||||
public void insertCategory(Category category);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update a Category
|
|
||||||
*
|
|
||||||
* @param category
|
|
||||||
* the Category to update
|
|
||||||
*/
|
|
||||||
public void updateCategory(Category category);
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
package org.taskana;
|
||||||
|
|
||||||
|
import org.taskana.model.Classification;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ClassificationService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all available Classifications
|
||||||
|
*
|
||||||
|
* @return The List of all Classifications
|
||||||
|
*/
|
||||||
|
public List<Classification> selectClassifications();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all Classifications with given parent
|
||||||
|
*
|
||||||
|
* @param parentId
|
||||||
|
* the ID of the parent Classification
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<Classification> selectClassificationsByParentId(String parentId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a Classification for a given id
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return the requested Classification
|
||||||
|
*/
|
||||||
|
public Classification selectClassificationById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert a new Classification
|
||||||
|
*
|
||||||
|
* @param classification
|
||||||
|
* the classification to insert
|
||||||
|
*/
|
||||||
|
public void insertClassification(Classification classification);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update a Classification
|
||||||
|
*
|
||||||
|
* @param classification
|
||||||
|
* the Classification to update
|
||||||
|
*/
|
||||||
|
public void updateClassification(Classification classification);
|
||||||
|
}
|
||||||
|
|
@ -22,11 +22,11 @@ public interface TaskanaEngine {
|
||||||
public WorkbasketService getWorkbasketService();
|
public WorkbasketService getWorkbasketService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The CategoryService can be used for operations on all Categories
|
* The ClassificationService can be used for operations on all Categories
|
||||||
*
|
*
|
||||||
* @return the TaskService
|
* @return the TaskService
|
||||||
*/
|
*/
|
||||||
public CategoryService getCategoryService();
|
public ClassificationService getClassificationService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Taskana configuration
|
* The Taskana configuration
|
||||||
|
|
|
||||||
|
|
@ -1,73 +0,0 @@
|
||||||
package org.taskana.impl;
|
|
||||||
|
|
||||||
import org.taskana.CategoryService;
|
|
||||||
import org.taskana.model.Category;
|
|
||||||
import org.taskana.model.mappings.CategoryMapper;
|
|
||||||
|
|
||||||
import java.sql.Date;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class CategoryServiceImpl implements CategoryService {
|
|
||||||
|
|
||||||
private CategoryMapper categoryMapper;
|
|
||||||
|
|
||||||
public CategoryServiceImpl(CategoryMapper categoryMapper) {
|
|
||||||
super();
|
|
||||||
this.categoryMapper = categoryMapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Category> selectCategories() {
|
|
||||||
final List<Category> rootCategories = categoryMapper.findByParentId("");
|
|
||||||
populateChildcategories(rootCategories);
|
|
||||||
return rootCategories;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void populateChildcategories(final List<Category> categories) {
|
|
||||||
for (Category category : categories) {
|
|
||||||
List<Category> childCategories = categoryMapper.findByParentId(category.getId());
|
|
||||||
category.setChildren(childCategories);
|
|
||||||
populateChildcategories(childCategories);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Category> selectCategoriesByParentId(String parentId) {
|
|
||||||
return categoryMapper.findByParentId(parentId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void insertCategory(Category category) {
|
|
||||||
category.setId(UUID.randomUUID().toString());
|
|
||||||
category.setCreated(Date.valueOf(LocalDate.now()));
|
|
||||||
category.setModified(Date.valueOf(LocalDate.now()));
|
|
||||||
this.checkServiceLevel(category);
|
|
||||||
|
|
||||||
categoryMapper.insert(category);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateCategory(Category category) {
|
|
||||||
category.setModified(Date.valueOf(LocalDate.now()));
|
|
||||||
this.checkServiceLevel(category);
|
|
||||||
|
|
||||||
categoryMapper.update(category);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Category selectCategoryById(String id) {
|
|
||||||
return categoryMapper.findById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkServiceLevel(Category category){
|
|
||||||
if(category.getServiceLevel()!= null){
|
|
||||||
try {
|
|
||||||
java.time.Duration.parse(category.getServiceLevel());
|
|
||||||
} catch (Exception e){
|
|
||||||
throw new IllegalArgumentException("Invalid timestamp. Please use the format 'PddDThhHmmM'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
package org.taskana.impl;
|
||||||
|
|
||||||
|
import org.taskana.ClassificationService;
|
||||||
|
import org.taskana.model.Classification;
|
||||||
|
import org.taskana.model.mappings.ClassificationMapper;
|
||||||
|
|
||||||
|
import java.sql.Date;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class ClassificationServiceImpl implements ClassificationService {
|
||||||
|
|
||||||
|
private ClassificationMapper classificationMapper;
|
||||||
|
|
||||||
|
public ClassificationServiceImpl(ClassificationMapper classificationMapper) {
|
||||||
|
super();
|
||||||
|
this.classificationMapper = classificationMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Classification> selectClassifications() {
|
||||||
|
final List<Classification> rootClassifications = classificationMapper.findByParentId("");
|
||||||
|
populateChildClassifications(rootClassifications);
|
||||||
|
return rootClassifications;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void populateChildClassifications(final List<Classification> classifications) {
|
||||||
|
for (Classification classification : classifications) {
|
||||||
|
List<Classification> childClassifications = classificationMapper.findByParentId(classification.getId());
|
||||||
|
classification.setChildren(childClassifications);
|
||||||
|
populateChildClassifications(childClassifications);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Classification> selectClassificationsByParentId(String parentId) {
|
||||||
|
return classificationMapper.findByParentId(parentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertClassification(Classification classification) {
|
||||||
|
classification.setId(UUID.randomUUID().toString());
|
||||||
|
classification.setCreated(Date.valueOf(LocalDate.now()));
|
||||||
|
classification.setModified(Date.valueOf(LocalDate.now()));
|
||||||
|
this.checkServiceLevel(classification);
|
||||||
|
|
||||||
|
classificationMapper.insert(classification);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateClassification(Classification classification) {
|
||||||
|
classification.setModified(Date.valueOf(LocalDate.now()));
|
||||||
|
this.checkServiceLevel(classification);
|
||||||
|
|
||||||
|
classificationMapper.update(classification);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Classification selectClassificationById(String id) {
|
||||||
|
return classificationMapper.findById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkServiceLevel(Classification classification){
|
||||||
|
if(classification.getServiceLevel()!= null){
|
||||||
|
try {
|
||||||
|
java.time.Duration.parse(classification.getServiceLevel());
|
||||||
|
} catch (Exception e){
|
||||||
|
throw new IllegalArgumentException("Invalid timestamp. Please use the format 'PddDThhHmmM'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -8,12 +8,12 @@ import org.apache.ibatis.session.SqlSessionFactoryBuilder;
|
||||||
import org.apache.ibatis.transaction.TransactionFactory;
|
import org.apache.ibatis.transaction.TransactionFactory;
|
||||||
import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory;
|
import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory;
|
||||||
import org.apache.ibatis.transaction.managed.ManagedTransactionFactory;
|
import org.apache.ibatis.transaction.managed.ManagedTransactionFactory;
|
||||||
import org.taskana.CategoryService;
|
import org.taskana.ClassificationService;
|
||||||
import org.taskana.TaskService;
|
import org.taskana.TaskService;
|
||||||
import org.taskana.TaskanaEngine;
|
import org.taskana.TaskanaEngine;
|
||||||
import org.taskana.WorkbasketService;
|
import org.taskana.WorkbasketService;
|
||||||
import org.taskana.configuration.TaskanaEngineConfiguration;
|
import org.taskana.configuration.TaskanaEngineConfiguration;
|
||||||
import org.taskana.model.mappings.CategoryMapper;
|
import org.taskana.model.mappings.ClassificationMapper;
|
||||||
import org.taskana.model.mappings.DistributionTargetMapper;
|
import org.taskana.model.mappings.DistributionTargetMapper;
|
||||||
import org.taskana.model.mappings.TaskMapper;
|
import org.taskana.model.mappings.TaskMapper;
|
||||||
import org.taskana.model.mappings.WorkbasketAccessMapper;
|
import org.taskana.model.mappings.WorkbasketAccessMapper;
|
||||||
|
|
@ -30,7 +30,7 @@ public class TaskanaEngineImpl implements TaskanaEngine {
|
||||||
private TaskMapper taskMapper;
|
private TaskMapper taskMapper;
|
||||||
private WorkbasketMapper workbasketMapper;
|
private WorkbasketMapper workbasketMapper;
|
||||||
private DistributionTargetMapper distributionTargetMapper;
|
private DistributionTargetMapper distributionTargetMapper;
|
||||||
private CategoryMapper categoryMapper;
|
private ClassificationMapper classificationMapper;
|
||||||
private WorkbasketAccessMapper workbasketAccessMapper;
|
private WorkbasketAccessMapper workbasketAccessMapper;
|
||||||
|
|
||||||
private TaskServiceImpl taskServiceImpl;
|
private TaskServiceImpl taskServiceImpl;
|
||||||
|
|
@ -45,7 +45,7 @@ public class TaskanaEngineImpl implements TaskanaEngine {
|
||||||
this.taskMapper = session.getMapper(TaskMapper.class);
|
this.taskMapper = session.getMapper(TaskMapper.class);
|
||||||
this.workbasketMapper = session.getMapper(WorkbasketMapper.class);
|
this.workbasketMapper = session.getMapper(WorkbasketMapper.class);
|
||||||
this.distributionTargetMapper = session.getMapper(DistributionTargetMapper.class);
|
this.distributionTargetMapper = session.getMapper(DistributionTargetMapper.class);
|
||||||
this.categoryMapper = session.getMapper(CategoryMapper.class);
|
this.classificationMapper = session.getMapper(ClassificationMapper.class);
|
||||||
this.workbasketAccessMapper = session.getMapper(WorkbasketAccessMapper.class);
|
this.workbasketAccessMapper = session.getMapper(WorkbasketAccessMapper.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,8 +63,8 @@ public class TaskanaEngineImpl implements TaskanaEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CategoryService getCategoryService() {
|
public ClassificationService getClassificationService() {
|
||||||
return new CategoryServiceImpl(this.categoryMapper);
|
return new ClassificationServiceImpl(this.classificationMapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -94,7 +94,7 @@ public class TaskanaEngineImpl implements TaskanaEngine {
|
||||||
configuration.addMapper(TaskMapper.class);
|
configuration.addMapper(TaskMapper.class);
|
||||||
configuration.addMapper(WorkbasketMapper.class);
|
configuration.addMapper(WorkbasketMapper.class);
|
||||||
configuration.addMapper(DistributionTargetMapper.class);
|
configuration.addMapper(DistributionTargetMapper.class);
|
||||||
configuration.addMapper(CategoryMapper.class);
|
configuration.addMapper(ClassificationMapper.class);
|
||||||
configuration.addMapper(WorkbasketAccessMapper.class);
|
configuration.addMapper(WorkbasketAccessMapper.class);
|
||||||
return new SqlSessionFactoryBuilder().build(configuration);
|
return new SqlSessionFactoryBuilder().build(configuration);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,20 +5,20 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Category entity
|
* Classification entity
|
||||||
*/
|
*/
|
||||||
public class Category {
|
public class Classification {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
private String tenantId;
|
private String tenantId;
|
||||||
private String parentCategoryId;
|
private String parentClassificationId;
|
||||||
private Date created;
|
private Date created;
|
||||||
private Date modified;
|
private Date modified;
|
||||||
private String name;
|
private String name;
|
||||||
private String description;
|
private String description;
|
||||||
private int priority;
|
private int priority;
|
||||||
private String serviceLevel; //PddDThhHmmM
|
private String serviceLevel; //PddDThhHmmM
|
||||||
private List<Category> children = new ArrayList<>();
|
private List<Classification> children = new ArrayList<>();
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
|
|
@ -36,12 +36,12 @@ public class Category {
|
||||||
this.tenantId = tenantId;
|
this.tenantId = tenantId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getParentCategoryId() {
|
public String getParentClassificationId() {
|
||||||
return parentCategoryId;
|
return parentClassificationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParentCategoryId(String parentCategoryId) {
|
public void setParentClassificationId(String parentClassificationId) {
|
||||||
this.parentCategoryId = parentCategoryId;
|
this.parentClassificationId = parentClassificationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getCreated() {
|
public Date getCreated() {
|
||||||
|
|
@ -92,15 +92,15 @@ public class Category {
|
||||||
this.serviceLevel = serviceLevel;
|
this.serviceLevel = serviceLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Category> getChildren() {
|
public List<Classification> getChildren() {
|
||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addChild(Category child) {
|
public void addChild(Classification child) {
|
||||||
children.add(child);
|
children.add(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChildren(List<Category> children) {
|
public void setChildren(List<Classification> children) {
|
||||||
this.children = children;
|
this.children = children;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
package org.taskana.model.mappings;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.*;
|
|
||||||
import org.taskana.model.Category;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface CategoryMapper {
|
|
||||||
|
|
||||||
@Select("SELECT * FROM BUSINESS_CATEGORY ORDER BY ID")
|
|
||||||
@Results({
|
|
||||||
@Result(property="id", column="ID"),
|
|
||||||
@Result(property="tenantId", column="TENANT_ID"),
|
|
||||||
@Result(property="parentCategoryId", column="PARENT_CATEGORY_ID"),
|
|
||||||
@Result(property="created", column="CREATED"),
|
|
||||||
@Result(property="modified", column="MODIFIED"),
|
|
||||||
@Result(property="name", column="NAME"),
|
|
||||||
@Result(property="description", column="DESCRIPTION"),
|
|
||||||
@Result(property="priority", column="PRIORITY"),
|
|
||||||
@Result(property="serviceLevel", column="SERVICE_LEVEL")
|
|
||||||
})
|
|
||||||
List<Category> findAll();
|
|
||||||
|
|
||||||
@Select("SELECT * FROM BUSINESS_CATEGORY WHERE PARENT_CATEGORY_ID = #{parentCategoryId} ORDER BY ID")
|
|
||||||
List<Category> findByParentId(@Param("parentCategoryId") String parentId);
|
|
||||||
|
|
||||||
@Select("SELECT * FROM BUSINESS_CATEGORY WHERE ID = #{categoryId}")
|
|
||||||
Category findById(@Param("categoryId") String categoryId);
|
|
||||||
|
|
||||||
@Insert("INSERT INTO BUSINESS_CATEGORY (ID, TENANT_ID, PARENT_CATEGORY_ID, CREATED, NAME, DESCRIPTION, PRIORITY, SERVICE_LEVEL) VALUES (#{category.id}, #{category.tenantId}, #{category.parentCategoryId}, #{category.created}, #{category.name}, #{category.description}, #{category.priority}, #{category.serviceLevel})")
|
|
||||||
void insert(@Param("category") Category category);
|
|
||||||
|
|
||||||
@Update(value = "UPDATE BUSINESS_CATEGORY SET TENANT_ID = #{category.tenantId}, PARENT_CATEGORY_ID = #{category.parentCategoryId}, NAME = #{category.name}, DESCRIPTION = #{category.description}, PRIORITY = #{category.priority}, SERVICE_LEVEL = #{category.serviceLevel}, MODIFIED = #{category.modified} WHERE ID = #{category.id}")
|
|
||||||
void update(@Param("category") Category category);
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
package org.taskana.model.mappings;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.*;
|
||||||
|
import org.taskana.model.Classification;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ClassificationMapper {
|
||||||
|
|
||||||
|
@Select("SELECT * FROM BUSINESS_CLASSIFICATION ORDER BY ID")
|
||||||
|
@Results({
|
||||||
|
@Result(property="id", column="ID"),
|
||||||
|
@Result(property="tenantId", column="TENANT_ID"),
|
||||||
|
@Result(property="parentClassificationId", column="PARENT_CLASSIFICATION_ID"),
|
||||||
|
@Result(property="created", column="CREATED"),
|
||||||
|
@Result(property="modified", column="MODIFIED"),
|
||||||
|
@Result(property="name", column="NAME"),
|
||||||
|
@Result(property="description", column="DESCRIPTION"),
|
||||||
|
@Result(property="priority", column="PRIORITY"),
|
||||||
|
@Result(property="serviceLevel", column="SERVICE_LEVEL")
|
||||||
|
})
|
||||||
|
List<Classification> findAll();
|
||||||
|
|
||||||
|
@Select("SELECT * FROM BUSINESS_CLASSIFICATION WHERE PARENT_CLASSIFICATION_ID = #{parentClassificationId} ORDER BY ID")
|
||||||
|
List<Classification> findByParentId(@Param("parentClassificationId") String parentId);
|
||||||
|
|
||||||
|
@Select("SELECT * FROM BUSINESS_CLASSIFICATION WHERE ID = #{classificationId}")
|
||||||
|
Classification findById(@Param("classificationId") String classificationId);
|
||||||
|
|
||||||
|
@Insert("INSERT INTO BUSINESS_CLASSIFICATION (ID, TENANT_ID, PARENT_CLASSIFICATION_ID, CREATED, NAME, DESCRIPTION, PRIORITY, SERVICE_LEVEL) VALUES (#{classification.id}, #{classification.tenantId}, #{classification.parentClassificationId}, #{classification.created}, #{classification.name}, #{classification.description}, #{classification.priority}, #{classification.serviceLevel})")
|
||||||
|
void insert(@Param("classification") Classification classification);
|
||||||
|
|
||||||
|
@Update(value = "UPDATE BUSINESS_CLASSIFICATION SET TENANT_ID = #{classification.tenantId}, PARENT_CLASSIFICATION_ID = #{classification.parentClassificationId}, NAME = #{classification.name}, DESCRIPTION = #{classification.description}, PRIORITY = #{classification.priority}, SERVICE_LEVEL = #{classification.serviceLevel}, MODIFIED = #{classification.modified} WHERE ID = #{classification.id}")
|
||||||
|
void update(@Param("classification") Classification classification);
|
||||||
|
}
|
||||||
|
|
@ -37,10 +37,10 @@ CREATE TABLE IF NOT EXISTS DISTRIBUTION_TARGETS(
|
||||||
PRIMARY KEY (SOURCE_ID, TARGET_ID)
|
PRIMARY KEY (SOURCE_ID, TARGET_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS BUSINESS_CATEGORY(
|
CREATE TABLE IF NOT EXISTS BUSINESS_CLASSIFICATION(
|
||||||
ID varchar(255) NOT NULL,
|
ID varchar(255) NOT NULL,
|
||||||
TENANT_ID varchar(255) NULL,
|
TENANT_ID varchar(255) NULL,
|
||||||
PARENT_CATEGORY_ID varchar(255),
|
PARENT_CLASSIFICATION_ID varchar(255),
|
||||||
CREATED DATE NULL,
|
CREATED DATE NULL,
|
||||||
MODIFIED DATE NULL,
|
MODIFIED DATE NULL,
|
||||||
NAME varchar(255) NULL,
|
NAME varchar(255) NULL,
|
||||||
|
|
|
||||||
|
|
@ -1,100 +0,0 @@
|
||||||
package org.taskana.impl;
|
|
||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
|
||||||
import static org.mockito.Mockito.atLeast;
|
|
||||||
import static org.mockito.Mockito.doNothing;
|
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
import static org.mockito.Mockito.when;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.mockito.InjectMocks;
|
|
||||||
import org.mockito.Mock;
|
|
||||||
import org.mockito.junit.MockitoJUnitRunner;
|
|
||||||
import org.taskana.model.Category;
|
|
||||||
import org.taskana.model.mappings.CategoryMapper;
|
|
||||||
|
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
|
||||||
public class CategoryServiceImplTest {
|
|
||||||
|
|
||||||
@InjectMocks
|
|
||||||
CategoryServiceImpl categoryService;
|
|
||||||
|
|
||||||
@Mock
|
|
||||||
CategoryMapper categoryMapper;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testInsertCategory() {
|
|
||||||
doNothing().when(categoryMapper).insert(any());
|
|
||||||
|
|
||||||
Category category = new Category();
|
|
||||||
category.setId("0");
|
|
||||||
categoryService.insertCategory(category);
|
|
||||||
|
|
||||||
when(categoryMapper.findById(any())).thenReturn(category);
|
|
||||||
|
|
||||||
Assert.assertNotNull(categoryService.selectCategoryById(category.getId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testFindAllCategories() {
|
|
||||||
doNothing().when(categoryMapper).insert(any());
|
|
||||||
|
|
||||||
Category category0 = new Category();
|
|
||||||
category0.setId("0");
|
|
||||||
category0.setParentCategoryId("");
|
|
||||||
categoryService.insertCategory(category0);
|
|
||||||
Category category1 = new Category();
|
|
||||||
category1.setId("1");
|
|
||||||
category1.setParentCategoryId("");
|
|
||||||
categoryService.insertCategory(category1);
|
|
||||||
|
|
||||||
List<Category> categories = new ArrayList<>();
|
|
||||||
categories.add(category0);
|
|
||||||
when(categoryMapper.findByParentId("")).thenReturn(categories);
|
|
||||||
|
|
||||||
verify(categoryMapper, atLeast(2)).insert(any());
|
|
||||||
Assert.assertEquals(1, categoryService.selectCategories().size());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testFindByParentCategory() {
|
|
||||||
doNothing().when(categoryMapper).insert(any());
|
|
||||||
|
|
||||||
Category category0 = new Category();
|
|
||||||
category0.setId("0");
|
|
||||||
category0.setParentCategoryId("0");
|
|
||||||
categoryService.insertCategory(category0);
|
|
||||||
Category category1 = new Category();
|
|
||||||
category1.setId("1");
|
|
||||||
category1.setParentCategoryId("0");
|
|
||||||
categoryService.insertCategory(category1);
|
|
||||||
|
|
||||||
List<Category> categories = new ArrayList<>();
|
|
||||||
categories.add(category0);
|
|
||||||
categories.add(category1);
|
|
||||||
when(categoryMapper.findByParentId(any())).thenReturn(categories);
|
|
||||||
|
|
||||||
verify(categoryMapper, atLeast(2)).insert(any());
|
|
||||||
|
|
||||||
Assert.assertEquals(2, categoryService.selectCategoriesByParentId("0").size());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testModifiedCategory() {
|
|
||||||
doNothing().when(categoryMapper).insert(any());
|
|
||||||
doNothing().when(categoryMapper).update(any());
|
|
||||||
|
|
||||||
Category category = new Category();
|
|
||||||
categoryService.insertCategory(category);
|
|
||||||
category.setDescription("TEST EVERYTHING");
|
|
||||||
categoryService.updateCategory(category);
|
|
||||||
|
|
||||||
Assert.assertEquals(category.getModified().toString(), LocalDate.now().toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,97 @@
|
||||||
|
package org.taskana.impl;
|
||||||
|
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.mockito.InjectMocks;
|
||||||
|
import org.mockito.Mock;
|
||||||
|
import org.mockito.junit.MockitoJUnitRunner;
|
||||||
|
import org.taskana.model.Classification;
|
||||||
|
import org.taskana.model.mappings.ClassificationMapper;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
|
import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
|
public class ClassificationServiceImplTest {
|
||||||
|
|
||||||
|
@InjectMocks
|
||||||
|
ClassificationServiceImpl classificationService;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
ClassificationMapper classificationMapper;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testInsertClassification() {
|
||||||
|
doNothing().when(classificationMapper).insert(any());
|
||||||
|
|
||||||
|
Classification classification = new Classification();
|
||||||
|
classification.setId("0");
|
||||||
|
classificationService.insertClassification(classification);
|
||||||
|
|
||||||
|
when(classificationMapper.findById(any())).thenReturn(classification);
|
||||||
|
|
||||||
|
Assert.assertNotNull(classificationService.selectClassificationById(classification.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFindAllClassifications() {
|
||||||
|
doNothing().when(classificationMapper).insert(any());
|
||||||
|
|
||||||
|
Classification classification0 = new Classification();
|
||||||
|
classification0.setId("0");
|
||||||
|
classification0.setParentClassificationId("");
|
||||||
|
classificationService.insertClassification(classification0);
|
||||||
|
Classification classification1 = new Classification();
|
||||||
|
classification1.setId("1");
|
||||||
|
classification1.setParentClassificationId("");
|
||||||
|
classificationService.insertClassification(classification1);
|
||||||
|
|
||||||
|
List<Classification> classifications = new ArrayList<>();
|
||||||
|
classifications.add(classification0);
|
||||||
|
when(classificationMapper.findByParentId("")).thenReturn(classifications);
|
||||||
|
|
||||||
|
verify(classificationMapper, atLeast(2)).insert(any());
|
||||||
|
Assert.assertEquals(1, classificationService.selectClassifications().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFindByParentClassification() {
|
||||||
|
doNothing().when(classificationMapper).insert(any());
|
||||||
|
|
||||||
|
Classification classification0 = new Classification();
|
||||||
|
classification0.setId("0");
|
||||||
|
classification0.setParentClassificationId("0");
|
||||||
|
classificationService.insertClassification(classification0);
|
||||||
|
Classification classification1 = new Classification();
|
||||||
|
classification1.setId("1");
|
||||||
|
classification1.setParentClassificationId("0");
|
||||||
|
classificationService.insertClassification(classification1);
|
||||||
|
|
||||||
|
List<Classification> classifications = new ArrayList<>();
|
||||||
|
classifications.add(classification0);
|
||||||
|
classifications.add(classification1);
|
||||||
|
when(classificationMapper.findByParentId(any())).thenReturn(classifications);
|
||||||
|
|
||||||
|
verify(classificationMapper, atLeast(2)).insert(any());
|
||||||
|
|
||||||
|
Assert.assertEquals(2, classificationService.selectClassificationsByParentId("0").size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testModifiedClassification() {
|
||||||
|
doNothing().when(classificationMapper).insert(any());
|
||||||
|
doNothing().when(classificationMapper).update(any());
|
||||||
|
|
||||||
|
Classification classification = new Classification();
|
||||||
|
classificationService.insertClassification(classification);
|
||||||
|
classification.setDescription("TEST EVERYTHING");
|
||||||
|
classificationService.updateClassification(classification);
|
||||||
|
|
||||||
|
Assert.assertEquals(classification.getModified().toString(), LocalDate.now().toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,79 +0,0 @@
|
||||||
package org.taskana.impl.integration;
|
|
||||||
|
|
||||||
import org.h2.jdbcx.JdbcDataSource;
|
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.taskana.CategoryService;
|
|
||||||
import org.taskana.TaskanaEngine;
|
|
||||||
import org.taskana.configuration.TaskanaEngineConfiguration;
|
|
||||||
import org.taskana.model.Category;
|
|
||||||
|
|
||||||
import javax.security.auth.login.LoginException;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
|
|
||||||
public class CategoryServiceImplIntTest {
|
|
||||||
static int counter = 0;
|
|
||||||
private CategoryService categoryService;
|
|
||||||
|
|
||||||
@Before
|
|
||||||
public void setup() throws FileNotFoundException, SQLException, LoginException {
|
|
||||||
JdbcDataSource ds = new JdbcDataSource();
|
|
||||||
ds.setURL("jdbc:h2:mem:test-db-category" + counter++);
|
|
||||||
ds.setPassword("sa");
|
|
||||||
ds.setUser("sa");
|
|
||||||
TaskanaEngineConfiguration taskEngineConfiguration = new TaskanaEngineConfiguration(ds, false);
|
|
||||||
|
|
||||||
TaskanaEngine te = taskEngineConfiguration.buildTaskanaEngine();
|
|
||||||
categoryService = te.getCategoryService();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testInsertCategory() {
|
|
||||||
Category category = new Category();
|
|
||||||
category.setId("0");
|
|
||||||
categoryService.insertCategory(category);
|
|
||||||
|
|
||||||
Assert.assertNotNull(categoryService.selectCategoryById(category.getId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testFindAllCategories() {
|
|
||||||
Category category0 = new Category();
|
|
||||||
category0.setId("0");
|
|
||||||
category0.setParentCategoryId("");
|
|
||||||
categoryService.insertCategory(category0);
|
|
||||||
Category category1 = new Category();
|
|
||||||
category1.setId("1");
|
|
||||||
category1.setParentCategoryId("");
|
|
||||||
categoryService.insertCategory(category1);
|
|
||||||
|
|
||||||
Assert.assertEquals(2, categoryService.selectCategories().size());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testFindByParentCategory() {
|
|
||||||
Category category0 = new Category();
|
|
||||||
category0.setId("0");
|
|
||||||
category0.setParentCategoryId("0");
|
|
||||||
categoryService.insertCategory(category0);
|
|
||||||
Category category1 = new Category();
|
|
||||||
category1.setId("1");
|
|
||||||
category1.setParentCategoryId("0");
|
|
||||||
categoryService.insertCategory(category1);
|
|
||||||
|
|
||||||
Assert.assertEquals(2, categoryService.selectCategoriesByParentId("0").size());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testModifiedCategory() {
|
|
||||||
Category category = new Category();
|
|
||||||
categoryService.insertCategory(category);
|
|
||||||
category.setDescription("TEST EVERYTHING");
|
|
||||||
categoryService.updateCategory(category);
|
|
||||||
|
|
||||||
Assert.assertEquals(category.getModified().toString(), LocalDate.now().toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
package org.taskana.impl.integration;
|
||||||
|
|
||||||
|
import org.h2.jdbcx.JdbcDataSource;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.taskana.ClassificationService;
|
||||||
|
import org.taskana.TaskanaEngine;
|
||||||
|
import org.taskana.configuration.TaskanaEngineConfiguration;
|
||||||
|
import org.taskana.model.Classification;
|
||||||
|
|
||||||
|
import javax.security.auth.login.LoginException;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
public class ClassificationServiceImplIntTest {
|
||||||
|
static int counter = 0;
|
||||||
|
private ClassificationService classificationService;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setup() throws FileNotFoundException, SQLException, LoginException {
|
||||||
|
JdbcDataSource ds = new JdbcDataSource();
|
||||||
|
ds.setURL("jdbc:h2:mem:test-db-classification" + counter++);
|
||||||
|
ds.setPassword("sa");
|
||||||
|
ds.setUser("sa");
|
||||||
|
TaskanaEngineConfiguration taskEngineConfiguration = new TaskanaEngineConfiguration(ds, false);
|
||||||
|
|
||||||
|
TaskanaEngine te = taskEngineConfiguration.buildTaskanaEngine();
|
||||||
|
classificationService = te.getClassificationService();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testInsertClassification() {
|
||||||
|
Classification classification = new Classification();
|
||||||
|
classification.setId("0");
|
||||||
|
classificationService.insertClassification(classification);
|
||||||
|
|
||||||
|
Assert.assertNotNull(classificationService.selectClassificationById(classification.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFindAllClassifications() {
|
||||||
|
Classification classification0 = new Classification();
|
||||||
|
classification0.setId("0");
|
||||||
|
classification0.setParentClassificationId("");
|
||||||
|
classificationService.insertClassification(classification0);
|
||||||
|
Classification classification1 = new Classification();
|
||||||
|
classification1.setId("1");
|
||||||
|
classification1.setParentClassificationId("");
|
||||||
|
classificationService.insertClassification(classification1);
|
||||||
|
|
||||||
|
Assert.assertEquals(2, classificationService.selectClassifications().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFindByParentClassification() {
|
||||||
|
Classification classification0 = new Classification();
|
||||||
|
classification0.setId("0");
|
||||||
|
classification0.setParentClassificationId("0");
|
||||||
|
classificationService.insertClassification(classification0);
|
||||||
|
Classification classification1 = new Classification();
|
||||||
|
classification1.setId("1");
|
||||||
|
classification1.setParentClassificationId("0");
|
||||||
|
classificationService.insertClassification(classification1);
|
||||||
|
|
||||||
|
Assert.assertEquals(2, classificationService.selectClassificationsByParentId("0").size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testModifiedClassification() {
|
||||||
|
Classification classification = new Classification();
|
||||||
|
classificationService.insertClassification(classification);
|
||||||
|
classification.setDescription("TEST EVERYTHING");
|
||||||
|
classificationService.updateClassification(classification);
|
||||||
|
|
||||||
|
Assert.assertEquals(classification.getModified().toString(), LocalDate.now().toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
package org.taskana.impl.integration;
|
package org.taskana.impl.integration;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
import org.h2.jdbcx.JdbcDataSource;
|
import org.h2.jdbcx.JdbcDataSource;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
@ -14,12 +11,15 @@ import org.taskana.impl.TaskServiceImpl;
|
||||||
import org.taskana.impl.TaskanaEngineImpl;
|
import org.taskana.impl.TaskanaEngineImpl;
|
||||||
import org.taskana.model.Task;
|
import org.taskana.model.Task;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
public class TaskServiceImplTransactionTest {
|
public class TaskServiceImplTransactionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStart() throws FileNotFoundException, SQLException, TaskNotFoundException, NotAuthorizedException {
|
public void testStart() throws FileNotFoundException, SQLException, TaskNotFoundException, NotAuthorizedException {
|
||||||
JdbcDataSource ds = new JdbcDataSource();
|
JdbcDataSource ds = new JdbcDataSource();
|
||||||
ds.setURL("jdbc:h2:mem:test-db-taskservice-int1");
|
ds.setURL("jdbc:h2:~/data/test-db-taskservice-int1");
|
||||||
ds.setPassword("sa");
|
ds.setPassword("sa");
|
||||||
ds.setUser("sa");
|
ds.setUser("sa");
|
||||||
TaskanaEngineConfiguration taskanaEngineConfiguration = new TaskanaEngineConfiguration(ds, true, false);
|
TaskanaEngineConfiguration taskanaEngineConfiguration = new TaskanaEngineConfiguration(ds, true, false);
|
||||||
|
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.taskana.rest;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import org.taskana.CategoryService;
|
|
||||||
import org.taskana.model.Category;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping(path = "/v1/categories", produces = { MediaType.APPLICATION_JSON_VALUE })
|
|
||||||
public class CategoryController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private CategoryService categoryService;
|
|
||||||
|
|
||||||
@RequestMapping
|
|
||||||
public List<Category> getCategories() {
|
|
||||||
return categoryService.selectCategories();
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(value = "/{categoryId}")
|
|
||||||
public Category getCategory(@PathVariable String categoryId) {
|
|
||||||
return categoryService.selectCategoryById(categoryId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.POST)
|
|
||||||
public ResponseEntity<Category> createCategory(@RequestBody Category category) {
|
|
||||||
try {
|
|
||||||
categoryService.insertCategory(category);
|
|
||||||
return ResponseEntity.status(HttpStatus.CREATED).body(category);
|
|
||||||
} catch (Exception e) {
|
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.PUT)
|
|
||||||
public ResponseEntity<Category> updateCategory(@RequestBody Category category) {
|
|
||||||
try {
|
|
||||||
categoryService.updateCategory(category);
|
|
||||||
return ResponseEntity.status(HttpStatus.CREATED).body(category);
|
|
||||||
} catch (Exception e) {
|
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.taskana.rest;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.taskana.ClassificationService;
|
||||||
|
import org.taskana.model.Classification;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(path = "/v1/classifications", produces = { MediaType.APPLICATION_JSON_VALUE })
|
||||||
|
public class ClassificationController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ClassificationService classificationService;
|
||||||
|
|
||||||
|
@RequestMapping
|
||||||
|
public List<Classification> getClassifications() {
|
||||||
|
return classificationService.selectClassifications();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/{classificationId}")
|
||||||
|
public Classification getClassification(@PathVariable String classificationId) {
|
||||||
|
return classificationService.selectClassificationById(classificationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.POST)
|
||||||
|
public ResponseEntity<Classification> createClassification(@RequestBody Classification classification) {
|
||||||
|
try {
|
||||||
|
classificationService.insertClassification(classification);
|
||||||
|
return ResponseEntity.status(HttpStatus.CREATED).body(classification);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.PUT)
|
||||||
|
public ResponseEntity<Classification> updateClassification(@RequestBody Classification classification) {
|
||||||
|
try {
|
||||||
|
classificationService.updateClassification(classification);
|
||||||
|
return ResponseEntity.status(HttpStatus.CREATED).body(classification);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
package org.taskana.rest;
|
package org.taskana.rest;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
|
@ -14,7 +11,7 @@ import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||||
import org.springframework.http.converter.json.SpringHandlerInstantiator;
|
import org.springframework.http.converter.json.SpringHandlerInstantiator;
|
||||||
import org.taskana.CategoryService;
|
import org.taskana.ClassificationService;
|
||||||
import org.taskana.TaskService;
|
import org.taskana.TaskService;
|
||||||
import org.taskana.TaskanaEngine;
|
import org.taskana.TaskanaEngine;
|
||||||
import org.taskana.WorkbasketService;
|
import org.taskana.WorkbasketService;
|
||||||
|
|
@ -23,7 +20,8 @@ import org.taskana.model.Workbasket;
|
||||||
import org.taskana.rest.serialization.WorkbasketMixIn;
|
import org.taskana.rest.serialization.WorkbasketMixIn;
|
||||||
import org.taskana.sampledata.SampleDataGenerator;
|
import org.taskana.sampledata.SampleDataGenerator;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
|
import javax.annotation.PostConstruct;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class RestApplication {
|
public class RestApplication {
|
||||||
|
|
@ -35,8 +33,8 @@ public class RestApplication {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public CategoryService getCategoryService() throws Exception {
|
public ClassificationService getClassificationService() throws Exception {
|
||||||
return getTaskanaEngine().getCategoryService();
|
return getTaskanaEngine().getClassificationService();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue