diff --git a/history/taskana-simplehistory-provider/pom.xml b/history/taskana-simplehistory-provider/pom.xml index 6c766f971..d53b9f15e 100644 --- a/history/taskana-simplehistory-provider/pom.xml +++ b/history/taskana-simplehistory-provider/pom.xml @@ -53,13 +53,7 @@ org.junit.jupiter - junit-jupiter-api - ${version.junit.jupiter} - test - - - org.junit.jupiter - junit-jupiter-engine + junit-jupiter ${version.junit.jupiter} test diff --git a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/HistoryEventImpl.java b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/HistoryEventImpl.java index e07e6b471..eed67cef3 100644 --- a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/HistoryEventImpl.java +++ b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/HistoryEventImpl.java @@ -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); } } diff --git a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/HistoryQueryImpl.java b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/HistoryQueryImpl.java index e1ce3df1a..dc2974864 100644 --- a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/HistoryQueryImpl.java +++ b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/HistoryQueryImpl.java @@ -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 { @@ -510,7 +453,7 @@ public class HistoryQueryImpl implements HistoryQuery { "Custom number has to be between 1 and 4, but this is: " + num); } } - + @Override public List list() { LOGGER.debug("entry to list(), this = {}", this); diff --git a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/SimpleHistoryServiceImpl.java b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/SimpleHistoryServiceImpl.java index 1a07f5f62..de8416853 100644 --- a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/SimpleHistoryServiceImpl.java +++ b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/SimpleHistoryServiceImpl.java @@ -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); } diff --git a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/mappings/HistoryEventMapper.java b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/mappings/HistoryEventMapper.java index 40410c77c..a9301444a 100644 --- a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/mappings/HistoryEventMapper.java +++ b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/mappings/HistoryEventMapper.java @@ -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 { "") void insert(@Param("historyEvent") TaskanaHistoryEvent historyEvent); + + + @Select( + "") + @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); } diff --git a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/mappings/HistoryQueryMapper.java b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/mappings/HistoryQueryMapper.java index d6195d351..53dddcfc4 100644 --- a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/mappings/HistoryQueryMapper.java +++ b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/mappings/HistoryQueryMapper.java @@ -16,7 +16,7 @@ public interface HistoryQueryMapper { "") long countHistoryEvent(HistoryQueryImpl historyEventQuery); @@ -188,15 +173,12 @@ public interface HistoryQueryMapper { + "AND UPPER(TASK_CLASSIFICATION_KEY) IN (#{item}) " + "AND UPPER(TASK_CLASSIFICATION_CATEGORY) IN (#{item}) " + "AND UPPER(ATTACHMENT_CLASSIFICATION_KEY) IN (#{item}) " - + "AND UPPER(COMMENT) IN (#{item}) " + "AND UPPER(OLD_VALUE) IN (#{item}) " + "AND UPPER(NEW_VALUE) IN (#{item}) " + "AND UPPER(CUSTOM_1) IN (#{item}) " + "AND UPPER(CUSTOM_2) IN (#{item}) " + "AND UPPER(CUSTOM_3) IN (#{item}) " + "AND UPPER(CUSTOM_4) IN (#{item}) " - + "AND UPPER(OLD_DATA) IN (#{item}) " - + "AND UPPER(NEW_DATA) IN (#{item}) " // LIKE-Queries + "AND ( UPPER(BUSINESS_PROCESS_ID) LIKE #{item} ) " + "AND (UPPER(PARENT_BUSINESS_PROCESS_ID) LIKE #{item}) " @@ -213,15 +195,12 @@ public interface HistoryQueryMapper { + "AND (UPPER(TASK_CLASSIFICATION_KEY) LIKE #{item}) " + "AND (UPPER(TASK_CLASSIFICATION_CATEGORY) LIKE #{item}) " + "AND (UPPER(ATTACHMENT_CLASSIFICATION_KEY) LIKE #{item}) " - + "AND (UPPER(COMMENT) LIKE #{item}) " + "AND (UPPER(OLD_VALUE) LIKE #{item}) " + "AND (UPPER(NEW_VALUE) LIKE #{item}) " + "AND (UPPER(CUSTOM_1) LIKE #{item}) " + "AND (UPPER(CUSTOM_2) LIKE #{item}) " + "AND (UPPER(CUSTOM_3) LIKE #{item}) " + "AND (UPPER(CUSTOM_4) LIKE #{item}) " - + "AND (UPPER(OLD_DATA) LIKE #{item}) " - + "AND (UPPER(NEW_DATA) LIKE #{item}) " + "" + "ORDER BY ${item} " + "") diff --git a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/query/HistoryQuery.java b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/query/HistoryQuery.java index 44cfa78e3..0ba348f19 100644 --- a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/query/HistoryQuery.java +++ b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/query/HistoryQuery.java @@ -145,14 +145,6 @@ public interface HistoryQuery extends BaseQuery defaultList = - getHistoryService().createHistoryQuery().listValues(HistoryQueryColumnName.COMMENT, null); + getHistoryService().createHistoryQuery().listValues(HistoryQueryColumnName.TASK_ID, null); List 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 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 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); } } diff --git a/history/taskana-simplehistory-provider/src/test/java/pro/taskana/simplehistory/impl/HistoryQueryImplTest.java b/history/taskana-simplehistory-provider/src/test/java/pro/taskana/simplehistory/impl/HistoryQueryImplTest.java index 6d26dd8eb..f0391ae60 100644 --- a/history/taskana-simplehistory-provider/src/test/java/pro/taskana/simplehistory/impl/HistoryQueryImplTest.java +++ b/history/taskana-simplehistory-provider/src/test/java/pro/taskana/simplehistory/impl/HistoryQueryImplTest.java @@ -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; } diff --git a/history/taskana-simplehistory-provider/src/test/java/pro/taskana/simplehistory/impl/SimpleHistoryServiceImplTest.java b/history/taskana-simplehistory-provider/src/test/java/pro/taskana/simplehistory/impl/SimpleHistoryServiceImplTest.java index 667aed2bc..9c482220c 100644 --- a/history/taskana-simplehistory-provider/src/test/java/pro/taskana/simplehistory/impl/SimpleHistoryServiceImplTest.java +++ b/history/taskana-simplehistory-provider/src/test/java/pro/taskana/simplehistory/impl/SimpleHistoryServiceImplTest.java @@ -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 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 result = cutSpy.createHistoryQuery().taskIdIn("taskId1").list(); diff --git a/history/taskana-simplehistory-provider/src/test/resources/sql/history-events.sql b/history/taskana-simplehistory-provider/src/test/resources/sql/history-events.sql index bc97070ef..4201a2df2 100644 --- a/history/taskana-simplehistory-provider/src/test/resources/sql/history-events.sql +++ b/history/taskana-simplehistory-provider/src/test/resources/sql/history-events.sql @@ -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') +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, 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' ) ; diff --git a/history/taskana-simplehistory-rest-spring-example/src/main/resources/application.properties b/history/taskana-simplehistory-rest-spring-example/src/main/resources/application.properties index abc3b0ebd..b570b787e 100644 --- a/history/taskana-simplehistory-rest-spring-example/src/main/resources/application.properties +++ b/history/taskana-simplehistory-rest-spring-example/src/main/resources/application.properties @@ -1,2 +1,5 @@ logging.level.pro.taskana=DEBUG taskana.schemaName=TASKANA + +spring.main.allow-bean-definition-overriding=true + diff --git a/history/taskana-simplehistory-rest-spring/pom.xml b/history/taskana-simplehistory-rest-spring/pom.xml index 25b154a28..71e739500 100644 --- a/history/taskana-simplehistory-rest-spring/pom.xml +++ b/history/taskana-simplehistory-rest-spring/pom.xml @@ -58,5 +58,5 @@ ${version.jackson} - + diff --git a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/rest/resource/TaskHistoryEventListAssembler.java b/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/rest/resource/TaskHistoryEventListResourceAssembler.java similarity index 89% rename from history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/rest/resource/TaskHistoryEventListAssembler.java rename to history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/rest/resource/TaskHistoryEventListResourceAssembler.java index 45310db46..5a5273dc9 100644 --- a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/rest/resource/TaskHistoryEventListAssembler.java +++ b/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/rest/resource/TaskHistoryEventListResourceAssembler.java @@ -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 historyEvents, PageMetadata pageMetadata) { - TaskHistoryEventAssembler assembler = new TaskHistoryEventAssembler(); + TaskHistoryEventResourceAssembler assembler = new TaskHistoryEventResourceAssembler(); List resources = assembler.toResources(historyEvents); TaskHistoryEventListResource pagedResources = new TaskHistoryEventListResource(resources, pageMetadata); diff --git a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/rest/resource/TaskHistoryEventResource.java b/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/rest/resource/TaskHistoryEventResource.java index 69ad1c4c1..d91a2e218 100644 --- a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/rest/resource/TaskHistoryEventResource.java +++ b/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/rest/resource/TaskHistoryEventResource.java @@ -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 + "]"; } } diff --git a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/rest/resource/TaskHistoryEventAssembler.java b/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/rest/resource/TaskHistoryEventResourceAssembler.java similarity index 53% rename from history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/rest/resource/TaskHistoryEventAssembler.java rename to history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/rest/resource/TaskHistoryEventResourceAssembler.java index 87c0852f6..d7a333f02 100644 --- a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/rest/resource/TaskHistoryEventAssembler.java +++ b/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/rest/resource/TaskHistoryEventResourceAssembler.java @@ -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 { - 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; } } diff --git a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/rest/simplehistory/TaskHistoryEventController.java b/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/rest/simplehistory/TaskHistoryEventController.java index ef4117333..e6d82e39c 100644 --- a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/rest/simplehistory/TaskHistoryEventController.java +++ b/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/rest/simplehistory/TaskHistoryEventController.java @@ -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 getTaskHistoryEvent( + public ResponseEntity getTaskHistoryEvents( @RequestParam MultiValueMap 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 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 params) throws IllegalArgumentException, InvalidArgumentException { if (LOGGER.isDebugEnabled()) { diff --git a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/rest/simplehistory/TaskHistoryRestConfiguration.java b/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/rest/simplehistory/TaskHistoryRestConfiguration.java index 1959d2cd6..873fdd11a 100644 --- a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/rest/simplehistory/TaskHistoryRestConfiguration.java +++ b/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/rest/simplehistory/TaskHistoryRestConfiguration.java @@ -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(); + } } diff --git a/history/taskana-simplehistory-rest-spring/src/main/resources/sql.sample-data/history-event.sql b/history/taskana-simplehistory-rest-spring/src/main/resources/sql.sample-data/history-event.sql index 7e6fd1c7c..d0d2a91a2 100644 --- a/history/taskana-simplehistory-rest-spring/src/main/resources/sql.sample-data/history-event.sql +++ b/history/taskana-simplehistory-rest-spring/src/main/resources/sql.sample-data/history-event.sql @@ -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'); \ No newline at end of file diff --git a/history/taskana-simplehistory-spring-test/pom.xml b/history/taskana-simplehistory-spring-test/pom.xml index d9a3b5a86..17245d928 100644 --- a/history/taskana-simplehistory-spring-test/pom.xml +++ b/history/taskana-simplehistory-spring-test/pom.xml @@ -72,13 +72,7 @@ org.junit.jupiter - junit-jupiter-api - ${version.junit.jupiter} - test - - - org.junit.jupiter - junit-jupiter-engine + junit-jupiter ${version.junit.jupiter} test diff --git a/history/taskana-simplehistory-spring-test/src/test/java/pro/taskana/TaskHistoryEventControllerIntTest.java b/history/taskana-simplehistory-spring-test/src/test/java/pro/taskana/TaskHistoryEventControllerIntTest.java index d49793dba..b3b6823e9 100644 --- a/history/taskana-simplehistory-spring-test/src/test/java/pro/taskana/TaskHistoryEventControllerIntTest.java +++ b/history/taskana-simplehistory-spring-test/src/test/java/pro/taskana/TaskHistoryEventControllerIntTest.java @@ -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 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 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 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 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 diff --git a/history/taskana-simplehistory-spring-test/src/test/java/pro/taskana/TaskHistoryEventResourceAssemblerTest.java b/history/taskana-simplehistory-spring-test/src/test/java/pro/taskana/TaskHistoryEventResourceAssemblerTest.java new file mode 100644 index 000000000..5e67196bc --- /dev/null +++ b/history/taskana-simplehistory-spring-test/src/test/java/pro/taskana/TaskHistoryEventResourceAssemblerTest.java @@ -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()); + } +} diff --git a/history/taskana-simplehistory-spring-test/src/test/java/pro/taskana/doc/api/TaskHistoryEventControllerRestDocumentation.java b/history/taskana-simplehistory-spring-test/src/test/java/pro/taskana/doc/api/TaskHistoryEventControllerRestDocumentation.java index 29ca6c81e..8bce54ad7 100644 --- a/history/taskana-simplehistory-spring-test/src/test/java/pro/taskana/doc/api/TaskHistoryEventControllerRestDocumentation.java +++ b/history/taskana-simplehistory-spring-test/src/test/java/pro/taskana/doc/api/TaskHistoryEventControllerRestDocumentation.java @@ -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()) diff --git a/lib/taskana-core/src/main/java/pro/taskana/common/internal/util/FieldAndValuePairTriplet.java b/lib/taskana-core/src/main/java/pro/taskana/common/internal/util/FieldAndValuePairTriplet.java new file mode 100644 index 000000000..04f4488e4 --- /dev/null +++ b/lib/taskana-core/src/main/java/pro/taskana/common/internal/util/FieldAndValuePairTriplet.java @@ -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; + } +} diff --git a/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/TaskanaHistory.java b/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/TaskanaHistory.java index 0443e148f..d3e8b3a99 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/TaskanaHistory.java +++ b/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/TaskanaHistory.java @@ -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; } diff --git a/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/TaskanaHistoryEvent.java b/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/TaskanaHistoryEvent.java index cf851a2f7..de57cd2fd 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/TaskanaHistoryEvent.java +++ b/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/TaskanaHistoryEvent.java @@ -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 + "]"; } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/ClaimCancelledEvent.java b/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/ClaimCancelledEvent.java index 2a94d2978..8a1fb25e2 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/ClaimCancelledEvent.java +++ b/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/ClaimCancelledEvent.java @@ -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(); } diff --git a/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/ClaimedEvent.java b/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/ClaimedEvent.java index 9fdddb8ee..b0480098f 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/ClaimedEvent.java +++ b/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/ClaimedEvent.java @@ -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(); } diff --git a/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/CompletedEvent.java b/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/CompletedEvent.java index d967562d2..d84cf29e7 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/CompletedEvent.java +++ b/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/CompletedEvent.java @@ -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(); } diff --git a/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/CreatedEvent.java b/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/CreatedEvent.java index ead47cdb9..42208db5b 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/CreatedEvent.java +++ b/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/CreatedEvent.java @@ -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(); } diff --git a/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/TaskEvent.java b/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/TaskEvent.java index b077aaa30..cc4de38e2 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/TaskEvent.java +++ b/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/TaskEvent.java @@ -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(); @@ -164,15 +164,17 @@ public class TaskEvent extends TaskanaHistoryEvent { @Override public String toString() { return "TaskEvent [taskId= " - + this.taskId - + ", businessProcessId= " - + this.businessProcessId - + ", parentBusinessProcessId= " - + this.parentBusinessProcessId - + ", domain= " - + this.domain - + ", workbasketKey= " - + this.workbasketKey - + "]"; + + this.taskId + + ", businessProcessId= " + + this.businessProcessId + + ", parentBusinessProcessId= " + + this.parentBusinessProcessId + + ", domain= " + + this.domain + + ", workbasketKey= " + + this.workbasketKey + + ", details= " + + this.details + + "]"; } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/TransferredEvent.java b/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/TransferredEvent.java index 0c21a988a..7d89781bb 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/TransferredEvent.java +++ b/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/TransferredEvent.java @@ -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(); diff --git a/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/UpdatedEvent.java b/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/UpdatedEvent.java new file mode 100644 index 000000000..bfd0181d9 --- /dev/null +++ b/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/events/task/UpdatedEvent.java @@ -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(); + } + +} diff --git a/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/exceptions/TaskanaHistoryEventNotFoundException.java b/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/exceptions/TaskanaHistoryEventNotFoundException.java new file mode 100644 index 000000000..aa598caa0 --- /dev/null +++ b/lib/taskana-core/src/main/java/pro/taskana/spi/history/api/exceptions/TaskanaHistoryEventNotFoundException.java @@ -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); + } +} diff --git a/lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskServiceImpl.java b/lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskServiceImpl.java index 741ecc85f..04c868f61 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskServiceImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskServiceImpl.java @@ -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 fields = new ArrayList<>(); + + Class currentClass = oldTaskImpl.getClass(); + while (currentClass.getSuperclass() != null) { + fields.addAll(Arrays.asList(currentClass.getDeclaredFields())); + currentClass = currentClass.getSuperclass(); + } + + Predicate areFieldsNotEqual = + fieldAndValuePairTriplet -> + !Objects.equals( + fieldAndValuePairTriplet.getOldValue(), fieldAndValuePairTriplet.getNewValue()); + Predicate isFieldNotCustomAttributes = + fieldAndValuePairTriplet -> + !fieldAndValuePairTriplet.getField().getName().equals("customAttributes"); + + List 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, BulkLog> getMinimalTaskSummaries(List argTaskIds) { BulkLog bulkLog = new BulkLog(); // remove duplicates diff --git a/lib/taskana-core/src/test/java/pro/taskana/task/internal/TaskServiceImplIntExplicitTest.java b/lib/taskana-core/src/test/java/pro/taskana/task/internal/TaskServiceImplIntExplicitTest.java index 488cbfed6..1ab495e05 100644 --- a/lib/taskana-core/src/test/java/pro/taskana/task/internal/TaskServiceImplIntExplicitTest.java +++ b/lib/taskana-core/src/test/java/pro/taskana/task/internal/TaskServiceImplIntExplicitTest.java @@ -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 diff --git a/lib/taskana-data/src/main/resources/sql/sample-data/history-event.sql b/lib/taskana-data/src/main/resources/sql/sample-data/history-event.sql index bc5ef6e75..d0d2a91a2 100644 --- a/lib/taskana-data/src/main/resources/sql/sample-data/history-event.sql +++ b/lib/taskana-data/src/main/resources/sql/sample-data/history-event.sql @@ -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'); \ No newline at end of file diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/Mapping.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/Mapping.java index bba188296..8964cb670 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/Mapping.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/Mapping.java @@ -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}";