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

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Jul 16 12:17:23 EDT 2009


Author: tom.baeyens at jboss.com
Date: 2009-07-16 12:17:22 -0400 (Thu, 16 Jul 2009)
New Revision: 5312

Added:
   jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryDetailQuery.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CreateHistoryDetailQueryCmd.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryDetailQueryImpl.java
Modified:
   jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/HistoryService.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/DbSessionImpl.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/DbSession.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/HistoryServiceImpl.java
Log:
JBPM-2398 api preparations for task details query

Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/HistoryService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/HistoryService.java	2009-07-16 11:07:23 UTC (rev 5311)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/HistoryService.java	2009-07-16 16:17:22 UTC (rev 5312)
@@ -24,6 +24,7 @@
 import java.util.Map;
 
 import org.jbpm.api.history.HistoryActivityInstanceQuery;
+import org.jbpm.api.history.HistoryDetailQuery;
 import org.jbpm.api.history.HistoryProcessInstanceQuery;
 import org.jbpm.api.history.HistoryTaskQuery;
 
@@ -44,6 +45,9 @@
   /** search in history task information */ 
   HistoryTaskQuery createHistoryTaskQuery();
 
+  /** search in history details */ 
+  HistoryDetailQuery createHistoryDetailQuery();
+
   /** returns the average duration in milliseconds for each activity in the given process definition */
   Map<String, Long> avgDurationPerActivity(String processDefinitionId);
   

Added: 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	                        (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryDetailQuery.java	2009-07-16 16:17:22 UTC (rev 5312)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.api.history;
+
+import java.util.Date;
+import java.util.List;
+
+
+/** query for task comments, task assignments and so on.
+ * 
+ * @author Tom Baeyens
+ */
+public interface HistoryDetailQuery {
+
+  /** userId property to be used as property in {@link #orderAsc(String)} and {@link #orderDesc(String)} */
+  String PROPERTY_USERID = "userId";
+  /** time property to be used as property in {@link #orderAsc(String)} and {@link #orderDesc(String)} */
+  String PROPERTY_TIME = "time";
+
+  /** only select details for the given processInstanceId */
+  HistoryDetailQuery processInstanceId(String processInstanceId);
+
+  /** only select details for the given historyActivityInstanceId */
+  HistoryDetailQuery processActivityInstanceId(String historyActivityInstanceId);
+
+  /** only select details for the given taskId */
+  HistoryDetailQuery taskId(String taskId);
+
+  /** only select details after the given time */
+  HistoryDetailQuery timeAfter(Date time);
+
+  /** only select details before the given time */
+  HistoryDetailQuery timeBefore(Date time);
+
+  /** only select activity instances for the given activity 
+   * (this usually used in combination with {@link #processDefinitionId(String)}) */
+  HistoryDetailQuery taskComments();
+
+  /** order selected process definitions descending for certain {@link #PROPERTY_USERID properties} */
+  HistoryDetailQuery orderDesc(String property);
+
+  /** select a specific page in the result set */
+  HistoryDetailQuery page(int firstResult, int maxResults);
+
+  /** execute the query and obtain the list of {@link HistoryDetail}s */
+  List<HistoryDetail> list(); 
+
+  /** execute the query and obtain the unique {@link HistoryDetail} */
+  HistoryDetail uniqueResult();
+
+}


Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryDetailQuery.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CreateHistoryDetailQueryCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CreateHistoryDetailQueryCmd.java	                        (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CreateHistoryDetailQueryCmd.java	2009-07-16 16:17:22 UTC (rev 5312)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.cmd;
+
+import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.query.HistoryDetailQueryImpl;
+import org.jbpm.pvm.internal.query.HistoryProcessInstanceQueryImpl;
+import org.jbpm.pvm.internal.session.DbSession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CreateHistoryDetailQueryCmd implements Command<HistoryDetailQueryImpl> {
+
+  private static final long serialVersionUID = 1L;
+
+  public HistoryDetailQueryImpl execute(Environment environment) throws Exception {
+    return environment.get(DbSession.class).createHistoryDetailQuery();
+  }
+
+}


Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CreateHistoryDetailQueryCmd.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/DbSessionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/DbSessionImpl.java	2009-07-16 11:07:23 UTC (rev 5311)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/DbSessionImpl.java	2009-07-16 16:17:22 UTC (rev 5312)
@@ -44,6 +44,7 @@
 import org.jbpm.pvm.internal.model.ExecutionImpl;
 import org.jbpm.pvm.internal.query.DeploymentQueryImpl;
 import org.jbpm.pvm.internal.query.HistoryActivityInstanceQueryImpl;
+import org.jbpm.pvm.internal.query.HistoryDetailQueryImpl;
 import org.jbpm.pvm.internal.query.HistoryProcessInstanceQueryImpl;
 import org.jbpm.pvm.internal.query.JobQueryImpl;
 import org.jbpm.pvm.internal.query.ProcessInstanceQueryImpl;
@@ -417,7 +418,11 @@
   public HistoryActivityInstanceQueryImpl createHistoryActivityInstanceQuery() {
     return new HistoryActivityInstanceQueryImpl();
   }
-
+  
+  public HistoryDetailQueryImpl createHistoryDetailQuery() {
+    return new HistoryDetailQueryImpl();
+  }
+  
   public JobQueryImpl createJobQuery() {
     return new JobQueryImpl();
   }
@@ -441,5 +446,4 @@
     ).setLong("taskDbid", taskDbid)
     .list();
   }
-  
 }

Added: 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	                        (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryDetailQueryImpl.java	2009-07-16 16:17:22 UTC (rev 5312)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.query;
+
+import java.util.Date;
+import java.util.List;
+
+import org.hibernate.Query;
+import org.jbpm.api.history.HistoryDetail;
+import org.jbpm.api.history.HistoryDetailQuery;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class HistoryDetailQueryImpl extends AbstractQuery implements HistoryDetailQuery {
+
+  @Override
+  protected void applyParameters(Query query) {
+  }
+
+  @Override
+  public String hql() {
+    return null;
+  }
+
+  public List<HistoryDetail> list() {
+    return null;
+  }
+
+  public HistoryDetailQuery orderDesc(String property) {
+    return null;
+  }
+
+  public HistoryDetailQuery page(int firstResult, int maxResults) {
+    return null;
+  }
+
+  public HistoryDetailQuery processActivityInstanceId(String historyActivityInstanceId) {
+    return null;
+  }
+
+  public HistoryDetailQuery processInstanceId(String processInstanceId) {
+    return null;
+  }
+
+  public HistoryDetailQuery taskComments() {
+    return null;
+  }
+
+  public HistoryDetailQuery taskId(String taskId) {
+    return null;
+  }
+
+  public HistoryDetailQuery timeAfter(Date time) {
+    return null;
+  }
+
+  public HistoryDetailQuery timeBefore(Date time) {
+    return null;
+  }
+
+  public HistoryDetail uniqueResult() {
+    return null;
+  }
+
+}


Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryDetailQueryImpl.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/DbSession.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/DbSession.java	2009-07-16 11:07:23 UTC (rev 5311)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/DbSession.java	2009-07-16 16:17:22 UTC (rev 5312)
@@ -31,6 +31,7 @@
 import org.jbpm.pvm.internal.model.ExecutionImpl;
 import org.jbpm.pvm.internal.query.DeploymentQueryImpl;
 import org.jbpm.pvm.internal.query.HistoryActivityInstanceQueryImpl;
+import org.jbpm.pvm.internal.query.HistoryDetailQueryImpl;
 import org.jbpm.pvm.internal.query.HistoryProcessInstanceQueryImpl;
 import org.jbpm.pvm.internal.query.JobQueryImpl;
 import org.jbpm.pvm.internal.query.ProcessInstanceQueryImpl;
@@ -73,21 +74,14 @@
 
   /** create a task query */
   TaskQueryImpl createTaskQuery();
-  
-  /** create a history process instance query */
   HistoryProcessInstanceQueryImpl createHistoryProcessInstanceQuery();
-  
-  /** create a history activity instance query */
   HistoryActivityInstanceQueryImpl createHistoryActivityInstanceQuery();
-
-  List<HistoryComment> findCommentsByTaskId(String taskId);
-
-  /** create a process instance query */
+  HistoryDetailQueryImpl createHistoryDetailQuery();
   JobQueryImpl createJobQuery();
-  
-  /** create a deployment query */
   DeploymentQueryImpl createDeploymentQuery();
 
+  List<HistoryComment> findCommentsByTaskId(String taskId);
+
   /** the execution uniquely identified by the given executionKey. 
    * this method doesn't 'see' suspended executions. */ 
   ClientExecution findExecutionById(String executionId);

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/HistoryServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/HistoryServiceImpl.java	2009-07-16 11:07:23 UTC (rev 5311)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/HistoryServiceImpl.java	2009-07-16 16:17:22 UTC (rev 5312)
@@ -27,15 +27,18 @@
 import org.jbpm.api.HistoryService;
 import org.jbpm.api.history.HistoryActivityInstanceQuery;
 import org.jbpm.api.history.HistoryComment;
+import org.jbpm.api.history.HistoryDetailQuery;
 import org.jbpm.api.history.HistoryProcessInstanceQuery;
 import org.jbpm.api.history.HistoryTaskQuery;
 import org.jbpm.pvm.internal.cmd.CreateHistoryActivityInstanceQueryCmd;
+import org.jbpm.pvm.internal.cmd.CreateHistoryDetailQueryCmd;
 import org.jbpm.pvm.internal.cmd.CreateHistoryProcessInstanceQueryCmd;
 import org.jbpm.pvm.internal.cmd.CreateHistoryTaskQueryCmd;
 import org.jbpm.pvm.internal.cmd.GetTaskCommentsCmd;
 import org.jbpm.pvm.internal.query.AvgDurationPerActivityQueryCmd;
 import org.jbpm.pvm.internal.query.ChoiceDistributionQueryCmd;
 import org.jbpm.pvm.internal.query.HistoryActivityInstanceQueryImpl;
+import org.jbpm.pvm.internal.query.HistoryDetailQueryImpl;
 import org.jbpm.pvm.internal.query.HistoryProcessInstanceQueryImpl;
 import org.jbpm.pvm.internal.query.HistoryTaskQueryImpl;
 
@@ -70,4 +73,10 @@
     query.setCommandService(commandService);
     return query;
   }
+
+  public HistoryDetailQuery createHistoryDetailQuery() {
+    HistoryDetailQueryImpl query = commandService.execute(new CreateHistoryDetailQueryCmd());
+    query.setCommandService(commandService);
+    return query;
+  }
 }



More information about the jbpm-commits mailing list