[jbpm-commits] JBoss JBPM SVN: r3325 - in projects/gwt-console/trunk: rpc/src/main/java/org/jboss/bpm/console/client/model and 6 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Dec 10 15:44:50 EST 2008
Author: heiko.braun at jboss.com
Date: 2008-12-10 15:44:50 -0500 (Wed, 10 Dec 2008)
New Revision: 3325
Added:
projects/gwt-console/trunk/server/src/test/java/org/jboss/bpm/console/server/ProcessManagementTest.java
Modified:
projects/gwt-console/trunk/gwt-parent.iml
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionRef.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionRefWrapper.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceRef.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceRefWrapper.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/jbpm3/TokenReference.java
projects/gwt-console/trunk/server/gwt-server.iml
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TestFacade.java
projects/gwt-console/trunk/server/src/test/java/org/jboss/bpm/console/server/AuthorizationTest.java
projects/gwt-console/trunk/server/src/test/java/org/jboss/bpm/console/server/BaseTC.java
projects/gwt-console/trunk/war/gwt-war.iml
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceDetailForm.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java
Log:
Test process instance creation and suspension
Modified: projects/gwt-console/trunk/gwt-parent.iml
===================================================================
--- projects/gwt-console/trunk/gwt-parent.iml 2008-12-10 20:44:16 UTC (rev 3324)
+++ projects/gwt-console/trunk/gwt-parent.iml 2008-12-10 20:44:50 UTC (rev 3325)
@@ -15,7 +15,9 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="module" module-name="jbpm3-toplevel" exported="" />
+ <orderEntry type="module" module-name="jbpm3-enterprise" exported="" />
+ <orderEntry type="module" module-name="jbpm3-identity" exported="" />
+ <orderEntry type="module" module-name="jbpm3-core" exported="" />
<orderEntry type="module-library" exported="">
<library name="M2 Dep: org.slf4j:slf4j-simple:jar:1.5.2:compile">
<CLASSES>
Modified: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionRef.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionRef.java 2008-12-10 20:44:16 UTC (rev 3324)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionRef.java 2008-12-10 20:44:50 UTC (rev 3325)
@@ -81,6 +81,29 @@
public String toString()
{
- return "ProcessDefinitionRef{id="+this.processId +", name="+this.name+"}";
+ return "ProcessDefinitionRef{id="+this.processId +", name="+this.name+", version="+this.version+"}";
}
+
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ ProcessDefinitionRef that = (ProcessDefinitionRef) o;
+
+ if (processId != that.processId) return false;
+ if (name != null ? !name.equals(that.name) : that.name != null) return false;
+ if (version != null ? !version.equals(that.version) : that.version != null) return false;
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int result;
+ result = (int) (processId ^ (processId >>> 32));
+ result = 31 * result + (name != null ? name.hashCode() : 0);
+ result = 31 * result + (version != null ? version.hashCode() : 0);
+ return result;
+ }
}
Modified: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionRefWrapper.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionRefWrapper.java 2008-12-10 20:44:16 UTC (rev 3324)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionRefWrapper.java 2008-12-10 20:44:50 UTC (rev 3325)
@@ -54,4 +54,9 @@
{
return definitions.size();
}
+
+ public void setDefinitions(List<ProcessDefinitionRef> definitions)
+ {
+ this.definitions = definitions;
+ }
}
Modified: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceRef.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceRef.java 2008-12-10 20:44:16 UTC (rev 3324)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceRef.java 2008-12-10 20:44:50 UTC (rev 3325)
@@ -45,8 +45,6 @@
private boolean suspended;
- private STATE state; // gson is field based, hence why...
-
private transient Lifecycle lifecycle;
private TokenReference rootToken;
@@ -84,8 +82,6 @@
this.lifecycle = new Lifecycle(this, STATE.SUSPENDED);
else
this.lifecycle = new Lifecycle(this, STATE.RUNNING);
-
- this.state = lifecycle.getState();
}
@XmlElement(name = "instanceId")
@@ -124,7 +120,7 @@
@XmlElement(name = "status")
public STATE getState()
{
- return this.state;
+ return this.lifecycle.getState();
}
public void setState(String nextState)
@@ -135,7 +131,6 @@
public void setState(STATE nextState)
{
this.lifecycle = this.lifecycle.transitionTo(nextState);
- this.state = this.lifecycle.getState();
}
@XmlElement(name = "start")
@@ -238,6 +233,26 @@
{
return current;
}
+
+
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Lifecycle lifecycle = (Lifecycle) o;
+
+ if (current != lifecycle.current) return false;
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int result;
+ result = (current != null ? current.hashCode() : 0);
+ return result;
+ }
}
private class IllegalTransitionException extends IllegalArgumentException
@@ -258,4 +273,44 @@
{
this.rootToken = rootToken;
}
+
+ // it's actually just used for unmarshalling, TODO: fix it
+ public void setSuspended(boolean suspended)
+ {
+ this.suspended = suspended;
+ initLifecycle();
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ ProcessInstanceRef that = (ProcessInstanceRef) o;
+
+ if (instanceId != that.instanceId) return false;
+ if (parentId != that.parentId) return false;
+ if (suspended != that.suspended) return false;
+ if (endDate != null ? !endDate.equals(that.endDate) : that.endDate != null) return false;
+ if (key != null ? !key.equals(that.key) : that.key != null) return false;
+ if (lifecycle != null ? !lifecycle.equals(that.lifecycle) : that.lifecycle != null) return false;
+ if (rootToken != null ? !rootToken.equals(that.rootToken) : that.rootToken != null) return false;
+ if (startDate != null ? !startDate.toString().equals(that.startDate.toString()) : that.startDate != null) return false;
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int result;
+ result = (int) (instanceId ^ (instanceId >>> 32));
+ result = 31 * result + (int) (parentId ^ (parentId >>> 32));
+ result = 31 * result + (key != null ? key.hashCode() : 0);
+ result = 31 * result + (startDate != null ? startDate.hashCode() : 0);
+ result = 31 * result + (endDate != null ? endDate.hashCode() : 0);
+ result = 31 * result + (suspended ? 1 : 0);
+ result = 31 * result + (lifecycle != null ? lifecycle.hashCode() : 0);
+ result = 31 * result + (rootToken != null ? rootToken.hashCode() : 0);
+ return result;
+ }
}
Modified: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceRefWrapper.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceRefWrapper.java 2008-12-10 20:44:16 UTC (rev 3324)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceRefWrapper.java 2008-12-10 20:44:50 UTC (rev 3325)
@@ -49,6 +49,11 @@
return instances;
}
+ public void setInstances(List<ProcessInstanceRef> instances)
+ {
+ this.instances = instances;
+ }
+
@XmlElement(name = "totalCount")
public int getTotalCount()
{
Modified: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/jbpm3/TokenReference.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/jbpm3/TokenReference.java 2008-12-10 20:44:16 UTC (rev 3324)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/jbpm3/TokenReference.java 2008-12-10 20:44:50 UTC (rev 3325)
@@ -43,6 +43,10 @@
private boolean canBeSignaled = true;
+ public TokenReference()
+ {
+ }
+
public TokenReference(long id, String name, String nodeName)
{
this.id = id;
@@ -84,4 +88,36 @@
{
this.canBeSignaled = canBeSignaled;
}
+
+
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ TokenReference that = (TokenReference) o;
+
+ if (canBeSignaled != that.canBeSignaled) return false;
+ if (id != that.id) return false;
+ if (availableSignals != null ? !availableSignals.equals(that.availableSignals) : that.availableSignals != null)
+ return false;
+ if (children != null ? !children.equals(that.children) : that.children != null) return false;
+ if (currentNodeName != null ? !currentNodeName.equals(that.currentNodeName) : that.currentNodeName != null)
+ return false;
+ if (name != null ? !name.equals(that.name) : that.name != null) return false;
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int result;
+ result = (int) (id ^ (id >>> 32));
+ result = 31 * result + (name != null ? name.hashCode() : 0);
+ result = 31 * result + (currentNodeName != null ? currentNodeName.hashCode() : 0);
+ result = 31 * result + (children != null ? children.hashCode() : 0);
+ result = 31 * result + (availableSignals != null ? availableSignals.hashCode() : 0);
+ result = 31 * result + (canBeSignaled ? 1 : 0);
+ return result;
+ }
}
Modified: projects/gwt-console/trunk/server/gwt-server.iml
===================================================================
--- projects/gwt-console/trunk/server/gwt-server.iml 2008-12-10 20:44:16 UTC (rev 3324)
+++ projects/gwt-console/trunk/server/gwt-server.iml 2008-12-10 20:44:50 UTC (rev 3325)
@@ -11,7 +11,9 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="gwt-parent" />
- <orderEntry type="module" module-name="jbpm3-toplevel" />
+ <orderEntry type="module" module-name="jbpm3-enterprise" />
+ <orderEntry type="module" module-name="jbpm3-identity" />
+ <orderEntry type="module" module-name="jbpm3-core" />
<orderEntry type="module-library" exported="">
<library name="M2 Dep: org.slf4j:slf4j-simple:jar:1.5.2:compile">
<CLASSES>
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TestFacade.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TestFacade.java 2008-12-10 20:44:16 UTC (rev 3324)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TestFacade.java 2008-12-10 20:44:50 UTC (rev 3325)
@@ -27,6 +27,7 @@
import org.jboss.bpm.console.server.integration.ExtensionManagement;
import org.jboss.bpm.console.server.integration.ManagementFactory;
import org.jboss.bpm.console.server.integration.ProcessManagement;
+import org.jboss.bpm.console.server.gson.GsonFactory;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
@@ -37,6 +38,8 @@
import java.io.InputStream;
import java.util.List;
+import com.google.gson.Gson;
+
/**
* Test utility to simplify GWT tests.
*
@@ -95,7 +98,7 @@
ProcessDefinitionRef def = getManagementExtension().deployNewDefinition(data);
log.info("Deployed test process definition " + def);
- return Response.ok().build();
+ return createJsonResponse(def);
}
catch (IOException e)
{
@@ -120,4 +123,11 @@
}
return Response.ok().build();
}
+
+ private Response createJsonResponse(Object wrapper)
+ {
+ Gson gson = GsonFactory.createInstance();
+ String json = gson.toJson(wrapper);
+ return Response.ok(json).type("application/json").build();
+ }
}
Modified: projects/gwt-console/trunk/server/src/test/java/org/jboss/bpm/console/server/AuthorizationTest.java
===================================================================
--- projects/gwt-console/trunk/server/src/test/java/org/jboss/bpm/console/server/AuthorizationTest.java 2008-12-10 20:44:16 UTC (rev 3324)
+++ projects/gwt-console/trunk/server/src/test/java/org/jboss/bpm/console/server/AuthorizationTest.java 2008-12-10 20:44:50 UTC (rev 3325)
@@ -22,16 +22,12 @@
package org.jboss.bpm.console.server;
import net.sf.json.JSONObject;
-import net.sf.json.util.JSONUtils;
-import net.sf.ezmorph.Morpher;
-import net.sf.ezmorph.MorpherRegistry;
-import net.sf.ezmorph.bean.BeanMorpher;
-import org.jboss.bpm.console.client.model.*;
-import org.apache.commons.beanutils.PropertyUtils;
+import org.jboss.bpm.console.client.model.RoleAssignmentRef;
+import org.jboss.bpm.console.client.model.RoleAssignmentRefWrapper;
-import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
/**
* @author Heiko.Braun <heiko.braun at jboss.com>
@@ -52,9 +48,6 @@
// --
// Postprocessing required:
// See http://json-lib.sourceforge.net/usage.html
- MorpherRegistry morpherRegistry = JSONUtils.getMorpherRegistry();
- Morpher dynaMorpher = new BeanMorpher( RoleAssignmentRef.class, morpherRegistry);
- morpherRegistry.registerMorpher( dynaMorpher );
List roles = new ArrayList();
for( Iterator i = dto.getRoles().iterator(); i.hasNext(); ){
roles.add( morpherRegistry.morph( RoleAssignmentRef.class, i.next() ) );
Modified: projects/gwt-console/trunk/server/src/test/java/org/jboss/bpm/console/server/BaseTC.java
===================================================================
--- projects/gwt-console/trunk/server/src/test/java/org/jboss/bpm/console/server/BaseTC.java 2008-12-10 20:44:16 UTC (rev 3324)
+++ projects/gwt-console/trunk/server/src/test/java/org/jboss/bpm/console/server/BaseTC.java 2008-12-10 20:44:50 UTC (rev 3325)
@@ -22,7 +22,16 @@
package org.jboss.bpm.console.server;
import junit.framework.TestCase;
+import net.sf.ezmorph.Morpher;
+import net.sf.ezmorph.MorpherRegistry;
+import net.sf.ezmorph.bean.BeanMorpher;
+import net.sf.json.JSONObject;
+import net.sf.json.util.JSONUtils;
+import org.jboss.bpm.console.client.model.*;
+import org.jboss.bpm.console.client.model.jbpm3.*;
+import java.io.ByteArrayInputStream;
+
/**
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
@@ -30,4 +39,54 @@
{
protected final static String[] DEFAULT_CREDENTIALS = new String[] {"admin", "admin"};
protected String SERVER_URL = "http://localhost:8080/gwt-console-server/rs";
+ protected final ByteArrayInputStream EMPTY = new ByteArrayInputStream("".getBytes());
+ protected ProcessDefinitionRef testDeploymentRef;
+ protected MorpherRegistry morpherRegistry = null;
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ setupMorphRegistry();
+ }
+
+ protected void deployTestHarness()
+ throws Exception
+ {
+ String response = HTTP.post(
+ SERVER_URL + "/test/deploy/harness", EMPTY, DEFAULT_CREDENTIALS
+ );
+
+ JSONObject jsonObject = JSONObject.fromObject( response );
+ testDeploymentRef = (ProcessDefinitionRef)
+ JSONObject.toBean( jsonObject, ProcessDefinitionRef.class );
+ System.out.println("deployed " + testDeploymentRef);
+ }
+
+ protected void undeployTestHarness()
+ throws Exception
+ {
+ String response = HTTP.post(
+ SERVER_URL + "/test/undeploy/harness", EMPTY, DEFAULT_CREDENTIALS
+ );
+
+ System.out.println("undeployed " + testDeploymentRef);
+ }
+
+ protected MorpherRegistry setupMorphRegistry()
+ {
+ this.morpherRegistry = JSONUtils.getMorpherRegistry();
+ Morpher procDef = new BeanMorpher( ProcessDefinitionRef.class, morpherRegistry);
+ morpherRegistry.registerMorpher( procDef );
+
+ Morpher roles = new BeanMorpher( RoleAssignmentRef.class, morpherRegistry);
+ morpherRegistry.registerMorpher( roles );
+
+ Morpher instance = new BeanMorpher( ProcessInstanceRef.class, morpherRegistry);
+ morpherRegistry.registerMorpher( instance );
+
+ Morpher token = new BeanMorpher( TokenReference.class, morpherRegistry);
+ morpherRegistry.registerMorpher( token );
+
+ return morpherRegistry;
+ }
}
Added: projects/gwt-console/trunk/server/src/test/java/org/jboss/bpm/console/server/ProcessManagementTest.java
===================================================================
--- projects/gwt-console/trunk/server/src/test/java/org/jboss/bpm/console/server/ProcessManagementTest.java (rev 0)
+++ projects/gwt-console/trunk/server/src/test/java/org/jboss/bpm/console/server/ProcessManagementTest.java 2008-12-10 20:44:50 UTC (rev 3325)
@@ -0,0 +1,171 @@
+/*
+ * 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;
+
+import net.sf.json.JSONObject;
+import org.jboss.bpm.console.client.model.*;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Executes process managemnt tests.
+ *
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class ProcessManagementTest extends BaseTC
+{
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ deployTestHarness();
+ }
+
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ undeployTestHarness();
+ }
+
+ /**
+ * Check the process defintion list after deployment of a new process.
+ * (done in {@link #setUp()})
+ *
+ * @throws Exception
+ */
+ public void testProcessDefinitionList() throws Exception
+ {
+ String response = HTTP.get(
+ SERVER_URL + "/process/definitions", DEFAULT_CREDENTIALS
+ );
+
+ ProcessDefinitionRefWrapper dto = unmarshallProcessDefinitionList(response);
+
+ ProcessDefinitionRef match = null;
+ for(ProcessDefinitionRef def : dto.getDefinitions())
+ {
+ if(def.equals(testDeploymentRef))
+ match = def;
+ }
+
+ assertNotNull(match);
+
+ }
+
+ /**
+ * Test instance creation, suspend, resume and deletetion.
+ *
+ * @throws Exception
+ */
+ public void testInstanceOperations() throws Exception
+ {
+ String resource = "/process/definitions/"+testDeploymentRef.getProcessId()+"/instances/new";
+ String response = HTTP.post(SERVER_URL + resource, EMPTY, DEFAULT_CREDENTIALS);
+
+ System.out.println("!!"+response);
+
+ // ------- New instance
+
+ ProcessInstanceRef newInstanceRef = unmarshallProcessInstance(response);
+ assertTrue(newInstanceRef.getState()==ProcessInstanceRef.STATE.RUNNING);
+
+ // ------- Suspend it
+
+ newInstanceRef.setState(ProcessInstanceRef.STATE.SUSPENDED);
+ HTTP.post(
+ SERVER_URL + "/process/instances/"+newInstanceRef.getInstanceId()+"/state/"+newInstanceRef.getState(),
+ EMPTY, DEFAULT_CREDENTIALS
+ );
+
+ // ------- Verify
+
+ String listResponse = HTTP.get(
+ SERVER_URL + "/process/definitions/"+testDeploymentRef.getProcessId()+"/instances",
+ DEFAULT_CREDENTIALS
+ );
+
+ ProcessInstanceRefWrapper instanceList = unmarshallProcessInstanceList(listResponse);
+ assertFalse(instanceList.getInstances().isEmpty());
+
+ ProcessInstanceRef match = null;
+ for(ProcessInstanceRef ref : instanceList.getInstances())
+ {
+ if(ref.equals(newInstanceRef))
+ {
+ match = ref;
+ break;
+ }
+ }
+
+ assertNotNull(match);
+ assertEquals(ProcessInstanceRef.STATE.SUSPENDED, match.getState());
+ }
+
+ // ---------------- marshalling --------------
+
+ private ProcessDefinitionRefWrapper unmarshallProcessDefinitionList(String response)
+ {
+ JSONObject jsonObject = JSONObject.fromObject( response );
+ ProcessDefinitionRefWrapper dto = (ProcessDefinitionRefWrapper)
+ JSONObject.toBean( jsonObject, ProcessDefinitionRefWrapper.class );
+
+ // --
+ List defs = new ArrayList();
+ for( Iterator i = dto.getDefinitions().iterator(); i.hasNext(); ){
+ defs.add(
+ morpherRegistry.morph( ProcessDefinitionRef.class, i.next() )
+ );
+ }
+ dto.setDefinitions(defs);
+ return dto;
+ }
+
+ private ProcessInstanceRefWrapper unmarshallProcessInstanceList(String response)
+ {
+ JSONObject jsonObject = JSONObject.fromObject( response );
+ ProcessInstanceRefWrapper dto = (ProcessInstanceRefWrapper)
+ JSONObject.toBean( jsonObject, ProcessInstanceRefWrapper.class );
+
+ // --
+ List instances = new ArrayList();
+ for( Iterator i = dto.getInstances().iterator(); i.hasNext(); ){
+ instances.add(
+ morpherRegistry.morph( ProcessInstanceRef.class, i.next() )
+ );
+ }
+ dto.setInstances(instances);
+
+ return dto;
+ }
+
+ private ProcessInstanceRef unmarshallProcessInstance(String response)
+ {
+ JSONObject jsonObject = JSONObject.fromObject( response );
+ ProcessInstanceRef dto = (ProcessInstanceRef)
+ JSONObject.toBean( jsonObject, ProcessInstanceRef.class );
+ return dto;
+ }
+
+}
Modified: projects/gwt-console/trunk/war/gwt-war.iml
===================================================================
--- projects/gwt-console/trunk/war/gwt-war.iml 2008-12-10 20:44:16 UTC (rev 3324)
+++ projects/gwt-console/trunk/war/gwt-war.iml 2008-12-10 20:44:50 UTC (rev 3325)
@@ -11,7 +11,7 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="module" module-name="gwt-parent" />
+ <orderEntry type="module" module-name="gwt-parent" exported="" />
<orderEntry type="module-library" exported="">
<library name="M2 Dep: junit:junit:jar:3.8.1:test">
<CLASSES>
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceDetailForm.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceDetailForm.java 2008-12-10 20:44:16 UTC (rev 3324)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceDetailForm.java 2008-12-10 20:44:50 UTC (rev 3325)
@@ -172,6 +172,12 @@
}
detailsForm.getForm().loadRecord(record);
+
+ // state not part of the payload
+ detailsForm.getForm().findField("state").setRawValue(
+ selectedInstance.getState().toString()
+ );
+
detailsForm.doLayout();
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java 2008-12-10 20:44:16 UTC (rev 3324)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java 2008-12-10 20:44:50 UTC (rev 3325)
@@ -29,6 +29,8 @@
import com.gwtext.client.widgets.MessageBoxConfig;
import com.gwtext.client.widgets.grid.ColumnConfig;
import com.gwtext.client.widgets.grid.ColumnModel;
+import com.gwtext.client.widgets.grid.Renderer;
+import com.gwtext.client.widgets.grid.CellMetadata;
import org.jboss.bpm.console.client.util.ConsoleLog;
import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.UIConstants;
@@ -207,7 +209,16 @@
new ColumnConfig("Instance ID", "instanceId", 75, true),
//new ColumnConfig("Process ID", "parentId", 25, true),
//new ColumnConfig("Key", "key", 50, true),
- new ColumnConfig("State", "state", 100, true, null, "expand"),
+ new ColumnConfig("State", "state", 100, true,
+ new Renderer()
+ {
+ public String render(Object object, CellMetadata cellMetadata, Record record, int i, int i1, Store store)
+ {
+ ProcessInstanceRef tmp = transform(record);
+ return tmp.getState().toString();
+ }
+ }
+ , "expand"),
new ColumnConfig("Start Date", "startDate", 125, true, new DateRenderer("startDate")),
//new ColumnConfig("End Date", "endDate", 125, true, new DateRenderer("endDate"))
}
More information about the jbpm-commits
mailing list