Closes #2622: Extend OpenAPI with History and Routing Doc

This commit is contained in:
James Reynaldi 2024-07-23 16:35:00 +02:00 committed by Jörg Heffner
parent bbad969a9b
commit 944c73f9c1
7 changed files with 537 additions and 4 deletions

View File

@ -1,9 +1,15 @@
package pro.taskana.simplehistory.rest;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import jakarta.servlet.http.HttpServletRequest;
import java.beans.ConstructorProperties;
import java.util.List;
import java.util.function.BiConsumer;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.MediaTypes;
import org.springframework.hateoas.config.EnableHypermediaSupport;
@ -57,13 +63,31 @@ public class TaskHistoryEventController {
* @param pagingParameter the paging parameters
* @return the Task History Events with the given filter, sort and paging options.
*/
@Operation(
summary = "Get a list of all Task History Events",
description =
"This endpoint retrieves a list of existing Task History Events. Filters can be applied.",
parameters = {
@Parameter(name = "page", example = "1"),
@Parameter(name = "page-size", example = "3")
},
responses = {
@ApiResponse(
responseCode = "200",
description = "the Task History Events with the given filter, sort and paging options.",
content = {
@Content(
mediaType = MediaTypes.HAL_JSON_VALUE,
schema = @Schema(implementation = TaskHistoryEventPagedRepresentationModel.class))
})
})
@GetMapping(path = HistoryRestEndpoints.URL_HISTORY_EVENTS, produces = MediaTypes.HAL_JSON_VALUE)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<TaskHistoryEventPagedRepresentationModel> getTaskHistoryEvents(
HttpServletRequest request,
TaskHistoryQueryFilterParameter filterParameter,
TaskHistoryQuerySortParameter sortParameter,
QueryPagingParameter<TaskHistoryEvent, TaskHistoryQuery> pagingParameter) {
@ParameterObject TaskHistoryQueryFilterParameter filterParameter,
@ParameterObject TaskHistoryQuerySortParameter sortParameter,
@ParameterObject QueryPagingParameter<TaskHistoryEvent, TaskHistoryQuery> pagingParameter) {
QueryParamsValidator.validateParams(
request,
@ -92,6 +116,26 @@ public class TaskHistoryEventController {
* @throws TaskanaHistoryEventNotFoundException If a Task History Event can't be found by the
* provided historyEventId
*/
@Operation(
summary = "Get a single Task History Event",
description = "This endpoint retrieves a single Task History Event.",
parameters = {
@Parameter(
name = "historyEventId",
description = "the Id of the requested Task History Event.",
example = "THI:000000000000000000000000000000000000",
required = true),
},
responses = {
@ApiResponse(
responseCode = "200",
description = "the requested Task History Event",
content = {
@Content(
mediaType = MediaTypes.HAL_JSON_VALUE,
schema = @Schema(implementation = TaskHistoryEventRepresentationModel.class))
})
})
@GetMapping(path = HistoryRestEndpoints.URL_HISTORY_EVENTS_ID)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<TaskHistoryEventRepresentationModel> getTaskHistoryEvent(

View File

@ -3,6 +3,7 @@ package pro.taskana.simplehistory.rest;
import static java.util.Optional.ofNullable;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import java.beans.ConstructorProperties;
import java.time.Instant;
import pro.taskana.common.api.exceptions.InvalidArgumentException;
@ -11,8 +12,154 @@ import pro.taskana.simplehistory.impl.task.TaskHistoryQuery;
import pro.taskana.spi.history.api.events.task.TaskHistoryCustomField;
public class TaskHistoryQueryFilterParameter implements QueryParameter<TaskHistoryQuery, Void> {
public String[] getEventType() {
return eventType;
}
public String[] getEventTypeLike() {
return eventTypeLike;
}
public String[] getUserId() {
return userId;
}
public String[] getUserIdLike() {
return userIdLike;
}
public Instant[] getCreated() {
return created;
}
public String[] getDomain() {
return domain;
}
public String[] getTaskId() {
return taskId;
}
public String[] getTaskIdLike() {
return taskIdLike;
}
public String[] getBusinessProcessId() {
return businessProcessId;
}
public String[] getBusinessProcessIdLike() {
return businessProcessIdLike;
}
public String[] getParentBusinessProcessId() {
return parentBusinessProcessId;
}
public String[] getParentBusinessProcessIdLike() {
return parentBusinessProcessIdLike;
}
public String[] getTaskClassificationKey() {
return taskClassificationKey;
}
public String[] getTaskClassificationKeyLike() {
return taskClassificationKeyLike;
}
public String[] getTaskClassificationCategory() {
return taskClassificationCategory;
}
public String[] getTaskClassificationCategoryLike() {
return taskClassificationCategoryLike;
}
public String[] getAttachmentClassificationKey() {
return attachmentClassificationKey;
}
public String[] getAttachmentClassificationKeyLike() {
return attachmentClassificationKeyLike;
}
public String[] getWorkbasketKey() {
return workbasketKey;
}
public String[] getWorkbasketKeyLike() {
return workbasketKeyLike;
}
public String[] getPorCompany() {
return porCompany;
}
public String[] getPorCompanyLike() {
return porCompanyLike;
}
public String[] getPorSystem() {
return porSystem;
}
public String[] getPorSystemLike() {
return porSystemLike;
}
public String[] getPorInstance() {
return porInstance;
}
public String[] getPorInstanceLike() {
return porInstanceLike;
}
public String[] getPorValue() {
return porValue;
}
public String[] getPorValueLike() {
return porValueLike;
}
public String[] getCustom1() {
return custom1;
}
public String[] getCustom1Like() {
return custom1Like;
}
public String[] getCustom2() {
return custom2;
}
public String[] getCustom2Like() {
return custom2Like;
}
public String[] getCustom3() {
return custom3;
}
public String[] getCustom3Like() {
return custom3Like;
}
public String[] getCustom4() {
return custom4;
}
public String[] getCustom4Like() {
return custom4Like;
}
/** Filter by the event type of the Task History Event. This is an exact match. */
@Schema(
name = "event-type",
description = "Filter by the event type of the Task History Event. This is an exact match.")
@JsonProperty("event-type")
private final String[] eventType;
@ -21,10 +168,19 @@ public class TaskHistoryQueryFilterParameter implements QueryParameter<TaskHisto
* appended to the beginning and end of the requested value). Further SQL "LIKE" wildcard
* characters will be resolved correctly.
*/
@Schema(
name = "event-type-like",
description =
"Filter by the event type of the Task History Event. This results in a substring search.."
+ " (% is appended to the beginning and end of the requested value). Further SQL "
+ "\"LIKE\" wildcard characters will be resolved correctly.")
@JsonProperty("event-type-like")
private final String[] eventTypeLike;
/** Filter by the user id of the Task History Event. This is an exact match. */
@Schema(
name = "user-id",
description = "Filter by the user id of the Task History Event. This is an exact match.")
@JsonProperty("user-id")
private final String[] userId;
@ -33,6 +189,12 @@ public class TaskHistoryQueryFilterParameter implements QueryParameter<TaskHisto
* appended to the beginning and end of the requested value). Further SQL "LIKE" wildcard
* characters will be resolved correctly.
*/
@Schema(
name = "user-id-like",
description =
"Filter by the user id of the Task History Event. This results in a substring search.. "
+ "(% is appended to the beginning and end of the requested value). Further SQL "
+ "\"LIKE\" wildcard characters will be resolved correctly.")
@JsonProperty("user-id-like")
private final String[] userIdLike;
@ -42,12 +204,24 @@ public class TaskHistoryQueryFilterParameter implements QueryParameter<TaskHisto
*
* <p>The format is ISO-8601.
*/
@Schema(
name = "created",
description =
"Filter by a created time interval. The length of the provided values has to be even. To "
+ "create an open interval you can either use 'null' or just leave it blank.<p>The "
+ "format is ISO-8601.")
private final Instant[] created;
/** Filter by the domain of the Task History Event. This is an exact match. */
@Schema(
name = "domain",
description = "Filter by the domain of the Task History Event. This is an exact match.")
private final String[] domain;
/** Filter by the task id of the Task History Event. This is an exact match. */
@Schema(
name = "task-id",
description = "Filter by the task id of the Task History Event. This is an exact match.")
@JsonProperty("task-id")
private final String[] taskId;
@ -56,10 +230,20 @@ public class TaskHistoryQueryFilterParameter implements QueryParameter<TaskHisto
* appended to the beginning and end of the requested value). Further SQL "LIKE" wildcard
* characters will be resolved correctly.
*/
@Schema(
name = "task-id-like",
description =
"Filter by the task id of the Task History Event. This results in a substring search.. (%"
+ " is appended to the beginning and end of the requested value). Further SQL "
+ "\"LIKE\" wildcard characters will be resolved correctly.")
@JsonProperty("task-id-like")
private final String[] taskIdLike;
/** Filter by the business process id of the Task History Event. This is an exact match. */
@Schema(
name = "business-process-id",
description =
"Filter by the business process id of the Task History Event. This is an exact match.")
@JsonProperty("business-process-id")
private final String[] businessProcessId;
@ -68,10 +252,21 @@ public class TaskHistoryQueryFilterParameter implements QueryParameter<TaskHisto
* search. (% is appended to the beginning and end of the requested value). Further SQL "LIKE"
* wildcard characters will be resolved correctly.
*/
@Schema(
name = "business-process-id-like",
description =
"Filter by the business process id of the Task History Event. This results into a "
+ "substring search. (% is appended to the beginning and end of the requested value)."
+ " Further SQL \"LIKE\" wildcard characters will be resolved correctly.")
@JsonProperty("business-process-id-like")
private final String[] businessProcessIdLike;
/** Filter by the parent business process id of the Task History Event. This is an exact match. */
@Schema(
name = "parent-business-process-id",
description =
"Filter by the parent business process id of the Task History Event. This is an exact "
+ "match.")
@JsonProperty("parent-business-process-id")
private final String[] parentBusinessProcessId;
@ -80,10 +275,21 @@ public class TaskHistoryQueryFilterParameter implements QueryParameter<TaskHisto
* substring search. (% is appended to the beginning and end of the requested value). Further SQL
* "Like" wildcard characters will be resolved correctly.
*/
@Schema(
name = "parent-business-process-id-like",
description =
"Filter by the parent business process id of the Task History Event. This results into a "
+ "substring search. (% is appended to the beginning and end of the requested value)."
+ " Further SQL \"Like\" wildcard characters will be resolved correctly.")
@JsonProperty("parent-business-process-id-like")
private final String[] parentBusinessProcessIdLike;
/** Filter by the task classification key of the Task History Event. This is an exact match. */
@Schema(
name = "task-classification-key",
description =
"Filter by the task classification key of the Task History Event. This is an exact "
+ "match.")
@JsonProperty("task-classification-key")
private final String[] taskClassificationKey;
@ -92,12 +298,23 @@ public class TaskHistoryQueryFilterParameter implements QueryParameter<TaskHisto
* search. (% is appended to the beginning and end of the requested value). Further SQL "LIKE"
* wildcard characters will be resolved correctly.
*/
@Schema(
name = "task-classification-key-like",
description =
"Filter by the task classification key of the Task History Event. This results into a "
+ "substring search. (% is appended to the beginning and end of the requested value)."
+ " Further SQL \"LIKE\" wildcard characters will be resolved correctly.")
@JsonProperty("task-classification-key-like")
private final String[] taskClassificationKeyLike;
/**
* Filter by the task classification category of the Task History Event. This is an exact match.
*/
@Schema(
name = "task-classification-category",
description =
"Filter by the task classification category of the Task History Event. This is an exact "
+ "match.")
@JsonProperty("task-classification-category")
private final String[] taskClassificationCategory;
@ -106,12 +323,23 @@ public class TaskHistoryQueryFilterParameter implements QueryParameter<TaskHisto
* substring search. (% is appended to the beginning and end of the requested value). Further SQL
* "Like" wildcard characters will be resolved correctly.
*/
@Schema(
name = "task-classification-category-like",
description =
"Filter by the task classification category of the Task History Event. This results into "
+ "a substring search. (% is appended to the beginning and end of the requested "
+ "value). Further SQL \"Like\" wildcard characters will be resolved correctly.")
@JsonProperty("task-classification-category-like")
private final String[] taskClassificationCategoryLike;
/**
* Filter by the attachment classification key of the Task History Event. This is an exact match.
*/
@Schema(
name = "attachment-classification-key",
description =
"Filter by the attachment classification key of the Task History Event. This is an exact "
+ "match.")
@JsonProperty("attachment-classification-key")
private final String[] attachmentClassificationKey;
@ -120,10 +348,20 @@ public class TaskHistoryQueryFilterParameter implements QueryParameter<TaskHisto
* substring search. (% is appended to the beginning and end of the requested value). Further SQL
* "Like" wildcard characters will be resolved correctly.
*/
@Schema(
name = "attachment-classification-key-like",
description =
"Filter by the attachment classification key of the Task History Event. This results into"
+ " a substring search. (% is appended to the beginning and end of the requested "
+ "value). Further SQL \"Like\" wildcard characters will be resolved correctly.")
@JsonProperty("attachment-classification-key-like")
private final String[] attachmentClassificationKeyLike;
/** Filter by the workbasket key of the Task History Event. This is an exact match. */
@Schema(
name = "workbasket-key",
description =
"Filter by the workbasket key of the Task History Event. This is an exact match.")
@JsonProperty("workbasket-key")
private final String[] workbasketKey;
@ -132,6 +370,12 @@ public class TaskHistoryQueryFilterParameter implements QueryParameter<TaskHisto
* is appended to the beginning and end of the requested value). Further SQL "LIKE" wildcard
* characters will be resolved correctly.
*/
@Schema(
name = "workbasket-key-like",
description =
"Filter by the workbasket key of the Task History Event. This results in a substring "
+ "search.. (% is appended to the beginning and end of the requested value). Further "
+ "SQL \"LIKE\" wildcard characters will be resolved correctly.")
@JsonProperty("workbasket-key-like")
private final String[] workbasketKeyLike;
@ -139,6 +383,11 @@ public class TaskHistoryQueryFilterParameter implements QueryParameter<TaskHisto
* Filter by the company of the primary object reference of the Task History Event. This is an
* exact match.
*/
@Schema(
name = "por-company",
description =
"* Filter by the company of the primary object reference of the Task History Event. This "
+ "is an exact match.")
@JsonProperty("por-company")
private final String[] porCompany;
@ -147,6 +396,13 @@ public class TaskHistoryQueryFilterParameter implements QueryParameter<TaskHisto
* into a substring search. (% is appended to the beginning and end of the requested value).
* Further SQL "LIKE" wildcard characters will be resolved correctly.
*/
@Schema(
name = "por-company-like",
description =
"Filter by the company of the primary object reference of the Task History Event. This "
+ "results into a substring search. (% is appended to the beginning and end of the "
+ "requested value). Further SQL \"LIKE\" wildcard characters will be resolved "
+ "correctly.")
@JsonProperty("por-company-like")
private final String[] porCompanyLike;
@ -154,6 +410,11 @@ public class TaskHistoryQueryFilterParameter implements QueryParameter<TaskHisto
* Filter by the system of the primary object reference of the Task History Event. This is an
* exact match.
*/
@Schema(
name = "por-system",
description =
"Filter by the system of the primary object reference of the Task History Event. This is "
+ "an exact match.")
@JsonProperty("por-system")
private final String[] porSystem;
@ -162,6 +423,13 @@ public class TaskHistoryQueryFilterParameter implements QueryParameter<TaskHisto
* into a substring search. (% is appended to the beginning and end of the requested value).
* Further SQL "LIKE" wildcard characters will be resolved correctly.
*/
@Schema(
name = "por-system-like",
description =
"Filter by the system of the primary object reference of the Task History Event. This "
+ "results into a substring search. (% is appended to the beginning and end of the "
+ "requested value). Further SQL \"LIKE\" wildcard characters will be resolved "
+ "correctly.")
@JsonProperty("por-system-like")
private final String[] porSystemLike;
@ -169,6 +437,11 @@ public class TaskHistoryQueryFilterParameter implements QueryParameter<TaskHisto
* Filter by the system instance of the primary object reference of the Task History Event. This
* is an exact match.
*/
@Schema(
name = "por-instance",
description =
"Filter by the system instance of the primary object reference of the Task History Event."
+ " This is an exact match.")
@JsonProperty("por-instance")
private final String[] porInstance;
@ -177,6 +450,13 @@ public class TaskHistoryQueryFilterParameter implements QueryParameter<TaskHisto
* results into a substring search. (% is appended to the beginning and end of the requested
* value). Further SQL "LIKE" wildcard characters will be resolved correctly.
*/
@Schema(
name = "por-instance-like",
description =
"Filter by the system instance of the primary object reference of the Task History Event."
+ " This results into a substring search. (% is appended to the beginning and end of "
+ "the requested value). Further SQL \"LIKE\" wildcard characters will be resolved "
+ "correctly.")
@JsonProperty("por-instance-like")
private final String[] porInstanceLike;
@ -184,6 +464,11 @@ public class TaskHistoryQueryFilterParameter implements QueryParameter<TaskHisto
* Filter by the value of the primary object reference of the Task History Event. This is an exact
* match.
*/
@Schema(
name = "por-value",
description =
"Filter by the value of the primary object reference of the Task History Event. This is "
+ "an exact match.")
@JsonProperty("por-value")
private final String[] porValue;
@ -192,10 +477,20 @@ public class TaskHistoryQueryFilterParameter implements QueryParameter<TaskHisto
* into a substring search. (% is appended to the beginning and end of the requested value).
* Further SQL "LIKE" wildcard characters will be resolved correctly.
*/
@Schema(
name = "por-value-like",
description =
"Filter by the value of the primary object reference of the Task History Event. This "
+ "results into a substring search. (% is appended to the beginning and end of the "
+ "requested value). Further SQL \"LIKE\" wildcard characters will be resolved "
+ "correctly.")
@JsonProperty("por-value-like")
private final String[] porValueLike;
/** Filter by the value of the field custom1. This is an exact match. */
@Schema(
name = "custom-1",
description = "Filter by the value of the field custom1. This is an exact match.")
@JsonProperty("custom-1")
private final String[] custom1;
@ -204,10 +499,19 @@ public class TaskHistoryQueryFilterParameter implements QueryParameter<TaskHisto
* search. (% is appended to the beginning and end of the requested value). Further SQL "LIKE"
* wildcard characters will be resolved correctly.
*/
@Schema(
name = "custom-1-like",
description =
"Filter by the value of the field custom1. This is an exact match. This results into a "
+ "substring search. (% is appended to the beginning and end of the requested value)."
+ " Further SQL \"LIKE\" wildcard characters will be resolved correctly.")
@JsonProperty("custom-1-like")
private final String[] custom1Like;
/** Filter by the value of the field custom2. This is an exact match. */
@Schema(
name = "custom-2",
description = "Filter by the value of the field custom2. This is an exact match.")
@JsonProperty("custom-2")
private final String[] custom2;
@ -216,10 +520,19 @@ public class TaskHistoryQueryFilterParameter implements QueryParameter<TaskHisto
* search. (% is appended to the beginning and end of the requested value). Further SQL "LIKE"
* wildcard characters will be resolved correctly.
*/
@Schema(
name = "custom-2-like",
description =
"Filter by the value of the field custom2. This is an exact match. This results into a "
+ "substring search. (% is appended to the beginning and end of the requested value)."
+ " Further SQL \"LIKE\" wildcard characters will be resolved correctly.")
@JsonProperty("custom-2-like")
private final String[] custom2Like;
/** Filter by the value of the field custom3. This is an exact match. */
@Schema(
name = "custom-3",
description = "Filter by the value of the field custom3. This is an exact match.")
@JsonProperty("custom-3")
private final String[] custom3;
@ -228,10 +541,19 @@ public class TaskHistoryQueryFilterParameter implements QueryParameter<TaskHisto
* search. (% is appended to the beginning and end of the requested value). Further SQL "LIKE"
* wildcard characters will be resolved correctly.
*/
@Schema(
name = "custom-3-like",
description =
"Filter by the value of the field custom3. This is an exact match. This results into a "
+ "substring search. (% is appended to the beginning and end of the requested value)."
+ " Further SQL \"LIKE\" wildcard characters will be resolved correctly.")
@JsonProperty("custom-3-like")
private final String[] custom3Like;
/** Filter by the value of the field custom4. This is an exact match. */
@Schema(
name = "custom-4",
description = "Filter by the value of the field custom4. This is an exact match.")
@JsonProperty("custom-4")
private final String[] custom4;
@ -240,6 +562,12 @@ public class TaskHistoryQueryFilterParameter implements QueryParameter<TaskHisto
* search. (% is appended to the beginning and end of the requested value). Further SQL "LIKE"
* wildcard characters will be resolved correctly.
*/
@Schema(
name = "custom-4-like",
description =
"Filter by the value of the field custom4. This is an exact match. This results into a "
+ "substring search. (% is appended to the beginning and end of the requested value)."
+ " Further SQL \"LIKE\" wildcard characters will be resolved correctly.")
@JsonProperty("custom-4-like")
private final String[] custom4Like;

View File

@ -1,6 +1,7 @@
package pro.taskana.simplehistory.rest.models;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import java.beans.ConstructorProperties;
import java.util.Collection;
import pro.taskana.common.rest.models.PageMetadata;
@ -16,6 +17,7 @@ public class TaskHistoryEventPagedRepresentationModel
}
/** the embedded task history events. */
@Schema(name = "taskHistoryEvents", description = "the embedded task history events.")
@JsonProperty("taskHistoryEvents")
@Override
public Collection<TaskHistoryEventRepresentationModel> getContent() {

View File

@ -1,5 +1,6 @@
package pro.taskana.simplehistory.rest.models;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.Instant;
import org.springframework.hateoas.RepresentationModel;
import pro.taskana.spi.history.api.events.task.TaskHistoryEvent;
@ -9,60 +10,101 @@ public class TaskHistoryEventRepresentationModel
extends RepresentationModel<TaskHistoryEventRepresentationModel> {
/** Unique Id. */
@Schema(name = "taskHistoryId", description = "Unique Id.")
private String taskHistoryId;
/** The Id of the business process. */
@Schema(name = "businessProcessId", description = "The Id of the business process.")
private String businessProcessId;
/** The Id of the parent business process. */
@Schema(name = "parentBusinessProcessId", description = "The Id of the parent business process.")
private String parentBusinessProcessId;
/** The Id of the task. */
@Schema(name = "taskId", description = "The Id of the task.")
private String taskId;
/** The type of the event. */
@Schema(name = "eventType", description = "The type of the event.")
private String eventType;
/**
* The time of event creation.
*
* <p>The format is ISO-8601.
*/
@Schema(name = "created", description = "The time of event creation.<p>The format is ISO-8601.")
private Instant created;
/** The Id of the user. */
@Schema(name = "userId", description = "The Id of the user.")
private String userId;
/** The long name of the user. */
@Schema(name = "userLongName", description = "The long name of the user.")
private String userLongName;
/** Domain. */
@Schema(name = "domain", description = "Domain.")
private String domain;
/** The key of the Workbasket. */
@Schema(name = "workbasketKey", description = "The key of the Workbasket.")
private String workbasketKey;
/** The company the referenced primary object belongs to. */
@Schema(
name = "porCompany",
description = "The company the referenced primary object belongs to.")
private String porCompany;
/** The type of the referenced primary object (contract, claim, policy, customer, ...). */
@Schema(
name = "porType",
description =
"The type of the referenced primary object (contract, claim, policy, customer, ...).")
private String porType;
/** The (kind of) system, the referenced primary object resides in (e.g. SAP, MySystem A, ...). */
@Schema(
name = "porSystem",
description =
"The (kind of) system, the referenced primary object resides in (e.g. SAP, MySystem A, "
+ "...).")
private String porSystem;
/** The instance of the system where the referenced primary object is located. */
@Schema(
name = "porInstance",
description = "The instance of the system where the referenced primary object is located.")
private String porInstance;
/** The value of the primary object reference. */
@Schema(name = "porValue", description = "The value of the primary object reference.")
private String porValue;
/** The long name of the task owner. */
@Schema(name = "taskOwnerLongName", description = "The long name of the task owner.")
private String taskOwnerLongName;
/** The key of the task's classification. */
@Schema(name = "taskClassificationKey", description = "The key of the task's classification.")
private String taskClassificationKey;
/** The category of the task's classification. */
@Schema(
name = "taskClassificationCategory",
description = "The category of the task's classification.")
private String taskClassificationCategory;
/** The classification key of the task's attachment. */
@Schema(
name = "attachmentClassificationKey",
description = "The classification key of the task's attachment.")
private String attachmentClassificationKey;
/** The old value. */
@Schema(name = "oldValue", description = "The old value.")
private String oldValue;
/** The new value. */
@Schema(name = "newValue", description = "The new value.")
private String newValue;
/** A custom property with name "1". */
@Schema(name = "custom1", description = "A custom property with name '1'.")
private String custom1;
/** A custom property with name "2". */
@Schema(name = "custom2", description = "A custom property with name '2'.")
private String custom2;
/** A custom property with name "3". */
@Schema(name = "custom3", description = "A custom property with name '3'.")
private String custom3;
/** A custom property with name "4". */
@Schema(name = "custom4", description = "A custom property with name '4'.")
private String custom4;
/** details of changes within the task. */
@Schema(name = "details", description = "details of changes within the task.")
private String details;
public String getTaskHistoryId() {

View File

@ -167,6 +167,11 @@ import org.springframework.context.annotation.Configuration;
+ "<td>workbasketKey, domain</td>"
+ "</tr>"
+ "<tr>"
+ "<td>**404 NOT_FOUND**</td>"
+ "<td>HISTORY_EVENT_NOT_FOUND</td>"
+ "<td>historyEventId</td>"
+ "</tr>"
+ "<tr>"
+ "<td>**409 CONFLICT**</td>"
+ "<td>ATTACHMENT_ALREADY_EXISTS</td>"
+ "<td>attachmentId, taskId</td>"

View File

@ -1,9 +1,16 @@
package pro.taskana.routing.dmn.rest;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import java.io.IOException;
import org.camunda.bpm.model.dmn.DmnModelInstance;
import org.camunda.bpm.model.dmn.instance.Rule;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.MediaTypes;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
@ -33,7 +40,93 @@ public class DmnUploadController {
* file
* @throws IOException if there is an I/O problem with the provided excel file
*/
@PutMapping(RoutingRestEndpoints.URL_ROUTING_RULES_DEFAULT)
@Operation(
summary =
"This endpoint converts an excel file to a DMN table and saves it on the filesystem.",
requestBody =
@RequestBody(
description =
"the excel file containing the routing rules<p> To try the request, copy the "
+ "following to an excel file and save it in .xlsx format with any name, then"
+ " upload the file"
+ "<table>"
+ "<thead>"
+ "<tr>"
+ "<th></th><th>Input</th><th>Input</th><th>Output</th><th>Output</th>"
+ "<th></th>"
+ "</tr>"
+ "</thead>"
+ "<tbody>"
+ "<tr>"
+ "<td></td>"
+ "<td>BKN</td>"
+ "<td>ClassificationKey</td>"
+ "<td>workbasketKey</td>"
+ "<td>domain</td>"
+ "</tr>"
+ "<tr>"
+ "<td></td>"
+ "<td>JUEL</td>"
+ "<td>javascript</td>"
+ "<td>Expression</td>"
+ "<td>Expression</td>"
+ "</tr>"
+ "<tr>"
+ "<td></td>"
+ "<td>task.primaryObjRef.value</td>"
+ "<td>task.classificationSummary.key + task.note</td>"
+ "<td>workbasketKey</td>"
+ "<td>domain</td>"
+ "</tr>"
+ "<tr>"
+ "<td>FIRST</td>"
+ "<td>string</td>"
+ "<td>string</td>"
+ "<td>string</td>"
+ "<td>string</td>"
+ "</tr>"
+ "<tr>"
+ "<td>1</td>"
+ "<td>6260203</td>"
+ "<td></td>"
+ "<td>GPK_KSC</td>"
+ "<td>DOMAIN_A</td>"
+ "<td>VIP-Team</td>"
+ "</tr>"
+ "<tr>"
+ "<td>2</td>"
+ "<td></td>"
+ "<td>matches(cellInput,\"11048|12012|12013|12513|12523|12619|12910<br>"
+ "|12911|12912|12913|12914|12915|12916|12917|12918|12919|12920<br>"
+ "|12921|12922|12923|12924|12925|12926|12927|12928|12929|12930<br>"
+ "|12931|12932|12933|12934|13082|13093|17999|19012\")</td>"
+ "<td>GPK_KSC</td>"
+ "<td>DOMAIN_A</td>"
+ "<td>Second-Level Team 1</td>"
+ "</tr>"
+ "<tr>"
+ "<td>3</td>"
+ "<td>12345678</td>"
+ "<td></td>"
+ "<td>GPK_KSC</td>"
+ "<td>DOMAIN_A</td>"
+ "</tr>"
+ "</tbody></table>",
required = true,
content = @Content(mediaType = MediaType.MULTIPART_FORM_DATA_VALUE)),
responses = {
@ApiResponse(
responseCode = "200",
description = "the result of the upload",
content = {
@Content(
mediaType = MediaTypes.HAL_JSON_VALUE,
schema = @Schema(implementation = RoutingUploadResultRepresentationModel.class))
})
})
@PutMapping(
path = RoutingRestEndpoints.URL_ROUTING_RULES_DEFAULT,
consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResponseEntity<RoutingUploadResultRepresentationModel> convertAndUpload(
@RequestParam("excelRoutingFile") MultipartFile excelRoutingFile)
throws IOException, NotAuthorizedException {
@ -55,6 +148,18 @@ public class DmnUploadController {
*
* @return true, when the taskana-routing-rest is enabled, otherwise false
*/
@Operation(
summary = "This endpoint checks if the taskana-routing-rest is in use.",
responses = {
@ApiResponse(
responseCode = "200",
description = "true, when the taskana-routing-rest is enabled, otherwise false",
content = {
@Content(
mediaType = MediaTypes.HAL_JSON_VALUE,
schema = @Schema(implementation = Boolean.class))
})
})
@GetMapping(path = RoutingRestEndpoints.ROUTING_REST_ENABLED)
public ResponseEntity<Boolean> getIsRoutingRestEnabled() {
return ResponseEntity.ok(true);

View File

@ -1,5 +1,6 @@
package pro.taskana.routing.dmn.rest;
import io.swagger.v3.oas.annotations.media.Schema;
import org.springframework.hateoas.RepresentationModel;
/** Model class for a routing upload result. */
@ -7,9 +8,15 @@ public class RoutingUploadResultRepresentationModel
extends RepresentationModel<RoutingUploadResultRepresentationModel> {
/** The total amount of imported rows from the provided excel sheet. */
@Schema(
name = "amountOfImportedRows",
description = "The total amount of imported rows from the provided excel sheet.")
protected int amountOfImportedRows;
/** A human readable String that contains the amount of imported rows. */
@Schema(
name = "result",
description = "A human readable String that contains the amount of imported rows.")
protected String result;
public int getAmountOfImportedRows() {