TSK-1365: Add classification history events
This commit is contained in:
parent
0e83abd0fd
commit
67d082a42d
|
|
@ -18,6 +18,7 @@ import pro.taskana.TaskanaEngineConfiguration;
|
||||||
import pro.taskana.common.api.TaskanaEngine;
|
import pro.taskana.common.api.TaskanaEngine;
|
||||||
import pro.taskana.common.api.exceptions.SystemException;
|
import pro.taskana.common.api.exceptions.SystemException;
|
||||||
import pro.taskana.spi.history.api.TaskanaHistory;
|
import pro.taskana.spi.history.api.TaskanaHistory;
|
||||||
|
import pro.taskana.spi.history.api.events.classification.ClassificationHistoryEvent;
|
||||||
import pro.taskana.spi.history.api.events.task.TaskHistoryEvent;
|
import pro.taskana.spi.history.api.events.task.TaskHistoryEvent;
|
||||||
import pro.taskana.spi.history.api.events.workbasket.WorkbasketHistoryEvent;
|
import pro.taskana.spi.history.api.events.workbasket.WorkbasketHistoryEvent;
|
||||||
|
|
||||||
|
|
@ -26,6 +27,8 @@ public class LogfileHistoryServiceImpl implements TaskanaHistory {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(LogfileHistoryServiceImpl.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(LogfileHistoryServiceImpl.class);
|
||||||
private static final String TASKANA_PROPERTIES = "/taskana.properties";
|
private static final String TASKANA_PROPERTIES = "/taskana.properties";
|
||||||
private static final String TASKANA_HISTORYLOGGER_NAME = "taskana.historylogger.name";
|
private static final String TASKANA_HISTORYLOGGER_NAME = "taskana.historylogger.name";
|
||||||
|
private static final String JSON_EXCEPTION =
|
||||||
|
"Caught exception while serializing history event to JSON ";
|
||||||
private static Logger historyLogger;
|
private static Logger historyLogger;
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
|
|
@ -57,7 +60,7 @@ public class LogfileHistoryServiceImpl implements TaskanaHistory {
|
||||||
historyLogger.info(objectMapper.writeValueAsString(event));
|
historyLogger.info(objectMapper.writeValueAsString(event));
|
||||||
}
|
}
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
throw new SystemException("Caught exception while serializing history event to JSON ", e);
|
throw new SystemException(JSON_EXCEPTION, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,7 +72,19 @@ public class LogfileHistoryServiceImpl implements TaskanaHistory {
|
||||||
historyLogger.info(objectMapper.writeValueAsString(event));
|
historyLogger.info(objectMapper.writeValueAsString(event));
|
||||||
}
|
}
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
throw new SystemException("Caught exception while serializing history event to JSON ", e);
|
throw new SystemException(JSON_EXCEPTION, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void create(ClassificationHistoryEvent event) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (historyLogger.isInfoEnabled()) {
|
||||||
|
historyLogger.info(objectMapper.writeValueAsString(event));
|
||||||
|
}
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
throw new SystemException(JSON_EXCEPTION, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,12 @@ import uk.org.lidalia.slf4jtest.TestLogger;
|
||||||
import uk.org.lidalia.slf4jtest.TestLoggerFactory;
|
import uk.org.lidalia.slf4jtest.TestLoggerFactory;
|
||||||
|
|
||||||
import pro.taskana.common.api.TaskanaEngine;
|
import pro.taskana.common.api.TaskanaEngine;
|
||||||
|
import pro.taskana.spi.history.api.events.classification.ClassificationHistoryEvent;
|
||||||
|
import pro.taskana.spi.history.api.events.classification.ClassificationHistoryEventType;
|
||||||
import pro.taskana.spi.history.api.events.task.TaskHistoryEvent;
|
import pro.taskana.spi.history.api.events.task.TaskHistoryEvent;
|
||||||
|
import pro.taskana.spi.history.api.events.task.TaskHistoryEventType;
|
||||||
import pro.taskana.spi.history.api.events.workbasket.WorkbasketHistoryEvent;
|
import pro.taskana.spi.history.api.events.workbasket.WorkbasketHistoryEvent;
|
||||||
|
import pro.taskana.spi.history.api.events.workbasket.WorkbasketHistoryEventType;
|
||||||
|
|
||||||
class LogfileHistoryServiceImplTest {
|
class LogfileHistoryServiceImplTest {
|
||||||
|
|
||||||
|
|
@ -40,7 +44,7 @@ class LogfileHistoryServiceImplTest {
|
||||||
TaskHistoryEvent eventToBeLogged = new TaskHistoryEvent();
|
TaskHistoryEvent eventToBeLogged = new TaskHistoryEvent();
|
||||||
eventToBeLogged.setId("someId");
|
eventToBeLogged.setId("someId");
|
||||||
eventToBeLogged.setUserId("someUser");
|
eventToBeLogged.setUserId("someUser");
|
||||||
eventToBeLogged.setEventType("TASK_CREATED");
|
eventToBeLogged.setEventType(TaskHistoryEventType.CREATED.getName());
|
||||||
eventToBeLogged.setDomain("DOMAIN_A");
|
eventToBeLogged.setDomain("DOMAIN_A");
|
||||||
eventToBeLogged.setCreated(Instant.now());
|
eventToBeLogged.setCreated(Instant.now());
|
||||||
eventToBeLogged.setNewValue("someNewValue");
|
eventToBeLogged.setNewValue("someNewValue");
|
||||||
|
|
@ -68,7 +72,7 @@ class LogfileHistoryServiceImplTest {
|
||||||
WorkbasketHistoryEvent eventToBeLogged = new WorkbasketHistoryEvent();
|
WorkbasketHistoryEvent eventToBeLogged = new WorkbasketHistoryEvent();
|
||||||
eventToBeLogged.setId("someId");
|
eventToBeLogged.setId("someId");
|
||||||
eventToBeLogged.setUserId("someUser");
|
eventToBeLogged.setUserId("someUser");
|
||||||
eventToBeLogged.setEventType("TASK_CREATED");
|
eventToBeLogged.setEventType(WorkbasketHistoryEventType.CREATED.getName());
|
||||||
eventToBeLogged.setDomain("DOMAIN_A");
|
eventToBeLogged.setDomain("DOMAIN_A");
|
||||||
eventToBeLogged.setCreated(Instant.now());
|
eventToBeLogged.setCreated(Instant.now());
|
||||||
eventToBeLogged.setKey("someWorkbasketKey");
|
eventToBeLogged.setKey("someWorkbasketKey");
|
||||||
|
|
@ -83,4 +87,27 @@ class LogfileHistoryServiceImplTest {
|
||||||
|
|
||||||
assertThat(eventToBeLogged).isEqualTo(deserializedEventFromLogMessage);
|
assertThat(eventToBeLogged).isEqualTo(deserializedEventFromLogMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void should_LogClassificationEventAsJson_When_CreateIsCalled() throws Exception {
|
||||||
|
|
||||||
|
logfileHistoryServiceImpl.initialize(taskanaEngine);
|
||||||
|
ClassificationHistoryEvent eventToBeLogged = new ClassificationHistoryEvent();
|
||||||
|
eventToBeLogged.setId("someId");
|
||||||
|
eventToBeLogged.setUserId("someUser");
|
||||||
|
eventToBeLogged.setEventType(ClassificationHistoryEventType.CREATED.getName());
|
||||||
|
eventToBeLogged.setDomain("DOMAIN_A");
|
||||||
|
eventToBeLogged.setCreated(Instant.now());
|
||||||
|
eventToBeLogged.setKey("someClassificationKey");
|
||||||
|
eventToBeLogged.setDetails("someDetails");
|
||||||
|
|
||||||
|
logfileHistoryServiceImpl.create(eventToBeLogged);
|
||||||
|
|
||||||
|
String logMessage = logger.getLoggingEvents().asList().get(0).getMessage();
|
||||||
|
|
||||||
|
ClassificationHistoryEvent deserializedEventFromLogMessage =
|
||||||
|
objectMapper.readValue(logMessage, ClassificationHistoryEvent.class);
|
||||||
|
|
||||||
|
assertThat(eventToBeLogged).isEqualTo(deserializedEventFromLogMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,5 +68,10 @@
|
||||||
<artifactId>h2</artifactId>
|
<artifactId>h2</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.postgresql</groupId>
|
||||||
|
<artifactId>postgresql</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,715 @@
|
||||||
|
package pro.taskana.simplehistory.impl;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.ibatis.session.RowBounds;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import pro.taskana.common.api.TimeInterval;
|
||||||
|
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||||
|
import pro.taskana.common.api.exceptions.SystemException;
|
||||||
|
import pro.taskana.simplehistory.impl.classification.ClassificationHistoryQuery;
|
||||||
|
import pro.taskana.simplehistory.impl.classification.ClassificationHistoryQueryColumnName;
|
||||||
|
import pro.taskana.spi.history.api.events.classification.ClassificationHistoryCustomField;
|
||||||
|
import pro.taskana.spi.history.api.events.classification.ClassificationHistoryEvent;
|
||||||
|
|
||||||
|
public class ClassificationHistoryQueryImpl implements ClassificationHistoryQuery {
|
||||||
|
|
||||||
|
private static final String CLASSIFICATION_PACKAGE_PATH =
|
||||||
|
"pro.taskana.simplehistory.impl.classification.";
|
||||||
|
private static final String LINK_TO_MAPPER =
|
||||||
|
CLASSIFICATION_PACKAGE_PATH + "ClassificationHistoryQueryMapper.queryHistoryEvents";
|
||||||
|
private static final String LINK_TO_VALUE_MAPPER =
|
||||||
|
CLASSIFICATION_PACKAGE_PATH + "ClassificationHistoryQueryMapper.queryHistoryColumnValues";
|
||||||
|
private static final String LINK_TO_COUNTER =
|
||||||
|
CLASSIFICATION_PACKAGE_PATH + "ClassificationHistoryQueryMapper.countHistoryEvents";
|
||||||
|
|
||||||
|
private static final Logger LOGGER =
|
||||||
|
LoggerFactory.getLogger(ClassificationHistoryQueryImpl.class);
|
||||||
|
|
||||||
|
private static final String SQL_EXCEPTION_MESSAGE =
|
||||||
|
"Method openConnection() could not open a connection to the database.";
|
||||||
|
|
||||||
|
private TaskanaHistoryEngineImpl taskanaHistoryEngine;
|
||||||
|
|
||||||
|
private ClassificationHistoryQueryColumnName columnName;
|
||||||
|
private List<String> orderBy;
|
||||||
|
private List<String> orderColumns;
|
||||||
|
|
||||||
|
private String[] idIn;
|
||||||
|
private String[] eventTypeIn;
|
||||||
|
private TimeInterval[] createdIn;
|
||||||
|
private String[] userIdIn;
|
||||||
|
private String[] classificationIdIn;
|
||||||
|
private String[] applicationEntryPointIn;
|
||||||
|
private String[] categoryIn;
|
||||||
|
private String[] domainIn;
|
||||||
|
private String[] keyIn;
|
||||||
|
private String[] nameIn;
|
||||||
|
private String[] parentIdIn;
|
||||||
|
private String[] parentKeyIn;
|
||||||
|
private int[] priorityIn;
|
||||||
|
private String[] serviceLevelIn;
|
||||||
|
private String[] typeIn;
|
||||||
|
private String[] custom1In;
|
||||||
|
private String[] custom2In;
|
||||||
|
private String[] custom3In;
|
||||||
|
private String[] custom4In;
|
||||||
|
private String[] custom5In;
|
||||||
|
private String[] custom6In;
|
||||||
|
private String[] custom7In;
|
||||||
|
private String[] custom8In;
|
||||||
|
|
||||||
|
private String[] eventTypeLike;
|
||||||
|
private String[] userIdLike;
|
||||||
|
private String[] classificationIdLike;
|
||||||
|
private String[] applicationEntryPointLike;
|
||||||
|
private String[] categoryLike;
|
||||||
|
private String[] domainLike;
|
||||||
|
private String[] keyLike;
|
||||||
|
private String[] nameLike;
|
||||||
|
private String[] parentIdLike;
|
||||||
|
private String[] parentKeyLike;
|
||||||
|
private String[] serviceLevelLike;
|
||||||
|
private String[] typeLike;
|
||||||
|
private String[] custom1Like;
|
||||||
|
private String[] custom2Like;
|
||||||
|
private String[] custom3Like;
|
||||||
|
private String[] custom4Like;
|
||||||
|
private String[] custom5Like;
|
||||||
|
private String[] custom6Like;
|
||||||
|
private String[] custom7Like;
|
||||||
|
private String[] custom8Like;
|
||||||
|
|
||||||
|
public ClassificationHistoryQueryImpl(TaskanaHistoryEngineImpl internalTaskanaHistoryEngine) {
|
||||||
|
this.taskanaHistoryEngine = internalTaskanaHistoryEngine;
|
||||||
|
this.orderBy = new ArrayList<>();
|
||||||
|
this.orderColumns = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery idIn(String... idIn) {
|
||||||
|
this.idIn = toUpperCopy(idIn);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery eventTypeIn(String... eventType) {
|
||||||
|
this.eventTypeIn = toUpperCopy(eventType);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery createdWithin(TimeInterval... createdWithin) {
|
||||||
|
this.createdIn = createdWithin;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery userIdIn(String... userId) {
|
||||||
|
this.userIdIn = toUpperCopy(userId);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery classificationIdIn(String... classificationId) {
|
||||||
|
this.classificationIdIn = toUpperCopy(classificationId);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery applicationEntryPointIn(String... applicationEntryPoint) {
|
||||||
|
this.applicationEntryPointIn = toUpperCopy(applicationEntryPoint);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery categoryIn(String... category) {
|
||||||
|
this.categoryIn = toUpperCopy(category);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery domainIn(String... domain) {
|
||||||
|
this.domainIn = toUpperCopy(domain);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery keyIn(String... key) {
|
||||||
|
this.keyIn = toUpperCopy(key);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery nameIn(String... name) {
|
||||||
|
this.nameIn = toUpperCopy(name);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery parentIdIn(String... parentId) {
|
||||||
|
this.parentIdIn = toUpperCopy(parentId);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery parentKeyIn(String... parentKey) {
|
||||||
|
this.parentKeyIn = toUpperCopy(parentKey);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery priorityIn(int... priorities) {
|
||||||
|
this.priorityIn = priorities;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery serviceLevelIn(String... serviceLevelIn) {
|
||||||
|
this.serviceLevelIn = serviceLevelIn;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery typeIn(String... type) {
|
||||||
|
this.typeIn = type;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery customAttributeIn(
|
||||||
|
ClassificationHistoryCustomField customField, String... searchArguments) {
|
||||||
|
switch (customField) {
|
||||||
|
case CUSTOM_1:
|
||||||
|
custom1In = toUpperCopy(searchArguments);
|
||||||
|
break;
|
||||||
|
case CUSTOM_2:
|
||||||
|
custom2In = toUpperCopy(searchArguments);
|
||||||
|
break;
|
||||||
|
case CUSTOM_3:
|
||||||
|
custom3In = toUpperCopy(searchArguments);
|
||||||
|
break;
|
||||||
|
case CUSTOM_4:
|
||||||
|
custom4In = toUpperCopy(searchArguments);
|
||||||
|
break;
|
||||||
|
case CUSTOM_5:
|
||||||
|
custom5In = toUpperCopy(searchArguments);
|
||||||
|
break;
|
||||||
|
case CUSTOM_6:
|
||||||
|
custom6In = toUpperCopy(searchArguments);
|
||||||
|
break;
|
||||||
|
case CUSTOM_7:
|
||||||
|
custom7In = toUpperCopy(searchArguments);
|
||||||
|
break;
|
||||||
|
case CUSTOM_8:
|
||||||
|
custom8In = toUpperCopy(searchArguments);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new SystemException("Unknown customField '" + customField + "'");
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery eventTypeLike(String... eventType) {
|
||||||
|
this.eventTypeLike = toUpperCopy(eventType);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery userIdLike(String... userId) {
|
||||||
|
this.userIdLike = toUpperCopy(userId);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery classificationIdLike(String... classificationId) {
|
||||||
|
this.classificationIdLike = toUpperCopy(classificationId);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery applicationEntryPointLike(String... applicationEntryPointLike) {
|
||||||
|
this.applicationEntryPointLike = toUpperCopy(applicationEntryPointLike);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery categoryLike(String... category) {
|
||||||
|
this.categoryLike = toUpperCopy(category);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery domainLike(String... domain) {
|
||||||
|
this.domainLike = toUpperCopy(domain);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery keyLike(String... key) {
|
||||||
|
this.keyLike = toUpperCopy(key);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery nameLike(String... name) {
|
||||||
|
this.nameLike = toUpperCopy(name);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery parentIdLike(String... parentId) {
|
||||||
|
this.parentIdLike = toUpperCopy(parentId);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery parentKeyLike(String... parentKey) {
|
||||||
|
this.parentKeyLike = toUpperCopy(parentKey);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery serviceLevelLike(String... serviceLevel) {
|
||||||
|
this.serviceLevelLike = toUpperCopy(serviceLevel);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery typeLike(String... type) {
|
||||||
|
this.typeLike = toUpperCopy(type);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery customAttributeLike(
|
||||||
|
ClassificationHistoryCustomField customField, String... searchArguments) {
|
||||||
|
switch (customField) {
|
||||||
|
case CUSTOM_1:
|
||||||
|
custom1Like = toUpperCopy(searchArguments);
|
||||||
|
break;
|
||||||
|
case CUSTOM_2:
|
||||||
|
custom2Like = toUpperCopy(searchArguments);
|
||||||
|
break;
|
||||||
|
case CUSTOM_3:
|
||||||
|
custom3Like = toUpperCopy(searchArguments);
|
||||||
|
break;
|
||||||
|
case CUSTOM_4:
|
||||||
|
custom4Like = toUpperCopy(searchArguments);
|
||||||
|
break;
|
||||||
|
case CUSTOM_5:
|
||||||
|
custom5Like = toUpperCopy(searchArguments);
|
||||||
|
break;
|
||||||
|
case CUSTOM_6:
|
||||||
|
custom6Like = toUpperCopy(searchArguments);
|
||||||
|
break;
|
||||||
|
case CUSTOM_7:
|
||||||
|
custom7Like = toUpperCopy(searchArguments);
|
||||||
|
break;
|
||||||
|
case CUSTOM_8:
|
||||||
|
custom8Like = toUpperCopy(searchArguments);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new SystemException("Unknown customField '" + customField + "'");
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery orderByEventType(SortDirection sortDirection) {
|
||||||
|
return addOrderCriteria("EVENT_TYPE", sortDirection);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery orderByCreated(SortDirection sortDirection) {
|
||||||
|
return addOrderCriteria("CREATED", sortDirection);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery orderByUserId(SortDirection sortDirection) {
|
||||||
|
return addOrderCriteria("USER_ID", sortDirection);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery orderByClassificationId(SortDirection sortDirection) {
|
||||||
|
return addOrderCriteria("CLASSIFICATION_ID", sortDirection);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery orderByApplicationEntryPoint(SortDirection sortDirection) {
|
||||||
|
return addOrderCriteria("APPLICATION_ENTRY_POINT", sortDirection);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery orderByCategory(SortDirection sortDirection) {
|
||||||
|
return addOrderCriteria("CATEGORY", sortDirection);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery orderByDomain(SortDirection sortDirection) {
|
||||||
|
return addOrderCriteria("DOMAIN", sortDirection);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery orderByKey(SortDirection sortDirection) {
|
||||||
|
return addOrderCriteria("KEY", sortDirection);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery orderByName(SortDirection sortDirection) {
|
||||||
|
return addOrderCriteria("NAME", sortDirection);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery orderByParentId(SortDirection sortDirection) {
|
||||||
|
return addOrderCriteria("PARENT_ID", sortDirection);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery orderByParentKey(SortDirection sortDirection) {
|
||||||
|
return addOrderCriteria("PARENT_KEY", sortDirection);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery orderByPriority(SortDirection sortDirection) {
|
||||||
|
return addOrderCriteria("PRIORITY", sortDirection);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery orderByServiceLevel(SortDirection sortDirection) {
|
||||||
|
return addOrderCriteria("SERVICE_LEVEL", sortDirection);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery orderByType(SortDirection sortDirection) {
|
||||||
|
return addOrderCriteria("TYPE", sortDirection);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryQuery orderByCustomAttribute(int num, SortDirection sortDirection)
|
||||||
|
throws InvalidArgumentException {
|
||||||
|
|
||||||
|
switch (num) {
|
||||||
|
case 1:
|
||||||
|
return addOrderCriteria("CUSTOM_1", sortDirection);
|
||||||
|
case 2:
|
||||||
|
return addOrderCriteria("CUSTOM_2", sortDirection);
|
||||||
|
case 3:
|
||||||
|
return addOrderCriteria("CUSTOM_3", sortDirection);
|
||||||
|
case 4:
|
||||||
|
return addOrderCriteria("CUSTOM_4", sortDirection);
|
||||||
|
case 5:
|
||||||
|
return addOrderCriteria("CUSTOM_5", sortDirection);
|
||||||
|
case 6:
|
||||||
|
return addOrderCriteria("CUSTOM_6", sortDirection);
|
||||||
|
case 7:
|
||||||
|
return addOrderCriteria("CUSTOM_7", sortDirection);
|
||||||
|
case 8:
|
||||||
|
return addOrderCriteria("CUSTOM_8", sortDirection);
|
||||||
|
default:
|
||||||
|
throw new InvalidArgumentException(
|
||||||
|
"Custom number has to be between 1 and 8, but this is: " + num);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ClassificationHistoryEvent> list() {
|
||||||
|
LOGGER.debug("entry to list(), this = {}", this);
|
||||||
|
List<ClassificationHistoryEvent> result = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
taskanaHistoryEngine.openConnection();
|
||||||
|
result = taskanaHistoryEngine.getSqlSession().selectList(LINK_TO_MAPPER, this);
|
||||||
|
return result;
|
||||||
|
} catch (SQLException e) {
|
||||||
|
LOGGER.error(SQL_EXCEPTION_MESSAGE, e.getCause());
|
||||||
|
return result;
|
||||||
|
} finally {
|
||||||
|
taskanaHistoryEngine.returnConnection();
|
||||||
|
if (LOGGER.isDebugEnabled()) {
|
||||||
|
LOGGER.debug(
|
||||||
|
"exit from list(). Returning {} resulting Objects: {} ", result.size(), result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ClassificationHistoryEvent> list(int offset, int limit) {
|
||||||
|
LOGGER.debug("entry to list({},{}), this = {}", offset, limit, this);
|
||||||
|
List<ClassificationHistoryEvent> result = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
taskanaHistoryEngine.openConnection();
|
||||||
|
RowBounds rowBounds = new RowBounds(offset, limit);
|
||||||
|
result = taskanaHistoryEngine.getSqlSession().selectList(LINK_TO_MAPPER, this, rowBounds);
|
||||||
|
return result;
|
||||||
|
} catch (SQLException e) {
|
||||||
|
LOGGER.error(SQL_EXCEPTION_MESSAGE, e.getCause());
|
||||||
|
return result;
|
||||||
|
} finally {
|
||||||
|
taskanaHistoryEngine.returnConnection();
|
||||||
|
if (LOGGER.isDebugEnabled()) {
|
||||||
|
LOGGER.debug(
|
||||||
|
"exit from list(offset,limit). Returning {} resulting Objects: {} ",
|
||||||
|
result.size(),
|
||||||
|
result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> listValues(
|
||||||
|
ClassificationHistoryQueryColumnName dbColumnName, SortDirection sortDirection) {
|
||||||
|
LOGGER.debug(
|
||||||
|
"entry to listValues() of column {} with sortDirection {}, this {}",
|
||||||
|
dbColumnName,
|
||||||
|
sortDirection,
|
||||||
|
this);
|
||||||
|
List<String> result = new ArrayList<>();
|
||||||
|
this.columnName = dbColumnName;
|
||||||
|
List<String> cacheOrderBy = this.orderBy;
|
||||||
|
this.orderBy.clear();
|
||||||
|
this.addOrderCriteria(columnName.toString(), sortDirection);
|
||||||
|
|
||||||
|
try {
|
||||||
|
taskanaHistoryEngine.openConnection();
|
||||||
|
result = taskanaHistoryEngine.getSqlSession().selectList(LINK_TO_VALUE_MAPPER, this);
|
||||||
|
return result;
|
||||||
|
} catch (SQLException e) {
|
||||||
|
LOGGER.error(SQL_EXCEPTION_MESSAGE, e.getCause());
|
||||||
|
return result;
|
||||||
|
} finally {
|
||||||
|
this.orderBy = cacheOrderBy;
|
||||||
|
this.columnName = null;
|
||||||
|
this.orderColumns.remove(orderColumns.size() - 1);
|
||||||
|
taskanaHistoryEngine.returnConnection();
|
||||||
|
if (LOGGER.isDebugEnabled()) {
|
||||||
|
LOGGER.debug(
|
||||||
|
"Exit from listValues. Returning {} resulting Objects: {} ", result.size(), result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassificationHistoryEvent single() {
|
||||||
|
LOGGER.debug("entry to single(), this = {}", this);
|
||||||
|
ClassificationHistoryEvent result = null;
|
||||||
|
try {
|
||||||
|
taskanaHistoryEngine.openConnection();
|
||||||
|
List<ClassificationHistoryEvent> results =
|
||||||
|
taskanaHistoryEngine.getSqlSession().selectList(LINK_TO_MAPPER, this);
|
||||||
|
if (results.isEmpty()) {
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
result = results.get(0);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
} catch (SQLException e) {
|
||||||
|
LOGGER.error(SQL_EXCEPTION_MESSAGE, e.getCause());
|
||||||
|
return result;
|
||||||
|
} finally {
|
||||||
|
taskanaHistoryEngine.returnConnection();
|
||||||
|
LOGGER.debug("exit from single(). Returning result {} ", result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long count() {
|
||||||
|
LOGGER.debug("entry to count(), this = {}", this);
|
||||||
|
Long rowCount = null;
|
||||||
|
try {
|
||||||
|
taskanaHistoryEngine.openConnection();
|
||||||
|
rowCount = taskanaHistoryEngine.getSqlSession().selectOne(LINK_TO_COUNTER, this);
|
||||||
|
return (rowCount == null) ? 0L : rowCount;
|
||||||
|
} catch (SQLException e) {
|
||||||
|
LOGGER.error(SQL_EXCEPTION_MESSAGE, e.getCause());
|
||||||
|
return -1;
|
||||||
|
} finally {
|
||||||
|
taskanaHistoryEngine.returnConnection();
|
||||||
|
LOGGER.debug("exit from count(). Returning result {} ", rowCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ClassificationHistoryQueryImpl addOrderCriteria(
|
||||||
|
String columnName, SortDirection sortDirection) {
|
||||||
|
String orderByDirection =
|
||||||
|
" " + (sortDirection == null ? SortDirection.ASCENDING : sortDirection);
|
||||||
|
orderBy.add(columnName + orderByDirection);
|
||||||
|
orderColumns.add(columnName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getIdIn() {
|
||||||
|
return idIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getEventTypeIn() {
|
||||||
|
return eventTypeIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimeInterval[] getCreatedIn() {
|
||||||
|
return createdIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getUserIdIn() {
|
||||||
|
return userIdIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getClassificationIdIn() {
|
||||||
|
return classificationIdIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getApplicationEntryPointIn() {
|
||||||
|
return applicationEntryPointIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getCategoryIn() {
|
||||||
|
return categoryIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getDomainIn() {
|
||||||
|
return domainIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getKeyIn() {
|
||||||
|
return keyIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getNameIn() {
|
||||||
|
return nameIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getParentIdIn() {
|
||||||
|
return parentIdIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getParentKeyIn() {
|
||||||
|
return parentKeyIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[] getPriorityIn() {
|
||||||
|
return priorityIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getServiceLevelIn() {
|
||||||
|
return serviceLevelIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getTypeIn() {
|
||||||
|
return typeIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getCustom1In() {
|
||||||
|
return custom1In;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getCustom2In() {
|
||||||
|
return custom2In;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getCustom3In() {
|
||||||
|
return custom3In;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getCustom4In() {
|
||||||
|
return custom4In;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getCustom5In() {
|
||||||
|
return custom5In;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getCustom6In() {
|
||||||
|
return custom6In;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getCustom7In() {
|
||||||
|
return custom7In;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getCustom8In() {
|
||||||
|
return custom8In;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getEventTypeLike() {
|
||||||
|
return eventTypeLike;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getUserIdLike() {
|
||||||
|
return userIdLike;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getClassificationIdLike() {
|
||||||
|
return classificationIdLike;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getApplicationEntryPointLike() {
|
||||||
|
return applicationEntryPointLike;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getCategoryLike() {
|
||||||
|
return categoryLike;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getDomainLike() {
|
||||||
|
return domainLike;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getKeyLike() {
|
||||||
|
return keyLike;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getNameLike() {
|
||||||
|
return nameLike;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getParentIdLike() {
|
||||||
|
return parentIdLike;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getParentKeyLike() {
|
||||||
|
return parentKeyLike;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getServiceLevelLike() {
|
||||||
|
return serviceLevelLike;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getTypeLike() {
|
||||||
|
return typeLike;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getCustom1Like() {
|
||||||
|
return custom1Like;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getCustom2Like() {
|
||||||
|
return custom2Like;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getCustom3Like() {
|
||||||
|
return custom3Like;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getCustom4Like() {
|
||||||
|
return custom4Like;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getCustom5Like() {
|
||||||
|
return custom5Like;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getCustom6Like() {
|
||||||
|
return custom6Like;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getCustom7Like() {
|
||||||
|
return custom7Like;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getCustom8Like() {
|
||||||
|
return custom8Like;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -11,11 +11,14 @@ import pro.taskana.common.api.TaskanaEngine;
|
||||||
import pro.taskana.common.api.TaskanaRole;
|
import pro.taskana.common.api.TaskanaRole;
|
||||||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
||||||
|
import pro.taskana.simplehistory.impl.classification.ClassificationHistoryEventMapper;
|
||||||
|
import pro.taskana.simplehistory.impl.classification.ClassificationHistoryQuery;
|
||||||
import pro.taskana.simplehistory.impl.task.TaskHistoryEventMapper;
|
import pro.taskana.simplehistory.impl.task.TaskHistoryEventMapper;
|
||||||
import pro.taskana.simplehistory.impl.task.TaskHistoryQuery;
|
import pro.taskana.simplehistory.impl.task.TaskHistoryQuery;
|
||||||
import pro.taskana.simplehistory.impl.workbasket.WorkbasketHistoryEventMapper;
|
import pro.taskana.simplehistory.impl.workbasket.WorkbasketHistoryEventMapper;
|
||||||
import pro.taskana.simplehistory.impl.workbasket.WorkbasketHistoryQuery;
|
import pro.taskana.simplehistory.impl.workbasket.WorkbasketHistoryQuery;
|
||||||
import pro.taskana.spi.history.api.TaskanaHistory;
|
import pro.taskana.spi.history.api.TaskanaHistory;
|
||||||
|
import pro.taskana.spi.history.api.events.classification.ClassificationHistoryEvent;
|
||||||
import pro.taskana.spi.history.api.events.task.TaskHistoryEvent;
|
import pro.taskana.spi.history.api.events.task.TaskHistoryEvent;
|
||||||
import pro.taskana.spi.history.api.events.workbasket.WorkbasketHistoryEvent;
|
import pro.taskana.spi.history.api.events.workbasket.WorkbasketHistoryEvent;
|
||||||
import pro.taskana.spi.history.api.exceptions.TaskanaHistoryEventNotFoundException;
|
import pro.taskana.spi.history.api.exceptions.TaskanaHistoryEventNotFoundException;
|
||||||
|
|
@ -27,6 +30,7 @@ public class SimpleHistoryServiceImpl implements TaskanaHistory {
|
||||||
private TaskanaHistoryEngineImpl taskanaHistoryEngine;
|
private TaskanaHistoryEngineImpl taskanaHistoryEngine;
|
||||||
private TaskHistoryEventMapper taskHistoryEventMapper;
|
private TaskHistoryEventMapper taskHistoryEventMapper;
|
||||||
private WorkbasketHistoryEventMapper workbasketHistoryEventMapper;
|
private WorkbasketHistoryEventMapper workbasketHistoryEventMapper;
|
||||||
|
private ClassificationHistoryEventMapper classificationHistoryEventMapper;
|
||||||
|
|
||||||
public void initialize(TaskanaEngine taskanaEngine) {
|
public void initialize(TaskanaEngine taskanaEngine) {
|
||||||
|
|
||||||
|
|
@ -42,6 +46,8 @@ public class SimpleHistoryServiceImpl implements TaskanaHistory {
|
||||||
this.taskanaHistoryEngine.getSqlSession().getMapper(TaskHistoryEventMapper.class);
|
this.taskanaHistoryEngine.getSqlSession().getMapper(TaskHistoryEventMapper.class);
|
||||||
this.workbasketHistoryEventMapper =
|
this.workbasketHistoryEventMapper =
|
||||||
this.taskanaHistoryEngine.getSqlSession().getMapper(WorkbasketHistoryEventMapper.class);
|
this.taskanaHistoryEngine.getSqlSession().getMapper(WorkbasketHistoryEventMapper.class);
|
||||||
|
this.classificationHistoryEventMapper =
|
||||||
|
this.taskanaHistoryEngine.getSqlSession().getMapper(ClassificationHistoryEventMapper.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -57,7 +63,7 @@ public class SimpleHistoryServiceImpl implements TaskanaHistory {
|
||||||
LOGGER.error("Error while inserting task history event into database", e);
|
LOGGER.error("Error while inserting task history event into database", e);
|
||||||
} finally {
|
} finally {
|
||||||
taskanaHistoryEngine.returnConnection();
|
taskanaHistoryEngine.returnConnection();
|
||||||
LOGGER.debug("Exit from create(TaskanaHistoryEvent event). Returning object = {}.", event);
|
LOGGER.debug("Exit from create(TaskHistoryEvent event). Returning object = {}.", event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -74,7 +80,25 @@ public class SimpleHistoryServiceImpl implements TaskanaHistory {
|
||||||
LOGGER.error("Error while inserting workbasket history event into database", e);
|
LOGGER.error("Error while inserting workbasket history event into database", e);
|
||||||
} finally {
|
} finally {
|
||||||
taskanaHistoryEngine.returnConnection();
|
taskanaHistoryEngine.returnConnection();
|
||||||
LOGGER.debug("Exit from create(TaskanaHistoryEvent event). Returning object = {}.", event);
|
LOGGER.debug("Exit from create(WorkbasketHistoryEvent event). Returning object = {}.", event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void create(ClassificationHistoryEvent event) {
|
||||||
|
try {
|
||||||
|
taskanaHistoryEngine.openConnection();
|
||||||
|
if (event.getCreated() == null) {
|
||||||
|
Instant now = Instant.now();
|
||||||
|
event.setCreated(now);
|
||||||
|
}
|
||||||
|
classificationHistoryEventMapper.insert(event);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
LOGGER.error("Error while inserting classification history event into database", e);
|
||||||
|
} finally {
|
||||||
|
taskanaHistoryEngine.returnConnection();
|
||||||
|
LOGGER.debug(
|
||||||
|
"Exit from create(ClassificationHistoryEvent event). Returning object = {}.", event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -138,6 +162,10 @@ public class SimpleHistoryServiceImpl implements TaskanaHistory {
|
||||||
return new WorkbasketHistoryQueryImpl(taskanaHistoryEngine);
|
return new WorkbasketHistoryQueryImpl(taskanaHistoryEngine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ClassificationHistoryQuery createClassificationHistoryQuery() {
|
||||||
|
return new ClassificationHistoryQueryImpl(taskanaHistoryEngine);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ATTENTION: This method exists for testing purposes.
|
* ATTENTION: This method exists for testing purposes.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@ import pro.taskana.common.api.TaskanaRole;
|
||||||
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.common.internal.security.CurrentUserContext;
|
import pro.taskana.common.internal.security.CurrentUserContext;
|
||||||
import pro.taskana.simplehistory.TaskanaHistoryEngine;
|
import pro.taskana.simplehistory.TaskanaHistoryEngine;
|
||||||
|
import pro.taskana.simplehistory.impl.classification.ClassificationHistoryEventMapper;
|
||||||
|
import pro.taskana.simplehistory.impl.classification.ClassificationHistoryQueryMapper;
|
||||||
import pro.taskana.simplehistory.impl.task.TaskHistoryEventMapper;
|
import pro.taskana.simplehistory.impl.task.TaskHistoryEventMapper;
|
||||||
import pro.taskana.simplehistory.impl.task.TaskHistoryQueryMapper;
|
import pro.taskana.simplehistory.impl.task.TaskHistoryQueryMapper;
|
||||||
import pro.taskana.simplehistory.impl.workbasket.WorkbasketHistoryEventMapper;
|
import pro.taskana.simplehistory.impl.workbasket.WorkbasketHistoryEventMapper;
|
||||||
|
|
@ -104,6 +106,9 @@ public class TaskanaHistoryEngineImpl implements TaskanaHistoryEngine {
|
||||||
configuration.addMapper(TaskHistoryQueryMapper.class);
|
configuration.addMapper(TaskHistoryQueryMapper.class);
|
||||||
configuration.addMapper(WorkbasketHistoryEventMapper.class);
|
configuration.addMapper(WorkbasketHistoryEventMapper.class);
|
||||||
configuration.addMapper(WorkbasketHistoryQueryMapper.class);
|
configuration.addMapper(WorkbasketHistoryQueryMapper.class);
|
||||||
|
configuration.addMapper(ClassificationHistoryEventMapper.class);
|
||||||
|
configuration.addMapper(ClassificationHistoryQueryMapper.class);
|
||||||
|
|
||||||
SqlSessionFactory localSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
|
SqlSessionFactory localSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
|
||||||
return SqlSessionManager.newInstance(localSessionFactory);
|
return SqlSessionManager.newInstance(localSessionFactory);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ public class WorkbasketHistoryQueryImpl implements WorkbasketHistoryQuery {
|
||||||
+ "WorkbasketHistoryQueryMapper.queryHistoryColumnValues";
|
+ "WorkbasketHistoryQueryMapper.queryHistoryColumnValues";
|
||||||
private static final String LINK_TO_COUNTER =
|
private static final String LINK_TO_COUNTER =
|
||||||
"pro.taskana.simplehistory.impl.workbasket.WorkbasketHistoryQueryMapper.countHistoryEvents";
|
"pro.taskana.simplehistory.impl.workbasket.WorkbasketHistoryQueryMapper.countHistoryEvents";
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(WorkbasketHistoryQueryImpl.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(WorkbasketHistoryQueryImpl.class);
|
||||||
|
|
||||||
private static final String SQL_EXCEPTION_MESSAGE =
|
private static final String SQL_EXCEPTION_MESSAGE =
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
package pro.taskana.simplehistory.impl.classification;
|
||||||
|
|
||||||
|
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.classification.ClassificationHistoryEvent;
|
||||||
|
|
||||||
|
/** This class is the mybatis mapping of classification history events. */
|
||||||
|
@SuppressWarnings("checkstyle:LineLength")
|
||||||
|
public interface ClassificationHistoryEventMapper {
|
||||||
|
|
||||||
|
@Insert(
|
||||||
|
"<script>INSERT INTO CLASSIFICATION_HISTORY_EVENT (ID,"
|
||||||
|
+ " EVENT_TYPE, CREATED, USER_ID, CLASSIFICATION_ID, APPLICATION_ENTRY_POINT, CATEGORY,"
|
||||||
|
+ " DOMAIN, KEY, NAME, PARENT_ID, PARENT_KEY, PRIORITY, SERVICE_LEVEL, TYPE,"
|
||||||
|
+ " CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, CUSTOM_6, CUSTOM_7, CUSTOM_8, DETAILS)"
|
||||||
|
+ " VALUES ( #{historyEvent.id}, #{historyEvent.eventType},"
|
||||||
|
+ " #{historyEvent.created}, #{historyEvent.userId}, #{historyEvent.classificationId}, "
|
||||||
|
+ " #{historyEvent.applicationEntryPoint}, #{historyEvent.category}, "
|
||||||
|
+ " #{historyEvent.domain}, #{historyEvent.key}, #{historyEvent.name}, #{historyEvent.parentId}, "
|
||||||
|
+ " #{historyEvent.parentKey}, #{historyEvent.priority}, #{historyEvent.serviceLevel}, #{historyEvent.type}, "
|
||||||
|
+ " #{historyEvent.custom1}, #{historyEvent.custom2}, #{historyEvent.custom3}, "
|
||||||
|
+ "#{historyEvent.custom4}, #{historyEvent.custom5}, #{historyEvent.custom6}, "
|
||||||
|
+ "#{historyEvent.custom7}, #{historyEvent.custom8}, #{historyEvent.details}) "
|
||||||
|
+ "</script>")
|
||||||
|
void insert(@Param("historyEvent") ClassificationHistoryEvent historyEvent);
|
||||||
|
|
||||||
|
@Select(
|
||||||
|
"<script>"
|
||||||
|
+ "SELECT ID, EVENT_TYPE, CREATED, USER_ID, CLASSIFICATION_ID, APPLICATION_ENTRY_POINT, CATEGORY,"
|
||||||
|
+ " DOMAIN, KEY, NAME, PARENT_ID, PARENT_KEY, PRIORITY, SERVICE_LEVEL, TYPE,"
|
||||||
|
+ " CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, CUSTOM_6, CUSTOM_7, CUSTOM_8, DETAILS"
|
||||||
|
+ " FROM CLASSIFICATION_HISTORY_EVENT WHERE ID = #{id} "
|
||||||
|
+ "<if test=\"_databaseId == 'db2'\">with UR </if> "
|
||||||
|
+ "</script>")
|
||||||
|
@Results(
|
||||||
|
value = {
|
||||||
|
@Result(property = "id", column = "ID"),
|
||||||
|
@Result(property = "eventType", column = "EVENT_TYPE"),
|
||||||
|
@Result(property = "created", column = "CREATED"),
|
||||||
|
@Result(property = "userId", column = "USER_ID"),
|
||||||
|
@Result(property = "classificationId", column = "CLASSIFICATION_ID"),
|
||||||
|
@Result(property = "applicationEntryPoint", column = "APPLICATION_ENTRY_POINT"),
|
||||||
|
@Result(property = "category", column = "CATEGORY"),
|
||||||
|
@Result(property = "domain", column = "DOMAIN"),
|
||||||
|
@Result(property = "key", column = "KEY"),
|
||||||
|
@Result(property = "name", column = "NAME"),
|
||||||
|
@Result(property = "parentId", column = "PARENT_ID"),
|
||||||
|
@Result(property = "parentKey", column = "PARENT_KEY"),
|
||||||
|
@Result(property = "priority", column = "PRIORITY"),
|
||||||
|
@Result(property = "serviceLevel", column = "SERVICE_LEVEL"),
|
||||||
|
@Result(property = "type", column = "TYPE"),
|
||||||
|
@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 = "custom5", column = "CUSTOM_5"),
|
||||||
|
@Result(property = "custom6", column = "CUSTOM_6"),
|
||||||
|
@Result(property = "custom7", column = "CUSTOM_7"),
|
||||||
|
@Result(property = "custom8", column = "CUSTOM_8"),
|
||||||
|
@Result(property = "details", column = "DETAILS")
|
||||||
|
})
|
||||||
|
ClassificationHistoryEvent findById(@Param("id") String id);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,401 @@
|
||||||
|
package pro.taskana.simplehistory.impl.classification;
|
||||||
|
|
||||||
|
import pro.taskana.common.api.BaseQuery;
|
||||||
|
import pro.taskana.common.api.TimeInterval;
|
||||||
|
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||||
|
import pro.taskana.spi.history.api.events.classification.ClassificationHistoryCustomField;
|
||||||
|
import pro.taskana.spi.history.api.events.classification.ClassificationHistoryEvent;
|
||||||
|
|
||||||
|
/** HistoryQuery for generating dynamic sql. */
|
||||||
|
public interface ClassificationHistoryQuery
|
||||||
|
extends BaseQuery<ClassificationHistoryEvent, ClassificationHistoryQueryColumnName> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your Id to your query.
|
||||||
|
*
|
||||||
|
* @param idIn as String
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery idIn(String... idIn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your eventType to your query.
|
||||||
|
*
|
||||||
|
* @param eventType as String
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery eventTypeIn(String... eventType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your created TimeInterval to your query.
|
||||||
|
*
|
||||||
|
* @param createdWithin the {@link TimeInterval} within which the searched-for classifications
|
||||||
|
* were created.
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery createdWithin(TimeInterval... createdWithin);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your userId to your query.
|
||||||
|
*
|
||||||
|
* @param userId as String
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery userIdIn(String... userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your classificationId to your query.
|
||||||
|
*
|
||||||
|
* @param classificationId as String
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery classificationIdIn(String... classificationId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your applicationEntryPoint to your query.
|
||||||
|
*
|
||||||
|
* @param applicationEntryPoint as String
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery applicationEntryPointIn(String... applicationEntryPoint);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your category to your query.
|
||||||
|
*
|
||||||
|
* @param category as String
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery categoryIn(String... category);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your domain to your query.
|
||||||
|
*
|
||||||
|
* @param domain as String
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery domainIn(String... domain);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your key to your query.
|
||||||
|
*
|
||||||
|
* @param key as String
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery keyIn(String... key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your name to your query.
|
||||||
|
*
|
||||||
|
* @param name as String
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery nameIn(String... name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your parentId to your query.
|
||||||
|
*
|
||||||
|
* @param parentId as String
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery parentIdIn(String... parentId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your parentKey to your query.
|
||||||
|
*
|
||||||
|
* @param parentKey as String
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery parentKeyIn(String... parentKey);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your priority to your query.
|
||||||
|
*
|
||||||
|
* @param priorities as integers
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery priorityIn(int... priorities);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your serviceLevel to your query.
|
||||||
|
*
|
||||||
|
* @param serviceLevelIn as String
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery serviceLevelIn(String... serviceLevelIn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your type to your query.
|
||||||
|
*
|
||||||
|
* @param type as String
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery typeIn(String... type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the values of custom attributes for exact matching to your query.
|
||||||
|
*
|
||||||
|
* @param customField identifies which custom attribute is affected.
|
||||||
|
* @param searchArguments the customField values of the searched for tasks
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery customAttributeIn(
|
||||||
|
ClassificationHistoryCustomField customField, String... searchArguments);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your eventType to your query. It will be compared in SQL with an LIKE. If you use a
|
||||||
|
* wildcard like % then it will be transmitted to the database.
|
||||||
|
*
|
||||||
|
* @param eventType as String
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery eventTypeLike(String... eventType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your userId to your query. It will be compared in SQL with an LIKE. If you use a wildcard
|
||||||
|
* like % then it will be transmitted to the database.
|
||||||
|
*
|
||||||
|
* @param userId as String
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery userIdLike(String... userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your classificationId to your query. It will be compared in SQL with an LIKE. If you use a
|
||||||
|
* wildcard like % then it will be transmitted to the database.
|
||||||
|
*
|
||||||
|
* @param classificationId as String
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery classificationIdLike(String... classificationId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your applicationEntryPoint to your query. It will be compared in SQL with an LIKE. If you
|
||||||
|
* use a * wildcard like % then it will be transmitted to the database.
|
||||||
|
*
|
||||||
|
* @param applicationEntryPointLike name of the applications entrypoint
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery applicationEntryPointLike(String... applicationEntryPointLike);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your category to your query. It will be compared in SQL with an LIKE. If you use a wildcard
|
||||||
|
* like % then it will be transmitted to the database.
|
||||||
|
*
|
||||||
|
* @param category as String
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery categoryLike(String... category);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your domain to your query. It will be compared in SQL with an LIKE. If you use a wildcard
|
||||||
|
* like % then it will be transmitted to the database.
|
||||||
|
*
|
||||||
|
* @param domain as String
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery domainLike(String... domain);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your key to your query. It will be compared in SQL with an LIKE. If you use a wildcard like
|
||||||
|
* % then it will be transmitted to the database.
|
||||||
|
*
|
||||||
|
* @param key as String
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery keyLike(String... key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your name to your query. It will be compared in SQL with an LIKE. If you use a wildcard
|
||||||
|
* like % then it will be transmitted to the database.
|
||||||
|
*
|
||||||
|
* @param name as String
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery nameLike(String... name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your parentId to your query. It will be compared in SQL with an LIKE. If you use a wildcard
|
||||||
|
* like % then it will be transmitted to the database.
|
||||||
|
*
|
||||||
|
* @param parentId as String
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery parentIdLike(String... parentId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your parentKey to your query. It will be compared in SQL with an LIKE. If you use a
|
||||||
|
* wildcard like % then it will be transmitted to the database.
|
||||||
|
*
|
||||||
|
* @param parentKey as String
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery parentKeyLike(String... parentKey);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your serviceLevel to your query. It will be compared in SQL with an LIKE. If you use a
|
||||||
|
* wildcard like % then it will be transmitted to the database.
|
||||||
|
*
|
||||||
|
* @param serviceLevel as String
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery serviceLevelLike(String... serviceLevel);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your type to your query. It will be compared in SQL with an LIKE. If you use a wildcard
|
||||||
|
* like % then it will be transmitted to the database.
|
||||||
|
*
|
||||||
|
* @param type as String
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery typeLike(String... type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the values of custom attributes for pattern matching to your query. They will be compared
|
||||||
|
* in SQL with the LIKE operator. You may use a wildcard like % to specify the pattern. If you
|
||||||
|
* specify multiple arguments they are combined with the OR keyword.
|
||||||
|
*
|
||||||
|
* @param customField identifies which custom attribute is affected.
|
||||||
|
* @param searchArguments the customField values of the searched-for tasks
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery customAttributeLike(
|
||||||
|
ClassificationHistoryCustomField customField, String... searchArguments);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort the query result by eventType.
|
||||||
|
*
|
||||||
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery orderByEventType(SortDirection sortDirection);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort the query result by created.
|
||||||
|
*
|
||||||
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery orderByCreated(SortDirection sortDirection);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort the query result by userId.
|
||||||
|
*
|
||||||
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery orderByUserId(SortDirection sortDirection);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort the query result by classificationId.
|
||||||
|
*
|
||||||
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery orderByClassificationId(SortDirection sortDirection);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort the query result by applicationEntryPoint.
|
||||||
|
*
|
||||||
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery orderByApplicationEntryPoint(SortDirection sortDirection);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort the query result by category.
|
||||||
|
*
|
||||||
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery orderByCategory(SortDirection sortDirection);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort the query result by Domain.
|
||||||
|
*
|
||||||
|
* @param sortDirection Determines whether the result is sorted dain ascending or descending
|
||||||
|
* order. If sortDirection is null, the result is sorted in ascending order
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery orderByDomain(SortDirection sortDirection);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort the query result by key.
|
||||||
|
*
|
||||||
|
* @param sortDirection Determines whether the result is sorted dain ascending or descending
|
||||||
|
* order. If sortDirection is null, the result is sorted in ascending order
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery orderByKey(SortDirection sortDirection);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort the query result by name.
|
||||||
|
*
|
||||||
|
* @param sortDirection Determines whether the result is sorted dain ascending or descending
|
||||||
|
* order. If sortDirection is null, the result is sorted in ascending order
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery orderByName(SortDirection sortDirection);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort the query result by parentId.
|
||||||
|
*
|
||||||
|
* @param sortDirection Determines whether the result is sorted dain ascending or descending
|
||||||
|
* order. If sortDirection is null, the result is sorted in ascending order
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery orderByParentId(SortDirection sortDirection);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort the query result by parentKey.
|
||||||
|
*
|
||||||
|
* @param sortDirection Determines whether the result is sorted dain ascending or descending
|
||||||
|
* order. If sortDirection is null, the result is sorted in ascending order
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery orderByParentKey(SortDirection sortDirection);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort the query result by priority.
|
||||||
|
*
|
||||||
|
* @param sortDirection Determines whether the result is sorted dain ascending or descending
|
||||||
|
* order. If sortDirection is null, the result is sorted in ascending order
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery orderByPriority(SortDirection sortDirection);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort the query result by serviceLevel.
|
||||||
|
*
|
||||||
|
* @param sortDirection Determines whether the result is sorted dain ascending or descending
|
||||||
|
* order. If sortDirection is null, the result is sorted in ascending order
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery orderByServiceLevel(SortDirection sortDirection);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort the query result by type.
|
||||||
|
*
|
||||||
|
* @param sortDirection Determines whether the result is sorted dain ascending or descending
|
||||||
|
* order. If sortDirection is null, the result is sorted in ascending order
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery orderByType(SortDirection sortDirection);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method sorts the query result according to the value of a custom field.
|
||||||
|
*
|
||||||
|
* @param num the number of the custom attribute as String (eg "4")
|
||||||
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
|
* @return the query
|
||||||
|
* @throws InvalidArgumentException when the number of the custom is incorrect.
|
||||||
|
*/
|
||||||
|
ClassificationHistoryQuery orderByCustomAttribute(int num, SortDirection sortDirection)
|
||||||
|
throws InvalidArgumentException;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
package pro.taskana.simplehistory.impl.classification;
|
||||||
|
|
||||||
|
import pro.taskana.common.api.QueryColumnName;
|
||||||
|
|
||||||
|
/** Enum containing the column names for {@link ClassificationHistoryQueryMapper}. */
|
||||||
|
public enum ClassificationHistoryQueryColumnName implements QueryColumnName {
|
||||||
|
ID("id"),
|
||||||
|
EVENT_TYPE("event_type"),
|
||||||
|
CREATED("created"),
|
||||||
|
USER_ID("user_id"),
|
||||||
|
CLASSIFICATION_ID("classification_id"),
|
||||||
|
APPLICATION_ENTRY_POINT("application_entry_point"),
|
||||||
|
CATEGORY("category"),
|
||||||
|
DOMAIN("domain"),
|
||||||
|
KEY("key"),
|
||||||
|
NAME("name"),
|
||||||
|
PARENT_ID("parent_id"),
|
||||||
|
PARENT_KEY("parent_key"),
|
||||||
|
PRIORITY("priority"),
|
||||||
|
SERVICE_LEVEL("service_level"),
|
||||||
|
TYPE("type"),
|
||||||
|
CUSTOM_1("custom_1"),
|
||||||
|
CUSTOM_2("custom_2"),
|
||||||
|
CUSTOM_3("custom_3"),
|
||||||
|
CUSTOM_4("custom_4"),
|
||||||
|
CUSTOM_5("custom_5"),
|
||||||
|
CUSTOM_6("custom_6"),
|
||||||
|
CUSTOM_7("custom_7"),
|
||||||
|
CUSTOM_8("custom_8");
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
ClassificationHistoryQueryColumnName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,204 @@
|
||||||
|
package pro.taskana.simplehistory.impl.classification;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.ibatis.annotations.Result;
|
||||||
|
import org.apache.ibatis.annotations.Results;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import pro.taskana.simplehistory.impl.ClassificationHistoryQueryImpl;
|
||||||
|
import pro.taskana.spi.history.api.events.classification.ClassificationHistoryEvent;
|
||||||
|
|
||||||
|
/** This class is the mybatis mapping of ClassificationHistoryQueries. */
|
||||||
|
@SuppressWarnings("checkstyle:LineLength")
|
||||||
|
public interface ClassificationHistoryQueryMapper {
|
||||||
|
|
||||||
|
@Select(
|
||||||
|
"<script>"
|
||||||
|
+ "SELECT ID, EVENT_TYPE, CREATED, USER_ID, CLASSIFICATION_ID, APPLICATION_ENTRY_POINT, CATEGORY, DOMAIN, KEY, NAME,"
|
||||||
|
+ "PARENT_ID, PARENT_KEY, PRIORITY, SERVICE_LEVEL, TYPE, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, CUSTOM_6, CUSTOM_7, CUSTOM_8 "
|
||||||
|
+ "FROM CLASSIFICATION_HISTORY_EVENT"
|
||||||
|
+ "<where>"
|
||||||
|
// IN-Queries
|
||||||
|
+ "<if test='idIn != null'>AND UPPER(ID) IN (<foreach item='item' collection='idIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='eventTypeIn != null'>AND UPPER(EVENT_TYPE) IN (<foreach item='item' collection='eventTypeIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='createdIn !=null'> AND ( <foreach item='item' collection='createdIn' separator=',' > ( <if test='item.begin!=null'> CREATED >= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> CREATED <=#{item.end} </if>)</foreach>)</if> "
|
||||||
|
+ "<if test='userIdIn != null'>AND UPPER(USER_ID) IN (<foreach item='item' collection='userIdIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='classificationIdIn != null'>AND UPPER(CLASSIFICATION_ID) IN (<foreach item='item' collection='classificationIdIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='applicationEntryPointIn != null'>AND UPPER(APPLICATION_ENTRY_POINT) IN (<foreach item='item' collection='applicationEntryPointIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='categoryIn != null'>AND UPPER(CATEGORY) IN (<foreach item='item' collection='categoryIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='domainIn != null'>AND UPPER(DOMAIN) IN (<foreach item='item' collection='domainIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='keyIn != null'>AND UPPER(KEY) IN (<foreach item='item' collection='keyIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='nameIn != null'>AND UPPER(NAME) IN (<foreach item='item' collection='nameIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='parentIdIn != null'>AND UPPER(PARENT_ID) IN (<foreach item='item' collection='parentIdIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='parentKeyIn != null'>AND UPPER(PARENT_KEY) IN (<foreach item='item' collection='parentKeyIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='priorityIn != null'>AND UPPER(PRIORITY) IN (<foreach item='item' collection='priorityIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='serviceLevelIn != null'>AND UPPER(SERVICE_LEVEL) IN (<foreach item='item' collection='serviceLevelIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='typeIn != null'>AND UPPER(TYPE) IN (<foreach item='item' collection='typeIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom1In != null'>AND UPPER(CUSTOM_1) IN (<foreach item='item' collection='custom1In' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom2In != null'>AND UPPER(CUSTOM_2) IN (<foreach item='item' collection='custom2In' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom3In != null'>AND UPPER(CUSTOM_3) IN (<foreach item='item' collection='custom3In' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom4In != null'>AND UPPER(CUSTOM_4) IN (<foreach item='item' collection='custom4In' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom5In != null'>AND UPPER(CUSTOM_5) IN (<foreach item='item' collection='custom5In' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom6In != null'>AND UPPER(CUSTOM_6) IN (<foreach item='item' collection='custom6In' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom7In != null'>AND UPPER(CUSTOM_7) IN (<foreach item='item' collection='custom7In' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom8In != null'>AND UPPER(CUSTOM_8) IN (<foreach item='item' collection='custom8In' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
// LIKE-Queries
|
||||||
|
+ "<if test='eventTypeLike != null'>AND (<foreach item='item' collection='eventTypeLike' separator= ' OR ' >UPPER(EVENT_TYPE) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='userIdLike != null'>AND (<foreach item='item' collection='userIdLike' separator=' OR ' > UPPER(USER_ID) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='classificationIdLike != null'>AND (<foreach item='item' collection='classificationIdLike' separator=' OR ' >UPPER(CLASSIFICATION_ID) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='applicationEntryPointLike != null'>AND (<foreach item='item' collection='applicationEntryPointLike' separator=' OR ' >UPPER(APPLICATION_ENTRY_POINT) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='categoryLike != null'>AND (<foreach item='item' collection='categoryLike' separator=' OR ' >UPPER(CATEGORY) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='domainLike != null'>AND (<foreach item='item' collection='domainLike' separator=' OR ' >UPPER(DOMAIN) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='keyLike != null'>AND (<foreach item='item' collection='keyLike' separator=' OR ' >UPPER(KEY) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='nameLike != null'>AND (<foreach item='item' collection='nameLike' separator=' OR ' >UPPER(NAME) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='parentIdLike != null'>AND (<foreach item='item' collection='parentIdLike' separator=' OR ' >UPPER(PARENT_ID) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='parentKeyLike != null'>AND (<foreach item='item' collection='parentKeyLike' separator=' OR ' >UPPER(PARENT_KEY) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='serviceLevelLike != null'>AND (<foreach item='item' collection='serviceLevelLike' separator=' OR ' >UPPER(SERVICE_LEVEL) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='typeLike != null'>AND (<foreach item='item' collection='typeLike' separator=' OR ' >UPPER(TYPE) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom1Like != null'>AND (<foreach item='item' collection='custom1Like' separator=' OR ' >UPPER(CUSTOM_1) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom2Like != null'>AND (<foreach item='item' collection='custom2Like' separator=' OR ' >UPPER(CUSTOM_2) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom3Like != null'>AND (<foreach item='item' collection='custom3Like' separator=' OR ' >UPPER(CUSTOM_3) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom4Like != null'>AND (<foreach item='item' collection='custom4Like' separator=' OR ' >UPPER(CUSTOM_4) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom5Like != null'>AND (<foreach item='item' collection='custom5Like' separator=' OR ' >UPPER(CUSTOM_5) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom6Like != null'>AND (<foreach item='item' collection='custom6Like' separator=' OR ' >UPPER(CUSTOM_6) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom7Like != null'>AND (<foreach item='item' collection='custom7Like' separator=' OR ' >UPPER(CUSTOM_7) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom8Like != null'>AND (<foreach item='item' collection='custom8Like' separator=' OR ' >UPPER(CUSTOM_8) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "</where>"
|
||||||
|
+ "<if test='!orderBy.isEmpty()'>ORDER BY <foreach item='item' collection='orderBy' separator=',' >${item}</foreach></if> "
|
||||||
|
+ "</script>")
|
||||||
|
@Results(
|
||||||
|
value = {
|
||||||
|
@Result(property = "id", column = "ID"),
|
||||||
|
@Result(property = "eventType", column = "EVENT_TYPE"),
|
||||||
|
@Result(property = "created", column = "CREATED"),
|
||||||
|
@Result(property = "userId", column = "USER_ID"),
|
||||||
|
@Result(property = "classificationId", column = "CLASSIFICATION_ID"),
|
||||||
|
@Result(property = "applicationEntryPoint", column = "APPLICATION_ENTRY_POINT"),
|
||||||
|
@Result(property = "category", column = "CATEGORY"),
|
||||||
|
@Result(property = "domain", column = "DOMAIN"),
|
||||||
|
@Result(property = "key", column = "KEY"),
|
||||||
|
@Result(property = "name", column = "NAME"),
|
||||||
|
@Result(property = "parentId", column = "PARENT_ID"),
|
||||||
|
@Result(property = "parentKey", column = "PARENT_KEY"),
|
||||||
|
@Result(property = "priority", column = "PRIORITY"),
|
||||||
|
@Result(property = "serviceLevel", column = "SERVICE_LEVEL"),
|
||||||
|
@Result(property = "type", column = "TYPE"),
|
||||||
|
@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 = "custom5", column = "CUSTOM_5"),
|
||||||
|
@Result(property = "custom6", column = "CUSTOM_6"),
|
||||||
|
@Result(property = "custom7", column = "CUSTOM_7"),
|
||||||
|
@Result(property = "custom8", column = "CUSTOM_8")
|
||||||
|
})
|
||||||
|
List<ClassificationHistoryEvent> queryHistoryEvents(ClassificationHistoryQueryImpl historyEventQuery);
|
||||||
|
|
||||||
|
@Select(
|
||||||
|
"<script>"
|
||||||
|
+ "SELECT COUNT(ID) "
|
||||||
|
+ "FROM CLASSIFICATION_HISTORY_EVENT"
|
||||||
|
+ "<where>"
|
||||||
|
+ "<if test='idIn != null'>AND UPPER(ID) IN (<foreach item='item' collection='idIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='eventTypeIn != null'>AND UPPER(EVENT_TYPE) IN (<foreach item='item' collection='eventTypeIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='createdIn !=null'> AND ( <foreach item='item' collection='createdIn' separator=',' > ( <if test='item.begin!=null'> CREATED >= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> CREATED <=#{item.end} </if>)</foreach>)</if> "
|
||||||
|
+ "<if test='userIdIn != null'>AND UPPER(USER_ID) IN (<foreach item='item' collection='userIdIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='classificationIdIn != null'>AND UPPER(CLASSIFICATION_ID) IN (<foreach item='item' collection='classificationIdIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='applicationEntryPointIn != null'>AND UPPER(APPLICATION_ENTRY_POINT) IN (<foreach item='item' collection='applicationEntryPointIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='categoryIn != null'>AND UPPER(CATEGORY) IN (<foreach item='item' collection='categoryIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='domainIn != null'>AND UPPER(DOMAIN) IN (<foreach item='item' collection='domainIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='keyIn != null'>AND UPPER(KEY) IN (<foreach item='item' collection='keyIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='nameIn != null'>AND UPPER(NAME) IN (<foreach item='item' collection='nameIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='parentIdIn != null'>AND UPPER(PARENT_ID) IN (<foreach item='item' collection='parentIdIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='parentKeyIn != null'>AND UPPER(PARENT_KEY) IN (<foreach item='item' collection='parentKeyIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='priorityIn != null'>AND UPPER(PRIORITY) IN (<foreach item='item' collection='priorityIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='serviceLevelIn != null'>AND UPPER(SERVICE_LEVEL) IN (<foreach item='item' collection='serviceLevelIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='typeIn != null'>AND UPPER(TYPE) IN (<foreach item='item' collection='typeIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom1In != null'>AND UPPER(CUSTOM_1) IN (<foreach item='item' collection='custom1In' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom2In != null'>AND UPPER(CUSTOM_2) IN (<foreach item='item' collection='custom2In' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom3In != null'>AND UPPER(CUSTOM_3) IN (<foreach item='item' collection='custom3In' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom4In != null'>AND UPPER(CUSTOM_4) IN (<foreach item='item' collection='custom4In' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom5In != null'>AND UPPER(CUSTOM_5) IN (<foreach item='item' collection='custom5In' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom6In != null'>AND UPPER(CUSTOM_6) IN (<foreach item='item' collection='custom6In' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom7In != null'>AND UPPER(CUSTOM_7) IN (<foreach item='item' collection='custom7In' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom8In != null'>AND UPPER(CUSTOM_8) IN (<foreach item='item' collection='custom8In' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
// LIKE-Queries
|
||||||
|
+ "<if test='eventTypeLike != null'>AND (<foreach item='item' collection='eventTypeLike' separator= ' OR ' >UPPER(EVENT_TYPE) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='userIdLike != null'>AND (<foreach item='item' collection='userIdLike' separator=' OR ' > UPPER(USER_ID) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='classificationIdLike != null'>AND (<foreach item='item' collection='classificationIdLike' separator=' OR ' >UPPER(CLASSIFICATION_ID) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='applicationEntryPointLike != null'>AND (<foreach item='item' collection='applicationEntryPointLike' separator=' OR ' >UPPER(APPLICATION_ENTRY_POINT) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='categoryLike != null'>AND (<foreach item='item' collection='categoryLike' separator=' OR ' >UPPER(CATEGORY) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='domainLike != null'>AND (<foreach item='item' collection='domainLike' separator=' OR ' >UPPER(DOMAIN) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='keyLike != null'>AND (<foreach item='item' collection='keyLike' separator=' OR ' >UPPER(KEY) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='nameLike != null'>AND (<foreach item='item' collection='nameLike' separator=' OR ' >UPPER(NAME) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='parentIdLike != null'>AND (<foreach item='item' collection='parentIdLike' separator=' OR ' >UPPER(PARENT_ID) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='parentKeyLike != null'>AND (<foreach item='item' collection='parentKeyLike' separator=' OR ' >UPPER(PARENT_KEY) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='serviceLevelLike != null'>AND (<foreach item='item' collection='serviceLevelLike' separator=' OR ' >UPPER(SERVICE_LEVEL) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='typeLike != null'>AND (<foreach item='item' collection='typeLike' separator=' OR ' >UPPER(TYPE) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom1Like != null'>AND (<foreach item='item' collection='custom1Like' separator=' OR ' >UPPER(CUSTOM_1) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom2Like != null'>AND (<foreach item='item' collection='custom2Like' separator=' OR ' >UPPER(CUSTOM_2) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom3Like != null'>AND (<foreach item='item' collection='custom3Like' separator=' OR ' >UPPER(CUSTOM_3) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom4Like != null'>AND (<foreach item='item' collection='custom4Like' separator=' OR ' >UPPER(CUSTOM_4) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom5Like != null'>AND (<foreach item='item' collection='custom5Like' separator=' OR ' >UPPER(CUSTOM_5) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom6Like != null'>AND (<foreach item='item' collection='custom6Like' separator=' OR ' >UPPER(CUSTOM_6) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom7Like != null'>AND (<foreach item='item' collection='custom7Like' separator=' OR ' >UPPER(CUSTOM_7) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom8Like != null'>AND (<foreach item='item' collection='custom8Like' separator=' OR ' >UPPER(CUSTOM_8) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "</where>"
|
||||||
|
+ "<if test='!orderBy.isEmpty()'>ORDER BY <foreach item='item' collection='orderBy' separator=',' >${item}</foreach></if> "
|
||||||
|
+ "</script>")
|
||||||
|
long countHistoryEvents(ClassificationHistoryQueryImpl historyEventQuery);
|
||||||
|
|
||||||
|
@Select(
|
||||||
|
"<script>SELECT DISTINCT ${columnName} "
|
||||||
|
+ "FROM CLASSIFICATION_HISTORY_EVENT"
|
||||||
|
+ "<where>"
|
||||||
|
+ "<if test='idIn != null'>AND UPPER(ID) IN (<foreach item='item' collection='idIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='eventTypeIn != null'>AND UPPER(EVENT_TYPE) IN (<foreach item='item' collection='eventTypeIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='createdIn !=null'> AND ( <foreach item='item' collection='createdIn' separator=',' > ( <if test='item.begin!=null'> CREATED >= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> CREATED <=#{item.end} </if>)</foreach>)</if> "
|
||||||
|
+ "<if test='userIdIn != null'>AND UPPER(USER_ID) IN (<foreach item='item' collection='userIdIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='classificationIdIn != null'>AND UPPER(CLASSIFICATION_ID) IN (<foreach item='item' collection='classificationIdIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='applicationEntryPointIn != null'>AND UPPER(APPLICATION_ENTRY_POINT) IN (<foreach item='item' collection='applicationEntryPointIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='categoryIn != null'>AND UPPER(CATEGORY) IN (<foreach item='item' collection='categoryIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='domainIn != null'>AND UPPER(DOMAIN) IN (<foreach item='item' collection='domainIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='keyIn != null'>AND UPPER(KEY) IN (<foreach item='item' collection='keyIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='nameIn != null'>AND UPPER(NAME) IN (<foreach item='item' collection='nameIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='parentIdIn != null'>AND UPPER(PARENT_ID) IN (<foreach item='item' collection='parentIdIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='parentKeyIn != null'>AND UPPER(PARENT_KEY) IN (<foreach item='item' collection='parentKeyIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='priorityIn != null'>AND UPPER(PRIORITY) IN (<foreach item='item' collection='priorityIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='serviceLevelIn != null'>AND UPPER(SERVICE_LEVEL) IN (<foreach item='item' collection='serviceLevelIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='typeIn != null'>AND UPPER(TYPE) IN (<foreach item='item' collection='typeIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom1In != null'>AND UPPER(CUSTOM_1) IN (<foreach item='item' collection='custom1In' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom2In != null'>AND UPPER(CUSTOM_2) IN (<foreach item='item' collection='custom2In' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom3In != null'>AND UPPER(CUSTOM_3) IN (<foreach item='item' collection='custom3In' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom4In != null'>AND UPPER(CUSTOM_4) IN (<foreach item='item' collection='custom4In' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom5In != null'>AND UPPER(CUSTOM_5) IN (<foreach item='item' collection='custom5In' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom6In != null'>AND UPPER(CUSTOM_6) IN (<foreach item='item' collection='custom6In' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom7In != null'>AND UPPER(CUSTOM_7) IN (<foreach item='item' collection='custom7In' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom8In != null'>AND UPPER(CUSTOM_8) IN (<foreach item='item' collection='custom8In' separator=',' >#{item}</foreach>)</if> "
|
||||||
|
// LIKE-Queries
|
||||||
|
+ "<if test='eventTypeLike != null'>AND (<foreach item='item' collection='eventTypeLike' separator= ' OR ' >UPPER(EVENT_TYPE) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='userIdLike != null'>AND (<foreach item='item' collection='userIdLike' separator=' OR ' >UPPER(USER_ID) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='classificationIdLike != null'>AND (<foreach item='item' collection='classificationIdLike' separator=' OR ' >UPPER(CLASSIFICATION_ID) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='applicationEntryPointLike != null'>AND (<foreach item='item' collection='applicationEntryPointLike' separator=' OR ' >UPPER(APPLICATION_ENTRY_POINT) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='categoryLike != null'>AND (<foreach item='item' collection='categoryLike' separator=' OR ' >UPPER(CATEGORY) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='domainLike != null'>AND (<foreach item='item' collection='domainLike' separator=' OR ' >UPPER(DOMAIN) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='keyLike != null'>AND (<foreach item='item' collection='keyLike' separator=' OR ' >UPPER(KEY) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='nameLike != null'>AND (<foreach item='item' collection='nameLike' separator=' OR ' >UPPER(NAME) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='parentIdLike != null'>AND (<foreach item='item' collection='parentIdLike' separator=' OR ' >UPPER(PARENT_ID) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='parentKeyLike != null'>AND (<foreach item='item' collection='parentKeyLike' separator=' OR ' >UPPER(PARENT_KEY) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='serviceLevelLike != null'>AND (<foreach item='item' collection='serviceLevelLike' separator=' OR ' >UPPER(SERVICE_LEVEL) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='typeLike != null'>AND (<foreach item='item' collection='typeLike' separator=' OR ' >UPPER(TYPE) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom1Like != null'>AND (<foreach item='item' collection='custom1Like' separator=' OR ' >UPPER(CUSTOM_1) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom2Like != null'>AND (<foreach item='item' collection='custom2Like' separator=' OR ' >UPPER(CUSTOM_2) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom3Like != null'>AND (<foreach item='item' collection='custom3Like' separator=' OR ' >UPPER(CUSTOM_3) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom4Like != null'>AND (<foreach item='item' collection='custom4Like' separator=' OR ' >UPPER(CUSTOM_4) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom5Like != null'>AND (<foreach item='item' collection='custom5Like' separator=' OR ' >UPPER(CUSTOM_5) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom6Like != null'>AND (<foreach item='item' collection='custom6Like' separator=' OR ' >UPPER(CUSTOM_6) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom7Like != null'>AND (<foreach item='item' collection='custom7Like' separator=' OR ' >UPPER(CUSTOM_7) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "<if test='custom8Like != null'>AND (<foreach item='item' collection='custom8Like' separator=' OR ' >UPPER(CUSTOM_8) LIKE #{item}</foreach>)</if> "
|
||||||
|
+ "</where>"
|
||||||
|
+ "<if test='!orderBy.isEmpty()'>ORDER BY <foreach item='item' collection='orderBy' separator=',' >${item}</foreach></if> "
|
||||||
|
+ "</script>")
|
||||||
|
List<String> queryHistoryColumnValues(ClassificationHistoryQueryImpl historyQuery);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -22,6 +22,7 @@ import pro.taskana.common.internal.util.IdGenerator;
|
||||||
import pro.taskana.sampledata.SampleDataGenerator;
|
import pro.taskana.sampledata.SampleDataGenerator;
|
||||||
import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl;
|
import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl;
|
||||||
import pro.taskana.simplehistory.impl.TaskanaHistoryEngineImpl;
|
import pro.taskana.simplehistory.impl.TaskanaHistoryEngineImpl;
|
||||||
|
import pro.taskana.simplehistory.impl.classification.ClassificationHistoryEventMapper;
|
||||||
import pro.taskana.simplehistory.impl.task.TaskHistoryQueryMapper;
|
import pro.taskana.simplehistory.impl.task.TaskHistoryQueryMapper;
|
||||||
import pro.taskana.simplehistory.impl.workbasket.WorkbasketHistoryEventMapper;
|
import pro.taskana.simplehistory.impl.workbasket.WorkbasketHistoryEventMapper;
|
||||||
import pro.taskana.spi.history.api.events.task.TaskHistoryEvent;
|
import pro.taskana.spi.history.api.events.task.TaskHistoryEvent;
|
||||||
|
|
@ -198,6 +199,24 @@ public abstract class AbstractAccTest {
|
||||||
return manager.getMapper(WorkbasketHistoryEventMapper.class);
|
return manager.getMapper(WorkbasketHistoryEventMapper.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static ClassificationHistoryEventMapper getClassificationHistoryEventMapper() {
|
||||||
|
|
||||||
|
SqlSessionManager manager = null;
|
||||||
|
|
||||||
|
Field sessionManager;
|
||||||
|
try {
|
||||||
|
sessionManager = TaskanaHistoryEngineImpl.class.getDeclaredField("sessionManager");
|
||||||
|
|
||||||
|
sessionManager.setAccessible(true);
|
||||||
|
|
||||||
|
manager = (SqlSessionManager) sessionManager.get(taskanaHistoryEngine);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.warn("Caught unexpected exception ", e);
|
||||||
|
}
|
||||||
|
return manager.getMapper(ClassificationHistoryEventMapper.class);
|
||||||
|
}
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
static void setupTest() throws Exception {
|
static void setupTest() throws Exception {
|
||||||
resetDb(null);
|
resetDb(null);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
package acceptance.events.classification;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
import acceptance.AbstractAccTest;
|
||||||
|
import acceptance.security.JaasExtension;
|
||||||
|
import acceptance.security.WithAccessId;
|
||||||
|
import java.util.List;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
|
import pro.taskana.classification.api.ClassificationService;
|
||||||
|
import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl;
|
||||||
|
import pro.taskana.simplehistory.impl.classification.ClassificationHistoryEventMapper;
|
||||||
|
import pro.taskana.spi.history.api.events.classification.ClassificationHistoryEvent;
|
||||||
|
import pro.taskana.spi.history.api.events.classification.ClassificationHistoryEventType;
|
||||||
|
|
||||||
|
@ExtendWith(JaasExtension.class)
|
||||||
|
class CreateHistoryEventOnClassificationDeletionAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
|
private final SimpleHistoryServiceImpl historyService = getHistoryService();
|
||||||
|
private final ClassificationService classificationService =
|
||||||
|
taskanaEngine.getClassificationService();
|
||||||
|
private final ClassificationHistoryEventMapper classificationHistoryEventMapper =
|
||||||
|
getClassificationHistoryEventMapper();
|
||||||
|
|
||||||
|
@WithAccessId(user = "admin")
|
||||||
|
@Test
|
||||||
|
void should_CreateClassificationDeletedHistoryEvent_When_ClassificationIsDeleted()
|
||||||
|
throws Exception {
|
||||||
|
|
||||||
|
final String classificationId = "CLI:200000000000000000000000000000000015";
|
||||||
|
|
||||||
|
List<ClassificationHistoryEvent> events =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.classificationIdIn(classificationId)
|
||||||
|
.list();
|
||||||
|
|
||||||
|
assertThat(events).isEmpty();
|
||||||
|
|
||||||
|
classificationService.deleteClassification(classificationId);
|
||||||
|
|
||||||
|
events =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.classificationIdIn(classificationId)
|
||||||
|
.list();
|
||||||
|
assertThat(events).hasSize(1);
|
||||||
|
|
||||||
|
String eventType = events.get(0).getEventType();
|
||||||
|
String details = classificationHistoryEventMapper.findById(events.get(0).getId()).getDetails();
|
||||||
|
|
||||||
|
assertThat(eventType).isEqualTo(ClassificationHistoryEventType.DELETED.getName());
|
||||||
|
|
||||||
|
assertThat(details).contains("\"oldValue\":\"CLI:200000000000000000000000000000000015\"");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
package acceptance.events.classification;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
import acceptance.AbstractAccTest;
|
||||||
|
import acceptance.security.JaasExtension;
|
||||||
|
import acceptance.security.WithAccessId;
|
||||||
|
import java.util.List;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
|
import pro.taskana.classification.api.ClassificationService;
|
||||||
|
import pro.taskana.classification.api.models.Classification;
|
||||||
|
import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl;
|
||||||
|
import pro.taskana.simplehistory.impl.classification.ClassificationHistoryEventMapper;
|
||||||
|
import pro.taskana.spi.history.api.events.classification.ClassificationHistoryEvent;
|
||||||
|
import pro.taskana.spi.history.api.events.classification.ClassificationHistoryEventType;
|
||||||
|
|
||||||
|
@ExtendWith(JaasExtension.class)
|
||||||
|
class CreateHistoryEventOnClassificationsCreationAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
|
private final SimpleHistoryServiceImpl historyService = getHistoryService();
|
||||||
|
private final ClassificationService classificationService =
|
||||||
|
taskanaEngine.getClassificationService();
|
||||||
|
private final ClassificationHistoryEventMapper classificationHistoryEventMapper =
|
||||||
|
getClassificationHistoryEventMapper();
|
||||||
|
|
||||||
|
@WithAccessId(user = "admin")
|
||||||
|
@Test
|
||||||
|
void should_CreateClassificationCreatedHistoryEvents_When_ClassificationIsDeleted()
|
||||||
|
throws Exception {
|
||||||
|
|
||||||
|
Classification newClassification =
|
||||||
|
classificationService.newClassification("somekey", "DOMAIN_A", "TASK");
|
||||||
|
newClassification.setDescription("some description");
|
||||||
|
newClassification = classificationService.createClassification(newClassification);
|
||||||
|
|
||||||
|
List<ClassificationHistoryEvent> events =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.classificationIdIn(newClassification.getId())
|
||||||
|
.list();
|
||||||
|
|
||||||
|
assertThat(events).hasSize(1);
|
||||||
|
|
||||||
|
String eventType = events.get(0).getEventType();
|
||||||
|
String details = classificationHistoryEventMapper.findById(events.get(0).getId()).getDetails();
|
||||||
|
|
||||||
|
assertThat(eventType).isEqualTo(ClassificationHistoryEventType.CREATED.getName());
|
||||||
|
|
||||||
|
assertThat(details).contains("\"newValue\":\"some description\"");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
package acceptance.events.classification;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
import acceptance.AbstractAccTest;
|
||||||
|
import acceptance.security.JaasExtension;
|
||||||
|
import acceptance.security.WithAccessId;
|
||||||
|
import java.util.List;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
|
import pro.taskana.classification.api.ClassificationCustomField;
|
||||||
|
import pro.taskana.classification.api.ClassificationService;
|
||||||
|
import pro.taskana.classification.api.models.Classification;
|
||||||
|
import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl;
|
||||||
|
import pro.taskana.simplehistory.impl.classification.ClassificationHistoryEventMapper;
|
||||||
|
import pro.taskana.spi.history.api.events.classification.ClassificationHistoryEvent;
|
||||||
|
import pro.taskana.spi.history.api.events.workbasket.WorkbasketHistoryEventType;
|
||||||
|
|
||||||
|
@ExtendWith(JaasExtension.class)
|
||||||
|
class CreateHistoryEventOnClassificationsUpdateAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
|
private final SimpleHistoryServiceImpl historyService = getHistoryService();
|
||||||
|
private final ClassificationService classificationService =
|
||||||
|
taskanaEngine.getClassificationService();
|
||||||
|
private final ClassificationHistoryEventMapper classificationHistoryEventMapper =
|
||||||
|
getClassificationHistoryEventMapper();
|
||||||
|
|
||||||
|
@WithAccessId(user = "businessadmin")
|
||||||
|
@Test
|
||||||
|
void should_CreateClassificationUpdatedHistoryEvent_When_ClassificationIsUpdated()
|
||||||
|
throws Exception {
|
||||||
|
|
||||||
|
Classification classification =
|
||||||
|
classificationService.getClassification("CLI:000000000000000000000000000000000017");
|
||||||
|
|
||||||
|
List<ClassificationHistoryEvent> events =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.classificationIdIn(classification.getId())
|
||||||
|
.list();
|
||||||
|
|
||||||
|
assertThat(events).isEmpty();
|
||||||
|
|
||||||
|
classification.setName("new name");
|
||||||
|
classification.setDescription("new description");
|
||||||
|
classification.setCategory("EXTERNAL");
|
||||||
|
classification.setCustomAttribute(ClassificationCustomField.CUSTOM_1, "new custom 1");
|
||||||
|
classification.setCustomAttribute(ClassificationCustomField.CUSTOM_2, "new custom 2");
|
||||||
|
classification.setCustomAttribute(ClassificationCustomField.CUSTOM_3, "new custom 3");
|
||||||
|
classification.setCustomAttribute(ClassificationCustomField.CUSTOM_4, "new custom 4");
|
||||||
|
classificationService.updateClassification(classification);
|
||||||
|
|
||||||
|
events =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.classificationIdIn(classification.getId())
|
||||||
|
.list();
|
||||||
|
|
||||||
|
assertThat(events).hasSize(1);
|
||||||
|
|
||||||
|
String eventType = events.get(0).getEventType();
|
||||||
|
String details = classificationHistoryEventMapper.findById(events.get(0).getId()).getDetails();
|
||||||
|
|
||||||
|
assertThat(eventType).isEqualTo(WorkbasketHistoryEventType.UPDATED.getName());
|
||||||
|
|
||||||
|
assertThat(details).contains("\"newValue\":\"new description\"");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -48,8 +48,7 @@ class CreateHistoryEventOnWorkbasketAccessItemCreationAccTest extends AbstractAc
|
||||||
String eventType = events.get(0).getEventType();
|
String eventType = events.get(0).getEventType();
|
||||||
String details = workbasketHistoryEventMapper.findById(events.get(0).getId()).getDetails();
|
String details = workbasketHistoryEventMapper.findById(events.get(0).getId()).getDetails();
|
||||||
|
|
||||||
assertThat(eventType)
|
assertThat(eventType).isEqualTo(WorkbasketHistoryEventType.ACCESS_ITEM_CREATED.getName());
|
||||||
.isEqualTo(WorkbasketHistoryEventType.ACCESS_ITEM_CREATED.getName());
|
|
||||||
|
|
||||||
assertThat(details).contains("\"newValue\":\"peter\"");
|
assertThat(details).contains("\"newValue\":\"peter\"");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,7 @@ class CreateHistoryEventOnWorkbasketAccessItemDeletionAccTest extends AbstractAc
|
||||||
String eventType = events.get(0).getEventType();
|
String eventType = events.get(0).getEventType();
|
||||||
String details = workbasketHistoryEventMapper.findById(events.get(0).getId()).getDetails();
|
String details = workbasketHistoryEventMapper.findById(events.get(0).getId()).getDetails();
|
||||||
|
|
||||||
assertThat(eventType)
|
assertThat(eventType).isEqualTo(WorkbasketHistoryEventType.ACCESS_ITEM_DELETED.getName());
|
||||||
.isEqualTo(WorkbasketHistoryEventType.ACCESS_ITEM_DELETED.getName());
|
|
||||||
|
|
||||||
assertThat(details).contains("\"oldValue\":\"WBI:100000000000000000000000000000000004\"");
|
assertThat(details).contains("\"oldValue\":\"WBI:100000000000000000000000000000000004\"");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,483 @@
|
||||||
|
package acceptance.query;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
import acceptance.AbstractAccTest;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import pro.taskana.common.api.BaseQuery.SortDirection;
|
||||||
|
import pro.taskana.common.api.TimeInterval;
|
||||||
|
import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl;
|
||||||
|
import pro.taskana.simplehistory.impl.classification.ClassificationHistoryQuery;
|
||||||
|
import pro.taskana.simplehistory.impl.classification.ClassificationHistoryQueryColumnName;
|
||||||
|
import pro.taskana.spi.history.api.events.classification.ClassificationHistoryCustomField;
|
||||||
|
import pro.taskana.spi.history.api.events.classification.ClassificationHistoryEvent;
|
||||||
|
import pro.taskana.spi.history.api.events.classification.ClassificationHistoryEventType;
|
||||||
|
|
||||||
|
/** Test for Classification History queries. */
|
||||||
|
class QueryClassificationHistoryAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
|
private final SimpleHistoryServiceImpl historyService = getHistoryService();
|
||||||
|
|
||||||
|
public QueryClassificationHistoryAccTest() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void should_ConfirmEquality_When_UsingListValuesAscendingAndDescending() {
|
||||||
|
List<String> defaultList =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.listValues(ClassificationHistoryQueryColumnName.CREATED, null);
|
||||||
|
List<String> ascendingList =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.listValues(ClassificationHistoryQueryColumnName.CREATED, SortDirection.ASCENDING);
|
||||||
|
|
||||||
|
assertThat(ascendingList).hasSize(11).isEqualTo(defaultList);
|
||||||
|
|
||||||
|
List<String> descendingList =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.listValues(ClassificationHistoryQueryColumnName.CREATED, SortDirection.DESCENDING);
|
||||||
|
Collections.reverse(ascendingList);
|
||||||
|
|
||||||
|
assertThat(ascendingList).isEqualTo(descendingList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void should_ReturnHistoryEvents_For_ComplexQuery() {
|
||||||
|
|
||||||
|
ClassificationHistoryQuery query =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.eventTypeIn(ClassificationHistoryEventType.UPDATED.getName())
|
||||||
|
.domainLike("%A")
|
||||||
|
.customAttributeIn(ClassificationHistoryCustomField.CUSTOM_1, "otherCustom1")
|
||||||
|
.orderByCreated(SortDirection.DESCENDING);
|
||||||
|
|
||||||
|
List<ClassificationHistoryEvent> results = query.list();
|
||||||
|
assertThat(results)
|
||||||
|
.extracting(ClassificationHistoryEvent::getUserId)
|
||||||
|
.containsOnly("admin", "peter", "sven");
|
||||||
|
results = query.orderByUserId(SortDirection.DESCENDING).list();
|
||||||
|
assertThat(results)
|
||||||
|
.extracting(ClassificationHistoryEvent::getUserId)
|
||||||
|
.containsOnly("admin", "peter", "sven");
|
||||||
|
assertThat(results).hasSize(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void should_ConfirmQueryListOffset_When_ProvidingOffsetAndLimit() {
|
||||||
|
List<ClassificationHistoryEvent> offsetAndLimitResult =
|
||||||
|
historyService.createClassificationHistoryQuery().list(1, 2);
|
||||||
|
List<ClassificationHistoryEvent> regularResult =
|
||||||
|
historyService.createClassificationHistoryQuery().list();
|
||||||
|
|
||||||
|
assertThat(offsetAndLimitResult).hasSize(2);
|
||||||
|
assertThat(offsetAndLimitResult.get(0).getUserId())
|
||||||
|
.isNotEqualTo(regularResult.get(0).getUserId());
|
||||||
|
assertThat(offsetAndLimitResult.get(0).getUserId()).isEqualTo(regularResult.get(1).getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void should_ReturnEmptyList_When_ProvidingWrongContraints() {
|
||||||
|
List<ClassificationHistoryEvent> result =
|
||||||
|
historyService.createClassificationHistoryQuery().list(1, 1000);
|
||||||
|
assertThat(result).hasSize(10);
|
||||||
|
|
||||||
|
result = historyService.createClassificationHistoryQuery().list(100, 1000);
|
||||||
|
assertThat(result).isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void should_ReturnSingleHistoryEvent_When_UsingSingleMethod() {
|
||||||
|
ClassificationHistoryEvent single =
|
||||||
|
historyService.createClassificationHistoryQuery().userIdIn("peter").single();
|
||||||
|
assertThat(single.getEventType()).isEqualTo(ClassificationHistoryEventType.CREATED.getName());
|
||||||
|
|
||||||
|
single =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.eventTypeIn(ClassificationHistoryEventType.CREATED.getName(), "xy")
|
||||||
|
.single();
|
||||||
|
assertThat(single.getUserId()).isEqualTo("peter");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void should_ReturnCountOfEvents_When_UsingCountMethod() {
|
||||||
|
long count = historyService.createClassificationHistoryQuery().userIdIn("peter").count();
|
||||||
|
assertThat(count).isEqualTo(7);
|
||||||
|
|
||||||
|
count = historyService.createClassificationHistoryQuery().count();
|
||||||
|
assertThat(count).isEqualTo(11);
|
||||||
|
|
||||||
|
count =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.userIdIn("hans", "jürgen", "klaus")
|
||||||
|
.count();
|
||||||
|
assertThat(count).isZero();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void should_ReturnHistoryEvents_For_DifferentInAttributes() {
|
||||||
|
|
||||||
|
List<ClassificationHistoryEvent> returnValues =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.eventTypeIn(ClassificationHistoryEventType.CREATED.getName())
|
||||||
|
.list();
|
||||||
|
assertThat(returnValues).hasSize(6);
|
||||||
|
|
||||||
|
TimeInterval timeInterval =
|
||||||
|
new TimeInterval(Instant.now().minus(1000L, ChronoUnit.DAYS), Instant.now());
|
||||||
|
returnValues =
|
||||||
|
historyService.createClassificationHistoryQuery().createdWithin(timeInterval).list();
|
||||||
|
assertThat(returnValues).hasSize(11);
|
||||||
|
|
||||||
|
returnValues = historyService.createClassificationHistoryQuery().userIdIn("peter").list();
|
||||||
|
assertThat(returnValues).hasSize(7);
|
||||||
|
|
||||||
|
returnValues =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.classificationIdIn("CLI:000000000000000000000000000000000002")
|
||||||
|
.list();
|
||||||
|
assertThat(returnValues).hasSize(2);
|
||||||
|
|
||||||
|
returnValues =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.applicationEntryPointIn("someEntryPoint")
|
||||||
|
.list();
|
||||||
|
assertThat(returnValues).hasSize(2);
|
||||||
|
|
||||||
|
returnValues = historyService.createClassificationHistoryQuery().categoryIn("MANUAL").list();
|
||||||
|
assertThat(returnValues).hasSize(7);
|
||||||
|
|
||||||
|
returnValues = historyService.createClassificationHistoryQuery().domainIn("DOMAIN_A").list();
|
||||||
|
assertThat(returnValues).hasSize(11);
|
||||||
|
|
||||||
|
returnValues = historyService.createClassificationHistoryQuery().keyIn("L10003").list();
|
||||||
|
assertThat(returnValues).hasSize(2);
|
||||||
|
|
||||||
|
returnValues =
|
||||||
|
historyService.createClassificationHistoryQuery().nameIn("DFG-Leistungsfall").list();
|
||||||
|
assertThat(returnValues).hasSize(2);
|
||||||
|
|
||||||
|
returnValues =
|
||||||
|
historyService.createClassificationHistoryQuery().parentIdIn("someParentId").list();
|
||||||
|
assertThat(returnValues).hasSize(1);
|
||||||
|
|
||||||
|
returnValues =
|
||||||
|
historyService.createClassificationHistoryQuery().parentKeyIn("otherParentKey").list();
|
||||||
|
assertThat(returnValues).hasSize(1);
|
||||||
|
|
||||||
|
returnValues = historyService.createClassificationHistoryQuery().priorityIn(1).list();
|
||||||
|
assertThat(returnValues).hasSize(3);
|
||||||
|
|
||||||
|
returnValues = historyService.createClassificationHistoryQuery().serviceLevelIn("P3D").list();
|
||||||
|
assertThat(returnValues).hasSize(2);
|
||||||
|
|
||||||
|
returnValues = historyService.createClassificationHistoryQuery().typeIn("TASK").list();
|
||||||
|
assertThat(returnValues).hasSize(7);
|
||||||
|
|
||||||
|
returnValues =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.customAttributeIn(ClassificationHistoryCustomField.CUSTOM_1, "custom1")
|
||||||
|
.list();
|
||||||
|
assertThat(returnValues).hasSize(6);
|
||||||
|
|
||||||
|
returnValues =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.customAttributeIn(ClassificationHistoryCustomField.CUSTOM_2, "custom2")
|
||||||
|
.list();
|
||||||
|
assertThat(returnValues).hasSize(6);
|
||||||
|
|
||||||
|
returnValues =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.customAttributeIn(ClassificationHistoryCustomField.CUSTOM_3, "otherCustom3")
|
||||||
|
.list();
|
||||||
|
assertThat(returnValues).hasSize(5);
|
||||||
|
|
||||||
|
returnValues =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.customAttributeIn(ClassificationHistoryCustomField.CUSTOM_4, "custom4", "otherCustom4")
|
||||||
|
.list();
|
||||||
|
assertThat(returnValues).hasSize(11);
|
||||||
|
|
||||||
|
returnValues =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.customAttributeIn(ClassificationHistoryCustomField.CUSTOM_5, "custom5")
|
||||||
|
.list();
|
||||||
|
assertThat(returnValues).hasSize(6);
|
||||||
|
|
||||||
|
returnValues =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.customAttributeIn(ClassificationHistoryCustomField.CUSTOM_6, "custom6")
|
||||||
|
.list();
|
||||||
|
assertThat(returnValues).hasSize(6);
|
||||||
|
|
||||||
|
returnValues =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.customAttributeIn(ClassificationHistoryCustomField.CUSTOM_7, "otherCustom7")
|
||||||
|
.list();
|
||||||
|
assertThat(returnValues).hasSize(5);
|
||||||
|
|
||||||
|
returnValues =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.customAttributeIn(ClassificationHistoryCustomField.CUSTOM_8, "custom8", "otherCustom8")
|
||||||
|
.list();
|
||||||
|
assertThat(returnValues).hasSize(11);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void should_ReturnHistoryEvents_For_DifferentLikeAttributes() {
|
||||||
|
|
||||||
|
List<ClassificationHistoryEvent> returnValues =
|
||||||
|
historyService.createClassificationHistoryQuery().eventTypeLike("C%").list();
|
||||||
|
assertThat(returnValues).hasSize(6);
|
||||||
|
|
||||||
|
returnValues = historyService.createClassificationHistoryQuery().userIdLike("p%", "c%").list();
|
||||||
|
assertThat(returnValues).hasSize(8);
|
||||||
|
|
||||||
|
returnValues =
|
||||||
|
historyService.createClassificationHistoryQuery().classificationIdLike("%0004").list();
|
||||||
|
assertThat(returnValues).hasSize(2);
|
||||||
|
|
||||||
|
returnValues =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.applicationEntryPointLike("other%")
|
||||||
|
.list();
|
||||||
|
assertThat(returnValues).hasSize(1);
|
||||||
|
|
||||||
|
returnValues = historyService.createClassificationHistoryQuery().categoryLike("%ERNAL").list();
|
||||||
|
assertThat(returnValues).hasSize(4);
|
||||||
|
|
||||||
|
returnValues = historyService.createClassificationHistoryQuery().domainLike("%_A").list();
|
||||||
|
assertThat(returnValues).hasSize(11);
|
||||||
|
|
||||||
|
returnValues = historyService.createClassificationHistoryQuery().keyLike("%004").list();
|
||||||
|
assertThat(returnValues).hasSize(2);
|
||||||
|
|
||||||
|
returnValues = historyService.createClassificationHistoryQuery().nameLike("POK%").list();
|
||||||
|
assertThat(returnValues).hasSize(2);
|
||||||
|
|
||||||
|
returnValues = historyService.createClassificationHistoryQuery().parentIdLike("other%").list();
|
||||||
|
assertThat(returnValues).hasSize(1);
|
||||||
|
|
||||||
|
returnValues = historyService.createClassificationHistoryQuery().parentKeyLike("other%").list();
|
||||||
|
assertThat(returnValues).hasSize(1);
|
||||||
|
|
||||||
|
returnValues = historyService.createClassificationHistoryQuery().serviceLevelLike("%1D").list();
|
||||||
|
assertThat(returnValues).hasSize(6);
|
||||||
|
|
||||||
|
returnValues = historyService.createClassificationHistoryQuery().typeLike("DOCU%").list();
|
||||||
|
assertThat(returnValues).hasSize(4);
|
||||||
|
|
||||||
|
returnValues =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.customAttributeLike(ClassificationHistoryCustomField.CUSTOM_1, "other%")
|
||||||
|
.list();
|
||||||
|
assertThat(returnValues).hasSize(5);
|
||||||
|
|
||||||
|
returnValues =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.customAttributeLike(ClassificationHistoryCustomField.CUSTOM_2, "cu%")
|
||||||
|
.list();
|
||||||
|
assertThat(returnValues).hasSize(6);
|
||||||
|
|
||||||
|
returnValues =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.customAttributeLike(ClassificationHistoryCustomField.CUSTOM_3, "other%", "cu%")
|
||||||
|
.list();
|
||||||
|
assertThat(returnValues).hasSize(11);
|
||||||
|
|
||||||
|
returnValues =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.customAttributeLike(ClassificationHistoryCustomField.CUSTOM_4, "other%")
|
||||||
|
.list();
|
||||||
|
assertThat(returnValues).hasSize(5);
|
||||||
|
|
||||||
|
returnValues =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.customAttributeLike(ClassificationHistoryCustomField.CUSTOM_5, "cu%")
|
||||||
|
.list();
|
||||||
|
assertThat(returnValues).hasSize(6);
|
||||||
|
|
||||||
|
returnValues =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.customAttributeLike(ClassificationHistoryCustomField.CUSTOM_6, "other%", "cu%")
|
||||||
|
.list();
|
||||||
|
assertThat(returnValues).hasSize(11);
|
||||||
|
|
||||||
|
returnValues =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.customAttributeLike(ClassificationHistoryCustomField.CUSTOM_7, "other%")
|
||||||
|
.list();
|
||||||
|
assertThat(returnValues).hasSize(5);
|
||||||
|
|
||||||
|
returnValues =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.customAttributeLike(ClassificationHistoryCustomField.CUSTOM_8, "other%", "cu%")
|
||||||
|
.list();
|
||||||
|
assertThat(returnValues).hasSize(11);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void should_ReturnHistoryEvents_When_ProvidingListValues() {
|
||||||
|
List<String> returnedList =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.listValues(ClassificationHistoryQueryColumnName.ID, null);
|
||||||
|
assertThat(returnedList).hasSize(11);
|
||||||
|
|
||||||
|
returnedList =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.listValues(ClassificationHistoryQueryColumnName.EVENT_TYPE, null);
|
||||||
|
assertThat(returnedList).hasSize(2);
|
||||||
|
|
||||||
|
returnedList =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.listValues(ClassificationHistoryQueryColumnName.CREATED, null);
|
||||||
|
assertThat(returnedList).hasSize(11);
|
||||||
|
|
||||||
|
returnedList =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.listValues(ClassificationHistoryQueryColumnName.USER_ID, null);
|
||||||
|
assertThat(returnedList).hasSize(4);
|
||||||
|
|
||||||
|
returnedList =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.listValues(ClassificationHistoryQueryColumnName.CLASSIFICATION_ID, null);
|
||||||
|
assertThat(returnedList).hasSize(6);
|
||||||
|
|
||||||
|
returnedList =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.listValues(ClassificationHistoryQueryColumnName.APPLICATION_ENTRY_POINT, null);
|
||||||
|
assertThat(returnedList).hasSize(3);
|
||||||
|
|
||||||
|
returnedList =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.listValues(ClassificationHistoryQueryColumnName.CATEGORY, null);
|
||||||
|
assertThat(returnedList).hasSize(2);
|
||||||
|
|
||||||
|
returnedList =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.listValues(ClassificationHistoryQueryColumnName.DOMAIN, null);
|
||||||
|
assertThat(returnedList).hasSize(1);
|
||||||
|
|
||||||
|
returnedList =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.listValues(ClassificationHistoryQueryColumnName.KEY, null);
|
||||||
|
assertThat(returnedList).hasSize(6);
|
||||||
|
|
||||||
|
returnedList =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.listValues(ClassificationHistoryQueryColumnName.NAME, null);
|
||||||
|
assertThat(returnedList).hasSize(6);
|
||||||
|
|
||||||
|
returnedList =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.listValues(ClassificationHistoryQueryColumnName.PARENT_ID, null);
|
||||||
|
assertThat(returnedList).hasSize(3);
|
||||||
|
|
||||||
|
returnedList =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.listValues(ClassificationHistoryQueryColumnName.PARENT_KEY, null);
|
||||||
|
assertThat(returnedList).hasSize(3);
|
||||||
|
|
||||||
|
returnedList =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.listValues(ClassificationHistoryQueryColumnName.SERVICE_LEVEL, null);
|
||||||
|
assertThat(returnedList).hasSize(4);
|
||||||
|
|
||||||
|
returnedList =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.listValues(ClassificationHistoryQueryColumnName.TYPE, null);
|
||||||
|
assertThat(returnedList).hasSize(2);
|
||||||
|
|
||||||
|
returnedList =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.listValues(ClassificationHistoryQueryColumnName.CUSTOM_1, null);
|
||||||
|
assertThat(returnedList).hasSize(2);
|
||||||
|
|
||||||
|
returnedList =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.listValues(ClassificationHistoryQueryColumnName.CUSTOM_2, null);
|
||||||
|
assertThat(returnedList).hasSize(2);
|
||||||
|
|
||||||
|
returnedList =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.listValues(ClassificationHistoryQueryColumnName.CUSTOM_3, null);
|
||||||
|
assertThat(returnedList).hasSize(2);
|
||||||
|
|
||||||
|
returnedList =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.listValues(ClassificationHistoryQueryColumnName.CUSTOM_4, null);
|
||||||
|
assertThat(returnedList).hasSize(2);
|
||||||
|
|
||||||
|
returnedList =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.listValues(ClassificationHistoryQueryColumnName.CUSTOM_5, null);
|
||||||
|
assertThat(returnedList).hasSize(2);
|
||||||
|
|
||||||
|
returnedList =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.listValues(ClassificationHistoryQueryColumnName.CUSTOM_6, null);
|
||||||
|
assertThat(returnedList).hasSize(2);
|
||||||
|
|
||||||
|
returnedList =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.listValues(ClassificationHistoryQueryColumnName.CUSTOM_7, null);
|
||||||
|
assertThat(returnedList).hasSize(2);
|
||||||
|
|
||||||
|
returnedList =
|
||||||
|
historyService
|
||||||
|
.createClassificationHistoryQuery()
|
||||||
|
.listValues(ClassificationHistoryQueryColumnName.CUSTOM_8, null);
|
||||||
|
assertThat(returnedList).hasSize(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
package pro.taskana.simplehistory.impl;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
|
import static org.mockito.Mockito.doNothing;
|
||||||
|
import static org.mockito.Mockito.validateMockitoUsage;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.ibatis.session.SqlSession;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.Mock;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import pro.taskana.common.internal.util.IdGenerator;
|
||||||
|
import pro.taskana.spi.history.api.events.classification.ClassificationHistoryEvent;
|
||||||
|
import pro.taskana.spi.history.api.events.classification.ClassificationHistoryEventType;
|
||||||
|
|
||||||
|
/** Unit Test for ClassificationQueryImplTest. */
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class ClassificationHistoryQueryImplTest {
|
||||||
|
|
||||||
|
private static final String ID_PREFIX_HISTORY_EVENT = "CHI";
|
||||||
|
|
||||||
|
private ClassificationHistoryQueryImpl historyQueryImpl;
|
||||||
|
|
||||||
|
@Mock private TaskanaHistoryEngineImpl taskanaHistoryEngineMock;
|
||||||
|
|
||||||
|
@Mock private SqlSession sqlSessionMock;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
void setup() {
|
||||||
|
historyQueryImpl = new ClassificationHistoryQueryImpl(taskanaHistoryEngineMock);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void should_returnList_When_CallingListMethodOnTaskHistoryQuery() throws Exception {
|
||||||
|
List<ClassificationHistoryEvent> returnList = new ArrayList<>();
|
||||||
|
returnList.add(
|
||||||
|
createHistoryEvent(
|
||||||
|
ClassificationHistoryEventType.CREATED.getName(), "admin", "someDetails"));
|
||||||
|
|
||||||
|
doNothing().when(taskanaHistoryEngineMock).openConnection();
|
||||||
|
doNothing().when(taskanaHistoryEngineMock).returnConnection();
|
||||||
|
when(taskanaHistoryEngineMock.getSqlSession()).thenReturn(sqlSessionMock);
|
||||||
|
when(sqlSessionMock.selectList(any(), any())).thenReturn(new ArrayList<>(returnList));
|
||||||
|
|
||||||
|
List<ClassificationHistoryEvent> result =
|
||||||
|
historyQueryImpl
|
||||||
|
.userIdIn("admin")
|
||||||
|
.typeIn(ClassificationHistoryEventType.CREATED.getName())
|
||||||
|
.list();
|
||||||
|
|
||||||
|
validateMockitoUsage();
|
||||||
|
assertThat(result).isEqualTo(returnList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ClassificationHistoryEvent createHistoryEvent(
|
||||||
|
String type, String userId, String details) {
|
||||||
|
ClassificationHistoryEvent he = new ClassificationHistoryEvent();
|
||||||
|
he.setId(IdGenerator.generateWithPrefix(ID_PREFIX_HISTORY_EVENT));
|
||||||
|
he.setUserId(userId);
|
||||||
|
he.setDetails(details);
|
||||||
|
he.setEventType(type);
|
||||||
|
return he;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -64,11 +64,10 @@ class SimpleHistoryServiceImplTest {
|
||||||
doReturn(taskanaEngine).when(taskanaEngineConfiguration).buildTaskanaEngine();
|
doReturn(taskanaEngine).when(taskanaEngineConfiguration).buildTaskanaEngine();
|
||||||
doReturn(taskanaEngineConfiguration).when(taskanaEngine).getConfiguration();
|
doReturn(taskanaEngineConfiguration).when(taskanaEngine).getConfiguration();
|
||||||
|
|
||||||
|
|
||||||
cutSpy.initialize(taskanaEngineConfiguration.buildTaskanaEngine());
|
cutSpy.initialize(taskanaEngineConfiguration.buildTaskanaEngine());
|
||||||
|
|
||||||
verify(sqlSessionManagerMock, times(2)).getMapper(any());
|
verify(sqlSessionManagerMock, times(3)).getMapper(any());
|
||||||
verify(taskanaHistoryEngineMock, times(2)).getSqlSession();
|
verify(taskanaHistoryEngineMock, times(3)).getSqlSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -88,10 +87,7 @@ class SimpleHistoryServiceImplTest {
|
||||||
void should_VerifyMethodInvocations_When_CreateWorkbasketHisoryEvent() throws Exception {
|
void should_VerifyMethodInvocations_When_CreateWorkbasketHisoryEvent() throws Exception {
|
||||||
WorkbasketHistoryEvent expectedEvent =
|
WorkbasketHistoryEvent expectedEvent =
|
||||||
AbstractAccTest.createWorkbasketHistoryEvent(
|
AbstractAccTest.createWorkbasketHistoryEvent(
|
||||||
"wbKey1",
|
"wbKey1", WorkbasketHistoryEventType.CREATED.getName(), "someUserId", "someDetails");
|
||||||
WorkbasketHistoryEventType.CREATED.getName(),
|
|
||||||
"someUserId",
|
|
||||||
"someDetails");
|
|
||||||
|
|
||||||
cutSpy.create(expectedEvent);
|
cutSpy.create(expectedEvent);
|
||||||
verify(taskanaHistoryEngineMock, times(1)).openConnection();
|
verify(taskanaHistoryEngineMock, times(1)).openConnection();
|
||||||
|
|
@ -127,10 +123,7 @@ class SimpleHistoryServiceImplTest {
|
||||||
List<WorkbasketHistoryEvent> returnList = new ArrayList<>();
|
List<WorkbasketHistoryEvent> returnList = new ArrayList<>();
|
||||||
returnList.add(
|
returnList.add(
|
||||||
AbstractAccTest.createWorkbasketHistoryEvent(
|
AbstractAccTest.createWorkbasketHistoryEvent(
|
||||||
"wbKey1",
|
"wbKey1", WorkbasketHistoryEventType.CREATED.getName(), "someUserId", "someDetails"));
|
||||||
WorkbasketHistoryEventType.CREATED.getName(),
|
|
||||||
"someUserId",
|
|
||||||
"someDetails"));
|
|
||||||
when(taskanaHistoryEngineMock.getSqlSession()).thenReturn(sqlSessionMock);
|
when(taskanaHistoryEngineMock.getSqlSession()).thenReturn(sqlSessionMock);
|
||||||
when(sqlSessionMock.selectList(any(), any())).thenReturn(new ArrayList<>(returnList));
|
when(sqlSessionMock.selectList(any(), any())).thenReturn(new ArrayList<>(returnList));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ import pro.taskana.common.api.TimeInterval;
|
||||||
import pro.taskana.common.internal.util.IdGenerator;
|
import pro.taskana.common.internal.util.IdGenerator;
|
||||||
import pro.taskana.spi.history.api.events.task.TaskHistoryEvent;
|
import pro.taskana.spi.history.api.events.task.TaskHistoryEvent;
|
||||||
|
|
||||||
/** Unit Test for SimpleHistoryServiceImplTest. */
|
/** Unit Test for TaskHistoryQueryImplTest. */
|
||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
class TaskHistoryQueryImplTest {
|
class TaskHistoryQueryImplTest {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ import pro.taskana.common.internal.util.IdGenerator;
|
||||||
import pro.taskana.spi.history.api.events.workbasket.WorkbasketHistoryEvent;
|
import pro.taskana.spi.history.api.events.workbasket.WorkbasketHistoryEvent;
|
||||||
import pro.taskana.spi.history.api.events.workbasket.WorkbasketHistoryEventType;
|
import pro.taskana.spi.history.api.events.workbasket.WorkbasketHistoryEventType;
|
||||||
|
|
||||||
/** Unit Test for SimpleHistoryServiceImplTest. */
|
/** Unit Test for WorkbasketHistoryQueryImplTest. */
|
||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
class WorkbasketHistoryQueryImplTest {
|
class WorkbasketHistoryQueryImplTest {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,14 @@ import pro.taskana.common.api.exceptions.DomainNotFoundException;
|
||||||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.common.internal.InternalTaskanaEngine;
|
import pro.taskana.common.internal.InternalTaskanaEngine;
|
||||||
|
import pro.taskana.common.internal.security.CurrentUserContext;
|
||||||
import pro.taskana.common.internal.util.IdGenerator;
|
import pro.taskana.common.internal.util.IdGenerator;
|
||||||
import pro.taskana.common.internal.util.LogSanitizer;
|
import pro.taskana.common.internal.util.LogSanitizer;
|
||||||
|
import pro.taskana.common.internal.util.ObjectAttributeChangeDetector;
|
||||||
|
import pro.taskana.spi.history.api.events.classification.ClassificationCreatedEvent;
|
||||||
|
import pro.taskana.spi.history.api.events.classification.ClassificationDeletedEvent;
|
||||||
|
import pro.taskana.spi.history.api.events.classification.ClassificationUpdatedEvent;
|
||||||
|
import pro.taskana.spi.history.internal.HistoryEventManager;
|
||||||
import pro.taskana.task.api.models.TaskSummary;
|
import pro.taskana.task.api.models.TaskSummary;
|
||||||
import pro.taskana.task.internal.TaskMapper;
|
import pro.taskana.task.internal.TaskMapper;
|
||||||
|
|
||||||
|
|
@ -38,7 +44,9 @@ import pro.taskana.task.internal.TaskMapper;
|
||||||
public class ClassificationServiceImpl implements ClassificationService {
|
public class ClassificationServiceImpl implements ClassificationService {
|
||||||
|
|
||||||
private static final String ID_PREFIX_CLASSIFICATION = "CLI";
|
private static final String ID_PREFIX_CLASSIFICATION = "CLI";
|
||||||
|
private static final String ID_PREFIX_CLASSIFICATION_HISTORY_EVENT = "CHI";
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(ClassificationServiceImpl.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(ClassificationServiceImpl.class);
|
||||||
|
private final HistoryEventManager historyEventManager;
|
||||||
private ClassificationMapper classificationMapper;
|
private ClassificationMapper classificationMapper;
|
||||||
private TaskMapper taskMapper;
|
private TaskMapper taskMapper;
|
||||||
private InternalTaskanaEngine taskanaEngine;
|
private InternalTaskanaEngine taskanaEngine;
|
||||||
|
|
@ -50,6 +58,7 @@ public class ClassificationServiceImpl implements ClassificationService {
|
||||||
this.taskanaEngine = taskanaEngine;
|
this.taskanaEngine = taskanaEngine;
|
||||||
this.classificationMapper = classificationMapper;
|
this.classificationMapper = classificationMapper;
|
||||||
this.taskMapper = taskMapper;
|
this.taskMapper = taskMapper;
|
||||||
|
this.historyEventManager = taskanaEngine.getHistoryEventManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -132,6 +141,20 @@ public class ClassificationServiceImpl implements ClassificationService {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.classificationMapper.deleteClassification(classificationId);
|
this.classificationMapper.deleteClassification(classificationId);
|
||||||
|
|
||||||
|
if (HistoryEventManager.isHistoryEnabled()) {
|
||||||
|
String details =
|
||||||
|
ObjectAttributeChangeDetector.determineChangesInAttributes(
|
||||||
|
classification, newClassification("", "", ""));
|
||||||
|
|
||||||
|
historyEventManager.createEvent(
|
||||||
|
new ClassificationDeletedEvent(
|
||||||
|
IdGenerator.generateWithPrefix(ID_PREFIX_CLASSIFICATION_HISTORY_EVENT),
|
||||||
|
classification,
|
||||||
|
CurrentUserContext.getUserid(),
|
||||||
|
details));
|
||||||
|
}
|
||||||
|
|
||||||
} catch (PersistenceException e) {
|
} catch (PersistenceException e) {
|
||||||
if (isReferentialIntegrityConstraintViolation(e)) {
|
if (isReferentialIntegrityConstraintViolation(e)) {
|
||||||
throw new ClassificationInUseException(
|
throw new ClassificationInUseException(
|
||||||
|
|
@ -204,6 +227,20 @@ public class ClassificationServiceImpl implements ClassificationService {
|
||||||
validateAndPopulateParentInformation(classificationImpl);
|
validateAndPopulateParentInformation(classificationImpl);
|
||||||
|
|
||||||
classificationMapper.insert(classificationImpl);
|
classificationMapper.insert(classificationImpl);
|
||||||
|
|
||||||
|
if (HistoryEventManager.isHistoryEnabled()) {
|
||||||
|
String details =
|
||||||
|
ObjectAttributeChangeDetector.determineChangesInAttributes(
|
||||||
|
newClassification("", "", ""), classificationImpl);
|
||||||
|
|
||||||
|
historyEventManager.createEvent(
|
||||||
|
new ClassificationCreatedEvent(
|
||||||
|
IdGenerator.generateWithPrefix(ID_PREFIX_CLASSIFICATION_HISTORY_EVENT),
|
||||||
|
classificationImpl,
|
||||||
|
CurrentUserContext.getUserid(),
|
||||||
|
details));
|
||||||
|
}
|
||||||
|
|
||||||
LOGGER.debug("Method createClassification created classification {}.", classificationImpl);
|
LOGGER.debug("Method createClassification created classification {}.", classificationImpl);
|
||||||
|
|
||||||
if (!classification.getDomain().isEmpty()) {
|
if (!classification.getDomain().isEmpty()) {
|
||||||
|
|
@ -244,6 +281,18 @@ public class ClassificationServiceImpl implements ClassificationService {
|
||||||
classificationMapper.update(classificationImpl);
|
classificationMapper.update(classificationImpl);
|
||||||
this.createJobIfPriorityOrServiceLevelHasChanged(oldClassification, classificationImpl);
|
this.createJobIfPriorityOrServiceLevelHasChanged(oldClassification, classificationImpl);
|
||||||
|
|
||||||
|
if (HistoryEventManager.isHistoryEnabled()) {
|
||||||
|
String details =
|
||||||
|
ObjectAttributeChangeDetector.determineChangesInAttributes(
|
||||||
|
oldClassification, classificationImpl);
|
||||||
|
|
||||||
|
historyEventManager.createEvent(
|
||||||
|
new ClassificationUpdatedEvent(
|
||||||
|
IdGenerator.generateWithPrefix(ID_PREFIX_CLASSIFICATION_HISTORY_EVENT),
|
||||||
|
classificationImpl,
|
||||||
|
CurrentUserContext.getUserid(),
|
||||||
|
details));
|
||||||
|
}
|
||||||
LOGGER.debug(
|
LOGGER.debug(
|
||||||
"Method updateClassification() updated the classification {}.", classificationImpl);
|
"Method updateClassification() updated the classification {}.", classificationImpl);
|
||||||
return classification;
|
return classification;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
import pro.taskana.common.api.TaskanaEngine;
|
import pro.taskana.common.api.TaskanaEngine;
|
||||||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
||||||
|
import pro.taskana.spi.history.api.events.classification.ClassificationHistoryEvent;
|
||||||
import pro.taskana.spi.history.api.events.task.TaskHistoryEvent;
|
import pro.taskana.spi.history.api.events.task.TaskHistoryEvent;
|
||||||
import pro.taskana.spi.history.api.events.workbasket.WorkbasketHistoryEvent;
|
import pro.taskana.spi.history.api.events.workbasket.WorkbasketHistoryEvent;
|
||||||
|
|
||||||
|
|
@ -32,6 +33,13 @@ public interface TaskanaHistory {
|
||||||
*/
|
*/
|
||||||
void create(WorkbasketHistoryEvent event);
|
void create(WorkbasketHistoryEvent event);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new classification history event.
|
||||||
|
*
|
||||||
|
* @param event {@link ClassificationHistoryEvent} The event to be created.
|
||||||
|
*/
|
||||||
|
void create(ClassificationHistoryEvent event);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete history events by taskIds. Invalid/non-existing taskIds will be ignored
|
* Delete history events by taskIds. Invalid/non-existing taskIds will be ignored
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
package pro.taskana.spi.history.api.events.classification;
|
||||||
|
|
||||||
|
import pro.taskana.classification.api.models.Classification;
|
||||||
|
|
||||||
|
public class ClassificationCreatedEvent extends ClassificationHistoryEvent {
|
||||||
|
|
||||||
|
public ClassificationCreatedEvent(
|
||||||
|
String id, Classification classification, String userId, String details) {
|
||||||
|
super(id, classification, userId, details);
|
||||||
|
eventType = ClassificationHistoryEventType.CREATED.getName();
|
||||||
|
created = classification.getCreated();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
package pro.taskana.spi.history.api.events.classification;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
|
import pro.taskana.classification.api.models.Classification;
|
||||||
|
|
||||||
|
public class ClassificationDeletedEvent extends ClassificationHistoryEvent {
|
||||||
|
|
||||||
|
public ClassificationDeletedEvent(
|
||||||
|
String id, Classification classification, String userId, String details) {
|
||||||
|
super(id, classification, userId, details);
|
||||||
|
eventType = ClassificationHistoryEventType.DELETED.getName();
|
||||||
|
created = Instant.now();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
package pro.taskana.spi.history.api.events.classification;
|
||||||
|
|
||||||
|
public enum ClassificationHistoryCustomField {
|
||||||
|
CUSTOM_1,
|
||||||
|
CUSTOM_2,
|
||||||
|
CUSTOM_3,
|
||||||
|
CUSTOM_4,
|
||||||
|
CUSTOM_5,
|
||||||
|
CUSTOM_6,
|
||||||
|
CUSTOM_7,
|
||||||
|
CUSTOM_8
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,364 @@
|
||||||
|
package pro.taskana.spi.history.api.events.classification;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import pro.taskana.classification.api.ClassificationCustomField;
|
||||||
|
import pro.taskana.classification.api.models.ClassificationSummary;
|
||||||
|
import pro.taskana.common.api.exceptions.SystemException;
|
||||||
|
|
||||||
|
/** Super class for all classification related events. */
|
||||||
|
public class ClassificationHistoryEvent {
|
||||||
|
|
||||||
|
protected String id;
|
||||||
|
protected String eventType;
|
||||||
|
protected Instant created;
|
||||||
|
protected String userId;
|
||||||
|
protected String classificationId;
|
||||||
|
protected String applicationEntryPoint;
|
||||||
|
protected String category;
|
||||||
|
protected String domain;
|
||||||
|
protected String key;
|
||||||
|
protected String name;
|
||||||
|
protected String parentId;
|
||||||
|
protected String parentKey;
|
||||||
|
protected int priority;
|
||||||
|
protected String serviceLevel;
|
||||||
|
protected String type;
|
||||||
|
protected String custom1;
|
||||||
|
protected String custom2;
|
||||||
|
protected String custom3;
|
||||||
|
protected String custom4;
|
||||||
|
protected String custom5;
|
||||||
|
protected String custom6;
|
||||||
|
protected String custom7;
|
||||||
|
protected String custom8;
|
||||||
|
protected String details;
|
||||||
|
|
||||||
|
public ClassificationHistoryEvent() {}
|
||||||
|
|
||||||
|
public ClassificationHistoryEvent(
|
||||||
|
String id, ClassificationSummary classification, String userId, String details) {
|
||||||
|
this.id = id;
|
||||||
|
this.userId = userId;
|
||||||
|
classificationId = classification.getId();
|
||||||
|
applicationEntryPoint = classification.getApplicationEntryPoint();
|
||||||
|
category = classification.getCategory();
|
||||||
|
domain = classification.getDomain();
|
||||||
|
key = classification.getKey();
|
||||||
|
name = classification.getName();
|
||||||
|
parentId = classification.getParentId();
|
||||||
|
parentKey = classification.getParentKey();
|
||||||
|
priority = classification.getPriority();
|
||||||
|
serviceLevel = classification.getServiceLevel();
|
||||||
|
type = classification.getType();
|
||||||
|
custom1 = classification.getCustomAttribute(ClassificationCustomField.CUSTOM_1);
|
||||||
|
custom2 = classification.getCustomAttribute(ClassificationCustomField.CUSTOM_2);
|
||||||
|
custom3 = classification.getCustomAttribute(ClassificationCustomField.CUSTOM_3);
|
||||||
|
custom4 = classification.getCustomAttribute(ClassificationCustomField.CUSTOM_4);
|
||||||
|
custom5 = classification.getCustomAttribute(ClassificationCustomField.CUSTOM_5);
|
||||||
|
custom6 = classification.getCustomAttribute(ClassificationCustomField.CUSTOM_6);
|
||||||
|
custom7 = classification.getCustomAttribute(ClassificationCustomField.CUSTOM_7);
|
||||||
|
custom8 = classification.getCustomAttribute(ClassificationCustomField.CUSTOM_8);
|
||||||
|
this.details = details;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCustomAttribute(ClassificationHistoryCustomField customField, String value) {
|
||||||
|
switch (customField) {
|
||||||
|
case CUSTOM_1:
|
||||||
|
custom1 = value;
|
||||||
|
break;
|
||||||
|
case CUSTOM_2:
|
||||||
|
custom2 = value;
|
||||||
|
break;
|
||||||
|
case CUSTOM_3:
|
||||||
|
custom3 = value;
|
||||||
|
break;
|
||||||
|
case CUSTOM_4:
|
||||||
|
custom4 = value;
|
||||||
|
break;
|
||||||
|
case CUSTOM_5:
|
||||||
|
custom5 = value;
|
||||||
|
break;
|
||||||
|
case CUSTOM_6:
|
||||||
|
custom6 = value;
|
||||||
|
break;
|
||||||
|
case CUSTOM_7:
|
||||||
|
custom7 = value;
|
||||||
|
break;
|
||||||
|
case CUSTOM_8:
|
||||||
|
custom8 = value;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new SystemException("Unknown customField '" + customField + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCustomAttribute(ClassificationHistoryCustomField customField) {
|
||||||
|
switch (customField) {
|
||||||
|
case CUSTOM_1:
|
||||||
|
return custom1;
|
||||||
|
case CUSTOM_2:
|
||||||
|
return custom2;
|
||||||
|
case CUSTOM_3:
|
||||||
|
return custom3;
|
||||||
|
case CUSTOM_4:
|
||||||
|
return custom4;
|
||||||
|
case CUSTOM_5:
|
||||||
|
return custom5;
|
||||||
|
case CUSTOM_6:
|
||||||
|
return custom6;
|
||||||
|
case CUSTOM_7:
|
||||||
|
return custom7;
|
||||||
|
case CUSTOM_8:
|
||||||
|
return custom8;
|
||||||
|
default:
|
||||||
|
throw new SystemException("Unknown customField '" + customField + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEventType() {
|
||||||
|
return eventType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEventType(String eventType) {
|
||||||
|
this.eventType = eventType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Instant getCreated() {
|
||||||
|
return created;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreated(Instant created) {
|
||||||
|
this.created = created;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(String userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClassificationId() {
|
||||||
|
return classificationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClassificationId(String classificationId) {
|
||||||
|
this.classificationId = classificationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApplicationEntryPoint() {
|
||||||
|
return applicationEntryPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApplicationEntryPoint(String applicationEntryPoint) {
|
||||||
|
this.applicationEntryPoint = applicationEntryPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCategory() {
|
||||||
|
return category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategory(String category) {
|
||||||
|
this.category = category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDomain() {
|
||||||
|
return domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDomain(String domain) {
|
||||||
|
this.domain = domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKey(String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParentId() {
|
||||||
|
return parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentId(String parentId) {
|
||||||
|
this.parentId = parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParentKey() {
|
||||||
|
return parentKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentKey(String parentKey) {
|
||||||
|
this.parentKey = parentKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPriority() {
|
||||||
|
return priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPriority(int priority) {
|
||||||
|
this.priority = priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getServiceLevel() {
|
||||||
|
return serviceLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setServiceLevel(String serviceLevel) {
|
||||||
|
this.serviceLevel = serviceLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDetails() {
|
||||||
|
return details;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDetails(String details) {
|
||||||
|
this.details = details;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(
|
||||||
|
getId(),
|
||||||
|
getEventType(),
|
||||||
|
getCreated(),
|
||||||
|
getUserId(),
|
||||||
|
getClassificationId(),
|
||||||
|
getApplicationEntryPoint(),
|
||||||
|
getCategory(),
|
||||||
|
getDomain(),
|
||||||
|
getKey(),
|
||||||
|
getName(),
|
||||||
|
getParentId(),
|
||||||
|
getParentKey(),
|
||||||
|
getPriority(),
|
||||||
|
getServiceLevel(),
|
||||||
|
getType(),
|
||||||
|
custom1,
|
||||||
|
custom2,
|
||||||
|
custom3,
|
||||||
|
custom4,
|
||||||
|
custom5,
|
||||||
|
custom6,
|
||||||
|
custom7,
|
||||||
|
custom8,
|
||||||
|
getDetails());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof ClassificationHistoryEvent)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ClassificationHistoryEvent other = (ClassificationHistoryEvent) obj;
|
||||||
|
return getPriority() == other.getPriority()
|
||||||
|
&& Objects.equals(getId(), other.getId())
|
||||||
|
&& Objects.equals(getEventType(), other.getEventType())
|
||||||
|
&& Objects.equals(getCreated(), other.getCreated())
|
||||||
|
&& Objects.equals(getUserId(), other.getUserId())
|
||||||
|
&& Objects.equals(getClassificationId(), other.getClassificationId())
|
||||||
|
&& Objects.equals(getApplicationEntryPoint(), other.getApplicationEntryPoint())
|
||||||
|
&& Objects.equals(getCategory(), other.getCategory())
|
||||||
|
&& Objects.equals(getDomain(), other.getDomain())
|
||||||
|
&& Objects.equals(getKey(), other.getKey())
|
||||||
|
&& Objects.equals(getName(), other.getName())
|
||||||
|
&& Objects.equals(getParentId(), other.getParentId())
|
||||||
|
&& Objects.equals(getParentKey(), other.getParentKey())
|
||||||
|
&& Objects.equals(getServiceLevel(), other.getServiceLevel())
|
||||||
|
&& Objects.equals(getType(), other.getType())
|
||||||
|
&& Objects.equals(custom1, other.custom1)
|
||||||
|
&& Objects.equals(custom2, other.custom2)
|
||||||
|
&& Objects.equals(custom3, other.custom3)
|
||||||
|
&& Objects.equals(custom4, other.custom4)
|
||||||
|
&& Objects.equals(custom5, other.custom5)
|
||||||
|
&& Objects.equals(custom6, other.custom6)
|
||||||
|
&& Objects.equals(custom7, other.custom7)
|
||||||
|
&& Objects.equals(custom8, other.custom8)
|
||||||
|
&& Objects.equals(getDetails(), other.getDetails());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ClassificationHistoryEvent [id="
|
||||||
|
+ id
|
||||||
|
+ ", eventType="
|
||||||
|
+ eventType
|
||||||
|
+ ", created="
|
||||||
|
+ created
|
||||||
|
+ ", userId="
|
||||||
|
+ userId
|
||||||
|
+ ", classificationId="
|
||||||
|
+ classificationId
|
||||||
|
+ ", applicationEntryPoint="
|
||||||
|
+ applicationEntryPoint
|
||||||
|
+ ", category="
|
||||||
|
+ category
|
||||||
|
+ ", domain="
|
||||||
|
+ domain
|
||||||
|
+ ", key="
|
||||||
|
+ key
|
||||||
|
+ ", name="
|
||||||
|
+ name
|
||||||
|
+ ", parentId="
|
||||||
|
+ parentId
|
||||||
|
+ ", parentKey="
|
||||||
|
+ parentKey
|
||||||
|
+ ", priority="
|
||||||
|
+ priority
|
||||||
|
+ ", serviceLevel="
|
||||||
|
+ serviceLevel
|
||||||
|
+ ", type="
|
||||||
|
+ type
|
||||||
|
+ ", custom1="
|
||||||
|
+ custom1
|
||||||
|
+ ", custom2="
|
||||||
|
+ custom2
|
||||||
|
+ ", custom3="
|
||||||
|
+ custom3
|
||||||
|
+ ", custom4="
|
||||||
|
+ custom4
|
||||||
|
+ ", custom5="
|
||||||
|
+ custom5
|
||||||
|
+ ", custom6="
|
||||||
|
+ custom6
|
||||||
|
+ ", custom7="
|
||||||
|
+ custom7
|
||||||
|
+ ", custom8="
|
||||||
|
+ custom8
|
||||||
|
+ ", details="
|
||||||
|
+ details
|
||||||
|
+ "]";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package pro.taskana.spi.history.api.events.classification;
|
||||||
|
|
||||||
|
public enum ClassificationHistoryEventType {
|
||||||
|
|
||||||
|
CREATED("CREATED"),
|
||||||
|
UPDATED("UPDATED"),
|
||||||
|
DELETED("DELETED");
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
ClassificationHistoryEventType(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
package pro.taskana.spi.history.api.events.classification;
|
||||||
|
|
||||||
|
import pro.taskana.classification.api.models.Classification;
|
||||||
|
|
||||||
|
public class ClassificationUpdatedEvent extends ClassificationHistoryEvent {
|
||||||
|
|
||||||
|
public ClassificationUpdatedEvent(
|
||||||
|
String id, Classification classification, String userId, String details) {
|
||||||
|
super(id, classification, userId, details);
|
||||||
|
eventType = ClassificationHistoryEventType.UPDATED.getName();
|
||||||
|
created = classification.getModified();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,5 +4,5 @@ public enum WorkbasketHistoryCustomField {
|
||||||
CUSTOM_1,
|
CUSTOM_1,
|
||||||
CUSTOM_2,
|
CUSTOM_2,
|
||||||
CUSTOM_3,
|
CUSTOM_3,
|
||||||
CUSTOM_4,
|
CUSTOM_4
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import pro.taskana.common.api.TaskanaEngine;
|
||||||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.spi.history.api.TaskanaHistory;
|
import pro.taskana.spi.history.api.TaskanaHistory;
|
||||||
|
import pro.taskana.spi.history.api.events.classification.ClassificationHistoryEvent;
|
||||||
import pro.taskana.spi.history.api.events.task.TaskHistoryEvent;
|
import pro.taskana.spi.history.api.events.task.TaskHistoryEvent;
|
||||||
import pro.taskana.spi.history.api.events.workbasket.WorkbasketHistoryEvent;
|
import pro.taskana.spi.history.api.events.workbasket.WorkbasketHistoryEvent;
|
||||||
|
|
||||||
|
|
@ -17,6 +18,7 @@ import pro.taskana.spi.history.api.events.workbasket.WorkbasketHistoryEvent;
|
||||||
public final class HistoryEventManager {
|
public final class HistoryEventManager {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(HistoryEventManager.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(HistoryEventManager.class);
|
||||||
|
private static final String SENDING_EVENT = "Sending event to history service providers: {}";
|
||||||
private static HistoryEventManager singleton;
|
private static HistoryEventManager singleton;
|
||||||
private boolean enabled = false;
|
private boolean enabled = false;
|
||||||
private ServiceLoader<TaskanaHistory> serviceLoader;
|
private ServiceLoader<TaskanaHistory> serviceLoader;
|
||||||
|
|
@ -45,12 +47,17 @@ public final class HistoryEventManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createEvent(TaskHistoryEvent event) {
|
public void createEvent(TaskHistoryEvent event) {
|
||||||
LOGGER.debug("Sending event to history service providers: {}", event);
|
LOGGER.debug(SENDING_EVENT, event);
|
||||||
serviceLoader.forEach(historyProvider -> historyProvider.create(event));
|
serviceLoader.forEach(historyProvider -> historyProvider.create(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createEvent(WorkbasketHistoryEvent event) {
|
public void createEvent(WorkbasketHistoryEvent event) {
|
||||||
LOGGER.debug("Sending event to history service providers: {}", event);
|
LOGGER.debug(SENDING_EVENT, event);
|
||||||
|
serviceLoader.forEach(historyProvider -> historyProvider.create(event));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void createEvent(ClassificationHistoryEvent event) {
|
||||||
|
LOGGER.debug(SENDING_EVENT, event);
|
||||||
serviceLoader.forEach(historyProvider -> historyProvider.create(event));
|
serviceLoader.forEach(historyProvider -> historyProvider.create(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,8 @@ class PojoTest {
|
||||||
.filter(
|
.filter(
|
||||||
javaClass ->
|
javaClass ->
|
||||||
!javaClass.getSimpleName().equals("TaskHistoryEvent")
|
!javaClass.getSimpleName().equals("TaskHistoryEvent")
|
||||||
&& !javaClass.getSimpleName().equals("WorkbasketHistoryEvent"))
|
&& !javaClass.getSimpleName().equals("WorkbasketHistoryEvent")
|
||||||
|
&& !javaClass.getSimpleName().equals("ClassificationHistoryEvent"))
|
||||||
.map(JavaClass::reflect)
|
.map(JavaClass::reflect)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package pro.taskana.classification.internal;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
|
import static org.mockito.Mockito.times;
|
||||||
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
|
@ -36,6 +38,7 @@ class ClassificationServiceImplTest {
|
||||||
@Test
|
@Test
|
||||||
void testCreateClassificationQuery() {
|
void testCreateClassificationQuery() {
|
||||||
cutSpy.createClassificationQuery();
|
cutSpy.createClassificationQuery();
|
||||||
|
verify(internalTaskanaEngineMock, times(1)).getHistoryEventManager();
|
||||||
verifyNoMoreInteractions(
|
verifyNoMoreInteractions(
|
||||||
classificationMapperMock,
|
classificationMapperMock,
|
||||||
internalTaskanaEngineMock,
|
internalTaskanaEngineMock,
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@ public final class SampleDataProvider {
|
||||||
static final String TEST_ATTACHMENT = "/sql/test-data/attachment.sql";
|
static final String TEST_ATTACHMENT = "/sql/test-data/attachment.sql";
|
||||||
static final String TEST_TASK_HISTORY_EVENT = "/sql/test-data/task-history-event.sql";
|
static final String TEST_TASK_HISTORY_EVENT = "/sql/test-data/task-history-event.sql";
|
||||||
static final String TEST_WORKBASKET_HISTORY_EVENT = "/sql/test-data/workbasket-history-event.sql";
|
static final String TEST_WORKBASKET_HISTORY_EVENT = "/sql/test-data/workbasket-history-event.sql";
|
||||||
|
static final String TEST_CLASSIFICATION_HISTORY_EVENT =
|
||||||
|
"/sql/test-data/classification-history-event.sql";
|
||||||
static final String MONITOR_SAMPLE_DATA = "/sql/monitor-data/monitor-sample-data.sql";
|
static final String MONITOR_SAMPLE_DATA = "/sql/monitor-data/monitor-sample-data.sql";
|
||||||
private static final String DB_CLEAR_TABLES_SCRIPT = "/sql/clear/clear-db.sql";
|
private static final String DB_CLEAR_TABLES_SCRIPT = "/sql/clear/clear-db.sql";
|
||||||
private static final String DB_DROP_TABLES_SCRIPT = "/sql/clear/drop-tables.sql";
|
private static final String DB_DROP_TABLES_SCRIPT = "/sql/clear/drop-tables.sql";
|
||||||
|
|
@ -45,8 +47,7 @@ public final class SampleDataProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
static Stream<String> getScriptsWithEvents() {
|
static Stream<String> getScriptsWithEvents() {
|
||||||
return Stream.concat(
|
return Stream.concat(getSampleDataCreationScripts(), Stream.of(SAMPLE_TASK_HISTORY_EVENT));
|
||||||
getSampleDataCreationScripts(), Stream.of(SAMPLE_TASK_HISTORY_EVENT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Stream<String> getScriptsToClearDatabase() {
|
static Stream<String> getScriptsToClearDatabase() {
|
||||||
|
|
@ -64,6 +65,7 @@ public final class SampleDataProvider {
|
||||||
TEST_TASK,
|
TEST_TASK,
|
||||||
TEST_TASK_HISTORY_EVENT,
|
TEST_TASK_HISTORY_EVENT,
|
||||||
TEST_WORKBASKET_HISTORY_EVENT,
|
TEST_WORKBASKET_HISTORY_EVENT,
|
||||||
|
TEST_CLASSIFICATION_HISTORY_EVENT,
|
||||||
TEST_TASK_COMMENT,
|
TEST_TASK_COMMENT,
|
||||||
TEST_WORKBASKET_ACCESS_LIST,
|
TEST_WORKBASKET_ACCESS_LIST,
|
||||||
TEST_DISTRIBUTION_TARGETS,
|
TEST_DISTRIBUTION_TARGETS,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
INSERT INTO CLASSIFICATION_HISTORY_EVENT (ID,EVENT_TYPE, CREATED, USER_ID, CLASSIFICATION_ID, APPLICATION_ENTRY_POINT, CATEGORY, DOMAIN, KEY, NAME, PARENT_ID, PARENT_KEY, PRIORITY, SERVICE_LEVEL, TYPE, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, CUSTOM_6, CUSTOM_7, CUSTOM_8, 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
|
||||||
|
('CHI:000000000000000000000000000000000000','CREATED' ,'2018-01-29 15:55:00' ,'peter', 'CLI:000000000000000000000000000000000001', '', 'MANUAL', 'DOMAIN_A', 'L10000', 'OLD-Leistungsfall', '', '', 1, 'P1D', 'TASK', 'custom1' ,'custom2' , 'custom3' ,'custom4', 'custom5','custom6', 'custom7','custom8', '{"changes":[{"newValue":"CHI:000000000000000000000000000000000000","fieldName":"id","oldValue":""}]}' ),
|
||||||
|
('CHI:000000000000000000000000000000000001','UPDATED' ,'2018-01-29 15:55:01' ,'admin', 'CLI:000000000000000000000000000000000001', 'someEntryPoint', 'MANUAL', 'DOMAIN_A', 'L10000', 'OLD-Leistungsfall', '', '', 1, 'P1D', 'TASK', 'otherCustom1' ,'otherCustom2' , 'otherCustom3' ,'otherCustom4', 'otherCustom5','otherCustom6', 'otherCustom7','otherCustom8', '{"changes":[{"newValue":"CHI:000000000000000000000000000000000000","fieldName":"id","oldValue":""}]}' ),
|
||||||
|
('CHI:000000000000000000000000000000000002','CREATED' ,'2018-01-29 15:55:02' ,'peter', 'CLI:000000000000000000000000000000000002', '', 'EXTERNAL', 'DOMAIN_A', 'L10001', 'ABC-Leistungsfall', 'someParentId', 'someParentKey', 2, 'P2D', 'DOCUMENT', 'custom1' ,'custom2' , 'custom3' ,'custom4', 'custom5','custom6', 'custom7','custom8', '{"changes":[{"newValue":"CHI:000000000000000000000000000000000000","fieldName":"id","oldValue":""}]}' ),
|
||||||
|
('CHI:000000000000000000000000000000000003','UPDATED' ,'2018-01-29 15:55:03' ,'peter', 'CLI:000000000000000000000000000000000002', 'someEntryPoint', 'EXTERNAL', 'DOMAIN_A', 'L10001', 'ABC-Leistungsfall', '', '', 2, 'P2D', 'DOCUMENT', 'otherCustom1' ,'otherCustom2' , 'otherCustom3' ,'otherCustom4', 'otherCustom5','otherCustom6', 'otherCustom7','otherCustom8', '{"changes":[{"newValue":"CHI:000000000000000000000000000000000000","fieldName":"id","oldValue":""}]}' ),
|
||||||
|
('CHI:000000000000000000000000000000000004','CREATED' ,'2018-01-29 15:55:04' ,'peter', 'CLI:000000000000000000000000000000000003', '', 'MANUAL', 'DOMAIN_A', 'L10004', 'DFG-Leistungsfall', '', '', 3, 'P1D', 'TASK', 'custom1' ,'custom2' , 'custom3' ,'custom4', 'custom5','custom6', 'custom7','custom8', '{"changes":[{"newValue":"CHI:000000000000000000000000000000000000","fieldName":"id","oldValue":""}]}' ),
|
||||||
|
('CHI:000000000000000000000000000000000005','UPDATED' ,'2018-01-29 15:55:05' ,'sven', 'CLI:000000000000000000000000000000000003', '', 'MANUAL', 'DOMAIN_A', 'L10004', 'DFG-Leistungsfall', '', '', 3, 'P1D', 'TASK', 'otherCustom1' ,'otherCustom2' , 'otherCustom3' ,'otherCustom4', 'otherCustom5','otherCustom6', 'otherCustom7','otherCustom8', '{"changes":[{"newValue":"CHI:000000000000000000000000000000000000","fieldName":"id","oldValue":""}]}' ),
|
||||||
|
('CHI:000000000000000000000000000000000006','CREATED' ,'2018-01-29 15:55:06' ,'peter', 'CLI:000000000000000000000000000000000004', 'otherEntryPoint', 'EXTERNAL', 'DOMAIN_A', 'L10002', 'ZDF-Leistungsfall', '', '', 4, 'P3D', 'DOCUMENT', 'custom1' ,'custom2' , 'custom3' ,'custom4', 'custom5','custom6', 'custom7','custom8', '{"changes":[{"newValue":"CHI:000000000000000000000000000000000000","fieldName":"id","oldValue":""}]}' ),
|
||||||
|
('CHI:000000000000000000000000000000000007','UPDATED' ,'2018-01-29 15:55:07' ,'peter', 'CLI:000000000000000000000000000000000004', '', 'EXTERNAL', 'DOMAIN_A', 'L10002', 'ZDF-Leistungsfall', 'otherParentId', 'otherParentKey', 4, 'P3D', 'DOCUMENT', 'otherCustom1' ,'otherCustom2' , 'otherCustom3' ,'otherCustom4', 'otherCustom5','otherCustom6', 'otherCustom7','otherCustom8', '{"changes":[{"newValue":"CHI:000000000000000000000000000000000000","fieldName":"id","oldValue":""}]}' ),
|
||||||
|
('CHI:000000000000000000000000000000000008','CREATED' ,'2018-01-29 15:55:08' ,'claudia', 'CLI:000000000000000000000000000000000005', '', 'MANUAL', 'DOMAIN_A', 'L10003', 'POK-Leistungsfall', '', '', 5, 'P1D', 'TASK', 'custom1' ,'custom2' , 'custom3' ,'custom4', 'custom5','custom6', 'custom7','custom8', '{"changes":[{"newValue":"CHI:000000000000000000000000000000000000","fieldName":"id","oldValue":""}]}' ),
|
||||||
|
('CHI:000000000000000000000000000000000009','UPDATED' ,'2018-01-29 15:55:09' ,'peter', 'CLI:000000000000000000000000000000000005', '', 'MANUAL', 'DOMAIN_A', 'L10003', 'POK-Leistungsfall', '', '', 5, 'P1D', 'TASK', 'otherCustom1' ,'otherCustom2' , 'otherCustom3' ,'otherCustom4', 'otherCustom5','otherCustom6', 'otherCustom7','otherCustom8', '{"changes":[{"newValue":"CHI:000000000000000000000000000000000000","fieldName":"id","oldValue":""}]}' ),
|
||||||
|
('CHI:000000000000000000000000000000000010','CREATED' ,'2018-01-29 15:55:10' ,'admin', 'CLI:000000000000000000000000000000000006', '', 'MANUAL', 'DOMAIN_A', 'L10005', 'LAX-Leistungsfall', '', '', 1, 'P4D', 'TASK', 'custom1' ,'custom2' , 'custom3' ,'custom4', 'custom5','custom6', 'custom7','custom8', '{"changes":[{"newValue":"CHI:000000000000000000000000000000000000","fieldName":"id","oldValue":""}]}' );
|
||||||
Loading…
Reference in New Issue