TSK-755 - Controller to get the simple history events
This commit is contained in:
parent
0d6708c2b3
commit
577ccaa648
|
@ -16,5 +16,6 @@
|
|||
<module>taskana-rest-spring</module>
|
||||
<module>../web</module>
|
||||
<module>taskana-rest-spring-example</module>
|
||||
<module>taskana-history-rest-spring</module>
|
||||
</modules>
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-history-rest-spring</artifactId>
|
||||
<version>1.0.5-SNAPSHOT</version>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.0.2.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>pro.taskana.simplehistory</groupId>
|
||||
<artifactId>taskana-simplehistory-provider</artifactId>
|
||||
<version>0.0.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.plugin</groupId>
|
||||
<artifactId>spring-plugin-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>1.4.197</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Tests -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.restdocs</groupId>
|
||||
<artifactId>spring-restdocs-mockmvc</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.hateoas</groupId>
|
||||
<artifactId>spring-hateoas</artifactId>
|
||||
<version>0.24.0.RELEASE</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-spring</artifactId>
|
||||
<version>1.0.5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-rest-spring</artifactId>
|
||||
<version>1.0.5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,72 @@
|
|||
package pro.taskana.rest;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
import pro.taskana.rest.sampledata.SampleDataGenerator;
|
||||
|
||||
/**
|
||||
* Example Application showing the implementation of taskana-rest-spring.
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@ComponentScan(basePackages = "pro.taskana")
|
||||
@Import({RestConfiguration.class})
|
||||
public class ExampleRestApplication {
|
||||
|
||||
@Value("${taskana.schemaName:TASKANA}")
|
||||
public String schemaName;
|
||||
|
||||
@Autowired
|
||||
private SampleDataGenerator sampleDataGenerator;
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ExampleRestApplication.class, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
@ConfigurationProperties(prefix = "datasource")
|
||||
public DataSourceProperties dataSourceProperties() {
|
||||
DataSourceProperties props = new DataSourceProperties();
|
||||
props.setUrl("jdbc:h2:mem:taskana;IGNORECASE=TRUE;LOCK_MODE=0;INIT=CREATE SCHEMA IF NOT EXISTS " + schemaName);
|
||||
return props;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DataSource dataSource(DataSourceProperties properties) {
|
||||
return properties.initializeDataSourceBuilder().build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public PlatformTransactionManager txManager(DataSource dataSource) {
|
||||
return new DataSourceTransactionManager(dataSource);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@DependsOn("getTaskanaEngine") // generate sample data after schema was inserted
|
||||
public SampleDataGenerator generateSampleData(DataSource dataSource) throws SQLException {
|
||||
sampleDataGenerator = new SampleDataGenerator(dataSource);
|
||||
return sampleDataGenerator;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
sampleDataGenerator.generateSampleData(schemaName);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,386 @@
|
|||
package pro.taskana.rest;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.hateoas.PagedResources;
|
||||
import org.springframework.hateoas.PagedResources.PageMetadata;
|
||||
import org.springframework.hateoas.config.EnableHypermediaSupport;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import pro.taskana.BaseQuery;
|
||||
import pro.taskana.TimeInterval;
|
||||
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
||||
import pro.taskana.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.rest.resource.TaskHistoryEventResource;
|
||||
import pro.taskana.rest.resource.TaskHistoryEventListAssembler;
|
||||
import pro.taskana.simplehistory.impl.HistoryEventImpl;
|
||||
import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl;
|
||||
import pro.taskana.simplehistory.query.HistoryQuery;
|
||||
|
||||
/**
|
||||
* Controller for all TaskHistoryEvent related endpoints.
|
||||
*/
|
||||
@RestController
|
||||
@EnableHypermediaSupport(type = EnableHypermediaSupport.HypermediaType.HAL)
|
||||
@RequestMapping(path = "/v1/task-history-event", produces = "application/hal+json")
|
||||
public class TaskHistoryEventController extends AbstractPagingController {
|
||||
|
||||
private static final String LIKE = "%";
|
||||
private static final String BUSINESS_PROCESS_ID = "business-process-id";
|
||||
private static final String BUSINESS_PROCESS_ID_LIKE = "business-process-id-like";
|
||||
private static final String PARENT_BUSINESS_PROCESS_ID = "parent-business-process-id";
|
||||
private static final String PARENT_BUSINESS_PROCESS_ID_LIKE = "parent-business-process-id-like";
|
||||
private static final String TASK_ID = "task-id";
|
||||
private static final String TASK_ID_LIKE = "task-id-like";
|
||||
private static final String EVENT_TYPE = "event-type";
|
||||
private static final String EVENT_TYPE_LIKE = "event-type-like";
|
||||
private static final String CREATED = "created";
|
||||
private static final String USER_ID = "user-id";
|
||||
private static final String USER_ID_LIKE = "user-id-like";
|
||||
private static final String DOMAIN = "domain";
|
||||
private static final String WORKBASKET_KEY = "workbasket-key";
|
||||
private static final String WORKBASKET_KEY_LIKE = "workbasket-key-like";
|
||||
private static final String POR_COMPANY = "por-company";
|
||||
private static final String POR_COMPANY_LIKE = "por-company-like";
|
||||
private static final String POR_SYSTEM = "por-system";
|
||||
private static final String POR_SYSTEM_LIKE = "por-system-like";
|
||||
private static final String POR_INSTANCE = "por-instance";
|
||||
private static final String POR_INSTANCE_LIKE = "por-instance-like";
|
||||
private static final String POR_TYPE = "por-type";
|
||||
private static final String POR_TYPE_LIKE = "por-type-like";
|
||||
private static final String POR_VALUE = "por-value";
|
||||
private static final String POR_VALUE_LIKE = "por-value-like";
|
||||
private static final String TASK_CLASSIFICATION_KEY = "task-classification-key";
|
||||
private static final String TASK_CLASSIFICATION_KEY_LIKE = "task-classification-key-like";
|
||||
private static final String TASK_CLASSIFICATION_CATEGORY = "task-classification-category";
|
||||
private static final String TASK_CLASSIFICATION_CATEGORY_LIKE = "task-classification-category-like";
|
||||
private static final String ATTACHMENT_CLASSIFICATION_KEY = "attachment-classification";
|
||||
private static final String ATTACHMENT_CLASSIFICATION_KEY_LIKE = "attachment-classification-like";
|
||||
private static final String CUSTOM_1 = "custom-1";
|
||||
private static final String CUSTOM_1_LIKE = "custom-1-like";
|
||||
private static final String CUSTOM_2 = "custom-2";
|
||||
private static final String CUSTOM_2_LIKE = "custom-2-like";
|
||||
private static final String CUSTOM_3 = "custom-3";
|
||||
private static final String CUSTOM_3_LIKE = "custom-3-like";
|
||||
private static final String CUSTOM_4 = "custom-4";
|
||||
private static final String CUSTOM_4_LIKE = "custom-4-like";
|
||||
|
||||
private static final String SORT_BY = "sort-by";
|
||||
private static final String SORT_DIRECTION = "order";
|
||||
|
||||
private static final String PAGING_PAGE = "page";
|
||||
private static final String PAGING_PAGE_SIZE = "page-size";
|
||||
|
||||
private SimpleHistoryServiceImpl simpleHistoryService;
|
||||
|
||||
@Autowired
|
||||
private TaskanaEngineConfiguration taskanaEngineConfiguration;
|
||||
|
||||
public TaskHistoryEventController(TaskanaEngineConfiguration taskanaEngineConfiguration) {
|
||||
this.taskanaEngineConfiguration = taskanaEngineConfiguration;
|
||||
simpleHistoryService = new SimpleHistoryServiceImpl();
|
||||
simpleHistoryService.initialize(taskanaEngineConfiguration);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Transactional(readOnly = true, rollbackFor = Exception.class)
|
||||
public ResponseEntity<PagedResources<TaskHistoryEventResource>> getTaskHistoryEvent(
|
||||
@RequestParam MultiValueMap<String, String> params) throws InvalidArgumentException {
|
||||
|
||||
HistoryQuery query = simpleHistoryService.createHistoryQuery();
|
||||
query = applySortingParams(query, params);
|
||||
query = applyFilterParams(query, params);
|
||||
|
||||
PageMetadata pageMetadata = null;
|
||||
List<HistoryEventImpl> historyEvents = null;
|
||||
String page = params.getFirst(PAGING_PAGE);
|
||||
String pageSize = params.getFirst(PAGING_PAGE_SIZE);
|
||||
params.remove(PAGING_PAGE);
|
||||
params.remove(PAGING_PAGE_SIZE);
|
||||
validateNoInvalidParameterIsLeft(params);
|
||||
if (page != null && pageSize != null) {
|
||||
long totalElements = query.count();
|
||||
pageMetadata = initPageMetadata(pageSize, page, totalElements);
|
||||
historyEvents = query.listPage((int) pageMetadata.getNumber(),
|
||||
(int) pageMetadata.getSize());
|
||||
} else if (page == null && pageSize == null) {
|
||||
historyEvents = query.list();
|
||||
} else {
|
||||
throw new InvalidArgumentException("Paging information is incomplete.");
|
||||
}
|
||||
|
||||
TaskHistoryEventListAssembler assembler = new TaskHistoryEventListAssembler();
|
||||
PagedResources<TaskHistoryEventResource> pagedResources = assembler.toResources(historyEvents, pageMetadata);
|
||||
|
||||
return new ResponseEntity<>(pagedResources, HttpStatus.OK);
|
||||
}
|
||||
|
||||
private HistoryQuery applySortingParams(HistoryQuery query, MultiValueMap<String, String> params)
|
||||
throws IllegalArgumentException, InvalidArgumentException {
|
||||
String sortBy = params.getFirst(SORT_BY);
|
||||
if (sortBy != null) {
|
||||
BaseQuery.SortDirection sortDirection;
|
||||
if (params.getFirst(SORT_DIRECTION) != null && "desc".equals(params.getFirst(SORT_DIRECTION))) {
|
||||
sortDirection = BaseQuery.SortDirection.DESCENDING;
|
||||
} else {
|
||||
sortDirection = BaseQuery.SortDirection.ASCENDING;
|
||||
}
|
||||
switch (sortBy) {
|
||||
case (BUSINESS_PROCESS_ID):
|
||||
query = query.orderByBusinessProcessId(sortDirection);
|
||||
break;
|
||||
case (PARENT_BUSINESS_PROCESS_ID):
|
||||
query = query.orderByParentBusinessProcessId(sortDirection);
|
||||
break;
|
||||
case (TASK_ID):
|
||||
query = query.orderByTaskId(sortDirection);
|
||||
break;
|
||||
case (EVENT_TYPE):
|
||||
query = query.orderByEventType(sortDirection);
|
||||
break;
|
||||
case (CREATED):
|
||||
query = query.orderByCreated(sortDirection);
|
||||
break;
|
||||
case (USER_ID):
|
||||
query = query.orderByUserId(sortDirection);
|
||||
break;
|
||||
case (DOMAIN):
|
||||
query = query.orderByDomain(sortDirection);
|
||||
break;
|
||||
case (WORKBASKET_KEY):
|
||||
query = query.orderByWorkbasketKey(sortDirection);
|
||||
break;
|
||||
case (POR_COMPANY):
|
||||
query = query.orderByPorCompany(sortDirection);
|
||||
break;
|
||||
case (POR_SYSTEM):
|
||||
query = query.orderByPorSystem(sortDirection);
|
||||
break;
|
||||
case (POR_INSTANCE):
|
||||
query = query.orderByPorInstance(sortDirection);
|
||||
break;
|
||||
case (POR_TYPE):
|
||||
query = query.orderByPorType(sortDirection);
|
||||
break;
|
||||
case (POR_VALUE):
|
||||
query = query.orderByPorValue(sortDirection);
|
||||
break;
|
||||
case (TASK_CLASSIFICATION_KEY):
|
||||
query = query.orderByTaskClassificationKey(sortDirection);
|
||||
break;
|
||||
case (TASK_CLASSIFICATION_CATEGORY):
|
||||
query = query.orderByTaskClassificationCategory(sortDirection);
|
||||
break;
|
||||
case (ATTACHMENT_CLASSIFICATION_KEY):
|
||||
query = query.orderByAttachmentClassificationKey(sortDirection);
|
||||
break;
|
||||
case (CUSTOM_1):
|
||||
query = query.orderByCustomAttribute(1, sortDirection);
|
||||
break;
|
||||
case (CUSTOM_2):
|
||||
query = query.orderByCustomAttribute(2, sortDirection);
|
||||
break;
|
||||
case (CUSTOM_3):
|
||||
query = query.orderByCustomAttribute(3, sortDirection);
|
||||
break;
|
||||
case (CUSTOM_4):
|
||||
query = query.orderByCustomAttribute(4, sortDirection);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown order '" + sortBy + "'");
|
||||
}
|
||||
}
|
||||
params.remove(SORT_BY);
|
||||
params.remove(SORT_DIRECTION);
|
||||
return query;
|
||||
}
|
||||
|
||||
private HistoryQuery applyFilterParams(HistoryQuery query,
|
||||
MultiValueMap<String, String> params) {
|
||||
if (params.containsKey(BUSINESS_PROCESS_ID)) {
|
||||
String[] businessProcessId = extractCommaSeparatedFields(params.get(BUSINESS_PROCESS_ID));
|
||||
query.businessProcessIdIn(businessProcessId);
|
||||
params.remove(BUSINESS_PROCESS_ID);
|
||||
}
|
||||
if (params.containsKey(BUSINESS_PROCESS_ID_LIKE)) {
|
||||
query.businessProcessIdLike(LIKE + params.get(BUSINESS_PROCESS_ID_LIKE).get(0) + LIKE);
|
||||
params.remove(BUSINESS_PROCESS_ID_LIKE);
|
||||
}
|
||||
if (params.containsKey(PARENT_BUSINESS_PROCESS_ID)) {
|
||||
String[] parentBusinessProcessId = extractCommaSeparatedFields(params.get(PARENT_BUSINESS_PROCESS_ID));
|
||||
query.parentBusinessProcessIdIn(parentBusinessProcessId);
|
||||
params.remove(PARENT_BUSINESS_PROCESS_ID);
|
||||
}
|
||||
if (params.containsKey(PARENT_BUSINESS_PROCESS_ID_LIKE)) {
|
||||
query.parentBusinessProcessIdLike(LIKE + params.get(PARENT_BUSINESS_PROCESS_ID_LIKE).get(0) + LIKE);
|
||||
params.remove(PARENT_BUSINESS_PROCESS_ID_LIKE);
|
||||
}
|
||||
if (params.containsKey(TASK_ID)) {
|
||||
String[] taskId = extractCommaSeparatedFields(params.get(TASK_ID));
|
||||
query.taskIdIn(taskId);
|
||||
params.remove(TASK_ID);
|
||||
}
|
||||
if (params.containsKey(TASK_ID_LIKE)) {
|
||||
query.taskIdLike(LIKE + params.get(TASK_ID_LIKE).get(0) + LIKE);
|
||||
params.remove(TASK_ID_LIKE);
|
||||
}
|
||||
if (params.containsKey(EVENT_TYPE)) {
|
||||
String[] eventType = extractCommaSeparatedFields(params.get(EVENT_TYPE));
|
||||
query.eventTypeIn(eventType);
|
||||
params.remove(EVENT_TYPE);
|
||||
}
|
||||
if (params.containsKey(EVENT_TYPE_LIKE)) {
|
||||
query.eventTypeLike(LIKE + params.get(EVENT_TYPE_LIKE).get(0) + LIKE);
|
||||
params.remove(EVENT_TYPE_LIKE);
|
||||
}
|
||||
if (params.containsKey(CREATED)) {
|
||||
String[] created = extractCommaSeparatedFields(params.get(CREATED));
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
Instant date = Instant.from(formatter.parse(created[0]));
|
||||
TimeInterval timeInterval = new TimeInterval(date, date);
|
||||
query.createdWithin(timeInterval);
|
||||
params.remove(CREATED);
|
||||
}
|
||||
if (params.containsKey(USER_ID)) {
|
||||
String[] userId = extractCommaSeparatedFields(params.get(USER_ID));
|
||||
query.userIdIn(userId);
|
||||
params.remove(USER_ID);
|
||||
}
|
||||
if (params.containsKey(USER_ID_LIKE)) {
|
||||
query.userIdLike(LIKE + params.get(USER_ID_LIKE).get(0) + LIKE);
|
||||
params.remove(USER_ID_LIKE);
|
||||
}
|
||||
if (params.containsKey(DOMAIN)) {
|
||||
query.domainIn(extractCommaSeparatedFields(params.get(DOMAIN)));
|
||||
params.remove(DOMAIN);
|
||||
}
|
||||
if (params.containsKey(WORKBASKET_KEY)) {
|
||||
String[] workbasketKey = extractCommaSeparatedFields(params.get(WORKBASKET_KEY));
|
||||
query.workbasketKeyIn(workbasketKey);
|
||||
params.remove(WORKBASKET_KEY);
|
||||
}
|
||||
if (params.containsKey(WORKBASKET_KEY_LIKE)) {
|
||||
query.workbasketKeyLike(LIKE + params.get(WORKBASKET_KEY_LIKE).get(0) + LIKE);
|
||||
params.remove(WORKBASKET_KEY_LIKE);
|
||||
}
|
||||
if (params.containsKey(POR_COMPANY)) {
|
||||
String[] porCompany = extractCommaSeparatedFields(params.get(POR_COMPANY));
|
||||
query.porCompanyIn(porCompany);
|
||||
params.remove(POR_COMPANY);
|
||||
}
|
||||
if (params.containsKey(POR_COMPANY_LIKE)) {
|
||||
query.porCompanyLike(LIKE + params.get(POR_COMPANY_LIKE).get(0) + LIKE);
|
||||
params.remove(POR_COMPANY_LIKE);
|
||||
}
|
||||
if (params.containsKey(POR_SYSTEM)) {
|
||||
String[] porSystem = extractCommaSeparatedFields(params.get(POR_SYSTEM));
|
||||
query.porSystemIn(porSystem);
|
||||
params.remove(POR_SYSTEM);
|
||||
}
|
||||
if (params.containsKey(POR_SYSTEM_LIKE)) {
|
||||
query.porSystemLike(LIKE + params.get(POR_SYSTEM_LIKE).get(0) + LIKE);
|
||||
params.remove(POR_SYSTEM_LIKE);
|
||||
}
|
||||
if (params.containsKey(POR_INSTANCE)) {
|
||||
String[] porInstance = extractCommaSeparatedFields(params.get(POR_INSTANCE));
|
||||
query.porInstanceIn(porInstance);
|
||||
params.remove(POR_INSTANCE);
|
||||
}
|
||||
if (params.containsKey(POR_INSTANCE_LIKE)) {
|
||||
query.porInstanceLike(LIKE + params.get(POR_INSTANCE_LIKE).get(0) + LIKE);
|
||||
params.remove(POR_INSTANCE_LIKE);
|
||||
}
|
||||
if (params.containsKey(POR_TYPE)) {
|
||||
String[] porType = extractCommaSeparatedFields(params.get(POR_TYPE));
|
||||
query.porTypeIn(porType);
|
||||
params.remove(POR_TYPE);
|
||||
}
|
||||
if (params.containsKey(POR_TYPE_LIKE)) {
|
||||
query.porTypeLike(LIKE + params.get(POR_TYPE_LIKE).get(0) + LIKE);
|
||||
params.remove(POR_TYPE_LIKE);
|
||||
}
|
||||
if (params.containsKey(POR_VALUE)) {
|
||||
String[] porValue = extractCommaSeparatedFields(params.get(POR_VALUE));
|
||||
query.porValueIn(porValue);
|
||||
params.remove(POR_VALUE);
|
||||
}
|
||||
if (params.containsKey(POR_VALUE_LIKE)) {
|
||||
query.porValueLike(LIKE + params.get(POR_VALUE_LIKE).get(0) + LIKE);
|
||||
params.remove(POR_VALUE_LIKE);
|
||||
}
|
||||
if (params.containsKey(TASK_CLASSIFICATION_KEY)) {
|
||||
String[] taskClassificationKey = extractCommaSeparatedFields(params.get(TASK_CLASSIFICATION_KEY));
|
||||
query.taskClassificationKeyIn(taskClassificationKey);
|
||||
params.remove(TASK_CLASSIFICATION_KEY);
|
||||
}
|
||||
if (params.containsKey(TASK_CLASSIFICATION_KEY_LIKE)) {
|
||||
query.taskClassificationKeyLike(LIKE + params.get(TASK_CLASSIFICATION_KEY_LIKE).get(0) + LIKE);
|
||||
params.remove(TASK_CLASSIFICATION_KEY_LIKE);
|
||||
}
|
||||
if (params.containsKey(TASK_CLASSIFICATION_CATEGORY)) {
|
||||
String[] taskClassificationCategory = extractCommaSeparatedFields(params.get(TASK_CLASSIFICATION_CATEGORY));
|
||||
query.taskClassificationCategoryIn(taskClassificationCategory);
|
||||
params.remove(TASK_CLASSIFICATION_CATEGORY);
|
||||
}
|
||||
if (params.containsKey(TASK_CLASSIFICATION_CATEGORY_LIKE)) {
|
||||
query.taskClassificationCategoryLike(LIKE + params.get(TASK_CLASSIFICATION_CATEGORY_LIKE).get(0) + LIKE);
|
||||
params.remove(TASK_CLASSIFICATION_CATEGORY_LIKE);
|
||||
}
|
||||
if (params.containsKey(ATTACHMENT_CLASSIFICATION_KEY)) {
|
||||
String[] attachmentClassificationKey = extractCommaSeparatedFields(params.get(ATTACHMENT_CLASSIFICATION_KEY));
|
||||
query.attachmentClassificationKeyIn(attachmentClassificationKey);
|
||||
params.remove(ATTACHMENT_CLASSIFICATION_KEY);
|
||||
}
|
||||
if (params.containsKey(ATTACHMENT_CLASSIFICATION_KEY_LIKE)) {
|
||||
query.attachmentClassificationKeyLike(LIKE + params.get(ATTACHMENT_CLASSIFICATION_KEY_LIKE).get(0) + LIKE);
|
||||
params.remove(ATTACHMENT_CLASSIFICATION_KEY_LIKE);
|
||||
}
|
||||
if (params.containsKey(CUSTOM_1)) {
|
||||
String[] custom1 = extractCommaSeparatedFields(params.get(CUSTOM_1));
|
||||
query.custom1In(custom1);
|
||||
params.remove(CUSTOM_1);
|
||||
}
|
||||
if (params.containsKey(CUSTOM_1_LIKE)) {
|
||||
query.custom1Like(LIKE + params.get(CUSTOM_1_LIKE).get(0) + LIKE);
|
||||
params.remove(CUSTOM_1_LIKE);
|
||||
}
|
||||
if (params.containsKey(CUSTOM_2)) {
|
||||
String[] custom2 = extractCommaSeparatedFields(params.get(CUSTOM_2));
|
||||
query.custom2In(custom2);
|
||||
params.remove(CUSTOM_2);
|
||||
}
|
||||
if (params.containsKey(CUSTOM_2_LIKE)) {
|
||||
query.custom2Like(LIKE + params.get(CUSTOM_2_LIKE).get(0) + LIKE);
|
||||
params.remove(CUSTOM_2_LIKE);
|
||||
}
|
||||
if (params.containsKey(CUSTOM_3)) {
|
||||
String[] custom3 = extractCommaSeparatedFields(params.get(CUSTOM_3));
|
||||
query.custom3In(custom3);
|
||||
params.remove(CUSTOM_3);
|
||||
}
|
||||
if (params.containsKey(CUSTOM_3_LIKE)) {
|
||||
query.custom3Like(LIKE + params.get(CUSTOM_3_LIKE).get(0) + LIKE);
|
||||
params.remove(CUSTOM_3_LIKE);
|
||||
}
|
||||
if (params.containsKey(CUSTOM_4)) {
|
||||
String[] custom4 = extractCommaSeparatedFields(params.get(CUSTOM_4));
|
||||
query.custom4In(custom4);
|
||||
params.remove(CUSTOM_4);
|
||||
}
|
||||
if (params.containsKey(CUSTOM_4_LIKE)) {
|
||||
query.custom4Like(LIKE + params.get(CUSTOM_4_LIKE).get(0) + LIKE);
|
||||
params.remove(CUSTOM_4_LIKE);
|
||||
}
|
||||
return query;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package pro.taskana.rest.resource;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.hateoas.mvc.ResourceAssemblerSupport;
|
||||
|
||||
import pro.taskana.history.api.TaskanaHistoryEvent;
|
||||
import pro.taskana.simplehistory.impl.HistoryEventImpl;
|
||||
|
||||
/**
|
||||
* Transforms any {@link HistoryEventImpl} into its {@link TaskHistoryEventResource}.
|
||||
*/
|
||||
public class TaskHistoryEventAssembler extends ResourceAssemblerSupport<TaskanaHistoryEvent, TaskHistoryEventResource> {
|
||||
|
||||
public TaskHistoryEventAssembler() {
|
||||
super(HistoryEventImpl.class, TaskHistoryEventResource.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskHistoryEventResource toResource(TaskanaHistoryEvent historyEvent) {
|
||||
TaskHistoryEventResource resource = createResourceWithId(historyEvent.getId(), historyEvent);
|
||||
BeanUtils.copyProperties(historyEvent, resource);
|
||||
if (historyEvent.getCreated() != null) {
|
||||
resource.setCreated(historyEvent.getCreated().toString());
|
||||
}
|
||||
resource.setTaskHistoryId(String.valueOf(historyEvent.getId()));
|
||||
resource.removeLinks();
|
||||
return resource;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package pro.taskana.rest.resource;
|
||||
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
||||
import static pro.taskana.rest.resource.AbstractRessourcesAssembler.getBuilderForOriginalUri;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.hateoas.Link;
|
||||
import org.springframework.hateoas.PagedResources;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import pro.taskana.rest.TaskHistoryEventController;
|
||||
import pro.taskana.simplehistory.impl.HistoryEventImpl;
|
||||
|
||||
/**
|
||||
* Mapper to convert from a list of HistoryEventImpl to a TaskHistoryEventResource.
|
||||
*/
|
||||
public class TaskHistoryEventListAssembler {
|
||||
|
||||
public TaskHistoryEventListAssembler() {
|
||||
}
|
||||
|
||||
public PagedResources<TaskHistoryEventResource> toResources(List<HistoryEventImpl> historyEvents,
|
||||
PagedResources.PageMetadata pageMetadata) {
|
||||
|
||||
TaskHistoryEventAssembler assembler = new TaskHistoryEventAssembler();
|
||||
List<TaskHistoryEventResource> resources = assembler.toResources(historyEvents);
|
||||
PagedResources<TaskHistoryEventResource> pagedResources = new PagedResources<TaskHistoryEventResource>(
|
||||
resources,
|
||||
pageMetadata);
|
||||
|
||||
UriComponentsBuilder original = getBuilderForOriginalUri();
|
||||
pagedResources.add(new Link(original.toUriString()).withSelfRel());
|
||||
if (pageMetadata != null) {
|
||||
pagedResources.add(linkTo(TaskHistoryEventController.class).withRel("allTaskHistoryEvent"));
|
||||
pagedResources.add(new Link(original.replaceQueryParam("page", 1).toUriString()).withRel(Link.REL_FIRST));
|
||||
pagedResources.add(new Link(original.replaceQueryParam("page", pageMetadata.getTotalPages()).toUriString())
|
||||
.withRel(Link.REL_LAST));
|
||||
if (pageMetadata.getNumber() > 1) {
|
||||
pagedResources
|
||||
.add(new Link(original.replaceQueryParam("page", pageMetadata.getNumber() - 1).toUriString())
|
||||
.withRel(Link.REL_PREVIOUS));
|
||||
}
|
||||
if (pageMetadata.getNumber() < pageMetadata.getTotalPages()) {
|
||||
pagedResources
|
||||
.add(new Link(original.replaceQueryParam("page", pageMetadata.getNumber() + 1).toUriString())
|
||||
.withRel(Link.REL_NEXT));
|
||||
}
|
||||
}
|
||||
|
||||
return pagedResources;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,247 @@
|
|||
package pro.taskana.rest.resource;
|
||||
|
||||
import org.springframework.hateoas.ResourceSupport;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* Resource class for {@link pro.taskana.history.api.TaskanaHistoryEvent}.
|
||||
*/
|
||||
public class TaskHistoryEventResource extends ResourceSupport {
|
||||
@NotNull
|
||||
private String taskHistoryEventId;
|
||||
|
||||
private String businessProcessId;
|
||||
private String parentBusinessProcessId;
|
||||
private String taskId;
|
||||
private String eventType;
|
||||
private String created;
|
||||
private String userId;
|
||||
private String domain;
|
||||
private String workbasketKey;
|
||||
private String porCompany;
|
||||
private String porType;
|
||||
private String porSystem;
|
||||
private String porInstance;
|
||||
private String porValue;
|
||||
private String taskClassificationKey;
|
||||
private String taskClassificationCategory;
|
||||
private String attachmentClassificationKey;
|
||||
private String comment;
|
||||
private String oldValue;
|
||||
private String newValue;
|
||||
private String custom1;
|
||||
private String custom2;
|
||||
private String custom3;
|
||||
private String custom4;
|
||||
private String oldData;
|
||||
private String newData;
|
||||
|
||||
public String getTaskHistoryId() {
|
||||
return taskHistoryEventId;
|
||||
}
|
||||
|
||||
public void setTaskHistoryId(String taskHistoryId) {
|
||||
this.taskHistoryEventId = taskHistoryId;
|
||||
}
|
||||
|
||||
public String getBusinessProcessId() {
|
||||
return businessProcessId;
|
||||
}
|
||||
|
||||
public void setBusinessProcessId(String businessProcessId) {
|
||||
this.businessProcessId = businessProcessId;
|
||||
}
|
||||
|
||||
public String getParentBusinessProcessId() {
|
||||
return parentBusinessProcessId;
|
||||
}
|
||||
|
||||
public void setParentBusinessProcessId(String parentBusinessProcessId) {
|
||||
this.parentBusinessProcessId = parentBusinessProcessId;
|
||||
}
|
||||
|
||||
public String getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public void setTaskId(String taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public String getEventType() {
|
||||
return eventType;
|
||||
}
|
||||
|
||||
public void setEventType(String eventType) {
|
||||
this.eventType = eventType;
|
||||
}
|
||||
|
||||
public String getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(String created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getDomain() {
|
||||
return domain;
|
||||
}
|
||||
|
||||
public void setDomain(String domain) {
|
||||
this.domain = domain;
|
||||
}
|
||||
|
||||
public String getWorkbasketKey() {
|
||||
return workbasketKey;
|
||||
}
|
||||
|
||||
public void setWorkbasketKey(String workbasketKey) {
|
||||
this.workbasketKey = workbasketKey;
|
||||
}
|
||||
|
||||
public String getPorCompany() {
|
||||
return porCompany;
|
||||
}
|
||||
|
||||
public void setPorCompany(String porCompany) {
|
||||
this.porCompany = porCompany;
|
||||
}
|
||||
|
||||
public String getPorType() {
|
||||
return porType;
|
||||
}
|
||||
|
||||
public void setPorType(String porType) {
|
||||
this.porType = porType;
|
||||
}
|
||||
|
||||
public String getPorSystem() {
|
||||
return porSystem;
|
||||
}
|
||||
|
||||
public void setPorSystem(String porSystem) {
|
||||
this.porSystem = porSystem;
|
||||
}
|
||||
|
||||
public String getPorInstance() {
|
||||
return porInstance;
|
||||
}
|
||||
|
||||
public void setPorInstance(String porInstance) {
|
||||
this.porInstance = porInstance;
|
||||
}
|
||||
|
||||
public String getPorValue() {
|
||||
return porValue;
|
||||
}
|
||||
|
||||
public void setPorValue(String porValue) {
|
||||
this.porValue = porValue;
|
||||
}
|
||||
|
||||
public String getTaskClassificationKey() {
|
||||
return taskClassificationKey;
|
||||
}
|
||||
|
||||
public void setTaskClassificationKey(String taskClassificationKey) {
|
||||
this.taskClassificationKey = taskClassificationKey;
|
||||
}
|
||||
|
||||
public String getTaskClassificationCategory() {
|
||||
return taskClassificationCategory;
|
||||
}
|
||||
|
||||
public void setTaskClassificationCategory(String taskClassificationCategory) {
|
||||
this.taskClassificationCategory = taskClassificationCategory;
|
||||
}
|
||||
|
||||
public String getAttachmentClassificationKey() {
|
||||
return attachmentClassificationKey;
|
||||
}
|
||||
|
||||
public void setAttachmentClassificationKey(String attachmentClassificationKey) {
|
||||
this.attachmentClassificationKey = attachmentClassificationKey;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public String getOldValue() {
|
||||
return oldValue;
|
||||
}
|
||||
|
||||
public void setOldValue(String oldValue) {
|
||||
this.oldValue = oldValue;
|
||||
}
|
||||
|
||||
public String getNewValue() {
|
||||
return newValue;
|
||||
}
|
||||
|
||||
public void setNewValue(String newValue) {
|
||||
this.newValue = newValue;
|
||||
}
|
||||
|
||||
public String getCustom1() {
|
||||
return custom1;
|
||||
}
|
||||
|
||||
public void setCustom1(String custom1) {
|
||||
this.custom1 = custom1;
|
||||
}
|
||||
|
||||
public String getCustom2() {
|
||||
return custom2;
|
||||
}
|
||||
|
||||
public void setCustom2(String custom2) {
|
||||
this.custom2 = custom2;
|
||||
}
|
||||
|
||||
public String getCustom3() {
|
||||
return custom3;
|
||||
}
|
||||
|
||||
public void setCustom3(String custom3) {
|
||||
this.custom3 = custom3;
|
||||
}
|
||||
|
||||
public String getCustom4() {
|
||||
return custom4;
|
||||
}
|
||||
|
||||
public void setCustom4(String custom4) {
|
||||
this.custom4 = custom4;
|
||||
}
|
||||
|
||||
public String getOldData() {
|
||||
return oldData;
|
||||
}
|
||||
|
||||
public void setOldData(String oldData) {
|
||||
this.oldData = oldData;
|
||||
}
|
||||
|
||||
public String getNewData() {
|
||||
return newData;
|
||||
}
|
||||
|
||||
public void setNewData(String newData) {
|
||||
this.newData = newData;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package pro.taskana.rest.sampledata;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.ibatis.jdbc.ScriptRunner;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* This class generates sample data for manual testing purposes.
|
||||
*/
|
||||
public class SampleDataGenerator {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SampleDataGenerator.class);
|
||||
private static final String SQL = "/sql";
|
||||
private static final String TEST_DATA = "/sql.sample-data";
|
||||
private static final String CLEAR = TEST_DATA + "/clear-db.sql";
|
||||
private static final String HISTORY_EVENT = TEST_DATA + "/history-event.sql";
|
||||
private ScriptRunner runner;
|
||||
|
||||
|
||||
DataSource dataSource;
|
||||
|
||||
public SampleDataGenerator(DataSource dataSource) throws SQLException {
|
||||
if (LOGGER.isTraceEnabled()) {
|
||||
LOGGER.trace(dataSource.getConnection().getMetaData().toString());
|
||||
}
|
||||
this.dataSource = dataSource;
|
||||
|
||||
runner = new ScriptRunner(dataSource.getConnection());
|
||||
}
|
||||
|
||||
public void generateSampleData(String schemaName) {
|
||||
StringWriter outWriter = new StringWriter();
|
||||
PrintWriter logWriter = new PrintWriter(outWriter);
|
||||
|
||||
StringWriter errorWriter = new StringWriter();
|
||||
PrintWriter errorLogWriter = new PrintWriter(errorWriter);
|
||||
try {
|
||||
runner.runScript(selectSchemaScript(dataSource.getConnection().getMetaData().getDatabaseProductName(), schemaName));
|
||||
runner.setStopOnError(false);
|
||||
runner.runScript(new BufferedReader(
|
||||
new InputStreamReader(this.getClass().getResourceAsStream(CLEAR), StandardCharsets.UTF_8)));
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("caught Exception {}", e);
|
||||
}
|
||||
|
||||
runner.setStopOnError(true);
|
||||
runner.setLogWriter(logWriter);
|
||||
runner.setErrorLogWriter(errorLogWriter);
|
||||
|
||||
runner.runScript(new BufferedReader(
|
||||
new InputStreamReader(this.getClass().getResourceAsStream(HISTORY_EVENT), StandardCharsets.UTF_8)));
|
||||
|
||||
runner.closeConnection();
|
||||
|
||||
LOGGER.trace(outWriter.toString());
|
||||
if (!errorWriter.toString().trim().isEmpty()) {
|
||||
LOGGER.error(errorWriter.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private StringReader selectSchemaScript(String dbProductName, String schemaName) {
|
||||
return new StringReader("PostgreSQL".equals(dbProductName) ?
|
||||
"SET search_path TO " + schemaName + ";" :
|
||||
"SET SCHEMA " + schemaName + ";");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
logging.level.pro.taskana=INFO
|
||||
taskana.schemaName=TASKANA
|
|
@ -0,0 +1,3 @@
|
|||
-- the order is important!
|
||||
DELETE FROM HISTORY_EVENT;
|
||||
COMMIT;
|
|
@ -0,0 +1,4 @@
|
|||
DROP TABLE TASKANA_SCHEMA_VERSION;
|
||||
DROP TABLE HISTORY_EVENT;
|
||||
|
||||
COMMIT;
|
|
@ -0,0 +1,54 @@
|
|||
SET SCHEMA TASKANA;
|
||||
|
||||
INSERT INTO HISTORY_EVENTS (BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, TASK_ID, EVENT_TYPE, CREATED, USER_ID, DOMAIN, WORKBASKET_KEY, POR_COMPANY, POR_SYSTEM, POR_INSTANCE, POR_TYPE, POR_VALUE, TASK_CLASSIFICATION_KEY, TASK_CLASSIFICATION_CATEGORY, ATTACHMENT_CLASSIFICATION_KEY, COMMENT, OLD_VALUE, NEW_VALUE, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, OLD_DATA, NEW_DATA) VALUES
|
||||
-- BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, TASK_ID, EVENT_TYPE, CREATED, USER_ID, DOMAIN, WORKBASKET_KEY, POR_COMPANY , POR_SYSTEM, POR_INSTANCE , POR_TYPE , POR_VALUE , TASK_CLASSIFICATION_KEY, TASK_CLASSIFICATION_CATEGORY , ATTACHMENT_CLASSIFICATION_KEY , COMMENT , OLD_VALUE , NEW_VALUE , CUSTOM_1 , CUSTOM_2 , CUSTOM_3 , CUSTOM_4 , OLD_DATA , NEW_DATA
|
||||
(1, 'BPI:01' ,'', 'TKI:000000000000000000000000000000000000', 'CREATE', CURRENT_TIMESTAMP, 'USER_2_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', 'L140101' , 'TASK' ,'' , 'this task has been created' ,'old_val' ,'new_val' ,'custom1' ,'custom2' , 'custom3' ,'custom4' ,'123' ,'456'),
|
||||
(2, 'BPI:02' ,'', 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -2, CURRENT_TIMESTAMP), 'USER_1_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '65464564', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'777'),
|
||||
(3, 'BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'119' ,'555'),
|
||||
(4, 'BPI:04' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'999'),
|
||||
(5, 'BPI:03' ,'BPI:02', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'1188' ,'QQQ'),
|
||||
(6, 'BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -6, CURRENT_TIMESTAMP), 'USER_2_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'eee'),
|
||||
(7, 'BPI:06' ,'BPI:04', 'TKI:000000000000000000000000000000000001', 'UPDATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'ZZZ' ,'777'),
|
||||
(8, 'BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'DELETE', DATEADD('DAY', -5, CURRENT_TIMESTAMP), 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'999'),
|
||||
(9, 'BPI:04' ,'BPI:03', 'TKI:000000000000000000000000000000000001', 'CREATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'288' ,'ooo'),
|
||||
(10, 'BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP), 'USER_1_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '65464564', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'SSS'),
|
||||
(11, 'BPI:04' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'DDD' ,'555'),
|
||||
(12, 'BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -2, CURRENT_TIMESTAMP), 'USER_1_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '68887564', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'555'),
|
||||
(13, 'BPI:03' ,'BPI:05', 'TKI:000000000000000000000000000000000001', 'UPDATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'123' ,'777'),
|
||||
(14, 'BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'DELETE', DATEADD('DAY', -5, CURRENT_TIMESTAMP), 'USER_2_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '68887564', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'456'),
|
||||
(15, 'BPI:03' ,'BPI:07', 'TKI:000000000000000000000000000000000001', 'CREATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'288' ,'ooo'),
|
||||
(16, 'BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP), 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'456'),
|
||||
(17, 'BPI:03' ,'BPI:07', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'PPP' ,'777'),
|
||||
(18, 'BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -5, CURRENT_TIMESTAMP), 'USER_1_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'999'),
|
||||
(19, 'BPI:05' ,'BPI:03', 'TKI:000000000000000000000000000000000001', 'UPDATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'123' ,'eee'),
|
||||
(20, 'BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -2, CURRENT_TIMESTAMP), 'USER_1_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'555'),
|
||||
(21, 'BPI:04' ,'BPI:04', 'TKI:000000000000000000000000000000000001', 'UPDATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'123' ,'555'),
|
||||
(22, 'BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -6, CURRENT_TIMESTAMP), 'USER_2_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '77887564', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'SSS'),
|
||||
(23, 'BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'PPP' ,'456'),
|
||||
(24, 'BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '77887500', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'777'),
|
||||
(25, 'BPI:05' ,'BPI:03', 'TKI:000000000000000000000000000000000001', 'CREATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'123' ,'ooo'),
|
||||
(26, 'BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'DELETE', DATEADD('DAY', -2, CURRENT_TIMESTAMP), 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '77887500', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'QQQ'),
|
||||
(27, 'BPI:05' ,'BPI:04', 'TKI:000000000000000000000000000000000001', 'UPDATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'288' ,'456'),
|
||||
(28, 'BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -5, CURRENT_TIMESTAMP), 'USER_2_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'555'),
|
||||
(29, 'BPI:03' ,'BPI:05', 'TKI:000000000000000000000000000000000001', 'UPDATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'000' ,'555'),
|
||||
(30, 'BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -6, CURRENT_TIMESTAMP), 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'777'),
|
||||
(31, 'BPI:04' ,'BPI:07', 'TKI:000000000000000000000000000000000001', 'UPDATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'PPP' ,'eee'),
|
||||
(32, 'BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -5, CURRENT_TIMESTAMP), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'999'),
|
||||
(33, 'BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'CREATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'PPP' ,'ooo'),
|
||||
(34, 'BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP), 'USER_1_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'555'),
|
||||
(35, 'BPI:05' ,'BPI:03', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'123' ,'777'),
|
||||
(36, 'BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP), 'USER_1_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '77887500', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'SSS'),
|
||||
(37, 'BPI:06' ,'BPI:07', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'123' ,'QQQ'),
|
||||
(38, 'BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP), 'USER_2_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11887500', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'456'),
|
||||
(39, 'BPI:03' ,'BPI:03', 'TKI:000000000000000000000000000000000001', 'CREATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'000' ,'999'),
|
||||
(40, 'BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'DELETE', DATEADD('DAY', -1, CURRENT_TIMESTAMP), 'USER_2_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11887599', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'eee'),
|
||||
(41, 'BPI:03' ,'BPI:04', 'TKI:000000000000000000000000000000000001', 'CREATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'aaa' ,'555'),
|
||||
(42, 'BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -6, CURRENT_TIMESTAMP), 'USER_1_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'555'),
|
||||
(43, 'BPI:06' ,'BPI:03', 'TKI:000000000000000000000000000000000001', 'UPDATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'acc' ,'ooo'),
|
||||
(44, 'BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'DELETE', DATEADD('DAY', -1, CURRENT_TIMESTAMP), 'USER_1_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'777'),
|
||||
(45, 'BPI:04' ,'BPI:03', 'TKI:000000000000000000000000000000000001', 'CREATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'acc' ,'999'),
|
||||
(46, 'BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'DELETE', DATEADD('DAY', -1, CURRENT_TIMESTAMP), 'USER_2_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11887599', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'999'),
|
||||
(47, 'BPI:03' ,'BPI:05', 'TKI:000000000000000000000000000000000001', 'UPDATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'WWW' ,'SSS'),
|
||||
(48, 'BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -5, CURRENT_TIMESTAMP), 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11887599', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'eee'),
|
||||
(49, 'BPI:06' ,'BPI:05', 'TKI:000000000000000000000000000000000001', 'UPDATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'123' ,'555'),
|
||||
(50, 'BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'DELETE', DATEADD('DAY', -1, CURRENT_TIMESTAMP), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'777');
|
|
@ -0,0 +1,23 @@
|
|||
package pro.taskana.historyPlugin.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl;
|
||||
|
||||
/**
|
||||
* Configuration for Taskana history REST service.
|
||||
*/
|
||||
@Configuration
|
||||
@ComponentScan
|
||||
@EnableTransactionManagement
|
||||
public class TaskHistoryRestConfiguration {
|
||||
|
||||
@Bean
|
||||
public SimpleHistoryServiceImpl getSimpleHistoryService() {
|
||||
return new SimpleHistoryServiceImpl();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,157 @@
|
|||
package pro.taskana.historyPlugin.doc.api;
|
||||
|
||||
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
|
||||
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration;
|
||||
import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest;
|
||||
import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
|
||||
import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint;
|
||||
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
|
||||
import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
|
||||
import static org.springframework.restdocs.payload.PayloadDocumentation.subsectionWithPath;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.web.server.LocalServerPort;
|
||||
import org.springframework.restdocs.JUnitRestDocumentation;
|
||||
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
||||
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
||||
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
|
||||
import pro.taskana.historyPlugin.config.TaskHistoryRestConfiguration;
|
||||
import pro.taskana.rest.RestConfiguration;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = {RestConfiguration.class, TaskHistoryRestConfiguration.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
public class TaskHistoryEventControllerRestDocumentation {
|
||||
|
||||
@LocalServerPort
|
||||
int port;
|
||||
|
||||
@Rule
|
||||
public JUnitRestDocumentation restDocumentation = new JUnitRestDocumentation();
|
||||
|
||||
@Autowired
|
||||
private WebApplicationContext context;
|
||||
|
||||
private MockMvc mockMvc;
|
||||
|
||||
private HashMap<String, String> taskHistoryEventFieldDescriptionsMap = new HashMap<String, String>();
|
||||
|
||||
private FieldDescriptor[] allTaskHistoryEventFieldDescriptors;
|
||||
private FieldDescriptor[] taskHistoryEventFieldDescriptors;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
document("{methodName}",
|
||||
preprocessRequest(prettyPrint()),
|
||||
preprocessResponse(prettyPrint()));
|
||||
|
||||
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
|
||||
.apply(documentationConfiguration(this.restDocumentation)
|
||||
.operationPreprocessors()
|
||||
.withResponseDefaults(prettyPrint())
|
||||
.withRequestDefaults(prettyPrint()))
|
||||
.build();
|
||||
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.taskHistoryId","Unique ID");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.businessProcessId","The id of the business process");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.parentBusinessProcessId","The id of the parent business process");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.taskId","The id of the task");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.eventType","The type of the event");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.created","The time was created");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.userId","The id of the user");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.domain","Domain");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.workbasketKey","The key of workbasket");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.porCompany","");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.porSystem","");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.porInstance","");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.porValue","");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.porType","");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.taskClassificationKey","The key of classification task");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.taskClassificationCategory","The category of classification");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.attachmentClassificationKey","");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.comment","");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.oldValue","The old value");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.newValue","The new value");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.custom1","A custom property with name \"1\"");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.custom2","A custom property with name \"2\"");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.custom3","A custom property with name \"3\"");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.custom4","A custom property with name \"4\"");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.oldData","The old data");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_embedded.newData","The new data");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_links.self.href","The links of this task history event");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_links.allTaskHistoryEvent.href","Link to all task history event");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_links.first.href","Link to the first result");
|
||||
taskHistoryEventFieldDescriptionsMap.put("_links.last.href","Link to the last result");
|
||||
|
||||
allTaskHistoryEventFieldDescriptors = new FieldDescriptor[] {
|
||||
subsectionWithPath("_embedded.taskHistoryEventResourceList").description("An array of Task history event"),
|
||||
fieldWithPath("_links.self.href").ignored(),
|
||||
fieldWithPath("page").ignored()
|
||||
};
|
||||
|
||||
taskHistoryEventFieldDescriptors = new FieldDescriptor[] {
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].taskHistoryId").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.taskHistoryId")),
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].businessProcessId").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.businessProcessId")),
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].parentBusinessProcessId").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.parentBusinessProcessId")),
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].taskId").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.taskId")),
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].eventType").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.eventType")),
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].created").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.created")),
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].userId").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.userId")),
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].domain").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.domain")),
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].workbasketKey").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.workbasketKey")),
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].porCompany").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.porCompany")),
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].porSystem").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.porSystem")),
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].porInstance").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.porInstance")),
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].porValue").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.porValue")),
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].porType").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.porType")),
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].taskClassificationKey").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.taskClassificationKey")),
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].taskClassificationCategory").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.taskClassificationCategory")),
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].attachmentClassificationKey").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.attachmentClassificationKey")),
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].comment").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.comment")),
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].oldValue").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.oldValue")),
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].newValue").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.newValue")),
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].custom1").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.custom1")),
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].custom2").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.custom2")),
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].custom3").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.custom3")),
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].custom4").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.custom4")),
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].oldData").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.oldData")),
|
||||
fieldWithPath("_embedded.taskHistoryEventResourceList[].newData").description(taskHistoryEventFieldDescriptionsMap.get("_embedded.newData")),
|
||||
fieldWithPath("_links.self.href").ignored(),
|
||||
fieldWithPath("page").ignored()
|
||||
};
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAllTaskHistoryEventDocTest() throws Exception {
|
||||
this.mockMvc.perform(
|
||||
RestDocumentationRequestBuilders.get("http://127.0.0.1:" + port + "/v1/task-history-event")
|
||||
.accept("application/hal+json")
|
||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||
.andDo(MockMvcRestDocumentation.document("GetAllTaskHistoryEventDocTest",
|
||||
responseFields(allTaskHistoryEventFieldDescriptors)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSpecificTaskHistoryEventDocTest() throws Exception {
|
||||
this.mockMvc.perform(RestDocumentationRequestBuilders.get(
|
||||
"http://127.0.0.1:" + port + "/v1/task-history-event?business-process-id=BPI:02")
|
||||
.accept("application/hal+json")
|
||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||
.andDo(MockMvcRestDocumentation.document("GetSpecificTaskHistoryEventDocTest",
|
||||
responseFields(taskHistoryEventFieldDescriptors)));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,154 @@
|
|||
package pro.taskana.historyPlugin.rest;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.web.server.LocalServerPort;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.hateoas.Link;
|
||||
import org.springframework.hateoas.PagedResources;
|
||||
import org.springframework.hateoas.hal.Jackson2HalModule;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import pro.taskana.historyPlugin.config.TaskHistoryRestConfiguration;
|
||||
import pro.taskana.rest.RestConfiguration;
|
||||
import pro.taskana.rest.resource.TaskHistoryEventResource;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = {RestConfiguration.class, TaskHistoryRestConfiguration.class},
|
||||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = {"devMode=true"})
|
||||
@ActiveProfiles(profiles = "history.plugin")
|
||||
public class TaskHistoryEventControllerIntTest {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(TaskHistoryEventControllerIntTest.class);
|
||||
String server = "http://127.0.0.1:";
|
||||
RestTemplate template;
|
||||
HttpEntity<String> request;
|
||||
@LocalServerPort
|
||||
int port;
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
template = getRestTemplate();
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
||||
request = new HttpEntity<String>(headers);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAllHistoryEvent() {
|
||||
ResponseEntity<PagedResources<TaskHistoryEventResource>> response = template.exchange(
|
||||
server + port + "/v1/task-history-event", HttpMethod.GET, request,
|
||||
new ParameterizedTypeReference<PagedResources<TaskHistoryEventResource>>() {
|
||||
});
|
||||
assertNotNull(response.getBody().getLink(Link.REL_SELF));
|
||||
assertEquals(50, response.getBody().getContent().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAllHistoryEventDescendingOrder() {
|
||||
String parameters = "/v1/task-history-event?sort-by=business-process-id&order=desc&page-size=6&page=1";
|
||||
ResponseEntity<PagedResources<TaskHistoryEventResource>> response = template.exchange(
|
||||
server + port + parameters, HttpMethod.GET, request,
|
||||
new ParameterizedTypeReference<PagedResources<TaskHistoryEventResource>>() {
|
||||
});
|
||||
assertNotNull(response.getBody().getLink(Link.REL_SELF));
|
||||
assertEquals(6, response.getBody().getContent().size());
|
||||
assertTrue(response.getBody()
|
||||
.getLink(Link.REL_SELF)
|
||||
.getHref()
|
||||
.endsWith(parameters));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSpecificTaskHistoryEvent() {
|
||||
ResponseEntity<PagedResources<TaskHistoryEventResource>> response = template.exchange(
|
||||
server + port + "/v1/task-history-event?business-process-id=BPI:01&sort-by=business-process-id&order=asc&page-size=6&page=1",
|
||||
HttpMethod.GET, request,
|
||||
new ParameterizedTypeReference<PagedResources<TaskHistoryEventResource>>() {
|
||||
});
|
||||
assertNotNull(response.getBody().getLink(Link.REL_SELF));
|
||||
assertNotNull(response.getBody().getLinks());
|
||||
assertNotNull(response.getBody().getMetadata());
|
||||
assertEquals(1, response.getBody().getContent().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testThrowsExceptionIfInvalidFilterIsUsed() {
|
||||
try {
|
||||
template.exchange(
|
||||
server + port + "/v1/task-history-event?invalid=BPI:01", HttpMethod.GET, request,
|
||||
new ParameterizedTypeReference<PagedResources<TaskHistoryEventResource>>() {
|
||||
});
|
||||
fail();
|
||||
} catch (HttpClientErrorException e) {
|
||||
assertEquals(HttpStatus.BAD_REQUEST, e.getStatusCode());
|
||||
assertTrue(e.getResponseBodyAsString().contains("[invalid]"));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSecondPageSortedByKey() {
|
||||
String parameters = "/v1/task-history-event?sort-by=workbasket-key&order=desc&page=2&page-size=2";
|
||||
ResponseEntity<PagedResources<TaskHistoryEventResource>> response = template.exchange(
|
||||
server + port + parameters, HttpMethod.GET, request,
|
||||
new ParameterizedTypeReference<PagedResources<TaskHistoryEventResource>>() {
|
||||
});
|
||||
assertEquals(2, response.getBody().getContent().size());
|
||||
assertEquals("WBI:100000000000000000000000000000000002", response.getBody().getContent().iterator().next().getWorkbasketKey());
|
||||
assertNotNull(response.getBody().getLink(Link.REL_SELF));
|
||||
assertTrue(response.getBody()
|
||||
.getLink(Link.REL_SELF)
|
||||
.getHref()
|
||||
.endsWith(parameters));
|
||||
assertNotNull(response.getBody().getLink("allTaskHistoryEvent"));
|
||||
assertTrue(response.getBody()
|
||||
.getLink("allTaskHistoryEvent")
|
||||
.getHref()
|
||||
.endsWith("/v1/task-history-event"));
|
||||
assertNotNull(response.getBody().getLink(Link.REL_FIRST));
|
||||
assertNotNull(response.getBody().getLink(Link.REL_LAST));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a REST template which is capable of dealing with responses in HAL format
|
||||
*
|
||||
* @return RestTemplate
|
||||
*/
|
||||
private RestTemplate getRestTemplate() {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
mapper.registerModule(new Jackson2HalModule());
|
||||
|
||||
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
|
||||
converter.setSupportedMediaTypes(MediaType.parseMediaTypes("application/hal+json"));
|
||||
converter.setObjectMapper(mapper);
|
||||
|
||||
RestTemplate template = new RestTemplate(Collections.<HttpMessageConverter<?>>singletonList(converter));
|
||||
return template;
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
logging.level.pro.taskana=INFO
|
|
@ -48,7 +48,7 @@
|
|||
<dependency>
|
||||
<groupId>pro.taskana.simplehistory</groupId>
|
||||
<artifactId>taskana-simplehistory-provider</artifactId>
|
||||
<version>0.0.4</version>
|
||||
<version>0.0.6</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
|
@ -162,6 +162,11 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-history-rest-spring</artifactId>
|
||||
<version>1.0.5-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
@ -299,6 +304,28 @@
|
|||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>copy-history-rest-spring-docs</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>
|
||||
${project.build.outputDirectory}/static/docs/rest
|
||||
</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>
|
||||
${project.build.directory}/generated-docs
|
||||
</directory>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>../taskana-history-rest-spring/target/apidocs</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
|
|
@ -784,3 +784,24 @@ include::../../../{snippets}/CommonSummaryResourceFields/http-request.adoc[]
|
|||
|
||||
include::../../../{snippets}/CommonSummaryResourceFields/response-body.adoc[]
|
||||
|
||||
== History event
|
||||
|
||||
=== Get all task history event
|
||||
|
||||
==== Example request
|
||||
|
||||
include::../../../{snippets}/GetAllTaskHistoryEventDocTest/http-request.adoc[]
|
||||
|
||||
==== Example response
|
||||
|
||||
include::../../../{snippets}/GetAllTaskHistoryEventDocTest/response-body.adoc[]
|
||||
|
||||
=== Get a specific task history event
|
||||
|
||||
==== Example request
|
||||
|
||||
include::../../../{snippets}/GetSpecificTaskHistoryEventDocTest/http-request.adoc[]
|
||||
|
||||
==== Example response
|
||||
|
||||
include::../../../{snippets}/GetSpecificTaskHistoryEventDocTest/response-body.adoc[]
|
||||
|
|
|
@ -73,9 +73,9 @@ public class ExampleRestApplication {
|
|||
}
|
||||
|
||||
@Bean
|
||||
@DependsOn("taskanaEngineConfiguration") // generate sample data after schema was inserted
|
||||
@DependsOn("getTaskanaEngine") // generate sample data after schema was inserted
|
||||
public SampleDataGenerator generateSampleData(DataSource dataSource) throws SQLException {
|
||||
SampleDataGenerator sampleDataGenerator = new SampleDataGenerator(dataSource);
|
||||
sampleDataGenerator = new SampleDataGenerator(dataSource);
|
||||
return sampleDataGenerator;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ public class SampleDataGenerator {
|
|||
private static final String CLASSIFICATION = SQL + TEST_DATA + "/classification.sql";
|
||||
private static final String OBJECT_REFERENCE = SQL + TEST_DATA + "/object-reference.sql";
|
||||
private static final String ATTACHMENT = SQL + TEST_DATA + "/attachment.sql";
|
||||
private static final String HISTORY_EVENT = SQL + TEST_DATA + "/history-event.sql";
|
||||
private ScriptRunner runner;
|
||||
|
||||
DataSource dataSource;
|
||||
|
@ -76,6 +77,8 @@ public class SampleDataGenerator {
|
|||
this.getClass().getResourceAsStream(WORKBASKET_ACCESS_LIST), StandardCharsets.UTF_8)));
|
||||
runner.runScript(new BufferedReader(
|
||||
new InputStreamReader(this.getClass().getResourceAsStream(OBJECT_REFERENCE), StandardCharsets.UTF_8)));
|
||||
runner.runScript(new BufferedReader(
|
||||
new InputStreamReader(this.getClass().getResourceAsStream(HISTORY_EVENT), StandardCharsets.UTF_8)));
|
||||
|
||||
runner.closeConnection();
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ DELETE FROM WORKBASKET;
|
|||
DELETE FROM DISTRIBUTION_TARGETS;
|
||||
DELETE FROM CLASSIFICATION;
|
||||
DELETE FROM OBJECT_REFERENCE;
|
||||
DELETE FROM HISTORY_EVENTS;
|
||||
-- do not clean JOB table
|
||||
-- DELETE FROM SCHEDULED_JOB;
|
||||
COMMIT;
|
||||
|
|
|
@ -7,5 +7,6 @@ DROP TABLE DISTRIBUTION_TARGETS;
|
|||
DROP TABLE CLASSIFICATION;
|
||||
DROP TABLE OBJECT_REFERENCE;
|
||||
DROP TABLE SCHEDULED_JOB;
|
||||
DROP TABLE HISTORY_EVENTS;
|
||||
DROP SEQUENCE SCHEDULED_JOB_SEQ;
|
||||
COMMIT;
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
SET SCHEMA TASKANA;
|
||||
|
||||
INSERT INTO HISTORY_EVENTS (BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, TASK_ID, EVENT_TYPE, CREATED, USER_ID, DOMAIN, WORKBASKET_KEY, POR_COMPANY, POR_SYSTEM, POR_INSTANCE, POR_TYPE, POR_VALUE, TASK_CLASSIFICATION_KEY, TASK_CLASSIFICATION_CATEGORY, ATTACHMENT_CLASSIFICATION_KEY, COMMENT, OLD_VALUE, NEW_VALUE, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, OLD_DATA, NEW_DATA) VALUES
|
||||
-- BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, TASK_ID, EVENT_TYPE, CREATED, USER_ID, DOMAIN, WORKBASKET_KEY, POR_COMPANY , POR_SYSTEM, POR_INSTANCE , POR_TYPE , POR_VALUE , TASK_CLASSIFICATION_KEY, TASK_CLASSIFICATION_CATEGORY , ATTACHMENT_CLASSIFICATION_KEY , COMMENT , OLD_VALUE , NEW_VALUE , CUSTOM_1 , CUSTOM_2 , CUSTOM_3 , CUSTOM_4 , OLD_DATA , NEW_DATA
|
||||
('BPI:01' ,'' ,'TKI:000000000000000000000000000000000000', 'CREATE', CURRENT_TIMESTAMP , 'USER_2_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', 'L140101' , 'TASK' ,'' , 'this task has been created' ,'old_val' ,'new_val' ,'custom1' ,'custom2' , 'custom3' ,'custom4' ,'123' ,'456'),
|
||||
('BPI:02' ,'' ,'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -2, CURRENT_TIMESTAMP),'USER_1_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'456'),
|
||||
('BPI:03' ,'BPI:01','TKI:000000000000000000000000000000000001', 'CREATE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'123' ,'456');
|
|
@ -9,6 +9,7 @@ import org.junit.runner.RunWith;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import pro.taskana.TaskanaEngine;
|
||||
|
@ -17,6 +18,7 @@ import pro.taskana.impl.TaskanaEngineImpl;
|
|||
import pro.taskana.rest.RestConfiguration;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@ActiveProfiles(profiles = "history.plugin")
|
||||
@SpringBootTest(classes = RestConfiguration.class)
|
||||
public class HistoryPluginLoaderTest {
|
||||
|
||||
|
|
|
@ -47,8 +47,8 @@ import pro.taskana.exceptions.InvalidArgumentException;
|
|||
import pro.taskana.rest.RestConfiguration;
|
||||
import pro.taskana.rest.resource.ClassificationResource;
|
||||
import pro.taskana.rest.resource.TaskResource;
|
||||
import pro.taskana.rest.resource.assembler.ClassificationResourceAssembler;
|
||||
import pro.taskana.rest.resource.assembler.TaskResourceAssembler;
|
||||
import pro.taskana.rest.resource.ClassificationResourceAssembler;
|
||||
import pro.taskana.rest.resource.TaskResourceAssembler;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = RestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT,
|
||||
|
|
|
@ -45,8 +45,8 @@ import pro.taskana.Task;
|
|||
import pro.taskana.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.rest.resource.ClassificationSummaryResource;
|
||||
import pro.taskana.rest.resource.TaskResource;
|
||||
import pro.taskana.rest.resource.assembler.ClassificationResourceAssembler;
|
||||
import pro.taskana.rest.resource.assembler.TaskResourceAssembler;
|
||||
import pro.taskana.rest.resource.ClassificationResourceAssembler;
|
||||
import pro.taskana.rest.resource.TaskResourceAssembler;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = RestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT,
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.springframework.http.HttpEntity;
|
|||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
@ -41,8 +40,8 @@ import ch.qos.logback.core.Appender;
|
|||
import pro.taskana.ldap.LdapCacheTestImpl;
|
||||
import pro.taskana.rest.resource.AccessIdResource;
|
||||
import pro.taskana.rest.resource.ClassificationSummaryResource;
|
||||
import pro.taskana.rest.resource.assembler.ClassificationResourceAssembler;
|
||||
import pro.taskana.rest.resource.assembler.TaskResourceAssembler;
|
||||
import pro.taskana.rest.resource.ClassificationResourceAssembler;
|
||||
import pro.taskana.rest.resource.TaskResourceAssembler;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = RestConfiguration.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = {
|
||||
|
|
|
@ -12,7 +12,6 @@ import org.junit.runner.RunWith;
|
|||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.boot.web.server.LocalServerPort;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.hateoas.hal.Jackson2HalModule;
|
||||
import org.springframework.http.HttpEntity;
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package pro.taskana.rest;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
@ -10,20 +7,13 @@ import java.util.Collections;
|
|||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.ibatis.jdbc.ScriptRunner;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runner.Runner;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import org.springframework.boot.web.server.LocalServerPort;
|
||||
import org.springframework.hateoas.hal.Jackson2HalModule;
|
||||
|
||||
import org.springframework.http.MediaType;
|
||||
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
|
|
@ -35,8 +35,8 @@ import pro.taskana.exceptions.InvalidArgumentException;
|
|||
import pro.taskana.exceptions.NotAuthorizedException;
|
||||
import pro.taskana.rest.resource.ClassificationResource;
|
||||
import pro.taskana.rest.resource.ClassificationSummaryResource;
|
||||
import pro.taskana.rest.resource.assembler.ClassificationResourceAssembler;
|
||||
import pro.taskana.rest.resource.assembler.ClassificationSummaryResourcesAssembler;
|
||||
import pro.taskana.rest.resource.ClassificationResourceAssembler;
|
||||
import pro.taskana.rest.resource.ClassificationSummaryResourcesAssembler;
|
||||
|
||||
/**
|
||||
* Controller for all {@link Classification} related endpoints.
|
||||
|
|
|
@ -23,7 +23,7 @@ import pro.taskana.exceptions.DomainNotFoundException;
|
|||
import pro.taskana.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.exceptions.NotAuthorizedException;
|
||||
import pro.taskana.rest.resource.ClassificationResource;
|
||||
import pro.taskana.rest.resource.assembler.ClassificationResourceAssembler;
|
||||
import pro.taskana.rest.resource.ClassificationResourceAssembler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
|
@ -22,7 +22,7 @@ import pro.taskana.impl.report.TimeIntervalColumnHeader;
|
|||
import pro.taskana.monitor.ClassificationTimeIntervalColumnHeader;
|
||||
import pro.taskana.monitor.WorkbasketTimeIntervalColumnHeader;
|
||||
import pro.taskana.rest.resource.ReportResource;
|
||||
import pro.taskana.rest.resource.assembler.ReportAssembler;
|
||||
import pro.taskana.rest.resource.ReportAssembler;
|
||||
|
||||
/**
|
||||
* Controller for all monitoring endpoints.
|
||||
|
|
|
@ -43,8 +43,8 @@ import pro.taskana.exceptions.TaskNotFoundException;
|
|||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||
import pro.taskana.rest.resource.TaskResource;
|
||||
import pro.taskana.rest.resource.TaskSummaryResource;
|
||||
import pro.taskana.rest.resource.assembler.TaskResourceAssembler;
|
||||
import pro.taskana.rest.resource.assembler.TaskSummaryResourcesAssembler;
|
||||
import pro.taskana.rest.resource.TaskResourceAssembler;
|
||||
import pro.taskana.rest.resource.TaskSummaryResourcesAssembler;
|
||||
|
||||
/**
|
||||
* Controller for all {@link Task} related endpoints.
|
||||
|
|
|
@ -24,7 +24,7 @@ import pro.taskana.exceptions.InvalidArgumentException;
|
|||
import pro.taskana.exceptions.NotAuthorizedException;
|
||||
import pro.taskana.ldap.LdapClient;
|
||||
import pro.taskana.rest.resource.WorkbasketAccessItemResource;
|
||||
import pro.taskana.rest.resource.assembler.WorkbasketAccessItemAssembler;
|
||||
import pro.taskana.rest.resource.WorkbasketAccessItemAssembler;
|
||||
|
||||
/**
|
||||
* Controller for Workbasket access.
|
||||
|
|
|
@ -44,11 +44,11 @@ import pro.taskana.rest.resource.DistributionTargetResource;
|
|||
import pro.taskana.rest.resource.WorkbasketAccessItemResource;
|
||||
import pro.taskana.rest.resource.WorkbasketResource;
|
||||
import pro.taskana.rest.resource.WorkbasketSummaryResource;
|
||||
import pro.taskana.rest.resource.assembler.DistributionTargetListAssembler;
|
||||
import pro.taskana.rest.resource.assembler.WorkbasketAccessItemAssembler;
|
||||
import pro.taskana.rest.resource.assembler.WorkbasketAccessItemListAssembler;
|
||||
import pro.taskana.rest.resource.assembler.WorkbasketResourceAssembler;
|
||||
import pro.taskana.rest.resource.assembler.WorkbasketSummaryResourcesAssembler;
|
||||
import pro.taskana.rest.resource.DistributionTargetListAssembler;
|
||||
import pro.taskana.rest.resource.WorkbasketAccessItemAssembler;
|
||||
import pro.taskana.rest.resource.WorkbasketAccessItemListAssembler;
|
||||
import pro.taskana.rest.resource.WorkbasketResourceAssembler;
|
||||
import pro.taskana.rest.resource.WorkbasketSummaryResourcesAssembler;
|
||||
|
||||
/**
|
||||
* Controller for all {@link Workbasket} related endpoints.
|
||||
|
|
|
@ -26,9 +26,9 @@ import pro.taskana.exceptions.WorkbasketNotFoundException;
|
|||
import pro.taskana.rest.resource.WorkbasketAccessItemResource;
|
||||
import pro.taskana.rest.resource.WorkbasketDefinition;
|
||||
import pro.taskana.rest.resource.WorkbasketResource;
|
||||
import pro.taskana.rest.resource.assembler.WorkbasketAccessItemAssembler;
|
||||
import pro.taskana.rest.resource.assembler.WorkbasketDefinitionAssembler;
|
||||
import pro.taskana.rest.resource.assembler.WorkbasketResourceAssembler;
|
||||
import pro.taskana.rest.resource.WorkbasketAccessItemAssembler;
|
||||
import pro.taskana.rest.resource.WorkbasketDefinitionAssembler;
|
||||
import pro.taskana.rest.resource.WorkbasketResourceAssembler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
package pro.taskana.rest.resource;
|
||||
|
||||
import java.util.Map;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
package pro.taskana.rest.resource;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -10,7 +10,6 @@ import org.springframework.stereotype.Component;
|
|||
import pro.taskana.Attachment;
|
||||
import pro.taskana.TaskService;
|
||||
import pro.taskana.impl.AttachmentImpl;
|
||||
import pro.taskana.rest.resource.AttachmentResource;
|
||||
|
||||
/**
|
||||
* Resource assembler for {@link AttachmentResource}.
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
package pro.taskana.rest.resource;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.hateoas.mvc.ResourceAssemblerSupport;
|
||||
|
@ -6,7 +6,6 @@ import org.springframework.stereotype.Component;
|
|||
|
||||
import pro.taskana.AttachmentSummary;
|
||||
import pro.taskana.rest.AttachmentController;
|
||||
import pro.taskana.rest.resource.AttachmentSummaryResource;
|
||||
|
||||
/**
|
||||
* Resource assembler for {@link AttachmentSummaryResource}.
|
|
@ -1,8 +1,7 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
package pro.taskana.rest.resource;
|
||||
|
||||
import java.util.List;
|
||||
import pro.taskana.AttachmentSummary;
|
||||
import pro.taskana.rest.resource.AttachmentSummaryResource;
|
||||
|
||||
/**
|
||||
* Resources assembler for {@link AttachmentSummaryResource}.
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
package pro.taskana.rest.resource;
|
||||
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
|
||||
|
@ -19,7 +19,6 @@ import pro.taskana.exceptions.InvalidArgumentException;
|
|||
import pro.taskana.exceptions.NotAuthorizedException;
|
||||
import pro.taskana.impl.ClassificationImpl;
|
||||
import pro.taskana.rest.ClassificationController;
|
||||
import pro.taskana.rest.resource.ClassificationResource;
|
||||
|
||||
/**
|
||||
* Transforms {@link Classification} to its resource counterpart {@link ClassificationResource} and vice versa.
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
package pro.taskana.rest.resource;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -9,7 +9,6 @@ import pro.taskana.ClassificationService;
|
|||
import pro.taskana.ClassificationSummary;
|
||||
import pro.taskana.impl.ClassificationImpl;
|
||||
import pro.taskana.rest.ClassificationController;
|
||||
import pro.taskana.rest.resource.ClassificationSummaryResource;
|
||||
|
||||
/**
|
||||
* Resource assembler for {@link ClassificationSummaryResource}.
|
|
@ -1,7 +1,7 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
package pro.taskana.rest.resource;
|
||||
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
||||
import static pro.taskana.rest.resource.assembler.AbstractRessourcesAssembler.getBuilderForOriginalUri;
|
||||
import static pro.taskana.rest.resource.AbstractRessourcesAssembler.getBuilderForOriginalUri;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -12,7 +12,6 @@ import org.springframework.web.util.UriComponentsBuilder;
|
|||
|
||||
import pro.taskana.ClassificationSummary;
|
||||
import pro.taskana.rest.ClassificationController;
|
||||
import pro.taskana.rest.resource.ClassificationSummaryResource;
|
||||
|
||||
/**
|
||||
* @author HH
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
package pro.taskana.rest.resource;
|
||||
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
|
||||
|
@ -15,7 +15,6 @@ import pro.taskana.WorkbasketSummary;
|
|||
import pro.taskana.exceptions.NotAuthorizedException;
|
||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||
import pro.taskana.rest.WorkbasketController;
|
||||
import pro.taskana.rest.resource.DistributionTargetResource;
|
||||
|
||||
/**
|
||||
* Mapper to convert from a list of WorkbasketSummary to a workbasket list resource.
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
package pro.taskana.rest.resource;
|
||||
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
|
||||
|
@ -10,7 +10,6 @@ import pro.taskana.WorkbasketSummary;
|
|||
import pro.taskana.exceptions.NotAuthorizedException;
|
||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||
import pro.taskana.rest.WorkbasketController;
|
||||
import pro.taskana.rest.resource.DistributionTargetResource;
|
||||
|
||||
/**
|
||||
* Transforms WorkbasketSummary to its resource counterpart DistributionTargerResource and vice versa.
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
package pro.taskana.rest.resource;
|
||||
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
|
||||
|
@ -23,7 +23,6 @@ import pro.taskana.report.ClassificationReport;
|
|||
import pro.taskana.report.WorkbasketReport;
|
||||
|
||||
import pro.taskana.rest.MonitorController;
|
||||
import pro.taskana.rest.resource.ReportResource;
|
||||
|
||||
/**
|
||||
* Transforms any {@link Report} into its {@link ReportResource}.
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
package pro.taskana.rest.resource;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Objects;
|
||||
|
@ -15,7 +15,6 @@ import pro.taskana.exceptions.InvalidArgumentException;
|
|||
import pro.taskana.exceptions.SystemException;
|
||||
import pro.taskana.impl.TaskImpl;
|
||||
import pro.taskana.rest.TaskController;
|
||||
import pro.taskana.rest.resource.TaskResource;
|
||||
|
||||
/**
|
||||
* Resource assembler for {@link TaskResource}.
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
package pro.taskana.rest.resource;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.hateoas.mvc.ResourceAssemblerSupport;
|
||||
|
@ -7,7 +7,6 @@ import pro.taskana.TaskSummary;
|
|||
import pro.taskana.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.exceptions.SystemException;
|
||||
import pro.taskana.rest.TaskController;
|
||||
import pro.taskana.rest.resource.TaskSummaryResource;
|
||||
|
||||
/**
|
||||
* Resource assembler for {@link TaskSummaryResource}.
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
package pro.taskana.rest.resource;
|
||||
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
||||
|
||||
|
@ -10,7 +10,6 @@ import org.springframework.hateoas.PagedResources.PageMetadata;
|
|||
|
||||
import pro.taskana.TaskSummary;
|
||||
import pro.taskana.rest.TaskController;
|
||||
import pro.taskana.rest.resource.TaskSummaryResource;
|
||||
|
||||
/**
|
||||
* Resources assembler for {@link TaskSummaryResource}.
|
|
@ -1,8 +1,8 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
package pro.taskana.rest.resource;
|
||||
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
|
||||
import static pro.taskana.rest.resource.assembler.AbstractRessourcesAssembler.getBuilderForOriginalUri;
|
||||
import static pro.taskana.rest.resource.AbstractRessourcesAssembler.getBuilderForOriginalUri;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -19,7 +19,6 @@ import pro.taskana.exceptions.NotAuthorizedException;
|
|||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||
import pro.taskana.impl.WorkbasketAccessItemImpl;
|
||||
import pro.taskana.rest.WorkbasketController;
|
||||
import pro.taskana.rest.resource.WorkbasketAccessItemResource;
|
||||
|
||||
/**
|
||||
* Transforms {@link WorkbasketAccessItem} to its resource counterpart {@link WorkbasketAccessItemResource} and vice
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
package pro.taskana.rest.resource;
|
||||
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
|
||||
|
@ -15,7 +15,6 @@ import pro.taskana.WorkbasketAccessItem;
|
|||
import pro.taskana.exceptions.NotAuthorizedException;
|
||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||
import pro.taskana.rest.WorkbasketController;
|
||||
import pro.taskana.rest.resource.WorkbasketAccessItemResource;
|
||||
|
||||
/**
|
||||
* Mapper to convert from a list of WorkbasketAccessItem to a WorkbasketAccessItemResource.
|
|
@ -1,11 +1,10 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
package pro.taskana.rest.resource;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.hateoas.mvc.ResourceAssemblerSupport;
|
||||
|
||||
import pro.taskana.WorkbasketAccessItem;
|
||||
import pro.taskana.rest.WorkbasketAccessItemController;
|
||||
import pro.taskana.rest.resource.WorkbasketAccessItemResource;
|
||||
|
||||
/**
|
||||
* Mapper to convert from a list of WorkbasketAccessItem to a WorkbasketAccessItemResource.
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
package pro.taskana.rest.resource;
|
||||
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
|
||||
|
@ -19,8 +19,6 @@ import pro.taskana.WorkbasketSummary;
|
|||
import pro.taskana.exceptions.NotAuthorizedException;
|
||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||
import pro.taskana.rest.WorkbasketDefinitionController;
|
||||
import pro.taskana.rest.resource.WorkbasketAccessItemResource;
|
||||
import pro.taskana.rest.resource.WorkbasketDefinition;
|
||||
|
||||
/**
|
||||
* Transforms {@link Workbasket} into a {@link WorkbasketDefinition}
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
package pro.taskana.rest.resource;
|
||||
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
|
||||
|
@ -15,7 +15,6 @@ import pro.taskana.exceptions.NotAuthorizedException;
|
|||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||
import pro.taskana.impl.WorkbasketImpl;
|
||||
import pro.taskana.rest.WorkbasketController;
|
||||
import pro.taskana.rest.resource.WorkbasketResource;
|
||||
|
||||
/**
|
||||
* Transforms {@link Workbasket} to its resource counterpart {@link WorkbasketResource} and vice versa.
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
package pro.taskana.rest.resource;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -9,7 +9,6 @@ import pro.taskana.WorkbasketService;
|
|||
import pro.taskana.WorkbasketSummary;
|
||||
import pro.taskana.impl.WorkbasketImpl;
|
||||
import pro.taskana.rest.WorkbasketController;
|
||||
import pro.taskana.rest.resource.WorkbasketSummaryResource;
|
||||
|
||||
/**
|
||||
* @author HH
|
|
@ -1,7 +1,6 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
package pro.taskana.rest.resource;
|
||||
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
||||
import static pro.taskana.rest.resource.assembler.AbstractRessourcesAssembler.getBuilderForOriginalUri;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -12,7 +11,6 @@ import org.springframework.web.util.UriComponentsBuilder;
|
|||
|
||||
import pro.taskana.WorkbasketSummary;
|
||||
import pro.taskana.rest.WorkbasketController;
|
||||
import pro.taskana.rest.resource.WorkbasketSummaryResource;
|
||||
|
||||
/**
|
||||
* @author HH
|
||||
|
@ -31,7 +29,7 @@ public class WorkbasketSummaryResourcesAssembler {
|
|||
resources,
|
||||
pageMetadata);
|
||||
|
||||
UriComponentsBuilder original = getBuilderForOriginalUri();
|
||||
UriComponentsBuilder original = AbstractRessourcesAssembler.getBuilderForOriginalUri();
|
||||
pagedResources.add(new Link(original.toUriString()).withSelfRel());
|
||||
if (pageMetadata != null) {
|
||||
pagedResources.add(linkTo(WorkbasketController.class).withRel("allWorkbaskets"));
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
package pro.taskana.rest.resource;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
|
@ -20,7 +20,6 @@ import pro.taskana.exceptions.InvalidArgumentException;
|
|||
import pro.taskana.exceptions.NotAuthorizedException;
|
||||
import pro.taskana.impl.ClassificationImpl;
|
||||
import pro.taskana.rest.TestConfiguration;
|
||||
import pro.taskana.rest.resource.ClassificationResource;
|
||||
|
||||
/**
|
||||
* Test for {@link ClassificationResourceAssembler}.
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
package pro.taskana.rest.resource;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
@ -14,7 +14,6 @@ import pro.taskana.exceptions.NotAuthorizedException;
|
|||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||
import pro.taskana.impl.WorkbasketAccessItemImpl;
|
||||
import pro.taskana.rest.TestConfiguration;
|
||||
import pro.taskana.rest.resource.WorkbasketAccessItemResource;
|
||||
|
||||
/**
|
||||
* Test for {@link WorkbasketAccessItemAssembler}.
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
package pro.taskana.rest.resource;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
|
@ -17,7 +17,6 @@ import pro.taskana.exceptions.NotAuthorizedException;
|
|||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||
import pro.taskana.impl.WorkbasketImpl;
|
||||
import pro.taskana.rest.TestConfiguration;
|
||||
import pro.taskana.rest.resource.WorkbasketResource;
|
||||
|
||||
/**
|
||||
* Test for {@link WorkbasketResourceAssembler}.
|
|
@ -1,4 +1,4 @@
|
|||
package pro.taskana.rest.resource.assembler;
|
||||
package pro.taskana.rest.resource;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
@ -12,7 +12,6 @@ import pro.taskana.WorkbasketService;
|
|||
import pro.taskana.WorkbasketType;
|
||||
import pro.taskana.impl.WorkbasketSummaryImpl;
|
||||
import pro.taskana.rest.TestConfiguration;
|
||||
import pro.taskana.rest.resource.WorkbasketSummaryResource;
|
||||
|
||||
/**
|
||||
* Test for {@link WorkbasketSummaryResourceAssembler}.
|
|
@ -0,0 +1 @@
|
|||
logging.level.pro.taskana=INFO
|
Loading…
Reference in New Issue