JBoss JBPM SVN: r3105 - jbpm3/trunk/modules/integration/api/src/test/java/org/jbpm/test/integration/jpdl.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-26 12:08:16 -0500 (Wed, 26 Nov 2008)
New Revision: 3105
Modified:
jbpm3/trunk/modules/integration/api/src/test/java/org/jbpm/test/integration/jpdl/DialectHandlerTest.java
Log:
Unregister procDef on tearDown
Modified: jbpm3/trunk/modules/integration/api/src/test/java/org/jbpm/test/integration/jpdl/DialectHandlerTest.java
===================================================================
--- jbpm3/trunk/modules/integration/api/src/test/java/org/jbpm/test/integration/jpdl/DialectHandlerTest.java 2008-11-26 16:05:40 UTC (rev 3104)
+++ jbpm3/trunk/modules/integration/api/src/test/java/org/jbpm/test/integration/jpdl/DialectHandlerTest.java 2008-11-26 17:08:16 UTC (rev 3105)
@@ -32,7 +32,7 @@
import org.jbpm.api.model.ProcessDefinition;
import org.jbpm.api.model.Process.ProcessStatus;
import org.jbpm.api.service.ProcessDefinitionService;
-import org.jbpm.api.test.APITestCase;
+import org.jbpm.api.test.CTSTestCase;
/**
* Test simple jPDL process deployment
@@ -40,7 +40,7 @@
* @author thomas.diesler(a)jboss.com
* @since 24-Nov-2008
*/
-public class DialectHandlerTest extends APITestCase
+public class DialectHandlerTest extends CTSTestCase
{
public void testSimple() throws Exception
{
@@ -49,10 +49,11 @@
ProcessEngine engine = Configuration.getProcessEngine();
ProcessDefinitionService pdService = engine.getService(ProcessDefinitionService.class);
- ProcessDefinition procDef = pdService.parseProcessDefinition(pdXML);
+ ProcessDefinition procDef = unregisterOnTearDown(pdService.parseProcessDefinition(pdXML));
assertNotNull("ProcDef not null", procDef);
Process proc = procDef.newInstance();
+
Token token = proc.startProcess();
assertEquals("Node name", "a", token.getCurrentNode().getName());
@@ -64,6 +65,7 @@
token.signal();
assertEquals("Node name", "end", token.getCurrentNode().getName());
+
assertEquals(ProcessStatus.Completed, proc.getProcessStatus());
}
}
17 years, 5 months
JBoss JBPM SVN: r3104 - in jbpm3/trunk/modules/integration/api: src/main/java/org/jbpm/integration/model and 1 other directory.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-26 11:05:40 -0500 (Wed, 26 Nov 2008)
New Revision: 3104
Modified:
jbpm3/trunk/modules/integration/api/.classpath
jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/model/ProcessImpl.java
Log:
Register proc on startProcess()
Modified: jbpm3/trunk/modules/integration/api/.classpath
===================================================================
--- jbpm3/trunk/modules/integration/api/.classpath 2008-11-26 14:10:44 UTC (rev 3103)
+++ jbpm3/trunk/modules/integration/api/.classpath 2008-11-26 16:05:40 UTC (rev 3104)
@@ -3,7 +3,7 @@
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" output="target/test-classes" path="src/cts/java"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Modified: jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/model/ProcessImpl.java
===================================================================
--- jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/model/ProcessImpl.java 2008-11-26 14:10:44 UTC (rev 3103)
+++ jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/model/ProcessImpl.java 2008-11-26 16:05:40 UTC (rev 3104)
@@ -38,6 +38,7 @@
import org.jbpm.api.model.builder.ObjectNameFactory;
import org.jbpm.api.runtime.Attachments;
import org.jbpm.api.runtime.Attachments.Key;
+import org.jbpm.api.service.ProcessService;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.integration.client.TokenImpl;
@@ -148,26 +149,30 @@
}
//@Override
- public Token startProcess(Attachments ctxData)
+ public Token startProcess(Attachments contextData)
{
- setProcessStatus(ProcessStatus.Active);
oldProc = new ProcessInstance(procDef.getOldProcessDefinition());
+ // Register the Process
+ ProcessService procService = getProcessEngine().getService(ProcessService.class);
+ procService.registerProcess(this);
+
// Create the root token
Token token = new TokenImpl(this, oldProc.getRootToken());
// Initialize the context data
- if (ctxData != null)
+ if (contextData != null)
{
Attachments tokenAtt = token.getAttachments();
- for (Key key : ctxData.getAttachmentKeys())
+ for (Key key : contextData.getAttachmentKeys())
{
- Object val = ctxData.getAttachment(key.getClassPart(), key.getNamePart());
+ Object val = contextData.getAttachment(key.getClassPart(), key.getNamePart());
tokenAtt.addAttachment(key.getClassPart(), key.getNamePart(), val);
}
}
// Signal the root token
+ setProcessStatus(ProcessStatus.Active);
token.signal();
return token;
17 years, 5 months
JBoss JBPM SVN: r3103 - projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-26 09:10:44 -0500 (Wed, 26 Nov 2008)
New Revision: 3103
Modified:
projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/Attachments.java
Log:
Fix Key.valueOf()
Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/Attachments.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/Attachments.java 2008-11-26 14:07:55 UTC (rev 3102)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/Attachments.java 2008-11-26 14:10:44 UTC (rev 3103)
@@ -85,16 +85,21 @@
int index = key.indexOf(",");
if (key.startsWith("[") && key.endsWith("]") && index > 0)
{
- String classPart = key.substring(1, index);
+ Class<?> classPart = null;
+ String className = key.substring(1, index);
String namePart = key.substring(index + 1, key.length() - 1);
- try
+ if (className.length() > 0 && !className.equals("null"))
{
- return new Key(Class.forName(classPart), namePart);
+ try
+ {
+ classPart = Class.forName(className);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ throw new IllegalArgumentException("Cannot find class '" + className + "' in: " + key);
+ }
}
- catch (ClassNotFoundException ex)
- {
- throw new IllegalArgumentException("Cannot find class: " + classPart);
- }
+ return new Key(classPart, namePart);
}
return null;
}
17 years, 5 months
JBoss JBPM SVN: r3102 - in jbpm3/trunk/modules/integration: api/src/main/java/org/jbpm/integration/model and 1 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-26 09:07:55 -0500 (Wed, 26 Nov 2008)
New Revision: 3102
Modified:
jbpm3/trunk/modules/integration/api/deploy.sh
jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/model/ProcessImpl.java
jbpm3/trunk/modules/integration/jboss42/deploy.sh
Log:
More spec integration
Modified: jbpm3/trunk/modules/integration/api/deploy.sh
===================================================================
--- jbpm3/trunk/modules/integration/api/deploy.sh 2008-11-26 14:07:30 UTC (rev 3101)
+++ jbpm3/trunk/modules/integration/api/deploy.sh 2008-11-26 14:07:55 UTC (rev 3102)
@@ -1,3 +1,4 @@
#! /bin/bash
+rm $JBOSS422/server/default/deploy/jbpm/jbpm-integration.beans/jbpm-integration-api*.jar
cp target/jbpm-integration-api-3.3.1-SNAPSHOT.jar $JBOSS422/server/default/deploy/jbpm/jbpm-integration.beans
Modified: jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/model/ProcessImpl.java
===================================================================
--- jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/model/ProcessImpl.java 2008-11-26 14:07:30 UTC (rev 3101)
+++ jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/model/ProcessImpl.java 2008-11-26 14:07:55 UTC (rev 3102)
@@ -29,13 +29,12 @@
import javax.management.ObjectName;
import org.jbpm.api.Constants;
-import org.jbpm.api.NotImplementedException;
import org.jbpm.api.client.ProcessEngine;
import org.jbpm.api.client.Token;
import org.jbpm.api.client.Token.TokenStatus;
import org.jbpm.api.model.Node;
-import org.jbpm.api.model.ProcessDefinition;
import org.jbpm.api.model.Process;
+import org.jbpm.api.model.ProcessDefinition;
import org.jbpm.api.model.builder.ObjectNameFactory;
import org.jbpm.api.runtime.Attachments;
import org.jbpm.api.runtime.Attachments.Key;
@@ -110,12 +109,12 @@
public Date getEndDate()
{
- return oldProc.getEnd();
+ return oldProc != null ? oldProc.getEnd() : null;
}
public Date getStartDate()
{
- return oldProc.getStart();
+ return oldProc != null ? oldProc.getStart() : null;
}
//@Override
@@ -176,10 +175,7 @@
public Token getRootToken()
{
- if (oldProc != null)
- return new TokenImpl(this, oldProc.getRootToken());
- else
- return null;
+ return oldProc != null ? new TokenImpl(this, oldProc.getRootToken()) : null;
}
public Set<Token> getTokens()
Modified: jbpm3/trunk/modules/integration/jboss42/deploy.sh
===================================================================
--- jbpm3/trunk/modules/integration/jboss42/deploy.sh 2008-11-26 14:07:30 UTC (rev 3101)
+++ jbpm3/trunk/modules/integration/jboss42/deploy.sh 2008-11-26 14:07:55 UTC (rev 3102)
@@ -1,4 +1,5 @@
#! /bin/bash
+rm $JBOSS422/server/default/deploy/jbpm/jbpm-service.sar/jbpm-integration-jboss42*.jar
cp target/jbpm-integration-jboss42-3.3.1-SNAPSHOT.jar $JBOSS422/server/default/deploy/jbpm/jbpm-service.sar
cp src/main/etc/par-deployer.xml $JBOSS422/server/default/deploy/jbpm/jbpm-service.sar
17 years, 5 months
JBoss JBPM SVN: r3101 - in projects/gwt-console/trunk/server: src/main/java/org/jboss/bpm/console/server and 3 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-26 09:07:30 -0500 (Wed, 26 Nov 2008)
New Revision: 3101
Added:
projects/gwt-console/trunk/server/deploy.sh
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ExtensionManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ManagementFactoryImpl.java
Removed:
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/JBPM3Extension.java
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/TestFacade.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/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/jbpm3/JBPM3ManagementExtension.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3ManagementFactory.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3ProcessManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java
Log:
More spec integration
Added: projects/gwt-console/trunk/server/deploy.sh
===================================================================
--- projects/gwt-console/trunk/server/deploy.sh (rev 0)
+++ projects/gwt-console/trunk/server/deploy.sh 2008-11-26 14:07:30 UTC (rev 3101)
@@ -0,0 +1,3 @@
+#! /bin/bash
+
+cp target/gwt-console-server.war $JBOSS422/server/default/deploy/jbpm
Property changes on: projects/gwt-console/trunk/server/deploy.sh
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
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-26 12:01:31 UTC (rev 3100)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java 2008-11-26 14:07:30 UTC (rev 3101)
@@ -30,7 +30,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.server.integration.JBPM3Extension;
+import org.jboss.bpm.console.server.integration.ExtensionManagement;
import org.jboss.bpm.console.server.integration.ManagementFactory;
import org.jboss.bpm.console.server.integration.ProcessManagement;
import org.jboss.bpm.console.server.gson.GsonFactory;
@@ -54,7 +54,7 @@
{
private static final Log log = LogFactory.getLog(JBPM3MgmtFacade.class);
- private JBPM3Extension JBPM3Extension = null;
+ private ExtensionManagement extensionManagement = null;
private ProcessManagement processManagement = null;
private ProcessManagement getProcessManagement()
@@ -70,15 +70,15 @@
}
- private JBPM3Extension getManagementExtension()
+ private ExtensionManagement getManagementExtension()
{
- if(null==this.JBPM3Extension)
+ if(null==this.extensionManagement)
{
ManagementFactory factory = ManagementFactory.newInstance();
- this.JBPM3Extension = factory.createExtensionManagement();
+ this.extensionManagement = factory.createExtensionManagement();
}
- return this.JBPM3Extension;
+ return this.extensionManagement;
}
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-26 12:01:31 UTC (rev 3100)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java 2008-11-26 14:07:30 UTC (rev 3101)
@@ -29,7 +29,7 @@
import org.jboss.bpm.console.client.model.ProcessInstanceRefWrapper;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.server.gson.GsonFactory;
-import org.jboss.bpm.console.server.integration.JBPM3Extension;
+import org.jboss.bpm.console.server.integration.ExtensionManagement;
import org.jboss.bpm.console.server.integration.ManagementFactory;
import org.jboss.bpm.console.server.integration.ProcessManagement;
@@ -46,7 +46,7 @@
{
private static final Log log = LogFactory.getLog(ProcessMgmtFacade.class);
private ProcessManagement processManagement;
- private JBPM3Extension managementExtension;
+ private ExtensionManagement managementExtension;
private ProcessManagement getProcessManagement()
{
@@ -60,7 +60,7 @@
return this.processManagement;
}
- private JBPM3Extension getManagementExtension()
+ private ExtensionManagement getManagementExtension()
{
if(null==this.managementExtension)
{
@@ -79,7 +79,7 @@
public Response getDefinitionsJSON()
{
ProcessDefinitionRefWrapper wrapper =
- new ProcessDefinitionRefWrapper(getProcessManagement().getAllDefinitions());
+ new ProcessDefinitionRefWrapper(getProcessManagement().getProcessDefinitions());
return createJsonResponse(wrapper);
}
@@ -92,7 +92,7 @@
)
{
ProcessDefinitionRefWrapper wrapper =
- new ProcessDefinitionRefWrapper( getProcessManagement().removeDefinition(processId));
+ new ProcessDefinitionRefWrapper( getProcessManagement().removeProcessDefinition(processId));
return createJsonResponse(wrapper);
}
@@ -106,7 +106,7 @@
{
ProcessInstanceRefWrapper wrapper =
- new ProcessInstanceRefWrapper(getProcessManagement().getInstancesByDefinitionId(processId));
+ new ProcessInstanceRefWrapper(getProcessManagement().getProcessInstances(processId));
return createJsonResponse(wrapper);
}
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-26 12:01:31 UTC (rev 3100)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java 2008-11-26 14:07:30 UTC (rev 3101)
@@ -29,7 +29,7 @@
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.ExtensionManagement;
import org.jboss.bpm.console.server.integration.ManagementFactory;
import org.jboss.bpm.console.server.integration.TaskManagement;
import org.jboss.bpm.console.server.integration.jbpm3.JBPM3FormParser;
@@ -52,7 +52,7 @@
private static final Log log = LogFactory.getLog(TaskMgmtFacade.class);
private TaskManagement taskManagement;
- private JBPM3Extension JBPM3Extension;
+ private ExtensionManagement JBPM3Extension;
/**
* Lazy load the {@link org.jboss.bpm.console.server.integration.ProcessManagement}
@@ -69,7 +69,7 @@
return this.taskManagement;
}
- private JBPM3Extension getManagementExtension()
+ private ExtensionManagement getManagementExtension()
{
if(null==this.JBPM3Extension)
{
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TestFacade.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TestFacade.java 2008-11-26 12:01:31 UTC (rev 3100)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TestFacade.java 2008-11-26 14:07:30 UTC (rev 3101)
@@ -24,7 +24,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
-import org.jboss.bpm.console.server.integration.JBPM3Extension;
+import org.jboss.bpm.console.server.integration.ExtensionManagement;
import org.jboss.bpm.console.server.integration.ManagementFactory;
import org.jboss.bpm.console.server.integration.ProcessManagement;
@@ -47,10 +47,10 @@
{
private static final Log log = LogFactory.getLog(TaskMgmtFacade.class);
- private JBPM3Extension JBPM3Extension;
+ private ExtensionManagement JBPM3Extension;
private ProcessManagement processManagement;
- private JBPM3Extension getManagementExtension()
+ private ExtensionManagement getManagementExtension()
{
if(null==this.JBPM3Extension)
{
@@ -108,14 +108,14 @@
@Path("undeploy/harness")
public Response undeployTestHarness()
{
- List<ProcessDefinitionRef> defs = getProcessManagement().getAllDefinitions();
+ List<ProcessDefinitionRef> defs = getProcessManagement().getProcessDefinitions();
for(ProcessDefinitionRef pd : defs)
{
if(pd.getName().equals("GWT_Test_Harness"))
{
log.info("Remove test harness " +pd);
- getProcessManagement().removeDefinition(pd.getProcessId());
+ getProcessManagement().removeProcessDefinition(pd.getProcessId());
}
}
return Response.ok().build();
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-26 12:01:31 UTC (rev 3100)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java 2008-11-26 14:07:30 UTC (rev 3101)
@@ -54,7 +54,7 @@
if(null==userManagement)
{
ManagementFactory factory = ManagementFactory.newInstance();
- this.userManagement = factory.createUsermanagement();
+ this.userManagement = factory.createUserManagement();
}
return this.userManagement;
Copied: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ExtensionManagement.java (from rev 3100, 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/ExtensionManagement.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ExtensionManagement.java 2008-11-26 14:07:30 UTC (rev 3101)
@@ -0,0 +1,51 @@
+/*
+ * 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 org.jboss.bpm.console.client.model.jbpm3.ActiveNodeInfo;
+import org.jboss.bpm.console.client.model.jbpm3.DiagramInfo;
+
+import java.util.Map;
+
+/**
+ * Proprietary to jBPM3, no sure if it will stay.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ExtensionManagement
+{
+ byte[] getProcessImage(long processId);
+
+ DiagramInfo getDiagramInfo(long processId);
+
+ ActiveNodeInfo getActivNodeInfo(long instanceId);
+
+ Map<String, String> getAvailableTaskForms(long processId);
+
+ byte[] getTaskFormByTaskName(long processId, long taskId);
+
+ void changeInstanceState(long instanceId, ProcessInstanceRef.STATE nextState);
+
+ ProcessDefinitionRef deployNewDefinition(byte[] data);
+}
Deleted: 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-26 12:01:31 UTC (rev 3100)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/JBPM3Extension.java 2008-11-26 14:07:30 UTC (rev 3101)
@@ -1,51 +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.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 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);
-
- Map<String, String> getAvailableTaskForms(long processId);
-
- byte[] getTaskFormByTaskName(long processId, long taskId);
-
- 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/ManagementFactory.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ManagementFactory.java 2008-11-26 12:01:31 UTC (rev 3100)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ManagementFactory.java 2008-11-26 14:07:30 UTC (rev 3101)
@@ -21,40 +21,30 @@
*/
package org.jboss.bpm.console.server.integration;
-import org.jboss.bpm.console.server.util.ServiceLoader;
+// $Id: $
+import org.jboss.bpm.console.server.integration.jbpm3.JBPM3ManagementFactory;
+import org.jboss.bpm.console.server.integration.spec.ManagementFactoryImpl;
+
/**
- * Construct management implementations.
- * Defaults to <code>org.jboss.bpm.console.server.integration.jbpm3.JBPM3ManagementFactory</code>
- *
- * @see org.jboss.bpm.console.server.util.ServiceLoader
+ * Construct management implementation
*
* @author Heiko.Braun <heiko.braun(a)jboss.com>
+ * @author Thomas.Diesler(a)jboss.com
*/
public abstract class ManagementFactory
{
- private static final String DEFAULT_FACTORY = "org.jboss.bpm.console.server.integration.jbpm3.JBPM3ManagementFactory";
+ public static ManagementFactory newInstance()
+ {
+ // return new ManagementFactoryImpl();
+ return new JBPM3ManagementFactory();
+ }
+
+ public abstract ProcessManagement createProcessManagement();
- public abstract ProcessManagement createProcessManagement();
-
- public abstract JBPM3Extension createExtensionManagement();
+ public abstract ExtensionManagement createExtensionManagement();
- public abstract TaskManagement createTaskManagement();
+ 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(), DEFAULT_FACTORY);
- if(null==factory)
- throw new RuntimeException("Failed to load ManagementFactory.");
-
- return factory;
- }
-
+ public abstract UserManagement createUserManagement();
}
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-26 12:01:31 UTC (rev 3100)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ProcessManagement.java 2008-11-26 14:07:30 UTC (rev 3101)
@@ -28,20 +28,21 @@
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
+ * @author Thomas.Diesler(a)jboss.com
*/
public interface ProcessManagement
{
- List<ProcessDefinitionRef> getAllDefinitions();
+ List<ProcessDefinitionRef> getProcessDefinitions();
- ProcessDefinitionRef getDefinitionById(long processId);
+ ProcessDefinitionRef getProcessDefinition(long procDefId);
- List<ProcessDefinitionRef> removeDefinition(long processId);
+ List<ProcessDefinitionRef> removeProcessDefinition(long procDefId);
- List<ProcessInstanceRef> getInstancesByDefinitionId(long processId);
+ List<ProcessInstanceRef> getProcessInstances(long procDefId);
- ProcessInstanceRef getInstanceById(long instanceId);
+ ProcessInstanceRef getProcessInstance(long procId);
- ProcessInstanceRef newInstance(long processId);
+ ProcessInstanceRef newInstance(long procDefId);
void signalToken(long tokenId, String signal);
}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3ManagementExtension.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3ManagementExtension.java 2008-11-26 12:01:31 UTC (rev 3100)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3ManagementExtension.java 2008-11-26 14:07:30 UTC (rev 3101)
@@ -25,7 +25,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.server.integration.JBPM3Extension;
+import org.jboss.bpm.console.server.integration.ExtensionManagement;
import org.jbpm.file.def.FileDefinition;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
@@ -43,7 +43,7 @@
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
-public class JBPM3ManagementExtension implements JBPM3Extension
+public class JBPM3ManagementExtension implements ExtensionManagement
{
private JBPM3CommandDelegate delegate;
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3ManagementFactory.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3ManagementFactory.java 2008-11-26 12:01:31 UTC (rev 3100)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3ManagementFactory.java 2008-11-26 14:07:30 UTC (rev 3101)
@@ -35,9 +35,9 @@
return (ProcessManagement) InvocationProxy.newInstance(new JBPM3ProcessManagement());
}
- public JBPM3Extension createExtensionManagement()
+ public ExtensionManagement createExtensionManagement()
{
- return (JBPM3Extension) InvocationProxy.newInstance( new JBPM3ManagementExtension() );
+ return (ExtensionManagement) InvocationProxy.newInstance( new JBPM3ManagementExtension() );
}
@@ -47,7 +47,7 @@
}
- public UserManagement createUsermanagement()
+ public UserManagement createUserManagement()
{
return (UserManagement) InvocationProxy.newInstance( new JBPM3UserManagement() );
}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3ProcessManagement.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3ProcessManagement.java 2008-11-26 12:01:31 UTC (rev 3100)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3ProcessManagement.java 2008-11-26 14:07:30 UTC (rev 3101)
@@ -42,7 +42,7 @@
this.delegate = new JBPM3CommandDelegate();
}
- public List<ProcessDefinitionRef> getAllDefinitions()
+ public List<ProcessDefinitionRef> getProcessDefinitions()
{
List<ProcessDefinition> defs = delegate.getActualDefinitions();
@@ -54,16 +54,16 @@
return results;
}
- public ProcessDefinitionRef getDefinitionById(long processId)
+ public ProcessDefinitionRef getProcessDefinition(long processId)
{
ProcessDefinition p0 = delegate.getActualDefinition(processId);
return Transform.processDefinition(p0);
}
- public List<ProcessDefinitionRef> removeDefinition(long processId)
+ public List<ProcessDefinitionRef> removeProcessDefinition(long processId)
{
delegate.removeActualDefinition(processId);
- return getAllDefinitions();
+ return getProcessDefinitions();
}
@@ -73,7 +73,7 @@
return Transform.processInstance(instance);
}
- public List<ProcessInstanceRef> getInstancesByDefinitionId(long processId)
+ public List<ProcessInstanceRef> getProcessInstances(long processId)
{
List<ProcessInstance> instances = delegate.getActualInstances(processId);
List<ProcessInstanceRef> results = new ArrayList<ProcessInstanceRef>(instances.size());
@@ -84,7 +84,7 @@
return results;
}
- public ProcessInstanceRef getInstanceById(long instanceId)
+ public ProcessInstanceRef getProcessInstance(long instanceId)
{
ProcessInstance instance = delegate.getActualInstance(instanceId);
return Transform.processInstance(instance);
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ManagementFactoryImpl.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ManagementFactoryImpl.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ManagementFactoryImpl.java 2008-11-26 14:07:30 UTC (rev 3101)
@@ -0,0 +1,59 @@
+/*
+ * 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.spec;
+
+import org.jboss.bpm.console.server.integration.ExtensionManagement;
+import org.jboss.bpm.console.server.integration.InvocationProxy;
+import org.jboss.bpm.console.server.integration.ManagementFactory;
+import org.jboss.bpm.console.server.integration.ProcessManagement;
+import org.jboss.bpm.console.server.integration.TaskManagement;
+import org.jboss.bpm.console.server.integration.UserManagement;
+import org.jboss.bpm.console.server.integration.jbpm3.JBPM3ManagementExtension;
+import org.jboss.bpm.console.server.integration.jbpm3.JBPM3TaskManagement;
+import org.jboss.bpm.console.server.integration.jbpm3.JBPM3UserManagement;
+
+/**
+ * Wraps management instances in {@link InvocationProxy}
+ * @author Thomas.Diesler(a)jboss.com
+ */
+public class ManagementFactoryImpl extends ManagementFactory
+{
+ public ProcessManagement createProcessManagement()
+ {
+ return (ProcessManagement) InvocationProxy.newInstance(new ProcessManagementImpl());
+ }
+
+ public ExtensionManagement createExtensionManagement()
+ {
+ return (ExtensionManagement) InvocationProxy.newInstance( new JBPM3ManagementExtension() );
+ }
+
+ public TaskManagement createTaskManagement()
+ {
+ return (TaskManagement) InvocationProxy.newInstance( new JBPM3TaskManagement() );
+ }
+
+ public UserManagement createUserManagement()
+ {
+ return (UserManagement) InvocationProxy.newInstance( new JBPM3UserManagement() );
+ }
+}
Property changes on: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ManagementFactoryImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java 2008-11-26 12:01:31 UTC (rev 3100)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java 2008-11-26 14:07:30 UTC (rev 3101)
@@ -27,6 +27,8 @@
import javax.management.ObjectName;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.server.integration.ProcessManagement;
@@ -47,81 +49,95 @@
*/
public class ProcessManagementImpl implements ProcessManagement
{
- public List<ProcessDefinitionRef> getAllDefinitions()
+ private static final Log log = LogFactory.getLog(ProcessManagementImpl.class);
+
+ public List<ProcessDefinitionRef> getProcessDefinitions()
{
+ log.info("getProcessDefinitions");
+
List<ProcessDefinitionRef> results = new ArrayList<ProcessDefinitionRef>();
-
ProcessDefinitionService pdService = getProcessDefinitionService();
Iterator<ObjectName> itKey = pdService.getProcessDefinitions().iterator();
while (itKey.hasNext())
{
ObjectName procDefKey = itKey.next();
ProcessDefinition procDef = pdService.getProcessDefinition(procDefKey);
+
+ log.info(procDef);
+
ProcessDefinitionRef pdRef = adaptProcessDefinition(procDef);
results.add(pdRef);
}
-
return results;
}
- public ProcessDefinitionRef getDefinitionById(long procDefId)
+ public ProcessDefinitionRef getProcessDefinition(long procDefId)
{
- ProcessDefinitionRef results = null;
-
- ProcessDefinition procDef = getProcessDefinitionById(procDefId);
- if (procDef != null)
- {
- results = new ProcessDefinitionRef(procDefId, procDef.getName(), procDef.getVersion());
- }
-
- return results;
+ ProcessDefinition procDef = getProcessDefinitionInternal(procDefId);
+ log.info("getProcessDefinition: " + procDef);
+
+ return procDef != null ? new ProcessDefinitionRef(procDefId, procDef.getName(), procDef.getVersion()) : null;
}
- public List<ProcessDefinitionRef> removeDefinition(long procDefId)
+ public List<ProcessDefinitionRef> removeProcessDefinition(long procDefId)
{
- ProcessDefinition procDef = getProcessDefinitionById(procDefId);
+ ProcessDefinition procDef = getProcessDefinitionInternal(procDefId);
+ log.info("removeDefinition: " + procDef);
+
if (procDef != null)
{
ProcessDefinitionService pdService = getProcessDefinitionService();
pdService.unregisterProcessDefinition(procDef.getKey());
}
- return getAllDefinitions();
+ return getProcessDefinitions();
}
public ProcessInstanceRef newInstance(long procDefId)
{
- ProcessDefinition procDef = getProcessDefinitionById(procDefId);
+ ProcessDefinition procDef = getProcessDefinitionInternal(procDefId);
+ log.info("newInstance: " + procDef);
+
if (procDef == null)
throw new IllegalStateException("Cannot obtain process definition: " + procDefId);
Process proc = procDef.newInstance();
+ proc.startProcess();
+
+ log.info("Started: " + proc);
+
ProcessInstanceRef procRef = adaptProcess(proc);
return procRef;
}
- public List<ProcessInstanceRef> getInstancesByDefinitionId(long procDefId)
+ public List<ProcessInstanceRef> getProcessInstances(long procDefId)
{
List<ProcessInstanceRef> results = new ArrayList<ProcessInstanceRef>();
-
- ProcessDefinition procDef = getProcessDefinitionById(procDefId);
+ ProcessDefinition procDef = getProcessDefinitionInternal(procDefId);
if (procDef == null)
throw new IllegalStateException("Cannot obtain process definition: " + procDefId);
+ log.info("getProcessInstances: " + procDef);
+
ProcessService procService = getProcessService();
Iterator<ObjectName> itProc = procService.getProcesses(procDef.getKey(), null).iterator();
while (itProc.hasNext())
{
ObjectName procID = itProc.next();
Process proc = procService.getProcess(procID);
+
+ log.info(proc);
+
results.add(adaptProcess(proc));
}
return results;
}
- public ProcessInstanceRef getInstanceById(long procID)
+ public ProcessInstanceRef getProcessInstance(long procID)
{
Process proc = getProcessById(procID);
+ log.info("getProcessInstance: " + proc);
+
ProcessInstanceRef procRef = adaptProcess(proc);
return procRef;
}
@@ -149,6 +165,8 @@
if (token == null)
throw new IllegalStateException("Cannot obtain token: " + tokenId);
+ log.info("signalToken: " + token);
+
// Signal the token
token.signal(name);
}
@@ -162,7 +180,7 @@
return pdService;
}
- private ProcessDefinition getProcessDefinitionById(long procDefID)
+ private ProcessDefinition getProcessDefinitionInternal(long procDefID)
{
ProcessDefinition procDef = null;
ProcessDefinitionService pdService = getProcessDefinitionService();
17 years, 5 months
JBoss JBPM SVN: r3100 - projects/gwt-console/trunk/server.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-11-26 07:01:31 -0500 (Wed, 26 Nov 2008)
New Revision: 3100
Added:
projects/gwt-console/trunk/server/default-identities.mysql.sql
Log:
default identity setup
Added: projects/gwt-console/trunk/server/default-identities.mysql.sql
===================================================================
--- projects/gwt-console/trunk/server/default-identities.mysql.sql (rev 0)
+++ projects/gwt-console/trunk/server/default-identities.mysql.sql 2008-11-26 12:01:31 UTC (rev 3100)
@@ -0,0 +1,115 @@
+-- MySQL dump 10.11
+--
+-- Host: localhost Database: jbpmtest
+-- ------------------------------------------------------
+-- Server version 5.0.67
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table `JBPM_ID_USER`
+--
+
+DROP TABLE IF EXISTS `JBPM_ID_USER`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `JBPM_ID_USER` (
+ `ID_` bigint(20) NOT NULL auto_increment,
+ `CLASS_` char(1) NOT NULL,
+ `NAME_` varchar(255) default NULL,
+ `EMAIL_` varchar(255) default NULL,
+ `PASSWORD_` varchar(255) default NULL,
+ PRIMARY KEY (`ID_`)
+) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Dumping data for table `JBPM_ID_USER`
+--
+
+LOCK TABLES `JBPM_ID_USER` WRITE;
+/*!40000 ALTER TABLE `JBPM_ID_USER` DISABLE KEYS */;
+INSERT INTO `JBPM_ID_USER` VALUES (3,'U','admin','','admin'),(4,'U','manager','','manager'),(5,'U','fred','','fred'),(6,'U','mary','','mary');
+/*!40000 ALTER TABLE `JBPM_ID_USER` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `JBPM_ID_GROUP`
+--
+
+DROP TABLE IF EXISTS `JBPM_ID_GROUP`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `JBPM_ID_GROUP` (
+ `ID_` bigint(20) NOT NULL auto_increment,
+ `CLASS_` char(1) NOT NULL,
+ `NAME_` varchar(255) default NULL,
+ `TYPE_` varchar(255) default NULL,
+ `PARENT_` bigint(20) default NULL,
+ PRIMARY KEY (`ID_`),
+ KEY `FK_ID_GRP_PARENT` (`PARENT_`),
+ CONSTRAINT `FK_ID_GRP_PARENT` FOREIGN KEY (`PARENT_`) REFERENCES `jbpm_id_group` (`ID_`)
+) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Dumping data for table `JBPM_ID_GROUP`
+--
+
+LOCK TABLES `JBPM_ID_GROUP` WRITE;
+/*!40000 ALTER TABLE `JBPM_ID_GROUP` DISABLE KEYS */;
+INSERT INTO `JBPM_ID_GROUP` VALUES (7,'','admin','security-role',NULL),(8,'','user','security-role',NULL),(9,'','manager','security-role',NULL),(10,'','manager','organisation',NULL),(11,'','user','organisation',NULL),(12,'G','sales','organisation',NULL),(13,'G','hr','organisation',NULL);
+/*!40000 ALTER TABLE `JBPM_ID_GROUP` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `JBPM_ID_MEMBERSHIP`
+--
+
+DROP TABLE IF EXISTS `JBPM_ID_MEMBERSHIP`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `JBPM_ID_MEMBERSHIP` (
+ `ID_` bigint(20) NOT NULL auto_increment,
+ `CLASS_` char(1) NOT NULL,
+ `NAME_` varchar(255) default NULL,
+ `ROLE_` varchar(255) default NULL,
+ `USER_` bigint(20) default NULL,
+ `GROUP_` bigint(20) default NULL,
+ PRIMARY KEY (`ID_`),
+ KEY `FK_ID_MEMSHIP_GRP` (`GROUP_`),
+ KEY `FK_ID_MEMSHIP_USR` (`USER_`),
+ CONSTRAINT `FK_ID_MEMSHIP_USR` FOREIGN KEY (`USER_`) REFERENCES `jbpm_id_user` (`ID_`),
+ CONSTRAINT `FK_ID_MEMSHIP_GRP` FOREIGN KEY (`GROUP_`) REFERENCES `jbpm_id_group` (`ID_`)
+) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Dumping data for table `JBPM_ID_MEMBERSHIP`
+--
+
+LOCK TABLES `JBPM_ID_MEMBERSHIP` WRITE;
+/*!40000 ALTER TABLE `JBPM_ID_MEMBERSHIP` DISABLE KEYS */;
+INSERT INTO `JBPM_ID_MEMBERSHIP` VALUES (3,'M',NULL,NULL,3,7),(4,'M',NULL,NULL,3,9),(5,'M',NULL,NULL,3,8),(6,'M',NULL,NULL,3,10),(7,'M',NULL,NULL,4,9),(9,'M',NULL,NULL,4,8),(10,'M',NULL,NULL,4,13),(11,'M',NULL,NULL,4,11),(12,'M',NULL,NULL,5,11),(13,'M',NULL,NULL,5,8),(14,'',NULL,NULL,6,8),(15,'M',NULL,NULL,6,11);
+/*!40000 ALTER TABLE `JBPM_ID_MEMBERSHIP` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2008-11-20 10:39:38
17 years, 5 months
JBoss JBPM SVN: r3099 - in jbpm3/trunk/modules/integration/api: src/main/java/org/jbpm/integration/client and 2 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-26 05:54:40 -0500 (Wed, 26 Nov 2008)
New Revision: 3099
Added:
jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/runtime/TokenAttachmentDelegate.java
Modified:
jbpm3/trunk/modules/integration/api/.classpath
jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/client/TokenImpl.java
jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/model/ProcessImpl.java
Log:
Add TokenAttachmentDelegate
Modified: jbpm3/trunk/modules/integration/api/.classpath
===================================================================
--- jbpm3/trunk/modules/integration/api/.classpath 2008-11-26 10:46:02 UTC (rev 3098)
+++ jbpm3/trunk/modules/integration/api/.classpath 2008-11-26 10:54:40 UTC (rev 3099)
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/cts/java"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
- <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
Modified: jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/client/TokenImpl.java
===================================================================
--- jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/client/TokenImpl.java 2008-11-26 10:46:02 UTC (rev 3098)
+++ jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/client/TokenImpl.java 2008-11-26 10:54:40 UTC (rev 3099)
@@ -39,7 +39,9 @@
import org.jbpm.api.model.builder.ObjectNameFactory;
import org.jbpm.api.runtime.Attachments;
import org.jbpm.api.runtime.BasicAttachments;
+import org.jbpm.context.exe.ContextInstance;
import org.jbpm.integration.model.ProcessImpl;
+import org.jbpm.integration.runtime.TokenAttachmentDelegate;
/**
* An integration wrapper
@@ -53,14 +55,22 @@
private org.jbpm.graph.exe.Token oldToken;
private ProcessImpl procImpl;
- private Attachments att = new BasicAttachments();
+ private Attachments att;
public TokenImpl(ProcessImpl proc, org.jbpm.graph.exe.Token oldToken)
{
this.oldToken = oldToken;
this.procImpl = proc;
+
+ ContextInstance context = proc.getOldProcessInstance().getContextInstance();
+ this.att = new TokenAttachmentDelegate(this, context);
}
+ public org.jbpm.graph.exe.Token getOldToken()
+ {
+ return oldToken;
+ }
+
public ObjectName getKey()
{
return ObjectNameFactory.create(Constants.ID_DOMAIN + ":id=" + oldToken.getId());
Modified: jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/model/ProcessImpl.java
===================================================================
--- jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/model/ProcessImpl.java 2008-11-26 10:46:02 UTC (rev 3098)
+++ jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/model/ProcessImpl.java 2008-11-26 10:54:40 UTC (rev 3099)
@@ -38,6 +38,7 @@
import org.jbpm.api.model.Process;
import org.jbpm.api.model.builder.ObjectNameFactory;
import org.jbpm.api.runtime.Attachments;
+import org.jbpm.api.runtime.Attachments.Key;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.integration.client.TokenImpl;
@@ -79,6 +80,11 @@
return procDef.getProcessEngine();
}
+ public ProcessInstance getOldProcessInstance()
+ {
+ return oldProc;
+ }
+
//@Override
public ProcessStatus getProcessStatus()
{
@@ -139,22 +145,41 @@
//@Override
public Token startProcess()
{
- setProcessStatus(ProcessStatus.Active);
- oldProc = new ProcessInstance(procDef.getOldProcessDefinition());
- Token rootToken = new TokenImpl(this, oldProc.getRootToken());
- rootToken.signal();
- return rootToken;
+ return startProcess(null);
}
//@Override
- public Token startProcess(Attachments att)
+ public Token startProcess(Attachments ctxData)
{
- throw new NotImplementedException();
+ setProcessStatus(ProcessStatus.Active);
+ oldProc = new ProcessInstance(procDef.getOldProcessDefinition());
+
+ // Create the root token
+ Token token = new TokenImpl(this, oldProc.getRootToken());
+
+ // Initialize the context data
+ if (ctxData != null)
+ {
+ Attachments tokenAtt = token.getAttachments();
+ for (Key key : ctxData.getAttachmentKeys())
+ {
+ Object val = ctxData.getAttachment(key.getClassPart(), key.getNamePart());
+ tokenAtt.addAttachment(key.getClassPart(), key.getNamePart(), val);
+ }
+ }
+
+ // Signal the root token
+ token.signal();
+
+ return token;
}
public Token getRootToken()
{
- return new TokenImpl(this, oldProc.getRootToken());
+ if (oldProc != null)
+ return new TokenImpl(this, oldProc.getRootToken());
+ else
+ return null;
}
public Set<Token> getTokens()
Added: jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/runtime/TokenAttachmentDelegate.java
===================================================================
--- jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/runtime/TokenAttachmentDelegate.java (rev 0)
+++ jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/runtime/TokenAttachmentDelegate.java 2008-11-26 10:54:40 UTC (rev 3099)
@@ -0,0 +1,114 @@
+/*
+ * 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.integration.runtime;
+
+//$Id$
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jbpm.api.runtime.Attachments;
+import org.jbpm.context.exe.ContextInstance;
+import org.jbpm.integration.client.TokenImpl;
+
+/**
+ * An Attachment implementation that delegates to to the ContextInstance
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 26-Nov-2008
+ */
+public class TokenAttachmentDelegate implements Attachments
+{
+ private ContextInstance context;
+ private TokenImpl token;
+
+ public TokenAttachmentDelegate(TokenImpl token, ContextInstance context)
+ {
+ this.token = token;
+ this.context = context;
+ }
+
+ public <T> T addAttachment(Class<T> clazz, Object value)
+ {
+ return addAttachment(clazz, null, value);
+ }
+
+ public Object addAttachment(String name, Object value)
+ {
+ return addAttachment(null, name, value);
+ }
+
+ public <T> T addAttachment(Class<T> clazz, String name, Object value)
+ {
+ Key key = new Key(clazz, name);
+ context.createVariable(key.toString(), value, token.getOldToken());
+ return (T)value;
+ }
+
+ public <T> T getAttachment(Class<T> clazz)
+ {
+ return getAttachment(clazz, null);
+ }
+
+ public Object getAttachment(String name)
+ {
+ return getAttachment(null, name);
+ }
+
+ public <T> T getAttachment(Class<T> clazz, String name)
+ {
+ Key key = new Key(clazz, name);
+ return (T)context.getVariable(key.toString(), token.getOldToken());
+ }
+
+ public Collection<Key> getAttachmentKeys()
+ {
+ Set<Key> keys = new HashSet<Key>();
+ Set<String> strKeys = context.getVariables(token.getOldToken()).keySet();
+ for (String strKey : strKeys)
+ {
+ Key key = Key.valueOf(strKey);
+ if (key != null)
+ keys.add(key);
+ }
+ return keys;
+ }
+
+ public <T> T removeAttachment(Class<T> clazz, String name)
+ {
+ Key key = new Key(clazz, name);
+ T value = getAttachment(clazz, name);
+ context.deleteVariable(key.toString(), token.getOldToken());
+ return value;
+ }
+
+ public <T> T removeAttachment(Class<T> clazz)
+ {
+ return removeAttachment(clazz, null);
+ }
+
+ public Object removeAttachment(String name)
+ {
+ return removeAttachment(null, name);
+ }
+}
\ No newline at end of file
Property changes on: jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/runtime/TokenAttachmentDelegate.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
17 years, 5 months
JBoss JBPM SVN: r3098 - projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-26 05:46:02 -0500 (Wed, 26 Nov 2008)
New Revision: 3098
Modified:
projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/Attachments.java
Log:
Add Key.valueOf(String)
Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/Attachments.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/Attachments.java 2008-11-26 09:31:53 UTC (rev 3097)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/Attachments.java 2008-11-26 10:46:02 UTC (rev 3098)
@@ -80,6 +80,25 @@
this.name = name;
}
+ public static Key valueOf(String key)
+ {
+ int index = key.indexOf(",");
+ if (key.startsWith("[") && key.endsWith("]") && index > 0)
+ {
+ String classPart = key.substring(1, index);
+ String namePart = key.substring(index + 1, key.length() - 1);
+ try
+ {
+ return new Key(Class.forName(classPart), namePart);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ throw new IllegalArgumentException("Cannot find class: " + classPart);
+ }
+ }
+ return null;
+ }
+
/**
* Get the class part for this key
*
@@ -121,22 +140,16 @@
}
/**
- * Returns the String repesentation of this Key. <p/>
- * <pre>
- * "[" + clazz + "," + name + "]"
+ * Returns the String repesentation of this Key.
+ * <p/>
+ *
+ * <pre>
+ * "[" + clazz + "," + name + "]"
* </pre>
*/
public String toString()
{
- StringBuilder str = new StringBuilder("[");
- if (clazz != null)
- str.append(clazz.getName());
- if (clazz != null && name != null)
- str.append(",");
- if (name != null)
- str.append(name);
- str.append("]");
- return str.toString();
+ return "[" + clazz + "," + name + "]";
}
}
}
\ No newline at end of file
17 years, 5 months
JBoss JBPM SVN: r3097 - in projects/gwt-console/trunk: war/src/main/java/org/jboss/bpm/console/client and 1 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-11-26 04:31:53 -0500 (Wed, 26 Nov 2008)
New Revision: 3097
Modified:
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/Transform.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/UIConstants.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java
Log:
Fix JBPM-1828: TaskRef transition names are null
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/Transform.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/Transform.java 2008-11-26 09:24:00 UTC (rev 3096)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/Transform.java 2008-11-26 09:31:53 UTC (rev 3097)
@@ -80,7 +80,8 @@
for(Object tr0 : t0.getNode().getLeavingTransitionsList())
{
Transition transition = (Transition)tr0;
- token.getAvailableSignals().add(transition.getName());
+ String tName = transition.getName()!=null ? transition.getName() : "default transition";
+ token.getAvailableSignals().add(tName);
}
return token;
@@ -118,20 +119,18 @@
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)
+ List<Transition> transitionList =
+ t0.getToken().getNode().getLeavingTransitionsList();
+ for(Transition transition : transitionList)
{
- taskRef.getTransitionNames().add(
- trs0.getName()
- );
+ String tName = transition.getName()!=null ? transition.getName() : "default transition";
+ taskRef.getTransitionNames().add(tName);
}
return taskRef;
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/UIConstants.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/UIConstants.java 2008-11-26 09:24:00 UTC (rev 3096)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/UIConstants.java 2008-11-26 09:31:53 UTC (rev 3097)
@@ -34,6 +34,6 @@
public static final int TEASER_PANEL_WIDTH = 200;
public static final int EDITOR_PANEL_WIDTH = 450;
- public static final String DEFAULT_TRANSITION = "(Default transition)";
+ public static final String DEFAULT_TRANSITION = "default transition";
public static final String DATE_FORMAT = "yyyy-m-j H:i:s"; //08-10-02 13:51:27
}
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-26 09:24:00 UTC (rev 3096)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java 2008-11-26 09:31:53 UTC (rev 3097)
@@ -22,6 +22,7 @@
package org.jboss.bpm.console.client.model;
import com.google.gwt.json.client.*;
+import com.allen_sauer.gwt.log.client.Log;
import org.jboss.bpm.console.client.util.ConsoleLog;
import org.jboss.bpm.console.client.model.forms.FieldDef;
import org.jboss.bpm.console.client.model.forms.FormDef;
@@ -130,7 +131,10 @@
{
JSONValue jsonValue = arr.get(k);
if(jsonValue.toString().equals("null"))
+ {
+ Log.warn("FIXME JBPM-1828: Null value on transitionNames:" +arr.toString());
continue; // TODO: JBPM-1828
+ }
JSONString t = jsonValue.isString();
ref.getTransitionNames().add(t.stringValue());
}
@@ -233,7 +237,10 @@
{
JSONValue jsonValue = signals.get(i);
if(jsonValue.toString().equals("null"))
+ {
+ Log.warn("FIXME JBPM-1828: Null value on availableSignals:" +signals.toString());
continue; // TODO: JBPM-1828
+ }
JSONString item = jsonValue.isString();
rt.getAvailableSignals().add(item.stringValue());
}
@@ -261,7 +268,10 @@
{
JSONValue jsonValue = jsonArray.get(i);
if(jsonValue.toString().equals("null"))
+ {
+ Log.warn("FIXME JBPM-1828: Null value on string array:" +jsonArray.toString());
continue; // TODO: JBPM-1828
+ }
JSONString item = jsonValue.isString();
result.add(item.stringValue());
}
17 years, 5 months
JBoss JBPM SVN: r3096 - projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-26 04:24:00 -0500 (Wed, 26 Nov 2008)
New Revision: 3096
Modified:
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java
Log:
Update API integration
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java 2008-11-26 09:23:21 UTC (rev 3095)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java 2008-11-26 09:24:00 UTC (rev 3096)
@@ -32,6 +32,7 @@
import org.jboss.bpm.console.server.integration.ProcessManagement;
import org.jbpm.api.client.Configuration;
import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.client.Token;
import org.jbpm.api.model.Process;
import org.jbpm.api.model.ProcessDefinition;
import org.jbpm.api.model.Process.ProcessStatus;
@@ -49,30 +50,30 @@
public List<ProcessDefinitionRef> getAllDefinitions()
{
List<ProcessDefinitionRef> results = new ArrayList<ProcessDefinitionRef>();
-
+
ProcessDefinitionService pdService = getProcessDefinitionService();
Iterator<ObjectName> itKey = pdService.getProcessDefinitions().iterator();
- while(itKey.hasNext())
+ while (itKey.hasNext())
{
ObjectName procDefKey = itKey.next();
ProcessDefinition procDef = pdService.getProcessDefinition(procDefKey);
ProcessDefinitionRef pdRef = adaptProcessDefinition(procDef);
results.add(pdRef);
}
-
+
return results;
}
public ProcessDefinitionRef getDefinitionById(long procDefId)
{
ProcessDefinitionRef results = null;
-
+
ProcessDefinition procDef = getProcessDefinitionById(procDefId);
if (procDef != null)
{
results = new ProcessDefinitionRef(procDefId, procDef.getName(), procDef.getVersion());
}
-
+
return results;
}
@@ -100,7 +101,22 @@
public List<ProcessInstanceRef> getInstancesByDefinitionId(long procDefId)
{
- throw new RuntimeException("Not implemented");
+ List<ProcessInstanceRef> results = new ArrayList<ProcessInstanceRef>();
+
+ ProcessDefinition procDef = getProcessDefinitionById(procDefId);
+ if (procDef == null)
+ throw new IllegalStateException("Cannot obtain process definition: " + procDefId);
+
+ ProcessService procService = getProcessService();
+ Iterator<ObjectName> itProc = procService.getProcesses(procDef.getKey(), null).iterator();
+ while (itProc.hasNext())
+ {
+ ObjectName procID = itProc.next();
+ Process proc = procService.getProcess(procID);
+ results.add(adaptProcess(proc));
+ }
+
+ return results;
}
public ProcessInstanceRef getInstanceById(long procID)
@@ -110,11 +126,35 @@
return procRef;
}
- public void signalToken(long tokenId, String signal)
+ public void signalToken(long tokenId, String name)
{
- throw new RuntimeException("Not implemented");
+ Token token = null;
+ ProcessService procService = getProcessService();
+ Iterator<ObjectName> itProc = procService.getProcesses().iterator();
+ while (token == null && itProc.hasNext())
+ {
+ ObjectName procID = itProc.next();
+ Process proc = procService.getProcess(procID);
+ for (Token aux : proc.getTokens())
+ {
+ Long auxId = apaptKey(aux.getKey());
+ if (auxId == tokenId)
+ {
+ token = aux;
+ break;
+ }
+ }
+ }
+
+ if (token == null)
+ throw new IllegalStateException("Cannot obtain token: " + tokenId);
+
+ // Signal the token
+ token.signal(name);
}
+ // Private
+
private ProcessDefinitionService getProcessDefinitionService()
{
ProcessEngine engine = Configuration.getProcessEngine();
@@ -127,7 +167,7 @@
ProcessDefinition procDef = null;
ProcessDefinitionService pdService = getProcessDefinitionService();
Iterator<ObjectName> it = pdService.getProcessDefinitions().iterator();
- while(it.hasNext())
+ while (it.hasNext())
{
ObjectName auxKey = it.next();
if (procDefID == apaptKey(auxKey))
@@ -156,39 +196,39 @@
private Process getProcessById(long procID)
{
Process proc = null;
- ProcessService pdService = getProcessService();
- Iterator<ObjectName> it = pdService.getProcesses().iterator();
- while(it.hasNext())
+ ProcessService procService = getProcessService();
+ Iterator<ObjectName> it = procService.getProcesses().iterator();
+ while (it.hasNext())
{
ObjectName auxKey = it.next();
if (procID == apaptKey(auxKey))
{
- proc = pdService.getProcess(auxKey);
+ proc = procService.getProcess(auxKey);
break;
}
}
return proc;
}
-
+
private ProcessInstanceRef adaptProcess(Process proc)
{
Long procDefID = apaptKey(proc.getProcessDefinition().getKey());
Long procID = apaptKey(proc.getKey());
-
+
// [TODO] clarify process status
ProcessStatus status = proc.getProcessStatus();
boolean suspended = ProcessStatus.Active != status;
-
+
ProcessInstanceRef procRef = new ProcessInstanceRef(procID, procDefID, proc.getStartDate(), proc.getEndDate(), suspended);
return procRef;
}
- private Long apaptKey(ObjectName procDefKey)
+ private Long apaptKey(ObjectName key)
{
- String procDefID = procDefKey.getKeyProperty("id");
- if (procDefID == null)
- throw new IllegalStateException("Cannot obtain id property from: " + procDefKey);
-
- return new Long(procDefID);
+ String id = key.getKeyProperty("id");
+ if (id == null)
+ throw new IllegalStateException("Cannot obtain id property from: " + key);
+
+ return new Long(id);
}
}
17 years, 5 months