{
*/
TaskQuery taskCandidateGroupExpression(String candidateGroupExpression);
+ /**
+ * Only select tasks whose candidate users belong to groups matching the given parameter.
+ * The syntax is that of SQL: for example usage: nameLike(%operaton%)
+ *
+ *
+ * Per default it only selects tasks which are not already assigned
+ * to a user. To also include assigned task in the result specify
+ * {@link #includeAssignedTasks()} in your query.
+ *
+ *
+ * @throws ProcessEngineException - When query is executed and {@link #taskCandidateUser(String)} or
+ * {@link #taskCandidateUserExpression(String)} (List)} has been executed on the
+ * "and query" instance.
+ * No exception is thrown when query is executed and {@link #taskCandidateUser(String)} or
+ * {@link #taskCandidateUserExpression(String)} has been executed on the "or query" instance.
+ * - When passed group is
null
.
+ */
+ TaskQuery taskCandidateGroupLike(String candidateGroupLike);
+
/**
* Only select tasks for which the 'candidateGroup' is one of the given groups.
*
@@ -1104,4 +1123,11 @@ public interface TaskQuery extends Query {
* this exception, {@link #or()} must be invoked first.
*/
TaskQuery endOr();
+
+ /**
+ * Evaluates existence of attachment and comments associated with the task, defaults to false.
+ * Adding the filter will do additional attachment and comments queries to the database,
+ * it might slow down the query in case of tables having high volume of data.
+ */
+ TaskQuery withCommentAttachmentInfo();
}
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.db2.create.engine.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.db2.create.engine.sql
index b3989a1857c..c007171ede6 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.db2.create.engine.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.db2.create.engine.sql
@@ -130,6 +130,7 @@ create table ACT_RU_JOB (
TENANT_ID_ varchar(64),
CREATE_TIME_ timestamp,
LAST_FAILURE_LOG_ID_ varchar(64),
+ BATCH_ID_ varchar(64),
primary key (ID_)
);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.db2.create.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.db2.create.history.sql
index f4008b1d6ef..29445d439dc 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.db2.create.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.db2.create.history.sql
@@ -35,6 +35,7 @@ create table ACT_HI_PROCINST (
DELETE_REASON_ varchar(4000),
TENANT_ID_ varchar(64),
STATE_ varchar(255),
+ RESTARTED_PROC_INST_ID_ varchar(64),
primary key (ID_)
);
@@ -288,6 +289,7 @@ create table ACT_HI_JOB_LOG (
TENANT_ID_ varchar(64),
HOSTNAME_ varchar(255),
REMOVAL_TIME_ timestamp,
+ BATCH_ID_ varchar(64),
primary key (ID_)
);
@@ -340,6 +342,7 @@ create index ACT_IDX_HI_PRO_INST_PROC_TIME on ACT_HI_PROCINST(START_TIME_, END_T
create index ACT_IDX_HI_PI_PDEFID_END_TIME on ACT_HI_PROCINST(PROC_DEF_ID_, END_TIME_);
create index ACT_IDX_HI_PRO_INST_ROOT_PI on ACT_HI_PROCINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_PRO_INST_RM_TIME on ACT_HI_PROCINST(REMOVAL_TIME_);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
create index ACT_IDX_HI_ACTINST_ROOT_PI on ACT_HI_ACTINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_ACT_INST_START_END on ACT_HI_ACTINST(START_TIME_, END_TIME_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.h2.create.engine.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.h2.create.engine.sql
index 7c7c64ea59a..1af710fbdfc 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.h2.create.engine.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.h2.create.engine.sql
@@ -130,6 +130,7 @@ create table ACT_RU_JOB (
TENANT_ID_ varchar(64),
CREATE_TIME_ timestamp,
LAST_FAILURE_LOG_ID_ varchar(64),
+ BATCH_ID_ varchar(64),
primary key (ID_)
);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.h2.create.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.h2.create.history.sql
index 52a04fde94c..1edf441710d 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.h2.create.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.h2.create.history.sql
@@ -35,6 +35,7 @@ create table ACT_HI_PROCINST (
DELETE_REASON_ varchar(4000),
TENANT_ID_ varchar(64),
STATE_ varchar(255),
+ RESTARTED_PROC_INST_ID_ varchar(64),
primary key (ID_),
unique (PROC_INST_ID_)
);
@@ -287,6 +288,7 @@ create table ACT_HI_JOB_LOG (
TENANT_ID_ varchar(64),
HOSTNAME_ varchar(255),
REMOVAL_TIME_ timestamp,
+ BATCH_ID_ varchar(64),
primary key (ID_)
);
@@ -339,6 +341,7 @@ create index ACT_IDX_HI_PRO_INST_PROC_TIME on ACT_HI_PROCINST(START_TIME_, END_T
create index ACT_IDX_HI_PI_PDEFID_END_TIME on ACT_HI_PROCINST(PROC_DEF_ID_, END_TIME_);
create index ACT_IDX_HI_PRO_INST_ROOT_PI on ACT_HI_PROCINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_PRO_INST_RM_TIME on ACT_HI_PROCINST(REMOVAL_TIME_);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
create index ACT_IDX_HI_ACTINST_ROOT_PI on ACT_HI_ACTINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_ACT_INST_START_END on ACT_HI_ACTINST(START_TIME_, END_TIME_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mariadb.create.engine.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mariadb.create.engine.sql
index 522ae0e1c5a..f24ca14d222 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mariadb.create.engine.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mariadb.create.engine.sql
@@ -130,6 +130,7 @@ create table ACT_RU_JOB (
TENANT_ID_ varchar(64),
CREATE_TIME_ datetime(3),
LAST_FAILURE_LOG_ID_ varchar(64),
+ BATCH_ID_ varchar(64),
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mariadb.create.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mariadb.create.history.sql
index 01a1cc72d12..228b264ff75 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mariadb.create.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mariadb.create.history.sql
@@ -35,6 +35,7 @@ create table ACT_HI_PROCINST (
DELETE_REASON_ varchar(4000),
TENANT_ID_ varchar(64),
STATE_ varchar(255),
+ RESTARTED_PROC_INST_ID_ varchar(64),
primary key (ID_),
unique (PROC_INST_ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
@@ -287,6 +288,7 @@ create table ACT_HI_JOB_LOG (
TENANT_ID_ varchar(64),
HOSTNAME_ varchar(255),
REMOVAL_TIME_ datetime(3),
+ BATCH_ID_ varchar(64),
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
@@ -339,6 +341,7 @@ create index ACT_IDX_HI_PRO_INST_PROC_TIME on ACT_HI_PROCINST(START_TIME_, END_T
create index ACT_IDX_HI_PI_PDEFID_END_TIME on ACT_HI_PROCINST(PROC_DEF_ID_, END_TIME_);
create index ACT_IDX_HI_PRO_INST_ROOT_PI on ACT_HI_PROCINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_PRO_INST_RM_TIME on ACT_HI_PROCINST(REMOVAL_TIME_);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
create index ACT_IDX_HI_ACTINST_ROOT_PI on ACT_HI_ACTINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_ACT_INST_START_END on ACT_HI_ACTINST(START_TIME_, END_TIME_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mssql.create.engine.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mssql.create.engine.sql
index f214c3a2547..4a2abbe0a20 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mssql.create.engine.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mssql.create.engine.sql
@@ -130,6 +130,7 @@ create table ACT_RU_JOB (
TENANT_ID_ nvarchar(64),
CREATE_TIME_ datetime2,
LAST_FAILURE_LOG_ID_ nvarchar(64),
+ BATCH_ID_ nvarchar(64),
primary key (ID_)
);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mssql.create.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mssql.create.history.sql
index d6b3f9a6d06..076516d4c12 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mssql.create.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mssql.create.history.sql
@@ -35,6 +35,7 @@ create table ACT_HI_PROCINST (
DELETE_REASON_ nvarchar(4000),
TENANT_ID_ nvarchar(64),
STATE_ nvarchar(255),
+ RESTARTED_PROC_INST_ID_ nvarchar(64),
primary key (ID_),
unique (PROC_INST_ID_)
);
@@ -286,6 +287,7 @@ create table ACT_HI_JOB_LOG (
TENANT_ID_ nvarchar(64),
HOSTNAME_ nvarchar(255),
REMOVAL_TIME_ datetime2,
+ BATCH_ID_ nvarchar(64),
primary key (ID_)
);
@@ -338,6 +340,7 @@ create index ACT_IDX_HI_PRO_INST_PROC_TIME on ACT_HI_PROCINST(START_TIME_, END_T
create index ACT_IDX_HI_PI_PDEFID_END_TIME on ACT_HI_PROCINST(PROC_DEF_ID_, END_TIME_);
create index ACT_IDX_HI_PRO_INST_ROOT_PI on ACT_HI_PROCINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_PRO_INST_RM_TIME on ACT_HI_PROCINST(REMOVAL_TIME_);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
create index ACT_IDX_HI_ACTINST_ROOT_PI on ACT_HI_ACTINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_ACT_INST_START_END on ACT_HI_ACTINST(START_TIME_, END_TIME_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mysql.create.engine.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mysql.create.engine.sql
index 49a5962aea2..4d60e888494 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mysql.create.engine.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mysql.create.engine.sql
@@ -130,6 +130,7 @@ create table ACT_RU_JOB (
TENANT_ID_ varchar(64),
CREATE_TIME_ datetime,
LAST_FAILURE_LOG_ID_ varchar(64),
+ BATCH_ID_ varchar(64),
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mysql.create.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mysql.create.history.sql
index 478f30ea48a..4559ad612b8 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mysql.create.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mysql.create.history.sql
@@ -35,6 +35,7 @@ create table ACT_HI_PROCINST (
DELETE_REASON_ varchar(4000),
TENANT_ID_ varchar(64),
STATE_ varchar(255),
+ RESTARTED_PROC_INST_ID_ varchar(64),
primary key (ID_),
unique (PROC_INST_ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
@@ -287,6 +288,7 @@ create table ACT_HI_JOB_LOG (
TENANT_ID_ varchar(64),
HOSTNAME_ varchar(255),
REMOVAL_TIME_ datetime,
+ BATCH_ID_ varchar(64),
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
@@ -340,6 +342,7 @@ create index ACT_IDX_HI_PRO_INST_PROC_TIME on ACT_HI_PROCINST(START_TIME_, END_T
create index ACT_IDX_HI_PI_PDEFID_END_TIME on ACT_HI_PROCINST(PROC_DEF_ID_, END_TIME_);
create index ACT_IDX_HI_PRO_INST_ROOT_PI on ACT_HI_PROCINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_PRO_INST_RM_TIME on ACT_HI_PROCINST(REMOVAL_TIME_);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
create index ACT_IDX_HI_ACTINST_ROOT_PI on ACT_HI_ACTINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_ACT_INST_START_END on ACT_HI_ACTINST(START_TIME_, END_TIME_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.oracle.create.engine.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.oracle.create.engine.sql
index 05a6fddf78a..814e48459d3 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.oracle.create.engine.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.oracle.create.engine.sql
@@ -130,6 +130,7 @@ create table ACT_RU_JOB (
TENANT_ID_ NVARCHAR2(64),
CREATE_TIME_ TIMESTAMP(6),
LAST_FAILURE_LOG_ID_ NVARCHAR2(64),
+ BATCH_ID_ NVARCHAR2(64),
primary key (ID_)
);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.oracle.create.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.oracle.create.history.sql
index 430ed1ee56d..e28095b8416 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.oracle.create.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.oracle.create.history.sql
@@ -35,6 +35,7 @@ create table ACT_HI_PROCINST (
DELETE_REASON_ NVARCHAR2(2000),
TENANT_ID_ NVARCHAR2(64),
STATE_ NVARCHAR2(255),
+ RESTARTED_PROC_INST_ID_ NVARCHAR2(64),
primary key (ID_),
unique (PROC_INST_ID_)
);
@@ -287,6 +288,7 @@ create table ACT_HI_JOB_LOG (
TENANT_ID_ NVARCHAR2(64),
HOSTNAME_ NVARCHAR2(255),
REMOVAL_TIME_ TIMESTAMP(6),
+ BATCH_ID_ NVARCHAR2(64),
primary key (ID_)
);
@@ -339,6 +341,7 @@ create index ACT_IDX_HI_PRO_INST_PROC_TIME on ACT_HI_PROCINST(START_TIME_, END_T
create index ACT_IDX_HI_PI_PDEFID_END_TIME on ACT_HI_PROCINST(PROC_DEF_ID_, END_TIME_);
create index ACT_IDX_HI_PRO_INST_ROOT_PI on ACT_HI_PROCINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_PRO_INST_RM_TIME on ACT_HI_PROCINST(REMOVAL_TIME_);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
create index ACT_IDX_HI_ACTINST_ROOT_PI on ACT_HI_ACTINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_ACT_INST_START_END on ACT_HI_ACTINST(START_TIME_, END_TIME_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.postgres.create.engine.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.postgres.create.engine.sql
index e05f02d7214..e45f8533f0f 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.postgres.create.engine.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.postgres.create.engine.sql
@@ -130,6 +130,7 @@ create table ACT_RU_JOB (
TENANT_ID_ varchar(64),
CREATE_TIME_ timestamp,
LAST_FAILURE_LOG_ID_ varchar(64),
+ BATCH_ID_ varchar(64),
primary key (ID_)
);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.postgres.create.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.postgres.create.history.sql
index 2126975e74a..c95743b5187 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.postgres.create.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.postgres.create.history.sql
@@ -35,6 +35,7 @@ create table ACT_HI_PROCINST (
DELETE_REASON_ varchar(4000),
TENANT_ID_ varchar(64),
STATE_ varchar(255),
+ RESTARTED_PROC_INST_ID_ varchar(64),
primary key (ID_),
unique (PROC_INST_ID_)
);
@@ -287,6 +288,7 @@ create table ACT_HI_JOB_LOG (
TENANT_ID_ varchar(64),
HOSTNAME_ varchar(255),
REMOVAL_TIME_ timestamp,
+ BATCH_ID_ varchar(64),
primary key (ID_)
);
@@ -339,6 +341,7 @@ create index ACT_IDX_HI_PRO_INST_PROC_TIME on ACT_HI_PROCINST(START_TIME_, END_T
create index ACT_IDX_HI_PI_PDEFID_END_TIME on ACT_HI_PROCINST(PROC_DEF_ID_, END_TIME_);
create index ACT_IDX_HI_PRO_INST_ROOT_PI on ACT_HI_PROCINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_PRO_INST_RM_TIME on ACT_HI_PROCINST(REMOVAL_TIME_);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
create index ACT_IDX_HI_ACTINST_ROOT_PI on ACT_HI_ACTINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_ACT_INST_START_END on ACT_HI_ACTINST(START_TIME_, END_TIME_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.db2.drop.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.db2.drop.history.sql
index bdd56029478..9d8be4d3f31 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.db2.drop.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.db2.drop.history.sql
@@ -23,6 +23,7 @@ drop index ACT_IDX_HI_PRO_INST_PROC_TIME;
drop index ACT_IDX_HI_PI_PDEFID_END_TIME;
drop index ACT_IDX_HI_PRO_INST_ROOT_PI;
drop index ACT_IDX_HI_PRO_INST_RM_TIME;
+drop index ACT_IDX_HI_PRO_RST_PRO_INST_ID;
drop index ACT_IDX_HI_ACTINST_ROOT_PI;
drop index ACT_IDX_HI_ACT_INST_START_END;
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.h2.drop.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.h2.drop.history.sql
index 8bf4e2a4655..bc856ed8645 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.h2.drop.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.h2.drop.history.sql
@@ -23,6 +23,7 @@ drop index ACT_IDX_HI_PRO_INST_PROC_TIME;
drop index ACT_IDX_HI_PI_PDEFID_END_TIME;
drop index ACT_IDX_HI_PRO_INST_ROOT_PI;
drop index ACT_IDX_HI_PRO_INST_RM_TIME;
+drop index ACT_IDX_HI_PRO_RST_PRO_INST_ID;
drop index ACT_IDX_HI_ACTINST_ROOT_PI;
drop index ACT_IDX_HI_ACT_INST_START_END;
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.mariadb.drop.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.mariadb.drop.history.sql
index 2fff71cc558..0cebb8ea81f 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.mariadb.drop.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.mariadb.drop.history.sql
@@ -23,6 +23,7 @@ drop index ACT_IDX_HI_PRO_INST_PROC_TIME on ACT_HI_PROCINST;
drop index ACT_IDX_HI_PI_PDEFID_END_TIME on ACT_HI_PROCINST;
drop index ACT_IDX_HI_PRO_INST_ROOT_PI on ACT_HI_PROCINST;
drop index ACT_IDX_HI_PRO_INST_RM_TIME on ACT_HI_PROCINST;
+drop index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST;
drop index ACT_IDX_HI_ACTINST_ROOT_PI on ACT_HI_ACTINST;
drop index ACT_IDX_HI_ACT_INST_START_END on ACT_HI_ACTINST;
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.mssql.drop.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.mssql.drop.history.sql
index 3cbce879033..de4b0ab35b7 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.mssql.drop.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.mssql.drop.history.sql
@@ -23,6 +23,7 @@ drop index ACT_HI_PROCINST.ACT_IDX_HI_PRO_INST_PROC_TIME;
drop index ACT_HI_PROCINST.ACT_IDX_HI_PI_PDEFID_END_TIME;
drop index ACT_HI_PROCINST.ACT_IDX_HI_PRO_INST_ROOT_PI;
drop index ACT_HI_PROCINST.ACT_IDX_HI_PRO_INST_RM_TIME;
+drop index ACT_HI_PROCINST.ACT_IDX_HI_PRO_RST_PRO_INST_ID;
drop index ACT_HI_ACTINST.ACT_IDX_HI_ACTINST_ROOT_PI;
drop index ACT_HI_ACTINST.ACT_IDX_HI_ACT_INST_START_END;
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.mysql.drop.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.mysql.drop.history.sql
index cc7fae60ffd..e63914408cb 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.mysql.drop.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.mysql.drop.history.sql
@@ -23,6 +23,7 @@ drop index ACT_IDX_HI_PRO_INST_PROC_TIME on ACT_HI_PROCINST;
drop index ACT_IDX_HI_PI_PDEFID_END_TIME on ACT_HI_PROCINST;
drop index ACT_IDX_HI_PRO_INST_ROOT_PI on ACT_HI_PROCINST;
drop index ACT_IDX_HI_PRO_INST_RM_TIME on ACT_HI_PROCINST;
+drop index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST;
drop index ACT_IDX_HI_ACTINST_ROOT_PI on ACT_HI_ACTINST;
drop index ACT_IDX_HI_ACT_INST_START_END on ACT_HI_ACTINST;
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.oracle.drop.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.oracle.drop.history.sql
index b7318b2807f..e6acb942fd6 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.oracle.drop.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.oracle.drop.history.sql
@@ -23,6 +23,7 @@ drop index ACT_IDX_HI_PRO_INST_PROC_TIME;
drop index ACT_IDX_HI_PI_PDEFID_END_TIME;
drop index ACT_IDX_HI_PRO_INST_ROOT_PI;
drop index ACT_IDX_HI_PRO_INST_RM_TIME;
+drop index ACT_IDX_HI_PRO_RST_PRO_INST_ID;
drop index ACT_IDX_HI_ACTINST_ROOT_PI;
drop index ACT_IDX_HI_ACT_INST_START_END;
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.postgres.drop.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.postgres.drop.history.sql
index 5f9c798074d..bb0e521ff91 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.postgres.drop.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.postgres.drop.history.sql
@@ -23,6 +23,7 @@ drop index ACT_IDX_HI_PRO_INST_PROC_TIME;
drop index ACT_IDX_HI_PI_PDEFID_END_TIME;
drop index ACT_IDX_HI_PRO_INST_ROOT_PI;
drop index ACT_IDX_HI_PRO_INST_RM_TIME;
+drop index ACT_IDX_HI_PRO_RST_PRO_INST_ID;
drop index ACT_IDX_HI_ACTINST_ROOT_PI;
drop index ACT_IDX_HI_ACT_INST_START_END;
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/db2_engine_7.21_to_7.22.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/db2_engine_7.21_to_7.22.sql
index 7a8ada55ac2..55583c6f431 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/db2_engine_7.21_to_7.22.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/db2_engine_7.21_to_7.22.sql
@@ -21,3 +21,9 @@ values ('1100', CURRENT_TIMESTAMP, '7.22.0');
alter table ACT_RU_TASK add column TASK_STATE_ varchar(64);
alter table ACT_HI_TASKINST add column TASK_STATE_ varchar(64);
+
+alter table ACT_RU_JOB add column BATCH_ID_ varchar(64);
+alter table ACT_HI_JOB_LOG add column BATCH_ID_ varchar(64);
+
+alter table ACT_HI_PROCINST add RESTARTED_PROC_INST_ID_ varchar(64);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/h2_engine_7.21_to_7.22.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/h2_engine_7.21_to_7.22.sql
index 7a8ada55ac2..55583c6f431 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/h2_engine_7.21_to_7.22.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/h2_engine_7.21_to_7.22.sql
@@ -21,3 +21,9 @@ values ('1100', CURRENT_TIMESTAMP, '7.22.0');
alter table ACT_RU_TASK add column TASK_STATE_ varchar(64);
alter table ACT_HI_TASKINST add column TASK_STATE_ varchar(64);
+
+alter table ACT_RU_JOB add column BATCH_ID_ varchar(64);
+alter table ACT_HI_JOB_LOG add column BATCH_ID_ varchar(64);
+
+alter table ACT_HI_PROCINST add RESTARTED_PROC_INST_ID_ varchar(64);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/mariadb_engine_7.21_to_7.22.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/mariadb_engine_7.21_to_7.22.sql
index 7a8ada55ac2..55583c6f431 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/mariadb_engine_7.21_to_7.22.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/mariadb_engine_7.21_to_7.22.sql
@@ -21,3 +21,9 @@ values ('1100', CURRENT_TIMESTAMP, '7.22.0');
alter table ACT_RU_TASK add column TASK_STATE_ varchar(64);
alter table ACT_HI_TASKINST add column TASK_STATE_ varchar(64);
+
+alter table ACT_RU_JOB add column BATCH_ID_ varchar(64);
+alter table ACT_HI_JOB_LOG add column BATCH_ID_ varchar(64);
+
+alter table ACT_HI_PROCINST add RESTARTED_PROC_INST_ID_ varchar(64);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/mssql_engine_7.21_to_7.22.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/mssql_engine_7.21_to_7.22.sql
index 5c49433ff26..66ea5d03d6d 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/mssql_engine_7.21_to_7.22.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/mssql_engine_7.21_to_7.22.sql
@@ -21,3 +21,9 @@ values ('1100', CURRENT_TIMESTAMP, '7.22.0');
alter table ACT_RU_TASK add TASK_STATE_ nvarchar(64);
alter table ACT_HI_TASKINST add TASK_STATE_ nvarchar(64);
+
+alter table ACT_RU_JOB add BATCH_ID_ nvarchar(64);
+alter table ACT_HI_JOB_LOG add BATCH_ID_ nvarchar(64);
+
+alter table ACT_HI_PROCINST add RESTARTED_PROC_INST_ID_ nvarchar(64);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/mysql_engine_7.21_to_7.22.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/mysql_engine_7.21_to_7.22.sql
index 7a8ada55ac2..55583c6f431 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/mysql_engine_7.21_to_7.22.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/mysql_engine_7.21_to_7.22.sql
@@ -21,3 +21,9 @@ values ('1100', CURRENT_TIMESTAMP, '7.22.0');
alter table ACT_RU_TASK add column TASK_STATE_ varchar(64);
alter table ACT_HI_TASKINST add column TASK_STATE_ varchar(64);
+
+alter table ACT_RU_JOB add column BATCH_ID_ varchar(64);
+alter table ACT_HI_JOB_LOG add column BATCH_ID_ varchar(64);
+
+alter table ACT_HI_PROCINST add RESTARTED_PROC_INST_ID_ varchar(64);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/oracle_engine_7.21_to_7.22.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/oracle_engine_7.21_to_7.22.sql
index 1136a2087ef..afe6e9d3f09 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/oracle_engine_7.21_to_7.22.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/oracle_engine_7.21_to_7.22.sql
@@ -21,3 +21,9 @@ values ('1100', CURRENT_TIMESTAMP, '7.22.0');
alter table ACT_RU_TASK add TASK_STATE_ NVARCHAR2(64);
alter table ACT_HI_TASKINST add TASK_STATE_ NVARCHAR2(64);
+
+alter table ACT_RU_JOB add BATCH_ID_ NVARCHAR2(64);
+alter table ACT_HI_JOB_LOG add BATCH_ID_ NVARCHAR2(64);
+
+alter table ACT_HI_PROCINST add RESTARTED_PROC_INST_ID_ NVARCHAR2(64);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/postgres_engine_7.21_to_7.22.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/postgres_engine_7.21_to_7.22.sql
index 7a8ada55ac2..55583c6f431 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/postgres_engine_7.21_to_7.22.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/postgres_engine_7.21_to_7.22.sql
@@ -21,3 +21,9 @@ values ('1100', CURRENT_TIMESTAMP, '7.22.0');
alter table ACT_RU_TASK add column TASK_STATE_ varchar(64);
alter table ACT_HI_TASKINST add column TASK_STATE_ varchar(64);
+
+alter table ACT_RU_JOB add column BATCH_ID_ varchar(64);
+alter table ACT_HI_JOB_LOG add column BATCH_ID_ varchar(64);
+
+alter table ACT_HI_PROCINST add RESTARTED_PROC_INST_ID_ varchar(64);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/impl/mapping/entity/Authorization.xml b/engine/src/main/resources/org/operaton/bpm/engine/impl/mapping/entity/Authorization.xml
index 3b4f8b7e12b..70bca14a0ef 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/impl/mapping/entity/Authorization.xml
+++ b/engine/src/main/resources/org/operaton/bpm/engine/impl/mapping/entity/Authorization.xml
@@ -844,7 +844,8 @@
-
+
+
@@ -861,6 +862,34 @@
OR A.GROUP_ID_ IN #{item}
)
+
+ )
+
+
+
+
+ left join
+ inner join
+
+ (
+ SELECT A.*
+ FROM ${prefix}ACT_RU_AUTHORIZATION A
+ WHERE A.TYPE_ < 2
+ AND A.USER_ID_ in ( #{authCheck.authUserId, jdbcType=VARCHAR}, '*')
+
+
+ UNION (
+ SELECT A.*
+ FROM ${prefix}ACT_RU_AUTHORIZATION A
+ WHERE A.TYPE_ < 2
+ AND A.GROUP_ID_ IN #{item}
+
+ )
+
+ )
+
+
+
AND (
@@ -874,8 +903,7 @@
)
-
- )
+
@@ -550,6 +562,14 @@
${queryType} INC.INCIDENT_TYPE_ = #{query.incidentType}
+
+
+ ${queryType} INC.ID_ IN
+
+ #{incidentId}
+
+
+
${queryType} INC.INCIDENT_MSG_ = #{query.incidentMessage}
@@ -623,6 +643,21 @@
)
+
+ ${queryType} (
+ (
+ HAI.END_TIME_ IS NULL
+ AND HAI.ACT_ID_ IN
+
+ #{activityId}
+
+ ) OR INCACT.ACTIVITY_ID_ IN
+
+ #{activityId}
+
+ )
+
+
${queryType} (
HAI.END_TIME_ IS NOT NULL
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/impl/mapping/entity/Job.xml b/engine/src/main/resources/org/operaton/bpm/engine/impl/mapping/entity/Job.xml
index 49a924ac40b..f22101cdfb4 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/impl/mapping/entity/Job.xml
+++ b/engine/src/main/resources/org/operaton/bpm/engine/impl/mapping/entity/Job.xml
@@ -137,6 +137,7 @@
+
@@ -491,6 +492,7 @@
SEQUENCE_COUNTER_,
TENANT_ID_,
CREATE_TIME_,
+ BATCH_ID_,
REV_
)
values (#{id, jdbcType=VARCHAR},
@@ -519,6 +521,7 @@
#{sequenceCounter, jdbcType=BIGINT},
#{tenantId, jdbcType=VARCHAR},
#{createTime, jdbcType=TIMESTAMP},
+ #{batchId, jdbcType=VARCHAR},
1
)
@@ -547,7 +550,8 @@
HANDLER_CFG_ = #{jobHandlerConfigurationRaw, jdbcType=VARCHAR},
PRIORITY_ = #{priority, jdbcType=BIGINT},
SEQUENCE_COUNTER_ = #{sequenceCounter, jdbcType=BIGINT},
- LAST_FAILURE_LOG_ID_ = #{lastFailureLogId, jdbcType=VARCHAR}
+ LAST_FAILURE_LOG_ID_ = #{lastFailureLogId, jdbcType=VARCHAR},
+ BATCH_ID_ = #{batchId, jdbcType=VARCHAR}
where ID_= #{id, jdbcType=VARCHAR}
and REV_ = #{revision, jdbcType=INTEGER}
@@ -602,6 +606,7 @@
SEQUENCE_COUNTER_,
TENANT_ID_,
CREATE_TIME_,
+ BATCH_ID_,
REV_
)
values (#{id, jdbcType=VARCHAR},
@@ -628,6 +633,7 @@
#{sequenceCounter, jdbcType=BIGINT},
#{tenantId, jdbcType=VARCHAR},
#{createTime, jdbcType=TIMESTAMP},
+ #{batchId, jdbcType=VARCHAR},
1
)
@@ -653,7 +659,8 @@
HANDLER_CFG_ = #{jobHandlerConfigurationRaw, jdbcType=VARCHAR},
PRIORITY_ = #{priority, jdbcType=BIGINT},
SEQUENCE_COUNTER_ = #{sequenceCounter, jdbcType=BIGINT},
- LAST_FAILURE_LOG_ID_ = #{lastFailureLogId, jdbcType=VARCHAR}
+ LAST_FAILURE_LOG_ID_ = #{lastFailureLogId, jdbcType=VARCHAR},
+ BATCH_ID_ = #{batchId, jdbcType=VARCHAR}
where ID_= #{id, jdbcType=VARCHAR}
and REV_ = #{revision, jdbcType=INTEGER}
@@ -685,6 +692,7 @@
SEQUENCE_COUNTER_,
TENANT_ID_,
CREATE_TIME_,
+ BATCH_ID_,
REV_
)
values (#{id, jdbcType=VARCHAR},
@@ -711,6 +719,7 @@
#{sequenceCounter, jdbcType=BIGINT},
#{tenantId, jdbcType=VARCHAR},
#{createTime, jdbcType=TIMESTAMP},
+ #{batchId, jdbcType=VARCHAR},
1
)
@@ -736,7 +745,8 @@
HANDLER_CFG_ = #{jobHandlerConfigurationRaw, jdbcType=VARCHAR},
PRIORITY_ = #{priority, jdbcType=BIGINT},
SEQUENCE_COUNTER_ = #{sequenceCounter, jdbcType=BIGINT},
- LAST_FAILURE_LOG_ID_ = #{lastFailureLogId, jdbcType=VARCHAR}
+ LAST_FAILURE_LOG_ID_ = #{lastFailureLogId, jdbcType=VARCHAR},
+ BATCH_ID_ = #{batchId, jdbcType=VARCHAR}
where ID_= #{id, jdbcType=VARCHAR}
and REV_ = #{revision, jdbcType=INTEGER}
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/impl/mapping/entity/Task.xml b/engine/src/main/resources/org/operaton/bpm/engine/impl/mapping/entity/Task.xml
index 7404a44f6ec..c9663e659ff 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/impl/mapping/entity/Task.xml
+++ b/engine/src/main/resources/org/operaton/bpm/engine/impl/mapping/entity/Task.xml
@@ -250,7 +250,7 @@
-
+
+
+ or
+
+
+ I.GROUP_ID_ LIKE #{candidateGroupLike}
+
)
diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/externaltask/ExternalTaskQueryAuthorizationTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/externaltask/ExternalTaskQueryAuthorizationTest.java
index 57986b731f5..77ad1667985 100644
--- a/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/externaltask/ExternalTaskQueryAuthorizationTest.java
+++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/externaltask/ExternalTaskQueryAuthorizationTest.java
@@ -16,16 +16,22 @@
*/
package org.operaton.bpm.engine.test.api.authorization.externaltask;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.operaton.bpm.engine.authorization.Authorization.ANY;
+import static org.operaton.bpm.engine.authorization.Permissions.ALL;
import static org.operaton.bpm.engine.authorization.Permissions.READ;
import static org.operaton.bpm.engine.authorization.Permissions.READ_INSTANCE;
import static org.operaton.bpm.engine.authorization.Resources.PROCESS_DEFINITION;
import static org.operaton.bpm.engine.authorization.Resources.PROCESS_INSTANCE;
import static org.junit.Assert.assertEquals;
+import java.util.List;
import org.operaton.bpm.engine.externaltask.ExternalTaskQuery;
+import org.operaton.bpm.engine.externaltask.LockedExternalTask;
import org.operaton.bpm.engine.test.api.authorization.AuthorizationTest;
+import org.operaton.commons.testing.ProcessEngineLoggingRule;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
/**
@@ -34,10 +40,15 @@
*/
public class ExternalTaskQueryAuthorizationTest extends AuthorizationTest {
+ protected static final String WORKER_ID = "aWorkerId";
+ protected static final String EXTERNAL_TASK_TOPIC = "externalTaskTopic";
protected String deploymentId;
protected String instance1Id;
protected String instance2Id;
+ @Rule
+ public ProcessEngineLoggingRule loggingRule = new ProcessEngineLoggingRule();
+
@Override
@Before
public void setUp() throws Exception {
@@ -135,4 +146,52 @@ public void shouldNotFindTaskWithRevokedReadOnProcessInstance() {
// then
verifyQueryResults(query, 1);
}
+
+ @Test
+ public void shouldFetchAndLockWhenUserAuthorized() {
+ // given
+ createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, ALL);
+
+ // when
+ List externalTasks = externalTaskService
+ .fetchAndLock(1, WORKER_ID)
+ .topic(EXTERNAL_TASK_TOPIC, 10)
+ .execute();
+
+ // then
+ assertThat(externalTasks).hasSize(1);
+ assertThat(externalTasks).extracting(LockedExternalTask::getTopicName).first().isEqualTo(EXTERNAL_TASK_TOPIC);
+ }
+
+ @Test
+ public void shouldFetchAndLockWhenGroupAuthorized() {
+ // given
+ createGrantAuthorizationGroup(PROCESS_DEFINITION, ANY, groupId, ALL);
+
+ // when
+ List externalTasks = externalTaskService
+ .fetchAndLock(1, WORKER_ID)
+ .topic(EXTERNAL_TASK_TOPIC, 10)
+ .execute();
+
+ // then
+ assertThat(externalTasks).hasSize(1);
+ assertThat(externalTasks).extracting(LockedExternalTask::getTopicName).first().isEqualTo(EXTERNAL_TASK_TOPIC);
+ }
+
+ @Test
+ public void shouldNotFetchAndLockWhenUnauthorized() {
+ // given
+ createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_INSTANCE);
+ createGrantAuthorizationGroup(PROCESS_DEFINITION, ANY, groupId, READ_INSTANCE);
+
+ // when
+ List externalTasks = externalTaskService
+ .fetchAndLock(1, WORKER_ID)
+ .topic(EXTERNAL_TASK_TOPIC, 10)
+ .execute();
+
+ // then
+ assertThat(externalTasks).isEmpty();
+ }
}
diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/filter/FilterTaskQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/filter/FilterTaskQueryTest.java
index 4d752a026a4..d9b2dacaa69 100644
--- a/engine/src/test/java/org/operaton/bpm/engine/test/api/filter/FilterTaskQueryTest.java
+++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/filter/FilterTaskQueryTest.java
@@ -185,6 +185,7 @@ public void testTaskQuery() {
query.taskUnassigned();
query.taskAssigned();
query.taskDelegationState(testDelegationState);
+ query.taskCandidateGroupLike(testString);
query.taskCandidateGroupIn(testCandidateGroups);
query.taskCandidateGroupInExpression(testString);
query.withCandidateGroups();
@@ -290,6 +291,7 @@ public void testTaskQuery() {
assertTrue(query.isUnassigned());
assertTrue(query.isAssigned());
assertEquals(testDelegationState, query.getDelegationState());
+ assertEquals(testString, query.getCandidateGroupLike());
assertEquals(testCandidateGroups, query.getCandidateGroups());
assertTrue(query.isWithCandidateGroups());
assertTrue(query.isWithoutCandidateGroups());
@@ -657,6 +659,21 @@ public void testTaskQueryCandidateGroup() {
assertEquals(testGroup.getId(), query.getExpressions().get("taskCandidateGroup"));
}
+ @Test
+ public void testTaskQueryCandidateGroupLike() {
+ // given
+ TaskQueryImpl query = new TaskQueryImpl();
+ query.taskCandidateGroupLike(testGroup.getId());
+
+ saveQuery(query);
+
+ // when
+ query = filter.getQuery();
+
+ // then
+ assertEquals(testGroup.getId(), query.getCandidateGroupLike());
+ }
+
@Test
public void testTaskQueryCandidateUserIncludeAssignedTasks() {
TaskQueryImpl query = new TaskQueryImpl();
@@ -709,6 +726,23 @@ public void testTaskQueryCandidateGroupExpressionIncludeAssignedTasks() {
assertTrue(query.isIncludeAssignedTasks());
}
+ @Test
+ public void testTaskQueryCandidateGroupLikeIncludeAssignedTasks() {
+ // given
+ TaskQueryImpl query = new TaskQueryImpl();
+ query.taskCandidateGroupLike(testGroup.getId());
+ query.includeAssignedTasks();
+
+ saveQuery(query);
+
+ // when
+ query = filter.getQuery();
+
+ // then
+ assertEquals(testGroup.getId(), query.getCandidateGroupLike());
+ assertTrue(query.isIncludeAssignedTasks());
+ }
+
@Test
public void testTaskQueryCandidateGroupsIncludeAssignedTasks() {
TaskQueryImpl query = new TaskQueryImpl();
@@ -823,6 +857,56 @@ public void testExtendingTaskQueryWithAssigneeNotIn() {
assertEquals(0, extendingQueryTasks.size());
}
+ @Test
+ public void testExtendingEmptyTaskQueryWithCandidateGroupLike() {
+ // given 3 test tasks created during setup
+ TaskQuery query = taskService.createTaskQuery();
+ saveQuery(query);
+ List tasks = filterService.list(filter.getId());
+ assertEquals(3, tasks.size());
+
+ // when extending the query with a "candidate group like"
+ TaskQuery extendingQuery = taskService.createTaskQuery();
+ extendingQuery.taskCandidateGroupLike("%count%");
+
+ // then there is 1 unassigned task with the candidate group "accounting"
+ tasks = filterService.list(filter.getId(), extendingQuery);
+ assertEquals(1, tasks.size());
+ }
+
+ @Test
+ public void testExtendingCandidateGroupLikeTaskQueryWithEmpty() {
+ // given 3 existing tasks but only 1 unassigned task that matches the initial filter
+ TaskQuery query = taskService.createTaskQuery().taskCandidateGroupLike("%count%");
+ saveQuery(query);
+ List tasks = filterService.list(filter.getId());
+ assertEquals(1, tasks.size());
+
+ // when extending the query with an empty query
+ TaskQuery extendingQuery = taskService.createTaskQuery();
+
+ // then the empty query should be ignored in favor of the existing value for "candidate group like"
+ tasks = filterService.list(filter.getId(), extendingQuery);
+ assertEquals(1, tasks.size());
+ }
+
+ @Test
+ public void testExtendingCandidateGroupLikeTaskQueryWithCandidateGroupLike() {
+ // given 3 existing tasks but zero match the initial filter
+ TaskQuery query = taskService.createTaskQuery().taskCandidateGroupLike("HR");
+ saveQuery(query);
+ List tasks = filterService.list(filter.getId());
+ assertTrue(tasks.isEmpty());
+
+ // when extending the query with a "candidate groups like" query
+ TaskQuery extendingQuery = taskService.createTaskQuery();
+ extendingQuery.taskCandidateGroupLike("acc%");
+
+ // then the query should be return result of task matching the new filter
+ tasks = filterService.list(filter.getId(), extendingQuery);
+ assertEquals(1, tasks.size());
+ }
+
@Test
public void testExtendingTaskQueryListWithCandidateGroups() {
TaskQuery query = taskService.createTaskQuery();
diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/ModificationExecutionAsyncTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/ModificationExecutionAsyncTest.java
index dab148b01a7..3e9cc63d282 100644
--- a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/ModificationExecutionAsyncTest.java
+++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/ModificationExecutionAsyncTest.java
@@ -35,12 +35,15 @@
import java.util.List;
import org.assertj.core.api.Assertions;
+import org.operaton.bpm.engine.HistoryService;
import org.operaton.bpm.engine.ProcessEngineConfiguration;
import org.operaton.bpm.engine.ProcessEngineException;
import org.operaton.bpm.engine.RuntimeService;
+import org.operaton.bpm.engine.TaskService;
import org.operaton.bpm.engine.batch.Batch;
import org.operaton.bpm.engine.batch.history.HistoricBatch;
import org.operaton.bpm.engine.delegate.ExecutionListener;
+import org.operaton.bpm.engine.history.HistoricProcessInstanceQuery;
import org.operaton.bpm.engine.impl.batch.BatchSeedJobHandler;
import org.operaton.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.operaton.bpm.engine.impl.persistence.entity.ExecutionEntity;
@@ -55,6 +58,7 @@
import org.operaton.bpm.engine.runtime.ProcessInstanceQuery;
import org.operaton.bpm.engine.runtime.VariableInstance;
import org.operaton.bpm.engine.task.Task;
+import org.operaton.bpm.engine.test.Deployment;
import org.operaton.bpm.engine.test.ProcessEngineRule;
import org.operaton.bpm.engine.test.RequiredHistoryLevel;
import org.operaton.bpm.engine.test.bpmn.multiinstance.DelegateEvent;
@@ -86,6 +90,7 @@ public class ModificationExecutionAsyncTest {
protected ProcessEngineConfigurationImpl configuration;
protected RuntimeService runtimeService;
+ protected HistoryService historyService;
protected BpmnModelInstance instance;
@@ -110,6 +115,7 @@ public static Collection