[jbpm-commits] JBoss JBPM SVN: r6036 - in jbpm4/trunk/modules: api/src/main/java/org/jbpm/api/history and 2 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Dec 23 10:17:14 EST 2009


Author: tom.baeyens at jboss.com
Date: 2009-12-23 10:17:13 -0500 (Wed, 23 Dec 2009)
New Revision: 6036

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/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/ProcessInstanceQueryTest.java
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/TaskQueryTest.java
Log:
JBPM-2567 changed return type of queries .count() from Long to long

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	2009-12-23 15:14:21 UTC (rev 6035)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/DeploymentQuery.java	2009-12-23 15:17:13 UTC (rev 6036)
@@ -38,17 +38,26 @@
   /** only select suspended deployments */
   DeploymentQuery suspended();
   
+  /** only select non-suspended deployments */
   DeploymentQuery notSuspended();
 
+  /** order results ascending for property {@link #PROPERTY_TIMESTAMP} 
+   * or {@link #PROPERTY_STATE} */
   DeploymentQuery orderAsc(String property);
+
+  /** order results descending for property {@link #PROPERTY_TIMESTAMP} 
+   * or {@link #PROPERTY_STATE} */
   DeploymentQuery orderDesc(String property);
 
+  /** only select a specific page */ 
   DeploymentQuery page(int firstResult, int maxResults);
   
+  /** execute the query and get the result list */ 
   List<Deployment> list();
   
+  /** execute the query and get the unique result */ 
   Deployment uniqueResult();
   
-  /** Returns the count for this query. */
-  Long count();
+  /** 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	2009-12-23 15:14:21 UTC (rev 6035)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/JobQuery.java	2009-12-23 15:17:13 UTC (rev 6036)
@@ -70,7 +70,6 @@
   /** execute the query and get the unique result */ 
   Job uniqueResult();
   
-  /** Returns the count for the query. */
-  Long count();
-  
+  /** execute a count(*) query and returns number of results */ 
+  long count();
 }

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	2009-12-23 15:14:21 UTC (rev 6035)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ProcessDefinitionQuery.java	2009-12-23 15:17:13 UTC (rev 6036)
@@ -77,4 +77,6 @@
   /** execute the query and obtain the unique {@link ProcessDefinition} */
   ProcessDefinition uniqueResult();
   
+  /** execute a count(*) query and returns number of results */ 
+  long count();
 }

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	2009-12-23 15:14:21 UTC (rev 6035)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ProcessInstanceQuery.java	2009-12-23 15:17:13 UTC (rev 6036)
@@ -63,7 +63,6 @@
   /** execute the query and obtain the unique {@link ProcessInstance} */
   ProcessInstance uniqueResult();
   
-  /** execute the query and return the count */
-  Long count();
-  
+  /** execute a count(*) query and returns number of results */ 
+  long count();
 }

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	2009-12-23 15:14:21 UTC (rev 6035)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/TaskQuery.java	2009-12-23 15:17:13 UTC (rev 6036)
@@ -83,8 +83,8 @@
   /** order selected tasks descending for certain {@link #PROPERTY_NAME properties} */
   TaskQuery orderDesc(String property);
   
-  /** does a count(*) on the given query. */
-  Long count();
+  /** execute a count(*) query and returns number of results */ 
+  long count();
   
   /** execute the query and obtain the list of {@link Task}s */
   List<Task> list();

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	2009-12-23 15:14:21 UTC (rev 6035)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryActivityInstanceQuery.java	2009-12-23 15:17:13 UTC (rev 6036)
@@ -79,6 +79,6 @@
   /** execute the query and obtain the unique {@link HistoryActivityInstance} */
   HistoryActivityInstance uniqueResult();
   
-  /** Returns the count of this query. */
-  Long count();
+  /** execute a count(*) query and returns number of results */ 
+  long count();
 }

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	2009-12-23 15:14:21 UTC (rev 6035)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryDetailQuery.java	2009-12-23 15:17:13 UTC (rev 6036)
@@ -70,4 +70,6 @@
   /** execute the query and obtain the unique {@link HistoryDetail} */
   HistoryDetail uniqueResult();
 
+  /** execute a count(*) query and returns number of results */ 
+  long count();
 }

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	2009-12-23 15:14:21 UTC (rev 6035)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryProcessInstanceQuery.java	2009-12-23 15:17:13 UTC (rev 6036)
@@ -70,7 +70,6 @@
   /** execute the query and obtain the unique {@link HistoryProcessInstance} */
   HistoryProcessInstance uniqueResult();
   
-  /** Return the count of the query. */
-  Long count();
-  
+  /** execute a count(*) query and returns number of results */ 
+  long count();
 }

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	2009-12-23 15:14:21 UTC (rev 6035)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryTaskQuery.java	2009-12-23 15:17:13 UTC (rev 6036)
@@ -90,7 +90,6 @@
   /** execute the query and obtain the unique {@link HistoryTask} */
   HistoryTask uniqueResult();
   
-  /** Return the count for this query. */
-  Long count();
-  
+  /** execute a count(*) query and returns number of results */ 
+  long count();
 }

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	2009-12-23 15:14:21 UTC (rev 6035)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/AbstractQuery.java	2009-12-23 15:17:13 UTC (rev 6036)
@@ -118,7 +118,7 @@
    *   - add the operation signature to their interface
    *   - use the 'count' variable in their hql() method.
    */
-  public Long count() {
+  public long count() {
     count = true;
     
     // Page and count cannot be used together, because paging is applied after the query is formed

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	2009-12-23 15:14:21 UTC (rev 6035)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/DeploymentQueryTest.java	2009-12-23 15:17:13 UTC (rev 6036)
@@ -99,16 +99,16 @@
   public void testCount() {
     List<String> deploymentIds = deployTestProcesses();
     
-    assertEquals(new Long(3L), repositoryService.createDeploymentQuery().count());
+    assertEquals(3, repositoryService.createDeploymentQuery().count());
     for (String deploymentId : deploymentIds) {
-      assertEquals(new Long(1L), repositoryService.createDeploymentQuery().deploymentId(deploymentId).count());      
+      assertEquals(1, repositoryService.createDeploymentQuery().deploymentId(deploymentId).count());      
     }
     
     Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentIds.get(0)).uniqueResult();
     repositoryService.suspendDeployment(deployment.getId());
     
-    assertEquals(new Long(1L), repositoryService.createDeploymentQuery().suspended().count());
-    assertEquals(new Long(2L), repositoryService.createDeploymentQuery().notSuspended().count());
+    assertEquals(1, repositoryService.createDeploymentQuery().suspended().count());
+    assertEquals(2, repositoryService.createDeploymentQuery().notSuspended().count());
     
     deleteCascade(deploymentIds);
   }

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	2009-12-23 15:14:21 UTC (rev 6035)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryActivityInstanceQueryTest.java	2009-12-23 15:17:13 UTC (rev 6036)
@@ -175,22 +175,22 @@
   public void testCount() {
     List<String> procInstIds = deployStartAndSignalTestProcesses();
     
-    assertEquals(new Long(9L), historyService.createHistoryActivityInstanceQuery().count());
-    assertEquals(new Long(4L), historyService.createHistoryActivityInstanceQuery().activityName("a").count());
-    assertEquals(new Long(3L), historyService.createHistoryActivityInstanceQuery().activityName("b").count());
-    assertEquals(new Long(2L), historyService.createHistoryActivityInstanceQuery().activityName("c").count());
-    assertEquals(new Long(0L), historyService.createHistoryActivityInstanceQuery().activityName("d").count());
+    assertEquals(9, historyService.createHistoryActivityInstanceQuery().count());
+    assertEquals(4, historyService.createHistoryActivityInstanceQuery().activityName("a").count());
+    assertEquals(3, historyService.createHistoryActivityInstanceQuery().activityName("b").count());
+    assertEquals(2, historyService.createHistoryActivityInstanceQuery().activityName("c").count());
+    assertEquals(0, historyService.createHistoryActivityInstanceQuery().activityName("d").count());
     
-    assertEquals(new Long(3L), historyService.createHistoryActivityInstanceQuery().executionId(procInstIds.get(0)).count());
-    assertEquals(new Long(3L), historyService.createHistoryActivityInstanceQuery().executionId(procInstIds.get(1)).count());
-    assertEquals(new Long(2L), historyService.createHistoryActivityInstanceQuery().executionId(procInstIds.get(2)).count());
-    assertEquals(new Long(1L), historyService.createHistoryActivityInstanceQuery().executionId(procInstIds.get(3)).count());
+    assertEquals(3, historyService.createHistoryActivityInstanceQuery().executionId(procInstIds.get(0)).count());
+    assertEquals(3, historyService.createHistoryActivityInstanceQuery().executionId(procInstIds.get(1)).count());
+    assertEquals(2, historyService.createHistoryActivityInstanceQuery().executionId(procInstIds.get(2)).count());
+    assertEquals(1, historyService.createHistoryActivityInstanceQuery().executionId(procInstIds.get(3)).count());
     
-    assertEquals(new Long(1L), historyService.createHistoryActivityInstanceQuery()
+    assertEquals(1, historyService.createHistoryActivityInstanceQuery()
                                   .executionId(procInstIds.get(0)).activityName("a").count());
-    assertEquals(new Long(1L), historyService.createHistoryActivityInstanceQuery()
+    assertEquals(1, historyService.createHistoryActivityInstanceQuery()
             .executionId(procInstIds.get(0)).activityName("b").count());
-    assertEquals(new Long(1L), historyService.createHistoryActivityInstanceQuery()
+    assertEquals(1, historyService.createHistoryActivityInstanceQuery()
             .executionId(procInstIds.get(0)).activityName("c").count());
   }
   

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	2009-12-23 15:14:21 UTC (rev 6035)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryProcessInstanceQueryTest.java	2009-12-23 15:17:13 UTC (rev 6036)
@@ -64,12 +64,12 @@
   public void testCount() {
     List<String> procInstIds = createTestHistoryProcessInstances(7);
     
-    assertEquals(new Long(0L), historyService.createHistoryProcessInstanceQuery().processDefinitionId("-1").count());
+    assertEquals(0, historyService.createHistoryProcessInstanceQuery().processDefinitionId("-1").count());
     
-    assertEquals(new Long(7L), historyService.createHistoryProcessInstanceQuery().count());
+    assertEquals(7, historyService.createHistoryProcessInstanceQuery().count());
     
     for (String id : procInstIds) {
-      assertEquals(new Long(1L), historyService.createHistoryProcessInstanceQuery().processInstanceId(id).count());      
+      assertEquals(1, historyService.createHistoryProcessInstanceQuery().processInstanceId(id).count());      
     }
     
   }
@@ -138,7 +138,5 @@
       procInstIds.add(executionService.startProcessInstanceByKey("theProcess", "theProcess-" + i).getId());
     }
     return procInstIds;
-
   }
-
 }

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	2009-12-23 15:14:21 UTC (rev 6035)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryTaskQueryTest.java	2009-12-23 15:17:13 UTC (rev 6036)
@@ -89,18 +89,18 @@
   public void testCount() {
     List<String> taskIds = createTestHistoryTasks();
     
-    assertEquals(new Long(3L), historyService.createHistoryTaskQuery().count());
-    assertEquals(new Long(1L), historyService.createHistoryTaskQuery().assignee("Tom").count());
+    assertEquals(3, historyService.createHistoryTaskQuery().count());
+    assertEquals(1, historyService.createHistoryTaskQuery().assignee("Tom").count());
     
     for (String taskid : taskIds) {
-      assertEquals(new Long(1L), historyService.createHistoryTaskQuery().taskId(taskid).count());
+      assertEquals(1, historyService.createHistoryTaskQuery().taskId(taskid).count());
     }
     
-    assertEquals(new Long(0L), historyService.createHistoryTaskQuery().startedBefore(new Date(CLOCK_TEST_TIME - 10000L)).count());
-    assertEquals(new Long(1L), 
+    assertEquals(0, historyService.createHistoryTaskQuery().startedBefore(new Date(CLOCK_TEST_TIME - 10000L)).count());
+    assertEquals(1, 
             historyService.createHistoryTaskQuery().startedAfter(new Date(CLOCK_TEST_TIME - 10000L))
             .taskId(taskIds.get(0)).count());
-    assertEquals(new Long(0L), 
+    assertEquals(0, 
             historyService.createHistoryTaskQuery().startedAfter(new Date(CLOCK_TEST_TIME - 10000L))
             .taskId("-1").count());
   }

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	2009-12-23 15:14:21 UTC (rev 6035)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/JobQueryTest.java	2009-12-23 15:17:13 UTC (rev 6036)
@@ -133,12 +133,12 @@
   public void testCount() {
     List<String> procInstIds = startTestProcessInstances(6);
     
-    assertEquals(new Long(6L), managementService.createJobQuery().count());
-    assertEquals(new Long(6L), managementService.createJobQuery().timers().count());
+    assertEquals(6, managementService.createJobQuery().count());
+    assertEquals(6, managementService.createJobQuery().timers().count());
     
     for (String id : procInstIds) {
-      assertEquals(new Long(1L), managementService.createJobQuery().processInstanceId(id).count()); 
-      assertEquals(new Long(1L), managementService.createJobQuery().processInstanceId(id).timers().count());
+      assertEquals(1, managementService.createJobQuery().processInstanceId(id).count()); 
+      assertEquals(1, managementService.createJobQuery().processInstanceId(id).timers().count());
     }
 
   }

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	2009-12-23 15:14:21 UTC (rev 6035)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/ProcessInstanceQueryTest.java	2009-12-23 15:17:13 UTC (rev 6036)
@@ -199,14 +199,14 @@
     Map<String, ArrayList<String>> processInstanceIds = startTestProcesses(4, 6);
     List<String> idsForTestProcess1 = processInstanceIds.get(TEST_PROCESS_1_KEY);
     
-    assertEquals(new Long(10L), executionService.createProcessInstanceQuery().count());
+    assertEquals(10, executionService.createProcessInstanceQuery().count());
     
     for (String processInstanceId : idsForTestProcess1) {
-      assertEquals(new Long(1L), executionService.createProcessInstanceQuery().processInstanceId(processInstanceId).count());
+      assertEquals(1, executionService.createProcessInstanceQuery().processInstanceId(processInstanceId).count());
     }
     
     for (int i = 0; i < 6; i++) {
-      assertEquals(new Long(1L), executionService.createProcessInstanceQuery().processInstanceKey(TEST_PROCESS_2_KEY + "-" + i).count());
+      assertEquals(1, executionService.createProcessInstanceQuery().processInstanceKey(TEST_PROCESS_2_KEY + "-" + i).count());
     }
     
     try {

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	2009-12-23 15:14:21 UTC (rev 6035)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/TaskQueryTest.java	2009-12-23 15:17:13 UTC (rev 6036)
@@ -126,8 +126,8 @@
     }
     
     TaskQuery taskQuery = taskService.createTaskQuery();
-    assertEquals(new Long(30L), taskQuery.count());
-    assertEquals(new Long(15L), taskQuery.assignee(assignee).count());
+    assertEquals(30, taskQuery.count());
+    assertEquals(15, taskQuery.assignee(assignee).count());
     
     deleteTasks(tasks);
   }



More information about the jbpm-commits mailing list