incubator-hise-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wi...@apache.org
Subject svn commit: r999952 - in /incubator/hise/trunk: hise-services/src/main/java/org/apache/hise/api/ hise-services/src/main/java/org/apache/hise/dao/ hise-services/src/main/java/org/apache/hise/engine/ hise-services/src/main/java/org/apache/hise/engine/jax...
Date Wed, 22 Sep 2010 14:01:42 GMT
Author: witek
Date: Wed Sep 22 14:01:42 2010
New Revision: 999952

URL: http://svn.apache.org/viewvc?rev=999952&view=rev
Log:
support for sorting

Modified:
    incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/api/Management.java
    incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/dao/HISEDao.java
    incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/ManagementImpl.java
    incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsAdministrative.java
    incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsBaseImpl.java
    incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/DaoTest.java
    incubator/hise/trunk/rtests/src/test/java/org/apache/hise/managementApi/PagingTest.java

Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/api/Management.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/api/Management.java?rev=999952&r1=999951&r2=999952&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/api/Management.java (original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/api/Management.java Wed
Sep 22 14:01:42 2010
@@ -64,7 +64,7 @@ public interface Management {
 
 	 public String getText();
 	
-	 public GetMyTasksResponseDocument getMyTasks(String userName, String taskType, String genericHumanRole,
String workQueue, List<TStatus.Enum> status, String whereClause, String createdOnClause,
+	 public GetMyTasksResponseDocument getMyTasks(String userName, String taskType, String genericHumanRole,
String workQueue, List<TStatus.Enum> status, String whereClause, String orderByClause,
String createdOnClause,
 	            Integer maxTasks, Integer fromTaskNumber) throws IllegalArgumentFault, IllegalStateFault;
 	 
 	 public GetMyTaskAbstractsResponseDocument getMyTaskAbstracts(String userName, String taskType,
String genericHumanRole, String workQueue, List<TStatus.Enum> status, 

Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/dao/HISEDao.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/dao/HISEDao.java?rev=999952&r1=999951&r2=999952&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/dao/HISEDao.java (original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/dao/HISEDao.java Wed
Sep 22 14:01:42 2010
@@ -82,6 +82,7 @@ public class HISEDao extends JpaDaoSuppo
 				Validate.notNull(em);
 
 				Query query = buildSQLQueryForTaskQuery(taskQuery, em);
+				
 				if (taskQuery.getMaxTasks() != null) {
 					query.setMaxResults(taskQuery.getMaxTasks());
 				}
@@ -91,6 +92,7 @@ public class HISEDao extends JpaDaoSuppo
 				if (taskQuery.getWorkQueue() != null && !taskQuery.getWorkQueue().equals(""))
{
 					tasks = taskFilterByQuery(tasks, taskQuery);
 				}
+
 				return tasks;
 			}
 
@@ -99,20 +101,25 @@ public class HISEDao extends JpaDaoSuppo
 	}
 
 	public static  Query buildSQLQueryForTaskQuery(TaskQuery query, EntityManager em) {
-		Vector<Object> q= new Vector<Object>();
+		Vector<Object> q = new Vector<Object>();
 		q.add("select distinct t from Task t, TaskOrgEntity e where ");
+		
 		if(addStatuses(q, query)) 
 			q.add(" and ");
+		
 		if(addOrgEntity(q, query))
 			q.add(" and ");
+		
 		if(addGenericHumanRole(q, query))
 			q.add(" and ");
+		
 		if(addCreatedOnClause(q, query))
 			q.add(" and ");
+		
 		if(!addWhereClause(q, query))
 			if(q.size()>1) q.setSize(q.size()-1);
 
-		q.add(" order by t." + query.getOrderByClause());
+		q.add(" order by t." + (query.getOrderByClause() == null ? "id" : query.getOrderByClause()));
 		
 		return new JpaQueryBuilder().buildQuery(em, q.toArray());	
 	}

Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/ManagementImpl.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/ManagementImpl.java?rev=999952&r1=999951&r2=999952&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/ManagementImpl.java
(original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/ManagementImpl.java
Wed Sep 22 14:01:42 2010
@@ -105,11 +105,11 @@ public class ManagementImpl implements M
 
 	public GetMyTasksResponseDocument getMyTasks(String userName, String taskType,
 		String genericHumanRole, String workQueue, List<Enum> status,
-		String whereClause, String createdOnClause, Integer maxTasks,
+		String whereClause, String orderByClause, String createdOnClause, Integer maxTasks,
 		Integer fromTaskNumber) throws IllegalArgumentFault, IllegalStateFault {
 
 			adminOperations.setUserName(userName);
-			return adminOperations.getMyTasks( taskType, genericHumanRole, workQueue, status, whereClause,
createdOnClause, maxTasks, fromTaskNumber);
+			return adminOperations.getMyTasks( taskType, genericHumanRole, workQueue, status, whereClause,
orderByClause, createdOnClause, maxTasks, fromTaskNumber);
 
     }
 	

Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsAdministrative.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsAdministrative.java?rev=999952&r1=999951&r2=999952&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsAdministrative.java
(original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsAdministrative.java
Wed Sep 22 14:01:42 2010
@@ -57,7 +57,7 @@ public interface TaskOperationsAdministr
 	ActivateResponseDocument activate(Long id) throws IllegalArgumentFault, IllegalStateFault,
IllegalAccessFault;
 	ClaimResponseDocument claim(Long id) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault
;
 	SetPriorityResponseDocument setPriority(Long id, BigInteger priority) throws IllegalArgumentFault,
IllegalStateFault, IllegalAccessFault;
-	GetMyTasksResponseDocument getMyTasks(String taskType, String genericHumanRole, String workQueue,
List<TStatus.Enum> status, String whereClause, String createdOnClause,
+	GetMyTasksResponseDocument getMyTasks(String taskType, String genericHumanRole, String workQueue,
List<TStatus.Enum> status, String whereClause, String orderByClause, String createdOnClause,
             Integer maxTasks, Integer fromTaskNumber) throws IllegalArgumentFault, IllegalStateFault;
     GetMyTaskAbstractsResponseDocument getMyTaskAbstracts(String taskType, String genericHumanRole,
String workQueue, List<TStatus.Enum> status, String whereClause,
             String createdOnClause, Integer maxTasks, Integer fromTaskNumber) throws IllegalArgumentFault,
IllegalStateFault;

Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsBaseImpl.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsBaseImpl.java?rev=999952&r1=999951&r2=999952&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsBaseImpl.java
(original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsBaseImpl.java
Wed Sep 22 14:01:42 2010
@@ -206,16 +206,17 @@ public abstract class TaskOperationsBase
 		List<TStatus.Enum> status = getMyTasks.getGetMyTasks().getStatusList();
 		String whereClause = getMyTasks.getGetMyTasks().getWhereClause();
 		String createdOnClause = getMyTasks.getGetMyTasks().getCreatedOnClause();
+		String orderByClause = getMyTasks.getGetMyTasks().getOrderByClause();
 		Integer maxTasks = getMyTasks.getGetMyTasks().getMaxTasks();
 		Integer fromTaskNumber = getMyTasks.getGetMyTasks().getFromTaskNumber();
 		if (!getMyTasks.getGetMyTasks().isSetMaxTasks()) {
 			maxTasks = null;
 		}
 
-		return getMyTasks(taskType, genericHumanRole, workQueue, status, whereClause, createdOnClause,
maxTasks, fromTaskNumber);
+		return getMyTasks(taskType, genericHumanRole, workQueue, status, whereClause, orderByClause,
createdOnClause, maxTasks, fromTaskNumber);
 	}
     
-    public GetMyTasksResponseDocument getMyTasks(String taskType, String genericHumanRole,
String workQueue, List<TStatus.Enum> status, String whereClause, String createdOnClause,
+    public GetMyTasksResponseDocument getMyTasks(String taskType, String genericHumanRole,
String workQueue, List<TStatus.Enum> status, String whereClause, String orderByClause,
String createdOnClause,
             Integer maxTasks, Integer fromTaskNumber) throws IllegalArgumentFault, IllegalStateFault
{
 
         List<TTask> result = new ArrayList<TTask>();
@@ -234,7 +235,8 @@ public abstract class TaskOperationsBase
         query.setWorkQueue(workQueue);
         query.setStatuses(status);
         query.setWhereClause(whereClause);
-        query.setCreatedOnClause(createdOnClause);
+        query.setOrderByClause(orderByClause);
+        query.setCreatedOnClause(createdOnClause);        
 
         List<org.apache.hise.dao.Task> tasks = hiseEngine.getHiseDao().getUserTasks(query);
         if(maxTasks == null){
@@ -1268,6 +1270,7 @@ public abstract class TaskOperationsBase
         query.setWorkQueue(workQueue);
         query.setStatuses(status);
         query.setWhereClause(whereClause);
+        //query.setOrderByClause(orderByClause);
         query.setCreatedOnClause(createdOnClause);
         query.setMaxTasks(null); //TODO maxTasks + fromTaskNumber
 

Modified: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/DaoTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/DaoTest.java?rev=999952&r1=999951&r2=999952&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/DaoTest.java (original)
+++ incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/DaoTest.java Wed Sep
22 14:01:42 2010
@@ -74,7 +74,7 @@ public class DaoTest extends AbstractJUn
                     TaskQuery query = new TaskQuery();
                     
                     query.setUser(TaskCreationHelper.TASK1_OWNER);
-                    System.out.println("PAWELFILTERING where"+query.getWhereClause());
+                    //System.out.println("PAWELFILTERING where"+query.getWhereClause());
                     List<Task> r = hiseDao.getUserTasks(query);
                     Assert.assertEquals(TaskCreationHelper.TASK1_DEFINITION_KEY, r.get(0).getTaskDefinitionKey());
                     return null;

Modified: incubator/hise/trunk/rtests/src/test/java/org/apache/hise/managementApi/PagingTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/rtests/src/test/java/org/apache/hise/managementApi/PagingTest.java?rev=999952&r1=999951&r2=999952&view=diff
==============================================================================
--- incubator/hise/trunk/rtests/src/test/java/org/apache/hise/managementApi/PagingTest.java
(original)
+++ incubator/hise/trunk/rtests/src/test/java/org/apache/hise/managementApi/PagingTest.java
Wed Sep 22 14:01:42 2010
@@ -50,7 +50,7 @@ public class PagingTest extends TaskTest
         Integer fromTaskNumber = 0;
         List<TStatus.Enum> statuses = new ArrayList<TStatus.Enum>();
         
-        List<TTask> tasks = management.getMyTasks("user1", "ALL", genericHumanRole,
null, statuses,null, null, maxTasks, fromTaskNumber).getGetMyTasksResponse().getTaskAbstractList();
+        List<TTask> tasks = management.getMyTasks("user1", "ALL", genericHumanRole,
null, statuses, null, null, null, maxTasks, fromTaskNumber).getGetMyTasksResponse().getTaskAbstractList();
         for(int i = 0; i < taskNumber; ++i ){
         	allTasksID[i] = tasks.get(i).getId();
         }
@@ -59,28 +59,28 @@ public class PagingTest extends TaskTest
     	
     	maxTasks = null;
     	fromTaskNumber = 3;
-    	tasks = management.getMyTasks("user1", "ALL", genericHumanRole, null, statuses,null,
null, maxTasks, fromTaskNumber).getGetMyTasksResponse().getTaskAbstractList();
+    	tasks = management.getMyTasks("user1", "ALL", genericHumanRole, null, statuses, null,
null, null, maxTasks, fromTaskNumber).getGetMyTasksResponse().getTaskAbstractList();
     	Assert.assertEquals(3, tasks.size());
     	Assert.assertEquals(allTasksID[3], tasks.get(0).getId());
     	Assert.assertEquals(allTasksID[5], tasks.get(2).getId());
     	
     	maxTasks = 3;
     	fromTaskNumber = 1;
-    	tasks = management.getMyTasks("user1", "ALL", genericHumanRole, null, statuses,null,
null, maxTasks, fromTaskNumber).getGetMyTasksResponse().getTaskAbstractList();
+    	tasks = management.getMyTasks("user1", "ALL", genericHumanRole, null, statuses, null,
null, null, maxTasks, fromTaskNumber).getGetMyTasksResponse().getTaskAbstractList();
     	Assert.assertEquals(3, tasks.size());
     	Assert.assertEquals(allTasksID[1], tasks.get(0).getId());
     	Assert.assertEquals(allTasksID[3], tasks.get(2).getId());
     	
     	maxTasks = 3;
     	fromTaskNumber = 4;
-    	tasks = management.getMyTasks("user1", "ALL", genericHumanRole, null, statuses,null,
null, maxTasks, fromTaskNumber).getGetMyTasksResponse().getTaskAbstractList();
+    	tasks = management.getMyTasks("user1", "ALL", genericHumanRole, null, statuses, null,
null, null, maxTasks, fromTaskNumber).getGetMyTasksResponse().getTaskAbstractList();
     	Assert.assertEquals(2, tasks.size());
     	Assert.assertEquals(allTasksID[4], tasks.get(0).getId());
     	Assert.assertEquals(allTasksID[5], tasks.get(1).getId());
     	
     	maxTasks = 3;
     	fromTaskNumber = 6;
-    	tasks = management.getMyTasks("user1", "ALL", genericHumanRole, null, statuses,null,
null, maxTasks, fromTaskNumber).getGetMyTasksResponse().getTaskAbstractList();
+    	tasks = management.getMyTasks("user1", "ALL", genericHumanRole, null, statuses,null,
null, null, maxTasks, fromTaskNumber).getGetMyTasksResponse().getTaskAbstractList();
     	Assert.assertEquals(0, tasks.size());
     }
     



Mime
View raw message