[jbpm-commits] JBoss JBPM SVN: r2488 - in jbpm3/trunk/modules/gwt-console: server/src/main/java/org/jboss/bpm/console/server and 4 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon Oct 6 10:16:54 EDT 2008
Author: heiko.braun at jboss.com
Date: 2008-10-06 10:16:54 -0400 (Mon, 06 Oct 2008)
New Revision: 2488
Added:
jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/dao/
jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/dao/DAOFactory.java
jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/dao/ProcessDAO.java
jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/dao/internal/
jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/dao/internal/MockProcessDAO.java
Modified:
jbpm3/trunk/modules/gwt-console/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstance.java
jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/ProcessManagement.java
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/DAOFactory.java
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionDAO.java
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceDAO.java
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java
Log:
JSON/GWT DateFormat
Modified: jbpm3/trunk/modules/gwt-console/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstance.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstance.java 2008-10-06 14:07:27 UTC (rev 2487)
+++ jbpm3/trunk/modules/gwt-console/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstance.java 2008-10-06 14:16:54 UTC (rev 2488)
@@ -101,7 +101,6 @@
@XmlElement(name = "start")
public String getStartDate()
{
- //"yyyy.MM.dd G 'at' HH:mm:ss vvvv"
SimpleDateFormat df = new SimpleDateFormat("y-M-d H:m:s");
return df.format(startDate);
}
@@ -111,11 +110,16 @@
this.startDate = startDate;
}
- @XmlElement(name = "end")
+ @XmlElement(name = "end")
public String getEndDate()
{
- SimpleDateFormat df = new SimpleDateFormat("y-M-d H:m:s");
- return df.format(endDate);
+ String s = "";
+ if(endDate!=null)
+ {
+ SimpleDateFormat df = new SimpleDateFormat("y-M-d H:m:s");
+ s = df.format(endDate);
+ }
+ return s;
}
public void setEndDate(Date endDate)
Modified: jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/ProcessManagement.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/ProcessManagement.java 2008-10-06 14:07:27 UTC (rev 2487)
+++ jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/ProcessManagement.java 2008-10-06 14:16:54 UTC (rev 2488)
@@ -22,65 +22,46 @@
package org.jboss.bpm.console.server;
import org.jboss.bpm.console.client.model.ProcessDefinitionWrapper;
-import org.jboss.bpm.console.client.model.ProcessDefinition;
import org.jboss.bpm.console.client.model.ProcessInstanceWrapper;
-import org.jboss.bpm.console.client.model.ProcessInstance;
-import org.jboss.resteasy.annotations.providers.jaxb.json.BadgerFish;
+import org.jboss.bpm.console.server.dao.DAOFactory;
+import org.jboss.bpm.console.server.dao.ProcessDAO;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
import javax.ws.rs.PathParam;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Date;
+import javax.ws.rs.Produces;
/**
+ * REST server module for accessing process related data.
+ *
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
@Path("process")
public class ProcessManagement
{
- final static List<ProcessDefinition> defs = new ArrayList<ProcessDefinition>();
- static
- {
- defs.add( new ProcessDefinition(1, "OrderProcess", "1"));
- defs.add( new ProcessDefinition(2, "VacationManagement", "1"));
- defs.add( new ProcessDefinition(3, "New Employee walkthrough", "1"));
- defs.add( new ProcessDefinition(4, "Source code review", "2"));
- defs.add( new ProcessDefinition(5, "Loan application", "1"));
- defs.add( new ProcessDefinition(6, "Expense report review", "4"));
- defs.add( new ProcessDefinition(7, "Expense claim", "4"));
- defs.add( new ProcessDefinition(8, "Credit approval", "4"));
- defs.add( new ProcessDefinition(9, "Hello World", "4"));
- }
- final static List instances = new ArrayList();
- static
+ private ProcessDAO processDAO;
+
+
+ public ProcessManagement()
{
- instances.add( new ProcessInstance(2, -1, "Running", new Date(), null));
- instances.add( new ProcessInstance(3, -1, "Stopped", new Date(System.currentTimeMillis()-(1000*60*120)), new Date(System.currentTimeMillis()-(1000*60*12))));
- instances.add( new ProcessInstance(4, -1, "Ended", new Date(System.currentTimeMillis()-(1000*60*60)), new Date(System.currentTimeMillis()-(1000*60*24))));
- instances.add( new ProcessInstance(5, -1, "Suspended", new Date(System.currentTimeMillis()-(1000*60*90)), new Date(System.currentTimeMillis()-(1000*60*17))));
- instances.add( new ProcessInstance(6, -1, "Running", new Date(), null));
- instances.add( new ProcessInstance(7, -1, "Running", new Date(), null));
+ this.processDAO = DAOFactory.createProcessDefinitionDAO();
}
-
@GET
@Path("definitions")
@Produces("application/json")
public ProcessDefinitionWrapper getDefinitionsJSON()
{
- return new ProcessDefinitionWrapper(defs);
+ return new ProcessDefinitionWrapper( processDAO.getAllProcessDefinitions() );
}
@GET
@Path("definitions/{id}/instances")
@Produces("application/json")
- public ProcessInstanceWrapper getInstancesJSON(@PathParam("id") long instanceId)
+ public ProcessInstanceWrapper getInstancesJSON(@PathParam("id") long processId)
{
- return new ProcessInstanceWrapper(instances);
+ return new ProcessInstanceWrapper( processDAO.getInstanceByProcessDefinitionId(processId) );
}
}
Added: jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/dao/DAOFactory.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/dao/DAOFactory.java (rev 0)
+++ jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/dao/DAOFactory.java 2008-10-06 14:16:54 UTC (rev 2488)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jboss.bpm.console.server.dao;
+
+import org.jboss.bpm.console.server.dao.internal.MockProcessDAO;
+
+/**
+ * TODO: Add service locator lookup
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class DAOFactory
+{
+ public static ProcessDAO createProcessDefinitionDAO()
+ {
+ return new MockProcessDAO();
+ }
+}
+
Property changes on: jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/dao/DAOFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/dao/ProcessDAO.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/dao/ProcessDAO.java (rev 0)
+++ jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/dao/ProcessDAO.java 2008-10-06 14:16:54 UTC (rev 2488)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jboss.bpm.console.server.dao;
+
+import org.jboss.bpm.console.client.model.ProcessDefinition;
+import org.jboss.bpm.console.client.model.ProcessInstance;
+
+import java.util.List;
+
+/**
+ * Access process related data.
+ *
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public interface ProcessDAO
+{
+ List<ProcessDefinition> getAllProcessDefinitions();
+
+ ProcessDefinition getProcessDefinitionById(long id);
+
+ List<ProcessInstance> getInstanceByProcessDefinitionId(long id);
+}
Property changes on: jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/dao/ProcessDAO.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/dao/internal/MockProcessDAO.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/dao/internal/MockProcessDAO.java (rev 0)
+++ jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/dao/internal/MockProcessDAO.java 2008-10-06 14:16:54 UTC (rev 2488)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jboss.bpm.console.server.dao.internal;
+
+import org.jboss.bpm.console.server.dao.ProcessDAO;
+import org.jboss.bpm.console.client.model.ProcessDefinition;
+import org.jboss.bpm.console.client.model.ProcessInstance;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Date;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class MockProcessDAO implements ProcessDAO
+{
+
+ final static List<ProcessDefinition> defs = new ArrayList<ProcessDefinition>();
+ static
+ {
+ defs.add( new ProcessDefinition(1, "OrderProcess", "1"));
+ defs.add( new ProcessDefinition(2, "VacationManagement", "1"));
+ defs.add( new ProcessDefinition(3, "New Employee walkthrough", "1"));
+ defs.add( new ProcessDefinition(4, "Source code review", "2"));
+ defs.add( new ProcessDefinition(5, "Loan application", "1"));
+ defs.add( new ProcessDefinition(6, "Expense report review", "4"));
+ defs.add( new ProcessDefinition(7, "Expense claim", "4"));
+ defs.add( new ProcessDefinition(8, "Credit approval", "4"));
+ }
+
+ final static List instances = new ArrayList();
+ static
+ {
+ instances.add( new ProcessInstance(2, -1, "Running", new Date(), null));
+ instances.add( new ProcessInstance(3, -1, "Stopped", new Date(System.currentTimeMillis()-(1000*60*120)), new Date(System.currentTimeMillis()-(1000*60*12))));
+ instances.add( new ProcessInstance(4, -1, "Ended", new Date(System.currentTimeMillis()-(1000*60*60)), new Date(System.currentTimeMillis()-(1000*60*24))));
+ instances.add( new ProcessInstance(5, -1, "Suspended", new Date(System.currentTimeMillis()-(1000*60*90)), new Date(System.currentTimeMillis()-(1000*60*17))));
+ instances.add( new ProcessInstance(6, -1, "Running", new Date(), null));
+ instances.add( new ProcessInstance(7, -1, "Running", new Date(), null));
+ }
+
+ public List<ProcessDefinition> getAllProcessDefinitions()
+ {
+ return defs;
+ }
+
+ public ProcessDefinition getProcessDefinitionById(long id)
+ {
+ ProcessDefinition match = null;
+ for(ProcessDefinition pd : defs)
+ {
+ if(pd.getProcessId() == id)
+ {
+ match = pd;
+ break;
+ }
+ }
+ return match;
+ }
+
+ public List<ProcessInstance> getInstanceByProcessDefinitionId(long id)
+ {
+ return instances;
+ }
+}
Property changes on: jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/dao/internal/MockProcessDAO.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/DAOFactory.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/DAOFactory.java 2008-10-06 14:07:27 UTC (rev 2487)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/DAOFactory.java 2008-10-06 14:16:54 UTC (rev 2488)
@@ -29,6 +29,7 @@
/**
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
+ at Deprecated
public class DAOFactory
{
public static ProcessDefinitionDAO createProcessDefinitionDAO()
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionDAO.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionDAO.java 2008-10-06 14:07:27 UTC (rev 2487)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionDAO.java 2008-10-06 14:16:54 UTC (rev 2488)
@@ -26,6 +26,7 @@
/**
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
+ at Deprecated
public interface ProcessDefinitionDAO
{
List getAllProcessDefinitions();
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceDAO.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceDAO.java 2008-10-06 14:07:27 UTC (rev 2487)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceDAO.java 2008-10-06 14:16:54 UTC (rev 2488)
@@ -26,6 +26,7 @@
/**
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
+ at Deprecated
public interface ProcessInstanceDAO
{
List getInstanceByProcessDefinitionId(long id);
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java 2008-10-06 14:07:27 UTC (rev 2487)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java 2008-10-06 14:16:54 UTC (rev 2488)
@@ -41,6 +41,7 @@
private Map row2InstanceMap = new HashMap();
private ProcessDefinition parent;
+ private static final String DATE_FORMAT = "y-m-j H:i:s"; //08-10-02 13:51:27
public ProcessInstanceList(ProcessDefinition procDef, String titleName, ConsoleView view)
{
@@ -114,8 +115,8 @@
new IntegerFieldDef("parentId"),
new StringFieldDef("key"),
new StringFieldDef("status"),
- new DateFieldDef("start", "Y-m-d H:i:s"), //2008-10-02 13:51:27
- new DateFieldDef("end")
+ new DateFieldDef("start", DATE_FORMAT),
+ new DateFieldDef("end", DATE_FORMAT)
}
);
More information about the jbpm-commits
mailing list