TSK-746 Add simple history event tracking to update and create task method

This commit is contained in:
Jörg Heffner 2020-03-27 08:26:03 +01:00
parent c36933b450
commit d5674ed11a
42 changed files with 671 additions and 521 deletions

View File

@ -53,13 +53,7 @@
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${version.junit.jupiter}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<artifactId>junit-jupiter</artifactId>
<version>${version.junit.jupiter}</version>
<scope>test</scope>
</dependency>

View File

@ -5,7 +5,10 @@ import pro.taskana.spi.history.api.events.TaskanaHistoryEvent;
/** This entity contains the most important information about a history event. */
public class HistoryEventImpl extends TaskanaHistoryEvent {
public HistoryEventImpl(String userId) {
super(userId);
public HistoryEventImpl() {
}
public HistoryEventImpl(String userId, String details) {
super(userId, details);
}
}

View File

@ -43,15 +43,12 @@ public class HistoryQueryImpl implements HistoryQuery {
private String[] taskClassificationKeyIn;
private String[] taskClassificationCategoryIn;
private String[] attachmentClassificationKeyIn;
private String[] commentIn;
private String[] oldValueIn;
private String[] newValueIn;
private String[] custom1In;
private String[] custom2In;
private String[] custom3In;
private String[] custom4In;
private String[] oldDataIn;
private String[] newDataIn;
private String[] businessProcessIdLike;
private String[] parentBusinessProcessIdLike;
@ -68,15 +65,12 @@ public class HistoryQueryImpl implements HistoryQuery {
private String[] taskClassificationKeyLike;
private String[] taskClassificationCategoryLike;
private String[] attachmentClassificationKeyLike;
private String[] commentLike;
private String[] oldValueLike;
private String[] newValueLike;
private String[] custom1Like;
private String[] custom2Like;
private String[] custom3Like;
private String[] custom4Like;
private String[] oldDataLike;
private String[] newDataLike;
public HistoryQueryImpl(
TaskanaHistoryEngineImpl taskanaHistoryEngineImpl, HistoryQueryMapper historyQueryMapper) {
@ -189,12 +183,6 @@ public class HistoryQueryImpl implements HistoryQuery {
return this;
}
@Override
public HistoryQuery commentIn(String... commentIn) {
this.commentIn = toUpperCopy(commentIn);
return this;
}
@Override
public HistoryQuery oldValueIn(String... oldValueIn) {
this.oldValueIn = toUpperCopy(oldValueIn);
@ -231,18 +219,6 @@ public class HistoryQueryImpl implements HistoryQuery {
return this;
}
@Override
public HistoryQuery oldDataIn(String... oldDataIn) {
this.oldDataIn = toUpperCopy(oldDataIn);
return this;
}
@Override
public HistoryQuery newDataIn(String... newDataIn) {
this.newDataIn = toUpperCopy(newDataIn);
return this;
}
@Override
public HistoryQuery businessProcessIdLike(String... businessProcessId) {
this.businessProcessIdLike = toUpperCopy(businessProcessId);
@ -333,12 +309,6 @@ public class HistoryQueryImpl implements HistoryQuery {
return this;
}
@Override
public HistoryQuery commentLike(String... comment) {
this.commentLike = toUpperCopy(comment);
return this;
}
@Override
public HistoryQuery oldValueLike(String... oldValue) {
this.oldValueLike = toUpperCopy(oldValue);
@ -375,18 +345,6 @@ public class HistoryQueryImpl implements HistoryQuery {
return this;
}
@Override
public HistoryQuery oldDataLike(String... oldData) {
this.oldDataLike = toUpperCopy(oldData);
return this;
}
@Override
public HistoryQuery newDataLike(String... newData) {
this.newDataLike = toUpperCopy(newData);
return this;
}
@Override
public HistoryQuery orderByBusinessProcessId(SortDirection sortDirection) {
return addOrderCriteria("BUSINESS_PROCESS_ID", sortDirection);
@ -467,11 +425,6 @@ public class HistoryQueryImpl implements HistoryQuery {
return addOrderCriteria("ATTACHMENT_CLASSIFICATION_KEY", sortDirection);
}
@Override
public HistoryQuery orderByComment(SortDirection sortDirection) {
return addOrderCriteria("COMMENT", sortDirection);
}
@Override
public HistoryQuery orderByOldValue(SortDirection sortDirection) {
return addOrderCriteria("OLD_VALUE", sortDirection);
@ -482,16 +435,6 @@ public class HistoryQueryImpl implements HistoryQuery {
return addOrderCriteria("NEW_VALUE", sortDirection);
}
@Override
public HistoryQuery orderByOldData(SortDirection sortDirection) {
return addOrderCriteria("OLD_DATA", sortDirection);
}
@Override
public HistoryQuery orderByNewData(SortDirection sortDirection) {
return addOrderCriteria("NEW_DATA", sortDirection);
}
@Override
public HistoryQuery orderByCustomAttribute(int num, SortDirection sortDirection)
throws InvalidArgumentException {

View File

@ -11,6 +11,7 @@ import pro.taskana.simplehistory.impl.mappings.HistoryQueryMapper;
import pro.taskana.simplehistory.query.HistoryQuery;
import pro.taskana.spi.history.api.TaskanaHistory;
import pro.taskana.spi.history.api.events.TaskanaHistoryEvent;
import pro.taskana.spi.history.api.exceptions.TaskanaHistoryEventNotFoundException;
/** This is the implementation of TaskanaHistory. */
public class SimpleHistoryServiceImpl implements TaskanaHistory {
@ -55,6 +56,32 @@ public class SimpleHistoryServiceImpl implements TaskanaHistory {
}
}
@Override
public TaskanaHistoryEvent getHistoryEvent(String historyEventId)
throws TaskanaHistoryEventNotFoundException {
LOGGER.debug("entry to getHistoryEvent (id = {})", historyEventId);
TaskanaHistoryEvent resultEvent = null;
try {
taskanaHistoryEngine.openConnection();
resultEvent = historyEventMapper.findById(historyEventId);
if (resultEvent == null) {
throw new TaskanaHistoryEventNotFoundException(
historyEventId,
String.format("TaskanaHistoryEvent for id %s was not found", historyEventId));
}
return resultEvent;
} catch (SQLException e) {
LOGGER.error("Caught exception while trying to retrieve a history event", e);
return resultEvent;
} finally {
taskanaHistoryEngine.returnConnection();
LOGGER.debug("exit from getHistoryEvent(). Returning result {} ", resultEvent);
}
}
public HistoryQuery createHistoryQuery() {
return new HistoryQueryImpl(taskanaHistoryEngine, historyQueryMapper);
}

View File

@ -2,6 +2,9 @@ package pro.taskana.simplehistory.impl.mappings;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import pro.taskana.spi.history.api.events.TaskanaHistoryEvent;
@ -13,14 +16,52 @@ public interface HistoryEventMapper {
"<script>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)"
+ " OLD_VALUE, NEW_VALUE, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, DETAILS)"
+ " VALUES ( #{historyEvent.businessProcessId}, #{historyEvent.parentBusinessProcessId}, #{historyEvent.taskId},"
+ " #{historyEvent.eventType}, #{historyEvent.created}, #{historyEvent.userId}, #{historyEvent.domain}, #{historyEvent.workbasketKey},"
+ " #{historyEvent.porCompany}, #{historyEvent.porSystem}, #{historyEvent.porInstance}, #{historyEvent.porType},"
+ " #{historyEvent.porValue}, #{historyEvent.taskClassificationKey}, #{historyEvent.taskClassificationCategory},"
+ " #{historyEvent.attachmentClassificationKey}, #{historyEvent.comment}, #{historyEvent.oldValue}, #{historyEvent.newValue},"
+ " #{historyEvent.attachmentClassificationKey}, #{historyEvent.oldValue}, #{historyEvent.newValue},"
+ " #{historyEvent.custom1}, #{historyEvent.custom2}, #{historyEvent.custom3}, #{historyEvent.custom4},"
+ " #{historyEvent.oldData}, #{historyEvent.newData}) "
+ " #{historyEvent.details}) "
+ "</script>")
void insert(@Param("historyEvent") TaskanaHistoryEvent historyEvent);
@Select(
"<script>"
+ "SELECT ID, 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, OLD_VALUE, NEW_VALUE, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, DETAILS "
+ "FROM HISTORY_EVENTS WHERE ID = #{id} "
+ "<if test=\"_databaseId == 'db2'\">with UR </if> "
+ "</script>")
@Results(
value = {
@Result(property = "id", column = "ID"),
@Result(property = "businessProcessId", column = "BUSINESS_PROCESS_ID"),
@Result(property = "parentBusinessProcessId", column = "PARENT_BUSINESS_PROCESS_ID"),
@Result(property = "taskId", column = "TASK_ID"),
@Result(property = "eventType", column = "EVENT_TYPE"),
@Result(property = "created", column = "CREATED"),
@Result(property = "userId", column = "USER_ID"),
@Result(property = "domain", column = "DOMAIN"),
@Result(property = "workbasketKey", column = "WORKBASKET_KEY"),
@Result(property = "porCompany", column = "POR_COMPANY"),
@Result(property = "porSystem", column = "POR_SYSTEM"),
@Result(property = "porInstance", column = "POR_INSTANCE"),
@Result(property = "porType", column = "POR_TYPE"),
@Result(property = "porValue", column = "POR_VALUE"),
@Result(property = "taskClassificationKey", column = "TASK_CLASSIFICATION_KEY"),
@Result(property = "taskClassificationCategory", column = "TASK_CLASSIFICATION_CATEGORY"),
@Result(property = "attachmentClassificationKey", column = "ATTACHMENT_CLASSIFICATION_KEY"),
@Result(property = "oldValue", column = "OLD_VALUE"),
@Result(property = "newValue", column = "NEW_VALUE"),
@Result(property = "custom1", column = "CUSTOM_1"),
@Result(property = "custom2", column = "CUSTOM_2"),
@Result(property = "custom3", column = "CUSTOM_3"),
@Result(property = "custom4", column = "CUSTOM_4"),
@Result(property = "details", column = "DETAILS")
})
TaskanaHistoryEvent findById(@Param("id") String id);
}

View File

@ -16,7 +16,7 @@ public interface HistoryQueryMapper {
"<script>"
+ "SELECT ID, 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 "
+ "ATTACHMENT_CLASSIFICATION_KEY, OLD_VALUE, NEW_VALUE, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4 "
+ "FROM HISTORY_EVENTS"
+ "<where>"
// IN-Queries
@ -37,15 +37,12 @@ public interface HistoryQueryMapper {
+ "<if test='taskClassificationKeyIn != null'>AND UPPER(TASK_CLASSIFICATION_KEY) IN (<foreach item='item' collection='taskClassificationKeyIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='taskClassificationCategoryIn != null'>AND UPPER(TASK_CLASSIFICATION_CATEGORY) IN (<foreach item='item' collection='taskClassificationCategoryIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentClassificationKeyIn != null'>AND UPPER(ATTACHMENT_CLASSIFICATION_KEY) IN (<foreach item='item' collection='attachmentClassificationKeyIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='commentIn != null'>AND UPPER(COMMENT) IN (<foreach item='item' collection='commentIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='oldValueIn != null'>AND UPPER(OLD_VALUE) IN (<foreach item='item' collection='oldValueIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='newValueIn != null'>AND UPPER(NEW_VALUE) IN (<foreach item='item' collection='newValueIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom1In != null'>AND UPPER(CUSTOM_1) IN (<foreach item='item' collection='custom1In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom2In != null'>AND UPPER(CUSTOM_2) IN (<foreach item='item' collection='custom2In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom3In != null'>AND UPPER(CUSTOM_3) IN (<foreach item='item' collection='custom3In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom4In != null'>AND UPPER(CUSTOM_4) IN (<foreach item='item' collection='custom4In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='oldDataIn != null'>AND UPPER(OLD_DATA) IN (<foreach item='item' collection='oldDataIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='newDataIn != null'>AND UPPER(NEW_DATA) IN (<foreach item='item' collection='newDataIn' separator=',' >#{item}</foreach>)</if> "
// LIKE-Queries
+ "<if test='businessProcessIdLike != null'>AND (<foreach item='item' collection='businessProcessIdLike' separator='OR' > UPPER(BUSINESS_PROCESS_ID) LIKE #{item} </foreach>)</if> "
+ "<if test='parentBusinessProcessIdLike != null'>AND (<foreach item='item' collection='parentBusinessProcessIdLike' separator=' OR ' >UPPER(PARENT_BUSINESS_PROCESS_ID) LIKE #{item}</foreach>)</if> "
@ -62,15 +59,12 @@ public interface HistoryQueryMapper {
+ "<if test='taskClassificationKeyLike != null'>AND (<foreach item='item' collection='taskClassificationKeyLike' separator=' OR ' >UPPER(TASK_CLASSIFICATION_KEY) LIKE #{item}</foreach>)</if> "
+ "<if test='taskClassificationCategoryLike != null'>AND (<foreach item='item' collection='taskClassificationCategoryLike' separator=' OR ' >UPPER(TASK_CLASSIFICATION_CATEGORY) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentClassificationKeyLike != null'>AND (<foreach item='item' collection='attachmentClassificationKeyLike' separator=' OR ' >UPPER(ATTACHMENT_CLASSIFICATION_KEY) LIKE #{item}</foreach>)</if> "
+ "<if test='commentLike != null'>AND (<foreach item='item' collection='commentLike' separator=' OR ' >UPPER(COMMENT) LIKE #{item}</foreach>)</if> "
+ "<if test='oldValueLike != null'>AND (<foreach item='item' collection='oldValueLike' separator=' OR ' >UPPER(OLD_VALUE) LIKE #{item}</foreach>)</if> "
+ "<if test='newValueLike != null'>AND (<foreach item='item' collection='newValueLike' separator=' OR ' >UPPER(NEW_VALUE) LIKE #{item}</foreach>)</if> "
+ "<if test='custom1Like != null'>AND (<foreach item='item' collection='custom1Like' separator=' OR ' >UPPER(CUSTOM_1) LIKE #{item}</foreach>)</if> "
+ "<if test='custom2Like != null'>AND (<foreach item='item' collection='custom2Like' separator=' OR ' >UPPER(CUSTOM_2) LIKE #{item}</foreach>)</if> "
+ "<if test='custom3Like != null'>AND (<foreach item='item' collection='custom3Like' separator=' OR ' >UPPER(CUSTOM_3) LIKE #{item}</foreach>)</if> "
+ "<if test='custom4Like != null'>AND (<foreach item='item' collection='custom4Like' separator=' OR ' >UPPER(CUSTOM_4) LIKE #{item}</foreach>)</if> "
+ "<if test='oldDataLike != null'>AND (<foreach item='item' collection='oldDataLike' separator=' OR ' >UPPER(OLD_DATA) LIKE #{item}</foreach>)</if> "
+ "<if test='newDataLike != null'>AND (<foreach item='item' collection='newDataLike' separator=' OR ' >UPPER(NEW_DATA) LIKE #{item}</foreach>)</if> "
+ "</where>"
+ "<if test='!orderBy.isEmpty()'>ORDER BY <foreach item='item' collection='orderBy' separator=',' >${item}</foreach></if> "
+ "<if test='maxRows > 0'> FETCH FIRST #{maxRows} ROWS ONLY </if>"
@ -94,15 +88,12 @@ public interface HistoryQueryMapper {
@Result(property = "taskClassificationKey", column = "TASK_CLASSIFICATION_KEY"),
@Result(property = "taskClassificationCategory", column = "TASK_CLASSIFICATION_CATEGORY"),
@Result(property = "attachmentClassificationKey", column = "ATTACHMENT_CLASSIFICATION_KEY"),
@Result(property = "comment", column = "COMMENT"),
@Result(property = "oldValue", column = "OLD_VALUE"),
@Result(property = "newValue", column = "NEW_VALUE"),
@Result(property = "custom1", column = "CUSTOM_1"),
@Result(property = "custom2", column = "CUSTOM_2"),
@Result(property = "custom3", column = "CUSTOM_3"),
@Result(property = "custom4", column = "CUSTOM_4"),
@Result(property = "oldData", column = "OLD_DATA"),
@Result(property = "newData", column = "NEW_DATA")
@Result(property = "custom4", column = "CUSTOM_4")
})
List<HistoryEventImpl> queryHistoryEvent(HistoryQueryImpl historyEventQuery);
@ -128,15 +119,12 @@ public interface HistoryQueryMapper {
+ "<if test='taskClassificationKeyIn != null'>AND UPPER(TASK_CLASSIFICATION_KEY) IN (<foreach item='item' collection='taskClassificationKeyIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='taskClassificationCategoryIn != null'>AND UPPER(TASK_CLASSIFICATION_CATEGORY) IN (<foreach item='item' collection='taskClassificationCategoryIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentClassificationKeyIn != null'>AND UPPER(ATTACHMENT_CLASSIFICATION_KEY) IN (<foreach item='item' collection='attachmentClassificationKeyIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='commentIn != null'>AND UPPER(COMMENT) IN (<foreach item='item' collection='commentIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='oldValueIn != null'>AND UPPER(OLD_VALUE) IN (<foreach item='item' collection='oldValueIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='newValueIn != null'>AND UPPER(NEW_VALUE) IN (<foreach item='item' collection='newValueIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom1In != null'>AND UPPER(CUSTOM_1) IN (<foreach item='item' collection='custom1In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom2In != null'>AND UPPER(CUSTOM_2) IN (<foreach item='item' collection='custom2In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom3In != null'>AND UPPER(CUSTOM_3) IN (<foreach item='item' collection='custom3In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom4In != null'>AND UPPER(CUSTOM_4) IN (<foreach item='item' collection='custom4In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='oldDataIn != null'>AND UPPER(OLD_DATA) IN (<foreach item='item' collection='oldDataIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='newDataIn != null'>AND UPPER(NEW_DATA) IN (<foreach item='item' collection='newDataIn' separator=',' >#{item}</foreach>)</if> "
// LIKE-Queries
+ "<if test='businessProcessIdLike != null'>AND (<foreach item='item' collection='businessProcessIdLike' separator='OR' > UPPER(BUSINESS_PROCESS_ID) LIKE #{item} </foreach>)</if> "
+ "<if test='parentBusinessProcessIdLike != null'>AND (<foreach item='item' collection='parentBusinessProcessIdLike' separator=' OR ' >UPPER(PARENT_BUSINESS_PROCESS_ID) LIKE #{item}</foreach>)</if> "
@ -153,15 +141,12 @@ public interface HistoryQueryMapper {
+ "<if test='taskClassificationKeyLike != null'>AND (<foreach item='item' collection='taskClassificationKeyLike' separator=' OR ' >UPPER(TASK_CLASSIFICATION_KEY) LIKE #{item}</foreach>)</if> "
+ "<if test='taskClassificationCategoryLike != null'>AND (<foreach item='item' collection='taskClassificationCategoryLike' separator=' OR ' >UPPER(TASK_CLASSIFICATION_CATEGORY) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentClassificationKeyLike != null'>AND (<foreach item='item' collection='attachmentClassificationKeyLike' separator=' OR ' >UPPER(ATTACHMENT_CLASSIFICATION_KEY) LIKE #{item}</foreach>)</if> "
+ "<if test='commentLike != null'>AND (<foreach item='item' collection='commentLike' separator=' OR ' >UPPER(COMMENT) LIKE #{item}</foreach>)</if> "
+ "<if test='oldValueLike != null'>AND (<foreach item='item' collection='oldValueLike' separator=' OR ' >UPPER(OLD_VALUE) LIKE #{item}</foreach>)</if> "
+ "<if test='newValueLike != null'>AND (<foreach item='item' collection='newValueLike' separator=' OR ' >UPPER(NEW_VALUE) LIKE #{item}</foreach>)</if> "
+ "<if test='custom1Like != null'>AND (<foreach item='item' collection='custom1Like' separator=' OR ' >UPPER(CUSTOM_1) LIKE #{item}</foreach>)</if> "
+ "<if test='custom2Like != null'>AND (<foreach item='item' collection='custom2Like' separator=' OR ' >UPPER(CUSTOM_2) LIKE #{item}</foreach>)</if> "
+ "<if test='custom3Like != null'>AND (<foreach item='item' collection='custom3Like' separator=' OR ' >UPPER(CUSTOM_3) LIKE #{item}</foreach>)</if> "
+ "<if test='custom4Like != null'>AND (<foreach item='item' collection='custom4Like' separator=' OR ' >UPPER(CUSTOM_4) LIKE #{item}</foreach>)</if> "
+ "<if test='oldDataLike != null'>AND (<foreach item='item' collection='oldDataLike' separator=' OR ' >UPPER(OLD_DATA) LIKE #{item}</foreach>)</if> "
+ "<if test='newDataLike != null'>AND (<foreach item='item' collection='newDataLike' separator=' OR ' >UPPER(NEW_DATA) LIKE #{item}</foreach>)</if> "
+ "</where>"
+ "</script>")
long countHistoryEvent(HistoryQueryImpl historyEventQuery);
@ -188,15 +173,12 @@ public interface HistoryQueryMapper {
+ "<if test='taskClassificationKeyIn != null'>AND UPPER(TASK_CLASSIFICATION_KEY) IN (<foreach item='item' collection='taskClassificationKeyIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='taskClassificationCategoryIn != null'>AND UPPER(TASK_CLASSIFICATION_CATEGORY) IN (<foreach item='item' collection='taskClassificationCategoryIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentClassificationKeyIn != null'>AND UPPER(ATTACHMENT_CLASSIFICATION_KEY) IN (<foreach item='item' collection='attachmentClassificationKeyIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='commentIn != null'>AND UPPER(COMMENT) IN (<foreach item='item' collection='commentIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='oldValueIn != null'>AND UPPER(OLD_VALUE) IN (<foreach item='item' collection='oldValueIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='newValueIn != null'>AND UPPER(NEW_VALUE) IN (<foreach item='item' collection='newValueIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom1In != null'>AND UPPER(CUSTOM_1) IN (<foreach item='item' collection='custom1In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom2In != null'>AND UPPER(CUSTOM_2) IN (<foreach item='item' collection='custom2In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom3In != null'>AND UPPER(CUSTOM_3) IN (<foreach item='item' collection='custom3In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom4In != null'>AND UPPER(CUSTOM_4) IN (<foreach item='item' collection='custom4In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='oldDataIn != null'>AND UPPER(OLD_DATA) IN (<foreach item='item' collection='oldDataIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='newDataIn != null'>AND UPPER(NEW_DATA) IN (<foreach item='item' collection='newDataIn' separator=',' >#{item}</foreach>)</if> "
// LIKE-Queries
+ "<if test='businessProcessIdLike != null'>AND (<foreach item='item' collection='businessProcessIdLike' separator='OR' > UPPER(BUSINESS_PROCESS_ID) LIKE #{item} </foreach>)</if> "
+ "<if test='parentBusinessProcessIdLike != null'>AND (<foreach item='item' collection='parentBusinessProcessIdLike' separator=' OR ' >UPPER(PARENT_BUSINESS_PROCESS_ID) LIKE #{item}</foreach>)</if> "
@ -213,15 +195,12 @@ public interface HistoryQueryMapper {
+ "<if test='taskClassificationKeyLike != null'>AND (<foreach item='item' collection='taskClassificationKeyLike' separator=' OR ' >UPPER(TASK_CLASSIFICATION_KEY) LIKE #{item}</foreach>)</if> "
+ "<if test='taskClassificationCategoryLike != null'>AND (<foreach item='item' collection='taskClassificationCategoryLike' separator=' OR ' >UPPER(TASK_CLASSIFICATION_CATEGORY) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentClassificationKeyLike != null'>AND (<foreach item='item' collection='attachmentClassificationKeyLike' separator=' OR ' >UPPER(ATTACHMENT_CLASSIFICATION_KEY) LIKE #{item}</foreach>)</if> "
+ "<if test='commentLike != null'>AND (<foreach item='item' collection='commentLike' separator=' OR ' >UPPER(COMMENT) LIKE #{item}</foreach>)</if> "
+ "<if test='oldValueLike != null'>AND (<foreach item='item' collection='oldValueLike' separator=' OR ' >UPPER(OLD_VALUE) LIKE #{item}</foreach>)</if> "
+ "<if test='newValueLike != null'>AND (<foreach item='item' collection='newValueLike' separator=' OR ' >UPPER(NEW_VALUE) LIKE #{item}</foreach>)</if> "
+ "<if test='custom1Like != null'>AND (<foreach item='item' collection='custom1Like' separator=' OR ' >UPPER(CUSTOM_1) LIKE #{item}</foreach>)</if> "
+ "<if test='custom2Like != null'>AND (<foreach item='item' collection='custom2Like' separator=' OR ' >UPPER(CUSTOM_2) LIKE #{item}</foreach>)</if> "
+ "<if test='custom3Like != null'>AND (<foreach item='item' collection='custom3Like' separator=' OR ' >UPPER(CUSTOM_3) LIKE #{item}</foreach>)</if> "
+ "<if test='custom4Like != null'>AND (<foreach item='item' collection='custom4Like' separator=' OR ' >UPPER(CUSTOM_4) LIKE #{item}</foreach>)</if> "
+ "<if test='oldDataLike != null'>AND (<foreach item='item' collection='oldDataLike' separator=' OR ' >UPPER(OLD_DATA) LIKE #{item}</foreach>)</if> "
+ "<if test='newDataLike != null'>AND (<foreach item='item' collection='newDataLike' separator=' OR ' >UPPER(NEW_DATA) LIKE #{item}</foreach>)</if> "
+ "</where>"
+ "<if test='!orderBy.isEmpty()'>ORDER BY <foreach item='item' collection='orderBy' separator=',' >${item}</foreach></if> "
+ "</script>")

View File

@ -145,14 +145,6 @@ public interface HistoryQuery extends BaseQuery<HistoryEventImpl, HistoryQueryCo
*/
HistoryQuery attachmentClassificationKeyIn(String... attachmentClassificationKey);
/**
* Add your comment to your query.
*
* @param comment as String
* @return the query
*/
HistoryQuery commentIn(String... comment);
/**
* Add your oldValue to your query.
*
@ -201,22 +193,6 @@ public interface HistoryQuery extends BaseQuery<HistoryEventImpl, HistoryQueryCo
*/
HistoryQuery custom4In(String... custom4);
/**
* Add your oldData to your query.
*
* @param oldData as String
* @return the query
*/
HistoryQuery oldDataIn(String... oldData);
/**
* Add your newData to your query.
*
* @param newData as String
* @return the query
*/
HistoryQuery newDataIn(String... newData);
/**
* Add your businessProcessId to your query. It will be compared in SQL with an LIKE. If you use a
* wildcard like % then it will be transmitted to the database.
@ -352,15 +328,6 @@ public interface HistoryQuery extends BaseQuery<HistoryEventImpl, HistoryQueryCo
*/
HistoryQuery attachmentClassificationKeyLike(String... attachmentClassificationKey);
/**
* Add your comment to your query. It will be compared in SQL with an LIKE. If you use a wildcard
* like % then it will be transmitted to the database.
*
* @param comment as String
* @return the query
*/
HistoryQuery commentLike(String... comment);
/**
* Add your oldValue to your query. It will be compared in SQL with an LIKE. If you use a wildcard
* like % then it will be transmitted to the database.
@ -415,24 +382,6 @@ public interface HistoryQuery extends BaseQuery<HistoryEventImpl, HistoryQueryCo
*/
HistoryQuery custom4Like(String... custom4);
/**
* Add your oldData to your query. It will be compared in SQL with an LIKE. If you use a wildcard
* like % then it will be transmitted to the database.
*
* @param oldData as String
* @return the query
*/
HistoryQuery oldDataLike(String... oldData);
/**
* Add your newData to your query. It will be compared in SQL with an LIKE. If you use a wildcard
* like % then it will be transmitted to the database.
*
* @param newData as String
* @return the query
*/
HistoryQuery newDataLike(String... newData);
/**
* Sort the query result by businessProcessId.
*
@ -577,15 +526,6 @@ public interface HistoryQuery extends BaseQuery<HistoryEventImpl, HistoryQueryCo
*/
HistoryQuery orderByAttachmentClassificationKey(SortDirection sortDirection);
/**
* Sort the query result by comment.
*
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
* If sortDirection is null, the result is sorted in ascending order
* @return the query
*/
HistoryQuery orderByComment(SortDirection sortDirection);
/**
* Sort the query result by oldValue.
*
@ -605,27 +545,9 @@ public interface HistoryQuery extends BaseQuery<HistoryEventImpl, HistoryQueryCo
HistoryQuery orderByNewValue(SortDirection sortDirection);
/**
* Sort the query result by oldData.
* Sort the query result by a custom attribute.
*
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
* If sortDirection is null, the result is sorted in ascending order
* @return the query
*/
HistoryQuery orderByOldData(SortDirection sortDirection);
/**
* Sort the query result by newData.
*
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
* If sortDirection is null, the result is sorted in ascending order
* @return the query
*/
HistoryQuery orderByNewData(SortDirection sortDirection);
/**
* Sort the query result by a custom.
*
* @param num the number of the custom as String (eg "4")
* @param num the number of the custom attribute as String (eg "4")
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
* If sortDirection is null, the result is sorted in ascending order
* @return the query

View File

@ -26,16 +26,13 @@ public enum HistoryQueryColumnName implements QueryColumnName {
TASK_CLASSIFICATION_KEY("task_classification_key"),
TASK_CLASSIFICATION_CATEGORY("task_classification_category"),
ATTACHMENT_CLASSIFICATION_KEY("attachment_classification_key"),
COMMENT("comment"),
OLD_VALUE("old_value"),
NEW_VALUE("new_value"),
CUSTOM_1("custom_1"),
CUSTOM_2("custom_2"),
CUSTOM_3("custom_3"),
CUSTOM_4("custom_4"),
OLD_DATA("old_data"),
NEW_DATA("new_data"),
TYPE("type");
TYPE("event_Type");
private String name;

View File

@ -20,14 +20,12 @@ CREATE TABLE IF NOT EXISTS HISTORY_EVENTS (
TASK_CLASSIFICATION_KEY VARCHAR(32) NULL,
TASK_CLASSIFICATION_CATEGORY VARCHAR(32) NULL,
ATTACHMENT_CLASSIFICATION_KEY VARCHAR(32) NULL,
COMMENT VARCHAR(4096) NULL,
OLD_VALUE VARCHAR(255) NULL,
NEW_VALUE VARCHAR(255) NULL,
CUSTOM_1 VARCHAR(128) NULL,
CUSTOM_2 VARCHAR(128) NULL,
CUSTOM_3 VARCHAR(128) NULL,
CUSTOM_4 VARCHAR(128) NULL,
OLD_DATA VARCHAR(4096) NULL,
NEW_DATA VARCHAR(4096) NULL,
DETAILS CLOB NULL,
PRIMARY KEY (ID)
);

View File

@ -103,22 +103,22 @@ public class AbstractAccTest {
* @param workbasketKey the workbasketKey, the task currently resides in.
* @param taskId the taskid the event belongs to.
* @param type the type of the event.
* @param comment the individual comment.
* @param previousWorkbasketId the workbasketId of the previous workbasket (if applicable).
* @param userid the ID of the user that triggered the event.
* @param details the details of the changes that happened.
* @return History event object created.
*/
public static HistoryEventImpl createHistoryEvent(
String workbasketKey,
String taskId,
String type,
String comment,
String previousWorkbasketId,
String userid) {
HistoryEventImpl historyEvent = new HistoryEventImpl(userid);
String userid,
String details) {
HistoryEventImpl historyEvent = new HistoryEventImpl(userid, details);
historyEvent.setWorkbasketKey(workbasketKey);
historyEvent.setTaskId(taskId);
historyEvent.setEventType(type);
historyEvent.setComment(comment);
historyEvent.setOldValue(previousWorkbasketId);
return historyEvent;
}

View File

@ -0,0 +1,32 @@
package acceptance.events;
import static org.assertj.core.api.Assertions.assertThat;
import acceptance.AbstractAccTest;
import org.junit.jupiter.api.Test;
import pro.taskana.spi.history.api.events.TaskanaHistoryEvent;
import pro.taskana.spi.history.api.exceptions.TaskanaHistoryEventNotFoundException;
public class GetHistoryEventAccTest extends AbstractAccTest {
@Test
public void should_ReturnSpecificTaskHistoryEventWithDetails_For_HistoryEventId()
throws TaskanaHistoryEventNotFoundException {
String detailsJson =
"{\"changes\":[{"
+ "\"newValue\":\"BPI:01\","
+ "\"fieldName\":\"businessProcessId\","
+ "\"oldValue\":\"BPI:02\"},"
+ "{\"newValue\":\"admin\","
+ "\"fieldName\":\"owner\","
+ "\"oldValue\":\"owner1\"}]}";
TaskanaHistoryEvent taskHistoryEvent = getHistoryService().getHistoryEvent("4");
assertThat(taskHistoryEvent.getBusinessProcessId()).isEqualTo("BPI:01");
assertThat(taskHistoryEvent.getUserId()).isEqualTo("admin");
assertThat(taskHistoryEvent.getEventType()).isEqualTo("TASK_UPDATED");
assertThat(taskHistoryEvent.getDetails()).isEqualTo(detailsJson);
}
}

View File

@ -25,19 +25,19 @@ public class QueryHistoryAccTest extends AbstractAccTest {
@Test
public void testListValuesAscendingAndDescending() {
List<String> defaultList =
getHistoryService().createHistoryQuery().listValues(HistoryQueryColumnName.COMMENT, null);
getHistoryService().createHistoryQuery().listValues(HistoryQueryColumnName.TASK_ID, null);
List<String> ascendingList =
getHistoryService()
.createHistoryQuery()
.listValues(HistoryQueryColumnName.COMMENT, SortDirection.ASCENDING);
.listValues(HistoryQueryColumnName.TASK_ID, SortDirection.ASCENDING);
assertThat(ascendingList).hasSize(3);
assertThat(ascendingList).hasSize(2);
assertThat(ascendingList).isEqualTo(defaultList);
List<String> descendingList =
getHistoryService()
.createHistoryQuery()
.listValues(HistoryQueryColumnName.COMMENT, SortDirection.DESCENDING);
.listValues(HistoryQueryColumnName.TASK_ID, SortDirection.DESCENDING);
Collections.reverse(ascendingList);
assertThat(ascendingList).isEqualTo(descendingList);
@ -77,7 +77,6 @@ public class QueryHistoryAccTest extends AbstractAccTest {
public void testCorrectResultWithWrongConstraints() {
List<HistoryEventImpl> result = getHistoryService().createHistoryQuery().list(1, 1000);
assertThat(result).hasSize(2);
assertThat(result.get(0).getComment()).isEqualTo("created by Peter");
result = getHistoryService().createHistoryQuery().list(100, 1000);
assertThat(result).isEmpty();
@ -86,10 +85,10 @@ public class QueryHistoryAccTest extends AbstractAccTest {
@Test
public void testSingle() {
HistoryEventImpl single = getHistoryService().createHistoryQuery().userIdIn("peter").single();
assertThat(single.getEventType()).isEqualTo("CREATE");
assertThat(single.getEventType()).isEqualTo("TASK_CREATED");
single = getHistoryService().createHistoryQuery().eventTypeIn("CREATE", "xy").single();
assertThat(single.getUserId()).isEqualTo("admin");
single = getHistoryService().createHistoryQuery().eventTypeIn("TASK_CREATED", "xy").single();
assertThat(single.getUserId()).isEqualTo("peter");
}
@Test
@ -121,8 +120,8 @@ public class QueryHistoryAccTest extends AbstractAccTest {
.list();
assertThat(returnValues).hasSize(2);
returnValues = getHistoryService().createHistoryQuery().eventTypeIn("CREATE").list();
assertThat(returnValues).hasSize(3);
returnValues = getHistoryService().createHistoryQuery().eventTypeIn("TASK_CREATED").list();
assertThat(returnValues).hasSize(2);
TimeInterval timeInterval = new TimeInterval(Instant.now().minusSeconds(10), Instant.now());
returnValues = getHistoryService().createHistoryQuery().createdWithin(timeInterval).list();
@ -183,31 +182,17 @@ public class QueryHistoryAccTest extends AbstractAccTest {
returnValues = getHistoryService().createHistoryQuery().custom4In("custom4").list();
assertThat(returnValues).hasSize(1);
returnValues = getHistoryService().createHistoryQuery().commentIn("created a bug").list();
assertThat(returnValues).hasSize(1);
returnValues = getHistoryService().createHistoryQuery().oldValueIn("old_val").list();
assertThat(returnValues).hasSize(1);
returnValues = getHistoryService().createHistoryQuery().newValueIn("new_val").list();
assertThat(returnValues).hasSize(1);
returnValues = getHistoryService().createHistoryQuery().oldDataIn("123").list();
assertThat(returnValues).hasSize(2);
returnValues = getHistoryService().createHistoryQuery().newDataIn("456").list();
assertThat(returnValues).hasSize(3);
returnValues = getHistoryService().createHistoryQuery().oldValueLike("old%").list();
assertThat(returnValues).hasSize(1);
returnValues = getHistoryService().createHistoryQuery().newValueLike("new_%").list();
assertThat(returnValues).hasSize(2);
returnValues = getHistoryService().createHistoryQuery().oldDataLike("%23%").list();
assertThat(returnValues).hasSize(3);
returnValues = getHistoryService().createHistoryQuery().newDataLike("456%").list();
assertThat(returnValues).hasSize(3);
}
@Test
@ -229,12 +214,6 @@ public class QueryHistoryAccTest extends AbstractAccTest {
returnValues = getHistoryService().createHistoryQuery().newValueLike("new_%").list();
assertThat(returnValues).hasSize(2);
returnValues = getHistoryService().createHistoryQuery().oldDataLike("%23%").list();
assertThat(returnValues).hasSize(3);
returnValues = getHistoryService().createHistoryQuery().newDataLike("456%").list();
assertThat(returnValues).hasSize(3);
}
@Test
@ -263,7 +242,7 @@ public class QueryHistoryAccTest extends AbstractAccTest {
getHistoryService()
.createHistoryQuery()
.listValues(HistoryQueryColumnName.EVENT_TYPE, null);
assertThat(returnedList).hasSize(1);
assertThat(returnedList).hasSize(2);
returnedList =
getHistoryService().createHistoryQuery().listValues(HistoryQueryColumnName.CREATED, null);
@ -327,10 +306,6 @@ public class QueryHistoryAccTest extends AbstractAccTest {
.listValues(HistoryQueryColumnName.ATTACHMENT_CLASSIFICATION_KEY, null);
assertThat(returnedList).hasSize(2);
returnedList =
getHistoryService().createHistoryQuery().listValues(HistoryQueryColumnName.COMMENT, null);
assertThat(returnedList).hasSize(3);
returnedList =
getHistoryService().createHistoryQuery().listValues(HistoryQueryColumnName.OLD_VALUE, null);
assertThat(returnedList).hasSize(3);
@ -356,11 +331,7 @@ public class QueryHistoryAccTest extends AbstractAccTest {
assertThat(returnedList).hasSize(2);
returnedList =
getHistoryService().createHistoryQuery().listValues(HistoryQueryColumnName.OLD_DATA, null);
getHistoryService().createHistoryQuery().listValues(HistoryQueryColumnName.TYPE, null);
assertThat(returnedList).hasSize(2);
returnedList =
getHistoryService().createHistoryQuery().listValues(HistoryQueryColumnName.NEW_DATA, null);
assertThat(returnedList).hasSize(1);
}
}

View File

@ -53,7 +53,6 @@ public class HistoryQueryImplTest {
.workbasketKeyIn(
"T22", "some_long_long, long loooooooooooooooooooooooooooooooooooong String.")
.userIdIn("BV")
.commentLike("%as important")
.createdWithin(interval)
.list();
@ -66,13 +65,12 @@ public class HistoryQueryImplTest {
String workbasketKey,
String type,
String userId,
String comment,
String details,
Instant created) {
HistoryEventImpl he = new HistoryEventImpl(userId);
HistoryEventImpl he = new HistoryEventImpl(userId, details);
he.setTaskId(taskId);
he.setWorkbasketKey(workbasketKey);
he.setEventType(type);
he.setComment(comment);
he.setCreated(created);
return he;
}

View File

@ -57,7 +57,7 @@ public class SimpleHistoryServiceImplTest {
public void testCreateEvent() throws SQLException {
HistoryEventImpl expectedWb =
AbstractAccTest.createHistoryEvent(
"wbKey1", "taskId1", "type1", "Some comment", "wbKey2", "someUserId");
"wbKey1", "taskId1", "type1", "wbKey2", "someUserId", "someDetails");
cutSpy.create(expectedWb);
verify(taskanaHistoryEngineMock, times(1)).openConnection();
@ -71,7 +71,7 @@ public class SimpleHistoryServiceImplTest {
List<HistoryEventImpl> returnList = new ArrayList<>();
returnList.add(
AbstractAccTest.createHistoryEvent(
"wbKey1", "taskId1", "type1", "Some comment", "wbKey2", "someUserId"));
"wbKey1", "taskId1", "type1", "wbKey2", "someUserId", "someDetails"));
when(historyQueryMapperMock.queryHistoryEvent(any())).thenReturn(returnList);
final List<HistoryEventImpl> result = cutSpy.createHistoryQuery().taskIdIn("taskId1").list();

View File

@ -1,7 +1,7 @@
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 , 'admin', '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),'peter', '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 , 'admin', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'123' ,'456')
TASK_CLASSIFICATION_CATEGORY, ATTACHMENT_CLASSIFICATION_KEY, OLD_VALUE, NEW_VALUE, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, DETAILS) 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 , OLD_VALUE , NEW_VALUE , CUSTOM_1 , CUSTOM_2 , CUSTOM_3 , CUSTOM_4, details
('BPI:01' ,'' ,'TKI:000000000000000000000000000000000000', 'TASK_UPDATED', CURRENT_TIMESTAMP , 'admin', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', 'L140101' , 'TASK' ,'' ,'old_val' ,'new_val' ,'custom1' ,'custom2' , 'custom3' ,'custom4', '{"changes":[{"newValue":"BPI:01","fieldName":"businessProcessId","oldValue":"BPI:02"},{"newValue":"admin","fieldName":"owner","oldValue":"owner1"}]}' ),
('BPI:02' ,'' ,'TKI:000000000000000000000000000000000000', 'TASK_CREATED', DATEADD('DAY', -2, CURRENT_TIMESTAMP),'peter', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'someDetails' ),
('BPI:03' ,'BPI:01','TKI:000000000000000000000000000000000001','TASK_CREATED', CURRENT_TIMESTAMP , 'admin', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'someDetails' )
;

View File

@ -1,2 +1,5 @@
logging.level.pro.taskana=DEBUG
taskana.schemaName=TASKANA
spring.main.allow-bean-definition-overriding=true

View File

@ -10,14 +10,12 @@ import pro.taskana.rest.simplehistory.TaskHistoryEventController;
import pro.taskana.simplehistory.impl.HistoryEventImpl;
/** Mapper to convert from a list of HistoryEventImpl to a TaskHistoryEventResource. */
public class TaskHistoryEventListAssembler extends AbstractRessourcesAssembler {
public TaskHistoryEventListAssembler() {}
public class TaskHistoryEventListResourceAssembler extends AbstractRessourcesAssembler {
public TaskHistoryEventListResource toResources(
List<HistoryEventImpl> historyEvents, PageMetadata pageMetadata) {
TaskHistoryEventAssembler assembler = new TaskHistoryEventAssembler();
TaskHistoryEventResourceAssembler assembler = new TaskHistoryEventResourceAssembler();
List<TaskHistoryEventResource> resources = assembler.toResources(historyEvents);
TaskHistoryEventListResource pagedResources =
new TaskHistoryEventListResource(resources, pageMetadata);

View File

@ -7,8 +7,8 @@ import pro.taskana.spi.history.api.events.TaskanaHistoryEvent;
/** Resource class for {@link TaskanaHistoryEvent}. */
public class TaskHistoryEventResource extends ResourceSupport {
@NotNull private String taskHistoryEventId;
@NotNull private String taskHistoryEventId;
private String businessProcessId;
private String parentBusinessProcessId;
private String taskId;
@ -25,15 +25,13 @@ public class TaskHistoryEventResource extends ResourceSupport {
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;
private String details;
public String getTaskHistoryId() {
return taskHistoryEventId;
@ -171,14 +169,6 @@ public class TaskHistoryEventResource extends ResourceSupport {
this.attachmentClassificationKey = attachmentClassificationKey;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public String getOldValue() {
return oldValue;
}
@ -227,20 +217,12 @@ public class TaskHistoryEventResource extends ResourceSupport {
this.custom4 = custom4;
}
public String getOldData() {
return oldData;
public String getDetails() {
return details;
}
public void setOldData(String oldData) {
this.oldData = oldData;
}
public String getNewData() {
return newData;
}
public void setNewData(String newData) {
this.newData = newData;
public void setDetails(String details) {
this.details = details;
}
@Override
@ -268,10 +250,8 @@ public class TaskHistoryEventResource extends ResourceSupport {
+ this.oldValue
+ "newValue= "
+ this.newValue
+ "oldData= "
+ this.oldData
+ "newData= "
+ this.newData
+ "details= "
+ this.details
+ "]";
}
}

View File

@ -1,28 +1,44 @@
package pro.taskana.rest.resource;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
import org.springframework.beans.BeanUtils;
import org.springframework.hateoas.mvc.ResourceAssemblerSupport;
import pro.taskana.common.api.exceptions.SystemException;
import pro.taskana.rest.simplehistory.TaskHistoryEventController;
import pro.taskana.simplehistory.impl.HistoryEventImpl;
import pro.taskana.spi.history.api.events.TaskanaHistoryEvent;
import pro.taskana.spi.history.api.exceptions.TaskanaHistoryEventNotFoundException;
/** Transforms any {@link HistoryEventImpl} into its {@link TaskHistoryEventResource}. */
public class TaskHistoryEventAssembler
public class TaskHistoryEventResourceAssembler
extends ResourceAssemblerSupport<TaskanaHistoryEvent, TaskHistoryEventResource> {
public TaskHistoryEventAssembler() {
public TaskHistoryEventResourceAssembler() {
super(HistoryEventImpl.class, TaskHistoryEventResource.class);
}
@Override
public TaskHistoryEventResource toResource(TaskanaHistoryEvent historyEvent) {
TaskHistoryEventResource resource = createResourceWithId(historyEvent.getId(), historyEvent);
try {
resource.removeLinks();
resource.add(
linkTo(
methodOn(TaskHistoryEventController.class)
.getTaskHistoryEvent(String.valueOf(historyEvent.getId())))
.withSelfRel());
} catch (TaskanaHistoryEventNotFoundException e) {
throw new SystemException("caught unexpected Exception.", e.getCause());
}
BeanUtils.copyProperties(historyEvent, resource);
if (historyEvent.getCreated() != null) {
resource.setCreated(historyEvent.getCreated().toString());
}
resource.setTaskHistoryId(String.valueOf(historyEvent.getId()));
resource.removeLinks();
return resource;
}
}

View File

@ -12,6 +12,7 @@ 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.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@ -23,11 +24,15 @@ import pro.taskana.common.api.TimeInterval;
import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.rest.AbstractPagingController;
import pro.taskana.rest.resource.PagedResources.PageMetadata;
import pro.taskana.rest.resource.TaskHistoryEventListAssembler;
import pro.taskana.rest.resource.TaskHistoryEventListResource;
import pro.taskana.rest.resource.TaskHistoryEventListResourceAssembler;
import pro.taskana.rest.resource.TaskHistoryEventResource;
import pro.taskana.rest.resource.TaskHistoryEventResourceAssembler;
import pro.taskana.simplehistory.impl.HistoryEventImpl;
import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl;
import pro.taskana.simplehistory.query.HistoryQuery;
import pro.taskana.spi.history.api.events.TaskanaHistoryEvent;
import pro.taskana.spi.history.api.exceptions.TaskanaHistoryEventNotFoundException;
/** Controller for all TaskHistoryEvent related endpoints. */
@RestController
@ -129,20 +134,24 @@ public class TaskHistoryEventController extends AbstractPagingController {
private TaskanaEngineConfiguration taskanaEngineConfiguration;
private TaskHistoryEventResourceAssembler taskHistoryEventResourceAssembler;
public TaskHistoryEventController(
TaskanaEngineConfiguration taskanaEngineConfiguration,
SimpleHistoryServiceImpl simpleHistoryServiceImpl) {
SimpleHistoryServiceImpl simpleHistoryServiceImpl,
TaskHistoryEventResourceAssembler taskHistoryEventResourceAssembler) {
this.taskanaEngineConfiguration = taskanaEngineConfiguration;
this.simpleHistoryService = simpleHistoryServiceImpl;
simpleHistoryService.initialize(taskanaEngineConfiguration);
this.simpleHistoryService.initialize(taskanaEngineConfiguration);
this.taskHistoryEventResourceAssembler = taskHistoryEventResourceAssembler;
}
@GetMapping
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<TaskHistoryEventListResource> getTaskHistoryEvent(
public ResponseEntity<TaskHistoryEventListResource> getTaskHistoryEvents(
@RequestParam MultiValueMap<String, String> params) throws InvalidArgumentException {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to getTaskHistoryEvent(params= {})", LoggerUtils.mapToString(params));
LOGGER.debug("Entry to getTaskHistoryEvents(params= {})", LoggerUtils.mapToString(params));
}
HistoryQuery query = simpleHistoryService.createHistoryQuery();
@ -166,19 +175,42 @@ public class TaskHistoryEventController extends AbstractPagingController {
throw new InvalidArgumentException("Paging information is incomplete.");
}
TaskHistoryEventListAssembler assembler = new TaskHistoryEventListAssembler();
TaskHistoryEventListResourceAssembler assembler = new TaskHistoryEventListResourceAssembler();
TaskHistoryEventListResource pagedResources =
assembler.toResources(historyEvents, pageMetadata);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
"Exit from getTaskHistoryEvent(), returning {}",
"Exit from getTaskHistoryEvents(), returning {}",
new ResponseEntity<>(pagedResources, HttpStatus.OK));
}
return new ResponseEntity<>(pagedResources, HttpStatus.OK);
}
@GetMapping(path = "/{historyEventId}", produces = "application/hal+json")
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<TaskHistoryEventResource> getTaskHistoryEvent(
@PathVariable String historyEventId) throws TaskanaHistoryEventNotFoundException {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Entry to getTaskHistoryEvent(historyEventId= {})", historyEventId);
}
TaskanaHistoryEvent resultEvent = simpleHistoryService.getHistoryEvent(historyEventId);
TaskHistoryEventResource taskEventResource =
taskHistoryEventResourceAssembler.toResource(resultEvent);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
"Exit from getTaskHistoryEvent, returning {}",
new ResponseEntity<>(taskEventResource, HttpStatus.OK));
}
return new ResponseEntity<>(taskEventResource, HttpStatus.OK);
}
private HistoryQuery applySortingParams(HistoryQuery query, MultiValueMap<String, String> params)
throws IllegalArgumentException, InvalidArgumentException {
if (LOGGER.isDebugEnabled()) {

View File

@ -5,6 +5,7 @@ import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import pro.taskana.rest.resource.TaskHistoryEventResourceAssembler;
import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl;
/** Configuration for Taskana history REST service. */
@ -17,4 +18,9 @@ public class TaskHistoryRestConfiguration {
public SimpleHistoryServiceImpl getSimpleHistoryService() {
return new SimpleHistoryServiceImpl();
}
@Bean
public TaskHistoryEventResourceAssembler getTaskHistoryEventResourceAssembler() {
return new TaskHistoryEventResourceAssembler();
}
}

View File

@ -1,52 +1,47 @@
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', 'UPDATE', DATEADD('DAY', -2, CURRENT_TIMESTAMP), 'USER_1_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '65464564', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'777'),
('BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'119' ,'555'),
('BPI:04' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'999'),
('BPI:03' ,'BPI:02', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'1188' ,'QQQ'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -6, CURRENT_TIMESTAMP), 'USER_2_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'eee'),
('BPI:06' ,'BPI:04', 'TKI:000000000000000000000000000000000001', 'UPDATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'ZZZ' ,'777'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'DELETE', DATEADD('DAY', -5, CURRENT_TIMESTAMP), 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'999'),
('BPI:04' ,'BPI:03', 'TKI:000000000000000000000000000000000001', 'CREATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'288' ,'ooo'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP), 'USER_1_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '65464564', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'SSS'),
('BPI:04' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'DDD' ,'555'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -2, CURRENT_TIMESTAMP), 'USER_1_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '68887564', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'555'),
('BPI:03' ,'BPI:05', 'TKI:000000000000000000000000000000000001', 'UPDATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'123' ,'777'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'DELETE', DATEADD('DAY', -5, CURRENT_TIMESTAMP), 'USER_2_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '68887564', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'456'),
('BPI:03' ,'BPI:07', 'TKI:000000000000000000000000000000000001', 'CREATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'288' ,'ooo'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP), 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'456'),
('BPI:03' ,'BPI:07', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'PPP' ,'777'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -5, CURRENT_TIMESTAMP), 'USER_1_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'999'),
('BPI:05' ,'BPI:03', 'TKI:000000000000000000000000000000000001', 'UPDATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'123' ,'eee'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -2, CURRENT_TIMESTAMP), 'USER_1_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'555'),
('BPI:04' ,'BPI:04', 'TKI:000000000000000000000000000000000001', 'UPDATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'123' ,'555'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -6, CURRENT_TIMESTAMP), 'USER_2_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '77887564', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'SSS'),
('BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'PPP' ,'456'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '77887500', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'777'),
('BPI:05' ,'BPI:03', 'TKI:000000000000000000000000000000000001', 'CREATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'123' ,'ooo'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'DELETE', DATEADD('DAY', -2, CURRENT_TIMESTAMP), 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '77887500', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'QQQ'),
('BPI:05' ,'BPI:04', 'TKI:000000000000000000000000000000000001', 'UPDATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'288' ,'456'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -5, CURRENT_TIMESTAMP), 'USER_2_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'555'),
('BPI:03' ,'BPI:05', 'TKI:000000000000000000000000000000000001', 'UPDATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'000' ,'555'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -6, CURRENT_TIMESTAMP), 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'777'),
('BPI:04' ,'BPI:07', 'TKI:000000000000000000000000000000000001', 'UPDATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'PPP' ,'eee'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -5, CURRENT_TIMESTAMP), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'999'),
('BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'CREATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'PPP' ,'ooo'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP), 'USER_1_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'555'),
('BPI:05' ,'BPI:03', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'123' ,'777'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP), 'USER_1_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '77887500', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'SSS'),
('BPI:06' ,'BPI:07', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'123' ,'QQQ'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP), 'USER_2_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11887500', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'456'),
('BPI:03' ,'BPI:03', 'TKI:000000000000000000000000000000000001', 'CREATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'000' ,'999'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'DELETE', DATEADD('DAY', -1, CURRENT_TIMESTAMP), 'USER_2_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11887599', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'eee'),
('BPI:03' ,'BPI:04', 'TKI:000000000000000000000000000000000001', 'CREATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'aaa' ,'555'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -6, CURRENT_TIMESTAMP), 'USER_1_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'555'),
('BPI:06' ,'BPI:03', 'TKI:000000000000000000000000000000000001', 'UPDATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'acc' ,'ooo'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'DELETE', DATEADD('DAY', -1, CURRENT_TIMESTAMP), 'USER_1_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'777'),
('BPI:04' ,'BPI:03', 'TKI:000000000000000000000000000000000001', 'CREATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'acc' ,'999'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'DELETE', DATEADD('DAY', -1, CURRENT_TIMESTAMP), 'USER_2_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11887599', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'999'),
('BPI:03' ,'BPI:05', 'TKI:000000000000000000000000000000000001', 'UPDATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'WWW' ,'SSS'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -5, CURRENT_TIMESTAMP), 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11887599', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'eee'),
('BPI:06' ,'BPI:05', 'TKI:000000000000000000000000000000000001', 'UPDATE', CURRENT_TIMESTAMP, 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'123' ,'555'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'DELETE', DATEADD('DAY', -1, CURRENT_TIMESTAMP), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'777');
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, OLD_VALUE, NEW_VALUE, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, DETAILS) 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 , OLD_VALUE , NEW_VALUE , CUSTOM_1 , CUSTOM_2 , CUSTOM_3 , CUSTOM_4
('BPI:01' ,'', 'TKI:000000000000000000000000000000000000', 'CREATE', CURRENT_TIMESTAMP , 'USER_2_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' ,' L140101' , 'TASK' ,'' ,'old_val12' ,'new_val12' ,'custom1' ,'custom2' , 'custom3' ,'custom4', 'some Details'),
('BPI:02' ,'', 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -2, CURRENT_TIMESTAMP ), 'USER_1_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '65464564' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:04' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:06' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:04' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'CREATE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:03' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:03' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:05' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'CREATE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:04' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:03' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:05' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:05' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:03' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'CREATE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:04' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:03' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:05' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:06' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'CREATE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:04' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:06' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:04' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details');

View File

@ -72,13 +72,7 @@
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${version.junit.jupiter}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<artifactId>junit-jupiter</artifactId>
<version>${version.junit.jupiter}</version>
<scope>test</scope>
</dependency>

View File

@ -5,17 +5,13 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.sql.SQLException;
import java.time.LocalDateTime;
import java.util.Collections;
import javax.sql.DataSource;
import org.assertj.core.api.ThrowableAssert.ThrowingCallable;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
@ -33,10 +29,9 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate;
import pro.taskana.common.api.exceptions.SystemException;
import pro.taskana.rest.resource.TaskHistoryEventListResource;
import pro.taskana.rest.resource.TaskHistoryEventResource;
import pro.taskana.rest.simplehistory.TaskHistoryRestConfiguration;
import pro.taskana.rest.simplehistory.sampledata.SampleDataGenerator;
/** Controller for integration test. */
@EnableAutoConfiguration
@ -54,26 +49,12 @@ public class TaskHistoryEventControllerIntTest {
String server = "http://127.0.0.1:";
RestTemplate template;
RestTemplate template = getRestTemplate();
HttpEntity<String> request;
@LocalServerPort int port;
@Autowired private DataSource dataSource;
@BeforeEach
public void beforeEach() {
template = getRestTemplate();
SampleDataGenerator sampleDataGenerator;
try {
sampleDataGenerator = new SampleDataGenerator(dataSource);
sampleDataGenerator.generateSampleData(schemaName);
} catch (SQLException e) {
throw new SystemException("tried to reset DB and caught Exception " + e, e);
}
}
@Test
public void testGetAllHistoryEvent() {
ResponseEntity<TaskHistoryEventListResource> response =
@ -83,7 +64,7 @@ public class TaskHistoryEventControllerIntTest {
request,
ParameterizedTypeReference.forType(TaskHistoryEventListResource.class));
assertThat(response.getBody().getLink(Link.REL_SELF)).isNotNull();
assertThat(response.getBody().getContent()).hasSize(50);
assertThat(response.getBody().getContent()).hasSize(45);
}
@Test
@ -102,7 +83,7 @@ public class TaskHistoryEventControllerIntTest {
}
@Test
public void testGetSpecificTaskHistoryEvent() {
public void should_ReturnSpecificTaskHistoryEventWithoutDetails_When_ListIsQueried() {
ResponseEntity<TaskHistoryEventListResource> response =
template.exchange(
server
@ -117,6 +98,21 @@ public class TaskHistoryEventControllerIntTest {
assertThat(response.getBody().getLinks()).isNotNull();
assertThat(response.getBody().getMetadata()).isNotNull();
assertThat(response.getBody().getContent()).hasSize(1);
assertThat(response.getBody().getContent().stream().findFirst().get().getDetails()).isNull();
}
@Test
public void should_ReturnSpecificTaskHistoryEventWithDetails_When_SingleEventIsQueried() {
ResponseEntity<TaskHistoryEventResource> response =
template.exchange(
server + port + "/api/v1/task-history-event/47",
HttpMethod.GET,
request,
ParameterizedTypeReference.forType(TaskHistoryEventResource.class));
assertThat(response.getBody().getLink(Link.REL_SELF)).isNotNull();
assertThat(response.getBody().getLinks()).isNotNull();
assertThat(response.getBody().getDetails()).isNotNull();
}
@Test
@ -163,7 +159,7 @@ public class TaskHistoryEventControllerIntTest {
request,
ParameterizedTypeReference.forType(TaskHistoryEventListResource.class));
assertThat(response.getBody().getLink(Link.REL_SELF)).isNotNull();
assertThat(response.getBody().getContent()).hasSize(25);
assertThat(response.getBody().getContent()).hasSize(23);
}
@Test

View File

@ -0,0 +1,94 @@
package pro.taskana;
import static org.assertj.core.api.Assertions.assertThat;
import java.time.Instant;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import pro.taskana.rest.resource.TaskHistoryEventResource;
import pro.taskana.rest.resource.TaskHistoryEventResourceAssembler;
import pro.taskana.rest.simplehistory.TaskHistoryRestConfiguration;
import pro.taskana.simplehistory.impl.HistoryEventImpl;
import pro.taskana.spi.history.api.events.TaskanaHistoryEvent;
/** Test for {@link TaskHistoryEventResourceAssembler}. */
@EnableAutoConfiguration
@ExtendWith(SpringExtension.class)
@SpringBootTest(
classes = {TaskHistoryRestConfiguration.class},
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class TaskHistoryEventResourceAssemblerTest {
private final TaskHistoryEventResourceAssembler taskHistoryEventResourceAssembler;
@Autowired
public TaskHistoryEventResourceAssemblerTest(
TaskHistoryEventResourceAssembler taskHistoryEventResourceAssembler) {
this.taskHistoryEventResourceAssembler = taskHistoryEventResourceAssembler;
}
@Test
void taskHistoryEventModelToResource() {
HistoryEventImpl historyEvent = new HistoryEventImpl("user1", "someDetails");
historyEvent.setEventType("TASK_CREATED");
historyEvent.setBusinessProcessId("BPI:01");
historyEvent.setParentBusinessProcessId("BPI:02");
historyEvent.setTaskId("TKI:000000000000000000000000000000000000");
historyEvent.setTaskClassificationCategory("MANUAL");
historyEvent.setDomain("DOMAIN_A");
historyEvent.setWorkbasketKey("WorkbasketKey");
historyEvent.setAttachmentClassificationKey("L1050");
historyEvent.setCreated(Instant.now());
historyEvent.setOldValue("oldValue");
historyEvent.setNewValue("newValue");
historyEvent.setPorCompany("porCompany");
historyEvent.setPorSystem("porSystem");
historyEvent.setPorType("porType");
historyEvent.setPorValue("porValue");
historyEvent.setCustom1("custom1");
historyEvent.setCustom2("custom2");
historyEvent.setCustom3("custom3");
historyEvent.setCustom4("custom4");
TaskHistoryEventResource taskHistoryEventResource =
taskHistoryEventResourceAssembler.toResource(historyEvent);
testEquality(historyEvent, taskHistoryEventResource);
}
private void testEquality(
TaskanaHistoryEvent historyEvent, TaskHistoryEventResource taskHistoryEventResource) {
assertThat(historyEvent.getEventType()).isEqualTo(taskHistoryEventResource.getEventType());
assertThat(historyEvent.getBusinessProcessId())
.isEqualTo(taskHistoryEventResource.getBusinessProcessId());
assertThat(historyEvent.getParentBusinessProcessId())
.isEqualTo(taskHistoryEventResource.getParentBusinessProcessId());
assertThat(historyEvent.getTaskId()).isEqualTo(taskHistoryEventResource.getTaskId());
assertThat(historyEvent.getTaskClassificationCategory())
.isEqualTo(taskHistoryEventResource.getTaskClassificationCategory());
assertThat(historyEvent.getDomain()).isEqualTo(taskHistoryEventResource.getDomain());
assertThat(historyEvent.getWorkbasketKey())
.isEqualTo(taskHistoryEventResource.getWorkbasketKey());
assertThat(historyEvent.getAttachmentClassificationKey())
.isEqualTo(taskHistoryEventResource.getAttachmentClassificationKey());
assertThat(historyEvent.getCreated()).isEqualTo(taskHistoryEventResource.getCreated());
assertThat(historyEvent.getOldValue()).isEqualTo(taskHistoryEventResource.getOldValue());
assertThat(historyEvent.getNewValue()).isEqualTo(taskHistoryEventResource.getNewValue());
assertThat(historyEvent.getPorCompany()).isEqualTo(taskHistoryEventResource.getPorCompany());
assertThat(historyEvent.getPorSystem()).isEqualTo(taskHistoryEventResource.getPorSystem());
assertThat(historyEvent.getPorType()).isEqualTo(taskHistoryEventResource.getPorType());
assertThat(historyEvent.getPorValue()).isEqualTo(taskHistoryEventResource.getPorValue());
assertThat(historyEvent.getCustom1()).isEqualTo(taskHistoryEventResource.getCustom1());
assertThat(historyEvent.getCustom2()).isEqualTo(taskHistoryEventResource.getCustom2());
assertThat(historyEvent.getCustom3()).isEqualTo(taskHistoryEventResource.getCustom3());
assertThat(historyEvent.getCustom4()).isEqualTo(taskHistoryEventResource.getCustom4());
}
}

View File

@ -13,7 +13,6 @@ import java.util.HashMap;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
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.RestDocumentationContextProvider;
@ -36,9 +35,7 @@ import pro.taskana.rest.simplehistory.TaskHistoryRestConfiguration;
@ExtendWith({RestDocumentationExtension.class, SpringExtension.class})
public class TaskHistoryEventControllerRestDocumentation {
public RestDocumentationExtension restDocumentation = new RestDocumentationExtension();
@LocalServerPort int port;
@Autowired private WebApplicationContext context;
private MockMvc mockMvc;
@ -49,14 +46,15 @@ public class TaskHistoryEventControllerRestDocumentation {
private FieldDescriptor[] taskHistoryEventFieldDescriptors;
@BeforeEach
public void setUp() {
public void setUp(
WebApplicationContext webApplicationContext,
RestDocumentationContextProvider restDocumentationContextProvider) {
document("{methodName}", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()));
this.mockMvc =
MockMvcBuilders.webAppContextSetup(this.context)
MockMvcBuilders.webAppContextSetup(webApplicationContext)
.apply(
documentationConfiguration(
(RestDocumentationContextProvider) this.restDocumentation)
documentationConfiguration(restDocumentationContextProvider)
.operationPreprocessors()
.withResponseDefaults(prettyPrint())
.withRequestDefaults(prettyPrint()))
@ -82,15 +80,14 @@ public class TaskHistoryEventControllerRestDocumentation {
taskHistoryEventFieldDescriptionsMap.put(
"taskClassificationCategory", "The category of classification");
taskHistoryEventFieldDescriptionsMap.put("attachmentClassificationKey", "");
taskHistoryEventFieldDescriptionsMap.put("comment", "");
taskHistoryEventFieldDescriptionsMap.put("oldValue", "The old value");
taskHistoryEventFieldDescriptionsMap.put("newValue", "The new value");
taskHistoryEventFieldDescriptionsMap.put("custom1", "A custom property with name \"1\"");
taskHistoryEventFieldDescriptionsMap.put("custom2", "A custom property with name \"2\"");
taskHistoryEventFieldDescriptionsMap.put("custom3", "A custom property with name \"3\"");
taskHistoryEventFieldDescriptionsMap.put("custom4", "A custom property with name \"4\"");
taskHistoryEventFieldDescriptionsMap.put("oldData", "The old data");
taskHistoryEventFieldDescriptionsMap.put("newData", "The new data");
taskHistoryEventFieldDescriptionsMap.put("details", "details of changes within the task");
taskHistoryEventFieldDescriptionsMap.put(
"_links.self.href", "The links of this task history event");
taskHistoryEventFieldDescriptionsMap.put(
@ -114,63 +111,45 @@ public class TaskHistoryEventControllerRestDocumentation {
taskHistoryEventFieldDescriptors =
new FieldDescriptor[] {
fieldWithPath("taskHistoryEvents[].taskHistoryId")
fieldWithPath("taskHistoryId")
.description(taskHistoryEventFieldDescriptionsMap.get("taskHistoryId")),
fieldWithPath("taskHistoryEvents[].businessProcessId")
fieldWithPath("businessProcessId")
.description(taskHistoryEventFieldDescriptionsMap.get("businessProcessId")),
fieldWithPath("taskHistoryEvents[].parentBusinessProcessId")
fieldWithPath("parentBusinessProcessId")
.description(taskHistoryEventFieldDescriptionsMap.get("parentBusinessProcessId")),
fieldWithPath("taskHistoryEvents[].taskId")
.description(taskHistoryEventFieldDescriptionsMap.get("taskId")),
fieldWithPath("taskHistoryEvents[].eventType")
fieldWithPath("taskId").description(taskHistoryEventFieldDescriptionsMap.get("taskId")),
fieldWithPath("eventType")
.description(taskHistoryEventFieldDescriptionsMap.get("eventType")),
fieldWithPath("taskHistoryEvents[].created")
.description(taskHistoryEventFieldDescriptionsMap.get("created")),
fieldWithPath("taskHistoryEvents[].userId")
.description(taskHistoryEventFieldDescriptionsMap.get("userId")),
fieldWithPath("taskHistoryEvents[].domain")
.description(taskHistoryEventFieldDescriptionsMap.get("domain")),
fieldWithPath("taskHistoryEvents[].workbasketKey")
fieldWithPath("created").description(taskHistoryEventFieldDescriptionsMap.get("created")),
fieldWithPath("userId").description(taskHistoryEventFieldDescriptionsMap.get("userId")),
fieldWithPath("domain").description(taskHistoryEventFieldDescriptionsMap.get("domain")),
fieldWithPath("workbasketKey")
.description(taskHistoryEventFieldDescriptionsMap.get("workbasketKey")),
fieldWithPath("taskHistoryEvents[].porCompany")
fieldWithPath("porCompany")
.description(taskHistoryEventFieldDescriptionsMap.get("porCompany")),
fieldWithPath("taskHistoryEvents[].porSystem")
fieldWithPath("porSystem")
.description(taskHistoryEventFieldDescriptionsMap.get("porSystem")),
fieldWithPath("taskHistoryEvents[].porInstance")
fieldWithPath("porInstance")
.description(taskHistoryEventFieldDescriptionsMap.get("porInstance")),
fieldWithPath("taskHistoryEvents[].porValue")
fieldWithPath("porValue")
.description(taskHistoryEventFieldDescriptionsMap.get("porValue")),
fieldWithPath("taskHistoryEvents[].porType")
.description(taskHistoryEventFieldDescriptionsMap.get("porType")),
fieldWithPath("taskHistoryEvents[].taskClassificationKey")
fieldWithPath("porType").description(taskHistoryEventFieldDescriptionsMap.get("porType")),
fieldWithPath("taskClassificationKey")
.description(taskHistoryEventFieldDescriptionsMap.get("taskClassificationKey")),
fieldWithPath("taskHistoryEvents[].taskClassificationCategory")
fieldWithPath("taskClassificationCategory")
.description(taskHistoryEventFieldDescriptionsMap.get("taskClassificationCategory")),
fieldWithPath("taskHistoryEvents[].attachmentClassificationKey")
fieldWithPath("attachmentClassificationKey")
.description(taskHistoryEventFieldDescriptionsMap.get("attachmentClassificationKey")),
fieldWithPath("taskHistoryEvents[].comment")
.description(taskHistoryEventFieldDescriptionsMap.get("comment")),
fieldWithPath("taskHistoryEvents[].oldValue")
fieldWithPath("oldValue")
.description(taskHistoryEventFieldDescriptionsMap.get("oldValue")),
fieldWithPath("taskHistoryEvents[].newValue")
fieldWithPath("newValue")
.description(taskHistoryEventFieldDescriptionsMap.get("newValue")),
fieldWithPath("taskHistoryEvents[].custom1")
.description(taskHistoryEventFieldDescriptionsMap.get("custom1")),
fieldWithPath("taskHistoryEvents[].custom2")
.description(taskHistoryEventFieldDescriptionsMap.get("custom2")),
fieldWithPath("taskHistoryEvents[].custom3")
.description(taskHistoryEventFieldDescriptionsMap.get("custom3")),
fieldWithPath("taskHistoryEvents[].custom4")
.description(taskHistoryEventFieldDescriptionsMap.get("custom4")),
fieldWithPath("taskHistoryEvents[].oldData")
.description(taskHistoryEventFieldDescriptionsMap.get("oldData")),
fieldWithPath("taskHistoryEvents[].newData")
.description(taskHistoryEventFieldDescriptionsMap.get("newData")),
fieldWithPath("_links.self.href").ignored(),
fieldWithPath("page.size").ignored(),
fieldWithPath("page.totalElements").ignored(),
fieldWithPath("page.totalPages").ignored(),
fieldWithPath("page.number").ignored()
fieldWithPath("custom1").description(taskHistoryEventFieldDescriptionsMap.get("custom1")),
fieldWithPath("custom2").description(taskHistoryEventFieldDescriptionsMap.get("custom2")),
fieldWithPath("custom3").description(taskHistoryEventFieldDescriptionsMap.get("custom3")),
fieldWithPath("custom4").description(taskHistoryEventFieldDescriptionsMap.get("custom4")),
fieldWithPath("details").description(taskHistoryEventFieldDescriptionsMap.get("details")),
fieldWithPath("_links.self.href").ignored()
};
}
@ -194,9 +173,7 @@ public class TaskHistoryEventControllerRestDocumentation {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.get(
"http://127.0.0.1:"
+ port
+ "/api/v1/task-history-event?business-process-id=BPI:02")
"http://127.0.0.1:" + port + "/api/v1/task-history-event/1")
.accept("application/hal+json")
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
.andExpect(MockMvcResultMatchers.status().isOk())

View File

@ -0,0 +1,40 @@
package pro.taskana.common.internal.util;
import java.lang.reflect.Field;
public class FieldAndValuePairTriplet {
private Field field;
private Object oldValue;
private Object newValue;
public FieldAndValuePairTriplet(Field field, Object oldValue, Object newValue) {
this.field = field;
this.oldValue = oldValue;
this.newValue = newValue;
}
public Field getField() {
return field;
}
public void setField(Field field) {
this.field = field;
}
public Object getOldValue() {
return oldValue;
}
public void setOldValue(Object oldValue) {
this.oldValue = oldValue;
}
public Object getNewValue() {
return newValue;
}
public void setNewValue(Object newValue) {
this.newValue = newValue;
}
}

View File

@ -2,6 +2,7 @@ package pro.taskana.spi.history.api;
import pro.taskana.TaskanaEngineConfiguration;
import pro.taskana.spi.history.api.events.TaskanaHistoryEvent;
import pro.taskana.spi.history.api.exceptions.TaskanaHistoryEventNotFoundException;
/** Interface for TASKANA History Service Provider. */
public interface TaskanaHistory {
@ -20,4 +21,14 @@ public interface TaskanaHistory {
* @param event {@link TaskanaHistoryEvent} The event to be created.
*/
void create(TaskanaHistoryEvent event);
/**
* Get the details of a history event by Id.
*
* @param historyEventId the id of the history event
* @return the history event
* @throws TaskanaHistoryEventNotFoundException If the Id rfers to a not existing history event
*/
TaskanaHistoryEvent getHistoryEvent(String historyEventId)
throws TaskanaHistoryEventNotFoundException;
}

View File

@ -22,18 +22,20 @@ public class TaskanaHistoryEvent {
protected String taskClassificationKey;
protected String taskClassificationCategory;
protected String attachmentClassificationKey;
protected String comment;
protected String oldValue;
protected String newValue;
protected String custom1;
protected String custom2;
protected String custom3;
protected String custom4;
protected String oldData;
protected String newData;
protected String details;
public TaskanaHistoryEvent(String userId) {
public TaskanaHistoryEvent() {
}
public TaskanaHistoryEvent(String userId, String details) {
this.userId = userId;
this.details = details;
}
public long getId() {
@ -168,14 +170,6 @@ public class TaskanaHistoryEvent {
this.attachmentClassificationKey = attachmentClassificationKey;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public String getOldValue() {
return oldValue;
}
@ -224,20 +218,12 @@ public class TaskanaHistoryEvent {
this.custom4 = custom4;
}
public String getOldData() {
return oldData;
public String getDetails() {
return details;
}
public void setOldData(String oldData) {
this.oldData = oldData;
}
public String getNewData() {
return newData;
}
public void setNewData(String newData) {
this.newData = newData;
public void setDetails(String details) {
this.details = details;
}
@Override
@ -269,10 +255,8 @@ public class TaskanaHistoryEvent {
+ this.oldValue
+ ", newValue="
+ this.newValue
+ ", oldData="
+ this.oldData
+ ", newData="
+ this.newData
+ ", details="
+ this.details
+ "]";
}
}

View File

@ -6,7 +6,7 @@ import pro.taskana.task.api.models.Task;
public class ClaimCancelledEvent extends TaskEvent {
public ClaimCancelledEvent(Task task, String userId) {
super(task, userId);
super(task, userId,"");
eventType = "TASK_CLAIM_CANCELLED";
created = task.getModified();
}

View File

@ -6,7 +6,7 @@ import pro.taskana.task.api.models.Task;
public class ClaimedEvent extends TaskEvent {
public ClaimedEvent(Task task, String userId) {
super(task, userId);
super(task, userId,"");
setEventType("TASK_CLAIMED");
created = task.getClaimed();
}

View File

@ -7,13 +7,13 @@ import pro.taskana.task.api.models.TaskSummary;
public class CompletedEvent extends TaskEvent {
public CompletedEvent(Task completedTask, String userId) {
super(completedTask, userId);
super(completedTask, userId,"");
eventType = "TASK_COMPLETED";
created = completedTask.getCompleted();
}
public CompletedEvent(TaskSummary completedTask, String userId) {
super(completedTask, userId);
super(completedTask, userId,"");
eventType = "TASK_COMPLETED";
created = completedTask.getCompleted();
}

View File

@ -5,8 +5,8 @@ import pro.taskana.task.api.models.Task;
/** Event fired if a task is created. */
public class CreatedEvent extends TaskEvent {
public CreatedEvent(Task task, String userId) {
super(task, userId);
public CreatedEvent(Task task, String userId, String details) {
super(task, userId, details);
eventType = "TASK_CREATED";
created = task.getCreated();
}

View File

@ -7,8 +7,8 @@ import pro.taskana.task.api.models.TaskSummary;
/** Super class for all task related events. */
public class TaskEvent extends TaskanaHistoryEvent {
public TaskEvent(Task task, String userId) {
super(userId);
public TaskEvent(Task task, String userId, String details) {
super(userId, details);
taskId = task.getId();
businessProcessId = task.getBusinessProcessId();
parentBusinessProcessId = task.getParentBusinessProcessId();
@ -31,8 +31,8 @@ public class TaskEvent extends TaskanaHistoryEvent {
}
}
public TaskEvent(TaskSummary task, String userId) {
super(userId);
public TaskEvent(TaskSummary task, String userId, String details) {
super(userId, details);
taskId = task.getId();
businessProcessId = task.getBusinessProcessId();
parentBusinessProcessId = task.getParentBusinessProcessId();
@ -173,6 +173,8 @@ public class TaskEvent extends TaskanaHistoryEvent {
+ this.domain
+ ", workbasketKey= "
+ this.workbasketKey
+ ", details= "
+ this.details
+ "]";
}
}

View File

@ -13,7 +13,7 @@ public class TransferredEvent extends TaskEvent {
public TransferredEvent(
Task task, WorkbasketSummary oldWorkbasket, WorkbasketSummary newWorkbasket, String userId) {
super(task, userId);
super(task, userId,"");
eventType = "TASK_TRANSFERRED";
created = task.getModified();
this.oldValue = oldWorkbasket.getId();

View File

@ -0,0 +1,13 @@
package pro.taskana.spi.history.api.events.task;
import pro.taskana.task.api.models.Task;
public class UpdatedEvent extends TaskEvent {
public UpdatedEvent(Task updatedTask, String userId, String details) {
super(updatedTask, userId, details);
eventType = "TASK_UPDATED";
created = updatedTask.getModified();
}
}

View File

@ -0,0 +1,12 @@
package pro.taskana.spi.history.api.exceptions;
import pro.taskana.common.api.exceptions.NotFoundException;
public class TaskanaHistoryEventNotFoundException extends NotFoundException {
private static final long serialVersionUID = 1L;
public TaskanaHistoryEventNotFoundException(String id, String msg) {
super(id, msg);
}
}

View File

@ -1,7 +1,9 @@
package pro.taskana.task.internal;
import java.lang.reflect.Field;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
@ -9,10 +11,13 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.apache.ibatis.exceptions.PersistenceException;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -31,12 +36,15 @@ import pro.taskana.common.api.exceptions.TaskanaException;
import pro.taskana.common.internal.CustomPropertySelector;
import pro.taskana.common.internal.InternalTaskanaEngine;
import pro.taskana.common.internal.security.CurrentUserContext;
import pro.taskana.common.internal.util.CheckedFunction;
import pro.taskana.common.internal.util.FieldAndValuePairTriplet;
import pro.taskana.common.internal.util.IdGenerator;
import pro.taskana.common.internal.util.Pair;
import pro.taskana.spi.history.api.events.task.ClaimCancelledEvent;
import pro.taskana.spi.history.api.events.task.ClaimedEvent;
import pro.taskana.spi.history.api.events.task.CompletedEvent;
import pro.taskana.spi.history.api.events.task.CreatedEvent;
import pro.taskana.spi.history.api.events.task.UpdatedEvent;
import pro.taskana.spi.history.internal.HistoryEventProducer;
import pro.taskana.task.api.CallbackState;
import pro.taskana.task.api.TaskQuery;
@ -224,7 +232,10 @@ public class TaskServiceImpl implements TaskService {
this.taskMapper.insert(task);
LOGGER.debug("Method createTask() created Task '{}'.", task.getId());
if (HistoryEventProducer.isHistoryEnabled()) {
historyEventProducer.createEvent(new CreatedEvent(task, CurrentUserContext.getUserid()));
String details = determineChangesInTaskAttributes(newTask(), task);
historyEventProducer.createEvent(
new CreatedEvent(task, CurrentUserContext.getUserid(), details));
}
} catch (PersistenceException e) {
// Error messages:
@ -420,8 +431,18 @@ public class TaskServiceImpl implements TaskService {
standardUpdateActions(oldTaskImpl, newTaskImpl);
taskMapper.update(newTaskImpl);
LOGGER.debug("Method updateTask() updated task '{}' for user '{}'.", task.getId(), userId);
if (HistoryEventProducer.isHistoryEnabled()) {
String changeDetails = determineChangesInTaskAttributes(oldTaskImpl, newTaskImpl);
LOGGER.warn(changeDetails);
historyEventProducer.createEvent(
new UpdatedEvent(task, CurrentUserContext.getUserid(), changeDetails));
}
} finally {
taskanaEngine.returnConnection();
LOGGER.debug("exit from claim()");
@ -850,6 +871,60 @@ public class TaskServiceImpl implements TaskService {
}
}
protected String determineChangesInTaskAttributes(Task oldTaskImpl, Task newTaskImpl) {
LOGGER.debug(
"Entry to determineChangesInTaskAttributes (oldTaskImpl = {}, newTaskImpl = {}",
oldTaskImpl,
newTaskImpl);
List<Field> fields = new ArrayList<>();
Class<?> currentClass = oldTaskImpl.getClass();
while (currentClass.getSuperclass() != null) {
fields.addAll(Arrays.asList(currentClass.getDeclaredFields()));
currentClass = currentClass.getSuperclass();
}
Predicate<FieldAndValuePairTriplet> areFieldsNotEqual =
fieldAndValuePairTriplet ->
!Objects.equals(
fieldAndValuePairTriplet.getOldValue(), fieldAndValuePairTriplet.getNewValue());
Predicate<FieldAndValuePairTriplet> isFieldNotCustomAttributes =
fieldAndValuePairTriplet ->
!fieldAndValuePairTriplet.getField().getName().equals("customAttributes");
List<JSONObject> changedAttributes =
fields.stream()
.peek(field -> field.setAccessible(true))
.map(
CheckedFunction.wrap(
field ->
new FieldAndValuePairTriplet(
field, field.get(oldTaskImpl), field.get(newTaskImpl))))
.filter(areFieldsNotEqual.and(isFieldNotCustomAttributes))
.map(
fieldAndValuePairTriplet -> {
JSONObject changedAttribute = new JSONObject();
changedAttribute.put("fieldName", fieldAndValuePairTriplet.getField().getName());
changedAttribute.put(
"oldValue",
Optional.ofNullable(fieldAndValuePairTriplet.getOldValue()).orElse(""));
changedAttribute.put(
"newValue",
Optional.ofNullable(fieldAndValuePairTriplet.getNewValue()).orElse(""));
return changedAttribute;
})
.collect(Collectors.toList());
JSONObject changes = new JSONObject();
changes.put("changes", changedAttributes);
LOGGER.debug("Exit from determineChangesInTaskAttributes()");
return changes.toString();
}
Pair<List<MinimalTaskSummary>, BulkLog> getMinimalTaskSummaries(List<String> argTaskIds) {
BulkLog bulkLog = new BulkLog();
// remove duplicates

View File

@ -10,6 +10,8 @@ import java.util.List;
import java.util.UUID;
import javax.sql.DataSource;
import org.assertj.core.api.ThrowableAssert.ThrowingCallable;
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
@ -396,6 +398,22 @@ class TaskServiceImplIntExplicitTest {
}
}
@Test
void should_DetermineDifferences_When_DifferentAttributesInTwoTasks() {
Task newTask = taskServiceImpl.newTask();
newTask.setBusinessProcessId("key1");
newTask.setOwner("owner1");
Task oldTask = taskServiceImpl.newTask();
JSONArray changedAttributes =
new JSONObject(taskServiceImpl.determineChangesInTaskAttributes(oldTask, newTask))
.getJSONArray("changes");
assertThat(changedAttributes).hasSize(2);
}
@Test
void shouldNotTransferAnyTask() throws SQLException {
try (Connection connection = dataSource.getConnection()) {
@ -513,6 +531,8 @@ class TaskServiceImplIntExplicitTest {
assertThat(taskCreated2.isTransferred()).isFalse();
assertThat(taskCreated2.getWorkbasketKey()).isNotEqualTo(wbNoAppendCreated.getKey());
assertThat(taskCreated2.isTransferred()).isFalse();
assertThat(taskCreated2.getWorkbasketKey()).isNotEqualTo(wbNoAppendCreated.getKey());
}
@AfterEach

View File

@ -1,52 +1,47 @@
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', RELATIVE_DATE(0) , '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', 'UPDATE', DATEADD('DAY', -2, RELATIVE_DATE(0) ), 'USER_1_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '65464564', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'777'),
('BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'119' ,'555'),
('BPI:04' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, RELATIVE_DATE(0) ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'999'),
('BPI:03' ,'BPI:02', 'TKI:000000000000000000000000000000000001', 'DELETE', RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'1188' ,'QQQ'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -6, RELATIVE_DATE(0) ), 'USER_2_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'eee'),
('BPI:06' ,'BPI:04', 'TKI:000000000000000000000000000000000001', 'UPDATE', RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'ZZZ' ,'777'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'DELETE', DATEADD('DAY', -5, RELATIVE_DATE(0) ), 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'999'),
('BPI:04' ,'BPI:03', 'TKI:000000000000000000000000000000000001', 'CREATE', RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'288' ,'ooo'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, RELATIVE_DATE(0) ), 'USER_1_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '65464564', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'SSS'),
('BPI:04' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'DDD' ,'555'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -2, RELATIVE_DATE(0) ), 'USER_1_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '68887564', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'555'),
('BPI:03' ,'BPI:05', 'TKI:000000000000000000000000000000000001', 'UPDATE', RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'123' ,'777'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'DELETE', DATEADD('DAY', -5, RELATIVE_DATE(0) ), 'USER_2_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '68887564', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'456'),
('BPI:03' ,'BPI:07', 'TKI:000000000000000000000000000000000001', 'CREATE', RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'288' ,'ooo'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, RELATIVE_DATE(0) ), 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'456'),
('BPI:03' ,'BPI:07', 'TKI:000000000000000000000000000000000001', 'DELETE', RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'PPP' ,'777'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -5, RELATIVE_DATE(0) ), 'USER_1_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'999'),
('BPI:05' ,'BPI:03', 'TKI:000000000000000000000000000000000001', 'UPDATE', RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'123' ,'eee'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -2, RELATIVE_DATE(0) ), 'USER_1_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'555'),
('BPI:04' ,'BPI:04', 'TKI:000000000000000000000000000000000001', 'UPDATE', RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'123' ,'555'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -6, RELATIVE_DATE(0) ), 'USER_2_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '77887564', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'SSS'),
('BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'PPP' ,'456'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, RELATIVE_DATE(0) ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '77887500', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'777'),
('BPI:05' ,'BPI:03', 'TKI:000000000000000000000000000000000001', 'CREATE', RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'123' ,'ooo'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'DELETE', DATEADD('DAY', -2, RELATIVE_DATE(0) ), 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '77887500', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'QQQ'),
('BPI:05' ,'BPI:04', 'TKI:000000000000000000000000000000000001', 'UPDATE', RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'288' ,'456'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -5, RELATIVE_DATE(0) ), 'USER_2_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'555'),
('BPI:03' ,'BPI:05', 'TKI:000000000000000000000000000000000001', 'UPDATE', RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'000' ,'555'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -6, RELATIVE_DATE(0) ), 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'777'),
('BPI:04' ,'BPI:07', 'TKI:000000000000000000000000000000000001', 'UPDATE', RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'PPP' ,'eee'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -5, RELATIVE_DATE(0) ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'999'),
('BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'CREATE', RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'PPP' ,'ooo'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -1, RELATIVE_DATE(0) ), 'USER_1_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'555'),
('BPI:05' ,'BPI:03', 'TKI:000000000000000000000000000000000001', 'DELETE', RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'123' ,'777'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, RELATIVE_DATE(0) ), 'USER_1_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '77887500', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'SSS'),
('BPI:06' ,'BPI:07', 'TKI:000000000000000000000000000000000001', 'DELETE', RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'123' ,'QQQ'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, RELATIVE_DATE(0) ), 'USER_2_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11887500', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'456'),
('BPI:03' ,'BPI:03', 'TKI:000000000000000000000000000000000001', 'CREATE', RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'000' ,'999'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'DELETE', DATEADD('DAY', -1, RELATIVE_DATE(0) ), 'USER_2_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11887599', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'eee'),
('BPI:03' ,'BPI:04', 'TKI:000000000000000000000000000000000001', 'CREATE', RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'aaa' ,'555'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -6, RELATIVE_DATE(0) ), 'USER_1_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'555'),
('BPI:06' ,'BPI:03', 'TKI:000000000000000000000000000000000001', 'UPDATE', RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'acc' ,'ooo'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'DELETE', DATEADD('DAY', -1, RELATIVE_DATE(0) ), 'USER_1_2', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'777'),
('BPI:04' ,'BPI:03', 'TKI:000000000000000000000000000000000001', 'CREATE', RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'acc' ,'999'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'DELETE', DATEADD('DAY', -1, RELATIVE_DATE(0) ), 'USER_2_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11887599', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'999'),
('BPI:03' ,'BPI:05', 'TKI:000000000000000000000000000000000001', 'UPDATE', RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'WWW' ,'SSS'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -5, RELATIVE_DATE(0) ), 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11887599', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'eee'),
('BPI:06' ,'BPI:05', 'TKI:000000000000000000000000000000000001', 'UPDATE', RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' , 'created a bug' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'123' ,'555'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'DELETE', DATEADD('DAY', -1, RELATIVE_DATE(0) ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' , 'created by Peter' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'234' ,'777');
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, OLD_VALUE, NEW_VALUE, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, DETAILS) 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 , OLD_VALUE , NEW_VALUE , CUSTOM_1 , CUSTOM_2 , CUSTOM_3 , CUSTOM_4
('BPI:01' ,'', 'TKI:000000000000000000000000000000000000', 'CREATE', CURRENT_TIMESTAMP , 'USER_2_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' ,' L140101' , 'TASK' ,'' ,'old_val12' ,'new_val12' ,'custom1' ,'custom2' , 'custom3' ,'custom4', 'some Details'),
('BPI:02' ,'', 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -2, CURRENT_TIMESTAMP ), 'USER_1_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '65464564' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:04' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:06' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:04' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'CREATE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:03' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:03' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:05' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'CREATE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:04' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:03' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:05' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:05' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:03' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'CREATE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:04' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:03' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:05' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:06' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'CREATE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:04' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:06' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('BPI:04' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATE', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETE', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details');

View File

@ -24,6 +24,8 @@ public final class Mapping {
PRE + "classifications-by-type";
public static final String URL_CURRENT_USER = PRE + "current-user-info";
public static final String URL_HISTORY_ENABLED = PRE + "history-provider-enabled";
public static final String URL_HISTORY_EVENTS = PRE + "task-history-event";
public static final String URL_HISTORY_EVENTS_ID = "/{historyEventId}";
public static final String URL_VERSION = PRE + "version";
public static final String URL_TASKS = PRE + "tasks";
public static final String URL_TASKS_ID = URL_TASKS + "/{taskId}";