diff --git a/.travis.yml b/.travis.yml index 8f258d324..ce54bdffc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -56,6 +56,7 @@ jobs: && ci/release.sh lib/taskana-cdi $TRAVIS_TAG && ci/release.sh web/ $TRAVIS_TAG && ci/release.sh rest/taskana-rest-spring $TRAVIS_TAG + && ci/release.sh rest/taskana-rest-spring-base $TRAVIS_TAG if: repo = env(DEPLOY_REPO) AND (tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ OR branch = master) AND type != pull_request - stage: "Release / Deploy" name: "Update Pom's stage" diff --git a/ci/test.sh b/ci/test.sh index 2524b592c..3e16eadd4 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -31,8 +31,9 @@ function main { mvn clean verify -q -f $REL/../lib/ -B mvn clean install -q -f $REL/../rest/ -B -P history.plugin elif [[ "$1" == "POSTGRES_10_4" ]]; then - mvn clean verify -q -f $REL/../lib/taskana-core -B - mvn clean install -q -f $REL/../rest/ -B -P postgres + mvn clean install -q -f $REL/../lib/ -B -DskipTests=true -Dmaven.javadoc.skip=true + mvn clean install -q -f $REL/../rest/ -B -DskipTests=true -pl !taskana-rest-spring-wildfly-example -Dmaven.javadoc.skip=true + mvn clean install -q -f $REL/../rest/ -B -pl taskana-rest-spring-wildfly-example -Dmaven.javadoc.skip=true -P postgres else mvn clean verify -q -f $REL/../lib/taskana-core -B fi diff --git a/rest/pom.xml b/rest/pom.xml index 6c92fda88..b72a0c14a 100644 --- a/rest/pom.xml +++ b/rest/pom.xml @@ -15,8 +15,7 @@ taskana-rest-spring ../web - taskana-history-rest-spring - taskana-rest-spring-setup + taskana-rest-spring-base taskana-rest-spring-example taskana-rest-spring-wildfly-example diff --git a/rest/taskana-history-rest-spring/pom.xml b/rest/taskana-history-rest-spring/pom.xml deleted file mode 100644 index dad4a1011..000000000 --- a/rest/taskana-history-rest-spring/pom.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - 4.0.0 - - pro.taskana - taskana-history-rest-spring - 1.0.8-SNAPSHOT - - - - org.springframework.boot - spring-boot-maven-plugin - - - org.apache.maven.plugins - maven-surefire-plugin - - - **/*Test.java - **/*Documentation.java - - - -Xms1024m -Xmx2048m - - - - org.asciidoctor - asciidoctor-maven-plugin - 1.5.3 - - - generate-docs - prepare-package - - process-asciidoc - - - html - book - - target/generated-snippets - shared - - - - - - - - - - org.springframework.boot - spring-boot-starter-parent - 2.0.2.RELEASE - - - - - - pro.taskana.simplehistory - taskana-simplehistory-provider - 0.0.6 - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-jdbc - - - org.springframework.plugin - spring-plugin-core - - - com.h2database - h2 - 1.4.197 - - - - - org.springframework.boot - spring-boot-starter-test - test - - - org.springframework.security - spring-security-test - test - - - org.springframework.restdocs - spring-restdocs-mockmvc - test - - - org.springframework.boot - spring-boot-starter-thymeleaf - - - org.springframework.hateoas - spring-hateoas - 0.24.0.RELEASE - compile - - - pro.taskana - taskana-spring - ${project.version} - compile - - - pro.taskana - taskana-rest-spring - ${project.version} - compile - - - \ No newline at end of file diff --git a/rest/taskana-history-rest-spring/src/main/asciidoc/docinfo.html b/rest/taskana-history-rest-spring/src/main/asciidoc/docinfo.html deleted file mode 100644 index a702c4972..000000000 --- a/rest/taskana-history-rest-spring/src/main/asciidoc/docinfo.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/rest/taskana-history-rest-spring/src/main/asciidoc/rest-api.adoc b/rest/taskana-history-rest-spring/src/main/asciidoc/rest-api.adoc deleted file mode 100644 index 326b6e729..000000000 --- a/rest/taskana-history-rest-spring/src/main/asciidoc/rest-api.adoc +++ /dev/null @@ -1,97 +0,0 @@ -= Taskana RESTful API Documentation -taskana.pro; -:doctype: book -:icons: font -:source-highlighter: highlightjs -:toc: left -:toclevels: 4 -:sectlinks: - -= Overview - -[big]#*This Documentation is still under development and probably incomplete and/or flawed in certain areas.*# - -== HTTP verbs - -The Taskana RESTful API tries to adhere as closely as possible to standard HTTP and REST conventions in its -use of HTTP verbs. - -|=== -| Verb | Usage - -| `GET` -| Used to retrieve a resource - -| `POST` -| Used to create a new resource - -| `PUT` -| Used to update a resource - -| `DELETE` -| Used to delete a existing resource -|=== - -== HTTP status codes - -The Taskana RESTful API tries to adhere as closely as possible to standard HTTP and REST conventions in its -use of HTTP status codes. - -|=== -| Status code | Usage - -| `200 OK` -| The request completed successfully. - -| `201 Created` -| The request completed successfully und create the new resource. - -| `204 No Content` -| The request completed successfully and there is no content to send in the response payload. - -| `400 Bad Request` -| The request was not performed because of a client error like a invalid parameter. - -| `401 Unauthorized` -| The request has not been applied because it lacks valid authentication credentials for the target resource. - -| `403 FORBIDDEN` -| The current user has no read permission for . - -| `404 Not Found` -| The requested resource did not exist. - -| `405 Method not allowed` -| The method used in this request is can not be used on this resource. - -| `406` Not acceptable -| Wrong content-type in request header. - -| `409 Conflict` -| The resource could not be updatet or created because of a conflict with an existing one. - -| `415 Unsupported Media Type` -| The content of the request can't be understood due to being in an unsupported media-type. -|=== - -== 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[] diff --git a/rest/taskana-history-rest-spring/src/main/java/pro/taskana/rest/ExampleRestApplication.java b/rest/taskana-history-rest-spring/src/main/java/pro/taskana/rest/ExampleRestApplication.java deleted file mode 100644 index f1988e1e4..000000000 --- a/rest/taskana-history-rest-spring/src/main/java/pro/taskana/rest/ExampleRestApplication.java +++ /dev/null @@ -1,72 +0,0 @@ -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); - } -} diff --git a/rest/taskana-history-rest-spring/src/main/java/pro/taskana/rest/TaskHistoryEventController.java b/rest/taskana-history-rest-spring/src/main/java/pro/taskana/rest/TaskHistoryEventController.java deleted file mode 100644 index d75ce09ed..000000000 --- a/rest/taskana-history-rest-spring/src/main/java/pro/taskana/rest/TaskHistoryEventController.java +++ /dev/null @@ -1,413 +0,0 @@ -package pro.taskana.rest; - -import java.time.Instant; -import java.time.format.DateTimeFormatter; -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -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.impl.util.LoggerUtils; -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 Logger LOGGER = LoggerFactory.getLogger(TaskHistoryEventController.class); - - 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-key"; - private static final String ATTACHMENT_CLASSIFICATION_KEY_LIKE = "attachment-classification-key-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> getTaskHistoryEvent( - @RequestParam MultiValueMap params) throws InvalidArgumentException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Entry to getTaskHistoryEvent(params= {})", LoggerUtils.mapToString(params)); - } - - HistoryQuery query = simpleHistoryService.createHistoryQuery(); - query = applySortingParams(query, params); - query = applyFilterParams(query, params); - - PageMetadata pageMetadata = null; - List 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 pagedResources = assembler.toResources(historyEvents, pageMetadata); - - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from getTaskHistoryEvent(), returning {}", new ResponseEntity<>(pagedResources, HttpStatus.OK)); - } - - return new ResponseEntity<>(pagedResources, HttpStatus.OK); - } - - private HistoryQuery applySortingParams(HistoryQuery query, MultiValueMap params) - throws IllegalArgumentException, InvalidArgumentException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Entry to applySortingParams(params= {})", LoggerUtils.mapToString(params)); - } - - 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); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from applySortingParams(), returning {}", query); - } - - return query; - } - - private HistoryQuery applyFilterParams(HistoryQuery query, - MultiValueMap params) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Entry to applyFilterParams(query= {}, params= {})", query, 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); - } - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from applyFilterParams(), returning {}", query); - } - - return query; - } -} diff --git a/rest/taskana-history-rest-spring/src/main/java/pro/taskana/rest/resource/TaskHistoryEventAssembler.java b/rest/taskana-history-rest-spring/src/main/java/pro/taskana/rest/resource/TaskHistoryEventAssembler.java deleted file mode 100644 index ff9729fff..000000000 --- a/rest/taskana-history-rest-spring/src/main/java/pro/taskana/rest/resource/TaskHistoryEventAssembler.java +++ /dev/null @@ -1,29 +0,0 @@ -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 { - - 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; - } -} diff --git a/rest/taskana-history-rest-spring/src/main/java/pro/taskana/rest/resource/TaskHistoryEventListAssembler.java b/rest/taskana-history-rest-spring/src/main/java/pro/taskana/rest/resource/TaskHistoryEventListAssembler.java deleted file mode 100644 index 9773c00f1..000000000 --- a/rest/taskana-history-rest-spring/src/main/java/pro/taskana/rest/resource/TaskHistoryEventListAssembler.java +++ /dev/null @@ -1,53 +0,0 @@ -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 toResources(List historyEvents, - PagedResources.PageMetadata pageMetadata) { - - TaskHistoryEventAssembler assembler = new TaskHistoryEventAssembler(); - List resources = assembler.toResources(historyEvents); - PagedResources pagedResources = new PagedResources( - 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; - } -} diff --git a/rest/taskana-history-rest-spring/src/main/java/pro/taskana/rest/resource/TaskHistoryEventResource.java b/rest/taskana-history-rest-spring/src/main/java/pro/taskana/rest/resource/TaskHistoryEventResource.java deleted file mode 100644 index ad01322f1..000000000 --- a/rest/taskana-history-rest-spring/src/main/java/pro/taskana/rest/resource/TaskHistoryEventResource.java +++ /dev/null @@ -1,266 +0,0 @@ -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; - } - - @Override - public String toString() { - return "TaskHistoryEventResource [" - + "taskHistoryEventId= " + this.taskHistoryEventId - + "businessProcessId= " + this.businessProcessId - + "parentBusinessProcessId= " + this.parentBusinessProcessId - + "taskId= " + this.taskId - + "eventType= " + this.eventType - + "created= " + this.created - + "userId= " + this.userId - + "domain= " + this.domain - + "workbasketKey= " + this.workbasketKey - + "oldValue= " + this.oldValue - + "newValue= " + this.newValue - + "oldData= " + this.oldData - + "newData= " + this.newData - + "]"; - } -} diff --git a/rest/taskana-history-rest-spring/src/main/java/pro/taskana/rest/sampledata/SampleDataGenerator.java b/rest/taskana-history-rest-spring/src/main/java/pro/taskana/rest/sampledata/SampleDataGenerator.java deleted file mode 100644 index 5b7bbd453..000000000 --- a/rest/taskana-history-rest-spring/src/main/java/pro/taskana/rest/sampledata/SampleDataGenerator.java +++ /dev/null @@ -1,75 +0,0 @@ -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 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 + ";"); - } - -} diff --git a/rest/taskana-history-rest-spring/src/main/resources/application.properties b/rest/taskana-history-rest-spring/src/main/resources/application.properties deleted file mode 100644 index c98e26959..000000000 --- a/rest/taskana-history-rest-spring/src/main/resources/application.properties +++ /dev/null @@ -1,2 +0,0 @@ -logging.level.pro.taskana=INFO -taskana.schemaName=TASKANA diff --git a/rest/taskana-history-rest-spring/src/main/resources/sql.sample-data/clear-db.sql b/rest/taskana-history-rest-spring/src/main/resources/sql.sample-data/clear-db.sql deleted file mode 100644 index 51424d47a..000000000 --- a/rest/taskana-history-rest-spring/src/main/resources/sql.sample-data/clear-db.sql +++ /dev/null @@ -1,3 +0,0 @@ --- the order is important! -DELETE FROM HISTORY_EVENTS; -COMMIT; diff --git a/rest/taskana-history-rest-spring/src/main/resources/sql.sample-data/drop-tables.sql b/rest/taskana-history-rest-spring/src/main/resources/sql.sample-data/drop-tables.sql deleted file mode 100644 index ca8ef04c8..000000000 --- a/rest/taskana-history-rest-spring/src/main/resources/sql.sample-data/drop-tables.sql +++ /dev/null @@ -1,4 +0,0 @@ -DROP TABLE TASKANA_SCHEMA_VERSION; -DROP TABLE HISTORY_EVENTS; - -COMMIT; diff --git a/rest/taskana-history-rest-spring/src/main/resources/sql.sample-data/history-event.sql b/rest/taskana-history-rest-spring/src/main/resources/sql.sample-data/history-event.sql deleted file mode 100644 index 764be4353..000000000 --- a/rest/taskana-history-rest-spring/src/main/resources/sql.sample-data/history-event.sql +++ /dev/null @@ -1,7 +0,0 @@ -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'); diff --git a/rest/taskana-history-rest-spring/src/test/java/pro/taskana/historyPlugin/config/TaskHistoryRestConfiguration.java b/rest/taskana-history-rest-spring/src/test/java/pro/taskana/historyPlugin/config/TaskHistoryRestConfiguration.java deleted file mode 100644 index 7044d1f48..000000000 --- a/rest/taskana-history-rest-spring/src/test/java/pro/taskana/historyPlugin/config/TaskHistoryRestConfiguration.java +++ /dev/null @@ -1,23 +0,0 @@ -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(); - } - -} diff --git a/rest/taskana-history-rest-spring/src/test/java/pro/taskana/historyPlugin/doc/api/TaskHistoryEventControllerRestDocumentation.java b/rest/taskana-history-rest-spring/src/test/java/pro/taskana/historyPlugin/doc/api/TaskHistoryEventControllerRestDocumentation.java deleted file mode 100644 index ae9d4fb32..000000000 --- a/rest/taskana-history-rest-spring/src/test/java/pro/taskana/historyPlugin/doc/api/TaskHistoryEventControllerRestDocumentation.java +++ /dev/null @@ -1,160 +0,0 @@ -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; - -/** - * Controller for Rest documentation. - */ -@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 taskHistoryEventFieldDescriptionsMap = new HashMap(); - - 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))); - } -} diff --git a/rest/taskana-history-rest-spring/src/test/java/pro/taskana/historyPlugin/rest/TaskHistoryEventControllerIntTest.java b/rest/taskana-history-rest-spring/src/test/java/pro/taskana/historyPlugin/rest/TaskHistoryEventControllerIntTest.java deleted file mode 100644 index 3232c3875..000000000 --- a/rest/taskana-history-rest-spring/src/test/java/pro/taskana/historyPlugin/rest/TaskHistoryEventControllerIntTest.java +++ /dev/null @@ -1,161 +0,0 @@ -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; - -/** - * Controller for integration test. - */ - -@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 request; - @LocalServerPort - int port; - - @Before - public void before() { - template = getRestTemplate(); - HttpHeaders headers = new HttpHeaders(); - headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"); - request = new HttpEntity(headers); - } - - @Test - public void testGetAllHistoryEvent() { - ResponseEntity> response = template.exchange( - server + port + "/v1/task-history-event", HttpMethod.GET, request, - new ParameterizedTypeReference>() { - }); - assertNotNull(response.getBody().getLink(Link.REL_SELF)); - assertEquals(3, response.getBody().getContent().size()); - } - - @Test - public void testGetAllHistoryEventDescendingOrder() { - String parameters = "/v1/task-history-event?sort-by=business-process-id&order=desc&page-size=3&page=1"; - ResponseEntity> response = template.exchange( - server + port + parameters, HttpMethod.GET, request, - new ParameterizedTypeReference>() { - }); - assertNotNull(response.getBody().getLink(Link.REL_SELF)); - assertEquals(3, response.getBody().getContent().size()); - assertTrue(response.getBody() - .getLink(Link.REL_SELF) - .getHref() - .endsWith(parameters)); - } - - @Test - public void testGetSpecificTaskHistoryEvent() { - ResponseEntity> 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>() { - - }); - 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>() { - }); - 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> response = template.exchange( - server + port + parameters, HttpMethod.GET, request, - new ParameterizedTypeReference>() { - - }); - assertEquals(1, response.getBody().getContent().size()); - assertEquals("WBI:100000000000000000000000000000000001", - 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.>singletonList(converter)); - return template; - } -} diff --git a/rest/taskana-history-rest-spring/src/test/resources/application.properties b/rest/taskana-history-rest-spring/src/test/resources/application.properties deleted file mode 100644 index 4da1feb99..000000000 --- a/rest/taskana-history-rest-spring/src/test/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ -logging.level.pro.taskana=INFO diff --git a/rest/taskana-rest-spring-setup/pom.xml b/rest/taskana-rest-spring-base/pom.xml similarity index 52% rename from rest/taskana-rest-spring-setup/pom.xml rename to rest/taskana-rest-spring-base/pom.xml index 595d26a90..0a7f1b714 100644 --- a/rest/taskana-rest-spring-setup/pom.xml +++ b/rest/taskana-rest-spring-base/pom.xml @@ -2,14 +2,120 @@ + 4.0.0 + + taskana-rest-spring-base + + ${project.groupId}:${project.artifactId} + The taskana rest spring base configuration for a spring based web application. + http://taskana.pro + taskana-rest-parent pro.taskana 1.0.8-SNAPSHOT - 4.0.0 - taskana-rest-spring-setup + + + The Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + + Holger Hagen + holger.hagen@novatec-gmbh.de + NovaTec Consulting GmbH + https://www.novatec-gmbh.de + + + + + scm:git:git://github.com/taskana/taskana.git + scm:git:ssh://github.com:taskana/taskana.git + http://github.com/taskana/taskana/tree/master + + + + + snapshot + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.8 + true + + ossrh + https://oss.sonatype.org/ + false + + + + + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + + + release + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.8 + true + + ossrh + https://oss.sonatype.org/ + false + + + + + + + ossrh + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + diff --git a/rest/taskana-rest-spring-setup/src/main/java/pro/taskana/jobs/JobScheduler.java b/rest/taskana-rest-spring-base/src/main/java/pro/taskana/jobs/JobScheduler.java similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/java/pro/taskana/jobs/JobScheduler.java rename to rest/taskana-rest-spring-base/src/main/java/pro/taskana/jobs/JobScheduler.java diff --git a/rest/taskana-rest-spring-setup/src/main/java/pro/taskana/jobs/TransactionalJobsConfiguration.java b/rest/taskana-rest-spring-base/src/main/java/pro/taskana/jobs/TransactionalJobsConfiguration.java similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/java/pro/taskana/jobs/TransactionalJobsConfiguration.java rename to rest/taskana-rest-spring-base/src/main/java/pro/taskana/jobs/TransactionalJobsConfiguration.java diff --git a/rest/taskana-rest-spring-setup/src/main/java/pro/taskana/ldap/LdapCacheTestImpl.java b/rest/taskana-rest-spring-base/src/main/java/pro/taskana/ldap/LdapCacheTestImpl.java similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/java/pro/taskana/ldap/LdapCacheTestImpl.java rename to rest/taskana-rest-spring-base/src/main/java/pro/taskana/ldap/LdapCacheTestImpl.java diff --git a/rest/taskana-rest-spring-setup/src/main/java/pro/taskana/rest/WebMvcConfig.java b/rest/taskana-rest-spring-base/src/main/java/pro/taskana/rest/WebMvcConfig.java similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/java/pro/taskana/rest/WebMvcConfig.java rename to rest/taskana-rest-spring-base/src/main/java/pro/taskana/rest/WebMvcConfig.java diff --git a/rest/taskana-rest-spring-setup/src/main/java/pro/taskana/rest/controllers/LoginController.java b/rest/taskana-rest-spring-base/src/main/java/pro/taskana/rest/controllers/LoginController.java similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/java/pro/taskana/rest/controllers/LoginController.java rename to rest/taskana-rest-spring-base/src/main/java/pro/taskana/rest/controllers/LoginController.java diff --git a/rest/taskana-rest-spring-setup/src/main/java/pro/taskana/rest/controllers/ViewController.java b/rest/taskana-rest-spring-base/src/main/java/pro/taskana/rest/controllers/ViewController.java similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/java/pro/taskana/rest/controllers/ViewController.java rename to rest/taskana-rest-spring-base/src/main/java/pro/taskana/rest/controllers/ViewController.java diff --git a/rest/taskana-rest-spring-setup/src/main/java/pro/taskana/rest/models/User.java b/rest/taskana-rest-spring-base/src/main/java/pro/taskana/rest/models/User.java similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/java/pro/taskana/rest/models/User.java rename to rest/taskana-rest-spring-base/src/main/java/pro/taskana/rest/models/User.java diff --git a/rest/taskana-rest-spring-setup/src/main/java/pro/taskana/rest/security/SampleLoginModule.java b/rest/taskana-rest-spring-base/src/main/java/pro/taskana/rest/security/SampleLoginModule.java similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/java/pro/taskana/rest/security/SampleLoginModule.java rename to rest/taskana-rest-spring-base/src/main/java/pro/taskana/rest/security/SampleLoginModule.java diff --git a/rest/taskana-rest-spring-setup/src/main/java/pro/taskana/rest/security/SampleRoleGranter.java b/rest/taskana-rest-spring-base/src/main/java/pro/taskana/rest/security/SampleRoleGranter.java similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/java/pro/taskana/rest/security/SampleRoleGranter.java rename to rest/taskana-rest-spring-base/src/main/java/pro/taskana/rest/security/SampleRoleGranter.java diff --git a/rest/taskana-rest-spring-setup/src/main/java/pro/taskana/rest/security/WebSecurityConfig.java b/rest/taskana-rest-spring-base/src/main/java/pro/taskana/rest/security/WebSecurityConfig.java similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/java/pro/taskana/rest/security/WebSecurityConfig.java rename to rest/taskana-rest-spring-base/src/main/java/pro/taskana/rest/security/WebSecurityConfig.java diff --git a/rest/taskana-rest-spring-setup/src/main/java/pro/taskana/sampledata/SampleDataGenerator.java b/rest/taskana-rest-spring-base/src/main/java/pro/taskana/sampledata/SampleDataGenerator.java similarity index 99% rename from rest/taskana-rest-spring-setup/src/main/java/pro/taskana/sampledata/SampleDataGenerator.java rename to rest/taskana-rest-spring-base/src/main/java/pro/taskana/sampledata/SampleDataGenerator.java index 118cfe8d8..cebb173ee 100644 --- a/rest/taskana-rest-spring-setup/src/main/java/pro/taskana/sampledata/SampleDataGenerator.java +++ b/rest/taskana-rest-spring-base/src/main/java/pro/taskana/sampledata/SampleDataGenerator.java @@ -74,8 +74,6 @@ public class SampleDataGenerator { runner.setStopOnError(false); runner.runScript(new BufferedReader( new InputStreamReader(this.getClass().getResourceAsStream(CLEAR), StandardCharsets.UTF_8))); - runner.runScript(new BufferedReader( - new InputStreamReader(this.getClass().getResourceAsStream(CLEAR_HISTORY_EVENTS), StandardCharsets.UTF_8))); } catch (Exception e) { LOGGER.error("caught Exception {}", e); } @@ -156,9 +154,11 @@ public class SampleDataGenerator { runner.runScript(new BufferedReader( new InputStreamReader(this.getClass().getResourceAsStream(CHECK_HISTORY_EVENT_EXIST), StandardCharsets.UTF_8))); + runner.runScript(new BufferedReader( + new InputStreamReader(this.getClass().getResourceAsStream(CLEAR_HISTORY_EVENTS), StandardCharsets.UTF_8))); scriptsList.add(HISTORY_EVENT); } catch (Exception e) { - LOGGER.info("The HISTORY_EVENTS table is not created"); + LOGGER.error("The HISTORY_EVENTS table is not created"); } return scriptsList.toArray(new String[0]); } diff --git a/rest/taskana-rest-spring-setup/src/main/resources/sql/sample-data/attachment.sql b/rest/taskana-rest-spring-base/src/main/resources/sql/sample-data/attachment.sql similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/resources/sql/sample-data/attachment.sql rename to rest/taskana-rest-spring-base/src/main/resources/sql/sample-data/attachment.sql diff --git a/rest/taskana-rest-spring-example/src/main/resources/sql/sample-data/check-history-event-exist.sql b/rest/taskana-rest-spring-base/src/main/resources/sql/sample-data/check-history-event-exist.sql similarity index 100% rename from rest/taskana-rest-spring-example/src/main/resources/sql/sample-data/check-history-event-exist.sql rename to rest/taskana-rest-spring-base/src/main/resources/sql/sample-data/check-history-event-exist.sql diff --git a/rest/taskana-rest-spring-setup/src/main/resources/sql/sample-data/classification.sql b/rest/taskana-rest-spring-base/src/main/resources/sql/sample-data/classification.sql similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/resources/sql/sample-data/classification.sql rename to rest/taskana-rest-spring-base/src/main/resources/sql/sample-data/classification.sql diff --git a/rest/taskana-rest-spring-setup/src/main/resources/sql/sample-data/clear-db.sql b/rest/taskana-rest-spring-base/src/main/resources/sql/sample-data/clear-db.sql similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/resources/sql/sample-data/clear-db.sql rename to rest/taskana-rest-spring-base/src/main/resources/sql/sample-data/clear-db.sql diff --git a/rest/taskana-rest-spring-setup/src/main/resources/sql/sample-data/clear-history-events.sql b/rest/taskana-rest-spring-base/src/main/resources/sql/sample-data/clear-history-events.sql similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/resources/sql/sample-data/clear-history-events.sql rename to rest/taskana-rest-spring-base/src/main/resources/sql/sample-data/clear-history-events.sql diff --git a/rest/taskana-rest-spring-setup/src/main/resources/sql/sample-data/distribution-targets.sql b/rest/taskana-rest-spring-base/src/main/resources/sql/sample-data/distribution-targets.sql similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/resources/sql/sample-data/distribution-targets.sql rename to rest/taskana-rest-spring-base/src/main/resources/sql/sample-data/distribution-targets.sql diff --git a/rest/taskana-rest-spring-setup/src/main/resources/sql/sample-data/drop-tables.sql b/rest/taskana-rest-spring-base/src/main/resources/sql/sample-data/drop-tables.sql similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/resources/sql/sample-data/drop-tables.sql rename to rest/taskana-rest-spring-base/src/main/resources/sql/sample-data/drop-tables.sql diff --git a/rest/taskana-rest-spring-setup/src/main/resources/sql/sample-data/history-event.sql b/rest/taskana-rest-spring-base/src/main/resources/sql/sample-data/history-event.sql similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/resources/sql/sample-data/history-event.sql rename to rest/taskana-rest-spring-base/src/main/resources/sql/sample-data/history-event.sql diff --git a/rest/taskana-rest-spring-setup/src/main/resources/sql/sample-data/object-reference.sql b/rest/taskana-rest-spring-base/src/main/resources/sql/sample-data/object-reference.sql similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/resources/sql/sample-data/object-reference.sql rename to rest/taskana-rest-spring-base/src/main/resources/sql/sample-data/object-reference.sql diff --git a/rest/taskana-rest-spring-setup/src/main/resources/sql/sample-data/task.sql b/rest/taskana-rest-spring-base/src/main/resources/sql/sample-data/task.sql similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/resources/sql/sample-data/task.sql rename to rest/taskana-rest-spring-base/src/main/resources/sql/sample-data/task.sql diff --git a/rest/taskana-rest-spring-setup/src/main/resources/sql/sample-data/workbasket-access-list.sql b/rest/taskana-rest-spring-base/src/main/resources/sql/sample-data/workbasket-access-list.sql similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/resources/sql/sample-data/workbasket-access-list.sql rename to rest/taskana-rest-spring-base/src/main/resources/sql/sample-data/workbasket-access-list.sql diff --git a/rest/taskana-rest-spring-setup/src/main/resources/sql/sample-data/workbasket.sql b/rest/taskana-rest-spring-base/src/main/resources/sql/sample-data/workbasket.sql similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/resources/sql/sample-data/workbasket.sql rename to rest/taskana-rest-spring-base/src/main/resources/sql/sample-data/workbasket.sql diff --git a/rest/taskana-rest-spring-setup/src/main/resources/static/css/bootstrap/4.1.3/bootstrap.min.css b/rest/taskana-rest-spring-base/src/main/resources/static/css/bootstrap/4.1.3/bootstrap.min.css similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/resources/static/css/bootstrap/4.1.3/bootstrap.min.css rename to rest/taskana-rest-spring-base/src/main/resources/static/css/bootstrap/4.1.3/bootstrap.min.css diff --git a/rest/taskana-rest-spring-setup/src/main/resources/static/css/main.css b/rest/taskana-rest-spring-base/src/main/resources/static/css/main.css similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/resources/static/css/main.css rename to rest/taskana-rest-spring-base/src/main/resources/static/css/main.css diff --git a/rest/taskana-rest-spring-setup/src/main/resources/static/environments/data-sources/environment-information.json b/rest/taskana-rest-spring-base/src/main/resources/static/environments/data-sources/environment-information.json similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/resources/static/environments/data-sources/environment-information.json rename to rest/taskana-rest-spring-base/src/main/resources/static/environments/data-sources/environment-information.json diff --git a/rest/taskana-rest-spring-setup/src/main/resources/static/environments/data-sources/taskana-customization.json b/rest/taskana-rest-spring-base/src/main/resources/static/environments/data-sources/taskana-customization.json similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/resources/static/environments/data-sources/taskana-customization.json rename to rest/taskana-rest-spring-base/src/main/resources/static/environments/data-sources/taskana-customization.json diff --git a/rest/taskana-rest-spring-setup/src/main/resources/static/img/logo.png b/rest/taskana-rest-spring-base/src/main/resources/static/img/logo.png similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/resources/static/img/logo.png rename to rest/taskana-rest-spring-base/src/main/resources/static/img/logo.png diff --git a/rest/taskana-rest-spring-setup/src/main/resources/templates/login.html b/rest/taskana-rest-spring-base/src/main/resources/templates/login.html similarity index 100% rename from rest/taskana-rest-spring-setup/src/main/resources/templates/login.html rename to rest/taskana-rest-spring-base/src/main/resources/templates/login.html diff --git a/rest/taskana-rest-spring-example/pom.xml b/rest/taskana-rest-spring-example/pom.xml index 4973ac53d..2f0ce369d 100644 --- a/rest/taskana-rest-spring-example/pom.xml +++ b/rest/taskana-rest-spring-example/pom.xml @@ -36,9 +36,9 @@ - pro.taskana - taskana-history-rest-spring - ${project.version} + pro.taskana.simplehistory + taskana-simplehistory-rest-spring + 0.0.9 @@ -150,7 +150,7 @@ pro.taskana - taskana-rest-spring-setup + taskana-rest-spring-base ${project.version} diff --git a/rest/taskana-rest-spring-wildfly-example/pom.xml b/rest/taskana-rest-spring-wildfly-example/pom.xml index 1a89694c5..88168d496 100644 --- a/rest/taskana-rest-spring-wildfly-example/pom.xml +++ b/rest/taskana-rest-spring-wildfly-example/pom.xml @@ -40,7 +40,7 @@ pro.taskana - taskana-rest-spring-setup + taskana-rest-spring-base ${project.version}