Author: swiderski.maciej
Date: 2010-08-31 13:35:24 -0400 (Tue, 31 Aug 2010)
New Revision: 6637
Added:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/QueryOperand.java
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/DeploymentQuery.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/JobQuery.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ProcessDefinitionQuery.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ProcessInstanceQuery.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/TaskQuery.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryActivityInstanceQuery.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryDetailQuery.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryProcessInstanceQuery.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryTaskQuery.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/AbstractQuery.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/DeploymentQueryImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryActivityInstanceQueryImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryDetailQueryImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryProcessInstanceQueryImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryTaskQueryImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/JobQueryImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessInstanceQueryImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/TaskQueryImpl.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/subprocess/SubProcessEndTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/subprocess/SubProcessTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/DeploymentQueryTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryActivityInstanceQueryTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryProcessInstanceQueryTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryTaskQueryTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/JobQueryTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/ProcessDefinitionQueryTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/ProcessInstanceQueryTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/TaskQueryTest.java
Log:
JBPM-2873 and JBPM-2868: support for using various query operands (like, in, not in,
equals) with query parameters
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/DeploymentQuery.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/DeploymentQuery.java 2010-08-31
05:05:48 UTC (rev 6636)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/DeploymentQuery.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -35,6 +35,9 @@
/** only include a specific deployment by id */
DeploymentQuery deploymentId(String id);
+ /** only include a specific deployment by id allows to specify query operand*/
+ DeploymentQuery deploymentId(String id, QueryOperand operand);
+
/** only select suspended deployments */
DeploymentQuery suspended();
@@ -60,4 +63,5 @@
/** execute a count(*) query and returns number of results */
long count();
+
}
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/JobQuery.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/JobQuery.java 2010-08-31 05:05:48
UTC (rev 6636)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/JobQuery.java 2010-08-31 17:35:24
UTC (rev 6637)
@@ -49,6 +49,9 @@
/** only select jobs related to the given process instance */
JobQuery processInstanceId(String processInstanceId);
+
+ /** only select jobs related to the given process instance, allows to specify query
operand*/
+ JobQuery processInstanceId(String processInstanceId, QueryOperand operand);
/** only select jobs that were rolled back due to an exception */
JobQuery exception(boolean hasException);
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ProcessDefinitionQuery.java
===================================================================
---
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ProcessDefinitionQuery.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ProcessDefinitionQuery.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -55,7 +55,19 @@
/** select only process definitions within the given deployment */
ProcessDefinitionQuery deploymentId(String deploymentId);
+
+ /** select only the process definition with the given id, allows to specify query
operand */
+ ProcessDefinitionQuery processDefinitionId(String processDefinitionId, QueryOperand
operand);
+ /** select only process definitions with the given key, allows to specify query operand
*/
+ ProcessDefinitionQuery processDefinitionKey(String key, QueryOperand operand);
+
+ /** select only process definitions with an exact match for the given name, allows to
specify query operand */
+ ProcessDefinitionQuery processDefinitionName(String name, QueryOperand operand);
+
+ /** select only process definitions within the given deployment, allows to specify
query operand */
+ ProcessDefinitionQuery deploymentId(String deploymentId, QueryOperand operand);
+
/** select only suspended process definitions */
ProcessDefinitionQuery suspended();
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ProcessInstanceQuery.java
===================================================================
---
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ProcessInstanceQuery.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ProcessInstanceQuery.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -45,7 +45,22 @@
/** select only specific process instances using a business key */
ProcessInstanceQuery processInstanceKey(String processInstanceKey);
+
+ /** select only process instances that were started be given user */
+ ProcessInstanceQuery initiator(String user);
+
+ /** select only process instances for the given process definition, allows to specify
query operand */
+ ProcessInstanceQuery processDefinitionId(String processDefinitionId, QueryOperand
operand);
+ /** select only a specific process instances using the process instance id, allows to
specify query operand */
+ ProcessInstanceQuery processInstanceId(String processInstanceId, QueryOperand
operand);
+
+ /** select only specific process instances using a business key, allows to specify
query operand */
+ ProcessInstanceQuery processInstanceKey(String processInstanceKey, QueryOperand
operand);
+
+ /** select only process instances that were started be given user, allows to specify
query operand */
+ ProcessInstanceQuery initiator(String user, QueryOperand operand);
+
/** select only suspended process definitions */
ProcessInstanceQuery suspended();
@@ -69,4 +84,5 @@
/** execute a count(*) query and returns number of results */
long count();
+
}
Added: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/QueryOperand.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/QueryOperand.java
(rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/QueryOperand.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -0,0 +1,26 @@
+package org.jbpm.api;
+
+
+public enum QueryOperand {
+
+ EQUALS(0, "="),
+ LIKE(1, "like"),
+ IN(2, "in"),
+ NOT_IN(3, "not in");
+
+ @SuppressWarnings("unused")
+ private int id;
+ private String value;
+
+ QueryOperand(int id, String value) {
+ this.id = id;
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return this.value;
+ }
+
+
+}
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/TaskQuery.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/TaskQuery.java 2010-08-31 05:05:48
UTC (rev 6636)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/TaskQuery.java 2010-08-31 17:35:24
UTC (rev 6637)
@@ -70,7 +70,26 @@
/** only select tasks that are associated to the given activity name. This
* can be used in combination with the {@link #processDefinitionId(String)} */
TaskQuery activityName(String activityName);
+
+ /** only query for tasks for which the given user is a candidate, allows to specify
query operand.
+ * The user could be associated directly as a candidate participant
+ * to the task or the user could be a member of a group that is
+ * associated as a candidate group to the task. */
+ TaskQuery assignee(String userId, QueryOperand operand);
+
+ /** only select tasks that are associated to the given execution, allows to specify
query operand */
+ TaskQuery executionId(String executionId, QueryOperand operand);
+ /** only select tasks that are associated to the given process instance, allows to
specify query operand */
+ TaskQuery processInstanceId(String processInstanceId, QueryOperand operand);
+
+ /** only select tasks that are associated to the given process definition, allows to
specify query operand */
+ TaskQuery processDefinitionId(String processDefinitionId, QueryOperand operand);
+
+ /** only select tasks that are associated to the given activity name, allows to specify
query operand. This
+ * can be used in combination with the {@link #processDefinitionId(String)} */
+ TaskQuery activityName(String activityName, QueryOperand operand);
+
/** only select suspended tasks */
TaskQuery suspended();
@@ -94,4 +113,5 @@
/** execute the query and obtain the unique {@link Task} */
Task uniqueResult();
+
}
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryActivityInstanceQuery.java
===================================================================
---
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryActivityInstanceQuery.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryActivityInstanceQuery.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -24,10 +24,13 @@
import java.util.Date;
import java.util.List;
+import org.jbpm.api.QueryOperand;
+
/** query for {@link HistoryActivityInstance activity occurrences}.
*
* @author Tom Baeyens
+ * @author Maciej Swiderski
*/
public interface HistoryActivityInstanceQuery {
@@ -50,7 +53,16 @@
/** only select activity instances for the given process instance id */
HistoryActivityInstanceQuery processInstanceId(String processInstanceId);
+
+ /** only select activity instances for the given process definition, allows to specify
query operand */
+ HistoryActivityInstanceQuery processDefinitionId(String processDefinitionId,
QueryOperand operand);
+ /** only select activity instances for the given execution, allows to specify query
operand */
+ HistoryActivityInstanceQuery executionId(String executionId, QueryOperand operand);
+
+ /** only select activity instances for the given process instance id, allows to specify
query operand */
+ HistoryActivityInstanceQuery processInstanceId(String processInstanceId, QueryOperand
operand);
+
/** only select activity instances started after the given time */
HistoryActivityInstanceQuery startedAfter(Date time);
@@ -60,6 +72,13 @@
/** only select activity instances for the given activity
* (this usually used in combination with {@link #processDefinitionId(String)}) */
HistoryActivityInstanceQuery activityName(String activityName);
+
+ /** only select activity instances that are not active any more */
+ HistoryActivityInstanceQuery completedOnly();
+
+ /** only select activity instances for the given activity, allows to specify query
operand
+ * (this usually used in combination with {@link #processDefinitionId(String)}) */
+ HistoryActivityInstanceQuery activityName(String activityName, QueryOperand operand);
/** only select activity instances that took longer then the given duration in
milliseconds */
HistoryActivityInstanceQuery tookLongerThen(long durationInMillis);
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryDetailQuery.java
===================================================================
---
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryDetailQuery.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryDetailQuery.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -24,10 +24,13 @@
import java.util.Date;
import java.util.List;
+import org.jbpm.api.QueryOperand;
+
/** query for task comments, task assignments and so on.
*
* @author Tom Baeyens
+ * @author Maciej Swiderski
*/
public interface HistoryDetailQuery {
@@ -44,7 +47,16 @@
/** only select details for the given taskId */
HistoryDetailQuery taskId(String taskId);
+
+ /** only select details for the given processInstanceId, allows to specify query
operand */
+ HistoryDetailQuery processInstanceId(String processInstanceId, QueryOperand operand);
+ /** only select details for the given activityInstanceId, allows to specify query
operand */
+ HistoryDetailQuery activityInstanceId(String activityInstanceId, QueryOperand
operand);
+
+ /** only select details for the given taskId, allows to specify query operand */
+ HistoryDetailQuery taskId(String taskId, QueryOperand operand);
+
/** only select details after the given time */
HistoryDetailQuery timeAfter(Date time);
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryProcessInstanceQuery.java
===================================================================
---
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryProcessInstanceQuery.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryProcessInstanceQuery.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -24,11 +24,14 @@
import java.util.Date;
import java.util.List;
+import org.jbpm.api.QueryOperand;
+
/** query for ongoing and finished
* {@linkplain HistoryProcessInstance process instances}.
*
* @author Tom Baeyens
+ * @author Maciej Swiderski
*/
public interface HistoryProcessInstanceQuery {
@@ -56,7 +59,33 @@
/** select only process instances in the given state */
HistoryProcessInstanceQuery state(String state);
+
+ /** select only process instances that were started be given user */
+ HistoryProcessInstanceQuery initiator(String user);
+
+ /** select only the process instances with the super process instance as given id,
+ * in other words sub process instances */
+ HistoryProcessInstanceQuery superProcessInstanceId(String processInstanceId);
+
+ /** select only the process instances with the given id, allows to specify query
operand */
+ HistoryProcessInstanceQuery processInstanceId(String processInstanceId, QueryOperand
operand);
+ /** select only process instances with the given process definition, allows to specify
query operand */
+ HistoryProcessInstanceQuery processDefinitionId(String processDefinitionId,
QueryOperand operand);
+
+ /** select only process instances with the given business key, allows to specify query
operand */
+ HistoryProcessInstanceQuery processInstanceKey(String processInstanceKey, QueryOperand
operand);
+
+ /** select only process instances in the given state, allows to specify query operand
*/
+ HistoryProcessInstanceQuery state(String state, QueryOperand operand);
+
+ /** select only process instances that were started be given user, allows to specify
query operand */
+ HistoryProcessInstanceQuery initiator(String user, QueryOperand operand);
+
+ /** select only the process instances with the super process instance as given id,
+ * in other words sub process instances, allows to specify query operand */
+ HistoryProcessInstanceQuery superProcessInstanceId(String processInstanceId,
QueryOperand operand);
+
/** order selected process instances ascending for certain {@link #PROPERTY_STARTTIME
properties} */
HistoryProcessInstanceQuery orderAsc(String property);
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryTaskQuery.java
===================================================================
---
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryTaskQuery.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryTaskQuery.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -24,10 +24,13 @@
import java.util.Date;
import java.util.List;
+import org.jbpm.api.QueryOperand;
+
/** query for history tasks.
*
* @author Tom Baeyens
+ * @author Maciej Swiderski
*/
public interface HistoryTaskQuery {
@@ -51,6 +54,9 @@
/** only select the history task for the given id */
HistoryTaskQuery taskId(String taskId);
+ /** only select history tasks within the given processInstanceId */
+ HistoryTaskQuery processInstanceId(String processInstanceId);
+
/** only select history tasks within the given execution */
HistoryTaskQuery executionId(String executionId);
@@ -59,9 +65,27 @@
/** only select history tasks in the given state */
HistoryTaskQuery state(String state);
+
+ /** only select the history task for the given id, allows to specify query operand */
+ HistoryTaskQuery taskId(String taskId, QueryOperand operand);
+
+ /** only select history tasks within the given processInstanceId, allows to specify
query operand */
+ HistoryTaskQuery processInstanceId(String processInstanceId, QueryOperand operand);
+
+ /** only select history tasks within the given execution, allows to specify query
operand */
+ HistoryTaskQuery executionId(String executionId, QueryOperand operand);
+
+ /** only select history tasks for the given assignee, allows to specify query operand
*/
+ HistoryTaskQuery assignee(String assignee, QueryOperand operand);
+ /** only select history tasks in the given state, allows to specify query operand */
+ HistoryTaskQuery state(String state, QueryOperand operand);
+
/** only select history tasks that have the given outcome */
HistoryTaskQuery outcome(String outcome);
+
+ /** only select history tasks that have the given outcome, allows to specify query
operand */
+ HistoryTaskQuery outcome(String outcome, QueryOperand operand);
/** order selected history tasks ascending for certain {@link #PROPERTY_ID properties}
*/
HistoryTaskQuery orderAsc(String property);
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/AbstractQuery.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/AbstractQuery.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/AbstractQuery.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -22,12 +22,15 @@
package org.jbpm.pvm.internal.query;
import java.io.ObjectStreamException;
+import java.lang.reflect.Array;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.hibernate.Query;
import org.hibernate.Session;
-
import org.jbpm.api.JbpmException;
+import org.jbpm.api.QueryOperand;
import org.jbpm.api.cmd.Command;
import org.jbpm.api.cmd.Environment;
import org.jbpm.pvm.internal.cmd.CommandService;
@@ -35,6 +38,7 @@
/**
* @author Tom Baeyens
+ * @author Maciej Swiderski
*/
public abstract class AbstractQuery implements Command<Object> {
@@ -47,6 +51,8 @@
protected boolean count;
protected boolean uniqueResult;
+ protected Map<String, QueryOperand> parameterOperands = new HashMap<String,
QueryOperand>();
+
protected abstract void applyParameters(Query query);
public abstract String hql();
@@ -155,7 +161,66 @@
this.commandService = null;
return this;
}
+
+ protected QueryOperand getOperand(String param) {
+ if (parameterOperands.containsKey(param)) {
+ return parameterOperands.get(param);
+ }
+ return QueryOperand.EQUALS;
+ }
+
+ protected boolean isListOperand(String param) {
+ QueryOperand operand = getOperand(param);
+
+ if (operand == QueryOperand.IN || operand == QueryOperand.NOT_IN) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Transforms given string (<code>parameter</code>) to an array of given
type (<code>clazz</code>).
+ * <code>parameter</code> will be split using separator ','
(comma).
+ * Array will be populated based on split string by creating new instance of class
<code>clazz</code>
+ * using its constructor that accepts String argument.
+ * All exceptions will be silently skipped.
+ */
+ @SuppressWarnings("unchecked")
+ protected <T> T[] transformToArray(String parameter, T clazz) {
+ String[] idsStr = parameter.split(",");
+ if (clazz instanceof String) {
+ return (T[]) idsStr;
+ }
+ T[] ids = (T[]) Array.newInstance( (Class)clazz, idsStr.length);
+
+ for (int i = 0; i < idsStr.length; i++) {
+ try {
+ ids[i] = (T) ((Class)clazz).getConstructor(String.class).newInstance(idsStr[i]);
+ } catch (Exception e) {
+ }
+ }
+ return ids;
+ }
+
+ protected void appendWhereClauseWithOperand(String where, String namedParam,
StringBuilder hql) {
+ QueryOperand operand = getOperand(namedParam);
+ if (isListOperand(namedParam)) {
+ appendWhereClause(where + " " + operand + " (:" + namedParam +
") ", hql);
+ } else {
+ appendWhereClause(where + " " + operand + " :" + namedParam +
" ", hql);
+ }
+ }
+
+ protected void applyParameterWithOperand(String parameter, String namedParam,
Class<?> clazz, Query query) {
+ if (isListOperand(namedParam)) {
+ query.setParameterList(namedParam, transformToArray(parameter, clazz));
+ } else {
+ query.setString(namedParam, parameter);
+ }
+ }
+
public void setCommandService(CommandService commandService) {
this.commandService = commandService;
}
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/DeploymentQueryImpl.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/DeploymentQueryImpl.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/DeploymentQueryImpl.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -26,12 +26,14 @@
import org.hibernate.Query;
import org.jbpm.api.Deployment;
import org.jbpm.api.DeploymentQuery;
+import org.jbpm.api.QueryOperand;
import org.jbpm.pvm.internal.repository.DeploymentImpl;
import org.jbpm.pvm.internal.util.CollectionUtil;
/**
* @author Tom Baeyens
+ * @author Maciej Swiderski
*/
public class DeploymentQueryImpl extends AbstractQuery implements DeploymentQuery {
@@ -53,7 +55,7 @@
hql.append(" as d ");
if (deploymentId!=null) {
- appendWhereClause("d.dbid = "+deploymentId+" ", hql);
+ appendWhereClauseWithOperand("d.dbid", "deploymentId", hql);
}
if (suspended!=null) {
@@ -70,6 +72,10 @@
}
protected void applyParameters(Query query) {
+
+ if (deploymentId != null) {
+ applyParameterWithOperand(deploymentId, "deploymentId", Long.class,
query);
+ }
}
public DeploymentQuery deploymentId(String deploymentId) {
@@ -109,4 +115,10 @@
public Deployment uniqueResult() {
return (Deployment) untypedUniqueResult();
}
+
+ public DeploymentQuery deploymentId(String id, QueryOperand operand) {
+ this.deploymentId = id;
+ parameterOperands.put("deploymentId", operand);
+ return this;
+ }
}
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryActivityInstanceQueryImpl.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryActivityInstanceQueryImpl.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryActivityInstanceQueryImpl.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -26,6 +26,7 @@
import org.hibernate.Query;
import org.jbpm.api.JbpmException;
+import org.jbpm.api.QueryOperand;
import org.jbpm.api.history.HistoryActivityInstance;
import org.jbpm.api.history.HistoryActivityInstanceQuery;
import org.jbpm.pvm.internal.history.model.HistoryActivityInstanceImpl;
@@ -34,6 +35,7 @@
/**
* @author Tom Baeyens
+ * @author Maciej Swiderski
*/
public class HistoryActivityInstanceQueryImpl extends AbstractQuery implements
HistoryActivityInstanceQuery {
@@ -47,6 +49,7 @@
protected String executionId;
protected String processInstanceId;
protected String activityName;
+ protected boolean completedOnly;
public String hql() {
StringBuilder hql = new StringBuilder();
@@ -63,7 +66,7 @@
hql.append(" as hai ");
if (processDefinitionId!=null) {
- appendWhereClause(" hai.historyProcessInstance.processDefinitionId =
'"+processDefinitionId+"' ", hql);
+
appendWhereClauseWithOperand("hai.historyProcessInstance.processDefinitionId",
"processDefinitionId", hql);
}
if (tookLessThen!=null) {
@@ -83,17 +86,21 @@
}
if (processInstanceId!=null) {
- appendWhereClause(" hai.historyProcessInstance.processInstanceId =
'"+processInstanceId+"'", hql);
+
appendWhereClauseWithOperand("hai.historyProcessInstance.processInstanceId",
"processInstanceId", hql);
}
if (executionId!=null) {
- appendWhereClause(" hai.executionId =
'"+executionId+"'", hql);
+ appendWhereClauseWithOperand("hai.executionId", "executionId",
hql);
}
if (activityName!=null) {
- appendWhereClause(" hai.activityName =
'"+activityName+"'", hql);
+ appendWhereClauseWithOperand("hai.activityName",
"activityName", hql);
}
+ if (completedOnly) {
+ appendWhereClause(" hai.endTime is not null ", hql);
+ }
+
appendOrderByClause(hql);
return hql.toString();
@@ -115,6 +122,22 @@
if (startedAfter!=null) {
query.setTimestamp("startedAfter", startedAfter);
}
+
+ if (processDefinitionId!=null) {
+ applyParameterWithOperand(processDefinitionId, "processDefinitionId",
String.class, query);
+ }
+
+ if (processInstanceId!=null) {
+ applyParameterWithOperand(processInstanceId, "processInstanceId",
String.class, query);
+ }
+
+ if (executionId!=null) {
+ applyParameterWithOperand(executionId, "executionId", String.class,
query);
+ }
+
+ if (activityName!=null) {
+ applyParameterWithOperand(activityName, "activityName", String.class,
query);
+ }
}
public List<HistoryActivityInstance> list() {
@@ -182,4 +205,37 @@
this.tookLongerThen = durationInMillis;
return this;
}
+
+ public HistoryActivityInstanceQuery completedOnly() {
+ this.completedOnly = true;
+ return this;
+ }
+
+ public HistoryActivityInstanceQuery activityName(String activityName, QueryOperand
operand) {
+ this.activityName = activityName;
+ parameterOperands.put("activityName", operand);
+
+ return this;
+ }
+
+ public HistoryActivityInstanceQuery executionId(String executionId, QueryOperand
operand) {
+ this.executionId = executionId;
+ parameterOperands.put("executionId", operand);
+
+ return this;
+ }
+
+ public HistoryActivityInstanceQuery processDefinitionId(String processDefinitionId,
QueryOperand operand) {
+ this.processDefinitionId = processDefinitionId;
+ parameterOperands.put("processDefinitionId", operand);
+
+ return this;
+ }
+
+ public HistoryActivityInstanceQuery processInstanceId(String processInstanceId,
QueryOperand operand) {
+ this.processInstanceId = processInstanceId;
+ parameterOperands.put("processInstanceId", operand);
+
+ return this;
+ }
}
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryDetailQueryImpl.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryDetailQueryImpl.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryDetailQueryImpl.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -25,6 +25,7 @@
import java.util.List;
import org.hibernate.Query;
+import org.jbpm.api.QueryOperand;
import org.jbpm.api.history.HistoryDetail;
import org.jbpm.api.history.HistoryDetailQuery;
import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
@@ -34,6 +35,7 @@
/**
* @author Tom Baeyens
+ * @author Maciej Swiderski
*/
public class HistoryDetailQueryImpl extends AbstractQuery implements HistoryDetailQuery
{
@@ -48,21 +50,26 @@
public String hql() {
StringBuilder hql = new StringBuilder();
- hql.append("select hd ");
+ hql.append("select ");
+ if (count) {
+ hql.append("count(hd) ");
+ } else {
+ hql.append("hd ");
+ }
hql.append("from ");
hql.append(type.getName());
hql.append(" as hd ");
if (taskId!=null) {
- appendWhereClause(" hd.historyTask.dbid = "+taskId+" ", hql);
+ appendWhereClauseWithOperand("hd.historyTask.dbid", "taskId",
hql);
}
if (processInstanceId!=null) {
- appendWhereClause(" hd.historyProcessInstance.processInstanceId =
'"+processInstanceId+"' ", hql);
+
appendWhereClauseWithOperand("hd.historyProcessInstance.processInstanceId",
"processInstanceId", hql);
}
if (activityInstanceId!=null) {
- appendWhereClause(" hd.historyActivityInstance.dbid =
"+activityInstanceId+" ", hql);
+ appendWhereClauseWithOperand("hd.historyActivityInstance.dbid",
"activityInstanceId", hql);
}
if (timeBefore!=null) {
@@ -86,6 +93,18 @@
if (timeBefore!=null) {
query.setTime("timeBefore", timeBefore);
}
+
+ if (taskId!=null) {
+ applyParameterWithOperand(taskId, "taskId", Long.class, query);
+ }
+
+ if (processInstanceId!=null) {
+ applyParameterWithOperand(processInstanceId, "processInstanceId",
String.class, query);
+ }
+
+ if (activityInstanceId!=null) {
+ applyParameterWithOperand(activityInstanceId, "activityInstanceId",
Long.class, query);
+ }
}
public List<HistoryDetail> list() {
@@ -140,4 +159,25 @@
this.timeBefore = timeBefore;
return this;
}
+
+ public HistoryDetailQuery activityInstanceId(String activityInstanceId, QueryOperand
operand) {
+ this.activityInstanceId = activityInstanceId;
+ parameterOperands.put("activityInstanceId", operand);
+
+ return this;
+ }
+
+ public HistoryDetailQuery processInstanceId(String processInstanceId, QueryOperand
operand) {
+ this.processInstanceId = processInstanceId;
+ parameterOperands.put("processInstanceId", operand);
+
+ return this;
+ }
+
+ public HistoryDetailQuery taskId(String taskId, QueryOperand operand) {
+ this.taskId = taskId;
+ parameterOperands.put("taskId", operand);
+
+ return this;
+ }
}
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryProcessInstanceQueryImpl.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryProcessInstanceQueryImpl.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryProcessInstanceQueryImpl.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -25,6 +25,7 @@
import java.util.List;
import org.hibernate.Query;
+import org.jbpm.api.QueryOperand;
import org.jbpm.api.history.HistoryProcessInstance;
import org.jbpm.api.history.HistoryProcessInstanceQuery;
import org.jbpm.pvm.internal.history.model.HistoryProcessInstanceImpl;
@@ -33,6 +34,7 @@
/**
* @author Tom Baeyens
* @author Alejandro Guizar
+ * @author Maciej Swiderski
*/
public class HistoryProcessInstanceQueryImpl extends AbstractQuery implements
HistoryProcessInstanceQuery {
@@ -42,10 +44,13 @@
protected String state;
protected String processInstanceId;
protected String processInstanceKey;
+ protected String initiator;
+ protected String superProcessInstanceId;
protected boolean ended;
protected Date endedBefore;
protected Date endedAfter;
+
public String hql() {
StringBuilder hql = new StringBuilder();
@@ -62,21 +67,29 @@
hql.append(" as hpi ");
if (processInstanceId!=null) {
- appendWhereClause(" hpi.processInstanceId =
'"+processInstanceId+"' ", hql);
+ appendWhereClauseWithOperand("hpi.processInstanceId",
"processInstanceId", hql);
}
if (processDefinitionId!=null) {
- appendWhereClause(" hpi.processDefinitionId =
'"+processDefinitionId+"' ", hql);
+ appendWhereClauseWithOperand("hpi.processDefinitionId",
"processDefinitionId", hql);
}
if (state!=null) {
- appendWhereClause(" hpi.state = '"+state+"' ", hql);
+ appendWhereClauseWithOperand("hpi.state", "state", hql);
}
if (processInstanceKey!=null) {
- appendWhereClause(" hpi.key = '" + processInstanceKey +
"'", hql);
+ appendWhereClauseWithOperand("hpi.key", "processInstanceKey",
hql);
}
+ if (initiator!=null) {
+ appendWhereClauseWithOperand("hpi.initiator", "initiator",
hql);
+ }
+
+ if (superProcessInstanceId!=null) {
+ appendWhereClauseWithOperand("hpi.superProcessInstanceId",
"superProcessInstanceId", hql);
+ }
+
if (ended) {
appendWhereClause(" hpi.endTime is not null", hql);
}
@@ -99,6 +112,30 @@
if (endedAfter != null) {
query.setTimestamp("after", endedAfter);
}
+
+ if (processInstanceId!=null) {
+ applyParameterWithOperand(processInstanceId, "processInstanceId",
String.class, query);
+ }
+
+ if (processDefinitionId!=null) {
+ applyParameterWithOperand(processDefinitionId, "processDefinitionId",
String.class, query);
+ }
+
+ if (state!=null) {
+ applyParameterWithOperand(state, "state", String.class, query);
+ }
+
+ if (processInstanceKey!=null) {
+ applyParameterWithOperand(processInstanceKey, "processInstanceKey",
String.class, query);
+ }
+
+ if (initiator!=null) {
+ applyParameterWithOperand(initiator, "initiator", String.class, query);
+ }
+
+ if (superProcessInstanceId!=null) {
+ applyParameterWithOperand(superProcessInstanceId,
"superProcessInstanceId", String.class, query);
+ }
}
public List<HistoryProcessInstance> list() {
@@ -143,6 +180,11 @@
this.state = state;
return this;
}
+
+ public HistoryProcessInstanceQuery initiator(String user) {
+ this.initiator = user;
+ return this;
+ }
public HistoryProcessInstanceQuery ended() {
ended = true;
@@ -167,4 +209,52 @@
ended = false;
return this;
}
+
+ public HistoryProcessInstanceQuery processDefinitionId(String processDefinitionId,
QueryOperand operand) {
+ this.processDefinitionId = processDefinitionId;
+ parameterOperands.put("processDefinitionId", operand);
+
+ return this;
+ }
+
+ public HistoryProcessInstanceQuery processInstanceId(String processInstanceId,
QueryOperand operand) {
+ this.processInstanceId = processInstanceId;
+ parameterOperands.put("processInstanceId", operand);
+
+ return this;
+ }
+
+ public HistoryProcessInstanceQuery processInstanceKey(String processInstanceKey,
QueryOperand operand) {
+ this.processInstanceKey = processInstanceKey;
+ parameterOperands.put("processInstanceKey", operand);
+
+ return this;
+ }
+
+ public HistoryProcessInstanceQuery state(String state, QueryOperand operand) {
+ this.state = state;
+ parameterOperands.put("state", operand);
+
+ return this;
+ }
+
+ public HistoryProcessInstanceQuery initiator(String user, QueryOperand operand) {
+ this.initiator = user;
+ parameterOperands.put("initiator", operand);
+
+ return this;
+ }
+
+ public HistoryProcessInstanceQuery superProcessInstanceId(String processInstanceId) {
+ this.superProcessInstanceId = processInstanceId;
+
+ return this;
+ }
+
+ public HistoryProcessInstanceQuery superProcessInstanceId(String processInstanceId,
QueryOperand operand) {
+ this.superProcessInstanceId = processInstanceId;
+ parameterOperands.put("superProcessInstanceId", operand);
+
+ return this;
+ }
}
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryTaskQueryImpl.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryTaskQueryImpl.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryTaskQueryImpl.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -26,18 +26,22 @@
import org.hibernate.Query;
+import org.jbpm.api.QueryOperand;
import org.jbpm.api.history.HistoryTask;
import org.jbpm.api.history.HistoryTaskQuery;
import org.jbpm.pvm.internal.history.model.HistoryTaskImpl;
+import org.jbpm.pvm.internal.history.model.HistoryTaskInstanceImpl;
import org.jbpm.pvm.internal.util.CollectionUtil;
/**
* @author Tom Baeyens
+ * @author Maciej Swiderski
*/
public class HistoryTaskQueryImpl extends AbstractQuery implements HistoryTaskQuery {
protected String taskId;
protected String executionId;
+ protected String processInstanceId;
protected String assignee;
protected String state;
protected String outcome;
@@ -60,24 +64,32 @@
hql.append(HistoryTaskImpl.class.getName());
hql.append(" as ht ");
+ if (processInstanceId != null) {
+ hql.append(", ");
+ hql.append(HistoryTaskInstanceImpl.class.getName());
+ hql.append(" as hti ");
+ appendWhereClause("ht = hti.historyTask", hql);
+
appendWhereClauseWithOperand("hti.historyProcessInstance.processInstanceId",
"processInstanceId", hql);
+ }
+
if (taskId!=null) {
- appendWhereClause(" ht.dbid = "+taskId+" ", hql);
+ appendWhereClauseWithOperand("ht.dbid", "taskId", hql);
}
if (executionId!=null) {
- appendWhereClause(" ht.executionId = '"+executionId+"'
", hql);
+ appendWhereClauseWithOperand("ht.executionId", "executionId",
hql);
}
if (assignee!=null) {
- appendWhereClause(" ht.assignee = '"+assignee+"' ",
hql);
+ appendWhereClauseWithOperand("ht.assignee", "assignee", hql);
}
if (state!=null) {
- appendWhereClause(" ht.state = '"+state+"' ", hql);
+ appendWhereClauseWithOperand("ht.state", "state", hql);
}
if (outcome!=null) {
- appendWhereClause(" ht.outcome = '"+outcome+"' ",
hql);
+ appendWhereClauseWithOperand("ht.outcome", "outcome", hql);
}
if (tookLessThen!=null) {
@@ -117,6 +129,30 @@
if (startedAfter!=null) {
query.setTimestamp("startedAfter", startedAfter);
}
+
+ if (processInstanceId!=null) {
+ applyParameterWithOperand(processInstanceId, "processInstanceId",
String.class, query);
+ }
+
+ if (taskId!=null) {
+ applyParameterWithOperand(taskId, "taskId", Long.class, query);
+ }
+
+ if (executionId!=null) {
+ applyParameterWithOperand(executionId, "executionId", String.class,
query);
+ }
+
+ if (assignee!=null) {
+ applyParameterWithOperand(assignee, "assignee", String.class, query);
+ }
+
+ if (state!=null) {
+ applyParameterWithOperand(state, "state", String.class, query);
+ }
+
+ if (outcome!=null) {
+ applyParameterWithOperand(outcome, "outcome", String.class, query);
+ }
}
public List<HistoryTask> list() {
@@ -132,6 +168,11 @@
return this;
}
+ public HistoryTaskQuery processInstanceId(String processInstanceId) {
+ this.processInstanceId = processInstanceId;
+ return this;
+ }
+
public HistoryTaskQuery executionId(String executionId) {
this.executionId = executionId;
return this;
@@ -186,4 +227,46 @@
this.tookLongerThen = durationInMillis;
return this;
}
+
+ public HistoryTaskQuery assignee(String assignee, QueryOperand operand) {
+ this.assignee = assignee;
+ parameterOperands.put("assignee", operand);
+
+ return this;
+ }
+
+ public HistoryTaskQuery processInstanceId(String processInstanceId, QueryOperand
operand) {
+ this.processInstanceId = processInstanceId;
+ parameterOperands.put("processInstanceId", operand);
+
+ return this;
+ }
+
+ public HistoryTaskQuery executionId(String executionId, QueryOperand operand) {
+ this.executionId = executionId;
+ parameterOperands.put("executionId", operand);
+
+ return this;
+ }
+
+ public HistoryTaskQuery state(String state, QueryOperand operand) {
+ this.state = state;
+ parameterOperands.put("state", operand);
+
+ return this;
+ }
+
+ public HistoryTaskQuery taskId(String taskId, QueryOperand operand) {
+ this.taskId = taskId;
+ parameterOperands.put("taskId", operand);
+
+ return this;
+ }
+
+ public HistoryTaskQuery outcome(String outcome, QueryOperand operand) {
+ this.outcome = outcome;
+ parameterOperands.put("outcome", operand);
+
+ return this;
+ }
}
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/JobQueryImpl.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/JobQueryImpl.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/JobQueryImpl.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -25,6 +25,7 @@
import org.hibernate.Query;
import org.jbpm.api.JobQuery;
+import org.jbpm.api.QueryOperand;
import org.jbpm.api.job.Job;
import org.jbpm.pvm.internal.job.JobImpl;
import org.jbpm.pvm.internal.job.MessageImpl;
@@ -34,6 +35,7 @@
/**
* @author Tom Baeyens
+ * @author Maciej Swiderski
*/
public class JobQueryImpl extends AbstractQuery implements JobQuery {
@@ -43,6 +45,8 @@
protected boolean timersOnly = false;
protected String processInstanceId = null;
protected Boolean exception;
+
+
public String hql() {
StringBuilder hql = new StringBuilder();
@@ -65,8 +69,9 @@
hql.append(" j ");
if (processInstanceId!=null) {
- appendWhereClause("j.processInstance.id =
'"+processInstanceId+"' ", hql);
- }
+ appendWhereClauseWithOperand("j.processInstance.id",
"processInstanceId", hql);
+ }
+
if (exception!=null) {
if (exception) {
@@ -82,6 +87,9 @@
}
protected void applyParameters(Query query) {
+ if (processInstanceId != null) {
+ applyParameterWithOperand(processInstanceId, "processInstanceId",
String.class, query);
+ }
}
public List<Job> list() {
@@ -126,4 +134,11 @@
this.processInstanceId = processInstanceId;
return this;
}
+
+ public JobQuery processInstanceId(String processInstanceId, QueryOperand operand) {
+ this.processInstanceId = processInstanceId;
+ parameterOperands.put("processInstanceId", operand);
+
+ return this;
+ }
}
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -31,6 +31,7 @@
import org.jbpm.api.Deployment;
import org.jbpm.api.ProcessDefinition;
import org.jbpm.api.ProcessDefinitionQuery;
+import org.jbpm.api.QueryOperand;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
import org.jbpm.pvm.internal.repository.DeploymentImpl;
@@ -51,6 +52,7 @@
* to get the properly initialized ProcessDefinitionImpl.
*
* @author Tom Baeyens
+ * @author Maciej Swiderski
*/
public class ProcessDefinitionQueryImpl extends AbstractQuery implements
ProcessDefinitionQuery {
@@ -126,24 +128,25 @@
appendWhereClause("versionProperty.deployment = deployment ", hql);
if (id!=null) {
- appendWhereClause("idProperty.stringValue = '"+id+"'",
hql);
+ appendWhereClauseWithOperand("idProperty.stringValue", "id",
hql);
}
- if (nameLike!=null) {
- appendWhereClause("idProperty.objectName like '"+nameLike+"'
", hql);
- }
-
if (name!=null) {
- appendWhereClause("idProperty.objectName = '"+name+"'
", hql);
+ appendWhereClauseWithOperand("idProperty.objectName", "name",
hql);
}
if (key!=null) {
- appendWhereClause("keyProperty.stringValue = '"+key+"'
", hql);
+ appendWhereClauseWithOperand("keyProperty.stringValue", "key",
hql);
}
if (deploymentId!=null) {
- appendWhereClause("idProperty.deployment.dbid = "+deploymentId+"
", hql);
+ appendWhereClauseWithOperand("idProperty.deployment.dbid",
"deploymentId", hql);
}
+
+ // @deprecated, should be used with operand
+ if (nameLike!=null) {
+ appendWhereClause("idProperty.objectName like '"+nameLike+"'
", hql);
+ }
appendOrderByClause(hql);
@@ -151,6 +154,22 @@
}
protected void applyParameters(Query query) {
+ if (id != null) {
+ applyParameterWithOperand(id, "id", String.class, query);
+ }
+
+ if (name != null) {
+ applyParameterWithOperand(name, "name", String.class, query);
+ }
+
+ if (key != null) {
+ applyParameterWithOperand(key, "key", String.class, query);
+ }
+
+ if (deploymentId != null) {
+ applyParameterWithOperand(deploymentId, "deploymentId", Long.class,
query);
+ }
+
}
public List<ProcessDefinition> list() {
@@ -215,4 +234,32 @@
this.page = new Page(firstResult, maxResults);
return this;
}
+
+ public ProcessDefinitionQuery deploymentId(String deploymentId, QueryOperand operand)
{
+ this.deploymentId = deploymentId;
+ parameterOperands.put("deploymentId", operand);
+
+ return this;
+ }
+
+ public ProcessDefinitionQuery processDefinitionId(String processDefinitionId,
QueryOperand operand) {
+ this.id = processDefinitionId;
+ parameterOperands.put("processDefinitionId", operand);
+
+ return this;
+ }
+
+ public ProcessDefinitionQuery processDefinitionKey(String key, QueryOperand operand) {
+ this.key = key;
+ parameterOperands.put("key", operand);
+
+ return this;
+ }
+
+ public ProcessDefinitionQuery processDefinitionName(String name, QueryOperand operand)
{
+ this.name = name;
+ parameterOperands.put("name", operand);
+
+ return this;
+ }
}
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessInstanceQueryImpl.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessInstanceQueryImpl.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessInstanceQueryImpl.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -26,11 +26,13 @@
import org.hibernate.Query;
import org.jbpm.api.ProcessInstance;
import org.jbpm.api.ProcessInstanceQuery;
+import org.jbpm.api.QueryOperand;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.util.CollectionUtil;
/**
* @author Tom Baeyens
+ * @author Maciej Swiderski
*/
public class ProcessInstanceQueryImpl extends AbstractQuery implements
ProcessInstanceQuery {
@@ -40,6 +42,7 @@
protected String processInstanceId;
protected String processInstanceKey;
protected Boolean suspended;
+ protected String initiator;
public ProcessInstance uniqueResult() {
return (ProcessInstance)untypedUniqueResult();
@@ -74,16 +77,20 @@
}
if (processInstanceId != null) {
- appendWhereClause("processInstance.processInstance.id = '" +
processInstanceId+"' ", hql);
+ appendWhereClauseWithOperand("processInstance.processInstance.id",
"processInstanceId", hql);
}
if (processDefinitionId != null) {
- appendWhereClause("processInstance.processDefinitionId = '" +
processDefinitionId+"' ", hql);
+ appendWhereClauseWithOperand("processInstance.processDefinitionId",
"processDefinitionId", hql);
}
if (processInstanceKey != null) {
- appendWhereClause("processInstance.key = '" + processInstanceKey +
"'", hql);
+ appendWhereClauseWithOperand("processInstance.key",
"processInstanceKey", hql);
}
+
+ if (initiator!=null) {
+ appendWhereClauseWithOperand("processInstance.initiator",
"initiator", hql);
+ }
appendOrderByClause(hql);
@@ -91,6 +98,21 @@
}
protected void applyParameters(Query query) {
+ if (processInstanceId != null) {
+ applyParameterWithOperand(processInstanceId, "processInstanceId",
String.class, query);
+ }
+
+ if (processDefinitionId != null) {
+ applyParameterWithOperand(processDefinitionId, "processDefinitionId",
String.class, query);
+ }
+
+ if (processInstanceKey != null) {
+ applyParameterWithOperand(processInstanceKey, "processInstanceKey",
String.class, query);
+ }
+
+ if (initiator!=null) {
+ applyParameterWithOperand(initiator, "initiator", String.class, query);
+ }
}
public ProcessInstanceQuery orderAsc(String property) {
@@ -127,10 +149,44 @@
this.processInstanceKey = processInstanceKey;
return this;
}
+
+ public ProcessInstanceQuery initiator(String user) {
+ this.initiator = user;
+ return this;
+ }
public ProcessInstanceQuery notSuspended() {
this.suspended = false;
return this;
}
+ public String operand(String parameter, QueryOperand operand) {
+ parameterOperands.put(parameter, operand);
+
+ return parameter;
+ }
+
+ public ProcessInstanceQuery processDefinitionId(String processDefinitionId,
QueryOperand operand) {
+ this.processDefinitionId = processDefinitionId;
+ parameterOperands.put("processDefinitionId", operand);
+ return this;
+ }
+
+ public ProcessInstanceQuery processInstanceId(String processInstanceId, QueryOperand
operand) {
+ this.processInstanceId = processInstanceId;
+ parameterOperands.put("processInstanceId", operand);
+ return this;
+ }
+
+ public ProcessInstanceQuery processInstanceKey(String processInstanceKey, QueryOperand
operand) {
+ this.processInstanceKey = processInstanceKey;
+ parameterOperands.put("processInstanceKey", operand);
+ return this;
+ }
+ public ProcessInstanceQuery initiator(String user, QueryOperand operand) {
+ this.initiator = user;
+ parameterOperands.put("initiator", operand);
+
+ return this;
+ }
}
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/TaskQueryImpl.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/TaskQueryImpl.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/TaskQueryImpl.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -30,6 +30,7 @@
import org.hibernate.Session;
import org.jbpm.api.JbpmException;
+import org.jbpm.api.QueryOperand;
import org.jbpm.api.TaskQuery;
import org.jbpm.api.identity.Group;
import org.jbpm.api.task.Task;
@@ -45,6 +46,7 @@
* @author Tom Baeyens
* @author Heiko Braun <heiko.braun(a)jboss.com>
* @author Huisheng Xu
+ * @author Maciej Swiderski
*/
public class TaskQueryImpl extends AbstractQuery implements TaskQuery {
@@ -133,7 +135,7 @@
if (log.isDebugEnabled()) {
log.debug("setting parameter assignee: " + assignee);
}
- query.setString("assignee", assignee);
+ applyParameterWithOperand(assignee, "assignee", String.class, query);
}
// canidate parameter
@@ -156,28 +158,28 @@
if (log.isDebugEnabled()) {
log.debug("setting parameter executionId: " + executionId);
}
- query.setString("executionId", executionId);
+ applyParameterWithOperand(executionId, "executionId", String.class,
query);
}
if (processInstanceId != null) {
if (log.isDebugEnabled()) {
log.debug("setting parameter processInstanceId: " +
processInstanceId);
}
- query.setString("processInstanceId", processInstanceId);
+ applyParameterWithOperand(processInstanceId, "processInstanceId",
String.class, query);
}
if (activityName != null) {
if (log.isDebugEnabled()) {
log.debug("setting parameter activityName: " + activityName);
}
- query.setString("activityName", activityName );
+ applyParameterWithOperand(activityName, "activityName", String.class,
query);
}
if (processDefinitionId != null) {
if (log.isDebugEnabled()) {
log.debug("setting parameter processDefinitionId: " +
processDefinitionId);
}
- query.setString("processDefinitionId", processDefinitionId);
+ applyParameterWithOperand(processDefinitionId, "processDefinitionId",
String.class, query);
}
}
@@ -234,23 +236,23 @@
}
if (executionId != null) {
- appendWhereClause("task.execution.id = :executionId ", hql);
+ appendWhereClauseWithOperand("task.execution.id",
"executionId", hql);
}
if (processInstanceId != null) {
- appendWhereClause("task.processInstance.id = :processInstanceId ", hql);
+ appendWhereClauseWithOperand("task.processInstance.id",
"processInstanceId", hql);
}
if (activityName != null) {
- appendWhereClause("task.execution.activityName = :activityName ", hql);
+ appendWhereClauseWithOperand("task.execution.activityName",
"activityName", hql);
}
if (processDefinitionId != null) {
- appendWhereClause("task.processInstance.processDefinitionId =
:processDefinitionId ", hql);
+ appendWhereClauseWithOperand("task.processInstance.processDefinitionId",
"processDefinitionId", hql);
}
if (assignee != null) {
- appendWhereClause("task.assignee = :assignee ", hql);
+ appendWhereClauseWithOperand("task.assignee", "assignee",
hql);
} else if (unassigned) {
appendWhereClause("task.assignee is null ", hql);
}
@@ -295,4 +297,39 @@
public Task uniqueResult() {
return (Task) untypedUniqueResult();
}
+
+ public TaskQuery activityName(String activityName, QueryOperand operand) {
+ this.activityName = activityName;
+ parameterOperands.put("activityName", operand);
+
+ return this;
+ }
+
+ public TaskQuery assignee(String userId, QueryOperand operand) {
+ this.assignee = userId;
+ parameterOperands.put("assignee", operand);
+
+ return this;
+ }
+
+ public TaskQuery executionId(String executionId, QueryOperand operand) {
+ this.executionId = executionId;
+ parameterOperands.put("executionId", operand);
+
+ return this;
+ }
+
+ public TaskQuery processDefinitionId(String processDefinitionId, QueryOperand operand)
{
+ this.processDefinitionId = processDefinitionId;
+ parameterOperands.put("processDefinitionId", operand);
+
+ return this;
+ }
+
+ public TaskQuery processInstanceId(String processInstanceId, QueryOperand operand) {
+ this.processInstanceId = processInstanceId;
+ parameterOperands.put("processInstanceId", operand);
+
+ return this;
+ }
}
Modified:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/subprocess/SubProcessEndTest.java
===================================================================
---
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/subprocess/SubProcessEndTest.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/subprocess/SubProcessEndTest.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -28,7 +28,10 @@
import java.util.List;
import java.util.Map;
+import org.jbpm.api.Execution;
import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.QueryOperand;
+import org.jbpm.api.history.HistoryProcessInstance;
import org.jbpm.api.task.Task;
import org.jbpm.test.JbpmTestCase;
@@ -54,14 +57,28 @@
super.tearDown();
}
+ @SuppressWarnings("unchecked")
public void testSubProcessJoinEnd() {
ProcessInstance processInstance =
executionService.startProcessInstanceByKey("mp");
+ String execIdSp1 =
((List<Execution>)processInstance.getExecutions()).get(0).getId();
+ String execIdSp2 =
((List<Execution>)processInstance.getExecutions()).get(1).getId();
+
List<Task> taskList = taskService.findPersonalTasks("v");
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("result", "reject");
taskService.setVariables(taskList.get(0).getId(), variables);
taskService.completeTask(taskList.get(0).getId());
- this.assertTrue(true);
+
+
+ List<HistoryProcessInstance> history =
historyService.createHistoryProcessInstanceQuery().processInstanceId("sp2%",
QueryOperand.LIKE).list();
+ assertNotNull(history);
+ assertNotNull(history.get(0).getSuperProcessInstanceId());
+ assertEquals(execIdSp2, history.get(0).getSuperProcessInstanceId());
+
+ history =
historyService.createHistoryProcessInstanceQuery().processInstanceId("sp1%",
QueryOperand.LIKE).list();
+ assertNotNull(history);
+ assertNotNull(history.get(0).getSuperProcessInstanceId());
+ assertEquals(execIdSp1, history.get(0).getSuperProcessInstanceId());
}
}
Modified:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/subprocess/SubProcessTest.java
===================================================================
---
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/subprocess/SubProcessTest.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/subprocess/SubProcessTest.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -24,12 +24,11 @@
*/
package org.jbpm.test.activity.subprocess;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.List;
-import org.eclipse.jdt.internal.compiler.ast.AssertStatement;
-import org.jbpm.api.JbpmException;
import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.QueryOperand;
+import org.jbpm.api.history.HistoryProcessInstance;
import org.jbpm.api.task.Task;
import org.jbpm.test.JbpmTestCase;
@@ -136,5 +135,34 @@
assertEquals(0, executionService.createProcessInstanceQuery().list().size());
}
+
+ public void testSubProcessHistoryIds() {
+ deployJpdlXmlString(SUB_PROCESS);
+ deployJpdlXmlString(MAIN_PROCESS);
+ processEngine.setAuthenticatedUserId("mike");
+ ProcessInstance processInstance =
executionService.startProcessInstanceByKey("mainProcess");
+ assertEquals(2, executionService.createProcessInstanceQuery().list().size());
+
+ Task task = taskService.findPersonalTasks("johndoe").get(0);
+ taskService.completeTask(task.getId(), "nok");
+ assertActivityActive(processInstance.getId(), "update");
+
+ processInstance = executionService.signalExecutionById(processInstance.getId());
+
+ assertProcessInstanceEnded(processInstance);
+ assertEquals(0, executionService.createProcessInstanceQuery().list().size());
+
+
+ List<HistoryProcessInstance> history =
historyService.createHistoryProcessInstanceQuery().processInstanceId("SubProcessReview%",
QueryOperand.LIKE).list();
+ assertNotNull(history);
+ assertNotNull(history.get(0).getSuperProcessInstanceId());
+ assertEquals(processInstance.getId(), history.get(0).getSuperProcessInstanceId());
+
+ history =
historyService.createHistoryProcessInstanceQuery().superProcessInstanceId(processInstance.getId()).list();
+ assertNotNull(history);
+ assertNotNull(history.get(0).getSuperProcessInstanceId());
+ assertEquals(processInstance.getId(), history.get(0).getSuperProcessInstanceId());
+ }
+
}
Modified:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/DeploymentQueryTest.java
===================================================================
---
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/DeploymentQueryTest.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/DeploymentQueryTest.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -28,6 +28,7 @@
import org.jbpm.api.Deployment;
import org.jbpm.api.DeploymentQuery;
+import org.jbpm.api.QueryOperand;
import org.jbpm.test.JbpmTestCase;
import org.jbpm.test.assertion.QueryAssertions;
@@ -113,6 +114,42 @@
deleteCascade(deploymentIds);
}
+ public void testEquals() {
+ List<String> deploymentIds = deployTestProcesses();
+
+ assertEquals(1,
repositoryService.createDeploymentQuery().deploymentId(deploymentIds.get(0),
QueryOperand.EQUALS).count());
+
+
+ deleteCascade(deploymentIds);
+ }
+
+ public void testLike() {
+ List<String> deploymentIds = deployTestProcesses();
+
+ assertEquals(1,
repositoryService.createDeploymentQuery().deploymentId(deploymentIds.get(0),
QueryOperand.LIKE).count());
+
+
+ deleteCascade(deploymentIds);
+ }
+
+ public void testIn() {
+ List<String> deploymentIds = deployTestProcesses();
+
+ assertEquals(2,
repositoryService.createDeploymentQuery().deploymentId(deploymentIds.get(0) +
","+deploymentIds.get(1), QueryOperand.IN).count());
+
+
+ deleteCascade(deploymentIds);
+ }
+
+ public void testNotIn() {
+ List<String> deploymentIds = deployTestProcesses();
+
+ assertEquals(2,
repositoryService.createDeploymentQuery().deploymentId(deploymentIds.get(0),
QueryOperand.NOT_IN).count());
+
+
+ deleteCascade(deploymentIds);
+ }
+
/* --------------
* HELPER METHODS
* -------------- */
Modified:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryActivityInstanceQueryTest.java
===================================================================
---
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryActivityInstanceQueryTest.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryActivityInstanceQueryTest.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -30,6 +30,7 @@
import org.jbpm.api.ProcessDefinition;
import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.QueryOperand;
import org.jbpm.api.history.HistoryActivityInstance;
import org.jbpm.api.history.HistoryActivityInstanceQuery;
import org.jbpm.pvm.internal.util.Clock;
@@ -104,6 +105,79 @@
assertEquals(1,
historyService.createHistoryActivityInstanceQuery().executionId(ids.get(3)).list().size());
}
+ public void testQueryByExecutionIdLike() {
+ deployStartAndSignalTestProcesses();
+
+ assertEquals(9,
historyService.createHistoryActivityInstanceQuery().executionId("abc%",
QueryOperand.LIKE).list().size());
+
+ }
+
+ public void testQueryByExecutionIdIn() {
+ List<String> ids = deployStartAndSignalTestProcesses();
+
+ assertEquals(6,
historyService.createHistoryActivityInstanceQuery().executionId(ids.get(0) + ","
+ ids.get(1), QueryOperand.IN).list().size());
+
+ }
+
+ public void testQueryByExecutionIdNotIn() {
+ List<String> ids = deployStartAndSignalTestProcesses();
+
+ assertEquals(3,
historyService.createHistoryActivityInstanceQuery().executionId(ids.get(0) + ","
+ ids.get(1), QueryOperand.NOT_IN).list().size());
+
+ }
+
+ public void testQueryByProcessInstanceIdLike() {
+ deployStartAndSignalTestProcesses();
+
+ assertEquals(9,
historyService.createHistoryActivityInstanceQuery().processInstanceId("abc%",
QueryOperand.LIKE).list().size());
+
+ }
+
+ public void testQueryByProcessInstanceIdIn() {
+ List<String> ids = deployStartAndSignalTestProcesses();
+
+ assertEquals(6,
historyService.createHistoryActivityInstanceQuery().processInstanceId(ids.get(0) +
"," + ids.get(1), QueryOperand.IN).list().size());
+
+ }
+
+ public void testQueryByProcessInstanceIdNotIn() {
+ List<String> ids = deployStartAndSignalTestProcesses();
+
+ assertEquals(3,
historyService.createHistoryActivityInstanceQuery().processInstanceId(ids.get(0) +
"," + ids.get(1), QueryOperand.NOT_IN).list().size());
+
+ }
+
+ public void testQueryByProcessDefinitionIdLike() {
+ deployStartAndSignalTestProcesses();
+ deployTestProcessWithTask();
+ generateHistoryForTestProcessWithTask();
+ deployTestProcessWithTask();
+
+ assertEquals(12,
historyService.createHistoryActivityInstanceQuery().processInstanceId("abc%",
QueryOperand.LIKE).list().size());
+
+ }
+
+ public void testQueryByProcessDefinitionIdIn() {
+ deployStartAndSignalTestProcesses();
+ deployTestProcessWithTask();
+ List<String> idsTask = generateHistoryForTestProcessWithTask();
+ List<String> ids = deployStartAndSignalTestProcesses();
+
+
+ assertEquals(6,
historyService.createHistoryActivityInstanceQuery().processInstanceId(ids.get(0) +
"," + idsTask.get(0), QueryOperand.IN).list().size());
+
+ }
+
+ public void testQueryByProcessDefinitionIdNotIn() {
+ deployStartAndSignalTestProcesses();
+ deployTestProcessWithTask();
+ List<String> idsTask = generateHistoryForTestProcessWithTask();
+ List<String> ids = deployStartAndSignalTestProcesses();
+
+ assertEquals(15,
historyService.createHistoryActivityInstanceQuery().processInstanceId(ids.get(0) +
"," + idsTask.get(0), QueryOperand.NOT_IN).list().size());
+
+ }
+
// Currently only verifies the size of the result set
public void testQueryByStartedAfter() {
deployTestProcess();
@@ -146,6 +220,24 @@
assertEquals(2,
historyService.createHistoryActivityInstanceQuery().activityName("c").list().size());
}
+ public void testQueryByActivityNameLike() {
+ deployStartAndSignalTestProcesses();
+ assertEquals(9,
historyService.createHistoryActivityInstanceQuery().activityName("%",
QueryOperand.LIKE).list().size());
+
+ }
+
+ public void testQueryByActivityNameIn() {
+ deployStartAndSignalTestProcesses();
+ assertEquals(6,
historyService.createHistoryActivityInstanceQuery().activityName("a,c",
QueryOperand.IN).list().size());
+
+ }
+
+ public void testQueryByActivityNameNotIn() {
+ deployStartAndSignalTestProcesses();
+ assertEquals(2,
historyService.createHistoryActivityInstanceQuery().activityName("a,b",
QueryOperand.NOT_IN).list().size());
+
+ }
+
//Currently only verifies the size of the result set
public void testQueryByTookLessThen() {
deployStartAndSignalTestProcesses();
Modified:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryProcessInstanceQueryTest.java
===================================================================
---
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryProcessInstanceQueryTest.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryProcessInstanceQueryTest.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -30,6 +30,7 @@
import java.util.List;
import org.jbpm.api.ProcessDefinition;
+import org.jbpm.api.QueryOperand;
import org.jbpm.api.history.HistoryProcessInstance;
import org.jbpm.api.history.HistoryProcessInstanceQuery;
import org.jbpm.pvm.internal.util.Clock;
@@ -86,7 +87,115 @@
.count());
}
}
+
+ public void testQueryByProcessInstanceIdLike() {
+ createTestHistoryProcessInstances(7);
+ assertEquals(7, historyService.createHistoryProcessInstanceQuery()
+ .processInstanceId("theProcess%", QueryOperand.LIKE)
+ .count());
+
+ }
+
+ public void testQueryByProcessInstanceIdIn() {
+ List<String> procInstIds = createTestHistoryProcessInstances(7);
+
+ assertEquals(2, historyService.createHistoryProcessInstanceQuery()
+ .processInstanceId(procInstIds.get(0) + "," + procInstIds.get(1),
QueryOperand.IN)
+ .count());
+
+ }
+
+ public void testQueryByProcessInstanceIdNotIn() {
+ List<String> procInstIds = createTestHistoryProcessInstances(7);
+
+ assertEquals(5, historyService.createHistoryProcessInstanceQuery()
+ .processInstanceId(procInstIds.get(0) + "," + procInstIds.get(1),
QueryOperand.NOT_IN)
+ .count());
+
+ }
+
+ public void testQueryByProcessInstanceKeyLike() {
+ createTestHistoryProcessInstances(7);
+
+ assertEquals(7, historyService.createHistoryProcessInstanceQuery()
+ .processInstanceKey("theProcess-%", QueryOperand.LIKE)
+ .count());
+
+ }
+
+ public void testQueryByProcessInstanceKeyIn() {
+ createTestHistoryProcessInstances(7);
+
+ assertEquals(2, historyService.createHistoryProcessInstanceQuery()
+ .processInstanceKey("theProcess-1,theProcess-5", QueryOperand.IN)
+ .count());
+
+ }
+
+ public void testQueryByProcessInstanceKeyNotIn() {
+ createTestHistoryProcessInstances(7);
+
+ assertEquals(4, historyService.createHistoryProcessInstanceQuery()
+ .processInstanceKey("theProcess-1,theProcess-5,theProcess-6",
QueryOperand.NOT_IN)
+ .count());
+
+ }
+
+ public void testQueryByInitiator() {
+
+ deployJpdlXmlString("<process name='theProcess'>"
+ + " <start>"
+ + " <transition to='wait' />"
+ + " </start>"
+ + " <state name='wait'>"
+ + " <transition to='end' />"
+ + " </state>"
+ + " <end name='end' />"
+ + "</process>");
+
+ processEngine.setAuthenticatedUserId("mike");
+ executionService.startProcessInstanceByKey("theProcess");
+ processEngine.setAuthenticatedUserId("alex");
+ executionService.startProcessInstanceByKey("theProcess");
+ processEngine.setAuthenticatedUserId("erik");
+ executionService.startProcessInstanceByKey("theProcess");
+ processEngine.setAuthenticatedUserId("peter");
+ executionService.startProcessInstanceByKey("theProcess");
+
+ assertEquals(1,
historyService.createHistoryProcessInstanceQuery().initiator("peter").count());
+ assertEquals(1,
historyService.createHistoryProcessInstanceQuery().initiator("erik").count());
+ assertEquals(1,
historyService.createHistoryProcessInstanceQuery().initiator("mike").count());
+ assertEquals(1,
historyService.createHistoryProcessInstanceQuery().initiator("alex").count());
+
+ }
+
+ public void testQueryByInitiatorLike() {
+
+ deployJpdlXmlString("<process name='theProcess'>"
+ + " <start>"
+ + " <transition to='wait' />"
+ + " </start>"
+ + " <state name='wait'>"
+ + " <transition to='end' />"
+ + " </state>"
+ + " <end name='end' />"
+ + "</process>");
+
+ processEngine.setAuthenticatedUserId("mike");
+ executionService.startProcessInstanceByKey("theProcess");
+ processEngine.setAuthenticatedUserId("alex");
+ executionService.startProcessInstanceByKey("theProcess");
+ processEngine.setAuthenticatedUserId("erik");
+ executionService.startProcessInstanceByKey("theProcess");
+ processEngine.setAuthenticatedUserId("peter");
+ executionService.startProcessInstanceByKey("theProcess");
+
+ assertEquals(4,
historyService.createHistoryProcessInstanceQuery().initiator("%e%",
QueryOperand.LIKE).count());
+
+
+ }
+
public void testOrderByStartTime() {
testOrderByNaturalOrdening(HistoryProcessInstanceQuery.PROPERTY_STARTTIME, 4);
}
Modified:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryTaskQueryTest.java
===================================================================
---
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryTaskQueryTest.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryTaskQueryTest.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -32,6 +32,8 @@
import java.util.Date;
import java.util.List;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.QueryOperand;
import org.jbpm.api.history.HistoryTask;
import org.jbpm.api.history.HistoryTaskQuery;
import org.jbpm.pvm.internal.util.Clock;
@@ -104,6 +106,75 @@
.taskId("-1").count());
}
+ public void testAssigneeLike() {
+ createTestHistoryTasks();
+
+ assertEquals(2, historyService.createHistoryTaskQuery().assignee("%o%",
QueryOperand.LIKE).count());
+
+ }
+
+ public void testAssigneeIn() {
+ createTestHistoryTasks();
+
+ assertEquals(2,
historyService.createHistoryTaskQuery().assignee("Tom,Alex",
QueryOperand.IN).count());
+
+ }
+
+ public void testAssigneeNotIn() {
+ createTestHistoryTasks();
+
+ assertEquals(1,
historyService.createHistoryTaskQuery().assignee("Tom,Alex",
QueryOperand.NOT_IN).count());
+
+ }
+
+ public void testTaskIdLike() {
+ createTestHistoryTasks();
+
+ assertEquals(3, historyService.createHistoryTaskQuery().taskId("%",
QueryOperand.LIKE).count());
+
+ }
+
+ public void testTaskIdIn() {
+ List<String> taskIds = createTestHistoryTasks();
+
+ assertEquals(2, historyService.createHistoryTaskQuery().taskId(taskIds.get(0) +
"," + taskIds.get(1), QueryOperand.IN).count());
+
+ }
+
+ public void testTaskIdNotIn() {
+ List<String> taskIds = createTestHistoryTasks();
+
+ assertEquals(1, historyService.createHistoryTaskQuery().taskId(taskIds.get(0) +
"," + taskIds.get(1), QueryOperand.NOT_IN).count());
+
+ }
+
+ public void testExecutionIdLike() {
+ createTestHistoryTasks();
+
+ assertEquals(3,
historyService.createHistoryTaskQuery().executionId("theProcess%",
QueryOperand.LIKE).count());
+
+ }
+ public void testStateLike() {
+ createTestHistoryTasks();
+
+ assertEquals(3, historyService.createHistoryTaskQuery().state("%",
QueryOperand.LIKE).count());
+
+ }
+
+ public void testStateIn() {
+ createTestHistoryTasks();
+
+ assertEquals(3,
historyService.createHistoryTaskQuery().state(HistoryTask.STATE_COMPLETED + ","
+ HistoryTask.STATE_OBSOLETE, QueryOperand.IN).count());
+
+ }
+
+ public void testStateNotIn() {
+ createTestHistoryTasks();
+
+ assertEquals(0,
historyService.createHistoryTaskQuery().state(HistoryTask.STATE_COMPLETED + ","
+ HistoryTask.STATE_OBSOLETE, QueryOperand.NOT_IN).count());
+
+ }
+
@SuppressWarnings("unchecked")
private void testOrderBy(String property, List expectedValues,
Integer expectedNrOfResults, boolean naturalOrderCheck) {
@@ -163,6 +234,126 @@
return taskIds;
}
+ public void testHistoryTaskQuerySingleTaskByProcessId() {
+ deployJpdlXmlString(
+ "<process name='TaskAssignee'>" +
+ " <start>" +
+ " <transition to='review' />" +
+ " </start>" +
+ " <task name='review' " +
+ " assignee='johndoe'>" +
+ " <transition to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ ProcessInstance pi =
executionService.startProcessInstanceByKey("TaskAssignee");
+
+
taskService.completeTask(taskService.findPersonalTasks("johndoe").get(0).getId());
+
+ HistoryTask task =
historyService.createHistoryTaskQuery().processInstanceId(pi.getId()).uniqueResult();
+ assertNotNull(task.getName());
+ assertEquals("review", task.getName());
+ assertEquals("completed", task.getState());
+
+ }
+
+ public void testHistoryTaskQueryTaskByProcessId() {
+ deployJpdlXmlString(
+ "<process name='TaskAssignee'>" +
+ " <start>" +
+ " <transition to='review' />" +
+ " </start>" +
+ " <task name='review' " +
+ " assignee='johndoe'>" +
+ " <transition to='review-mgmt' />" +
+ " </task>" +
+ " <task name='review-mgmt' " +
+ " assignee='mike'>" +
+ " <transition to='review-top-mgmt' />" +
+ " </task>" +
+ " <task name='review-top-mgmt' " +
+ " assignee='peter'>" +
+ " <transition to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ ProcessInstance pi =
executionService.startProcessInstanceByKey("TaskAssignee");
+
+
taskService.completeTask(taskService.findPersonalTasks("johndoe").get(0).getId());
+
+
taskService.completeTask(taskService.findPersonalTasks("mike").get(0).getId());
+
+
taskService.completeTask(taskService.findPersonalTasks("peter").get(0).getId());
+
+ List<HistoryTask> tasks =
historyService.createHistoryTaskQuery().processInstanceId(pi.getId()).list();
+ assertNotNull(tasks);
+ assertEquals(3, tasks.size());
+
+ String[] expectedTasks = new String[] {"review", "review-mgmt",
"review-top-mgmt"};
+ String[] expectedAssignees = new String[] {"johndoe", "mike",
"peter"};
+ int i = 0;
+ for (HistoryTask task : tasks) {
+ assertEquals(expectedTasks[i], task.getName());
+ assertEquals(expectedAssignees[i], task.getAssignee());
+ assertEquals("completed", task.getState());
+ i++;
+ }
+
+ }
+
+ public void testHistoryTaskQueryTaskByProcessIdWithTimer() {
+ deployJpdlXmlString(
+ "<process name='TaskAssignee'>" +
+ " <start>" +
+ " <transition to='review' />" +
+ " </start>" +
+ " <task name='review' " +
+ " assignee='johndoe'>" +
+ " <transition to='review-mgmt' />" +
+ " <transition name='lunch' to='wait'>" +
+ " <timer duedate='10 seconds' />" +
+ " </transition>" +
+ " </task>" +
+ " <task name='review-mgmt' " +
+ " assignee='mike'>" +
+ " <transition to='review-top-mgmt' />" +
+ " </task>" +
+ " <task name='review-top-mgmt' " +
+ " assignee='peter'>" +
+ " <transition to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ ProcessInstance pi =
executionService.startProcessInstanceByKey("TaskAssignee");
+
+
taskService.completeTask(taskService.findPersonalTasks("johndoe").get(0).getId());
+
+
taskService.completeTask(taskService.findPersonalTasks("mike").get(0).getId());
+
+
taskService.completeTask(taskService.findPersonalTasks("peter").get(0).getId());
+
+ List<HistoryTask> tasks =
historyService.createHistoryTaskQuery().processInstanceId(pi.getId()).list();
+ assertNotNull(tasks);
+ assertEquals(3, tasks.size());
+
+ String[] expectedTasks = new String[] {"review", "review-mgmt",
"review-top-mgmt"};
+ String[] expectedAssignees = new String[] {"johndoe", "mike",
"peter"};
+ int i = 0;
+ for (HistoryTask task : tasks) {
+ assertEquals(expectedTasks[i], task.getName());
+ assertEquals(expectedAssignees[i], task.getAssignee());
+ assertEquals("completed", task.getState());
+ i++;
+ }
+
+ }
+
private Date stringToDate(String dateString) {
DateFormat dateFormat = new SimpleDateFormat("dd/mm/yyyy");
try {
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/JobQueryTest.java
===================================================================
---
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/JobQueryTest.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/JobQueryTest.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -26,6 +26,7 @@
import java.util.List;
import org.jbpm.api.JobQuery;
+import org.jbpm.api.QueryOperand;
import org.jbpm.api.job.Job;
import org.jbpm.test.JbpmTestCase;
import org.jbpm.test.assertion.QueryAssertions;
@@ -143,6 +144,38 @@
}
+ public void testProcessIdLike() {
+ startTestProcessInstances(6);
+
+ JobQuery query = managementService.createJobQuery();
+ assertEquals(6, query.processInstanceId("TimerQueryTest%",
QueryOperand.LIKE).count());
+
+ }
+
+ public void testProcessIdEquals() {
+ List<String> procInstIds = startTestProcessInstances(6);
+
+ JobQuery query = managementService.createJobQuery();
+ assertEquals(1, query.processInstanceId(procInstIds.get(0),
QueryOperand.EQUALS).count());
+
+ }
+
+ public void testProcessIdIn() {
+ List<String> procInstIds = startTestProcessInstances(6);
+
+ JobQuery query = managementService.createJobQuery();
+ assertEquals(2,
query.processInstanceId(""+procInstIds.get(0)+","+procInstIds.get(1)+"",
QueryOperand.IN).count());
+
+ }
+
+ public void testProcessIdNotIn() {
+ List<String> procInstIds = startTestProcessInstances(6);
+
+ JobQuery query = managementService.createJobQuery();
+ assertEquals(4,
query.processInstanceId(""+procInstIds.get(0)+","+procInstIds.get(1)+"",
QueryOperand.NOT_IN).count());
+
+ }
+
private List<String> startTestProcessInstances(int nrOfInstances) {
deployJpdlXmlString(
"<process name='TimerQueryTest' >" +
Modified:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/ProcessDefinitionQueryTest.java
===================================================================
---
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/ProcessDefinitionQueryTest.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/ProcessDefinitionQueryTest.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -25,6 +25,7 @@
import org.jbpm.api.ProcessDefinition;
import org.jbpm.api.ProcessDefinitionQuery;
+import org.jbpm.api.QueryOperand;
import org.jbpm.test.JbpmTestCase;
@@ -135,4 +136,127 @@
assertEquals("make_friends-3", processDefinitions.get(2).getId());
assertEquals("make_print-1", processDefinitions.get(3).getId());
}
+
+ public void testQueryProcessDefinitionsLike() {
+ deployJpdlXmlString(
+ "<process name='make print'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='use phone'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='make friends'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='clean whiteboard'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='fix coffeemaker'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ List<ProcessDefinition> processDefinitions =
+
repositoryService.createProcessDefinitionQuery().processDefinitionName("%make%",
QueryOperand.LIKE)
+ .orderAsc(ProcessDefinitionQuery.PROPERTY_NAME)
+ .list();
+
+ assertEquals("fix coffeemaker", processDefinitions.get(0).getName());
+ assertEquals("make friends", processDefinitions.get(1).getName());
+ assertEquals("make print", processDefinitions.get(2).getName());
+ }
+
+ public void testQueryProcessDefinitionsIn() {
+ String dbId1 = deployJpdlXmlString(
+ "<process name='make print'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ String dbId2 = deployJpdlXmlString(
+ "<process name='use phone'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='make friends'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='clean whiteboard'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='fix coffeemaker'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
+ List<ProcessDefinition> processDefinitions =
+ query.deploymentId(dbId1+","+dbId2, QueryOperand.IN)
+ .orderAsc(ProcessDefinitionQuery.PROPERTY_NAME)
+ .list();
+
+ assertEquals(2, processDefinitions.size());
+
+ }
+
+ public void testQueryProcessDefinitionsNotIn() {
+ String dbId1 = deployJpdlXmlString(
+ "<process name='make print'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ String dbId2 = deployJpdlXmlString(
+ "<process name='use phone'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='make friends'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='clean whiteboard'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='fix coffeemaker'>" +
+ " <start />" +
+ "</process>"
+ );
+
+
+ List<ProcessDefinition> processDefinitions =
+
repositoryService.createProcessDefinitionQuery().deploymentId(dbId1+","+dbId2,
QueryOperand.NOT_IN)
+ .orderAsc(ProcessDefinitionQuery.PROPERTY_NAME)
+ .list();
+
+ assertEquals(3, processDefinitions.size());
+
+ }
}
Modified:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/ProcessInstanceQueryTest.java
===================================================================
---
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/ProcessInstanceQueryTest.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/ProcessInstanceQueryTest.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -31,6 +31,8 @@
import org.jbpm.api.ProcessDefinition;
import org.jbpm.api.ProcessInstance;
import org.jbpm.api.ProcessInstanceQuery;
+import org.jbpm.api.QueryOperand;
+import org.jbpm.api.history.HistoryProcessInstance;
import org.jbpm.test.JbpmTestCase;
@@ -217,6 +219,126 @@
}
+ public void testProcessInstanceLike() {
+ startTestProcesses(4, 6);
+
+ assertEquals(10, executionService.createProcessInstanceQuery().count());
+
+ assertEquals(4,
executionService.createProcessInstanceQuery().processInstanceId("testProcess1.%",
QueryOperand.LIKE).count());
+
+ assertEquals(6,
executionService.createProcessInstanceQuery().processInstanceId("testProcess2.%",
QueryOperand.LIKE).count());
+ }
+
+ public void testProcessDefinitionLike() {
+ startTestProcesses(4, 6);
+
+ assertEquals(10, executionService.createProcessInstanceQuery().count());
+
+ assertEquals(10,
executionService.createProcessInstanceQuery().processDefinitionId("testProcess%",
QueryOperand.LIKE).count());
+
+ }
+
+ public void testProcessInstanceKeyLike() {
+ startTestProcesses(4, 6);
+
+ assertEquals(10, executionService.createProcessInstanceQuery().count());
+
+ assertEquals(4,
executionService.createProcessInstanceQuery().processInstanceKey("testProcess1-%",
QueryOperand.LIKE).count());
+
+ }
+
+ public void testProcessInstanceIn() {
+ Map<String, ArrayList<String>> processInstanceIds = startTestProcesses(4,
6);
+ List<String> idsForTestProcess1 = processInstanceIds.get(TEST_PROCESS_1_KEY);
+ List<String> idsForTestProcess2 = processInstanceIds.get(TEST_PROCESS_2_KEY);
+
+ assertEquals(10, executionService.createProcessInstanceQuery().count());
+
+ assertEquals(2,
executionService.createProcessInstanceQuery().processInstanceId(idsForTestProcess1.get(0)
+ "," + idsForTestProcess1.get(1), QueryOperand.IN).count());
+
+ assertEquals(2,
executionService.createProcessInstanceQuery().processInstanceId(idsForTestProcess2.get(0)
+ "," + idsForTestProcess2.get(1), QueryOperand.IN).count());
+ }
+
+ public void testProcessDefinitionIn() {
+ startTestProcesses(4, 6);
+
+ assertEquals(10, executionService.createProcessInstanceQuery().count());
+
+ assertEquals(4,
executionService.createProcessInstanceQuery().processDefinitionId("testProcess1-1,testProcess2",
QueryOperand.IN).count());
+
+ }
+
+ public void testProcessInstanceKeyIn() {
+ startTestProcesses(4, 6);
+
+ assertEquals(10, executionService.createProcessInstanceQuery().count());
+
+ assertEquals(2,
executionService.createProcessInstanceQuery().processInstanceKey("testProcess1-0,testProcess1-1",
QueryOperand.IN).count());
+
+ }
+
+ public void testProcessInstanceNotIn() {
+ Map<String, ArrayList<String>> processInstanceIds = startTestProcesses(4,
6);
+ List<String> idsForTestProcess1 = processInstanceIds.get(TEST_PROCESS_1_KEY);
+ List<String> idsForTestProcess2 = processInstanceIds.get(TEST_PROCESS_2_KEY);
+
+ assertEquals(10, executionService.createProcessInstanceQuery().count());
+
+ assertEquals(8,
executionService.createProcessInstanceQuery().processInstanceId(idsForTestProcess1.get(0)
+ "," + idsForTestProcess1.get(1), QueryOperand.NOT_IN).count());
+
+ assertEquals(8,
executionService.createProcessInstanceQuery().processInstanceId(idsForTestProcess2.get(0)
+ "," + idsForTestProcess2.get(1), QueryOperand.NOT_IN).count());
+ }
+
+ public void testProcessDefinitionNotIn() {
+ startTestProcesses(4, 6);
+
+ assertEquals(10, executionService.createProcessInstanceQuery().count());
+
+ assertEquals(6,
executionService.createProcessInstanceQuery().processDefinitionId("testProcess1-1,testProcess2",
QueryOperand.NOT_IN).count());
+
+ }
+
+ public void testProcessInstanceKeyNotIn() {
+ startTestProcesses(4, 6);
+
+ assertEquals(10, executionService.createProcessInstanceQuery().count());
+
+ assertEquals(8,
executionService.createProcessInstanceQuery().processInstanceKey("testProcess1-0,testProcess1-1",
QueryOperand.NOT_IN).count());
+
+ }
+
+ public void testQueryByProcessInstanceIdWithInitiator() {
+ deployJpdlXmlString(TEST_PROCESS_1);
+ deployJpdlXmlString(TEST_PROCESS_2);
+
+ processEngine.setAuthenticatedUserId("mike");
+ ProcessInstance pi = executionService.startProcessInstanceByKey(TEST_PROCESS_1_KEY);
+
+ processEngine.setAuthenticatedUserId("alex");
+ ProcessInstance pi2 =
executionService.startProcessInstanceByKey(TEST_PROCESS_2_KEY);
+
+ assertEquals(2,
executionService.createProcessInstanceQuery().initiator("%e%",
QueryOperand.LIKE).count());
+
+ assertNotNull(pi.getInitiator());
+ assertEquals("mike", pi.getInitiator());
+
+ assertNotNull(pi2.getInitiator());
+ assertEquals("alex", pi2.getInitiator());
+
+ HistoryProcessInstance historypi =
historyService.createHistoryProcessInstanceQuery().processInstanceId(pi.getId()).uniqueResult();
+ assertNotNull(historypi.getInitiator());
+ assertEquals("mike", historypi.getInitiator());
+
+ historypi =
historyService.createHistoryProcessInstanceQuery().processInstanceId(pi2.getId()).uniqueResult();
+ assertNotNull(historypi.getInitiator());
+ assertEquals("alex", historypi.getInitiator());
+
+ historypi =
historyService.createHistoryProcessInstanceQuery().initiator("mike").uniqueResult();
+ assertNotNull(historypi);
+
+ assertEquals(2,
historyService.createHistoryProcessInstanceQuery().initiator("%e%",
QueryOperand.LIKE).count());
+ }
+
/**
* Returns a map containing a processKey - processInstanceId mapping.
* eg. TEST_PROCESS_1 - {"1", "5", "7", "8"}
Modified:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/TaskQueryTest.java
===================================================================
---
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/TaskQueryTest.java 2010-08-31
05:05:48 UTC (rev 6636)
+++
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/TaskQueryTest.java 2010-08-31
17:35:24 UTC (rev 6637)
@@ -29,6 +29,7 @@
import java.util.Date;
import java.util.List;
+import org.jbpm.api.QueryOperand;
import org.jbpm.api.TaskQuery;
import org.jbpm.api.task.Task;
import org.jbpm.test.JbpmTestCase;
@@ -132,7 +133,31 @@
deleteTasks(tasks);
}
+ public void testTaskQueryAssigneeLike() {
+ List<Task> tasks = createTestTasks();
+
+ assertEquals(2, taskService.createTaskQuery().assignee("%o%m",
QueryOperand.LIKE).count());
+
+ deleteTasks(tasks);
+ }
+ public void testTaskQueryAssigneeIn() {
+ List<Task> tasks = createTestTasks();
+
+ assertEquals(2, taskService.createTaskQuery().assignee("Koen,Tom",
QueryOperand.IN).count());
+
+ deleteTasks(tasks);
+ }
+
+ public void testTaskQueryAssigneeNotIn() {
+ List<Task> tasks = createTestTasks();
+
+ assertEquals(1, taskService.createTaskQuery().assignee("Koen,Tom,Alex",
QueryOperand.NOT_IN).count());
+
+ deleteTasks(tasks);
+ }
+
+
/* -------------------------------------------------------------------
* HELPER METHODS
* ------------------------------------------------------------------- */