JBoss JBPM SVN: r3025 - in jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm: enterprise and 4 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-21 06:26:42 -0500 (Fri, 21 Nov 2008)
New Revision: 3025
Added:
jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/config/
jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/config/AppServerConfigurationsTest.java
jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/config/ContainerProvidedJarsTest.java
jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/ejbtimer/
jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/ejbtimer/EjbSchedulerTest.java
jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/jms/
jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/jms/JmsMessageTest.java
jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/jta/
jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/jta/JtaDbPersistenceTest.java
Removed:
jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/AppServerConfigurationsTest.java
jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/ContainerProvidedJarsTest.java
jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/jta/JtaDbPersistenceTest.java
jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/msg/
jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/persistence/
jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/scheduler/
Log:
Move enterprise tests to their own package
Deleted: jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/AppServerConfigurationsTest.java
===================================================================
--- jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/AppServerConfigurationsTest.java 2008-11-21 11:04:59 UTC (rev 3024)
+++ jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/AppServerConfigurationsTest.java 2008-11-21 11:26:42 UTC (rev 3025)
@@ -1,65 +0,0 @@
-/*
- * 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.enterprise;
-
-import junit.framework.Test;
-
-import org.apache.cactus.ServletTestCase;
-import org.jbpm.JbpmConfiguration;
-import org.jbpm.api.test.IntegrationTestSetup;
-import org.jbpm.msg.jms.JmsMessageServiceFactory;
-import org.jbpm.persistence.jta.JtaDbPersistenceServiceFactory;
-import org.jbpm.scheduler.ejbtimer.EntitySchedulerServiceFactory;
-import org.jbpm.svc.Services;
-
-public class AppServerConfigurationsTest extends ServletTestCase
-{
- JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
-
- public static Test suite() throws Exception
- {
- return new IntegrationTestSetup(AppServerConfigurationsTest.class, "enterprise-test.war");
- }
-
- public void testUnavailabilityOfTheJobExecutor()
- {
- assertNull(jbpmConfiguration.getJobExecutor());
- }
-
- public void testJtaDbPersistenceFactoryConfiguration()
- {
- assertSame(JtaDbPersistenceServiceFactory.class, jbpmConfiguration.getServiceFactory(Services.SERVICENAME_PERSISTENCE).getClass());
- JtaDbPersistenceServiceFactory persistenceServiceFactory = (JtaDbPersistenceServiceFactory)jbpmConfiguration.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
- assertFalse(persistenceServiceFactory.isTransactionEnabled());
- assertTrue(persistenceServiceFactory.isCurrentSessionEnabled());
- }
-
- public void testJmsMessageServiceFactoryConfiguration()
- {
- assertSame(JmsMessageServiceFactory.class, jbpmConfiguration.getServiceFactory(Services.SERVICENAME_MESSAGE).getClass());
- }
-
- public void testEjbSchedulerServiceFactoryConfiguration()
- {
- assertSame(EntitySchedulerServiceFactory.class, jbpmConfiguration.getServiceFactory(Services.SERVICENAME_SCHEDULER).getClass());
- }
-}
Deleted: jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/ContainerProvidedJarsTest.java
===================================================================
--- jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/ContainerProvidedJarsTest.java 2008-11-21 11:04:59 UTC (rev 3024)
+++ jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/ContainerProvidedJarsTest.java 2008-11-21 11:26:42 UTC (rev 3025)
@@ -1,119 +0,0 @@
-/*
- * 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.enterprise;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.management.ObjectName;
-
-import junit.framework.TestCase;
-
-import org.jbpm.api.model.builder.ObjectNameFactory;
-import org.jbpm.api.test.IntegrationTestHelper;
-
-/**
- * Test that there are jars deployed which should in fact be provided by the container
- *
- * @author thomas.diesler(a)jboss.com
- * @since 23-Sep-2008
- */
-public class ContainerProvidedJarsTest extends TestCase
-{
- IntegrationTestHelper delegate = new IntegrationTestHelper();
-
- public void testDependencies() throws Exception
- {
- String targetContainer = null;
- if (delegate.isTargetJBoss422())
- {
- targetContainer = "jboss422";
- }
- else if (delegate.isTargetJBoss423())
- {
- targetContainer = "jboss423";
- }
- else if (delegate.isTargetJBoss500())
- {
- targetContainer = "jboss500";
- }
- assertNotNull("System property 'target.container' not null", targetContainer);
- assertTrue("Supported target.container: " + targetContainer, "jboss422,jboss423,jboss500".indexOf(targetContainer) >= 0);
-
- File jbossJars = delegate.getResourceFile(targetContainer + "-dependencies.txt");
- assertTrue("JBoss jar fixture exists: " + jbossJars, jbossJars.exists());
-
- // Read the JBoss ServerHomeDir
- ObjectName oname = ObjectNameFactory.create("jboss.system:type=ServerConfig");
- File serverHomeDir = (File)delegate.getServer().getAttribute(oname, "ServerHomeDir");
- if (serverHomeDir == null)
- throw new IllegalStateException("Cannot obtain jboss home dir");
-
- File jbpmDir = new File(serverHomeDir + "/deploy/jbpm");
- assertTrue("jBPM dir exists: " + jbpmDir, jbpmDir.exists());
-
- // Store the deployed jars in a string builder
- String deployedJars = getDeployedJars(jbpmDir).toString();
-
- // Iterate over the known server provided jars
- List<String> matchingJars = new ArrayList<String>();
- BufferedReader br = new BufferedReader(new FileReader(jbossJars));
- String line = br.readLine();
- while (line != null)
- {
- if (line.length() == 0 || line.startsWith("#"))
- {
- line = br.readLine();
- continue;
- }
-
- if (deployedJars.indexOf(line) > 0)
- {
- matchingJars.add(line);
- }
- line = br.readLine();
- }
-
- assertEquals("Invalid deployed jars: " + matchingJars, 0, matchingJars.size());
- }
-
- private List<String> getDeployedJars(File subdir)
- {
- List<String> deployedJars = new ArrayList<String>();
- for (File file : subdir.listFiles())
- {
- if (file.isDirectory())
- {
- deployedJars.addAll(getDeployedJars(file));
- continue;
- }
-
- String fileName = file.getName();
- if (fileName.endsWith(".jar"))
- deployedJars.add(fileName);
- }
- return deployedJars;
- }
-}
Added: jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/config/AppServerConfigurationsTest.java
===================================================================
--- jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/config/AppServerConfigurationsTest.java (rev 0)
+++ jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/config/AppServerConfigurationsTest.java 2008-11-21 11:26:42 UTC (rev 3025)
@@ -0,0 +1,65 @@
+/*
+ * 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.enterprise.config;
+
+import junit.framework.Test;
+
+import org.apache.cactus.ServletTestCase;
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.api.test.IntegrationTestSetup;
+import org.jbpm.msg.jms.JmsMessageServiceFactory;
+import org.jbpm.persistence.jta.JtaDbPersistenceServiceFactory;
+import org.jbpm.scheduler.ejbtimer.EntitySchedulerServiceFactory;
+import org.jbpm.svc.Services;
+
+public class AppServerConfigurationsTest extends ServletTestCase
+{
+ JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
+
+ public static Test suite() throws Exception
+ {
+ return new IntegrationTestSetup(AppServerConfigurationsTest.class, "enterprise-test.war");
+ }
+
+ public void testUnavailabilityOfTheJobExecutor()
+ {
+ assertNull(jbpmConfiguration.getJobExecutor());
+ }
+
+ public void testJtaDbPersistenceFactoryConfiguration()
+ {
+ assertSame(JtaDbPersistenceServiceFactory.class, jbpmConfiguration.getServiceFactory(Services.SERVICENAME_PERSISTENCE).getClass());
+ JtaDbPersistenceServiceFactory persistenceServiceFactory = (JtaDbPersistenceServiceFactory)jbpmConfiguration.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
+ assertFalse(persistenceServiceFactory.isTransactionEnabled());
+ assertTrue(persistenceServiceFactory.isCurrentSessionEnabled());
+ }
+
+ public void testJmsMessageServiceFactoryConfiguration()
+ {
+ assertSame(JmsMessageServiceFactory.class, jbpmConfiguration.getServiceFactory(Services.SERVICENAME_MESSAGE).getClass());
+ }
+
+ public void testEjbSchedulerServiceFactoryConfiguration()
+ {
+ assertSame(EntitySchedulerServiceFactory.class, jbpmConfiguration.getServiceFactory(Services.SERVICENAME_SCHEDULER).getClass());
+ }
+}
Property changes on: jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/config/AppServerConfigurationsTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/config/ContainerProvidedJarsTest.java
===================================================================
--- jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/config/ContainerProvidedJarsTest.java (rev 0)
+++ jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/config/ContainerProvidedJarsTest.java 2008-11-21 11:26:42 UTC (rev 3025)
@@ -0,0 +1,119 @@
+/*
+ * 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.enterprise.config;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.management.ObjectName;
+
+import junit.framework.TestCase;
+
+import org.jbpm.api.model.builder.ObjectNameFactory;
+import org.jbpm.api.test.IntegrationTestHelper;
+
+/**
+ * Test that there are jars deployed which should in fact be provided by the container
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 23-Sep-2008
+ */
+public class ContainerProvidedJarsTest extends TestCase
+{
+ IntegrationTestHelper delegate = new IntegrationTestHelper();
+
+ public void testDependencies() throws Exception
+ {
+ String targetContainer = null;
+ if (delegate.isTargetJBoss422())
+ {
+ targetContainer = "jboss422";
+ }
+ else if (delegate.isTargetJBoss423())
+ {
+ targetContainer = "jboss423";
+ }
+ else if (delegate.isTargetJBoss500())
+ {
+ targetContainer = "jboss500";
+ }
+ assertNotNull("System property 'target.container' not null", targetContainer);
+ assertTrue("Supported target.container: " + targetContainer, "jboss422,jboss423,jboss500".indexOf(targetContainer) >= 0);
+
+ File jbossJars = delegate.getResourceFile(targetContainer + "-dependencies.txt");
+ assertTrue("JBoss jar fixture exists: " + jbossJars, jbossJars.exists());
+
+ // Read the JBoss ServerHomeDir
+ ObjectName oname = ObjectNameFactory.create("jboss.system:type=ServerConfig");
+ File serverHomeDir = (File)delegate.getServer().getAttribute(oname, "ServerHomeDir");
+ if (serverHomeDir == null)
+ throw new IllegalStateException("Cannot obtain jboss home dir");
+
+ File jbpmDir = new File(serverHomeDir + "/deploy/jbpm");
+ assertTrue("jBPM dir exists: " + jbpmDir, jbpmDir.exists());
+
+ // Store the deployed jars in a string builder
+ String deployedJars = getDeployedJars(jbpmDir).toString();
+
+ // Iterate over the known server provided jars
+ List<String> matchingJars = new ArrayList<String>();
+ BufferedReader br = new BufferedReader(new FileReader(jbossJars));
+ String line = br.readLine();
+ while (line != null)
+ {
+ if (line.length() == 0 || line.startsWith("#"))
+ {
+ line = br.readLine();
+ continue;
+ }
+
+ if (deployedJars.indexOf(line) > 0)
+ {
+ matchingJars.add(line);
+ }
+ line = br.readLine();
+ }
+
+ assertEquals("Invalid deployed jars: " + matchingJars, 0, matchingJars.size());
+ }
+
+ private List<String> getDeployedJars(File subdir)
+ {
+ List<String> deployedJars = new ArrayList<String>();
+ for (File file : subdir.listFiles())
+ {
+ if (file.isDirectory())
+ {
+ deployedJars.addAll(getDeployedJars(file));
+ continue;
+ }
+
+ String fileName = file.getName();
+ if (fileName.endsWith(".jar"))
+ deployedJars.add(fileName);
+ }
+ return deployedJars;
+ }
+}
Property changes on: jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/config/ContainerProvidedJarsTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/ejbtimer/EjbSchedulerTest.java
===================================================================
--- jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/ejbtimer/EjbSchedulerTest.java (rev 0)
+++ jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/ejbtimer/EjbSchedulerTest.java 2008-11-21 11:26:42 UTC (rev 3025)
@@ -0,0 +1,321 @@
+/*
+ * 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.enterprise.ejbtimer;
+
+import java.rmi.RemoteException;
+import java.util.Collections;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import junit.framework.Test;
+
+import org.apache.cactus.ServletTestCase;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jbpm.EventCallback;
+import org.jbpm.JbpmContext;
+import org.jbpm.api.test.IntegrationTestSetup;
+import org.jbpm.command.Command;
+import org.jbpm.command.DeployProcessCommand;
+import org.jbpm.command.StartProcessInstanceCommand;
+import org.jbpm.ejb.LocalCommandService;
+import org.jbpm.ejb.LocalCommandServiceHome;
+import org.jbpm.graph.def.Event;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.graph.exe.Token;
+import org.jbpm.scheduler.ejbtimer.EntitySchedulerService;
+
+/**
+ * Exercises for the {@linkplain EntitySchedulerService EJB scheduler service}.
+ *
+ * @author Alejandro Guizar
+ */
+public class EjbSchedulerTest extends ServletTestCase {
+
+ private LocalCommandService commandService;
+
+ private static LocalCommandServiceHome commandServiceHome;
+
+ private static final Log log = LogFactory.getLog(EjbSchedulerTest.class);
+
+ public static Test suite() throws Exception {
+ return new IntegrationTestSetup(EjbSchedulerTest.class, "enterprise-test.war");
+ }
+
+ protected void setUp() throws Exception {
+ if (commandServiceHome == null) {
+ Context initialContext = new InitialContext();
+ try {
+ commandServiceHome = (LocalCommandServiceHome) initialContext.lookup("java:comp/env/ejb/CommandServiceBean");
+ }
+ finally {
+ initialContext.close();
+ }
+ }
+ commandService = commandServiceHome.create();
+ log.info("### " + getName() + " started ###");
+ }
+
+ protected void tearDown() throws Exception {
+ log.info("### " + getName() + " done ###");
+ commandService = null;
+ }
+
+ public void testScheduleFuture() throws Exception {
+ deployProcess("<process-definition name='future'>"
+ + " <event type='process-end'>"
+ + " <action expression='#{eventCallback.processEnd}'/>"
+ + " </event>"
+ + " <start-state name='start'>"
+ + " <transition to='a' />"
+ + " </start-state>"
+ + " <state name='a'>"
+ + " <timer duedate='1 second' transition='timeout' />"
+ + " <transition name='timeout' to='end' />"
+ + " </state>"
+ + " <end-state name='end' />"
+ + "</process-definition>");
+ long processId = launchProcess("future").getId();
+ EventCallback.waitForEvent(Event.EVENTTYPE_PROCESS_END);
+ assertTrue(isProcessFinished(processId));
+ }
+
+ public void testSchedulePast() throws Exception {
+ deployProcess("<process-definition name='past'>"
+ + " <event type='process-end'>"
+ + " <action expression='#{eventCallback.processEnd}'/>"
+ + " </event>"
+ + " <start-state name='start'>"
+ + " <transition to='a' />"
+ + " </start-state>"
+ + " <state name='a'>"
+ + " <timer duedate='-1 second' transition='timeout' />"
+ + " <transition name='timeout' to='end' />"
+ + " </state>"
+ + " <end-state name='end' />"
+ + "</process-definition>");
+ long processId = launchProcess("past").getId();
+ EventCallback.waitForEvent(Event.EVENTTYPE_PROCESS_END);
+ assertTrue(isProcessFinished(processId));
+ }
+
+ public void testScheduleRepeat() throws Exception {
+ deployProcess("<process-definition name='repeat'>"
+ + " <event type='timer'>"
+ + " <action expression='#{eventCallback.timer}'/>"
+ + " </event>"
+ + " <start-state name='start'>"
+ + " <transition to='a' />"
+ + " </start-state>"
+ + " <state name='a'>"
+ + " <timer duedate='1 second' repeat='1 second' />"
+ + " <transition to='end' />"
+ + " </state>"
+ + " <end-state name='end' />"
+ + "</process-definition>");
+ long processId = launchProcess("repeat").getId();
+ for (int i = 0; i < 3; i++) {
+ EventCallback.waitForEvent(Event.EVENTTYPE_TIMER);
+ assertEquals("a", getProcessState(processId));
+ }
+ signalProcess(processId);
+ assertTrue(isProcessFinished(processId));
+ }
+
+ public void testCancel() throws Exception {
+ deployProcess("<process-definition name='cancel'>"
+ + " <event type='timer'>"
+ + " <action expression='#{eventCallback.timer}'/>"
+ + " </event>"
+ + " <start-state name='start'>"
+ + " <transition to='a' />"
+ + " </start-state>"
+ + " <state name='a'>"
+ + " <timer duedate='1 second' repeat='1 second' />"
+ + " <transition to='end' />"
+ + " </state>"
+ + " <end-state name='end' />"
+ + "</process-definition>");
+ ProcessInstance process = launchProcess("cancel");
+ long processId = process.getId();
+ // first expiration
+ EventCallback.waitForEvent(Event.EVENTTYPE_TIMER);
+ assertEquals("a", getProcessState(processId));
+ // repeated expiration
+ EventCallback.waitForEvent(Event.EVENTTYPE_TIMER);
+ assertEquals("a", getProcessState(processId));
+ // no more expirations
+ cancelTimer("a", process.getRootToken().getId());
+ EventCallback.waitForEvent(Event.EVENTTYPE_TIMER, 2000);
+ signalProcess(processId);
+ assertTrue(isProcessFinished(processId));
+ }
+
+ public void testScheduleSequence() throws Exception {
+ deployProcess("<process-definition name='sequence'>"
+ + " <event type='process-end'>"
+ + " <action expression='#{eventCallback.processEnd}'/>"
+ + " </event>"
+ + " <event type='timer'>"
+ + " <action expression='#{eventCallback.timer}'/>"
+ + " </event>"
+ + " <start-state>"
+ + " <transition to='a' />"
+ + " </start-state>"
+ + " <state name='a'>"
+ + " <timer duedate='500 milliseconds' transition='timeout' />"
+ + " <transition name='timeout' to='b' />"
+ + " </state>"
+ + " <state name='b'>"
+ + " <timer duedate='500 milliseconds' transition='timeout' />"
+ + " <transition name='timeout' to='c' />"
+ + " </state>"
+ + " <state name='c'>"
+ + " <timer duedate='500 milliseconds' transition='timeout' />"
+ + " <transition name='timeout' to='d' />"
+ + " </state>"
+ + " <state name='d'>"
+ + " <timer duedate='500 milliseconds' transition='timeout' />"
+ + " <transition name='timeout' to='e' />"
+ + " </state>"
+ + " <state name='e'>"
+ + " <timer duedate='500 milliseconds' transition='timeout' />"
+ + " <transition name='timeout' to='end' />"
+ + " </state>"
+ + " <end-state name='end' />"
+ + "</process-definition>");
+ long processId = launchProcess("sequence").getId();
+ char state = 'b';
+ for (int i = 0; i < 4; i++) {
+ EventCallback.waitForEvent(Event.EVENTTYPE_TIMER);
+ assertEquals(Character.toString(state++), getProcessState(processId));
+ }
+ EventCallback.waitForEvent(Event.EVENTTYPE_PROCESS_END);
+ assertTrue(isProcessFinished(processId));
+ }
+
+ public void testScheduleFork() throws Exception {
+ deployProcess("<process-definition name='fork'>"
+ + " <event type='process-end'>"
+ + " <action expression='#{eventCallback.processEnd}'/>"
+ + " </event>"
+ + " <start-state>"
+ + " <transition to='f' />"
+ + " </start-state>"
+ + " <fork name='f'>"
+ + " <transition name='a' to='a' />"
+ + " <transition name='b' to='b' />"
+ + " <transition name='c' to='c' />"
+ + " <transition name='d' to='d' />"
+ + " <transition name='e' to='e' />"
+ + " </fork>"
+ + " <state name='a'>"
+ + " <timer duedate='0.25 seconds' transition='timeout' />"
+ + " <transition name='timeout' to='j' />"
+ + " </state>"
+ + " <state name='b'>"
+ + " <timer duedate='0.5 seconds' transition='timeout' />"
+ + " <transition name='timeout' to='j' />"
+ + " </state>"
+ + " <state name='c'>"
+ + " <timer duedate='0.75 seconds' transition='timeout' />"
+ + " <transition name='timeout' to='j' />"
+ + " </state>"
+ + " <state name='d'>"
+ + " <timer duedate='1 second' transition='timeout' />"
+ + " <transition name='timeout' to='j' />"
+ + " </state>"
+ + " <state name='e'>"
+ + " <timer duedate='1.25 second' transition='timeout' />"
+ + " <transition name='timeout' to='j' />"
+ + " </state>"
+ + " <join name='j' async='exclusive'>"
+ + " <transition to='end' />"
+ + " </join>"
+ + " <end-state name='end' />"
+ + "</process-definition>");
+ long processId = launchProcess("fork").getId();
+ EventCallback.waitForEvent(Event.EVENTTYPE_PROCESS_END);
+ assertTrue(isProcessFinished(processId));
+ }
+
+ private ProcessDefinition deployProcess(String xml) throws RemoteException {
+ return (ProcessDefinition) commandService.execute(new DeployProcessCommand(xml));
+ }
+
+ private ProcessInstance launchProcess(String processName) throws RemoteException {
+ StartProcessInstanceCommand command = new StartProcessInstanceCommand();
+ command.setProcessName(processName);
+ command.setVariables(Collections.singletonMap("eventCallback", new EventCallback()));
+ return (ProcessInstance) commandService.execute(command);
+ }
+
+ private void signalProcess(final long processId) throws RemoteException {
+ commandService.execute(new Command() {
+
+ private static final long serialVersionUID = 1L;
+
+ public Object execute(JbpmContext jbpmContext) throws Exception {
+ jbpmContext.loadProcessInstanceForUpdate(processId).signal();
+ return null;
+ }
+ });
+ }
+
+ private String getProcessState(final long processId) throws RemoteException {
+ return (String) commandService.execute(new Command() {
+
+ private static final long serialVersionUID = 1L;
+
+ public Object execute(JbpmContext jbpmContext) throws Exception {
+ return jbpmContext.loadProcessInstance(processId).getRootToken().getNode().getName();
+ }
+ });
+ }
+
+ private boolean isProcessFinished(final long processId) throws RemoteException {
+ Boolean isFinished = (Boolean) commandService.execute(new Command() {
+
+ private static final long serialVersionUID = 1L;
+
+ public Object execute(JbpmContext jbpmContext) throws Exception {
+ return jbpmContext.loadProcessInstance(processId).hasEnded();
+ }
+ });
+ return isFinished.booleanValue();
+ }
+
+ private void cancelTimer(final String timerName, final long tokenId) throws RemoteException {
+ commandService.execute(new Command() {
+
+ private static final long serialVersionUID = 1L;
+
+ public Object execute(JbpmContext jbpmContext) throws Exception {
+ Token token = jbpmContext.loadToken(tokenId);
+ jbpmContext.getServices().getSchedulerService().deleteTimersByName(timerName, token);
+ return null;
+ }
+ });
+ }
+}
Property changes on: jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/ejbtimer/EjbSchedulerTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/jms/JmsMessageTest.java
===================================================================
--- jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/jms/JmsMessageTest.java (rev 0)
+++ jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/jms/JmsMessageTest.java 2008-11-21 11:26:42 UTC (rev 3025)
@@ -0,0 +1,283 @@
+/*
+ * 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.enterprise.jms;
+
+import java.util.Collections;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import junit.framework.Test;
+
+import org.apache.cactus.ServletTestCase;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jbpm.EventCallback;
+import org.jbpm.JbpmContext;
+import org.jbpm.api.test.IntegrationTestSetup;
+import org.jbpm.command.Command;
+import org.jbpm.command.DeployProcessCommand;
+import org.jbpm.command.StartProcessInstanceCommand;
+import org.jbpm.ejb.LocalCommandService;
+import org.jbpm.ejb.LocalCommandServiceHome;
+import org.jbpm.graph.def.Event;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.msg.jms.JmsMessageService;
+
+/**
+ * Exercises for the {@linkplain JmsMessageService JMS message service}.
+ * @author Alejandro Guizar
+ */
+public class JmsMessageTest extends ServletTestCase {
+
+ private LocalCommandService commandService;
+
+ private static LocalCommandServiceHome commandServiceHome;
+
+ static final int processExecutionCount = 5;
+ static final int maxWaitTime = 10 * 1000;
+
+ public static Test suite() throws Exception {
+ return new IntegrationTestSetup(JmsMessageTest.class, "enterprise-test.war");
+ }
+
+ protected void setUp() throws Exception
+ {
+ if (commandServiceHome == null) {
+ Context initialContext = new InitialContext();
+ try {
+ commandServiceHome = (LocalCommandServiceHome) initialContext.lookup("java:comp/env/ejb/CommandServiceBean");
+ }
+ finally {
+ initialContext.close();
+ }
+ }
+ commandService = commandServiceHome.create();
+ log.info("### " + getName() + " started ###");
+ }
+
+ protected void tearDown() throws Exception
+ {
+ log.info("### " + getName() + " done ###");
+ commandService = null;
+ EventCallback.clear();
+ }
+
+ public void testAsyncNode()
+ {
+ deployProcess("<process-definition name='node'>"
+ + " <event type='process-end'>"
+ + " <action expression='#{eventCallback.processEnd}'/>"
+ + " </event>"
+ + " <start-state name='start'>"
+ + " <transition to='a' />"
+ + " </start-state>"
+ + " <node name='a' async='true'>"
+ + " <transition to='end' />"
+ + " </node>"
+ + " <end-state name='end' />"
+ + "</process-definition>");
+ long processId = launchProcess("node").getId();
+ EventCallback.waitForEvent(Event.EVENTTYPE_PROCESS_END);
+ assertTrue("Process has ended", hasProcessEnded(processId));
+ }
+
+ public void testAsyncAction()
+ {
+ deployProcess("<process-definition name='action'>"
+ + " <start-state name='start'>"
+ + " <transition to='a' />"
+ + " </start-state>"
+ + " <node name='a'>"
+ + " <event type='node-enter'>"
+ + " <action async='true' expression='#{eventCallback.nodeEnter}' />"
+ + " </event>"
+ + " <event type='node-leave'>"
+ + " <action async='true' expression='#{eventCallback.nodeLeave}' />"
+ + " </event>"
+ + " <transition to='end'>"
+ + " <action async='true' expression='#{eventCallback.transition}' />"
+ + " </transition>"
+ + " </node>"
+ + " <end-state name='end' />"
+ + "</process-definition>");
+ long processId = launchProcess("action").getId();
+ EventCallback.waitForEvent(Event.EVENTTYPE_NODE_ENTER);
+ EventCallback.waitForEvent(Event.EVENTTYPE_NODE_LEAVE);
+ EventCallback.waitForEvent(Event.EVENTTYPE_TRANSITION);
+ assertTrue("Process has ended", hasProcessEnded(processId));
+ }
+
+ public void testAsyncSequence()
+ {
+ deployProcess("<process-definition name='sequence'>"
+ + " <event type='process-end'>"
+ + " <action expression='#{eventCallback.processEnd}'/>"
+ + " </event>"
+ + " <start-state>"
+ + " <transition to='a' />"
+ + " </start-state>"
+ + " <node name='a' async='true'>"
+ + " <transition to='b' />"
+ + " </node>"
+ + " <node name='b' async='true'>"
+ + " <transition to='c' />"
+ + " </node>"
+ + " <node name='c' async='true'>"
+ + " <transition to='d' />"
+ + " </node>"
+ + " <node name='d' async='true'>"
+ + " <transition to='e' />"
+ + " </node>"
+ + " <node name='e' async='true'>"
+ + " <transition to='end' />"
+ + " </node>"
+ + " <end-state name='end' />"
+ + "</process-definition>");
+ long processId = launchProcess("sequence").getId();
+ EventCallback.waitForEvent(Event.EVENTTYPE_PROCESS_END);
+ assertTrue("Process has ended", hasProcessEnded(processId));
+ }
+
+ public void testAsyncFork() throws Exception
+ {
+ deployProcess("<process-definition name='fork'>"
+ + " <event type='process-end'>"
+ + " <action expression='#{eventCallback.processEnd}'/>"
+ + " </event>"
+ + " <start-state>"
+ + " <transition to='f' />"
+ + " </start-state>"
+ + " <fork name='f'>"
+ + " <transition name='a' to='a' />"
+ + " <transition name='b' to='b' />"
+ + " <transition name='c' to='c' />"
+ + " <transition name='d' to='d' />"
+ + " <transition name='e' to='e' />"
+ + " </fork>"
+ + " <node name='a'>"
+ + " <transition to='j' />"
+ + " </node>"
+ + " <node name='b' async='true'>"
+ + " <transition to='j' />"
+ + " </node>"
+ + " <node name='c' async='true'>"
+ + " <transition to='j' />"
+ + " </node>"
+ + " <node name='d' async='true'>"
+ + " <transition to='j' />"
+ + " </node>"
+ + " <node name='e' async='true'>"
+ + " <transition to='j' />"
+ + " </node>"
+ + " <join name='j' async='exclusive'>"
+ + " <transition to='end' />"
+ + " </join>"
+ + " <end-state name='end' />"
+ + "</process-definition>");
+ long processId = launchProcess("fork").getId();
+ EventCallback.waitForEvent(Event.EVENTTYPE_PROCESS_END);
+ Thread.sleep(1000);
+ assertTrue("Process has ended", hasProcessEnded(processId));
+ }
+
+ public void testAsyncExecutions()
+ {
+ deployProcess("<process-definition name='execution'>"
+ + " <event type='process-end'>"
+ + " <action expression='#{eventCallback.processEnd}' />"
+ + " </event>"
+ + " <start-state>"
+ + " <transition to='a' />"
+ + " </start-state>"
+ + " <node name='a' async='true'>"
+ + " <transition to='b' />"
+ + " </node>"
+ + " <node name='b'>"
+ + " <event type='node-enter'>"
+ + " <action async='exclusive' expression='#{eventCallback.nodeEnter}' />"
+ + " </event>"
+ + " <transition to='c' />"
+ + " </node>"
+ + " <node name='c' async='exclusive'>"
+ + " <transition to='d' />"
+ + " </node>"
+ + " <node name='d'>"
+ + " <event type='node-leave'>"
+ + " <action async='exclusive' expression='#{eventCallback.nodeLeave}' />"
+ + " </event>"
+ + " <transition to='e' />"
+ + " </node>"
+ + " <node name='e' async='exclusive'>"
+ + " <transition to='end' />"
+ + " </node>"
+ + " <end-state name='end' />"
+ + "</process-definition>");
+ long[] processIds = new long[processExecutionCount];
+ for (int i = 0; i < processExecutionCount; i++) {
+ processIds[i] = launchProcess("execution").getId();
+ EventCallback.waitForEvent(Event.EVENTTYPE_NODE_ENTER);
+ }
+ for (int i = 0; i < processExecutionCount; i++) {
+ EventCallback.waitForEvent(Event.EVENTTYPE_NODE_LEAVE);
+ }
+ for (int i = 0; i < processExecutionCount; i++) {
+ waitForProcessEnd(processIds[i]);
+ assertTrue(hasProcessEnded(processIds[i]));
+ }
+ }
+
+ private ProcessDefinition deployProcess(String xml) {
+ return (ProcessDefinition) commandService.execute(new DeployProcessCommand(xml));
+ }
+
+ private ProcessInstance launchProcess(String processName) {
+ StartProcessInstanceCommand command = new StartProcessInstanceCommand();
+ command.setProcessName(processName);
+ command.setVariables(Collections.singletonMap("eventCallback", new EventCallback()));
+ return (ProcessInstance) commandService.execute(command);
+ }
+
+ private boolean hasProcessEnded(final long processId) {
+ Boolean isFinished = (Boolean) commandService.execute(new Command() {
+ private static final long serialVersionUID = 1L;
+ public Object execute(JbpmContext jbpmContext) throws Exception {
+ return jbpmContext.loadProcessInstance(processId).hasEnded();
+ }
+ });
+ return isFinished.booleanValue();
+ }
+
+ private void waitForProcessEnd(long processId) {
+ long startTime = System.currentTimeMillis();
+ do {
+ EventCallback.waitForEvent(Event.EVENTTYPE_PROCESS_END, 1000);
+ if (System.currentTimeMillis() - startTime > maxWaitTime) {
+ log.warn("process " + processId + " took too long");
+ break;
+ }
+ } while (!hasProcessEnded(processId));
+ }
+
+ private static Log log = LogFactory.getLog(JmsMessageTest.class);
+}
Property changes on: jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/jms/JmsMessageTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/jta (from rev 3019, jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/persistence/jta)
Deleted: jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/jta/JtaDbPersistenceTest.java
===================================================================
--- jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/persistence/jta/JtaDbPersistenceTest.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/jta/JtaDbPersistenceTest.java 2008-11-21 11:26:42 UTC (rev 3025)
@@ -1,252 +0,0 @@
-/*
- * 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.persistence.jta;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.transaction.UserTransaction;
-
-import junit.framework.Test;
-
-import org.apache.cactus.ServletTestCase;
-import org.jbpm.JbpmConfiguration;
-import org.jbpm.JbpmContext;
-import org.jbpm.api.test.IntegrationTestSetup;
-import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.graph.exe.ProcessInstance;
-
-public class JtaDbPersistenceTest extends ServletTestCase
-{
-
- private JbpmConfiguration jbpmConfiguration;
- private UserTransaction tx;
- private boolean rollback;
-
- private static long definitionId;
-
- public static Test suite() throws Exception
- {
- return new IntegrationTestSetup(JtaDbPersistenceTest.class, "enterprise-test.war");
- }
-
- protected void setUp() throws Exception
- {
- jbpmConfiguration = JbpmConfiguration.getInstance();
- }
-
- public void testUserTx() throws Exception
- {
- tx = getUserTransaction();
- testServiceTx();
- }
-
- public void testUserTxRollback() throws Exception
- {
- tx = getUserTransaction();
- testServiceTxRollback();
- }
-
- public void testServiceTx() throws Exception
- {
- long definitionId = deployProcess();
- long instanceId = launchProcess(definitionId);
- signal(instanceId);
- assertTrue(hasEnded(instanceId));
- }
-
- public void testServiceTxRollback() throws Exception
- {
- rollback = true;
- long definitionId = deployProcess();
- long instanceId = launchProcess(definitionId);
- signal(instanceId);
- assertFalse(hasEnded(instanceId));
- }
-
- private long deployProcess() throws Exception
- {
- if (definitionId == 0)
- {
- try
- {
- if (tx != null)
- tx.begin();
- JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
- try
- {
- assertEquals(tx == null, isTxCreatedByService(jbpmContext));
- ProcessDefinition definition = ProcessDefinition.parseXmlString("<process-definition name='tx'>" + " <start-state name='start'>"
- + " <transition to='midway' />" + " </start-state>" + " <state name='midway'>" + " <transition to='end' />" + " </state>"
- + " <end-state name='end' />" + "</process-definition>");
- jbpmContext.deployProcessDefinition(definition);
- definitionId = definition.getId();
- }
- catch (RuntimeException e)
- {
- if (tx == null)
- jbpmContext.setRollbackOnly();
- throw e;
- }
- finally
- {
- jbpmContext.close();
- }
- if (tx != null)
- tx.commit();
- }
- catch (Exception e)
- {
- if (tx != null)
- tx.rollback();
- throw e;
- }
- }
- return definitionId;
- }
-
- private long launchProcess(long definitionId) throws Exception
- {
- try
- {
- if (tx != null)
- tx.begin();
- JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
- ProcessInstance instance;
- try
- {
- assertEquals(tx == null, isTxCreatedByService(jbpmContext));
- ProcessDefinition definition = jbpmContext.getGraphSession().loadProcessDefinition(definitionId);
- instance = new ProcessInstance(definition);
- instance.signal();
- jbpmContext.save(instance);
- }
- catch (RuntimeException e)
- {
- if (tx == null)
- jbpmContext.setRollbackOnly();
- throw e;
- }
- finally
- {
- jbpmContext.close();
- }
- if (tx != null)
- tx.commit();
- return instance.getId();
- }
- catch (Exception e)
- {
- if (tx != null)
- tx.rollback();
- throw e;
- }
- }
-
- private void signal(long instanceId) throws Exception
- {
- try
- {
- if (tx != null)
- tx.begin();
- JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
- try
- {
- assertEquals(tx == null, isTxCreatedByService(jbpmContext));
- ProcessInstance instance = jbpmContext.loadProcessInstanceForUpdate(instanceId);
- instance.signal();
- if (rollback && tx == null)
- jbpmContext.setRollbackOnly();
- }
- catch (RuntimeException e)
- {
- if (tx == null)
- jbpmContext.setRollbackOnly();
- throw e;
- }
- finally
- {
- jbpmContext.close();
- }
- if (tx != null)
- {
- if (rollback)
- tx.rollback();
- else
- tx.commit();
- }
- }
- catch (Exception e)
- {
- if (tx != null)
- tx.rollback();
- throw e;
- }
- }
-
- private boolean hasEnded(long instanceId) throws Exception
- {
- try
- {
- if (tx != null)
- tx.begin();
- JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
- ProcessInstance instance;
- try
- {
- assertEquals(tx == null, isTxCreatedByService(jbpmContext));
- instance = jbpmContext.loadProcessInstanceForUpdate(instanceId);
- }
- catch (RuntimeException e)
- {
- if (tx == null)
- jbpmContext.setRollbackOnly();
- throw e;
- }
- finally
- {
- jbpmContext.close();
- }
- if (tx != null)
- tx.commit();
- return instance.hasEnded();
- }
- catch (Exception e)
- {
- if (tx != null)
- tx.rollback();
- throw e;
- }
- }
-
- private boolean isTxCreatedByService(JbpmContext jbpmContext)
- {
- JtaDbPersistenceService persistenceService = (JtaDbPersistenceService)jbpmContext.getServices().getPersistenceService();
- return persistenceService.isJtaTxCreated();
- }
-
- private static UserTransaction getUserTransaction() throws NamingException
- {
- Context initial = new InitialContext();
- return (UserTransaction)initial.lookup("java:comp/UserTransaction");
- }
-}
Copied: jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/jta/JtaDbPersistenceTest.java (from rev 3024, jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/persistence/jta/JtaDbPersistenceTest.java)
===================================================================
--- jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/jta/JtaDbPersistenceTest.java (rev 0)
+++ jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/jta/JtaDbPersistenceTest.java 2008-11-21 11:26:42 UTC (rev 3025)
@@ -0,0 +1,253 @@
+/*
+ * 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.enterprise.jta;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.transaction.UserTransaction;
+
+import junit.framework.Test;
+
+import org.apache.cactus.ServletTestCase;
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.JbpmContext;
+import org.jbpm.api.test.IntegrationTestSetup;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.persistence.jta.JtaDbPersistenceService;
+
+public class JtaDbPersistenceTest extends ServletTestCase
+{
+
+ private JbpmConfiguration jbpmConfiguration;
+ private UserTransaction tx;
+ private boolean rollback;
+
+ private static long definitionId;
+
+ public static Test suite() throws Exception
+ {
+ return new IntegrationTestSetup(JtaDbPersistenceTest.class, "enterprise-test.war");
+ }
+
+ protected void setUp() throws Exception
+ {
+ jbpmConfiguration = JbpmConfiguration.getInstance();
+ }
+
+ public void testUserTx() throws Exception
+ {
+ tx = getUserTransaction();
+ testServiceTx();
+ }
+
+ public void testUserTxRollback() throws Exception
+ {
+ tx = getUserTransaction();
+ testServiceTxRollback();
+ }
+
+ public void testServiceTx() throws Exception
+ {
+ long definitionId = deployProcess();
+ long instanceId = launchProcess(definitionId);
+ signal(instanceId);
+ assertTrue(hasEnded(instanceId));
+ }
+
+ public void testServiceTxRollback() throws Exception
+ {
+ rollback = true;
+ long definitionId = deployProcess();
+ long instanceId = launchProcess(definitionId);
+ signal(instanceId);
+ assertFalse(hasEnded(instanceId));
+ }
+
+ private long deployProcess() throws Exception
+ {
+ if (definitionId == 0)
+ {
+ try
+ {
+ if (tx != null)
+ tx.begin();
+ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+ try
+ {
+ assertEquals(tx == null, isTxCreatedByService(jbpmContext));
+ ProcessDefinition definition = ProcessDefinition.parseXmlString("<process-definition name='tx'>" + " <start-state name='start'>"
+ + " <transition to='midway' />" + " </start-state>" + " <state name='midway'>" + " <transition to='end' />" + " </state>"
+ + " <end-state name='end' />" + "</process-definition>");
+ jbpmContext.deployProcessDefinition(definition);
+ definitionId = definition.getId();
+ }
+ catch (RuntimeException e)
+ {
+ if (tx == null)
+ jbpmContext.setRollbackOnly();
+ throw e;
+ }
+ finally
+ {
+ jbpmContext.close();
+ }
+ if (tx != null)
+ tx.commit();
+ }
+ catch (Exception e)
+ {
+ if (tx != null)
+ tx.rollback();
+ throw e;
+ }
+ }
+ return definitionId;
+ }
+
+ private long launchProcess(long definitionId) throws Exception
+ {
+ try
+ {
+ if (tx != null)
+ tx.begin();
+ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+ ProcessInstance instance;
+ try
+ {
+ assertEquals(tx == null, isTxCreatedByService(jbpmContext));
+ ProcessDefinition definition = jbpmContext.getGraphSession().loadProcessDefinition(definitionId);
+ instance = new ProcessInstance(definition);
+ instance.signal();
+ jbpmContext.save(instance);
+ }
+ catch (RuntimeException e)
+ {
+ if (tx == null)
+ jbpmContext.setRollbackOnly();
+ throw e;
+ }
+ finally
+ {
+ jbpmContext.close();
+ }
+ if (tx != null)
+ tx.commit();
+ return instance.getId();
+ }
+ catch (Exception e)
+ {
+ if (tx != null)
+ tx.rollback();
+ throw e;
+ }
+ }
+
+ private void signal(long instanceId) throws Exception
+ {
+ try
+ {
+ if (tx != null)
+ tx.begin();
+ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+ try
+ {
+ assertEquals(tx == null, isTxCreatedByService(jbpmContext));
+ ProcessInstance instance = jbpmContext.loadProcessInstanceForUpdate(instanceId);
+ instance.signal();
+ if (rollback && tx == null)
+ jbpmContext.setRollbackOnly();
+ }
+ catch (RuntimeException e)
+ {
+ if (tx == null)
+ jbpmContext.setRollbackOnly();
+ throw e;
+ }
+ finally
+ {
+ jbpmContext.close();
+ }
+ if (tx != null)
+ {
+ if (rollback)
+ tx.rollback();
+ else
+ tx.commit();
+ }
+ }
+ catch (Exception e)
+ {
+ if (tx != null)
+ tx.rollback();
+ throw e;
+ }
+ }
+
+ private boolean hasEnded(long instanceId) throws Exception
+ {
+ try
+ {
+ if (tx != null)
+ tx.begin();
+ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+ ProcessInstance instance;
+ try
+ {
+ assertEquals(tx == null, isTxCreatedByService(jbpmContext));
+ instance = jbpmContext.loadProcessInstanceForUpdate(instanceId);
+ }
+ catch (RuntimeException e)
+ {
+ if (tx == null)
+ jbpmContext.setRollbackOnly();
+ throw e;
+ }
+ finally
+ {
+ jbpmContext.close();
+ }
+ if (tx != null)
+ tx.commit();
+ return instance.hasEnded();
+ }
+ catch (Exception e)
+ {
+ if (tx != null)
+ tx.rollback();
+ throw e;
+ }
+ }
+
+ private boolean isTxCreatedByService(JbpmContext jbpmContext)
+ {
+ JtaDbPersistenceService persistenceService = (JtaDbPersistenceService)jbpmContext.getServices().getPersistenceService();
+ return persistenceService.isJtaTxCreated();
+ }
+
+ private static UserTransaction getUserTransaction() throws NamingException
+ {
+ Context initial = new InitialContext();
+ return (UserTransaction)initial.lookup("java:comp/UserTransaction");
+ }
+}
17 years, 5 months
JBoss JBPM SVN: r3024 - projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-11-21 06:04:59 -0500 (Fri, 21 Nov 2008)
New Revision: 3024
Modified:
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ManagementExtension.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ProcessManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3TaskManagement.java
Log:
Use qualified import since the models names don't conflict anymore
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ManagementExtension.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ManagementExtension.java 2008-11-21 11:01:30 UTC (rev 3023)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ManagementExtension.java 2008-11-21 11:04:59 UTC (rev 3024)
@@ -28,7 +28,9 @@
import org.jboss.bpm.console.server.integration.JBPM3Extension;
import org.jbpm.file.def.FileDefinition;
import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.util.XmlUtil;
+import org.jbpm.taskmgmt.exe.TaskInstance;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -55,20 +57,20 @@
public byte[] getProcessImage(long processId)
{
- org.jbpm.graph.def.ProcessDefinition p0 = delegate.getActualDefinition(processId);
+ ProcessDefinition p0 = delegate.getActualDefinition(processId);
return p0.getFileDefinition().getBytes(PROCESSIMAGE_FILENAME);
}
public DiagramInfo getDiagramInfo(long processId)
{
- org.jbpm.graph.def.ProcessDefinition p0 = delegate.getActualDefinition(processId);
+ ProcessDefinition p0 = delegate.getActualDefinition(processId);
InputStream in = p0.getFileDefinition().getInputStream(GPD_XML_FILENAME);
return DiagramInfoParser.parse(in);
}
public ActiveNodeInfo getActivNodeInfo(long instanceId)
{
- org.jbpm.graph.exe.ProcessInstance instance = delegate.getActualInstance(instanceId);
+ ProcessInstance instance = delegate.getActualInstance(instanceId);
String currentNodeName = instance.getRootToken().getNode().getName();
DiagramInfo diagram = getDiagramInfo(instance.getProcessDefinition().getId());
@@ -93,8 +95,7 @@
public Map<String, String> getAvailableTaskForms(long processId)
{
- org.jbpm.graph.def.ProcessDefinition processDefinition =
- delegate.getActualDefinition(processId);
+ ProcessDefinition processDefinition = delegate.getActualDefinition(processId);
return getTask2FileMapping(processDefinition);
}
@@ -136,9 +137,8 @@
public byte[] getTaskFormByTaskName(long processId, long taskId)
{
- org.jbpm.graph.def.ProcessDefinition processDefinition =
- delegate.getActualDefinition(processId);
- org.jbpm.taskmgmt.exe.TaskInstance t0 = delegate.getTaskById(taskId);
+ ProcessDefinition processDefinition = delegate.getActualDefinition(processId);
+ TaskInstance t0 = delegate.getTaskById(taskId);
Map<String,String> fileMapping = getTask2FileMapping(processDefinition);
String fileName = fileMapping.get(t0.getName());
@@ -151,7 +151,7 @@
public void changeInstanceState(long instanceId, ProcessInstanceRef.STATE nextState)
{
- org.jbpm.graph.exe.ProcessInstance p0 = delegate.getActualInstance(instanceId);
+ ProcessInstance p0 = delegate.getActualInstance(instanceId);
Transform.doTransition(p0, nextState); // modifies the actual PI
// TX commit will persist changes to the actual PI
@@ -159,7 +159,7 @@
public org.jboss.bpm.console.client.model.ProcessDefinitionRef deployNewDefinition(byte[] data)
{
- org.jbpm.graph.def.ProcessDefinition p0 = delegate.deploy(data);
+ ProcessDefinition p0 = delegate.deploy(data);
return Transform.processDefinition(p0);
}
}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ProcessManagement.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ProcessManagement.java 2008-11-21 11:01:30 UTC (rev 3023)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ProcessManagement.java 2008-11-21 11:04:59 UTC (rev 3024)
@@ -24,6 +24,8 @@
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.server.integration.ProcessManagement;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
import java.util.ArrayList;
import java.util.List;
@@ -42,10 +44,10 @@
public List<ProcessDefinitionRef> getAllDefinitions()
{
- List<org.jbpm.graph.def.ProcessDefinition> defs = delegate.getActualDefinitions();
+ List<ProcessDefinition> defs = delegate.getActualDefinitions();
List<ProcessDefinitionRef> results = new ArrayList<ProcessDefinitionRef>(defs.size());
- for(org.jbpm.graph.def.ProcessDefinition p0 : defs)
+ for(ProcessDefinition p0 : defs)
{
results.add( Transform.processDefinition(p0) );
}
@@ -54,7 +56,7 @@
public ProcessDefinitionRef getDefinitionById(long processId)
{
- org.jbpm.graph.def.ProcessDefinition p0 = delegate.getActualDefinition(processId);
+ ProcessDefinition p0 = delegate.getActualDefinition(processId);
return Transform.processDefinition(p0);
}
@@ -67,13 +69,13 @@
public ProcessInstanceRef newInstance(long processId)
{
- org.jbpm.graph.exe.ProcessInstance instance = delegate.startNewInstance(processId);
+ ProcessInstance instance = delegate.startNewInstance(processId);
return Transform.processInstance(instance);
}
public List<ProcessInstanceRef> getInstancesByDefinitionId(long processId)
{
- List<org.jbpm.graph.exe.ProcessInstance> instances = delegate.getActualInstances(processId);
+ List<ProcessInstance> instances = delegate.getActualInstances(processId);
List<ProcessInstanceRef> results = new ArrayList<ProcessInstanceRef>(instances.size());
for(org.jbpm.graph.exe.ProcessInstance i0 : instances)
{
@@ -84,7 +86,7 @@
public ProcessInstanceRef getInstanceById(long instanceId)
{
- org.jbpm.graph.exe.ProcessInstance instance = delegate.getActualInstance(instanceId);
+ ProcessInstance instance = delegate.getActualInstance(instanceId);
return Transform.processInstance(instance);
}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3TaskManagement.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3TaskManagement.java 2008-11-21 11:01:30 UTC (rev 3023)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3TaskManagement.java 2008-11-21 11:04:59 UTC (rev 3024)
@@ -23,6 +23,7 @@
import org.jboss.bpm.console.client.model.TaskRef;
import org.jboss.bpm.console.server.integration.TaskManagement;
+import org.jbpm.taskmgmt.exe.TaskInstance;
import java.util.ArrayList;
import java.util.List;
@@ -43,11 +44,11 @@
public List<TaskRef> getTasksByActor(String actorName)
{
- List<org.jbpm.taskmgmt.exe.TaskInstance> actualTasks =
+ List<TaskInstance> actualTasks =
delegate.getActualTasksForActor(actorName);
List<TaskRef> taskRefs = new ArrayList<TaskRef>();
- for(org.jbpm.taskmgmt.exe.TaskInstance t0 : actualTasks)
+ for(TaskInstance t0 : actualTasks)
{
taskRefs.add( Transform.taskInstance(t0));
}
@@ -57,7 +58,7 @@
public TaskRef getTaskById(long taskId)
{
- org.jbpm.taskmgmt.exe.TaskInstance t0 = delegate.getTaskById(taskId);
+ TaskInstance t0 = delegate.getTaskById(taskId);
TaskRef taskRef = Transform.taskInstance(t0);
return taskRef;
}
17 years, 5 months
JBoss JBPM SVN: r3023 - in projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server: integration and 3 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-11-21 06:01:30 -0500 (Fri, 21 Nov 2008)
New Revision: 3023
Modified:
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ConsoleServerApplication.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/InvocationProxy.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/JBPM3Extension.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3CommandDelegate.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3FormParser.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ManagementExtension.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/Transform.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/cmd/GetGroupMembershipCommand.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/cmd/GetUsersForGroupCommand.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/DOMUtils.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/ServiceLoader.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/ServiceLocator.java
Log:
Optimize imports
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ConsoleServerApplication.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ConsoleServerApplication.java 2008-11-21 10:53:39 UTC (rev 3022)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ConsoleServerApplication.java 2008-11-21 11:01:30 UTC (rev 3023)
@@ -21,8 +21,6 @@
*/
package org.jboss.bpm.console.server;
-import org.jboss.bpm.console.server.JBPM3MgmtFacade;
-
import javax.ws.rs.core.Application;
import java.util.HashSet;
import java.util.Set;
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java 2008-11-21 10:53:39 UTC (rev 3022)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java 2008-11-21 11:01:30 UTC (rev 3023)
@@ -29,8 +29,8 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.bpm.console.client.model.jbpm3.ActiveNodeInfo;
import org.jboss.bpm.console.client.model.jbpm3.DiagramInfo;
+import org.jboss.bpm.console.server.integration.JBPM3Extension;
import org.jboss.bpm.console.server.integration.ManagementFactory;
-import org.jboss.bpm.console.server.integration.JBPM3Extension;
import org.jboss.bpm.console.server.integration.ProcessManagement;
import javax.servlet.http.HttpServletRequest;
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java 2008-11-21 10:53:39 UTC (rev 3022)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java 2008-11-21 11:01:30 UTC (rev 3023)
@@ -22,15 +22,15 @@
package org.jboss.bpm.console.server;
import com.google.gson.Gson;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.bpm.console.client.model.ProcessDefinitionRefWrapper;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.client.model.ProcessInstanceRefWrapper;
-import org.jboss.bpm.console.client.model.ProcessInstanceRef;
+import org.jboss.bpm.console.server.gson.GsonFactory;
+import org.jboss.bpm.console.server.integration.JBPM3Extension;
import org.jboss.bpm.console.server.integration.ManagementFactory;
import org.jboss.bpm.console.server.integration.ProcessManagement;
-import org.jboss.bpm.console.server.integration.JBPM3Extension;
-import org.jboss.bpm.console.server.gson.GsonFactory;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import javax.ws.rs.*;
import javax.ws.rs.core.Response;
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java 2008-11-21 10:53:39 UTC (rev 3022)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java 2008-11-21 11:01:30 UTC (rev 3023)
@@ -28,11 +28,11 @@
import org.jboss.bpm.console.client.model.forms.FieldDef;
import org.jboss.bpm.console.client.model.forms.FormDef;
import org.jboss.bpm.console.client.model.util.MapEntry;
+import org.jboss.bpm.console.server.gson.GsonFactory;
+import org.jboss.bpm.console.server.integration.JBPM3Extension;
import org.jboss.bpm.console.server.integration.ManagementFactory;
-import org.jboss.bpm.console.server.integration.JBPM3Extension;
import org.jboss.bpm.console.server.integration.TaskManagement;
import org.jboss.bpm.console.server.integration.internal.JBPM3FormParser;
-import org.jboss.bpm.console.server.gson.GsonFactory;
import javax.ws.rs.*;
import javax.ws.rs.core.Response;
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java 2008-11-21 10:53:39 UTC (rev 3022)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java 2008-11-21 11:01:30 UTC (rev 3023)
@@ -21,13 +21,14 @@
*/
package org.jboss.bpm.console.server;
+import com.google.gson.Gson;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.bpm.console.client.model.RoleAssignmentRef;
import org.jboss.bpm.console.client.model.RoleAssignmentRefWrapper;
import org.jboss.bpm.console.server.gson.GsonFactory;
-import org.jboss.bpm.console.server.integration.UserManagement;
import org.jboss.bpm.console.server.integration.ManagementFactory;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.jboss.bpm.console.server.integration.UserManagement;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.*;
@@ -35,8 +36,6 @@
import javax.ws.rs.core.Response;
import java.util.*;
-import com.google.gson.Gson;
-
/**
* REST server module for accessing user related data.
*
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/InvocationProxy.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/InvocationProxy.java 2008-11-21 10:53:39 UTC (rev 3022)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/InvocationProxy.java 2008-11-21 11:01:30 UTC (rev 3023)
@@ -21,9 +21,9 @@
*/
package org.jboss.bpm.console.server.integration;
-import org.jboss.bpm.console.server.util.ServiceLocator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jboss.bpm.console.server.util.ServiceLocator;
import javax.transaction.SystemException;
import javax.transaction.UserTransaction;
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/JBPM3Extension.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/JBPM3Extension.java 2008-11-21 10:53:39 UTC (rev 3022)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/JBPM3Extension.java 2008-11-21 11:01:30 UTC (rev 3023)
@@ -21,10 +21,10 @@
*/
package org.jboss.bpm.console.server.integration;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.client.model.jbpm3.ActiveNodeInfo;
import org.jboss.bpm.console.client.model.jbpm3.DiagramInfo;
-import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
-import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import java.util.Map;
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3CommandDelegate.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3CommandDelegate.java 2008-11-21 10:53:39 UTC (rev 3022)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3CommandDelegate.java 2008-11-21 11:01:30 UTC (rev 3023)
@@ -21,18 +21,18 @@
*/
package org.jboss.bpm.console.server.integration.internal;
+import org.jboss.bpm.console.server.integration.internal.cmd.GetGroupMembershipCommand;
+import org.jboss.bpm.console.server.integration.internal.cmd.GetUsersForGroupCommand;
+import org.jboss.bpm.console.server.util.ServiceLocator;
import org.jbpm.command.*;
import org.jbpm.ejb.LocalCommandService;
import org.jbpm.ejb.LocalCommandServiceHome;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.taskmgmt.exe.TaskInstance;
-import org.jboss.bpm.console.server.util.ServiceLocator;
-import org.jboss.bpm.console.server.integration.internal.cmd.GetGroupMembershipCommand;
-import org.jboss.bpm.console.server.integration.internal.cmd.GetUsersForGroupCommand;
import javax.ejb.CreateException;
+import java.util.ArrayList;
import java.util.List;
-import java.util.ArrayList;
/**
* Adopts a business interface to the command facade.<br>
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3FormParser.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3FormParser.java 2008-11-21 10:53:39 UTC (rev 3022)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3FormParser.java 2008-11-21 11:01:30 UTC (rev 3023)
@@ -21,11 +21,11 @@
*/
package org.jboss.bpm.console.server.integration.internal;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.bpm.console.client.model.forms.FieldDef;
import org.jboss.bpm.console.server.util.DOMUtils;
import org.w3c.dom.Element;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ManagementExtension.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ManagementExtension.java 2008-11-21 10:53:39 UTC (rev 3022)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ManagementExtension.java 2008-11-21 11:01:30 UTC (rev 3023)
@@ -21,22 +21,22 @@
*/
package org.jboss.bpm.console.server.integration.internal;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.client.model.jbpm3.ActiveNodeInfo;
import org.jboss.bpm.console.client.model.jbpm3.DiagramInfo;
import org.jboss.bpm.console.client.model.jbpm3.DiagramNodeInfo;
-import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.server.integration.JBPM3Extension;
+import org.jbpm.file.def.FileDefinition;
import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.file.def.FileDefinition;
import org.jbpm.util.XmlUtil;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import java.io.InputStream;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.HashMap;
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/Transform.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/Transform.java 2008-11-21 10:53:39 UTC (rev 3022)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/Transform.java 2008-11-21 11:01:30 UTC (rev 3023)
@@ -31,8 +31,8 @@
import java.util.Date;
import java.util.List;
+import java.util.Map;
import java.util.Set;
-import java.util.Map;
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/cmd/GetGroupMembershipCommand.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/cmd/GetGroupMembershipCommand.java 2008-11-21 10:53:39 UTC (rev 3022)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/cmd/GetGroupMembershipCommand.java 2008-11-21 11:01:30 UTC (rev 3023)
@@ -21,16 +21,16 @@
*/
package org.jboss.bpm.console.server.integration.internal.cmd;
+import org.jbpm.JbpmContext;
+import org.jbpm.command.AbstractGetObjectBaseCommand;
import org.jbpm.command.Command;
-import org.jbpm.command.AbstractGetObjectBaseCommand;
-import org.jbpm.JbpmContext;
+import org.jbpm.identity.Group;
+import org.jbpm.identity.User;
import org.jbpm.identity.hibernate.IdentitySession;
-import org.jbpm.identity.User;
-import org.jbpm.identity.Group;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Set;
-import java.util.List;
-import java.util.ArrayList;
/**
* TODO: Group resolution should be pluggable
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/cmd/GetUsersForGroupCommand.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/cmd/GetUsersForGroupCommand.java 2008-11-21 10:53:39 UTC (rev 3022)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/cmd/GetUsersForGroupCommand.java 2008-11-21 11:01:30 UTC (rev 3023)
@@ -21,15 +21,15 @@
*/
package org.jboss.bpm.console.server.integration.internal.cmd;
+import org.jbpm.JbpmContext;
+import org.jbpm.command.AbstractGetObjectBaseCommand;
import org.jbpm.command.Command;
-import org.jbpm.command.AbstractGetObjectBaseCommand;
-import org.jbpm.JbpmContext;
-import org.jbpm.identity.hibernate.IdentitySession;
import org.jbpm.identity.Group;
import org.jbpm.identity.User;
+import org.jbpm.identity.hibernate.IdentitySession;
+import java.util.ArrayList;
import java.util.List;
-import java.util.ArrayList;
import java.util.Set;
/**
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/DOMUtils.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/DOMUtils.java 2008-11-21 10:53:39 UTC (rev 3022)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/DOMUtils.java 2008-11-21 11:01:30 UTC (rev 3023)
@@ -21,43 +21,24 @@
*/
package org.jboss.bpm.console.server.util;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.util.LinkedList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import org.jboss.logging.Logger;
+import org.w3c.dom.*;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
+import java.io.*;
+import java.util.*;
-import org.jboss.logging.Logger;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
/**
* DOM2 utilites
*
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/ServiceLoader.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/ServiceLoader.java 2008-11-21 10:53:39 UTC (rev 3022)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/ServiceLoader.java 2008-11-21 11:01:30 UTC (rev 3023)
@@ -21,12 +21,7 @@
*/
package org.jboss.bpm.console.server.util;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
+import java.io.*;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Properties;
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/ServiceLocator.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/ServiceLocator.java 2008-11-21 10:53:39 UTC (rev 3022)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/util/ServiceLocator.java 2008-11-21 11:01:30 UTC (rev 3023)
@@ -26,7 +26,6 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.transaction.UserTransaction;
-import java.util.Properties;
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
17 years, 5 months
JBoss JBPM SVN: r3022 - in projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server: integration and 1 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-11-21 05:53:39 -0500 (Fri, 21 Nov 2008)
New Revision: 3022
Modified:
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/JBPM3Extension.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ProcessManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/TaskManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/UserManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ManagementExtension.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ProcessManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/Transform.java
Log:
Cleanup API
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java 2008-11-21 10:41:15 UTC (rev 3021)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java 2008-11-21 10:53:39 UTC (rev 3022)
@@ -180,7 +180,7 @@
{
log.debug("Signal token " + id + " -> " + signalName);
- getManagementExtension().signalToken(id, signalName);
+ getProcessManagement().signalToken(id, signalName);
return Response.ok().type("application/json").build();
}
@@ -193,7 +193,7 @@
{
log.debug("Signal token " + id);
- getManagementExtension().signalToken(id, null);
+ getProcessManagement().signalToken(id, null);
return Response.ok().type("application/json").build();
}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java 2008-11-21 10:41:15 UTC (rev 3021)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java 2008-11-21 10:53:39 UTC (rev 3022)
@@ -105,7 +105,7 @@
{
ProcessInstanceRefWrapper wrapper =
- new ProcessInstanceRefWrapper(getProcessDAO().getInstancesByProcessId(processId));
+ new ProcessInstanceRefWrapper(getProcessDAO().getInstancesByDefinitionId(processId));
return createJsonResponse(wrapper);
}
@@ -131,7 +131,9 @@
String next)
{
log.debug("Change instance (ID "+instanceId+") to state " +next);
- getManagementExtension().changeState(instanceId, next);
+
+ ProcessInstanceRef.STATE state = ProcessInstanceRef.STATE.valueOf(next);
+ getManagementExtension().changeInstanceState(instanceId, state);
return Response.ok().type("application/json").build();
}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/JBPM3Extension.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/JBPM3Extension.java 2008-11-21 10:41:15 UTC (rev 3021)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/JBPM3Extension.java 2008-11-21 10:53:39 UTC (rev 3022)
@@ -24,6 +24,7 @@
import org.jboss.bpm.console.client.model.jbpm3.ActiveNodeInfo;
import org.jboss.bpm.console.client.model.jbpm3.DiagramInfo;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import java.util.Map;
@@ -40,14 +41,11 @@
ActiveNodeInfo getActivNodeInfo(long instanceId);
- // TODO: move to process management
- void signalToken(long tokenId, String signal);
-
Map<String, String> getAvailableTaskForms(long processId);
byte[] getTaskFormByTaskName(long processId, long taskId);
- void changeState(long instanceId, String nextState);
+ void changeInstanceState(long instanceId, ProcessInstanceRef.STATE nextState);
ProcessDefinitionRef deployNewDefinition(byte[] data);
}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ProcessManagement.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ProcessManagement.java 2008-11-21 10:41:15 UTC (rev 3021)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ProcessManagement.java 2008-11-21 10:53:39 UTC (rev 3022)
@@ -27,8 +27,6 @@
import java.util.List;
/**
- * Access process related data.
- *
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
public interface ProcessManagement
@@ -39,10 +37,11 @@
List<ProcessDefinitionRef> removeDefinition(long processId);
- List<ProcessInstanceRef> getInstancesByProcessId(long processId);
+ List<ProcessInstanceRef> getInstancesByDefinitionId(long processId);
ProcessInstanceRef getInstanceById(long instanceId);
ProcessInstanceRef newInstance(long processId);
+ void signalToken(long tokenId, String signal);
}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/TaskManagement.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/TaskManagement.java 2008-11-21 10:41:15 UTC (rev 3021)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/TaskManagement.java 2008-11-21 10:53:39 UTC (rev 3022)
@@ -31,9 +31,10 @@
public interface TaskManagement
{
List<TaskRef> getTasksByActor(String actorName);
+
TaskRef getTaskById(long taskId);
+
void reassignTask(long taskId, String actorId);
-
- // TODO: If signaling resides with an extension then closeTask() should as well
+
void closeTask(long taskId, String signalName);
}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/UserManagement.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/UserManagement.java 2008-11-21 10:41:15 UTC (rev 3021)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/UserManagement.java 2008-11-21 10:53:39 UTC (rev 3022)
@@ -29,5 +29,6 @@
public interface UserManagement
{
List<String> getGroupsForActor(String actorId);
+
List<String> getActorsForGroup(String groupName);
}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ManagementExtension.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ManagementExtension.java 2008-11-21 10:41:15 UTC (rev 3021)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ManagementExtension.java 2008-11-21 10:53:39 UTC (rev 3022)
@@ -24,6 +24,7 @@
import org.jboss.bpm.console.client.model.jbpm3.ActiveNodeInfo;
import org.jboss.bpm.console.client.model.jbpm3.DiagramInfo;
import org.jboss.bpm.console.client.model.jbpm3.DiagramNodeInfo;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.server.integration.JBPM3Extension;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.file.def.FileDefinition;
@@ -90,12 +91,6 @@
return new ActiveNodeInfo(diagram.getWidth(), diagram.getHeight(), activeNode);
}
-
- public void signalToken(long tokenId, String signal)
- {
- delegate.signalToken(tokenId, signal);
- }
-
public Map<String, String> getAvailableTaskForms(long processId)
{
org.jbpm.graph.def.ProcessDefinition processDefinition =
@@ -154,7 +149,7 @@
}
- public void changeState(long instanceId, String nextState)
+ public void changeInstanceState(long instanceId, ProcessInstanceRef.STATE nextState)
{
org.jbpm.graph.exe.ProcessInstance p0 = delegate.getActualInstance(instanceId);
Transform.doTransition(p0, nextState); // modifies the actual PI
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ProcessManagement.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ProcessManagement.java 2008-11-21 10:41:15 UTC (rev 3021)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ProcessManagement.java 2008-11-21 10:53:39 UTC (rev 3022)
@@ -71,7 +71,7 @@
return Transform.processInstance(instance);
}
- public List<ProcessInstanceRef> getInstancesByProcessId(long processId)
+ public List<ProcessInstanceRef> getInstancesByDefinitionId(long processId)
{
List<org.jbpm.graph.exe.ProcessInstance> instances = delegate.getActualInstances(processId);
List<ProcessInstanceRef> results = new ArrayList<ProcessInstanceRef>(instances.size());
@@ -88,4 +88,9 @@
return Transform.processInstance(instance);
}
+ public void signalToken(long tokenId, String signal)
+ {
+ delegate.signalToken(tokenId, signal);
+ }
+
}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/Transform.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/Transform.java 2008-11-21 10:41:15 UTC (rev 3021)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/Transform.java 2008-11-21 10:53:39 UTC (rev 3022)
@@ -86,7 +86,7 @@
return token;
}
- public static void doTransition(org.jbpm.graph.exe.ProcessInstance p0, String nextState)
+ public static void doTransition(org.jbpm.graph.exe.ProcessInstance p0, ProcessInstanceRef.STATE nextState)
{
ProcessInstanceRef instance = Transform.processInstance(p0);
instance.setState(nextState); // has lifecycle build in, hence the extra round
17 years, 5 months
JBoss JBPM SVN: r3021 - in projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server: integration and 2 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-11-21 05:41:15 -0500 (Fri, 21 Nov 2008)
New Revision: 3021
Added:
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/InvocationProxy.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/JBPM3Extension.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ManagementFactory.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ProcessManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/TaskManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/UserManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/DiagramInfoParser.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3CommandDelegate.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3FormParser.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ManagementExtension.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ManagementFactory.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ProcessManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3TaskManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3UserManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/Transform.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/cmd/
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/cmd/GetGroupMembershipCommand.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/cmd/GetUsersForGroupCommand.java
Removed:
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/
Modified:
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java
Log:
Rename dao package to integration
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java 2008-11-21 10:30:25 UTC (rev 3020)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java 2008-11-21 10:41:15 UTC (rev 3021)
@@ -29,9 +29,9 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.bpm.console.client.model.jbpm3.ActiveNodeInfo;
import org.jboss.bpm.console.client.model.jbpm3.DiagramInfo;
-import org.jboss.bpm.console.server.dao.ManagementFactory;
-import org.jboss.bpm.console.server.dao.JBPM3Extension;
-import org.jboss.bpm.console.server.dao.ProcessManagement;
+import org.jboss.bpm.console.server.integration.ManagementFactory;
+import org.jboss.bpm.console.server.integration.JBPM3Extension;
+import org.jboss.bpm.console.server.integration.ProcessManagement;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.*;
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java 2008-11-21 10:30:25 UTC (rev 3020)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java 2008-11-21 10:41:15 UTC (rev 3021)
@@ -25,9 +25,9 @@
import org.jboss.bpm.console.client.model.ProcessDefinitionRefWrapper;
import org.jboss.bpm.console.client.model.ProcessInstanceRefWrapper;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
-import org.jboss.bpm.console.server.dao.ManagementFactory;
-import org.jboss.bpm.console.server.dao.ProcessManagement;
-import org.jboss.bpm.console.server.dao.JBPM3Extension;
+import org.jboss.bpm.console.server.integration.ManagementFactory;
+import org.jboss.bpm.console.server.integration.ProcessManagement;
+import org.jboss.bpm.console.server.integration.JBPM3Extension;
import org.jboss.bpm.console.server.gson.GsonFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java 2008-11-21 10:30:25 UTC (rev 3020)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java 2008-11-21 10:41:15 UTC (rev 3021)
@@ -28,10 +28,10 @@
import org.jboss.bpm.console.client.model.forms.FieldDef;
import org.jboss.bpm.console.client.model.forms.FormDef;
import org.jboss.bpm.console.client.model.util.MapEntry;
-import org.jboss.bpm.console.server.dao.ManagementFactory;
-import org.jboss.bpm.console.server.dao.JBPM3Extension;
-import org.jboss.bpm.console.server.dao.TaskManagement;
-import org.jboss.bpm.console.server.dao.internal.JBPM3FormParser;
+import org.jboss.bpm.console.server.integration.ManagementFactory;
+import org.jboss.bpm.console.server.integration.JBPM3Extension;
+import org.jboss.bpm.console.server.integration.TaskManagement;
+import org.jboss.bpm.console.server.integration.internal.JBPM3FormParser;
import org.jboss.bpm.console.server.gson.GsonFactory;
import javax.ws.rs.*;
@@ -55,7 +55,7 @@
private JBPM3Extension JBPM3Extension;
/**
- * Lazy load the {@link org.jboss.bpm.console.server.dao.ProcessManagement}
+ * Lazy load the {@link org.jboss.bpm.console.server.integration.ProcessManagement}
*/
private TaskManagement getTaskManagement()
{
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java 2008-11-21 10:30:25 UTC (rev 3020)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java 2008-11-21 10:41:15 UTC (rev 3021)
@@ -24,8 +24,8 @@
import org.jboss.bpm.console.client.model.RoleAssignmentRef;
import org.jboss.bpm.console.client.model.RoleAssignmentRefWrapper;
import org.jboss.bpm.console.server.gson.GsonFactory;
-import org.jboss.bpm.console.server.dao.UserManagement;
-import org.jboss.bpm.console.server.dao.ManagementFactory;
+import org.jboss.bpm.console.server.integration.UserManagement;
+import org.jboss.bpm.console.server.integration.ManagementFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/InvocationProxy.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/InvocationProxy.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/InvocationProxy.java 2008-11-21 10:41:15 UTC (rev 3021)
@@ -0,0 +1,96 @@
+/*
+ * 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.integration;
+
+import org.jboss.bpm.console.server.util.ServiceLocator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.transaction.SystemException;
+import javax.transaction.UserTransaction;
+import java.lang.reflect.Method;
+
+/**
+ * Decorates management invocations with common system aspects, i.e. transaction demarcation.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class InvocationProxy implements java.lang.reflect.InvocationHandler
+{
+ private static final Log log = LogFactory.getLog(InvocationProxy.class);
+
+ private Object obj;
+
+ public static Object newInstance(Object obj) {
+ return java.lang.reflect.Proxy.newProxyInstance(
+ obj.getClass().getClassLoader(),
+ obj.getClass().getInterfaces(),
+ new InvocationProxy(obj));
+ }
+
+ private InvocationProxy(Object obj) {
+ this.obj = obj;
+ }
+
+ public Object invoke(Object proxy, Method m, Object[] args)
+ throws Throwable
+ {
+ Object result;
+
+ UserTransaction tx = ServiceLocator.getUserTransaction();
+
+ try
+ {
+ // before method invocation
+ tx.begin();
+
+ // field target invocation
+ result = m.invoke(obj, args);
+
+ tx.commit();
+
+ }
+ catch (Throwable e)
+ {
+ if(tx!=null)
+ {
+ try
+ {
+ tx.rollback();
+ }
+ catch (SystemException e1) {
+ log.error("Failed to rollback on " + obj + " -> " + m.getName());
+ }
+ }
+
+ throw new RuntimeException("Unexpected invocation exception: " + e.getMessage(), e);
+
+ }
+ finally
+ {
+ // after method invocation
+
+ }
+
+ return result;
+ }
+}
\ No newline at end of file
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/JBPM3Extension.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/JBPM3Extension.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/JBPM3Extension.java 2008-11-21 10:41:15 UTC (rev 3021)
@@ -0,0 +1,53 @@
+/*
+ * 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.integration;
+
+import org.jboss.bpm.console.client.model.jbpm3.ActiveNodeInfo;
+import org.jboss.bpm.console.client.model.jbpm3.DiagramInfo;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+
+import java.util.Map;
+
+/**
+ * Proprietary to jBPM3, no sure if it will stay.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface JBPM3Extension
+{
+ byte[] getProcessImage(long processId);
+
+ DiagramInfo getDiagramInfo(long processId);
+
+ ActiveNodeInfo getActivNodeInfo(long instanceId);
+
+ // TODO: move to process management
+ void signalToken(long tokenId, String signal);
+
+ Map<String, String> getAvailableTaskForms(long processId);
+
+ byte[] getTaskFormByTaskName(long processId, long taskId);
+
+ void changeState(long instanceId, String nextState);
+
+ ProcessDefinitionRef deployNewDefinition(byte[] data);
+}
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ManagementFactory.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ManagementFactory.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ManagementFactory.java 2008-11-21 10:41:15 UTC (rev 3021)
@@ -0,0 +1,56 @@
+/*
+ * 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.integration;
+
+import org.jboss.bpm.console.server.util.ServiceLoader;
+
+/**
+ * Construct management implementations.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public abstract class ManagementFactory
+{
+ public abstract ProcessManagement createProcessManagement();
+
+ // TODO: remove from base class. It's proprietary to jbpm3
+ public abstract JBPM3Extension createExtensionManagement();
+
+ public abstract TaskManagement createTaskManagement();
+
+ public abstract UserManagement createUsermanagement();
+
+ /**
+ * Load a ManagementFactory through {@link org.jboss.bpm.console.server.util.ServiceLoader}
+ * @return a ManagementFactory implementation
+ */
+ public static ManagementFactory newInstance()
+ {
+ ManagementFactory factory = (ManagementFactory)
+ ServiceLoader.loadFromServices(ManagementFactory.class.getName(), "org.jboss.bpm.console.server.integration.internal.JBPM3ManagementFactory");
+ if(null==factory)
+ throw new RuntimeException("Failed to load ManagementFactory.");
+
+ return factory;
+ }
+
+}
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ProcessManagement.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ProcessManagement.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ProcessManagement.java 2008-11-21 10:41:15 UTC (rev 3021)
@@ -0,0 +1,48 @@
+/*
+ * 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.integration;
+
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
+
+import java.util.List;
+
+/**
+ * Access process related data.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ProcessManagement
+{
+ List<ProcessDefinitionRef> getAllDefinitions();
+
+ ProcessDefinitionRef getDefinitionById(long processId);
+
+ List<ProcessDefinitionRef> removeDefinition(long processId);
+
+ List<ProcessInstanceRef> getInstancesByProcessId(long processId);
+
+ ProcessInstanceRef getInstanceById(long instanceId);
+
+ ProcessInstanceRef newInstance(long processId);
+
+}
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/TaskManagement.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/TaskManagement.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/TaskManagement.java 2008-11-21 10:41:15 UTC (rev 3021)
@@ -0,0 +1,39 @@
+/*
+ * 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.integration;
+
+import org.jboss.bpm.console.client.model.TaskRef;
+
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface TaskManagement
+{
+ List<TaskRef> getTasksByActor(String actorName);
+ TaskRef getTaskById(long taskId);
+ void reassignTask(long taskId, String actorId);
+
+ // TODO: If signaling resides with an extension then closeTask() should as well
+ void closeTask(long taskId, String signalName);
+}
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/UserManagement.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/UserManagement.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/UserManagement.java 2008-11-21 10:41:15 UTC (rev 3021)
@@ -0,0 +1,33 @@
+/*
+ * 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.integration;
+
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface UserManagement
+{
+ List<String> getGroupsForActor(String actorId);
+ List<String> getActorsForGroup(String groupName);
+}
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/DiagramInfoParser.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/DiagramInfoParser.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/DiagramInfoParser.java 2008-11-21 10:41:15 UTC (rev 3021)
@@ -0,0 +1,91 @@
+/*
+ * 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.integration.internal;
+
+import org.jboss.bpm.console.client.model.jbpm3.DiagramInfo;
+import org.jboss.bpm.console.client.model.jbpm3.DiagramNodeInfo;
+import org.jbpm.util.XmlUtil;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+class DiagramInfoParser
+{
+ /**
+ * Will close the stream after successfull read
+ * @param in
+ * @return
+ */
+ public static DiagramInfo parse(InputStream in )
+ {
+ Document document = XmlUtil.parseXmlInputStream(in);
+ Element processDiagramElement = document.getDocumentElement();
+ final String widthString = processDiagramElement.getAttribute("width");
+ final String heightString = processDiagramElement.getAttribute("height");
+ final List<DiagramNodeInfo> diagramNodeInfoList = new ArrayList<DiagramNodeInfo>();
+ final NodeList nodeNodeList = processDiagramElement.getElementsByTagName("node");
+ final int nodeNodeListLength = nodeNodeList.getLength();
+ for (int i = 0; i < nodeNodeListLength; i ++) {
+ final Node nodeNode = nodeNodeList.item(i);
+ if (nodeNode instanceof Node && nodeNode.getParentNode() == processDiagramElement) {
+ final Element nodeElement = (Element) nodeNode;
+ final String nodeName = nodeElement.getAttribute("name");
+ final String nodeXString = nodeElement.getAttribute("x");
+ final String nodeYString = nodeElement.getAttribute("y");
+ final String nodeWidthString = nodeElement.getAttribute("width");
+ final String nodeHeightString = nodeElement.getAttribute("height");
+ final DiagramNodeInfo nodeInfo = new DiagramNodeInfo(
+ nodeName,
+ Integer.parseInt(nodeXString),
+ Integer.parseInt(nodeYString),
+ Integer.parseInt(nodeWidthString),
+ Integer.parseInt(nodeHeightString)
+ );
+ diagramNodeInfoList.add(nodeInfo);
+ }
+ }
+ DiagramInfo diagramInfo = new DiagramInfo(
+ Integer.parseInt(heightString),
+ Integer.parseInt(widthString),
+ diagramNodeInfoList
+ );
+
+ try
+ {
+ in.close();
+ } catch (IOException e)
+ {
+ throw new RuntimeException("Failed to close stream", e);
+ }
+
+ return diagramInfo;
+ }
+}
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3CommandDelegate.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3CommandDelegate.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3CommandDelegate.java 2008-11-21 10:41:15 UTC (rev 3021)
@@ -0,0 +1,223 @@
+/*
+ * 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.integration.internal;
+
+import org.jbpm.command.*;
+import org.jbpm.ejb.LocalCommandService;
+import org.jbpm.ejb.LocalCommandServiceHome;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.taskmgmt.exe.TaskInstance;
+import org.jboss.bpm.console.server.util.ServiceLocator;
+import org.jboss.bpm.console.server.integration.internal.cmd.GetGroupMembershipCommand;
+import org.jboss.bpm.console.server.integration.internal.cmd.GetUsersForGroupCommand;
+
+import javax.ejb.CreateException;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Adopts a business interface to the command facade.<br>
+ * Depends on the CommandServiceBean (<code>java:ejb/CommandServiceBean</code>).
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+class JBPM3CommandDelegate
+{
+ private LocalCommandService facade;
+ private static final String DEFAULT_JNDI_NAME = "java:ejb/CommandServiceBean";
+
+ /**
+ * Lookup with particluar JNDI name.
+ * @param jndiName
+ */
+ public JBPM3CommandDelegate(String jndiName)
+ {
+ ejbLookup(jndiName);
+ }
+
+ /**
+ * Lookup using default JNDI name.
+ *
+ * @see #DEFAULT_JNDI_NAME
+ */
+
+ public JBPM3CommandDelegate()
+ {
+ ejbLookup(DEFAULT_JNDI_NAME);
+ }
+
+ private void ejbLookup(String jndiName)
+ {
+ try
+ {
+ LocalCommandServiceHome home = (LocalCommandServiceHome)
+ ServiceLocator.getEjbLocalHome(jndiName);
+ this.facade = home.create();
+ }
+ catch (CreateException e)
+ {
+ throw new RuntimeException("Failed to create LocalCommandService", e);
+ }
+ }
+
+ public List<ProcessDefinition> getActualDefinitions()
+ {
+ List<org.jbpm.graph.def.ProcessDefinition> defs = (List<org.jbpm.graph.def.ProcessDefinition>)
+ facade.execute( new GetProcessDefinitionsCommand(false) );
+ return defs;
+ }
+
+ public org.jbpm.graph.def.ProcessDefinition getActualDefinition(long processId)
+ {
+ List<org.jbpm.graph.def.ProcessDefinition> defs = getActualDefinitions();
+
+ org.jbpm.graph.def.ProcessDefinition match = null;
+ for(org.jbpm.graph.def.ProcessDefinition p0 : defs)
+ {
+ if(processId == p0.getId())
+ {
+ match = p0;
+ break;
+ }
+ }
+
+ if(null==match)
+ throw new IllegalArgumentException("No process definition with ID " + processId);
+
+ return match;
+ }
+
+ public void removeActualDefinition(long processId)
+ {
+ org.jbpm.graph.def.ProcessDefinition def = getActualDefinition(processId);
+ facade.execute( new DeleteProcessdefinitionCommand(processId));
+ }
+
+ public org.jbpm.graph.exe.ProcessInstance getActualInstance(long instanceId)
+ {
+ org.jbpm.graph.exe.ProcessInstance instance = (org.jbpm.graph.exe.ProcessInstance)
+ facade.execute( new GetProcessInstanceCommand(instanceId));
+ return instance;
+ }
+
+ public List<org.jbpm.graph.exe.ProcessInstance> getActualInstances(long processId)
+ {
+ org.jbpm.graph.def.ProcessDefinition p0 = getActualDefinition(processId);
+ GetProcessInstancesCommand command = new GetProcessInstancesCommand();
+ command.setProcessId(processId);
+
+ List<org.jbpm.graph.exe.ProcessInstance> instances =
+ (List<org.jbpm.graph.exe.ProcessInstance>) facade.execute(command);
+
+ return instances;
+ }
+
+ public org.jbpm.graph.exe.ProcessInstance startNewInstance(long processId)
+ {
+ org.jbpm.graph.def.ProcessDefinition p0 = getActualDefinition(processId);
+ org.jbpm.graph.exe.ProcessInstance instance = (org.jbpm.graph.exe.ProcessInstance)
+ facade.execute(new NewProcessInstanceCommand(p0.getName()));
+
+ return instance;
+ }
+
+ public ProcessDefinition deploy(byte[] data)
+ {
+ org.jbpm.graph.def.ProcessDefinition p0 = (org.jbpm.graph.def.ProcessDefinition)
+ facade.execute(
+ new DeployProcessCommand(data)
+ );
+ return p0;
+ }
+
+ public List<TaskInstance> getActualTasksForActor(String actorName)
+ {
+
+ List<String> groupNames = getGroupsForActor(actorName);
+
+ String[] actors = new String[groupNames.size()+1];
+ int i=0;
+ for(String s : groupNames)
+ {
+ actors[i] = s;
+ i++;
+ }
+
+ actors[i] = actorName; // all groups & the username
+
+ List<TaskInstance> tasks = new ArrayList<TaskInstance>();
+ GetTaskListCommand command = new GetTaskListCommand(actors);
+ tasks.addAll( (List<TaskInstance>) facade.execute(command));
+ return tasks;
+ }
+
+ public List<String> getGroupsForActor(String actorName)
+ {
+ List<String> groupNames = (List<String>)facade.execute(
+ new GetGroupMembershipCommand(actorName)
+ );
+ return groupNames;
+ }
+
+ public List<String> getActorsForGroup(String groupName)
+ {
+ List<String> actorIds = (List<String>)facade.execute(
+ new GetUsersForGroupCommand(groupName)
+ );
+ return actorIds;
+ }
+
+ public TaskInstance getTaskById(long taskId)
+ {
+ // include variables, but no logs
+ return (TaskInstance) facade.execute( new GetTaskInstanceCommand(taskId, true, false));
+ }
+
+ public void assignTask(long taskId, String actorId)
+ {
+ if(actorId!=null)
+ {
+ StartWorkOnTaskCommand command = new StartWorkOnTaskCommand(taskId, true);
+ command.setActorId(actorId);
+ facade.execute(command);
+ }
+ else
+ {
+ CancelWorkOnTaskCommand command = new CancelWorkOnTaskCommand(taskId);
+ facade.execute(command);
+ }
+ }
+
+ public void signalToken(long tokenId, String signalName)
+ {
+ SignalCommand command = new SignalCommand(tokenId, signalName);
+ facade.execute(command);
+ }
+
+ public void endTask(long taskId, String signalName)
+ {
+ TaskInstanceEndCommand command = new TaskInstanceEndCommand();
+ command.setTaskInstanceId(taskId);
+ command.setTransitionName(signalName);
+
+ facade.execute(command);
+ }
+}
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3FormParser.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3FormParser.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3FormParser.java 2008-11-21 10:41:15 UTC (rev 3021)
@@ -0,0 +1,314 @@
+/*
+ * 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.integration.internal;
+
+import org.jboss.bpm.console.client.model.forms.FieldDef;
+import org.jboss.bpm.console.server.util.DOMUtils;
+import org.w3c.dom.Element;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class JBPM3FormParser
+{
+ private static final Log log = LogFactory.getLog(JBPM3FormParser.class);
+
+ private final String JSF_FACET_NAME = "facet";
+ private final static String[] JSF_TEXT_NAMES = {"outputText", "inputText"};
+ private final static String[] JSF_TEXTAREA_NAMES = { "outputTextarea","inputTextarea"};
+ private final static String[] JSF_BOOLEAN_NAMES = {"selectBooleanCheckbox"};
+ private final static String[] JSF_BUTTON_NAMES = {"saveButton", "transitionButton"};
+
+ private List<FieldDef> inputFields = new ArrayList<FieldDef>();
+ private List<InputButton> inputButtons = new ArrayList<InputButton>();
+
+ static String test = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" +
+ "\n" +
+ "<html xmlns=\"http://www.w3.org/1999/xhtml\"\n" +
+ "\txmlns:ui=\"http://java.sun.com/jsf/facelets\"\n" +
+ "\txmlns:c=\"http://java.sun.com/jstl/core\"\n" +
+ "\txmlns:h=\"http://java.sun.com/jsf/html\"\n" +
+ "\txmlns:f=\"http://java.sun.com/jsf/core\"\n" +
+ "\txmlns:tf=\"http://jbpm.org/jsf/tf\" xmlns:jbpm=\"http://jbpm.org/jsf\">\n" +
+ "<ui:component>\n" +
+ "\t<jbpm:dataform>\n" +
+ "\t\t<f:facet name=\"header\">\n" +
+ "\t\t\t<h:outputText value=\"#{taskName}\" />\n" +
+ "\t\t</f:facet>\n" +
+ "\t\t<jbpm:datacell>\n" +
+ "\t\t\t<f:facet name=\"header\">\n" +
+ "\t\t\t\t<h:outputText value=\"Purpose:\" />\n" +
+ "\t\t\t</f:facet>\n" +
+ "\t\t\t<h:outputText value=\"#{var['purpose']}\" />\n" +
+ "\t\t</jbpm:datacell>\n" +
+ "\t\t<jbpm:datacell>\n" +
+ "\t\t\t<f:facet name=\"header\">\n" +
+ "\t\t\t\t<h:outputText value=\"Description:\" />\n" +
+ "\t\t\t</f:facet>\n" +
+ "\t\t\t<h:outputText value=\"#{var['purpose']}\" />\n" +
+ "\t\t</jbpm:datacell>\n" +
+ "\t\t<jbpm:datacell>\n" +
+ "\t\t\t<f:facet name=\"header\">\n" +
+ "\t\t\t\t<h:outputText value=\"Self Paid\" />\n" +
+ "\t\t\t</f:facet>\n" +
+ "\t\t\t<h:selectBooleanCheckbox value=\"#{var['selfPaid']}\" disabled=\"true\" />\n" +
+ "\t\t</jbpm:datacell>\n" +
+ "\t\t<jbpm:datacell>\n" +
+ "\t\t\t<f:facet name=\"header\">\n" +
+ "\t\t\t\t<h:outputText value=\"Departure date\" />\n" +
+ "\t\t\t</f:facet>\n" +
+ "\t\t\t<h:outputText value=\"#{var['departureDate']}\" />\n" +
+ "\t\t</jbpm:datacell>\n" +
+ "\t\t<jbpm:datacell>\n" +
+ "\t\t\t<f:facet name=\"header\">\n" +
+ "\t\t\t\t<h:outputText value=\"Number of days\" />\n" +
+ "\t\t\t</f:facet>\n" +
+ "\t\t\t<h:outputText value=\"#{var['daysNum']}\" />\n" +
+ "\t\t</jbpm:datacell>\n" +
+ "\t\t<jbpm:datacell>\n" +
+ "\t\t\t<f:facet name=\"header\">\n" +
+ "\t\t\t\t<h:outputText value=\"Destination\" />\n" +
+ "\t\t\t</f:facet>\n" +
+ "\t\t\t<h:outputText value=\"#{var['country']}\" />\n" +
+ "\t\t</jbpm:datacell>\n" +
+ "\t\t<jbpm:datacell>\n" +
+ " <f:facet name=\"header\">\n" +
+ " <h:outputText value=\"City:\" />\n" +
+ " </f:facet>\n" +
+ " <h:outputText value=\"#{var['city']}\" />\n" +
+ " </jbpm:datacell>\n" +
+ "\t\t<jbpm:datacell>\n" +
+ "\t\t\t<f:facet name=\"header\">\n" +
+ "\t\t\t\t<h:outputText value=\"Actions:\" />\n" +
+ "\t\t\t</f:facet>\n" +
+ "\t\t\t<tf:saveButton value=\"Save\" />\n" +
+ "\t\t\t<tf:transitionButton value=\"Approve\" transition=\"approve\" />\n" +
+ "\t\t\t<tf:transitionButton value=\"Reject\" transition=\"reject\" />\n" +
+ "\t\t</jbpm:datacell>\n" +
+ "\t</jbpm:dataform>\n" +
+ "</ui:component>\n" +
+ "</html>";
+
+ public static void main(String[] args) throws Exception
+ {
+ JBPM3FormParser p = new JBPM3FormParser();
+ p.parse( new ByteArrayInputStream(test.getBytes()));
+ p.visitResults(
+ new ParseResultVisitor()
+ {
+ public void onInputField(FieldDef field)
+ {
+ log.debug(field);
+
+ }
+
+ public void onInputButton(InputButton btn)
+ {
+ log.debug(btn);
+ }
+ }
+ );
+ }
+
+ public void parse(InputStream in) throws Exception
+ {
+ Element root = DOMUtils.parse(in);
+ Element comp = DOMUtils.getFirstChildElement(root, "component");
+ Element dataForm = DOMUtils.getFirstChildElement(comp, "dataform");
+
+ Iterator<Element> it = DOMUtils.getChildElements(dataForm, "datacell");
+ while(it.hasNext())
+ {
+ parseDatacell(it.next());
+ }
+
+ }
+
+ private String lastFieldName = null; // TODO: cleanup
+ private void parseDatacell(Element datacell)
+ {
+
+ Iterator<Element> it = DOMUtils.getChildElements(datacell);
+ while(it.hasNext())
+ {
+ Element next = it.next();
+
+ // skip facet
+ String nodeName = next.getLocalName();
+
+ if(JSF_FACET_NAME.equals(nodeName))
+ {
+ lastFieldName = parseFieldName(next);
+ continue;
+ }
+
+ for(String textName : JSF_TEXT_NAMES)
+ {
+ if(textName.equals(nodeName))
+ {
+ parseTextInputField(next);
+ continue;
+ }
+
+ }
+
+ for(String textName : JSF_TEXTAREA_NAMES)
+ {
+ if(textName.equals(nodeName))
+ {
+ parseTextAreaField(next);
+ continue;
+ }
+
+ }
+
+ for(String textName : JSF_BUTTON_NAMES)
+ {
+ if(textName.equals(nodeName))
+ {
+ parseButtonInputField(next);
+ continue;
+ }
+ }
+
+ for(String textName : JSF_BOOLEAN_NAMES)
+ {
+ if(textName.equals(nodeName))
+ {
+ parseBooleanInputField(next);
+ continue;
+ }
+ }
+ }
+
+ }
+
+ public void visitResults(ParseResultVisitor visitor)
+ {
+ for(FieldDef field : inputFields)
+ visitor.onInputField(field);
+
+ for(InputButton btn : inputButtons)
+ visitor.onInputButton(btn);
+ }
+
+ public void reset()
+ {
+ this.inputButtons.clear();
+ this.inputFields.clear();
+ }
+
+
+ private void parseTextAreaField(Element next)
+ {
+ String varName = getTrimmedVarname(next);
+ inputFields.add( new FieldDef(lastFieldName,varName, FieldDef.InputType.TEXTAREA, String.class.getName(), true));
+ }
+
+ private String getTrimmedVarname(Element next)
+ {
+ String s = DOMUtils.getAttributeValue(next, "value");
+ return trimVarName(s);
+ }
+
+ private void parseBooleanInputField(Element next)
+ {
+ String varName = getTrimmedVarname(next);
+ inputFields.add( new FieldDef(lastFieldName,varName, FieldDef.InputType.BOOL, Boolean.class.getName(), false));
+ }
+
+ private void parseButtonInputField(Element next)
+ {
+ String name = getTrimmedVarname(next);
+ String transition = DOMUtils.getAttributeValue(next, "transition");
+ inputButtons.add( new InputButton(name, transition));
+ }
+
+ private void parseTextInputField(Element next)
+ {
+ String varName = getTrimmedVarname(next);
+ inputFields.add( new FieldDef(lastFieldName, varName, FieldDef.InputType.TEXT, String.class.getName(), true));
+ }
+
+ private String parseFieldName(Element facet)
+ {
+ String fieldName = "UNKOWN_FIELDNAME";
+ if("header".equals( facet.getAttribute("name")))
+ {
+ Element outputText = DOMUtils.getFirstChildElement(facet, "outputText");
+ if(outputText!=null)
+ {
+ fieldName = DOMUtils.getAttributeValue(outputText, "value");
+ }
+ }
+
+ return fieldName;
+ }
+
+
+ public final class InputButton
+ {
+ String name;
+ String transition;
+
+ public InputButton(String name, String transition)
+ {
+ this.name = name;
+ this.transition = transition;
+ }
+
+ public boolean hasTransition()
+ {
+ return transition!=null;
+ }
+
+ public String toString()
+ {
+ return "Button{"+name+": "+transition+"}";
+ }
+ }
+
+ public interface ParseResultVisitor
+ {
+ void onInputField(FieldDef field);
+ void onInputButton(InputButton btn);
+ }
+
+ private static String trimVarName(String name)
+ {
+ String result = name;
+ if(name.startsWith("#{var['"))
+ {
+ result = name.substring(7, name.length()-3);
+ }
+
+ return result;
+ }
+}
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ManagementExtension.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ManagementExtension.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ManagementExtension.java 2008-11-21 10:41:15 UTC (rev 3021)
@@ -0,0 +1,170 @@
+/*
+ * 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.integration.internal;
+
+import org.jboss.bpm.console.client.model.jbpm3.ActiveNodeInfo;
+import org.jboss.bpm.console.client.model.jbpm3.DiagramInfo;
+import org.jboss.bpm.console.client.model.jbpm3.DiagramNodeInfo;
+import org.jboss.bpm.console.server.integration.JBPM3Extension;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.file.def.FileDefinition;
+import org.jbpm.util.XmlUtil;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import java.io.InputStream;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class JBPM3ManagementExtension implements JBPM3Extension
+{
+ private JBPM3CommandDelegate delegate;
+
+ private static final String PROCESSIMAGE_FILENAME = "processimage.jpg";
+ private static final String GPD_XML_FILENAME = "gpd.xml";
+
+ public JBPM3ManagementExtension()
+ {
+ this.delegate = new JBPM3CommandDelegate();
+ }
+
+ public byte[] getProcessImage(long processId)
+ {
+ org.jbpm.graph.def.ProcessDefinition p0 = delegate.getActualDefinition(processId);
+ return p0.getFileDefinition().getBytes(PROCESSIMAGE_FILENAME);
+ }
+
+ public DiagramInfo getDiagramInfo(long processId)
+ {
+ org.jbpm.graph.def.ProcessDefinition p0 = delegate.getActualDefinition(processId);
+ InputStream in = p0.getFileDefinition().getInputStream(GPD_XML_FILENAME);
+ return DiagramInfoParser.parse(in);
+ }
+
+ public ActiveNodeInfo getActivNodeInfo(long instanceId)
+ {
+ org.jbpm.graph.exe.ProcessInstance instance = delegate.getActualInstance(instanceId);
+ String currentNodeName = instance.getRootToken().getNode().getName();
+
+ DiagramInfo diagram = getDiagramInfo(instance.getProcessDefinition().getId());
+ List<DiagramNodeInfo> nodes = diagram.getNodeList();
+
+ DiagramNodeInfo activeNode = null;
+ int i = 0;
+ for(DiagramNodeInfo n : nodes)
+ {
+ if(currentNodeName.equals(n.getName()))
+ {
+ activeNode = n;
+ break;
+ }
+ }
+
+ if(null==activeNode)
+ throw new RuntimeException("Failed to retrieve activeNodeInfo for instance " + instanceId);
+
+ return new ActiveNodeInfo(diagram.getWidth(), diagram.getHeight(), activeNode);
+ }
+
+
+ public void signalToken(long tokenId, String signal)
+ {
+ delegate.signalToken(tokenId, signal);
+ }
+
+ public Map<String, String> getAvailableTaskForms(long processId)
+ {
+ org.jbpm.graph.def.ProcessDefinition processDefinition =
+ delegate.getActualDefinition(processId);
+
+ return getTask2FileMapping(processDefinition);
+ }
+
+ private Map<String, String> getTask2FileMapping(ProcessDefinition processDefinition)
+ {
+ Map<String, String> result = new HashMap<String, String>();
+
+ final FileDefinition fileDefinition = processDefinition.getFileDefinition();
+ if (! fileDefinition.hasFile("forms.xml"))
+ {
+ // exit with empty list
+ // TODO: maybe an exception is better?
+ return result;
+ }
+
+ final InputStream inputStream = fileDefinition.getInputStream("forms.xml");
+ if (inputStream == null)
+ {
+ throw new RuntimeException("Failed to open stream on forms.xml");
+ }
+
+ final Document document = XmlUtil.parseXmlInputStream(inputStream);
+ final Element documentElement = document.getDocumentElement();
+ final NodeList nodeList = documentElement.getElementsByTagName("form");
+ final int length = nodeList.getLength();
+ for (int i = 0; i < length; i ++)
+ {
+ final Element element = (Element) nodeList.item(i);
+ final String itemTaskName = element.getAttribute("task");
+ final String itemFormName = element.getAttribute("form");
+ if (itemTaskName == null || itemFormName == null) {
+ continue;
+ }
+ result.put(itemTaskName, itemFormName);
+ }
+ return result;
+ }
+
+ public byte[] getTaskFormByTaskName(long processId, long taskId)
+ {
+ org.jbpm.graph.def.ProcessDefinition processDefinition =
+ delegate.getActualDefinition(processId);
+ org.jbpm.taskmgmt.exe.TaskInstance t0 = delegate.getTaskById(taskId);
+
+ Map<String,String> fileMapping = getTask2FileMapping(processDefinition);
+ String fileName = fileMapping.get(t0.getName());
+ if(fileName !=null)
+ return processDefinition.getFileDefinition().getBytes(fileName);
+ else
+ throw new RuntimeException("No form definition for taskId '"+taskId+"'");
+
+ }
+
+ public void changeState(long instanceId, String nextState)
+ {
+ org.jbpm.graph.exe.ProcessInstance p0 = delegate.getActualInstance(instanceId);
+ Transform.doTransition(p0, nextState); // modifies the actual PI
+
+ // TX commit will persist changes to the actual PI
+ }
+
+ public org.jboss.bpm.console.client.model.ProcessDefinitionRef deployNewDefinition(byte[] data)
+ {
+ org.jbpm.graph.def.ProcessDefinition p0 = delegate.deploy(data);
+ return Transform.processDefinition(p0);
+ }
+}
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ManagementFactory.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ManagementFactory.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ManagementFactory.java 2008-11-21 10:41:15 UTC (rev 3021)
@@ -0,0 +1,54 @@
+/*
+ * 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.integration.internal;
+
+import org.jboss.bpm.console.server.integration.*;
+
+/**
+ * Wraps management instances in {@link org.jboss.bpm.console.server.integration.InvocationProxy}
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class JBPM3ManagementFactory extends ManagementFactory
+{
+
+ public ProcessManagement createProcessManagement()
+ {
+ return (ProcessManagement) InvocationProxy.newInstance(new JBPM3ProcessManagement());
+ }
+
+ public JBPM3Extension createExtensionManagement()
+ {
+ return (JBPM3Extension) InvocationProxy.newInstance( new JBPM3ManagementExtension() );
+ }
+
+
+ public TaskManagement createTaskManagement()
+ {
+ return (TaskManagement) InvocationProxy.newInstance( new JBPM3TaskManagement() );
+ }
+
+
+ public UserManagement createUsermanagement()
+ {
+ return (UserManagement) InvocationProxy.newInstance( new JBPM3UserManagement() );
+ }
+}
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ProcessManagement.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ProcessManagement.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3ProcessManagement.java 2008-11-21 10:41:15 UTC (rev 3021)
@@ -0,0 +1,91 @@
+/*
+ * 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.integration.internal;
+
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
+import org.jboss.bpm.console.server.integration.ProcessManagement;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class JBPM3ProcessManagement implements ProcessManagement
+{
+ private JBPM3CommandDelegate delegate;
+
+ public JBPM3ProcessManagement()
+ {
+ this.delegate = new JBPM3CommandDelegate();
+ }
+
+ public List<ProcessDefinitionRef> getAllDefinitions()
+ {
+ List<org.jbpm.graph.def.ProcessDefinition> defs = delegate.getActualDefinitions();
+
+ List<ProcessDefinitionRef> results = new ArrayList<ProcessDefinitionRef>(defs.size());
+ for(org.jbpm.graph.def.ProcessDefinition p0 : defs)
+ {
+ results.add( Transform.processDefinition(p0) );
+ }
+ return results;
+ }
+
+ public ProcessDefinitionRef getDefinitionById(long processId)
+ {
+ org.jbpm.graph.def.ProcessDefinition p0 = delegate.getActualDefinition(processId);
+ return Transform.processDefinition(p0);
+ }
+
+ public List<ProcessDefinitionRef> removeDefinition(long processId)
+ {
+ delegate.removeActualDefinition(processId);
+ return getAllDefinitions();
+ }
+
+
+ public ProcessInstanceRef newInstance(long processId)
+ {
+ org.jbpm.graph.exe.ProcessInstance instance = delegate.startNewInstance(processId);
+ return Transform.processInstance(instance);
+ }
+
+ public List<ProcessInstanceRef> getInstancesByProcessId(long processId)
+ {
+ List<org.jbpm.graph.exe.ProcessInstance> instances = delegate.getActualInstances(processId);
+ List<ProcessInstanceRef> results = new ArrayList<ProcessInstanceRef>(instances.size());
+ for(org.jbpm.graph.exe.ProcessInstance i0 : instances)
+ {
+ results.add( Transform.processInstance(i0) );
+ }
+ return results;
+ }
+
+ public ProcessInstanceRef getInstanceById(long instanceId)
+ {
+ org.jbpm.graph.exe.ProcessInstance instance = delegate.getActualInstance(instanceId);
+ return Transform.processInstance(instance);
+ }
+
+}
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3TaskManagement.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3TaskManagement.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3TaskManagement.java 2008-11-21 10:41:15 UTC (rev 3021)
@@ -0,0 +1,77 @@
+/*
+ * 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.integration.internal;
+
+import org.jboss.bpm.console.client.model.TaskRef;
+import org.jboss.bpm.console.server.integration.TaskManagement;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class JBPM3TaskManagement implements TaskManagement
+{
+
+ private JBPM3CommandDelegate delegate;
+
+ public JBPM3TaskManagement()
+ {
+ this.delegate = new JBPM3CommandDelegate();
+ }
+
+ public List<TaskRef> getTasksByActor(String actorName)
+ {
+
+ List<org.jbpm.taskmgmt.exe.TaskInstance> actualTasks =
+ delegate.getActualTasksForActor(actorName);
+
+ List<TaskRef> taskRefs = new ArrayList<TaskRef>();
+ for(org.jbpm.taskmgmt.exe.TaskInstance t0 : actualTasks)
+ {
+ taskRefs.add( Transform.taskInstance(t0));
+ }
+
+ return taskRefs;
+ }
+
+ public TaskRef getTaskById(long taskId)
+ {
+ org.jbpm.taskmgmt.exe.TaskInstance t0 = delegate.getTaskById(taskId);
+ TaskRef taskRef = Transform.taskInstance(t0);
+ return taskRef;
+ }
+
+
+ public void reassignTask(long taskId, String actorId)
+ {
+ // TODO: validation of actorId?
+ delegate.assignTask(taskId, actorId);
+ }
+
+
+ public void closeTask(long taskId, String signalName)
+ {
+ delegate.endTask(taskId, signalName);
+ }
+}
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3UserManagement.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3UserManagement.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/JBPM3UserManagement.java 2008-11-21 10:41:15 UTC (rev 3021)
@@ -0,0 +1,50 @@
+/*
+ * 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.integration.internal;
+
+import org.jboss.bpm.console.server.integration.UserManagement;
+
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class JBPM3UserManagement implements UserManagement
+{
+
+ private JBPM3CommandDelegate delegate;
+
+ public JBPM3UserManagement()
+ {
+ this.delegate = new JBPM3CommandDelegate();
+ }
+
+ public List<String> getGroupsForActor(String actorId)
+ {
+ return delegate.getGroupsForActor(actorId);
+ }
+
+ public List<String> getActorsForGroup(String groupName)
+ {
+ return delegate.getActorsForGroup(groupName);
+ }
+}
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/Transform.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/Transform.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/Transform.java 2008-11-21 10:41:15 UTC (rev 3021)
@@ -0,0 +1,141 @@
+/*
+ * 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.integration.internal;
+
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
+import org.jboss.bpm.console.client.model.TaskRef;
+import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
+import org.jbpm.graph.def.Transition;
+import org.jbpm.graph.exe.Token;
+import org.jbpm.taskmgmt.exe.PooledActor;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Set;
+import java.util.Map;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+class Transform
+{
+ public static ProcessDefinitionRef processDefinition(org.jbpm.graph.def.ProcessDefinition p0)
+ {
+ return new ProcessDefinitionRef(p0.getId(), p0.getName(), String.valueOf(p0.getVersion()));
+ }
+
+ public static ProcessInstanceRef processInstance(org.jbpm.graph.exe.ProcessInstance i0)
+ {
+ Date start = i0.getStart();
+ Date end = i0.getEnd();
+ boolean suspended = i0.isSuspended();
+ long processId = i0.getProcessDefinition().getId();
+ long instanceId = i0.getId();
+ ProcessInstanceRef processInstance = new ProcessInstanceRef(instanceId, processId, start, end, suspended);
+
+ // token
+ Token t0 = i0.getRootToken();
+ processInstance.setRootToken(Transform.tokenReference(t0));
+ return processInstance;
+ }
+
+ private static TokenReference tokenReference(Token t0)
+ {
+ TokenReference token = new TokenReference(t0.getId(), t0.getName(), t0.getNode().getName());
+
+ if(t0.hasActiveChildren() || t0.isTerminatedImplicitly())
+ token.setCanBeSignaled(false);
+
+ Map children = t0.getChildren();
+ if(children!=null)
+ {
+ for(Object o : children.values())
+ {
+ Token t1 = (Token)o;
+ token.getChildren().add( Transform.tokenReference(t1) );
+ }
+ }
+
+ // signals
+ for(Object tr0 : t0.getNode().getLeavingTransitionsList())
+ {
+ Transition transition = (Transition)tr0;
+ token.getAvailableSignals().add(transition.getName());
+ }
+
+ return token;
+ }
+
+ public static void doTransition(org.jbpm.graph.exe.ProcessInstance p0, String nextState)
+ {
+ ProcessInstanceRef instance = Transform.processInstance(p0);
+ instance.setState(nextState); // has lifecycle build in, hence the extra round
+
+ switch(instance.getState())
+ {
+ case ENDED:
+ p0.setEnd(instance.getEndDate());
+ p0.end();
+ break;
+ case SUSPENDED:
+ p0.suspend();
+ break;
+ case RUNNING:
+ if(p0.isSuspended())
+ p0.resume();
+ }
+
+ }
+
+ public static TaskRef taskInstance(org.jbpm.taskmgmt.exe.TaskInstance t0)
+ {
+ TaskRef taskRef = new TaskRef(
+ t0.getId(),
+ t0.getToken().getId(),
+ t0.getProcessInstance().getId(),
+ t0.getProcessInstance().getProcessDefinition().getId(),
+ t0.getName(), t0.getActorId(),
+ t0.isBlocking(), t0.isSignalling()
+ );
+
+ List<Transition> transitionList = (List<Transition>)
+ t0.getToken().getNode().getLeavingTransitionsList();
+
+ Set<PooledActor> pooledActors = (Set<PooledActor>)t0.getPooledActors();
+ for(PooledActor p : pooledActors)
+ {
+ taskRef.addPooledActor(p.getActorId());
+ }
+
+ for(Transition trs0 : transitionList)
+ {
+ taskRef.getTransitionNames().add(
+ trs0.getName()
+ );
+ }
+
+ return taskRef;
+ }
+
+
+}
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/cmd/GetGroupMembershipCommand.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/cmd/GetGroupMembershipCommand.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/cmd/GetGroupMembershipCommand.java 2008-11-21 10:41:15 UTC (rev 3021)
@@ -0,0 +1,72 @@
+/*
+ * 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.integration.internal.cmd;
+
+import org.jbpm.command.Command;
+import org.jbpm.command.AbstractGetObjectBaseCommand;
+import org.jbpm.JbpmContext;
+import org.jbpm.identity.hibernate.IdentitySession;
+import org.jbpm.identity.User;
+import org.jbpm.identity.Group;
+
+import java.util.Set;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * TODO: Group resolution should be pluggable
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class GetGroupMembershipCommand extends AbstractGetObjectBaseCommand implements Command
+{
+ private static final long serialVersionUID = -1627380259541998349L;
+
+ private String actorName;
+
+ public GetGroupMembershipCommand(String actorName)
+ {
+ super();
+ this.actorName = actorName;
+ }
+
+ public Object execute(JbpmContext jbpmContext) throws Exception
+ {
+ List<String> groupNames = new ArrayList<String>();
+
+ setJbpmContext(jbpmContext);
+
+ IdentitySession session = new IdentitySession(
+ jbpmContext.getSession()
+ );
+
+ User user = session.getUserByName(actorName);
+ Set<Group> groups = (Set<Group>)user.getGroupsForGroupType("organisation");
+
+ for(Group g : groups)
+ {
+ groupNames.add(g.getName());
+ }
+
+ return groupNames;
+ }
+}
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/cmd/GetUsersForGroupCommand.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/cmd/GetUsersForGroupCommand.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/internal/cmd/GetUsersForGroupCommand.java 2008-11-21 10:41:15 UTC (rev 3021)
@@ -0,0 +1,71 @@
+/*
+ * 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.integration.internal.cmd;
+
+import org.jbpm.command.Command;
+import org.jbpm.command.AbstractGetObjectBaseCommand;
+import org.jbpm.JbpmContext;
+import org.jbpm.identity.hibernate.IdentitySession;
+import org.jbpm.identity.Group;
+import org.jbpm.identity.User;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Set;
+
+/**
+ * TODO: Group resolution should be pluggable
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class GetUsersForGroupCommand extends AbstractGetObjectBaseCommand implements Command
+{
+ private static final long serialVersionUID = -1627380259541998349L;
+
+ private String groupName;
+
+ public GetUsersForGroupCommand(String groupName)
+ {
+ super();
+ this.groupName = groupName;
+ }
+
+ public Object execute(JbpmContext jbpmContext) throws Exception
+ {
+ List<String> userNames = new ArrayList<String>();
+
+ setJbpmContext(jbpmContext);
+
+ IdentitySession session = new IdentitySession(
+ jbpmContext.getSession()
+ );
+
+ Group group = session.getGroupByName(groupName);
+ Set<User> users = group.getUsers();
+ for(User u : users)
+ {
+ userNames.add(u.getName());
+ }
+
+ return userNames;
+ }
+}
17 years, 5 months
JBoss JBPM SVN: r3020 - in projects/gwt-console/trunk: server and 11 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-11-21 05:30:25 -0500 (Fri, 21 Nov 2008)
New Revision: 3020
Added:
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/RoleAssignmentRef.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/RoleAssignmentRefWrapper.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskRef.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskRefWrapper.java
Removed:
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinition.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionWrapper.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstance.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceWrapper.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/RoleAssignment.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/RoleAssignmentWrapper.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskReference.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskReferenceWrapper.java
Modified:
projects/gwt-console/trunk/server/SQL.txt
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/JBPM3Extension.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ProcessManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/TaskManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ManagementExtension.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ProcessManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3TaskManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/Transform.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricEditor.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricView.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverview.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionDAO.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/internal/MockMetricsDAO.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/internal/MockProcessDefinitionDAO.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/internal/MockProcessInstanceDAO.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessImageView.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceEditor.java
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/ProcessInstanceListEditor.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/TokenEditor.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/TokenForm.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentFormPanel.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskDetailsFormPanel.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskList.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskListEditor.java
projects/gwt-console/trunk/war/src/main/resources/org/jboss/bpm/console/public/Application.html
projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/GwtTestDTOParser.java
Log:
Rename GWT model elements to avoid naming conflicts
Deleted: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinition.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinition.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinition.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -1,86 +0,0 @@
-/*
- * 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.client.model;
-
-import com.google.gwt.user.client.rpc.IsSerializable;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-@XmlRootElement(name="processDefinition")
-public class ProcessDefinition implements IsSerializable
-{
- private long processId;
- private String name;
- private String version;
-
- public ProcessDefinition()
- {
- }
-
- public ProcessDefinition(long id, String name, String version)
- {
- this.processId = id;
- this.name = name;
- this.version = version;
- }
-
- @XmlElement(name = "processId")
- public long getProcessId()
- {
- return processId;
- }
-
- public void setProcessId(long processId)
- {
- this.processId = processId;
- }
-
- @XmlElement(name = "name")
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public String getVersion()
- {
- return version;
- }
-
- public void setVersion(String version)
- {
- this.version = version;
- }
-
- public String toString()
- {
- return "ProcessDefinition{id="+this.processId +", name="+this.name+"}";
- }
-}
Copied: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionRef.java (from rev 2755, projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinition.java)
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionRef.java (rev 0)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionRef.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -0,0 +1,86 @@
+/*
+ * 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.client.model;
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+@XmlRootElement(name="processDefinition")
+public class ProcessDefinitionRef implements IsSerializable
+{
+ private long processId;
+ private String name;
+ private String version;
+
+ public ProcessDefinitionRef()
+ {
+ }
+
+ public ProcessDefinitionRef(long id, String name, String version)
+ {
+ this.processId = id;
+ this.name = name;
+ this.version = version;
+ }
+
+ @XmlElement(name = "processId")
+ public long getProcessId()
+ {
+ return processId;
+ }
+
+ public void setProcessId(long processId)
+ {
+ this.processId = processId;
+ }
+
+ @XmlElement(name = "name")
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getVersion()
+ {
+ return version;
+ }
+
+ public void setVersion(String version)
+ {
+ this.version = version;
+ }
+
+ public String toString()
+ {
+ return "ProcessDefinitionRef{id="+this.processId +", name="+this.name+"}";
+ }
+}
Property changes on: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionRef.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionRefWrapper.java (from rev 2755, projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionWrapper.java)
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionRefWrapper.java (rev 0)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionRefWrapper.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -0,0 +1,57 @@
+/*
+ * 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.client.model;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+@XmlRootElement(name = "wrapper")
+public class ProcessDefinitionRefWrapper
+{
+
+ List<ProcessDefinitionRef> definitions;
+
+ public ProcessDefinitionRefWrapper()
+ {
+ }
+
+ public ProcessDefinitionRefWrapper(List<ProcessDefinitionRef> defs)
+ {
+ this.definitions = defs;
+ }
+
+ @XmlElement
+ public List<ProcessDefinitionRef> getDefinitions()
+ {
+ return definitions;
+ }
+
+ @XmlElement(name = "totalCount")
+ public int getTotalCount()
+ {
+ return definitions.size();
+ }
+}
Property changes on: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionRefWrapper.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionWrapper.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionWrapper.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionWrapper.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -1,57 +0,0 @@
-/*
- * 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.client.model;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import java.util.List;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-@XmlRootElement(name = "wrapper")
-public class ProcessDefinitionWrapper
-{
-
- List<ProcessDefinition> definitions;
-
- public ProcessDefinitionWrapper()
- {
- }
-
- public ProcessDefinitionWrapper(List<ProcessDefinition> defs)
- {
- this.definitions = defs;
- }
-
- @XmlElement
- public List<ProcessDefinition> getDefinitions()
- {
- return definitions;
- }
-
- @XmlElement(name = "totalCount")
- public int getTotalCount()
- {
- return definitions.size();
- }
-}
Deleted: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstance.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstance.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstance.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -1,261 +0,0 @@
-/*
- * 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.client.model;
-
-
-import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import java.util.Date;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-@XmlRootElement(name="processInstance")
-public class ProcessInstance
-{
- private long instanceId;
- private long parentId;
-
- private String key;
- public enum STATE {RUNNING, SUSPENDED, ENDED};
-
- private Date startDate;
- private Date endDate;
-
- private boolean suspended;
-
- private STATE state; // gson is field based, hence why...
-
- private transient Lifecycle lifecycle;
-
- private TokenReference rootToken;
-
- public ProcessInstance()
- {
- initLifecycle();
- }
-
- public ProcessInstance(long id, long parentId, Date startDate, Date endDate, boolean suspended)
- {
-
- if(null==startDate)
- throw new IllegalArgumentException("An instance requires a start date");
-
- if(endDate!=null && suspended)
- throw new IllegalArgumentException("An instance cannot be ended and suspended at the same time");
-
- this.instanceId = id;
- this.parentId = parentId;
- this.startDate = startDate;
- this.endDate = endDate;
- this.suspended = suspended;
- initLifecycle();
- }
-
- /**
- * If not ENDED or SUSPENDED the instance is RUNNING
- */
- private void initLifecycle()
- {
- if(hasEnded())
- this.lifecycle = new Lifecycle(this, STATE.ENDED);
- else if(isSuspended())
- this.lifecycle = new Lifecycle(this, STATE.SUSPENDED);
- else
- this.lifecycle = new Lifecycle(this, STATE.RUNNING);
-
- this.state = lifecycle.getState();
- }
-
- @XmlElement(name = "instanceId")
- public long getInstanceId()
- {
- return instanceId;
- }
-
- public void setInstanceId(long instanceId)
- {
- this.instanceId = instanceId;
- }
-
- @XmlElement(name = "parentId")
- public long getParentId()
- {
- return parentId;
- }
-
- public void setParentId(long parentId)
- {
- this.parentId = parentId;
- }
-
- @XmlElement(name = "key")
- public String getKey()
- {
- return key !=null ? key : "";
- }
-
- public void setKey(String key)
- {
- this.key = key;
- }
-
- @XmlElement(name = "status")
- public STATE getState()
- {
- return this.state;
- }
-
- public void setState(String nextState)
- {
- setState(STATE.valueOf(nextState));
- }
-
- public void setState(STATE nextState)
- {
- this.lifecycle = this.lifecycle.transitionTo(nextState);
- this.state = this.lifecycle.getState();
- }
-
- @XmlElement(name = "start")
- public Date getStartDate()
- {
- return startDate;
- }
-
- public void setStartDate(Date startDate)
- {
- this.startDate = startDate;
- }
-
- @XmlElement(name = "end")
- public Date getEndDate()
- {
- return endDate;
- }
-
- public void setEndDate(Date endDate)
- {
- this.endDate = endDate;
- }
-
- public boolean isRunning()
- {
- return this.startDate!=null && !isSuspended();
- }
-
- public boolean hasEnded()
- {
- return this.startDate!=null
- && this.endDate!=null;
- }
-
- public boolean isSuspended()
- {
- return null==this.endDate && suspended;
- }
-
- private class Lifecycle
- {
- private STATE current;
- private ProcessInstance instance;
-
- public Lifecycle(ProcessInstance instance, STATE current)
- {
- this.instance = instance;
- this.current = current;
- }
-
- public Lifecycle transitionTo(STATE next)
- {
- Lifecycle nextLifecycle = null;
-
- switch(next)
- {
- case SUSPENDED: // only RUNNING instances can be SUSPENDED
- if(STATE.RUNNING.equals(current))
- {
- nextLifecycle = new Lifecycle(instance, next);
- instance.suspended = true;
- break;
- }
- else
- {
- throw new IllegalTransitionException(current, next);
- }
- case ENDED: // both RUNNING and SUSPENDED instances can be ENDED
- if(STATE.RUNNING.equals(current) || STATE.SUSPENDED.equals(current))
- {
- nextLifecycle = new Lifecycle(instance, next);
- instance.suspended = false;
- instance.endDate = new Date();
- break;
- }
- else
- {
- throw new IllegalTransitionException(current, next);
- }
- case RUNNING: // only SUSPENDED instances can become RUNNING
- if(STATE.SUSPENDED.equals(current))
- {
- nextLifecycle = new Lifecycle(instance, next);
- instance.suspended = false;
- break;
- }
- else
- {
- throw new IllegalTransitionException(current, next);
- }
- default:
- throw new IllegalTransitionException(current, next);
- }
-
- return nextLifecycle;
- }
-
- public STATE getState()
- {
- return current;
- }
- }
-
- private class IllegalTransitionException extends IllegalArgumentException
- {
-
- public IllegalTransitionException(STATE current, STATE next)
- {
- super("Illegal transition current " + current + " next " + next);
- }
- }
-
- public TokenReference getRootToken()
- {
- return rootToken;
- }
-
- public void setRootToken(TokenReference rootToken)
- {
- this.rootToken = rootToken;
- }
-}
Copied: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceRef.java (from rev 2892, projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstance.java)
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceRef.java (rev 0)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceRef.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -0,0 +1,261 @@
+/*
+ * 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.client.model;
+
+
+import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.Date;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+@XmlRootElement(name="processInstance")
+public class ProcessInstanceRef
+{
+ private long instanceId;
+ private long parentId;
+
+ private String key;
+ public enum STATE {RUNNING, SUSPENDED, ENDED};
+
+ private Date startDate;
+ private Date endDate;
+
+ private boolean suspended;
+
+ private STATE state; // gson is field based, hence why...
+
+ private transient Lifecycle lifecycle;
+
+ private TokenReference rootToken;
+
+ public ProcessInstanceRef()
+ {
+ initLifecycle();
+ }
+
+ public ProcessInstanceRef(long id, long parentId, Date startDate, Date endDate, boolean suspended)
+ {
+
+ if(null==startDate)
+ throw new IllegalArgumentException("An instance requires a start date");
+
+ if(endDate!=null && suspended)
+ throw new IllegalArgumentException("An instance cannot be ended and suspended at the same time");
+
+ this.instanceId = id;
+ this.parentId = parentId;
+ this.startDate = startDate;
+ this.endDate = endDate;
+ this.suspended = suspended;
+ initLifecycle();
+ }
+
+ /**
+ * If not ENDED or SUSPENDED the instance is RUNNING
+ */
+ private void initLifecycle()
+ {
+ if(hasEnded())
+ this.lifecycle = new Lifecycle(this, STATE.ENDED);
+ else if(isSuspended())
+ this.lifecycle = new Lifecycle(this, STATE.SUSPENDED);
+ else
+ this.lifecycle = new Lifecycle(this, STATE.RUNNING);
+
+ this.state = lifecycle.getState();
+ }
+
+ @XmlElement(name = "instanceId")
+ public long getInstanceId()
+ {
+ return instanceId;
+ }
+
+ public void setInstanceId(long instanceId)
+ {
+ this.instanceId = instanceId;
+ }
+
+ @XmlElement(name = "parentId")
+ public long getParentId()
+ {
+ return parentId;
+ }
+
+ public void setParentId(long parentId)
+ {
+ this.parentId = parentId;
+ }
+
+ @XmlElement(name = "key")
+ public String getKey()
+ {
+ return key !=null ? key : "";
+ }
+
+ public void setKey(String key)
+ {
+ this.key = key;
+ }
+
+ @XmlElement(name = "status")
+ public STATE getState()
+ {
+ return this.state;
+ }
+
+ public void setState(String nextState)
+ {
+ setState(STATE.valueOf(nextState));
+ }
+
+ public void setState(STATE nextState)
+ {
+ this.lifecycle = this.lifecycle.transitionTo(nextState);
+ this.state = this.lifecycle.getState();
+ }
+
+ @XmlElement(name = "start")
+ public Date getStartDate()
+ {
+ return startDate;
+ }
+
+ public void setStartDate(Date startDate)
+ {
+ this.startDate = startDate;
+ }
+
+ @XmlElement(name = "end")
+ public Date getEndDate()
+ {
+ return endDate;
+ }
+
+ public void setEndDate(Date endDate)
+ {
+ this.endDate = endDate;
+ }
+
+ public boolean isRunning()
+ {
+ return this.startDate!=null && !isSuspended();
+ }
+
+ public boolean hasEnded()
+ {
+ return this.startDate!=null
+ && this.endDate!=null;
+ }
+
+ public boolean isSuspended()
+ {
+ return null==this.endDate && suspended;
+ }
+
+ private class Lifecycle
+ {
+ private STATE current;
+ private ProcessInstanceRef instance;
+
+ public Lifecycle(ProcessInstanceRef instance, STATE current)
+ {
+ this.instance = instance;
+ this.current = current;
+ }
+
+ public Lifecycle transitionTo(STATE next)
+ {
+ Lifecycle nextLifecycle = null;
+
+ switch(next)
+ {
+ case SUSPENDED: // only RUNNING instances can be SUSPENDED
+ if(STATE.RUNNING.equals(current))
+ {
+ nextLifecycle = new Lifecycle(instance, next);
+ instance.suspended = true;
+ break;
+ }
+ else
+ {
+ throw new IllegalTransitionException(current, next);
+ }
+ case ENDED: // both RUNNING and SUSPENDED instances can be ENDED
+ if(STATE.RUNNING.equals(current) || STATE.SUSPENDED.equals(current))
+ {
+ nextLifecycle = new Lifecycle(instance, next);
+ instance.suspended = false;
+ instance.endDate = new Date();
+ break;
+ }
+ else
+ {
+ throw new IllegalTransitionException(current, next);
+ }
+ case RUNNING: // only SUSPENDED instances can become RUNNING
+ if(STATE.SUSPENDED.equals(current))
+ {
+ nextLifecycle = new Lifecycle(instance, next);
+ instance.suspended = false;
+ break;
+ }
+ else
+ {
+ throw new IllegalTransitionException(current, next);
+ }
+ default:
+ throw new IllegalTransitionException(current, next);
+ }
+
+ return nextLifecycle;
+ }
+
+ public STATE getState()
+ {
+ return current;
+ }
+ }
+
+ private class IllegalTransitionException extends IllegalArgumentException
+ {
+
+ public IllegalTransitionException(STATE current, STATE next)
+ {
+ super("Illegal transition current " + current + " next " + next);
+ }
+ }
+
+ public TokenReference getRootToken()
+ {
+ return rootToken;
+ }
+
+ public void setRootToken(TokenReference rootToken)
+ {
+ this.rootToken = rootToken;
+ }
+}
Property changes on: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceRef.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceRefWrapper.java (from rev 2755, projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceWrapper.java)
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceRefWrapper.java (rev 0)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceRefWrapper.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -0,0 +1,57 @@
+/*
+ * 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.client.model;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+@XmlRootElement(name = "wrapper")
+public class ProcessInstanceRefWrapper
+{
+
+ List<ProcessInstanceRef> instances;
+
+ public ProcessInstanceRefWrapper()
+ {
+ }
+
+ public ProcessInstanceRefWrapper(List<ProcessInstanceRef> instances)
+ {
+ this.instances = instances;
+ }
+
+ @XmlElement
+ public List<ProcessInstanceRef> getInstances()
+ {
+ return instances;
+ }
+
+ @XmlElement(name = "totalCount")
+ public int getTotalCount()
+ {
+ return instances.size();
+ }
+}
Property changes on: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceRefWrapper.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceWrapper.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceWrapper.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceWrapper.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -1,57 +0,0 @@
-/*
- * 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.client.model;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import java.util.List;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-@XmlRootElement(name = "wrapper")
-public class ProcessInstanceWrapper
-{
-
- List<ProcessInstance> instances;
-
- public ProcessInstanceWrapper()
- {
- }
-
- public ProcessInstanceWrapper(List<ProcessInstance> instances)
- {
- this.instances = instances;
- }
-
- @XmlElement
- public List<ProcessInstance> getInstances()
- {
- return instances;
- }
-
- @XmlElement(name = "totalCount")
- public int getTotalCount()
- {
- return instances.size();
- }
-}
Deleted: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/RoleAssignment.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/RoleAssignment.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/RoleAssignment.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -1,68 +0,0 @@
-/*
- * 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.client.model;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-@XmlRootElement(name = "roleAssignment")
-public class RoleAssignment
-{
- private String role;
- private boolean isAssigned;
-
-
- public RoleAssignment()
- {
- }
-
- public RoleAssignment(String role, boolean assigned)
- {
- this.role = role;
- isAssigned = assigned;
- }
-
- @XmlElement(name = "role")
- public String getRole()
- {
- return role;
- }
-
- public void setRole(String role)
- {
- this.role = role;
- }
-
- @XmlElement(name = "isAssigned")
- public boolean isAssigned()
- {
- return isAssigned;
- }
-
- public void setAssigned(boolean assigned)
- {
- isAssigned = assigned;
- }
-}
Copied: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/RoleAssignmentRef.java (from rev 2755, projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/RoleAssignment.java)
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/RoleAssignmentRef.java (rev 0)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/RoleAssignmentRef.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -0,0 +1,68 @@
+/*
+ * 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.client.model;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+@XmlRootElement(name = "roleAssignment")
+public class RoleAssignmentRef
+{
+ private String role;
+ private boolean isAssigned;
+
+
+ public RoleAssignmentRef()
+ {
+ }
+
+ public RoleAssignmentRef(String role, boolean assigned)
+ {
+ this.role = role;
+ isAssigned = assigned;
+ }
+
+ @XmlElement(name = "role")
+ public String getRole()
+ {
+ return role;
+ }
+
+ public void setRole(String role)
+ {
+ this.role = role;
+ }
+
+ @XmlElement(name = "isAssigned")
+ public boolean isAssigned()
+ {
+ return isAssigned;
+ }
+
+ public void setAssigned(boolean assigned)
+ {
+ isAssigned = assigned;
+ }
+}
Property changes on: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/RoleAssignmentRef.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/RoleAssignmentRefWrapper.java (from rev 2755, projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/RoleAssignmentWrapper.java)
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/RoleAssignmentRefWrapper.java (rev 0)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/RoleAssignmentRefWrapper.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -0,0 +1,53 @@
+/*
+ * 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.client.model;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+@XmlRootElement(name = "wrapper")
+public class RoleAssignmentRefWrapper
+{
+ List<RoleAssignmentRef> roles;
+
+ public RoleAssignmentRefWrapper()
+ {
+ }
+
+ public RoleAssignmentRefWrapper(List<RoleAssignmentRef> roles)
+ {
+ this.roles = roles;
+ }
+
+ public List<RoleAssignmentRef> getRoles()
+ {
+ return roles;
+ }
+
+ public void setRoles(List<RoleAssignmentRef> roles)
+ {
+ this.roles = roles;
+ }
+}
Property changes on: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/RoleAssignmentRefWrapper.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/RoleAssignmentWrapper.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/RoleAssignmentWrapper.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/RoleAssignmentWrapper.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -1,53 +0,0 @@
-/*
- * 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.client.model;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import java.util.List;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-@XmlRootElement(name = "wrapper")
-public class RoleAssignmentWrapper
-{
- List<RoleAssignment> roles;
-
- public RoleAssignmentWrapper()
- {
- }
-
- public RoleAssignmentWrapper(List<RoleAssignment> roles)
- {
- this.roles = roles;
- }
-
- public List<RoleAssignment> getRoles()
- {
- return roles;
- }
-
- public void setRoles(List<RoleAssignment> roles)
- {
- this.roles = roles;
- }
-}
Copied: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskRef.java (from rev 3011, projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskReference.java)
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskRef.java (rev 0)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskRef.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -0,0 +1,200 @@
+/*
+ * 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.client.model;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+@XmlRootElement(name = "taskReference")
+public class TaskRef
+{
+ private long id;
+ private long tokenId;
+ private long processInstanceId;
+ private long processId;
+
+ private String name;
+ private String actor = "";
+
+ private boolean isBlocking;
+ private boolean isSignalling = true;
+
+ private List<String> transitionNames = new ArrayList<String>();
+ private List<String> pooledActors = new ArrayList<String>();
+
+ public enum STATE {OPEN, ASSIGNED, CLOSED};
+ private STATE currentState;
+
+ public TaskRef()
+ {
+ initOrUpdateState();
+ }
+
+ public TaskRef(
+ long taskId, long tokenId, long processInstanceId,
+ long processId,
+ String taskName, String actorName,
+ boolean blocking, boolean signalling
+ )
+ {
+ this.id = taskId;
+ this.tokenId = tokenId;
+ this.processInstanceId = processInstanceId;
+ this.processId = processId;
+ this.name = taskName;
+ setActor(actorName);
+ isBlocking = blocking;
+ isSignalling = signalling;
+
+ initOrUpdateState();
+ }
+
+ public long getId()
+ {
+ return id;
+ }
+
+ public void setId(long id)
+ {
+ this.id = id;
+ }
+
+ public long getTokenId()
+ {
+ return tokenId;
+ }
+
+ public void setTokenId(long tokenId)
+ {
+ this.tokenId = tokenId;
+ }
+
+ public long getProcessInstanceId()
+ {
+ return processInstanceId;
+ }
+
+ public void setProcessInstanceId(long processInstanceId)
+ {
+ this.processInstanceId = processInstanceId;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getActor()
+ {
+ return actor;
+ }
+
+ public void setActor(String actor)
+ {
+ if(null==actor)
+ actor = "";
+
+ this.actor = actor;
+ initOrUpdateState();
+ }
+
+ public boolean isBlocking()
+ {
+ return isBlocking;
+ }
+
+ public void setBlocking(boolean blocking)
+ {
+ isBlocking = blocking;
+ }
+
+ public boolean isSignalling()
+ {
+ return isSignalling;
+ }
+
+ public void setSignalling(boolean signalling)
+ {
+ isSignalling = signalling;
+ }
+
+ public List<String> getTransitionNames()
+ {
+ return transitionNames;
+ }
+
+ public void addPooledActor(String actorId)
+ {
+ pooledActors.add(actorId);
+
+ initOrUpdateState();
+ }
+
+ private void initOrUpdateState()
+ {
+ if(actor==null || actor.equals(""))
+ {
+ currentState = STATE.OPEN;
+ }
+ else
+ {
+ currentState = STATE.ASSIGNED;
+ }
+ }
+
+ public void close()
+ {
+ if(STATE.ASSIGNED != currentState)
+ throw new IllegalArgumentException("Cannot close task in state " + currentState);
+
+ currentState = STATE.CLOSED;
+ }
+
+ public long getProcessId()
+ {
+ return processId;
+ }
+
+ public STATE getCurrentState()
+ {
+ return currentState;
+ }
+
+ public String toString()
+ {
+ return "TaskRef{id:"+id+",state:"+currentState+"}";
+ }
+
+ public List<String> getPooledActors()
+ {
+ return pooledActors;
+ }
+}
Copied: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskRefWrapper.java (from rev 2755, projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskReferenceWrapper.java)
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskRefWrapper.java (rev 0)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskRefWrapper.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -0,0 +1,61 @@
+/*
+ * 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.client.model;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlElement;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+@XmlRootElement(name = "wrapper")
+public class TaskRefWrapper
+{
+ List<TaskRef> tasks = new ArrayList<TaskRef>();
+
+ public TaskRefWrapper()
+ {
+ }
+
+ public TaskRefWrapper(List<TaskRef> tasks)
+ {
+ this.tasks = tasks;
+ }
+
+ public List<TaskRef> getTasks()
+ {
+ return tasks;
+ }
+
+ public void setTasks(List<TaskRef> tasks)
+ {
+ this.tasks = tasks;
+ }
+
+ @XmlElement(name = "totalCount")
+ public int getTotalCount()
+ {
+ return tasks.size();
+ }
+}
Deleted: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskReference.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskReference.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskReference.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -1,200 +0,0 @@
-/*
- * 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.client.model;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-@XmlRootElement(name = "taskReference")
-public class TaskReference
-{
- private long id;
- private long tokenId;
- private long processInstanceId;
- private long processId;
-
- private String name;
- private String actor = "";
-
- private boolean isBlocking;
- private boolean isSignalling = true;
-
- private List<String> transitionNames = new ArrayList<String>();
- private List<String> pooledActors = new ArrayList<String>();
-
- public enum STATE {OPEN, ASSIGNED, CLOSED};
- private STATE currentState;
-
- public TaskReference()
- {
- initOrUpdateState();
- }
-
- public TaskReference(
- long taskId, long tokenId, long processInstanceId,
- long processId,
- String taskName, String actorName,
- boolean blocking, boolean signalling
- )
- {
- this.id = taskId;
- this.tokenId = tokenId;
- this.processInstanceId = processInstanceId;
- this.processId = processId;
- this.name = taskName;
- setActor(actorName);
- isBlocking = blocking;
- isSignalling = signalling;
-
- initOrUpdateState();
- }
-
- public long getId()
- {
- return id;
- }
-
- public void setId(long id)
- {
- this.id = id;
- }
-
- public long getTokenId()
- {
- return tokenId;
- }
-
- public void setTokenId(long tokenId)
- {
- this.tokenId = tokenId;
- }
-
- public long getProcessInstanceId()
- {
- return processInstanceId;
- }
-
- public void setProcessInstanceId(long processInstanceId)
- {
- this.processInstanceId = processInstanceId;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public String getActor()
- {
- return actor;
- }
-
- public void setActor(String actor)
- {
- if(null==actor)
- actor = "";
-
- this.actor = actor;
- initOrUpdateState();
- }
-
- public boolean isBlocking()
- {
- return isBlocking;
- }
-
- public void setBlocking(boolean blocking)
- {
- isBlocking = blocking;
- }
-
- public boolean isSignalling()
- {
- return isSignalling;
- }
-
- public void setSignalling(boolean signalling)
- {
- isSignalling = signalling;
- }
-
- public List<String> getTransitionNames()
- {
- return transitionNames;
- }
-
- public void addPooledActor(String actorId)
- {
- pooledActors.add(actorId);
-
- initOrUpdateState();
- }
-
- private void initOrUpdateState()
- {
- if(actor==null || actor.equals(""))
- {
- currentState = STATE.OPEN;
- }
- else
- {
- currentState = STATE.ASSIGNED;
- }
- }
-
- public void close()
- {
- if(STATE.ASSIGNED != currentState)
- throw new IllegalArgumentException("Cannot close task in state " + currentState);
-
- currentState = STATE.CLOSED;
- }
-
- public long getProcessId()
- {
- return processId;
- }
-
- public STATE getCurrentState()
- {
- return currentState;
- }
-
- public String toString()
- {
- return "TaskRef{id:"+id+",state:"+currentState+"}";
- }
-
- public List<String> getPooledActors()
- {
- return pooledActors;
- }
-}
Deleted: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskReferenceWrapper.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskReferenceWrapper.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskReferenceWrapper.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -1,61 +0,0 @@
-/*
- * 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.client.model;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlElement;
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-@XmlRootElement(name = "wrapper")
-public class TaskReferenceWrapper
-{
- List<TaskReference> tasks = new ArrayList<TaskReference>();
-
- public TaskReferenceWrapper()
- {
- }
-
- public TaskReferenceWrapper(List<TaskReference> tasks)
- {
- this.tasks = tasks;
- }
-
- public List<TaskReference> getTasks()
- {
- return tasks;
- }
-
- public void setTasks(List<TaskReference> tasks)
- {
- this.tasks = tasks;
- }
-
- @XmlElement(name = "totalCount")
- public int getTotalCount()
- {
- return tasks.size();
- }
-}
Modified: projects/gwt-console/trunk/server/SQL.txt
===================================================================
--- projects/gwt-console/trunk/server/SQL.txt 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/server/SQL.txt 2008-11-21 10:30:25 UTC (rev 3020)
@@ -1,4 +1,21 @@
-Group membership:
+Group membership
+----------------
+select u.NAME_ as userName, g.NAME_ as groupName, m.ROLE_ as role from JBPM_ID_USER as u, JBPM_ID_GROUP as g, JBPM_ID_MEMBERSHIP as m
+where u.ID_=m.USER_ AND m.GROUP_=g.ID_
-select u.NAME_ as userName, g.NAME_ as groupName, m.ROLE_ as role from JBPM_ID_USER as u, JBPM_ID_GROUP as g, JBPM_ID_MEMBERSHIP as m
-where u.ID_=m.USER_ AND m.GROUP_=g.ID_
\ No newline at end of file
+Log analysis
+-------------
+
+[Instance start and end]
+
+SELECT l.CLASS_, l.DATE_, l.TOKEN_, i.ID_ as instanceID, p.NAME_ as processName, p.ID_ as processID
+ FROM JBPM_LOG l, JBPM_TOKEN t, JBPM_PROCESSINSTANCE i, JBPM_PROCESSDEFINITION p
+WHERE l.CLASS_='I' OR l.CLASS_='X'
+AND t.ID_=l.TOKEN_
+AND t.PROCESSINSTANCE_=i.ID_
+AND i.PROCESSDEFINITION_=p.ID_
+GROUP BY l.CLASS_
+ORDER BY l.DATE_ ASC, l.TOKEN_
+
+
+
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -112,7 +112,7 @@
// Process a file upload in memory
byte[] data = item.get();
- getProcessManagement().deployNewDefinition(data);
+ getManagementExtension().deployNewDefinition(data);
// Process stream
//InputStream uploadedStream = item.getInputStream();
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -22,11 +22,12 @@
package org.jboss.bpm.console.server;
import com.google.gson.Gson;
-import org.jboss.bpm.console.client.model.ProcessDefinitionWrapper;
-import org.jboss.bpm.console.client.model.ProcessInstanceWrapper;
-import org.jboss.bpm.console.client.model.ProcessInstance;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRefWrapper;
+import org.jboss.bpm.console.client.model.ProcessInstanceRefWrapper;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.server.dao.ManagementFactory;
import org.jboss.bpm.console.server.dao.ProcessManagement;
+import org.jboss.bpm.console.server.dao.JBPM3Extension;
import org.jboss.bpm.console.server.gson.GsonFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -42,14 +43,10 @@
@Path("process")
public class ProcessMgmtFacade
{
-
private static final Log log = LogFactory.getLog(ProcessMgmtFacade.class);
-
private ProcessManagement processManagement;
+ private JBPM3Extension managementExtension;
- /**
- * Lazy load the {@link org.jboss.bpm.console.server.dao.ProcessManagement}
- */
private ProcessManagement getProcessDAO()
{
if(null==this.processManagement)
@@ -62,13 +59,26 @@
return this.processManagement;
}
+ private JBPM3Extension getManagementExtension()
+ {
+ if(null==this.managementExtension)
+ {
+ ManagementFactory factory = ManagementFactory.newInstance();
+ this.managementExtension = factory.createExtensionManagement();
+ }
+
+ return this.managementExtension;
+
+ }
+
+
@GET
@Path("definitions")
@Produces("application/json")
public Response getDefinitionsJSON()
{
- ProcessDefinitionWrapper wrapper =
- new ProcessDefinitionWrapper(getProcessDAO().getAllDefinitions());
+ ProcessDefinitionRefWrapper wrapper =
+ new ProcessDefinitionRefWrapper(getProcessDAO().getAllDefinitions());
return createJsonResponse(wrapper);
}
@@ -76,12 +86,12 @@
@Path("definitions/{id}/remove")
@Produces("application/json")
public Response removeDefinitionsJSON(
- @PathParam("id")
- long processId
+ @PathParam("id")
+ long processId
)
{
- ProcessDefinitionWrapper wrapper =
- new ProcessDefinitionWrapper( getProcessDAO().removeDefinition(processId));
+ ProcessDefinitionRefWrapper wrapper =
+ new ProcessDefinitionRefWrapper( getProcessDAO().removeDefinition(processId));
return createJsonResponse(wrapper);
}
@@ -89,13 +99,13 @@
@Path("definitions/{id}/instances")
@Produces("application/json")
public Response getInstancesJSON(
- @PathParam("id")
- long processId
+ @PathParam("id")
+ long processId
)
{
- ProcessInstanceWrapper wrapper =
- new ProcessInstanceWrapper(getProcessDAO().getInstancesByProcessId(processId));
+ ProcessInstanceRefWrapper wrapper =
+ new ProcessInstanceRefWrapper(getProcessDAO().getInstancesByProcessId(processId));
return createJsonResponse(wrapper);
}
@@ -103,11 +113,11 @@
@Path("definitions/{id}/instances/new")
@Produces("application/json")
public Response newInstance(
- @PathParam("id")
- long processId)
+ @PathParam("id")
+ long processId)
{
- ProcessInstance instance = getProcessDAO().newInstance(processId);
+ ProcessInstanceRef instance = getProcessDAO().newInstance(processId);
return createJsonResponse(instance);
}
@@ -115,13 +125,13 @@
@Path("instances/{id}/state/{next}")
@Produces("application/json")
public Response changeState(
- @PathParam("id")
- long instanceId,
- @PathParam("next")
- String next)
+ @PathParam("id")
+ long instanceId,
+ @PathParam("next")
+ String next)
{
log.debug("Change instance (ID "+instanceId+") to state " +next);
- getProcessDAO().changeState(instanceId, next);
+ getManagementExtension().changeState(instanceId, next);
return Response.ok().type("application/json").build();
}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -24,7 +24,7 @@
import com.google.gson.Gson;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.bpm.console.client.model.TaskReferenceWrapper;
+import org.jboss.bpm.console.client.model.TaskRefWrapper;
import org.jboss.bpm.console.client.model.forms.FieldDef;
import org.jboss.bpm.console.client.model.forms.FormDef;
import org.jboss.bpm.console.client.model.util.MapEntry;
@@ -89,8 +89,8 @@
String actorName
)
{
- TaskReferenceWrapper wrapper =
- new TaskReferenceWrapper(getTaskManagement().getTasksByActor(actorName));
+ TaskRefWrapper wrapper =
+ new TaskRefWrapper(getTaskManagement().getTasksByActor(actorName));
return createJsonResponse(wrapper);
}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -21,8 +21,8 @@
*/
package org.jboss.bpm.console.server;
-import org.jboss.bpm.console.client.model.RoleAssignment;
-import org.jboss.bpm.console.client.model.RoleAssignmentWrapper;
+import org.jboss.bpm.console.client.model.RoleAssignmentRef;
+import org.jboss.bpm.console.client.model.RoleAssignmentRefWrapper;
import org.jboss.bpm.console.server.gson.GsonFactory;
import org.jboss.bpm.console.server.dao.UserManagement;
import org.jboss.bpm.console.server.dao.ManagementFactory;
@@ -78,15 +78,15 @@
log.debug("Role check user: " + request.getRemoteUser() + ", actualRoles requested: " + roleCheck);
- List<RoleAssignment> actualRoles = new ArrayList<RoleAssignment>();
+ List<RoleAssignmentRef> actualRoles = new ArrayList<RoleAssignmentRef>();
StringTokenizer tok = new StringTokenizer(roleCheck, ",");
while(tok.hasMoreTokens())
{
String possibleRole = tok.nextToken();
- actualRoles.add( new RoleAssignment(possibleRole, request.isUserInRole(possibleRole)));
+ actualRoles.add( new RoleAssignmentRef(possibleRole, request.isUserInRole(possibleRole)));
}
- return createJsonResponse( new RoleAssignmentWrapper(actualRoles));
+ return createJsonResponse( new RoleAssignmentRefWrapper(actualRoles));
}
@GET
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/JBPM3Extension.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/JBPM3Extension.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/JBPM3Extension.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -23,6 +23,7 @@
import org.jboss.bpm.console.client.model.jbpm3.ActiveNodeInfo;
import org.jboss.bpm.console.client.model.jbpm3.DiagramInfo;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import java.util.Map;
@@ -39,10 +40,14 @@
ActiveNodeInfo getActivNodeInfo(long instanceId);
+ // TODO: move to process management
void signalToken(long tokenId, String signal);
Map<String, String> getAvailableTaskForms(long processId);
byte[] getTaskFormByTaskName(long processId, long taskId);
+ void changeState(long instanceId, String nextState);
+
+ ProcessDefinitionRef deployNewDefinition(byte[] data);
}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ProcessManagement.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ProcessManagement.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/ProcessManagement.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -21,9 +21,8 @@
*/
package org.jboss.bpm.console.server.dao;
-import org.jboss.bpm.console.client.model.ProcessDefinition;
-import org.jboss.bpm.console.client.model.ProcessInstance;
-import org.jboss.bpm.console.client.model.TaskReference;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import java.util.List;
@@ -34,20 +33,16 @@
*/
public interface ProcessManagement
{
- List<ProcessDefinition> getAllDefinitions();
+ List<ProcessDefinitionRef> getAllDefinitions();
- ProcessDefinition getDefinitionById(long processId);
+ ProcessDefinitionRef getDefinitionById(long processId);
- List<ProcessDefinition> removeDefinition(long processId);
+ List<ProcessDefinitionRef> removeDefinition(long processId);
- List<ProcessInstance> getInstancesByProcessId(long processId);
+ List<ProcessInstanceRef> getInstancesByProcessId(long processId);
- ProcessInstance getInstanceById(long instanceId);
-
- void changeState(long instanceId, String nextState);
+ ProcessInstanceRef getInstanceById(long instanceId);
- ProcessInstance newInstance(long processId);
+ ProcessInstanceRef newInstance(long processId);
- ProcessDefinition deployNewDefinition(byte[] data);
-
}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/TaskManagement.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/TaskManagement.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/TaskManagement.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -21,18 +21,17 @@
*/
package org.jboss.bpm.console.server.dao;
-import org.jboss.bpm.console.client.model.TaskReference;
+import org.jboss.bpm.console.client.model.TaskRef;
import java.util.List;
-import java.util.Map;
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
public interface TaskManagement
{
- List<TaskReference> getTasksByActor(String actorName);
- TaskReference getTaskById(long taskId);
+ List<TaskRef> getTasksByActor(String actorName);
+ TaskRef getTaskById(long taskId);
void reassignTask(long taskId, String actorId);
// TODO: If signaling resides with an extension then closeTask() should as well
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ManagementExtension.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ManagementExtension.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ManagementExtension.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -153,4 +153,18 @@
throw new RuntimeException("No form definition for taskId '"+taskId+"'");
}
+
+ public void changeState(long instanceId, String nextState)
+ {
+ org.jbpm.graph.exe.ProcessInstance p0 = delegate.getActualInstance(instanceId);
+ Transform.doTransition(p0, nextState); // modifies the actual PI
+
+ // TX commit will persist changes to the actual PI
+ }
+
+ public org.jboss.bpm.console.client.model.ProcessDefinitionRef deployNewDefinition(byte[] data)
+ {
+ org.jbpm.graph.def.ProcessDefinition p0 = delegate.deploy(data);
+ return Transform.processDefinition(p0);
+ }
}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ProcessManagement.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ProcessManagement.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ProcessManagement.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -21,8 +21,8 @@
*/
package org.jboss.bpm.console.server.dao.internal;
-import org.jboss.bpm.console.client.model.ProcessDefinition;
-import org.jboss.bpm.console.client.model.ProcessInstance;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.server.dao.ProcessManagement;
import java.util.ArrayList;
@@ -40,11 +40,11 @@
this.delegate = new JBPM3CommandDelegate();
}
- public List<ProcessDefinition> getAllDefinitions()
+ public List<ProcessDefinitionRef> getAllDefinitions()
{
List<org.jbpm.graph.def.ProcessDefinition> defs = delegate.getActualDefinitions();
- List<ProcessDefinition> results = new ArrayList<ProcessDefinition>(defs.size());
+ List<ProcessDefinitionRef> results = new ArrayList<ProcessDefinitionRef>(defs.size());
for(org.jbpm.graph.def.ProcessDefinition p0 : defs)
{
results.add( Transform.processDefinition(p0) );
@@ -52,29 +52,29 @@
return results;
}
- public ProcessDefinition getDefinitionById(long processId)
+ public ProcessDefinitionRef getDefinitionById(long processId)
{
org.jbpm.graph.def.ProcessDefinition p0 = delegate.getActualDefinition(processId);
return Transform.processDefinition(p0);
}
- public List<ProcessDefinition> removeDefinition(long processId)
+ public List<ProcessDefinitionRef> removeDefinition(long processId)
{
delegate.removeActualDefinition(processId);
return getAllDefinitions();
}
- public ProcessInstance newInstance(long processId)
+ public ProcessInstanceRef newInstance(long processId)
{
org.jbpm.graph.exe.ProcessInstance instance = delegate.startNewInstance(processId);
return Transform.processInstance(instance);
}
- public List<ProcessInstance> getInstancesByProcessId(long processId)
+ public List<ProcessInstanceRef> getInstancesByProcessId(long processId)
{
List<org.jbpm.graph.exe.ProcessInstance> instances = delegate.getActualInstances(processId);
- List<ProcessInstance> results = new ArrayList<ProcessInstance>(instances.size());
+ List<ProcessInstanceRef> results = new ArrayList<ProcessInstanceRef>(instances.size());
for(org.jbpm.graph.exe.ProcessInstance i0 : instances)
{
results.add( Transform.processInstance(i0) );
@@ -82,26 +82,10 @@
return results;
}
- public ProcessInstance getInstanceById(long instanceId)
+ public ProcessInstanceRef getInstanceById(long instanceId)
{
org.jbpm.graph.exe.ProcessInstance instance = delegate.getActualInstance(instanceId);
return Transform.processInstance(instance);
}
-
- public void changeState(long instanceId, String nextState)
- {
- org.jbpm.graph.exe.ProcessInstance p0 = delegate.getActualInstance(instanceId);
- Transform.doTransition(p0, nextState); // modifies the actual PI
-
- // TX commit will persist changes to the actual PI
-
-
- }
-
- public ProcessDefinition deployNewDefinition(byte[] data)
- {
- org.jbpm.graph.def.ProcessDefinition p0 = delegate.deploy(data);
- return Transform.processDefinition(p0);
- }
}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3TaskManagement.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3TaskManagement.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3TaskManagement.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -21,7 +21,7 @@
*/
package org.jboss.bpm.console.server.dao.internal;
-import org.jboss.bpm.console.client.model.TaskReference;
+import org.jboss.bpm.console.client.model.TaskRef;
import org.jboss.bpm.console.server.dao.TaskManagement;
import java.util.ArrayList;
@@ -40,13 +40,13 @@
this.delegate = new JBPM3CommandDelegate();
}
- public List<TaskReference> getTasksByActor(String actorName)
+ public List<TaskRef> getTasksByActor(String actorName)
{
List<org.jbpm.taskmgmt.exe.TaskInstance> actualTasks =
delegate.getActualTasksForActor(actorName);
- List<TaskReference> taskRefs = new ArrayList<TaskReference>();
+ List<TaskRef> taskRefs = new ArrayList<TaskRef>();
for(org.jbpm.taskmgmt.exe.TaskInstance t0 : actualTasks)
{
taskRefs.add( Transform.taskInstance(t0));
@@ -55,10 +55,10 @@
return taskRefs;
}
- public TaskReference getTaskById(long taskId)
+ public TaskRef getTaskById(long taskId)
{
org.jbpm.taskmgmt.exe.TaskInstance t0 = delegate.getTaskById(taskId);
- TaskReference taskRef = Transform.taskInstance(t0);
+ TaskRef taskRef = Transform.taskInstance(t0);
return taskRef;
}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/Transform.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/Transform.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/dao/internal/Transform.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -21,9 +21,9 @@
*/
package org.jboss.bpm.console.server.dao.internal;
-import org.jboss.bpm.console.client.model.ProcessDefinition;
-import org.jboss.bpm.console.client.model.ProcessInstance;
-import org.jboss.bpm.console.client.model.TaskReference;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
+import org.jboss.bpm.console.client.model.TaskRef;
import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
import org.jbpm.graph.def.Transition;
import org.jbpm.graph.exe.Token;
@@ -39,19 +39,19 @@
*/
class Transform
{
- public static ProcessDefinition processDefinition(org.jbpm.graph.def.ProcessDefinition p0)
+ public static ProcessDefinitionRef processDefinition(org.jbpm.graph.def.ProcessDefinition p0)
{
- return new ProcessDefinition(p0.getId(), p0.getName(), String.valueOf(p0.getVersion()));
+ return new ProcessDefinitionRef(p0.getId(), p0.getName(), String.valueOf(p0.getVersion()));
}
- public static ProcessInstance processInstance(org.jbpm.graph.exe.ProcessInstance i0)
+ public static ProcessInstanceRef processInstance(org.jbpm.graph.exe.ProcessInstance i0)
{
Date start = i0.getStart();
Date end = i0.getEnd();
boolean suspended = i0.isSuspended();
long processId = i0.getProcessDefinition().getId();
long instanceId = i0.getId();
- ProcessInstance processInstance = new ProcessInstance(instanceId, processId, start, end, suspended);
+ ProcessInstanceRef processInstance = new ProcessInstanceRef(instanceId, processId, start, end, suspended);
// token
Token t0 = i0.getRootToken();
@@ -88,7 +88,7 @@
public static void doTransition(org.jbpm.graph.exe.ProcessInstance p0, String nextState)
{
- ProcessInstance instance = Transform.processInstance(p0);
+ ProcessInstanceRef instance = Transform.processInstance(p0);
instance.setState(nextState); // has lifecycle build in, hence the extra round
switch(instance.getState())
@@ -107,9 +107,9 @@
}
- public static TaskReference taskInstance(org.jbpm.taskmgmt.exe.TaskInstance t0)
+ public static TaskRef taskInstance(org.jbpm.taskmgmt.exe.TaskInstance t0)
{
- TaskReference taskRef = new TaskReference(
+ TaskRef taskRef = new TaskRef(
t0.getId(),
t0.getToken().getId(),
t0.getProcessInstance().getId(),
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -23,7 +23,7 @@
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.http.client.URL;
-import org.jboss.bpm.console.client.model.ProcessInstance;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
/**
@@ -100,7 +100,7 @@
return getBaseUrl() + "/rs/jbpm3/instances/" + instanceId + "/activeNodeInfo";
}
- public String getStateChangeURL(long instanceId, ProcessInstance.STATE state)
+ public String getStateChangeURL(long instanceId, ProcessInstanceRef.STATE state)
{
return getBaseUrl() + "/rs/process/instances/" + instanceId + "/state/"+state;
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricEditor.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricEditor.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -25,7 +25,7 @@
import org.jboss.bpm.console.client.UIConstants;
import org.jboss.bpm.console.client.widgets.TeaserPanel;
import org.jboss.bpm.console.client.widgets.HelpPanel;
-import org.jboss.bpm.console.client.model.ProcessDefinition;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.process.ProcessInstanceEditor;
import org.jboss.bpm.console.client.process.ProcessInstanceListEditor;
@@ -44,11 +44,11 @@
public class DefinitionMetricEditor extends Editor
{
- private ProcessDefinition parent;
+ private ProcessDefinitionRef parent;
private MainView view;
private Panel teaserPanel;
- public DefinitionMetricEditor(final MainView view, final ProcessDefinition proc)
+ public DefinitionMetricEditor(final MainView view, final ProcessDefinitionRef proc)
{
super();
this.view = view;
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricView.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricView.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricView.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -29,7 +29,7 @@
import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.UIConstants;
import org.jboss.bpm.console.client.model.DAOFactory;
-import org.jboss.bpm.console.client.model.ProcessDefinition;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.client.model.ProcessInstancePerformance;
import org.jboss.bpm.console.client.widgets.LineChart;
@@ -41,11 +41,11 @@
*/
public class DefinitionMetricView extends Panel
{
- private ProcessDefinition parent;
+ private ProcessDefinitionRef parent;
private MainView view;
- public DefinitionMetricView(MainView view, ProcessDefinition parent)
+ public DefinitionMetricView(MainView view, ProcessDefinitionRef parent)
{
super();
this.view = view;
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverview.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverview.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverview.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -35,7 +35,7 @@
import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.UIConstants;
import org.jboss.bpm.console.client.model.DAOFactory;
-import org.jboss.bpm.console.client.model.ProcessDefinition;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.client.model.ProcessDefinitionDAO;
import org.jboss.bpm.console.client.widgets.BarChart;
@@ -138,7 +138,7 @@
{
if(currentSelection!=-1)
{
- ProcessDefinition def = (ProcessDefinition)row2ProcessMap.get(new Integer(currentSelection));
+ ProcessDefinitionRef def = (ProcessDefinitionRef)row2ProcessMap.get(new Integer(currentSelection));
String editorId = MetricOverviewEditor.ID+"."+def.getName();
if(view.hasEditor(editorId))
@@ -183,7 +183,7 @@
int row = 0;
while(it.hasNext())
{
- ProcessDefinition pd = (ProcessDefinition)it.next();
+ ProcessDefinitionRef pd = (ProcessDefinitionRef)it.next();
records[row] = new Object[3];
records[row][0] = new Long(pd.getProcessId());
records[row][1] = pd.getName();
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -64,9 +64,9 @@
return roles;
}
- public static List<TaskReference> parseTaskReferenceList(String json)
+ public static List<TaskRef> parseTaskReferenceList(String json)
{
- List<TaskReference> results = new ArrayList<TaskReference>();
+ List<TaskRef> results = new ArrayList<TaskRef>();
// {"tasks":[{"id":14,"name":"manager evaluation","isSignalling":true,
// "isBlocking":false,"tokenId":6,"processInstanceId":4,"actor":"manager",
@@ -78,14 +78,14 @@
for (int i = 0; i < array.size(); ++i)
{
JSONObject item = array.get(i).isObject();
- TaskReference ref = parseTaskReference(item);
+ TaskRef ref = parseTaskReference(item);
results.add(ref);
}
return results;
}
- public static TaskReference parseTaskReference(JSONObject item)
+ public static TaskRef parseTaskReference(JSONObject item)
{
long id = JSONWalk.on(item).next("id").asLong();
@@ -97,7 +97,7 @@
boolean isBlocking = JSONWalk.on(item).next("isBlocking").asBool();
boolean isSignalling = JSONWalk.on(item).next("isSignalling").asBool();
- TaskReference ref = new TaskReference(
+ TaskRef ref = new TaskRef(
id, tokenId, instanceId,
processId,
name, actor,
@@ -180,7 +180,7 @@
return formDef;
}
- public static ProcessInstance parseProcessInstance(JSONObject root)
+ public static ProcessInstanceRef parseProcessInstance(JSONObject root)
{
Log.debug("parse " + root);
@@ -195,7 +195,7 @@
boolean suspended = JSONWalk.on(root).next("suspended").asBool();
- ProcessInstance processInstance = new ProcessInstance(
+ ProcessInstanceRef processInstance = new ProcessInstanceRef(
id, parentId,
start, end,
suspended
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionDAO.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionDAO.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionDAO.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -31,5 +31,5 @@
{
List getAllProcessDefinitions();
- ProcessDefinition getProcessDefinitionById(long id);
+ ProcessDefinitionRef getProcessDefinitionById(long id);
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/internal/MockMetricsDAO.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/internal/MockMetricsDAO.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/internal/MockMetricsDAO.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -37,7 +37,7 @@
public ProcessInstancePerformance getProcessInstancePerformance(long processId)
{
- ProcessDefinition pd = DAOFactory.createProcessDefinitionDAO().getProcessDefinitionById(processId);
+ ProcessDefinitionRef pd = DAOFactory.createProcessDefinitionDAO().getProcessDefinitionById(processId);
ProcessInstancePerformance performance = new ProcessInstancePerformance(
pd.getProcessId(), pd.getName(), generateInstanceMetrics(processId)
@@ -53,7 +53,7 @@
Map metrics = new HashMap();
for(int i=0; i<instances.size(); i++)
{
- ProcessInstance pi = (ProcessInstance)instances.get(i);
+ ProcessInstanceRef pi = (ProcessInstanceRef)instances.get(i);
metrics.put( new Long(pi.getInstanceId()) , new Double(Math.random()* MAX_EXEC_TIME) );
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/internal/MockProcessDefinitionDAO.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/internal/MockProcessDefinitionDAO.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/internal/MockProcessDefinitionDAO.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -22,7 +22,7 @@
package org.jboss.bpm.console.client.model.internal;
import org.jboss.bpm.console.client.model.ProcessDefinitionDAO;
-import org.jboss.bpm.console.client.model.ProcessDefinition;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import java.util.ArrayList;
import java.util.List;
@@ -35,14 +35,14 @@
public final static List defs = new ArrayList();
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 ProcessDefinitionRef(1, "OrderProcess", "1"));
+ defs.add( new ProcessDefinitionRef(2, "VacationManagement", "1"));
+ defs.add( new ProcessDefinitionRef(3, "New Employee walkthrough", "1"));
+ defs.add( new ProcessDefinitionRef(4, "Source code review", "2"));
+ defs.add( new ProcessDefinitionRef(5, "Loan application", "1"));
+ defs.add( new ProcessDefinitionRef(6, "Expense report review", "4"));
+ defs.add( new ProcessDefinitionRef(7, "Expense claim", "4"));
+ defs.add( new ProcessDefinitionRef(8, "Credit approval", "4"));
}
@@ -51,12 +51,12 @@
return defs;
}
- public ProcessDefinition getProcessDefinitionById(long id)
+ public ProcessDefinitionRef getProcessDefinitionById(long id)
{
- ProcessDefinition result = null;
+ ProcessDefinitionRef result = null;
for(int i=0; i<defs.size(); i++)
{
- ProcessDefinition pd = (ProcessDefinition)defs.get(i);
+ ProcessDefinitionRef pd = (ProcessDefinitionRef)defs.get(i);
if(pd.getProcessId() == id)
{
result = pd;
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/internal/MockProcessInstanceDAO.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/internal/MockProcessInstanceDAO.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/internal/MockProcessInstanceDAO.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -21,7 +21,7 @@
*/
package org.jboss.bpm.console.client.model.internal;
-import org.jboss.bpm.console.client.model.ProcessInstance;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.client.model.ProcessInstanceDAO;
import java.util.ArrayList;
@@ -37,12 +37,12 @@
final static List instances = new ArrayList();
static
{
- instances.add( new ProcessInstance(2, -1, new Date(), null, false));
- instances.add( new ProcessInstance(3, -1, new Date(System.currentTimeMillis()-(1000*60*120)), new Date(System.currentTimeMillis()-(1000*60*12)), false));
- instances.add( new ProcessInstance(4, -1, new Date(System.currentTimeMillis()-(1000*60*60)), new Date(System.currentTimeMillis()-(1000*60*24)), false));
- instances.add( new ProcessInstance(5, -1, new Date(System.currentTimeMillis()-(1000*60*90)), new Date(System.currentTimeMillis()-(1000*60*17)), false));
- instances.add( new ProcessInstance(6, -1, new Date(), null, false));
- instances.add( new ProcessInstance(7, -1, new Date(), null, false));
+ instances.add( new ProcessInstanceRef(2, -1, new Date(), null, false));
+ instances.add( new ProcessInstanceRef(3, -1, new Date(System.currentTimeMillis()-(1000*60*120)), new Date(System.currentTimeMillis()-(1000*60*12)), false));
+ instances.add( new ProcessInstanceRef(4, -1, new Date(System.currentTimeMillis()-(1000*60*60)), new Date(System.currentTimeMillis()-(1000*60*24)), false));
+ instances.add( new ProcessInstanceRef(5, -1, new Date(System.currentTimeMillis()-(1000*60*90)), new Date(System.currentTimeMillis()-(1000*60*17)), false));
+ instances.add( new ProcessInstanceRef(6, -1, new Date(), null, false));
+ instances.add( new ProcessInstanceRef(7, -1, new Date(), null, false));
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -25,13 +25,11 @@
import com.gwtext.client.data.*;
import com.gwtext.client.widgets.MessageBox;
import com.gwtext.client.widgets.MessageBoxConfig;
-import com.gwtext.client.widgets.Component;
-import com.gwtext.client.widgets.event.PanelListenerAdapter;
import com.gwtext.client.widgets.grid.ColumnConfig;
import com.gwtext.client.widgets.grid.ColumnModel;
import com.allen_sauer.gwt.log.client.Log;
import org.jboss.bpm.console.client.MainView;
-import org.jboss.bpm.console.client.model.ProcessDefinition;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.client.widgets.RemoteListView;
import java.util.*;
@@ -41,7 +39,7 @@
*/
public class ProcessDefinitionList extends RemoteListView
{
- private Map<Integer, ProcessDefinition> row2ProcessMap = new HashMap<Integer,ProcessDefinition>();
+ private Map<Integer, ProcessDefinitionRef> row2ProcessMap = new HashMap<Integer, ProcessDefinitionRef>();
public ProcessDefinitionList(String titleName, final MainView view)
{
@@ -86,7 +84,7 @@
protected void onExamine(int row)
{
- ProcessDefinition proc = row2ProcessMap.get(row);
+ ProcessDefinitionRef proc = row2ProcessMap.get(row);
String editorId = ProcessInstanceEditor.createWidgetID(proc);
if(view.hasEditor(editorId))
@@ -108,7 +106,7 @@
{
if("yes".equals( btnID) )
{
- ProcessDefinition proc = (ProcessDefinition)row2ProcessMap.get(row);
+ ProcessDefinitionRef proc = (ProcessDefinitionRef)row2ProcessMap.get(row);
String url = view.getUrlBuilder().getRemoveDefinitionURL(proc.getProcessId());
RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, url);
@@ -154,7 +152,7 @@
for(Record r : records)
{
Long id = Long.valueOf(r.getAsString("processId"));
- ProcessDefinition pd = new ProcessDefinition(
+ ProcessDefinitionRef pd = new ProcessDefinitionRef(
id,
r.getAsString("name"),
r.getAsString("version")
@@ -167,9 +165,9 @@
Log.debug("Loaded " + row2ProcessMap.size() + " process definitions");
}
- public List<ProcessDefinition> getAvailableProcessDefinitions()
+ public List<ProcessDefinitionRef> getAvailableProcessDefinitions()
{
- List<ProcessDefinition> results = new ArrayList<ProcessDefinition>();
+ List<ProcessDefinitionRef> results = new ArrayList<ProcessDefinitionRef>();
Iterator<Integer> keys = row2ProcessMap.keySet().iterator();
while(keys.hasNext())
{
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessImageView.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessImageView.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessImageView.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -29,7 +29,7 @@
import com.gwtext.client.widgets.event.PanelListenerAdapter;
import com.allen_sauer.gwt.log.client.Log;
import org.jboss.bpm.console.client.MainView;
-import org.jboss.bpm.console.client.model.ProcessInstance;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.client.model.jbpm3.ActiveNodeInfo;
import org.jboss.bpm.console.client.model.jbpm3.DiagramNodeInfo;
import org.jboss.bpm.console.client.util.JSONRequest;
@@ -49,11 +49,11 @@
*/
public class ProcessImageView extends Panel
{
- private ProcessInstance instance;
+ private ProcessInstanceRef instance;
private MainView view;
private ActiveNodeInfo activeNodeInfo = null;
- public ProcessImageView(final ProcessInstance instance, final MainView view)
+ public ProcessImageView(final ProcessInstanceRef instance, final MainView view)
{
super();
this.instance = instance;
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceEditor.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceEditor.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -29,8 +29,8 @@
import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.Editor;
import org.jboss.bpm.console.client.UIConstants;
-import org.jboss.bpm.console.client.model.ProcessDefinition;
-import org.jboss.bpm.console.client.model.ProcessInstance;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.client.widgets.TeaserPanel;
import org.jboss.bpm.console.client.widgets.HelpPanel;
@@ -43,15 +43,15 @@
{
public final static String ID = "org.jboss.bpm.process.ProcessInstance";
- private ProcessDefinition processDefinition;
+ private ProcessDefinitionRef processDefinition;
- private ProcessInstance processInstance;
+ private ProcessInstanceRef processInstance;
private MainView view;
private Panel teaserPanel;
- public ProcessInstanceEditor(final ProcessDefinition proc, final ProcessInstance instance, final MainView view)
+ public ProcessInstanceEditor(final ProcessDefinitionRef proc, final ProcessInstanceRef instance, final MainView view)
{
super();
this.setId(ProcessInstanceEditor.ID+"."+instance.getInstanceId());
@@ -170,7 +170,7 @@
return "bpm-instance-icon";
}
- public static String createWidgetID(ProcessDefinition parent)
+ public static String createWidgetID(ProcessDefinitionRef parent)
{
return ProcessInstanceEditor.ID+"."+parent.getName()+"."+parent.getVersion();
}
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-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -32,8 +32,8 @@
import com.allen_sauer.gwt.log.client.Log;
import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.util.DateRenderer;
-import org.jboss.bpm.console.client.model.ProcessDefinition;
-import org.jboss.bpm.console.client.model.ProcessInstance;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.client.model.DTOParser;
import org.jboss.bpm.console.client.widgets.RemoteListView;
@@ -46,24 +46,24 @@
public class ProcessInstanceList extends RemoteListView
{
- private Map<Integer, ProcessInstance> row2InstanceMap = new HashMap<Integer, ProcessInstance>();
- private ProcessDefinition parent;
+ private Map<Integer, ProcessInstanceRef> row2InstanceMap = new HashMap<Integer, ProcessInstanceRef>();
+ private ProcessDefinitionRef parent;
private static final String DATE_FORMAT = "yyyy-m-j H:i:s"; //08-10-02 13:51:27
- public ProcessInstanceList(ProcessDefinition procDef, String titleName, MainView view)
+ public ProcessInstanceList(ProcessDefinitionRef procDef, String titleName, MainView view)
{
super(titleName, view, getResourceUrl(view, procDef.getProcessId()));
this.parent = procDef;
}
- ProcessDefinition getProcessDefinition()
+ ProcessDefinitionRef getProcessDefinition()
{
return parent;
}
protected void onExamine(final int row)
{
- ProcessInstance instance = row2InstanceMap.get(row);
+ ProcessInstanceRef instance = row2InstanceMap.get(row);
String id = ProcessInstanceEditor.ID+"."+instance.getInstanceId();
if(view.hasEditor(id))
view.showEditor(id);
@@ -83,8 +83,8 @@
{
if("yes".equals( btnID) )
{
- ProcessInstance instance = row2InstanceMap.get(row);
- instance.setState(ProcessInstance.STATE.ENDED);
+ ProcessInstanceRef instance = row2InstanceMap.get(row);
+ instance.setState(ProcessInstanceRef.STATE.ENDED);
String url = view.getUrlBuilder().getStateChangeURL(instance.getInstanceId(), instance.getState());
RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, url);
@@ -166,7 +166,7 @@
int i = 0;
for(Record r : records)
{
- ProcessInstance pd = transform(r);
+ ProcessInstanceRef pd = transform(r);
row2InstanceMap.put(i, pd);
i++;
}
@@ -174,9 +174,9 @@
Log.debug("Loaded " + row2InstanceMap.size() + " records");
}
- public static ProcessInstance transform(Record r)
+ public static ProcessInstanceRef transform(Record r)
{
- ProcessInstance processInstance = null;
+ ProcessInstanceRef processInstance = null;
try
{
JavaScriptObject js = r.getDataAsJsObject();
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -40,8 +40,8 @@
import org.jboss.bpm.console.client.Editor;
import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.UIConstants;
-import org.jboss.bpm.console.client.model.ProcessDefinition;
-import org.jboss.bpm.console.client.model.ProcessInstance;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
import org.jboss.bpm.console.client.widgets.*;
@@ -53,17 +53,17 @@
public class ProcessInstanceListEditor extends Editor
{
private MainView view;
- private ProcessDefinition parent;
+ private ProcessDefinitionRef parent;
private ProcessInstanceList instanceList;
private FormPanel detailsForm;
private Panel tokenEditorPanel;
- private ProcessInstance selectedInstance;
+ private ProcessInstanceRef selectedInstance;
private TokenEditor currentTokenEditor;
private TabPanel tabPanel;
- public ProcessInstanceListEditor(ProcessDefinition proc, MainView view)
+ public ProcessInstanceListEditor(ProcessDefinitionRef proc, MainView view)
{
super();
@@ -157,7 +157,7 @@
{
public void onClick(Button button, EventObject eventObject)
{
- selectedInstance.setState(ProcessInstance.STATE.SUSPENDED);
+ selectedInstance.setState(ProcessInstanceRef.STATE.SUSPENDED);
persistStateChange();
}
}
@@ -169,7 +169,7 @@
public void onClick(Button button, EventObject eventObject)
{
- selectedInstance.setState(ProcessInstance.STATE.RUNNING);
+ selectedInstance.setState(ProcessInstanceRef.STATE.RUNNING);
persistStateChange();
}
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/TokenEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/TokenEditor.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/TokenEditor.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -29,7 +29,7 @@
import com.gwtext.client.widgets.tree.TreeNode;
import com.gwtext.client.widgets.tree.TreePanel;
import com.gwtext.client.widgets.tree.event.TreeNodeListenerAdapter;
-import org.jboss.bpm.console.client.model.ProcessInstance;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
/**
@@ -41,7 +41,7 @@
private TokenForm tokenForm;
private TokenTree tokenTree;
- public TokenEditor(final ProcessInstance instance, final SignalCallback callback)
+ public TokenEditor(final ProcessInstanceRef instance, final SignalCallback callback)
{
super();
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/TokenForm.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/TokenForm.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/TokenForm.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -33,7 +33,7 @@
import com.gwtext.client.widgets.form.TextField;
import org.jboss.bpm.console.client.UIConstants;
import org.jboss.bpm.console.client.widgets.RefreshableComboBox;
-import org.jboss.bpm.console.client.model.ProcessInstance;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
/**
@@ -106,7 +106,7 @@
/**
* display the root token
*/
- void display(ProcessInstance processInstance)
+ void display(ProcessInstanceRef processInstance)
{
display(processInstance, processInstance.getRootToken());
}
@@ -114,7 +114,7 @@
/**
* display a particular token
*/
- void display(final ProcessInstance processInstance, final TokenReference tok)
+ void display(final ProcessInstanceRef processInstance, final TokenReference tok)
{
Form form = tokenForm.getForm();
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentFormPanel.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentFormPanel.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentFormPanel.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -34,7 +34,7 @@
import com.gwtext.client.widgets.form.FormPanel;
import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.model.DTOParser;
-import org.jboss.bpm.console.client.model.TaskReference;
+import org.jboss.bpm.console.client.model.TaskRef;
import org.jboss.bpm.console.client.widgets.FormWidgets;
import org.jboss.bpm.console.client.widgets.ModelChangeListener;
import org.jboss.bpm.console.client.widgets.ModelListenerRegistry;
@@ -55,7 +55,7 @@
private AssignmentCallback callback;
private List<String> availableActors;
- private TaskReference selectedInstance;
+ private TaskRef selectedInstance;
public AssignmentFormPanel(MainView mainView, AssignmentCallback callback)
{
@@ -118,7 +118,7 @@
public void onModelChange(ModelListenerRegistry parent, Object changeEvent)
{
TaskListEditor editor = (TaskListEditor)parent.getUnderlying();
- selectedInstance= (TaskReference)changeEvent;
+ selectedInstance= (TaskRef)changeEvent;
availableActors = null;
boolean hasPooledActors = selectedInstance.getPooledActors().size()>0;
@@ -128,7 +128,7 @@
availableActors = selectedInstance.getPooledActors();
}
else if(!hasPooledActors &&
- TaskReference.STATE.ASSIGNED ==selectedInstance.getCurrentState())
+ TaskRef.STATE.ASSIGNED ==selectedInstance.getCurrentState())
{
// no pooled actors but an assigned actor
loadActors();
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskDetailsFormPanel.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskDetailsFormPanel.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskDetailsFormPanel.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -35,7 +35,7 @@
import com.gwtext.client.widgets.form.TextField;
import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.UIConstants;
-import org.jboss.bpm.console.client.model.TaskReference;
+import org.jboss.bpm.console.client.model.TaskRef;
import org.jboss.bpm.console.client.widgets.FormWidgets;
import org.jboss.bpm.console.client.widgets.ModelChangeListener;
import org.jboss.bpm.console.client.widgets.ModelListenerRegistry;
@@ -48,7 +48,7 @@
{
private FormPanel formPanel;
- private TaskReference selectedInstance;
+ private TaskRef selectedInstance;
private MainView mainView;
private Button startBtn;
@@ -242,7 +242,7 @@
startBtn.disable();
stopBtn.disable();
}
- else if(TaskReference.STATE.ASSIGNED == selectedInstance.getCurrentState())
+ else if(TaskRef.STATE.ASSIGNED == selectedInstance.getCurrentState())
{
startBtn.disable();
stopBtn.enable();
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskList.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskList.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskList.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -30,18 +30,13 @@
import com.gwtext.client.data.*;
import com.gwtext.client.data.event.StoreListenerAdapter;
import com.gwtext.client.widgets.*;
-import com.gwtext.client.widgets.event.ButtonListenerAdapter;
import com.gwtext.client.widgets.event.PanelListenerAdapter;
-import com.gwtext.client.widgets.form.*;
import com.gwtext.client.widgets.grid.*;
import com.gwtext.client.widgets.grid.event.GridCellListener;
import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.UIConstants;
import org.jboss.bpm.console.client.model.DTOParser;
-import org.jboss.bpm.console.client.model.TaskReference;
-import org.jboss.bpm.console.client.model.forms.FormDef;
-import org.jboss.bpm.console.client.util.JSONRequest;
-import org.jboss.bpm.console.client.util.JSONRequestHandler;
+import org.jboss.bpm.console.client.model.TaskRef;
import java.util.HashMap;
import java.util.Map;
@@ -51,7 +46,7 @@
*/
public class TaskList extends Panel
{
- private Map<Integer,TaskReference> row2taskref = new HashMap<Integer,TaskReference>();
+ private Map<Integer, TaskRef> row2taskref = new HashMap<Integer, TaskRef>();
private MainView mainView;
private GridPanel grid;
private GroupingStore store;
@@ -105,7 +100,7 @@
int i=0;
for(Record r : records)
{
- TaskReference ref = transform(r);
+ TaskRef ref = transform(r);
row2taskref.put(i, ref);
i++;
}
@@ -118,11 +113,11 @@
Log.debug("Loaded " + row2taskref.size() + " tasks");
}
- public static TaskReference transform(Record r)
+ public static TaskRef transform(Record r)
{
JavaScriptObject js = r.getDataAsJsObject();
JSONObject jso = new JSONObject(js);
- TaskReference ref = DTOParser.parseTaskReference(jso);
+ TaskRef ref = DTOParser.parseTaskReference(jso);
return ref;
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskListEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskListEditor.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskListEditor.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -34,7 +34,7 @@
import org.jboss.bpm.console.client.Editor;
import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.UIConstants;
-import org.jboss.bpm.console.client.model.TaskReference;
+import org.jboss.bpm.console.client.model.TaskRef;
import org.jboss.bpm.console.client.widgets.ModelChangeListener;
import org.jboss.bpm.console.client.widgets.ModelListenerRegistry;
import org.jboss.bpm.console.client.widgets.TeaserPanel;
@@ -124,7 +124,7 @@
{
public void onRowSelect(RowSelectionModel sm, int rowIndex, Record record)
{
- TaskReference taskRef = TaskList.transform(record);
+ TaskRef taskRef = TaskList.transform(record);
modelListeners.fireRecordChangeEvent(record);
modelListeners.fireModelChangeEvent(taskRef);
}
Modified: projects/gwt-console/trunk/war/src/main/resources/org/jboss/bpm/console/public/Application.html
===================================================================
--- projects/gwt-console/trunk/war/src/main/resources/org/jboss/bpm/console/public/Application.html 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/war/src/main/resources/org/jboss/bpm/console/public/Application.html 2008-11-21 10:30:25 UTC (rev 3020)
@@ -8,6 +8,7 @@
<!-- -->
<script language='javascript'
src='org.jboss.bpm.console.Application.nocache.js'></script>
+ <meta name="gwt:property" id="bpm-server-url" content="localhost:8080"/>
<link rel="stylesheet" href="console.css" type="text/css">
</head>
Modified: projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/GwtTestDTOParser.java
===================================================================
--- projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/GwtTestDTOParser.java 2008-11-21 10:10:35 UTC (rev 3019)
+++ projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/GwtTestDTOParser.java 2008-11-21 10:30:25 UTC (rev 3020)
@@ -23,7 +23,7 @@
import com.google.gwt.junit.client.GWTTestCase;
import org.jboss.bpm.console.client.model.DTOParser;
-import org.jboss.bpm.console.client.model.TaskReference;
+import org.jboss.bpm.console.client.model.TaskRef;
import org.jboss.bpm.console.client.model.forms.FormDef;
import java.util.List;
@@ -47,7 +47,7 @@
public void testTaskRefParsing()
{
String json = "{\"tasks\":[{\"id\":14,\"tokenId\":6,\"processInstanceId\":4,\"processId\":2,\"name\":\"manager evaluation\",\"actor\":\"manager\",\"isBlocking\":false,\"isSignalling\":true,\"transitionNames\":[\"reject\",\"approve\"],\"pooledActors\":[\"hr\",\"sales\"]}]}";
- List<TaskReference> result = DTOParser.parseTaskReferenceList(json);
+ List<TaskRef> result = DTOParser.parseTaskReferenceList(json);
assertTrue("Failed to parse TaskReferenceList", result.size()==1);
assertTrue("Failed to parse transitionNames", result.get(0).getTransitionNames().size()==2);
assertFalse("Failed to parse pooledActors", result.get(0).getPooledActors().isEmpty());
17 years, 5 months
JBoss JBPM SVN: r3019 - jbpm3/branches.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-21 05:10:35 -0500 (Fri, 21 Nov 2008)
New Revision: 3019
Added:
jbpm3/branches/jpdl-3.2.2-SOA-4.2/
Log:
Recreate jpdl-3.2.2-SOA-4.2 from jbpm-3.3.0.GA
Copied: jbpm3/branches/jpdl-3.2.2-SOA-4.2 (from rev 3018, jbpm3/tags/jbpm-3.3.0.GA)
17 years, 5 months
JBoss JBPM SVN: r3018 - jbpm3/branches.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-21 05:10:03 -0500 (Fri, 21 Nov 2008)
New Revision: 3018
Removed:
jbpm3/branches/jpdl-3.2.2-SOA-4.2/
Log:
Recreate jpdl-3.2.2-SOA-4.2 from jbpm-3.3.0.GA
17 years, 5 months
JBoss JBPM SVN: r3017 - in jbpm4/trunk: modules/api/src/main/java/org/jbpm and 8 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-11-20 15:44:23 -0500 (Thu, 20 Nov 2008)
New Revision: 3017
Added:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessDefinitionCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessInstance.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessInstanceStoppedSynchronization.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/ProcessTest.java
Modified:
jbpm4/trunk/build.xml
jbpm4/trunk/modules/api/src/main/java/org/jbpm/Deployment.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessService.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/session/PvmDbSession.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DeploymentImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/resources/org/jbpm/pvm/hibernate.execution.hbm.xml
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/Db.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/StateTest.java
Log:
added db test infrastructure
Modified: jbpm4/trunk/build.xml
===================================================================
--- jbpm4/trunk/build.xml 2008-11-20 15:46:29 UTC (rev 3016)
+++ jbpm4/trunk/build.xml 2008-11-20 20:44:23 UTC (rev 3017)
@@ -31,11 +31,11 @@
</target>
<target name="javadoc">
- <exec executable="cmd" os="Windows Vista, Windows XP,Windows 2000,Windows 98">
+ <exec executable="cmd" dir="modules/api" os="Windows Vista, Windows XP,Windows 2000,Windows 98">
<arg line="/C mvn javadoc:javadoc" />
</exec>
<antcall target="show.html">
- <param name="page" value="modules/pvm/target/site/apidocs/index.html"/>
+ <param name="page" value="modules/api/target/site/apidocs/index.html"/>
</antcall>
</target>
@@ -57,12 +57,12 @@
</antcall>
</target>
- <target name="wirexsddoc">
- <exec executable="cmd">
- <arg line="/C mvn ?" />
+ <target name="jpdlxsddoc">
+ <exec executable="cmd" dir="modules/jpdl">
+ <arg line="/C mvn package" />
</exec>
<antcall target="show.html">
- <param name="page" value="modules/core/target/site/apidocs/index.html"/>
+ <param name="page" value="modules/jpdl/target/doc/jpdlxsd/index.html"/>
</antcall>
</target>
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/Deployment.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/Deployment.java 2008-11-20 15:46:29 UTC (rev 3016)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/Deployment.java 2008-11-20 20:44:23 UTC (rev 3017)
@@ -25,6 +25,7 @@
import java.io.InputStream;
import java.io.Serializable;
import java.net.URL;
+import java.util.List;
import java.util.zip.ZipInputStream;
@@ -54,5 +55,5 @@
Deployment addDirectory(File directory);
Deployment addDirectoryCanonical(File directory);
- void deploy();
+ List<ProcessDefinition> deploy();
}
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java 2008-11-20 15:46:29 UTC (rev 3016)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java 2008-11-20 20:44:23 UTC (rev 3017)
@@ -123,4 +123,7 @@
/** retrieves a map of variables */
Map<String, Object> getVariables(String executionId, List<String> variableNames);
+
+ /* delete a process instance */
+ void deleteProcessInstance(String processInstanceId);
}
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessService.java 2008-11-20 15:46:29 UTC (rev 3016)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessService.java 2008-11-20 20:44:23 UTC (rev 3017)
@@ -30,10 +30,11 @@
*/
public interface ProcessService {
+ /** start a deployment */
Deployment createDeployment();
- /** deploy a new process definition into the process repository. */
- ProcessDefinition deploy(Deployment deployment);
+ /** TODO REMOVE: deploy a new process definition into the process repository. */
+ List<ProcessDefinition> deploy(Deployment deployment);
/** all deployed process names. */
List<String> findProcessDefinitionNames();
@@ -47,4 +48,10 @@
/** specific version of a named processDefinition. */
ProcessDefinition findProcessDefinition(String processDefinitionName, int processDefinitionVersion);
+ /** deletes process definition if there are no existing executions.
+ * @throws JbpmException if there are existing executions. */
+ void deleteProcessDefinition(String processDefinitionId);
+
+ /** deletes process definition and the existing executions. */
+ void deleteProcessDefinitionAndInstances(String processDefinitionId);
}
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/session/PvmDbSession.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/session/PvmDbSession.java 2008-11-20 15:46:29 UTC (rev 3016)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/session/PvmDbSession.java 2008-11-20 20:44:23 UTC (rev 3017)
@@ -67,4 +67,10 @@
/** the jobs for which all the retries have failed and which will not be
* picked up any more by the jobImpl executor */
public List<Job> findJobsWithException(int firstResult, int maxResults);
+
+ /* find ids for all process instances for a given process definition. */
+ List<String> findProcessInstanceIds(String processDefinitionId);
+
+ /** delete the process instance */
+ void deleteProcessInstance(String processInstanceId);
}
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessDefinitionCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessDefinitionCmd.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessDefinitionCmd.java 2008-11-20 20:44:23 UTC (rev 3017)
@@ -0,0 +1,66 @@
+/*
+ * 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 java.util.List;
+
+import org.jbpm.JbpmException;
+import org.jbpm.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.session.PvmDbSession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeleteProcessDefinitionCmd implements Command<Void> {
+
+ private static final long serialVersionUID = 1L;
+
+ String processDefinitionId;
+ boolean deleteProcessInstances;
+
+ public DeleteProcessDefinitionCmd(String processDefinitionId) {
+ this(processDefinitionId, false);
+ }
+
+ public DeleteProcessDefinitionCmd(String processDefinitionId, boolean deleteProcessInstances) {
+ this.deleteProcessInstances = deleteProcessInstances;
+ this.processDefinitionId = processDefinitionId;
+ }
+
+ public Void execute(Environment environment) {
+ PvmDbSession pvmDbSession = Environment.getFromCurrent(PvmDbSession.class);
+ List<String> processInstanceIds = pvmDbSession.findProcessInstanceIds(processDefinitionId);
+
+ if (deleteProcessInstances) {
+ for (String processInstanceId : processInstanceIds) {
+ pvmDbSession.deleteProcessInstance(processInstanceId);
+ }
+ } else {
+ if (processInstanceIds.size()>0) {
+ throw new JbpmException("still "+processInstanceIds.size()+" process instances for process definition "+processDefinitionId);
+ }
+ }
+ return null;
+ }
+}
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessInstance.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessInstance.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessInstance.java 2008-11-20 20:44:23 UTC (rev 3017)
@@ -0,0 +1,47 @@
+/*
+ * 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.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.session.PvmDbSession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeleteProcessInstance implements Command<Void> {
+
+ private static final long serialVersionUID = 1L;
+
+ String processInstanceId;
+
+ public DeleteProcessInstance(String processInstanceId) {
+ this.processInstanceId = processInstanceId;
+ }
+
+ public Void execute(Environment environment) throws Exception {
+ Environment.getFromCurrent(PvmDbSession.class).deleteProcessInstance(processInstanceId);
+ return null;
+ }
+
+}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java 2008-11-20 15:46:29 UTC (rev 3016)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java 2008-11-20 20:44:23 UTC (rev 3017)
@@ -21,6 +21,9 @@
*/
package org.jbpm.pvm.internal.cmd;
+import java.util.ArrayList;
+import java.util.List;
+
import org.jbpm.ProcessDefinition;
import org.jbpm.JbpmException;
import org.jbpm.cmd.Command;
@@ -31,7 +34,7 @@
/**
* @author Tom Baeyens
*/
-public class DeployCmd implements Command<ProcessDefinition> {
+public class DeployCmd implements Command<List<ProcessDefinition>> {
private static final long serialVersionUID = 1L;
@@ -41,7 +44,7 @@
this.deployment = deployment;
}
- public ProcessDefinition execute(Environment environment) throws Exception {
+ public List<ProcessDefinition> execute(Environment environment) throws Exception {
DeployerManager deployerManager = environment.get(DeployerManager.class);
if (deployerManager==null) {
throw new JbpmException("no "+DeployerManager.class.getName()+" configured");
@@ -51,13 +54,14 @@
// and handle the deployment
deployerManager.deploy(deployment);
+ List<ProcessDefinition> processDefinitions = new ArrayList<ProcessDefinition>();
for (String objectName: deployment.getObjectNames()) {
Object object = deployment.getObject(objectName);
if (object instanceof ProcessDefinition) {
- return (ProcessDefinition) object;
+ processDefinitions.add((ProcessDefinition) object);
}
}
- return null;
+ return processDefinitions;
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java 2008-11-20 15:46:29 UTC (rev 3016)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java 2008-11-20 20:44:23 UTC (rev 3017)
@@ -30,13 +30,16 @@
import org.jbpm.job.Job;
import org.jbpm.job.Message;
import org.jbpm.job.Timer;
+import org.jbpm.log.Log;
import org.jbpm.session.PvmDbSession;
/**
* @author Tom Baeyens
*/
public class HibernatePvmDbSession extends HibernateDbSession implements PvmDbSession {
-
+
+ private static final Log log = Log.getLog(HibernatePvmDbSession.class.getName());
+
public HibernatePvmDbSession() {
}
@@ -119,4 +122,17 @@
query.setMaxResults(maxResults);
return query.list();
}
+
+ public List<String> findProcessInstanceIds(String processDefinitionId) {
+ // query definition can be found at the bottom of resource org/jbpm/pvm/hibernate.job.hbm.xml
+ Query query = session.getNamedQuery("findProcessInstanceIds");
+ query.setString("processDefinitionId", processDefinitionId);
+ return query.list();
+ }
+
+ public void deleteProcessInstance(String processInstanceId) {
+ Execution processInstance = findExecutionById(processInstanceId);
+ log.debug("deleting process instance "+processInstanceId);
+ session.delete(processInstance);
+ }
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2008-11-20 15:46:29 UTC (rev 3016)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2008-11-20 20:44:23 UTC (rev 3017)
@@ -36,11 +36,13 @@
import java.util.Set;
import org.jbpm.Execution;
+import org.jbpm.ExecutionService;
import org.jbpm.JbpmException;
import org.jbpm.activity.ActivityExecution;
import org.jbpm.client.ClientProcessDefinition;
import org.jbpm.client.ClientProcessInstance;
import org.jbpm.env.Environment;
+import org.jbpm.env.Transaction;
import org.jbpm.job.Timer;
import org.jbpm.listener.EventListener;
import org.jbpm.listener.EventListenerExecution;
@@ -336,6 +338,17 @@
log.trace(toString()+" signals super process execution");
superProcessExecution.signal();
}
+
+ Environment environment = Environment.getCurrent();
+ if (environment!=null) {
+ Transaction transaction = environment.get(Transaction.class);
+ ExecutionService executionService = environment.get(ExecutionService.class);
+ if ( (transaction!=null)
+ && (executionService!=null)
+ ) {
+ transaction.registerSynchronization(new ProcessInstanceStoppedSynchronization(this.getId(), executionService));
+ }
+ }
}
}
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessInstanceStoppedSynchronization.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessInstanceStoppedSynchronization.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessInstanceStoppedSynchronization.java 2008-11-20 20:44:23 UTC (rev 3017)
@@ -0,0 +1,51 @@
+/*
+ * 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.model;
+
+import javax.transaction.Status;
+import javax.transaction.Synchronization;
+
+import org.jbpm.ExecutionService;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ProcessInstanceStoppedSynchronization implements Synchronization {
+
+ String processInstanceId;
+ ExecutionService executionService;
+
+ public ProcessInstanceStoppedSynchronization(String processInstanceId, ExecutionService executionService) {
+ this.processInstanceId = processInstanceId;
+ this.executionService = executionService;
+ }
+
+ public void afterCompletion(int status) {
+ if (status==Status.STATUS_COMMITTED) {
+ executionService.deleteProcessInstance(processInstanceId);
+ }
+ }
+
+ public void beforeCompletion() {
+ }
+}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DeploymentImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DeploymentImpl.java 2008-11-20 15:46:29 UTC (rev 3016)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DeploymentImpl.java 2008-11-20 20:44:23 UTC (rev 3017)
@@ -304,8 +304,8 @@
return this;
}
- public void deploy() {
- processServiceImpl.deploy(this);
+ public List<ProcessDefinition> deploy() {
+ return processServiceImpl.deploy(this);
}
// error logging
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java 2008-11-20 15:46:29 UTC (rev 3016)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java 2008-11-20 20:44:23 UTC (rev 3017)
@@ -28,6 +28,7 @@
import org.jbpm.Execution;
import org.jbpm.ExecutionService;
import org.jbpm.cmd.CommandService;
+import org.jbpm.pvm.internal.cmd.DeleteProcessInstance;
import org.jbpm.pvm.internal.cmd.FindExecutionCmd;
import org.jbpm.pvm.internal.cmd.GetVariablesCmd;
import org.jbpm.pvm.internal.cmd.SetVariablesCmd;
@@ -133,6 +134,10 @@
return commandService.execute(new FindExecutionCmd(executionId));
}
+ public void deleteProcessInstance(String processInstanceId) {
+ commandService.execute(new DeleteProcessInstance(processInstanceId));
+ }
+
public Object getVariable(String executionId, String variableName) {
List<String> variableNames = new ArrayList<String>();
variableNames.add(variableName);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java 2008-11-20 15:46:29 UTC (rev 3016)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java 2008-11-20 20:44:23 UTC (rev 3017)
@@ -28,6 +28,7 @@
import org.jbpm.ProcessService;
import org.jbpm.cmd.CommandService;
import org.jbpm.model.OpenProcessDefinition;
+import org.jbpm.pvm.internal.cmd.DeleteProcessDefinitionCmd;
import org.jbpm.pvm.internal.cmd.DeployCmd;
import org.jbpm.pvm.internal.cmd.FindLatestProcessDefinitionCmd;
import org.jbpm.pvm.internal.cmd.FindProcessDefinitionCmd;
@@ -43,7 +44,7 @@
protected CommandService commandService;
- public ProcessDefinition deploy(OpenProcessDefinition processDefinition) {
+ public List<ProcessDefinition> deploy(OpenProcessDefinition processDefinition) {
DeploymentImpl deploymentImpl = new DeploymentImpl(processDefinition);
return commandService.execute(new DeployCmd(deploymentImpl));
}
@@ -52,7 +53,7 @@
return new DeploymentImpl(this);
}
- public ProcessDefinition deploy(Deployment deployment) {
+ public List<ProcessDefinition> deploy(Deployment deployment) {
return commandService.execute(new DeployCmd((DeploymentImpl)deployment));
}
@@ -72,6 +73,14 @@
return (List)commandService.execute(new FindProcessDefinitionsCmd(processDefinitionName));
}
+ public void deleteProcessDefinition(String processDefinitionId) {
+ commandService.execute(new DeleteProcessDefinitionCmd(processDefinitionId));
+ }
+
+ public void deleteProcessDefinitionAndInstances(String processDefinitionId) {
+ commandService.execute(new DeleteProcessDefinitionCmd(processDefinitionId, true));
+ }
+
public CommandService getCommandService() {
return commandService;
}
Modified: jbpm4/trunk/modules/pvm/src/main/resources/org/jbpm/pvm/hibernate.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/org/jbpm/pvm/hibernate.execution.hbm.xml 2008-11-20 15:46:29 UTC (rev 3016)
+++ jbpm4/trunk/modules/pvm/src/main/resources/org/jbpm/pvm/hibernate.execution.hbm.xml 2008-11-20 20:44:23 UTC (rev 3017)
@@ -132,5 +132,15 @@
and execution.processDefinition.name = :processDefinitionName
]]>
</query>
+
+ <query name="findProcessInstanceIds">
+ <![CDATA[
+ select processInstance.id
+ from org.jbpm.pvm.internal.model.ExecutionImpl as processInstance
+ where processInstance.processDefinition.id = :processDefinitionId
+ and processInstance.parent is null
+ ]]>
+ </query>
+
</hibernate-mapping>
\ No newline at end of file
Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/Db.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/Db.java 2008-11-20 15:46:29 UTC (rev 3016)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/Db.java 2008-11-20 20:44:23 UTC (rev 3017)
@@ -35,19 +35,27 @@
import org.hibernate.mapping.Table;
import org.jbpm.ProcessEngine;
import org.jbpm.env.EnvironmentFactory;
+import org.jbpm.log.Log;
/**
* @author Tom Baeyens
*/
public class Db {
+
+ private static final Log log = Log.getLog(Db.class.getName());
+ private static final String TABLE_NAMES_KEY = "tableNames";
private static final String CLEAN_SQL_KEY = "cleanSql";
public static void clean(ProcessEngine processEngine) {
clean((EnvironmentFactory) processEngine);
}
+ public static void verifyClean(ProcessEngine processEngine) {
+ verifyClean((EnvironmentFactory) processEngine);
+ }
+
public static void clean(EnvironmentFactory environmentFactory) {
SessionFactory sessionFactory = environmentFactory.get(SessionFactory.class);
String[] cleanSql = (String[]) environmentFactory.get(CLEAN_SQL_KEY);
@@ -115,10 +123,56 @@
Session session = sessionFactory.openSession();
try {
for (String query : cleanSql) {
+ log.trace(query);
session.createSQLQuery(query).executeUpdate();
}
} finally {
session.close();
}
}
+
+ public static void verifyClean(EnvironmentFactory environmentFactory) {
+ SessionFactory sessionFactory = environmentFactory.get(SessionFactory.class);
+ String[] tableNames = (String[]) environmentFactory.get(TABLE_NAMES_KEY);
+
+ if (tableNames == null) {
+ Configuration configuration = environmentFactory.get(Configuration.class);
+
+ SessionFactoryImplementor sessionFactoryImplementor = (SessionFactoryImplementor) sessionFactory;
+ Dialect dialect = sessionFactoryImplementor.getDialect();
+
+ // loop over all foreign key constraints
+ List<String> tableNamesList = new ArrayList<String>();
+ Iterator iter = configuration.getTableMappings();
+ while (iter.hasNext()) {
+ Table table = (Table) iter.next();
+ if (table.isPhysicalTable()) {
+ tableNamesList.add(table.getName());
+ }
+ }
+
+ tableNames = (String[]) tableNamesList.toArray(new String[tableNamesList.size()]);
+
+ environmentFactory.set(TABLE_NAMES_KEY, tableNames);
+ }
+
+ boolean recordsLeft = false;
+ Session session = sessionFactory.openSession();
+ try {
+ for (String tableName : tableNames) {
+ String countSql = "select count(*) from "+tableName;
+ Integer recordCount = (Integer) session.createSQLQuery(countSql).uniqueResult();
+ if (recordCount>0) {
+ recordsLeft = true;
+ log.error("FIXME: "+recordCount+" records left in table "+tableName);
+ }
+ }
+ } finally {
+ session.close();
+ }
+
+ if (recordsLeft) {
+ clean(environmentFactory);
+ }
+ }
}
Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java 2008-11-20 15:46:29 UTC (rev 3016)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java 2008-11-20 20:44:23 UTC (rev 3017)
@@ -21,9 +21,13 @@
*/
package org.jbpm.test;
+import java.util.ArrayList;
+import java.util.List;
+
import org.jbpm.Configuration;
import org.jbpm.ExecutionService;
import org.jbpm.ManagementService;
+import org.jbpm.ProcessDefinition;
import org.jbpm.ProcessEngine;
import org.jbpm.ProcessService;
import org.jbpm.TaskService;
@@ -40,6 +44,8 @@
protected ExecutionService executionService;
protected ManagementService managementService;
protected TaskService taskService;
+
+ protected List<ProcessDefinition> processDefinitions;
public void setUp() throws Exception {
super.setUp();
@@ -67,8 +73,28 @@
}
public void tearDown() throws Exception {
- Db.clean(processEngine);
+ if (processDefinitions!=null) {
+ for (ProcessDefinition processDefinition : processDefinitions) {
+ processService.deleteProcessDefinition(processDefinition.getId());
+ }
+ }
+ Db.verifyClean(processEngine);
+
super.tearDown();
}
+
+ public void deployJpdlXmlString(String jpdlXmlString) {
+ List<ProcessDefinition> deployedProcessDefinitions =
+ processService.createDeployment()
+ .setLanguage("jpdl")
+ .addString("xmlstring.jpdl.xml", jpdlXmlString)
+ .deploy();
+
+ if (processDefinitions==null) {
+ processDefinitions = new ArrayList<ProcessDefinition>();
+ }
+
+ processDefinitions.addAll(deployedProcessDefinitions);
+ }
}
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/ProcessTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/ProcessTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/ProcessTest.java 2008-11-20 20:44:23 UTC (rev 3017)
@@ -0,0 +1,64 @@
+/*
+ * 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.test.basicfeatures;
+
+import org.jbpm.Execution;
+import org.jbpm.test.DbTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ProcessTest extends DbTestCase {
+
+ public void testMinimalProcess() {
+ deployJpdlXmlString(
+ "<process name='minimal'>" +
+ " <start>" +
+ " <flow to='end' />" +
+ " </start>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ Execution execution = executionService.startExecutionInLatest("minimal");
+
+ assertEquals("end", execution.getNodeName());
+ assertTrue(execution.isEnded());
+ assertTrue(execution.isFinished());
+ assertFalse(execution.isActive());
+ }
+
+ public void testMostMinimalProcess() {
+ deployJpdlXmlString(
+ "<process name='minimal'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ Execution execution = executionService.startExecutionInLatest("minimal");
+
+ assertTrue(execution.isEnded());
+ assertTrue(execution.isFinished());
+ assertFalse(execution.isActive());
+ }
+}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/StateTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/StateTest.java 2008-11-20 15:46:29 UTC (rev 3016)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/StateTest.java 2008-11-20 20:44:23 UTC (rev 3017)
@@ -56,13 +56,6 @@
assertEquals("d", execution.getNodeName());
assertTrue(execution.isEnded());
}
-
- public void deployJpdlXmlString(String jpdlXmlString) {
- processService.createDeployment()
- .setLanguage("jpdl")
- .addString("xmlstring.jpdl.xml", jpdlXmlString)
- .deploy();
- }
/*
public void testExternalDecision() {
17 years, 5 months
JBoss JBPM SVN: r3016 - in jbpm4/trunk/modules: test-db/src/test/java/org/jbpm/test/basicfeatures and 1 other directory.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-11-20 10:46:29 -0500 (Thu, 20 Nov 2008)
New Revision: 3016
Added:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/ConfigurationTest.java
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/Configuration.java
Log:
configuration testing
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/Configuration.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/Configuration.java 2008-11-20 15:46:13 UTC (rev 3015)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/Configuration.java 2008-11-20 15:46:29 UTC (rev 3016)
@@ -52,7 +52,7 @@
impl = instantiate(implementationClassName);
}
- public Configuration(Configuration base){
+ protected Configuration(Configuration base){
}
private synchronized String getImplementationClassName(String type) {
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/ConfigurationTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/ConfigurationTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/ConfigurationTest.java 2008-11-20 15:46:29 UTC (rev 3016)
@@ -0,0 +1,57 @@
+/*
+ * 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.test.basicfeatures;
+
+import org.jbpm.Configuration;
+import org.jbpm.ProcessEngine;
+import org.jbpm.test.JbpmTestCase;
+
+/**
+ * @author Tom Baeyens
+ */
+public class ConfigurationTest extends JbpmTestCase {
+
+ public void testMinimalConfiguration() {
+ ProcessEngine processEngine = new Configuration()
+ .setXmlString("<configuration />")
+ .buildProcessEngine();
+ assertNotNull(processEngine);
+ }
+
+ public void testConfigurationServices() {
+ ProcessEngine processEngine = new Configuration()
+ .setXmlString(
+ "<configuration>" +
+ " <environment-factory>" +
+ " <process-service />" +
+ " <execution-service />" +
+ " <management-service />" +
+ " </environment-factory>" +
+ "</configuration>"
+ )
+ .buildProcessEngine();
+ assertNotNull(processEngine);
+ assertNotNull(processEngine.getProcessService());
+ assertNotNull(processEngine.getExecutionService());
+ assertNotNull(processEngine.getManagementService());
+ }
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/ConfigurationTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
17 years, 5 months