entityClass, String attributeName, Object attributeValue) {
+ var criteriaBuilder = entityManager.getCriteriaBuilder();
+
+ var delete = criteriaBuilder.createCriteriaDelete(entityClass);
+ var from = delete.from(entityClass);
+
+ delete.where(criteriaBuilder.equal(from.get(attributeName), attributeValue));
+
+ entityManager.createQuery(delete).executeUpdate();
+ }
+
+ void remove(
+ Class entityClass,
+ String attributeName,
+ Class parentClass,
+ String parentIdAttribute,
+ String parentAttributeName,
+ Object parentAttributeValue
+ ) {
+ var criteriaBuilder = entityManager.getCriteriaBuilder();
+
+ var parentQuery = criteriaBuilder.createQuery(Object.class);
+ var parentFrom = parentQuery.from(parentClass);
+ parentQuery.select(parentFrom.get(parentIdAttribute));
+ parentQuery.where(criteriaBuilder.equal(parentFrom.get(parentAttributeName), parentAttributeValue));
+
+ var parentIds = entityManager.createQuery(parentQuery).getResultList();
+
+ if (!parentIds.isEmpty()) {
+ var delete = criteriaBuilder.createCriteriaDelete(entityClass);
+ var from = delete.from(entityClass);
+
+ delete.where(from.get(attributeName).in(parentIds));
+
+ entityManager.createQuery(delete).executeUpdate();
+ }
+ }
+
+ @Override
+ public String getHandledEvent() {
+ return ProcessRuntimeEvent.ProcessEvents.PROCESS_DELETED.name();
+ }
+}
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessDeployedEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessDeployedEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessDeployedEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessDeployedEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessResumedEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessResumedEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessResumedEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessResumedEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessStartedEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessStartedEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessStartedEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessStartedEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessSuspendedEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessSuspendedEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessSuspendedEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessSuspendedEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessUpdatedEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessUpdatedEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessUpdatedEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessUpdatedEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessVariableCreatedEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessVariableCreatedEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessVariableCreatedEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessVariableCreatedEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessVariableDeletedEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessVariableDeletedEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessVariableDeletedEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessVariableDeletedEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessVariableUpdateEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessVariableUpdateEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessVariableUpdateEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessVariableUpdateEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessVariableUpdater.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessVariableUpdater.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessVariableUpdater.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/ProcessVariableUpdater.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/QueryEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/QueryEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/QueryEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/QueryEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/QueryEventHandlerContext.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/QueryEventHandlerContext.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/QueryEventHandlerContext.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/QueryEventHandlerContext.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/QueryEventHandlerContextOptimizer.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/QueryEventHandlerContextOptimizer.java
similarity index 71%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/QueryEventHandlerContextOptimizer.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/QueryEventHandlerContextOptimizer.java
index 8361afc87cb..f4b9addab74 100644
--- a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/QueryEventHandlerContextOptimizer.java
+++ b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/QueryEventHandlerContextOptimizer.java
@@ -18,13 +18,18 @@
import jakarta.persistence.AttributeNode;
import jakarta.persistence.EntityGraph;
import jakarta.persistence.EntityManager;
+import jakarta.persistence.criteria.Join;
+import jakarta.persistence.criteria.Root;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
+import org.activiti.api.model.shared.model.VariableInstance;
+import org.activiti.api.task.model.Task;
import org.activiti.cloud.api.model.shared.events.CloudRuntimeEvent;
import org.activiti.cloud.api.model.shared.events.CloudVariableEvent;
import org.activiti.cloud.api.model.shared.impl.events.CloudVariableCreatedEventImpl;
@@ -45,6 +50,7 @@
import org.activiti.cloud.api.process.model.impl.events.CloudProcessCandidateStarterUserRemovedEventImpl;
import org.activiti.cloud.api.process.model.impl.events.CloudProcessCompletedEventImpl;
import org.activiti.cloud.api.process.model.impl.events.CloudProcessCreatedEventImpl;
+import org.activiti.cloud.api.process.model.impl.events.CloudProcessDeletedEventImpl;
import org.activiti.cloud.api.process.model.impl.events.CloudProcessStartedEventImpl;
import org.activiti.cloud.api.process.model.impl.events.CloudProcessSuspendedEventImpl;
import org.activiti.cloud.api.process.model.impl.events.CloudProcessUpdatedEventImpl;
@@ -61,6 +67,7 @@
import org.activiti.cloud.api.task.model.impl.events.CloudTaskCreatedEventImpl;
import org.activiti.cloud.api.task.model.impl.events.CloudTaskSuspendedEventImpl;
import org.activiti.cloud.api.task.model.impl.events.CloudTaskUpdatedEventImpl;
+import org.activiti.cloud.services.query.model.BPMNActivityEntity;
import org.activiti.cloud.services.query.model.ProcessInstanceEntity;
import org.hibernate.jpa.AvailableHints;
import org.slf4j.Logger;
@@ -108,7 +115,8 @@ public class QueryEventHandlerContextOptimizer {
Map.entry(CloudProcessCandidateStarterUserAddedEventImpl.class, 17),
Map.entry(CloudProcessCandidateStarterGroupAddedEventImpl.class, 17),
Map.entry(CloudProcessCandidateStarterUserRemovedEventImpl.class, 18),
- Map.entry(CloudProcessCandidateStarterGroupRemovedEventImpl.class, 18)
+ Map.entry(CloudProcessCandidateStarterGroupRemovedEventImpl.class, 18),
+ Map.entry(CloudProcessDeletedEventImpl.class, 19)
);
private Comparator> byTimestamp = Comparator.comparingLong(CloudRuntimeEvent::getTimestamp);
@@ -125,25 +133,51 @@ public QueryEventHandlerContextOptimizer(EntityManager entityManager) {
resolveProcessInstanceId(events)
.ifPresent(processInstanceId -> {
LOGGER.debug("Building entity fetch graph for root process instance: {}", processInstanceId);
- EntityGraph entityGraph = entityManager.createEntityGraph(
- ProcessInstanceEntity.class
- );
-
- findRuntimeEvent(events, CloudVariableEvent.class)
- .ifPresent(e -> entityGraph.addAttributeNodes(VARIABLES));
- findRuntimeEvent(events, CloudTaskRuntimeEvent.class)
- .ifPresent(e -> entityGraph.addAttributeNodes(TASKS));
- findRuntimeEvent(events, CloudBPMNActivityEvent.class)
- .ifPresent(e -> entityGraph.addAttributeNodes(ACTIVITIES, SERVICE_TASKS));
-
- Optional
- .ofNullable(
- entityManager.find(
- ProcessInstanceEntity.class,
- processInstanceId,
- Map.of(AvailableHints.HINT_SPEC_LOAD_GRAPH, entityGraph)
- )
- )
+ var entityGraph = entityManager.createEntityGraph(ProcessInstanceEntity.class);
+
+ var criteriaBuilder = entityManager.getCriteriaBuilder();
+ var criteriaQuery = criteriaBuilder.createQuery(ProcessInstanceEntity.class);
+ var fromProcessInstance = criteriaQuery.from(ProcessInstanceEntity.class);
+ var whereProcessInstance = criteriaBuilder.equal(fromProcessInstance.get("id"), processInstanceId);
+
+ criteriaQuery.select(fromProcessInstance).where(whereProcessInstance);
+
+ findRuntimeEvents(events, CloudVariableEvent.class, entity -> true, VariableInstance::getName)
+ .ifPresent(variableNames -> {
+ fetch(fromProcessInstance, entityGraph, VARIABLES, "name", variableNames);
+ });
+
+ findRuntimeEvents(events, CloudTaskRuntimeEvent.class, entity -> true, Task::getId)
+ .ifPresent(taskIds -> {
+ fetch(fromProcessInstance, entityGraph, TASKS, "id", taskIds);
+ });
+
+ findRuntimeEvents(
+ events,
+ CloudBPMNActivityEvent.class,
+ entity -> true,
+ BPMNActivityEntity.IdBuilderHelper::from
+ )
+ .ifPresent(activityIds -> {
+ fetch(fromProcessInstance, entityGraph, ACTIVITIES, "id", activityIds);
+ });
+
+ findRuntimeEvents(
+ events,
+ CloudBPMNActivityEvent.class,
+ entity -> SERVICE_TASKS.equals(entity.getActivityType()),
+ BPMNActivityEntity.IdBuilderHelper::from
+ )
+ .ifPresent(serviceTaskIds -> {
+ fetch(fromProcessInstance, entityGraph, SERVICE_TASKS, "id", serviceTaskIds);
+ });
+
+ entityManager
+ .createQuery(criteriaQuery)
+ .setHint(AvailableHints.HINT_SPEC_LOAD_GRAPH, entityGraph)
+ .getResultList()
+ .stream()
+ .findFirst()
.ifPresent(rootProcessInstance -> {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
@@ -173,17 +207,36 @@ protected Optional resolveProcessInstanceId(List
return events.stream().filter(runtimeEventClass::isInstance).findFirst();
}
- protected Optional findRuntimeEvent(
+ protected Optional> findRuntimeEvents(
List> events,
Class extends CloudRuntimeEvent> runtimeEventClass,
- Predicate predicate
+ Predicate predicate,
+ Function mapper
+ ) {
+ return Optional
+ .of(
+ events
+ .stream()
+ .filter(runtimeEventClass::isInstance)
+ .map(runtimeEventClass::cast)
+ .map(CloudRuntimeEvent::getEntity)
+ .filter(predicate)
+ .map(mapper)
+ .distinct()
+ .toList()
+ )
+ .filter(Predicate.not(List::isEmpty));
+ }
+
+ protected void fetch(
+ Root from,
+ EntityGraph entityGraph,
+ String association,
+ String attribute,
+ List ids
) {
- return events
- .stream()
- .filter(runtimeEventClass::isInstance)
- .map(runtimeEventClass::cast)
- .map(CloudRuntimeEvent::getEntity)
- .filter(predicate)
- .findFirst();
+ entityGraph.addAttributeNodes(association);
+ var join = (Join, ?>) from.fetch(association);
+ join.on(join.get(attribute).in(ids));
}
}
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskActivatedEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskActivatedEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskActivatedEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskActivatedEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskAssignedEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskAssignedEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskAssignedEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskAssignedEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCancelledEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCancelledEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCancelledEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCancelledEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCandidateGroupAddedEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCandidateGroupAddedEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCandidateGroupAddedEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCandidateGroupAddedEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCandidateGroupRemovedEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCandidateGroupRemovedEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCandidateGroupRemovedEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCandidateGroupRemovedEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCandidateUserAddedEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCandidateUserAddedEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCandidateUserAddedEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCandidateUserAddedEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCandidateUserRemovedEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCandidateUserRemovedEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCandidateUserRemovedEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCandidateUserRemovedEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCompletedEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCompletedEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCompletedEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCompletedEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCreatedEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCreatedEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCreatedEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskCreatedEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskSuspendedEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskSuspendedEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskSuspendedEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskSuspendedEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskUpdatedEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskUpdatedEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskUpdatedEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskUpdatedEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskVariableCreatedEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskVariableCreatedEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskVariableCreatedEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskVariableCreatedEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskVariableDeletedEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskVariableDeletedEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskVariableDeletedEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskVariableDeletedEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskVariableUpdatedEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskVariableUpdatedEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskVariableUpdatedEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskVariableUpdatedEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskVariableUpdater.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskVariableUpdater.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskVariableUpdater.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/TaskVariableUpdater.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/VariableCreatedEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/VariableCreatedEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/VariableCreatedEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/VariableCreatedEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/VariableDeletedEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/VariableDeletedEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/VariableDeletedEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/VariableDeletedEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/VariableUpdatedEventHandler.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/VariableUpdatedEventHandler.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/main/java/org/activiti/cloud/services/query/events/handlers/VariableUpdatedEventHandler.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/java/org/activiti/cloud/services/query/events/handlers/VariableUpdatedEventHandler.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 00000000000..3fdae482fb2
--- /dev/null
+++ b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+org.activiti.cloud.services.query.events.config.EventHandlersAutoConfiguration
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/test/java/org/activiti/cloud/services/query/events/handlers/EntityManagerFinderTest.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/test/java/org/activiti/cloud/services/query/events/handlers/EntityManagerFinderTest.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/test/java/org/activiti/cloud/services/query/events/handlers/EntityManagerFinderTest.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/test/java/org/activiti/cloud/services/query/events/handlers/EntityManagerFinderTest.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/test/java/org/activiti/cloud/services/query/events/handlers/ProcessCandidateStarterGroupAddedEventHandlerTest.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/test/java/org/activiti/cloud/services/query/events/handlers/ProcessCandidateStarterGroupAddedEventHandlerTest.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/test/java/org/activiti/cloud/services/query/events/handlers/ProcessCandidateStarterGroupAddedEventHandlerTest.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/test/java/org/activiti/cloud/services/query/events/handlers/ProcessCandidateStarterGroupAddedEventHandlerTest.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/test/java/org/activiti/cloud/services/query/QueryConsumerChannelHandlerTest.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/test/java/org/activiti/cloud/services/query/events/handlers/QueryConsumerChannelHandlerTest.java
similarity index 92%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/test/java/org/activiti/cloud/services/query/QueryConsumerChannelHandlerTest.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/test/java/org/activiti/cloud/services/query/events/handlers/QueryConsumerChannelHandlerTest.java
index 926512270b1..a2bfc83665a 100644
--- a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/test/java/org/activiti/cloud/services/query/QueryConsumerChannelHandlerTest.java
+++ b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/test/java/org/activiti/cloud/services/query/events/handlers/QueryConsumerChannelHandlerTest.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activiti.cloud.services.query;
+package org.activiti.cloud.services.query.events.handlers;
import static java.util.Arrays.asList;
import static org.mockito.Mockito.verify;
@@ -25,8 +25,6 @@
import org.activiti.cloud.api.process.model.impl.events.CloudProcessCreatedEventImpl;
import org.activiti.cloud.api.process.model.impl.events.CloudProcessStartedEventImpl;
import org.activiti.cloud.services.query.app.QueryConsumerChannelHandler;
-import org.activiti.cloud.services.query.events.handlers.QueryEventHandlerContext;
-import org.activiti.cloud.services.query.events.handlers.QueryEventHandlerContextOptimizer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/test/java/org/activiti/cloud/services/query/events/handlers/TaskBuilder.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/test/java/org/activiti/cloud/services/query/events/handlers/TaskBuilder.java
new file mode 100644
index 00000000000..3ca93a312f1
--- /dev/null
+++ b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/test/java/org/activiti/cloud/services/query/events/handlers/TaskBuilder.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2017-2020 Alfresco Software, Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.activiti.cloud.services.query.events.handlers;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.Date;
+import java.util.List;
+import org.activiti.cloud.services.query.model.TaskEntity;
+
+public class TaskBuilder {
+
+ private TaskEntity taskEntity;
+
+ private TaskBuilder() {
+ this.taskEntity = mock(TaskEntity.class);
+ }
+
+ public static TaskBuilder aTask() {
+ return new TaskBuilder();
+ }
+
+ public TaskBuilder withId(String taskId) {
+ when(taskEntity.getId()).thenReturn(taskId);
+ return this;
+ }
+
+ public TaskBuilder withName(String name) {
+ when(taskEntity.getName()).thenReturn(name);
+ return this;
+ }
+
+ public TaskBuilder withDescription(String description) {
+ when(taskEntity.getDescription()).thenReturn(description);
+ return this;
+ }
+
+ public TaskBuilder withPriority(Integer priority) {
+ when(taskEntity.getPriority()).thenReturn(priority);
+ return this;
+ }
+
+ public TaskBuilder withDueDate(Date dueDate) {
+ when(taskEntity.getDueDate()).thenReturn(dueDate);
+ return this;
+ }
+
+ public TaskBuilder withFormKey(String formKey) {
+ when(taskEntity.getFormKey()).thenReturn(formKey);
+ return this;
+ }
+
+ public TaskBuilder withParentTaskId(String parentTaskId) {
+ when(taskEntity.getParentTaskId()).thenReturn(parentTaskId);
+ return this;
+ }
+
+ public TaskBuilder withAssignee(String assignee) {
+ when(taskEntity.getAssignee()).thenReturn(assignee);
+ return this;
+ }
+
+ public TaskBuilder withCreatedDate(Date createdDate) {
+ when(taskEntity.getCreatedDate()).thenReturn(createdDate);
+ return this;
+ }
+
+ public TaskBuilder withCompletedDate(Date completedDate) {
+ when(taskEntity.getCompletedDate()).thenReturn(completedDate);
+ return this;
+ }
+
+ public TaskBuilder withCandidateUsers(List candidateUsers) {
+ when(taskEntity.getCandidateUsers()).thenReturn(candidateUsers);
+ return this;
+ }
+
+ public TaskBuilder withCandidateGroups(List candidateGroups) {
+ when(taskEntity.getCandidateGroups()).thenReturn(candidateGroups);
+ return this;
+ }
+
+ public TaskBuilder withOwner(String owner) {
+ when(taskEntity.getOwner()).thenReturn(owner);
+ return this;
+ }
+
+ public TaskEntity build() {
+ return taskEntity;
+ }
+}
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/test/java/org/activiti/cloud/services/query/events/handlers/VariableEntityCreatedEventHandlerTest.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/test/java/org/activiti/cloud/services/query/events/handlers/VariableEntityCreatedEventHandlerTest.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/test/java/org/activiti/cloud/services/query/events/handlers/VariableEntityCreatedEventHandlerTest.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/test/java/org/activiti/cloud/services/query/events/handlers/VariableEntityCreatedEventHandlerTest.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/test/java/org/activiti/cloud/services/query/events/handlers/VariableEntityUpdaterTest.java b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/test/java/org/activiti/cloud/services/query/events/handlers/VariableEntityUpdaterTest.java
similarity index 100%
rename from activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-rest/src/test/java/org/activiti/cloud/services/query/events/handlers/VariableEntityUpdaterTest.java
rename to activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/test/java/org/activiti/cloud/services/query/events/handlers/VariableEntityUpdaterTest.java
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/test/resources/logback-test.xml b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/test/resources/logback-test.xml
new file mode 100644
index 00000000000..e1f95399f50
--- /dev/null
+++ b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-events/src/test/resources/logback-test.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/pom.xml b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/pom.xml
index 212c3004bc8..5ec89bd62ad 100644
--- a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/pom.xml
+++ b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/pom.xml
@@ -3,7 +3,7 @@
org.activiti.cloud
activiti-cloud-services-query
- 8.6.0-SNAPSHOT
+ 8.7.0-SNAPSHOT
activiti-cloud-services-query-liquibase
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/23-alter.oracle.schema.8.6.0.sql b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/23-alter.oracle.schema.8.6.0.sql
new file mode 100644
index 00000000000..0b2e7065170
--- /dev/null
+++ b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/23-alter.oracle.schema.8.6.0.sql
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2017-2020 Alfresco Software, Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+CREATE INDEX CONCURRENTLY IF NOT EXISTS task_process_variable_task_id_idx ON task_process_variable (task_id);
+CREATE INDEX CONCURRENTLY IF NOT EXISTS task_process_variable_process_variable_id_idx ON task_process_variable (process_variable_id);
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/23-alter.pg.schema.8.6.0.sql b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/23-alter.pg.schema.8.6.0.sql
new file mode 100644
index 00000000000..0b2e7065170
--- /dev/null
+++ b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/23-alter.pg.schema.8.6.0.sql
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2017-2020 Alfresco Software, Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+CREATE INDEX CONCURRENTLY IF NOT EXISTS task_process_variable_task_id_idx ON task_process_variable (task_id);
+CREATE INDEX CONCURRENTLY IF NOT EXISTS task_process_variable_process_variable_id_idx ON task_process_variable (process_variable_id);
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/24-alter.oracle.schema.8.7.0.sql b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/24-alter.oracle.schema.8.7.0.sql
new file mode 100644
index 00000000000..d10f663f078
--- /dev/null
+++ b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/24-alter.oracle.schema.8.7.0.sql
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2017-2020 Alfresco Software, Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ALTER TABLE process_variable ADD (temp_value JSON);
+UPDATE process_variable SET temp_value = value WHERE true;
+ALTER TABLE process_variable DROP COLUMN value;
+ALTER TABLE process_variable RENAME COLUMN temp_value TO value;
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/24-alter.pg.schema.8.7.0.sql b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/24-alter.pg.schema.8.7.0.sql
new file mode 100644
index 00000000000..08adf2c4755
--- /dev/null
+++ b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/24-alter.pg.schema.8.7.0.sql
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2017-2020 Alfresco Software, Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ALTER TABLE process_variable
+ALTER COLUMN "value" TYPE jsonb USING "value"::jsonb;
+
+ALTER TABLE task_variable
+ALTER COLUMN "value" TYPE jsonb USING "value"::jsonb;
+
+CREATE INDEX process_variable_value_idx ON process_variable USING GIN ((value -> 'value') jsonb_path_ops);
+CREATE INDEX process_definition_key_name_value_idx ON process_variable (process_definition_key,name);
+
+CREATE INDEX task_variable_value_idx ON task_variable USING GIN ((value -> 'value') jsonb_path_ops);
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/25-alter.oracle.schema.8.7.0.sql b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/25-alter.oracle.schema.8.7.0.sql
new file mode 100644
index 00000000000..d37aa6b28fb
--- /dev/null
+++ b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/25-alter.oracle.schema.8.7.0.sql
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2017-2020 Alfresco Software, Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+create index if not exists idx_task_assignee on task(assignee);
+create index if not exists idx_task_owner on task(owner);
+create index if not exists idx_process_instance_initiator on process_instance(initiator);
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/25-alter.pg.schema.8.7.0.sql b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/25-alter.pg.schema.8.7.0.sql
new file mode 100644
index 00000000000..d37aa6b28fb
--- /dev/null
+++ b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/25-alter.pg.schema.8.7.0.sql
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2017-2020 Alfresco Software, Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+create index if not exists idx_task_assignee on task(assignee);
+create index if not exists idx_task_owner on task(owner);
+create index if not exists idx_process_instance_initiator on process_instance(initiator);
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/26-alter.oracle.schema.8.7.0.sql b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/26-alter.oracle.schema.8.7.0.sql
new file mode 100644
index 00000000000..97bf0ed584e
--- /dev/null
+++ b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/26-alter.oracle.schema.8.7.0.sql
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2017-2020 Alfresco Software, Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ALTER TABLE process_definition
+ MODIFY description varchar(4000);
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/26-alter.pg.schema.8.7.0.sql b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/26-alter.pg.schema.8.7.0.sql
new file mode 100644
index 00000000000..e9d844d1467
--- /dev/null
+++ b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/26-alter.pg.schema.8.7.0.sql
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2017-2020 Alfresco Software, Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ALTER TABLE process_definition
+ ALTER COLUMN description TYPE varchar(4000);
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/27-alter.oracle.schema.8.7.0.sql b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/27-alter.oracle.schema.8.7.0.sql
new file mode 100644
index 00000000000..0c6a16040ea
--- /dev/null
+++ b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/27-alter.oracle.schema.8.7.0.sql
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2017-2020 Alfresco Software, Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+CREATE INDEX idx_task_process_var_taskId_processVarId ON task_process_variable (task_id, process_variable_id);
+CREATE INDEX idx_task_createdDate ON task (created_date);
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/27-alter.pg.schema.8.7.0.sql b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/27-alter.pg.schema.8.7.0.sql
new file mode 100644
index 00000000000..0c6a16040ea
--- /dev/null
+++ b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/27-alter.pg.schema.8.7.0.sql
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2017-2020 Alfresco Software, Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+CREATE INDEX idx_task_process_var_taskId_processVarId ON task_process_variable (task_id, process_variable_id);
+CREATE INDEX idx_task_createdDate ON task (created_date);
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/h2.schema.sql b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/h2.schema.sql
index dee80ebb289..11f3c072876 100644
--- a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/h2.schema.sql
+++ b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/h2.schema.sql
@@ -60,7 +60,7 @@ create table process_definition
service_name varchar(255),
service_type varchar(255),
service_version varchar(255),
- description varchar(255),
+ description varchar(4000),
form_key varchar(255),
process_definition_key varchar(255),
name varchar(255),
@@ -118,7 +118,7 @@ create table process_variable
name varchar(255),
process_instance_id varchar(255),
type varchar(255),
- "value" text,
+ "value" json,
variable_definition_id varchar(64),
process_definition_key varchar(255),
primary key (id)
@@ -191,7 +191,7 @@ create table task_variable
name varchar(255),
process_instance_id varchar(255),
type varchar(255),
- "value" text,
+ "value" json,
task_id varchar(255),
primary key (id)
);
@@ -309,3 +309,8 @@ alter table task_process_variable
add constraint fk_process_variable_id foreign key (process_variable_id) references process_variable;
alter table task_process_variable
add constraint uk_task_process_var unique (task_id, process_variable_id);
+create index idx_task_assignee on task(assignee);
+create index idx_task_owner on task(owner);
+create index idx_process_instance_initiator on process_instance(initiator);
+CREATE INDEX idx_task_process_var_taskId_processVarId ON task_process_variable (task_id, process_variable_id);
+CREATE INDEX idx_task_createdDate ON task (created_date);
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/oracle.schema.sql b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/oracle.schema.sql
index 4ee9b0e5614..14186edc856 100644
--- a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/oracle.schema.sql
+++ b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/changelog/oracle.schema.sql
@@ -109,7 +109,7 @@ create table process_variable
name varchar(255),
process_instance_id varchar(255),
type varchar(255),
- value CLOB,
+ value json,
primary key (id)
);
create table task
@@ -178,7 +178,7 @@ create table task_variable
name varchar(255),
process_instance_id varchar(255),
type varchar(255),
- value CLOB,
+ value json,
task_id varchar(255),
primary key (id)
);
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/master.xml b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/master.xml
index 7e553c35825..7836cf474fa 100644
--- a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/master.xml
+++ b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-liquibase/src/main/resources/config/query/liquibase/master.xml
@@ -462,4 +462,110 @@
stripComments="true"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-model/pom.xml b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-model/pom.xml
index 65283826aa5..fe49dd00954 100644
--- a/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-model/pom.xml
+++ b/activiti-cloud-query-service/activiti-cloud-services-query/activiti-cloud-services-query-model/pom.xml
@@ -5,7 +5,7 @@
org.activiti.cloud
activiti-cloud-services-query
- 8.6.0-SNAPSHOT
+ 8.7.0-SNAPSHOT
activiti-cloud-services-query-model
Activiti Cloud Query :: Services :: Query Model
@@ -108,16 +108,16 @@
json-unit-fluent
test