JBoss JBPM SVN: r2954 - in jbpm3/trunk: modules and 15 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-17 08:08:14 -0500 (Mon, 17 Nov 2008)
New Revision: 2954
Added:
jbpm3/trunk/modules/integration/
jbpm3/trunk/modules/integration/.classpath
jbpm3/trunk/modules/integration/.project
jbpm3/trunk/modules/integration/pom.xml
jbpm3/trunk/modules/integration/src/
jbpm3/trunk/modules/integration/src/main/
jbpm3/trunk/modules/integration/src/main/java/
jbpm3/trunk/modules/integration/src/main/java/org/
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/client/
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/client/ProcessEngineImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/client/TokenImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/EndEventImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ExclusiveGatewayImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ExpressionImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/GatewayImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/NodeImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ProcessDefinitionImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ProcessImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/SequenceFlowImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/StartEventImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/TaskImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/WaitStateImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/builder/
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/builder/GatewayBuilderImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/builder/ProcessBuilderImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/ExpressionEvaluator.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/NodeExecuteInterceptor.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/NodeInterceptor.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/RuntimeContext.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/DialectHandlerServiceImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/MutableService.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/NoopPersistenceServiceImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/ProcessBuilderServiceImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/ProcessDefinitionServiceImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/ProcessServiceImpl.java
jbpm3/trunk/modules/integration/src/main/resources/
jbpm3/trunk/modules/integration/src/main/resources/jbpm-cfg-beans.xml
jbpm3/trunk/modules/integration/src/main/resources/org.jbpm.api.client.ConfigurationProvider
Removed:
jbpm3/trunk/modules/integration/.classpath
jbpm3/trunk/modules/integration/.project
jbpm3/trunk/modules/integration/pom.xml
jbpm3/trunk/modules/integration/src/
jbpm3/trunk/modules/integration/src/main/
jbpm3/trunk/modules/integration/src/main/java/
jbpm3/trunk/modules/integration/src/main/java/org/
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/client/
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/client/ProcessEngineImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/client/TokenImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/EndEventImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ExclusiveGatewayImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ExpressionImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/GatewayImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/NodeImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ProcessDefinitionImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ProcessImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/SequenceFlowImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/StartEventImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/TaskImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/WaitStateImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/builder/
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/builder/GatewayBuilderImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/builder/ProcessBuilderImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/ExpressionEvaluator.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/NodeExecuteInterceptor.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/NodeInterceptor.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/RuntimeContext.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/DialectHandlerServiceImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/MutableService.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/NoopPersistenceServiceImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/ProcessBuilderServiceImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/ProcessDefinitionServiceImpl.java
jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/ProcessServiceImpl.java
jbpm3/trunk/modules/integration/src/main/resources/
jbpm3/trunk/modules/integration/src/main/resources/jbpm-cfg-beans.xml
jbpm3/trunk/modules/integration/src/main/resources/org.jbpm.api.client.ConfigurationProvider
Modified:
jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/node/Decision.java
jbpm3/trunk/modules/simulation/.classpath
jbpm3/trunk/pom.xml
Log:
Add API integration
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/node/Decision.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/node/Decision.java 2008-11-17 12:57:48 UTC (rev 2953)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/node/Decision.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -81,7 +81,10 @@
try {
if (decisionDelegation != null) {
- DecisionHandler decisionHandler = (DecisionHandler) decisionDelegation.instantiate();
+ DecisionHandler decisionHandler = (DecisionHandler)decisionDelegation.getInstance();
+ if (decisionHandler == null)
+ decisionHandler = (DecisionHandler) decisionDelegation.instantiate();
+
String transitionName = decisionHandler.decide(executionContext);
transition = getLeavingTransition(transitionName);
if (transition == null) {
Copied: jbpm3/trunk/modules/integration (from rev 2952, jbpm3/branches/tdiesler/modules/integration)
Property changes on: jbpm3/trunk/modules/integration
___________________________________________________________________
Name: svn:ignore
+ target
.settings
Deleted: jbpm3/trunk/modules/integration/.classpath
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/.classpath 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/.classpath 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
- <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/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"/>
-</classpath>
Copied: jbpm3/trunk/modules/integration/.classpath (from rev 2952, jbpm3/branches/tdiesler/modules/integration/.classpath)
===================================================================
--- jbpm3/trunk/modules/integration/.classpath (rev 0)
+++ jbpm3/trunk/modules/integration/.classpath 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/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"/>
+</classpath>
Deleted: jbpm3/trunk/modules/integration/.project
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/.project 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/.project 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>jbpm-integration</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.maven.ide.eclipse.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.maven.ide.eclipse.maven2Nature</nature>
- </natures>
-</projectDescription>
Copied: jbpm3/trunk/modules/integration/.project (from rev 2952, jbpm3/branches/tdiesler/modules/integration/.project)
===================================================================
--- jbpm3/trunk/modules/integration/.project (rev 0)
+++ jbpm3/trunk/modules/integration/.project 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>jbpm-integration</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
Deleted: jbpm3/trunk/modules/integration/pom.xml
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/pom.xml 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/pom.xml 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,112 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- ====================================================================== -->
-<!-- -->
-<!-- JBoss, the OpenSource J2EE webOS -->
-<!-- -->
-<!-- Distributable under LGPL license. -->
-<!-- See terms of license at http://www.gnu.org. -->
-<!-- -->
-<!-- ====================================================================== -->
-
-<!-- $Id$ -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <name>JBoss jBPM3 - Integration</name>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-integration</artifactId>
- <packaging>jar</packaging>
-
- <!-- Parent -->
- <parent>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm</artifactId>
- <version>3.3.1-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
-
- <!-- Properties -->
- <properties>
- <mvel.version>1.3.7-java1.5</mvel.version>
- </properties>
-
- <!-- Dependencies -->
- <dependencies>
- <dependency>
- <groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm-spec-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-jpdl</artifactId>
- <version>${version}</version>
- </dependency>
- <dependency>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-jpdl</artifactId>
- <classifier>config</classifier>
- <version>${version}</version>
- </dependency>
- <dependency>
- <groupId>org.mvel</groupId>
- <artifactId>mvel</artifactId>
- <version>${mvel.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm-spec-dialect-api10</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm-spec-cts</artifactId>
- <scope>test</scope>
- <type>zip</type>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm-spec-cts</artifactId>
- <type>zip</type>
- </artifactItem>
- </artifactItems>
- <outputDirectory>src/test</outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>org/jbpm/test/preview/**/*Test.java</exclude>
- <exclude>org/jbpm/test/pattern/**/*Test.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
Copied: jbpm3/trunk/modules/integration/pom.xml (from rev 2952, jbpm3/branches/tdiesler/modules/integration/pom.xml)
===================================================================
--- jbpm3/trunk/modules/integration/pom.xml (rev 0)
+++ jbpm3/trunk/modules/integration/pom.xml 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ====================================================================== -->
+<!-- -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- -->
+<!-- ====================================================================== -->
+
+<!-- $Id$ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>JBoss jBPM3 - Integration</name>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm-integration</artifactId>
+ <packaging>jar</packaging>
+
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm</artifactId>
+ <version>3.3.1-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <!-- Properties -->
+ <properties>
+ <mvel.version>1.3.7-java1.5</mvel.version>
+ </properties>
+
+ <!-- Dependencies -->
+ <dependencies>
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-spec-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm-jpdl</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm-jpdl</artifactId>
+ <classifier>config</classifier>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mvel</groupId>
+ <artifactId>mvel</artifactId>
+ <version>${mvel.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-spec-dialect-api10</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-spec-cts</artifactId>
+ <scope>test</scope>
+ <type>zip</type>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-spec-cts</artifactId>
+ <type>zip</type>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>src/test</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>org/jbpm/test/preview/**/*Test.java</exclude>
+ <exclude>org/jbpm/test/pattern/**/*Test.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Copied: jbpm3/trunk/modules/integration/src (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src)
Property changes on: jbpm3/trunk/modules/integration/src
___________________________________________________________________
Name: svn:ignore
+ test
Copied: jbpm3/trunk/modules/integration/src/main (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main)
Copied: jbpm3/trunk/modules/integration/src/main/java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java)
Copied: jbpm3/trunk/modules/integration/src/main/java/org (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org)
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm)
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration)
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/client (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/client)
Deleted: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/client/ProcessEngineImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/client/ProcessEngineImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/client/ProcessEngineImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,54 +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.integration.client;
-
-//$Id$
-
-import java.util.Set;
-
-import org.jbpm.api.client.ProcessEngine;
-import org.jbpm.api.service.Service;
-import org.jbpm.integration.service.MutableService;
-
-/**
- * A process engine with public access
- *
- * @author thomas.diesler(a)jboss.com
- * @since 18-Jun-2008
- */
-public class ProcessEngineImpl extends ProcessEngine
-{
- public void setServices(Set<Service> services)
- {
- this.services = services;
-
- // Set this engine on every mutable service
- for (Service service : services)
- {
- if (service instanceof MutableService)
- {
- MutableService mutService = (MutableService)service;
- mutService.setProcessEngine(this);
- }
- }
- }
-}
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/client/ProcessEngineImpl.java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/client/ProcessEngineImpl.java)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/client/ProcessEngineImpl.java (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/client/ProcessEngineImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,54 @@
+/*
+ * 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.client;
+
+//$Id$
+
+import java.util.Set;
+
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.service.Service;
+import org.jbpm.integration.service.MutableService;
+
+/**
+ * A process engine with public access
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Jun-2008
+ */
+public class ProcessEngineImpl extends ProcessEngine
+{
+ public void setServices(Set<Service> services)
+ {
+ this.services = services;
+
+ // Set this engine on every mutable service
+ for (Service service : services)
+ {
+ if (service instanceof MutableService)
+ {
+ MutableService mutService = (MutableService)service;
+ mutService.setProcessEngine(this);
+ }
+ }
+ }
+}
Deleted: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/client/TokenImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/client/TokenImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/client/TokenImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,137 +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.integration.client;
-
-import java.util.Set;
-
-import org.jbpm.api.NotImplementedException;
-import org.jbpm.api.client.ProcessEngine;
-import org.jbpm.api.client.Token;
-import org.jbpm.api.model.Node;
-import org.jbpm.api.model.Process;
-import org.jbpm.api.model.SequenceFlow;
-import org.jbpm.api.model.Process.ProcessStatus;
-import org.jbpm.api.runtime.Attachments;
-import org.jbpm.api.runtime.BasicAttachments;
-import org.jbpm.integration.model.ProcessImpl;
-
-/**
- * An integration wrapper
- *
- * @author thomas.diesler(a)jboss.com
- * @since 15-Nov-2008
- */
-public class TokenImpl implements Token
-{
- private static final long serialVersionUID = 1L;
-
- private org.jbpm.graph.exe.Token oldToken;
- private ProcessImpl procImpl;
- private Attachments att = new BasicAttachments();
-
- public TokenImpl(ProcessImpl proc, org.jbpm.graph.exe.Token oldToken, Attachments att)
- {
- this.oldToken = oldToken;
- this.procImpl = proc;
- this.att = att;
- }
-
- @Override
- public String getTokenID()
- {
- throw new NotImplementedException();
- }
-
- @Override
- public Process getProcess()
- {
- return procImpl;
- }
-
- @Override
- public ProcessEngine getProcessEngine()
- {
- return procImpl.getProcessEngine();
- }
-
- @Override
- public Attachments getAttachments()
- {
- return att;
- }
-
- @Override
- public TokenStatus getTokenStatus()
- {
- TokenStatus status = TokenStatus.Suspended;
- if (oldToken.hasEnded())
- {
- status = TokenStatus.Destroyed;
- }
- return status;
- }
-
- @Override
- public Set<Token> getChildTokens()
- {
- throw new NotImplementedException();
- }
-
- @Override
- public Node getCurrentNode()
- {
- String nodeName = oldToken.getNode().getName();
- return procImpl.getNode(nodeName);
- }
-
- @Override
- public SequenceFlow getLastFlow()
- {
- throw new NotImplementedException();
- }
-
- @Override
- public Token getParentToken()
- {
- throw new NotImplementedException();
- }
-
- @Override
- public Token getRootToken()
- {
- throw new NotImplementedException();
- }
-
- @Override
- public void signal()
- {
- try
- {
- oldToken.signal();
- }
- catch (RuntimeException rte)
- {
- procImpl.setProcessStatus(ProcessStatus.Aborted);
- throw rte;
- }
- }
-}
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/client/TokenImpl.java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/client/TokenImpl.java)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/client/TokenImpl.java (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/client/TokenImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,137 @@
+/*
+ * 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.client;
+
+import java.util.Set;
+
+import org.jbpm.api.NotImplementedException;
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.client.Token;
+import org.jbpm.api.model.Node;
+import org.jbpm.api.model.Process;
+import org.jbpm.api.model.SequenceFlow;
+import org.jbpm.api.model.Process.ProcessStatus;
+import org.jbpm.api.runtime.Attachments;
+import org.jbpm.api.runtime.BasicAttachments;
+import org.jbpm.integration.model.ProcessImpl;
+
+/**
+ * An integration wrapper
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 15-Nov-2008
+ */
+public class TokenImpl implements Token
+{
+ private static final long serialVersionUID = 1L;
+
+ private org.jbpm.graph.exe.Token oldToken;
+ private ProcessImpl procImpl;
+ private Attachments att = new BasicAttachments();
+
+ public TokenImpl(ProcessImpl proc, org.jbpm.graph.exe.Token oldToken, Attachments att)
+ {
+ this.oldToken = oldToken;
+ this.procImpl = proc;
+ this.att = att;
+ }
+
+ @Override
+ public String getTokenID()
+ {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public Process getProcess()
+ {
+ return procImpl;
+ }
+
+ @Override
+ public ProcessEngine getProcessEngine()
+ {
+ return procImpl.getProcessEngine();
+ }
+
+ @Override
+ public Attachments getAttachments()
+ {
+ return att;
+ }
+
+ @Override
+ public TokenStatus getTokenStatus()
+ {
+ TokenStatus status = TokenStatus.Suspended;
+ if (oldToken.hasEnded())
+ {
+ status = TokenStatus.Destroyed;
+ }
+ return status;
+ }
+
+ @Override
+ public Set<Token> getChildTokens()
+ {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public Node getCurrentNode()
+ {
+ String nodeName = oldToken.getNode().getName();
+ return procImpl.getNode(nodeName);
+ }
+
+ @Override
+ public SequenceFlow getLastFlow()
+ {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public Token getParentToken()
+ {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public Token getRootToken()
+ {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public void signal()
+ {
+ try
+ {
+ oldToken.signal();
+ }
+ catch (RuntimeException rte)
+ {
+ procImpl.setProcessStatus(ProcessStatus.Aborted);
+ throw rte;
+ }
+ }
+}
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model)
Deleted: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/EndEventImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/EndEventImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/EndEventImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,57 +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.integration.model;
-
-import org.jbpm.api.model.EndEvent;
-import org.jbpm.api.model.ProcessDefinition;
-import org.jbpm.graph.node.EndState;
-
-/**
- * An integration wrapper
- *
- * @author thomas.diesler(a)jboss.com
- * @since 15-Nov-2008
- */
-public class EndEventImpl extends NodeImpl implements EndEvent
-{
- private static final long serialVersionUID = 1L;
-
- private EndState oldEnd;
-
- public EndEventImpl(ProcessDefinition procDef, EndState oldEnd)
- {
- super(procDef, oldEnd);
- this.oldEnd = oldEnd;
- }
-
- @Override
- public EventDetailType getResultType()
- {
- return EventDetailType.None;
- }
-
- @Override
- public EventType getEventType()
- {
- return EventType.End;
- }
-}
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/EndEventImpl.java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/EndEventImpl.java)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/EndEventImpl.java (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/EndEventImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -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.integration.model;
+
+import org.jbpm.api.model.EndEvent;
+import org.jbpm.api.model.ProcessDefinition;
+import org.jbpm.graph.node.EndState;
+
+/**
+ * An integration wrapper
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 15-Nov-2008
+ */
+public class EndEventImpl extends NodeImpl implements EndEvent
+{
+ private static final long serialVersionUID = 1L;
+
+ private EndState oldEnd;
+
+ public EndEventImpl(ProcessDefinition procDef, EndState oldEnd)
+ {
+ super(procDef, oldEnd);
+ this.oldEnd = oldEnd;
+ }
+
+ @Override
+ public EventDetailType getResultType()
+ {
+ return EventDetailType.None;
+ }
+
+ @Override
+ public EventType getEventType()
+ {
+ return EventType.End;
+ }
+}
Deleted: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ExclusiveGatewayImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ExclusiveGatewayImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ExclusiveGatewayImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,124 +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.integration.model;
-
-// $Id$
-
-import org.jbpm.api.client.Token;
-import org.jbpm.api.model.ExclusiveGateway;
-import org.jbpm.api.model.Expression;
-import org.jbpm.api.model.ProcessDefinition;
-import org.jbpm.api.model.SequenceFlow;
-import org.jbpm.api.model.SequenceFlow.ConditionType;
-import org.jbpm.graph.exe.ExecutionContext;
-import org.jbpm.graph.node.Decision;
-import org.jbpm.graph.node.DecisionHandler;
-import org.jbpm.instantiation.Delegation;
-import org.jbpm.integration.runtime.ExpressionEvaluator;
-
-/**
- * An integration wrapper
- *
- * @author thomas.diesler(a)jboss.com
- * @since 15-Nov-2008
- */
-public class ExclusiveGatewayImpl extends GatewayImpl implements ExclusiveGateway
-{
- private static final long serialVersionUID = 1L;
-
- public ExclusiveGatewayImpl(ProcessDefinition procDef, Decision oldDecision)
- {
- super(procDef, oldDecision);
- ExclusiveGatewayDecisionHandler decisionHandler = new ExclusiveGatewayDecisionHandler();
- oldDecision.setDecisionDelegation(new Delegation(decisionHandler));
- }
-
- @Override
- public GatewayType getGatewayType()
- {
- return GatewayType.Exclusive;
- }
-
- @Override
- public ExclusiveType getExclusiveType()
- {
- return ExclusiveType.Data;
- }
-
- class ExclusiveGatewayDecisionHandler implements DecisionHandler
- {
- private static final long serialVersionUID = 1L;
-
- @Override
- public String decide(ExecutionContext executionContext) throws Exception
- {
- ProcessImpl procImpl = (ProcessImpl)getProcess();
- Token token = procImpl.getRootToken();
-
- SequenceFlow selectedGate = null;
- for (SequenceFlow auxGate : getGates())
- {
- SequenceFlow seqFlow = auxGate;
- if (seqFlow.getConditionType() == ConditionType.Expression)
- {
- Expression expr = seqFlow.getConditionExpression();
- ExpressionEvaluator exprEvaluator = new ExpressionEvaluator(expr);
- if ((Boolean)exprEvaluator.evaluateExpression(token))
- {
- selectedGate = auxGate;
- break;
- }
- }
- }
-
- // Use to the default gate if there is one
- if (selectedGate == null)
- {
- for (SequenceFlow auxGate : getGates())
- {
- SequenceFlow seqFlow = auxGate;
- if (seqFlow.getConditionType() == ConditionType.Default)
- {
- selectedGate = auxGate;
- break;
- }
- }
- }
-
- // Fallback to the single outgoing gate that is not conditional
- if (selectedGate == null && getGates().size() == 1)
- {
- SequenceFlow auxGate = getGates().get(0);
- SequenceFlow seqFlow = auxGate;
- if (seqFlow.getConditionType() == ConditionType.None)
- {
- selectedGate = auxGate;
- }
- }
-
- if (selectedGate == null)
- throw new IllegalStateException("Cannot select applicable gate in: " + getOldNode());
-
- return selectedGate.getTargetRef();
- }
- }
-}
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ExclusiveGatewayImpl.java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ExclusiveGatewayImpl.java)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ExclusiveGatewayImpl.java (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ExclusiveGatewayImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,124 @@
+/*
+ * 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.model;
+
+// $Id$
+
+import org.jbpm.api.client.Token;
+import org.jbpm.api.model.ExclusiveGateway;
+import org.jbpm.api.model.Expression;
+import org.jbpm.api.model.ProcessDefinition;
+import org.jbpm.api.model.SequenceFlow;
+import org.jbpm.api.model.SequenceFlow.ConditionType;
+import org.jbpm.graph.exe.ExecutionContext;
+import org.jbpm.graph.node.Decision;
+import org.jbpm.graph.node.DecisionHandler;
+import org.jbpm.instantiation.Delegation;
+import org.jbpm.integration.runtime.ExpressionEvaluator;
+
+/**
+ * An integration wrapper
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 15-Nov-2008
+ */
+public class ExclusiveGatewayImpl extends GatewayImpl implements ExclusiveGateway
+{
+ private static final long serialVersionUID = 1L;
+
+ public ExclusiveGatewayImpl(ProcessDefinition procDef, Decision oldDecision)
+ {
+ super(procDef, oldDecision);
+ ExclusiveGatewayDecisionHandler decisionHandler = new ExclusiveGatewayDecisionHandler();
+ oldDecision.setDecisionDelegation(new Delegation(decisionHandler));
+ }
+
+ @Override
+ public GatewayType getGatewayType()
+ {
+ return GatewayType.Exclusive;
+ }
+
+ @Override
+ public ExclusiveType getExclusiveType()
+ {
+ return ExclusiveType.Data;
+ }
+
+ class ExclusiveGatewayDecisionHandler implements DecisionHandler
+ {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String decide(ExecutionContext executionContext) throws Exception
+ {
+ ProcessImpl procImpl = (ProcessImpl)getProcess();
+ Token token = procImpl.getRootToken();
+
+ SequenceFlow selectedGate = null;
+ for (SequenceFlow auxGate : getGates())
+ {
+ SequenceFlow seqFlow = auxGate;
+ if (seqFlow.getConditionType() == ConditionType.Expression)
+ {
+ Expression expr = seqFlow.getConditionExpression();
+ ExpressionEvaluator exprEvaluator = new ExpressionEvaluator(expr);
+ if ((Boolean)exprEvaluator.evaluateExpression(token))
+ {
+ selectedGate = auxGate;
+ break;
+ }
+ }
+ }
+
+ // Use to the default gate if there is one
+ if (selectedGate == null)
+ {
+ for (SequenceFlow auxGate : getGates())
+ {
+ SequenceFlow seqFlow = auxGate;
+ if (seqFlow.getConditionType() == ConditionType.Default)
+ {
+ selectedGate = auxGate;
+ break;
+ }
+ }
+ }
+
+ // Fallback to the single outgoing gate that is not conditional
+ if (selectedGate == null && getGates().size() == 1)
+ {
+ SequenceFlow auxGate = getGates().get(0);
+ SequenceFlow seqFlow = auxGate;
+ if (seqFlow.getConditionType() == ConditionType.None)
+ {
+ selectedGate = auxGate;
+ }
+ }
+
+ if (selectedGate == null)
+ throw new IllegalStateException("Cannot select applicable gate in: " + getOldNode());
+
+ return selectedGate.getTargetRef();
+ }
+ }
+}
Deleted: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ExpressionImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ExpressionImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ExpressionImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,67 +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.integration.model;
-
-//$Id$
-
-import org.jbpm.api.model.Expression;
-
-/**
- * An Expression, which is used in the definition of attributes for @{link StartEvent},
- *
- * @{link IntermediateEvent}, @{link Activity}, @{link ComplexGateway}, and @{link SequenceFlow}
- *
- * @author thomas.diesler(a)jboss.com
- * @since 17-Nov-2008
- */
-public class ExpressionImpl implements Expression
-{
- // provide serial version UID
- private static final long serialVersionUID = 1L;
-
- private String body;
- private ExpressionLanguage lang;
-
- public ExpressionImpl(String body)
- {
- this.body = body;
- this.lang = ExpressionLanguage.MVEL;
- }
-
- public ExpressionImpl(ExpressionLanguage lang, String body)
- {
- this.body = body;
- this.lang = lang;
- }
-
- @Override
- public ExpressionLanguage getExpressionLanguage()
- {
- return lang;
- }
-
- @Override
- public String getExpressionBody()
- {
- return body;
- }
-}
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ExpressionImpl.java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ExpressionImpl.java)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ExpressionImpl.java (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ExpressionImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,67 @@
+/*
+ * 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.model;
+
+//$Id$
+
+import org.jbpm.api.model.Expression;
+
+/**
+ * An Expression, which is used in the definition of attributes for @{link StartEvent},
+ *
+ * @{link IntermediateEvent}, @{link Activity}, @{link ComplexGateway}, and @{link SequenceFlow}
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 17-Nov-2008
+ */
+public class ExpressionImpl implements Expression
+{
+ // provide serial version UID
+ private static final long serialVersionUID = 1L;
+
+ private String body;
+ private ExpressionLanguage lang;
+
+ public ExpressionImpl(String body)
+ {
+ this.body = body;
+ this.lang = ExpressionLanguage.MVEL;
+ }
+
+ public ExpressionImpl(ExpressionLanguage lang, String body)
+ {
+ this.body = body;
+ this.lang = lang;
+ }
+
+ @Override
+ public ExpressionLanguage getExpressionLanguage()
+ {
+ return lang;
+ }
+
+ @Override
+ public String getExpressionBody()
+ {
+ return body;
+ }
+}
Deleted: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/GatewayImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/GatewayImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/GatewayImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,64 +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.integration.model;
-
-import java.util.List;
-
-import org.jbpm.api.NotImplementedException;
-import org.jbpm.api.model.Gateway;
-import org.jbpm.api.model.ProcessDefinition;
-import org.jbpm.api.model.SequenceFlow;
-import org.jbpm.graph.node.Decision;
-
-/**
- * An integration wrapper
- *
- * @author thomas.diesler(a)jboss.com
- * @since 15-Nov-2008
- */
-public abstract class GatewayImpl extends NodeImpl implements Gateway
-{
- private static final long serialVersionUID = 1L;
-
- public GatewayImpl(ProcessDefinition procDef, Decision oldDecision)
- {
- super(procDef, oldDecision);
- }
-
- @Override
- public List<SequenceFlow> getGates()
- {
- return getOutFlows();
- }
-
- @Override
- public SequenceFlow getGateByName(String targetName)
- {
- throw new NotImplementedException();
- }
-
- @Override
- public SequenceFlow getDefaultGate()
- {
- throw new NotImplementedException();
- }
-}
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/GatewayImpl.java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/GatewayImpl.java)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/GatewayImpl.java (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/GatewayImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -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.integration.model;
+
+import java.util.List;
+
+import org.jbpm.api.NotImplementedException;
+import org.jbpm.api.model.Gateway;
+import org.jbpm.api.model.ProcessDefinition;
+import org.jbpm.api.model.SequenceFlow;
+import org.jbpm.graph.node.Decision;
+
+/**
+ * An integration wrapper
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 15-Nov-2008
+ */
+public abstract class GatewayImpl extends NodeImpl implements Gateway
+{
+ private static final long serialVersionUID = 1L;
+
+ public GatewayImpl(ProcessDefinition procDef, Decision oldDecision)
+ {
+ super(procDef, oldDecision);
+ }
+
+ @Override
+ public List<SequenceFlow> getGates()
+ {
+ return getOutFlows();
+ }
+
+ @Override
+ public SequenceFlow getGateByName(String targetName)
+ {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public SequenceFlow getDefaultGate()
+ {
+ throw new NotImplementedException();
+ }
+}
Deleted: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/NodeImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/NodeImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/NodeImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,120 +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.integration.model;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import javax.management.ObjectName;
-
-import org.jbpm.api.Constants;
-import org.jbpm.api.InvalidProcessException;
-import org.jbpm.api.model.Node;
-import org.jbpm.api.model.Process;
-import org.jbpm.api.model.ProcessDefinition;
-import org.jbpm.api.model.SequenceFlow;
-import org.jbpm.api.model.builder.ObjectNameFactory;
-import org.jbpm.graph.def.Transition;
-
-/**
- * An integration wrapper
- *
- * @author thomas.diesler(a)jboss.com
- * @since 15-Nov-2008
- */
-public class NodeImpl implements Node
-{
- private static final long serialVersionUID = 1L;
-
- private ProcessDefinition procDef;
- private Process proc;
-
- private org.jbpm.graph.def.Node oldNode;
- private List<SequenceFlow> outFlows = new ArrayList<SequenceFlow>();
-
- public NodeImpl(ProcessDefinition procDef, org.jbpm.graph.def.Node oldNode)
- {
- this.procDef = procDef;
- this.oldNode = oldNode;
- }
-
- @Override
- public ObjectName getKey()
- {
- long id = oldNode.getId();
- return ObjectNameFactory.create(Constants.ID_DOMAIN + ":node=" + getName() + ",id=" + id);
- }
-
- public org.jbpm.graph.def.Node getOldNode()
- {
- return oldNode;
- }
-
- @Override
- public String getName()
- {
- return oldNode.getName();
- }
-
- @Override
- public ProcessDefinition getProcessDefinition()
- {
- return procDef;
- }
-
- @Override
- public Process getProcess()
- {
- return proc;
- }
-
- public void setProcess(Process proc)
- {
- this.proc = proc;
- }
-
- public void addSequenceFlow(SequenceFlowImpl flow)
- {
- String targetRef = flow.getTargetRef();
- NodeImpl targetNode = (NodeImpl)procDef.getNode(targetRef);
- if (targetNode == null)
- throw new InvalidProcessException("Cannot obtain target node: " + targetRef);
-
- Transition trans = flow.getOldTransition();
- oldNode.addLeavingTransition(trans);
- targetNode.getOldNode().addArrivingTransition(trans);
-
- outFlows.add(flow);
- }
-
- public List<SequenceFlow> getOutFlows()
- {
- return Collections.unmodifiableList(outFlows);
- }
-
- @Override
- public String toString()
- {
- return oldNode.toString();
- }
-}
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/NodeImpl.java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/NodeImpl.java)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/NodeImpl.java (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/NodeImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,120 @@
+/*
+ * 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.model;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.management.ObjectName;
+
+import org.jbpm.api.Constants;
+import org.jbpm.api.InvalidProcessException;
+import org.jbpm.api.model.Node;
+import org.jbpm.api.model.Process;
+import org.jbpm.api.model.ProcessDefinition;
+import org.jbpm.api.model.SequenceFlow;
+import org.jbpm.api.model.builder.ObjectNameFactory;
+import org.jbpm.graph.def.Transition;
+
+/**
+ * An integration wrapper
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 15-Nov-2008
+ */
+public class NodeImpl implements Node
+{
+ private static final long serialVersionUID = 1L;
+
+ private ProcessDefinition procDef;
+ private Process proc;
+
+ private org.jbpm.graph.def.Node oldNode;
+ private List<SequenceFlow> outFlows = new ArrayList<SequenceFlow>();
+
+ public NodeImpl(ProcessDefinition procDef, org.jbpm.graph.def.Node oldNode)
+ {
+ this.procDef = procDef;
+ this.oldNode = oldNode;
+ }
+
+ @Override
+ public ObjectName getKey()
+ {
+ long id = oldNode.getId();
+ return ObjectNameFactory.create(Constants.ID_DOMAIN + ":node=" + getName() + ",id=" + id);
+ }
+
+ public org.jbpm.graph.def.Node getOldNode()
+ {
+ return oldNode;
+ }
+
+ @Override
+ public String getName()
+ {
+ return oldNode.getName();
+ }
+
+ @Override
+ public ProcessDefinition getProcessDefinition()
+ {
+ return procDef;
+ }
+
+ @Override
+ public Process getProcess()
+ {
+ return proc;
+ }
+
+ public void setProcess(Process proc)
+ {
+ this.proc = proc;
+ }
+
+ public void addSequenceFlow(SequenceFlowImpl flow)
+ {
+ String targetRef = flow.getTargetRef();
+ NodeImpl targetNode = (NodeImpl)procDef.getNode(targetRef);
+ if (targetNode == null)
+ throw new InvalidProcessException("Cannot obtain target node: " + targetRef);
+
+ Transition trans = flow.getOldTransition();
+ oldNode.addLeavingTransition(trans);
+ targetNode.getOldNode().addArrivingTransition(trans);
+
+ outFlows.add(flow);
+ }
+
+ public List<SequenceFlow> getOutFlows()
+ {
+ return Collections.unmodifiableList(outFlows);
+ }
+
+ @Override
+ public String toString()
+ {
+ return oldNode.toString();
+ }
+}
Deleted: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ProcessDefinitionImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ProcessDefinitionImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ProcessDefinitionImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,145 +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.integration.model;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.management.ObjectName;
-
-import org.jbpm.api.Constants;
-import org.jbpm.api.InvalidProcessException;
-import org.jbpm.api.client.ProcessEngine;
-import org.jbpm.api.model.Node;
-import org.jbpm.api.model.Process;
-import org.jbpm.api.model.ProcessDefinition;
-import org.jbpm.api.model.builder.ObjectNameFactory;
-
-/**
- * An integration wrapper
- *
- * @author thomas.diesler(a)jboss.com
- * @since 15-Nov-2008
- */
-public class ProcessDefinitionImpl implements ProcessDefinition
-{
- private static final long serialVersionUID = 1L;
-
- private org.jbpm.graph.def.ProcessDefinition oldProcDef;
- private ProcessEngine engine;
- private Map<String, Node> nodes = new LinkedHashMap<String, Node>();
-
- public ProcessDefinitionImpl(ProcessEngine engine, String name)
- {
- this.oldProcDef = new org.jbpm.graph.def.ProcessDefinition(name);
- this.engine = engine;
-
- if (name == null)
- throw new InvalidProcessException("ProcessDefinition name cannot be null");
- }
-
-
- public org.jbpm.graph.def.ProcessDefinition getOldProcessDefinition()
- {
- return oldProcDef;
- }
-
-
- @Override
- public ProcessEngine getProcessEngine()
- {
- return engine;
- }
-
- @Override
- public ObjectName getKey()
- {
- long id = oldProcDef.getId();
- return ObjectNameFactory.create(Constants.ID_DOMAIN + ":procdef=" + getName() + ",id=" + id);
- }
-
- @Override
- public String getName()
- {
- return oldProcDef.getName();
- }
-
- @Override
- public Process newInstance()
- {
- ProcessImpl procImpl = new ProcessImpl(this);
- for (Node node : getNodes())
- {
- NodeImpl nodeImpl = (NodeImpl)node;
- nodeImpl.setProcess(procImpl);
- }
- return procImpl;
- }
-
- public void addNode(NodeImpl nodeImpl)
- {
- org.jbpm.graph.def.Node oldNode = nodeImpl.getOldNode();
- oldProcDef.addNode(oldNode);
- nodes.put(oldNode.getName(), nodeImpl);
- }
-
- @Override
- public Node getNode(String name)
- {
- return nodes.get(name);
- }
-
- @Override
- public List<Node> getNodes()
- {
- List<Node> nodeList = new ArrayList<Node>(nodes.values());
- return Collections.unmodifiableList(nodeList);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends Node> T getNode(Class<T> clazz, String name)
- {
- for (Node node : getNodes(clazz))
- {
- if (node.getName().equals(name))
- return (T)node;
- }
- return null;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends Node> List<T> getNodes(Class<T> clazz)
- {
- List<T> retNodes = new ArrayList<T>();
- for (Node node : getNodes())
- {
- if (clazz.isAssignableFrom(node.getClass()))
- retNodes.add((T)node);
- }
- return retNodes;
- }
-}
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ProcessDefinitionImpl.java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ProcessDefinitionImpl.java)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ProcessDefinitionImpl.java (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ProcessDefinitionImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,145 @@
+/*
+ * 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.model;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.ObjectName;
+
+import org.jbpm.api.Constants;
+import org.jbpm.api.InvalidProcessException;
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.model.Node;
+import org.jbpm.api.model.Process;
+import org.jbpm.api.model.ProcessDefinition;
+import org.jbpm.api.model.builder.ObjectNameFactory;
+
+/**
+ * An integration wrapper
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 15-Nov-2008
+ */
+public class ProcessDefinitionImpl implements ProcessDefinition
+{
+ private static final long serialVersionUID = 1L;
+
+ private org.jbpm.graph.def.ProcessDefinition oldProcDef;
+ private ProcessEngine engine;
+ private Map<String, Node> nodes = new LinkedHashMap<String, Node>();
+
+ public ProcessDefinitionImpl(ProcessEngine engine, String name)
+ {
+ this.oldProcDef = new org.jbpm.graph.def.ProcessDefinition(name);
+ this.engine = engine;
+
+ if (name == null)
+ throw new InvalidProcessException("ProcessDefinition name cannot be null");
+ }
+
+
+ public org.jbpm.graph.def.ProcessDefinition getOldProcessDefinition()
+ {
+ return oldProcDef;
+ }
+
+
+ @Override
+ public ProcessEngine getProcessEngine()
+ {
+ return engine;
+ }
+
+ @Override
+ public ObjectName getKey()
+ {
+ long id = oldProcDef.getId();
+ return ObjectNameFactory.create(Constants.ID_DOMAIN + ":procdef=" + getName() + ",id=" + id);
+ }
+
+ @Override
+ public String getName()
+ {
+ return oldProcDef.getName();
+ }
+
+ @Override
+ public Process newInstance()
+ {
+ ProcessImpl procImpl = new ProcessImpl(this);
+ for (Node node : getNodes())
+ {
+ NodeImpl nodeImpl = (NodeImpl)node;
+ nodeImpl.setProcess(procImpl);
+ }
+ return procImpl;
+ }
+
+ public void addNode(NodeImpl nodeImpl)
+ {
+ org.jbpm.graph.def.Node oldNode = nodeImpl.getOldNode();
+ oldProcDef.addNode(oldNode);
+ nodes.put(oldNode.getName(), nodeImpl);
+ }
+
+ @Override
+ public Node getNode(String name)
+ {
+ return nodes.get(name);
+ }
+
+ @Override
+ public List<Node> getNodes()
+ {
+ List<Node> nodeList = new ArrayList<Node>(nodes.values());
+ return Collections.unmodifiableList(nodeList);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends Node> T getNode(Class<T> clazz, String name)
+ {
+ for (Node node : getNodes(clazz))
+ {
+ if (node.getName().equals(name))
+ return (T)node;
+ }
+ return null;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends Node> List<T> getNodes(Class<T> clazz)
+ {
+ List<T> retNodes = new ArrayList<T>();
+ for (Node node : getNodes())
+ {
+ if (clazz.isAssignableFrom(node.getClass()))
+ retNodes.add((T)node);
+ }
+ return retNodes;
+ }
+}
Deleted: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ProcessImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ProcessImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ProcessImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,145 +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.integration.model;
-
-import java.util.List;
-
-import javax.management.ObjectName;
-
-import org.jbpm.api.Constants;
-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.Process;
-import org.jbpm.api.model.ProcessDefinition;
-import org.jbpm.api.model.builder.ObjectNameFactory;
-import org.jbpm.api.runtime.Attachments;
-import org.jbpm.graph.exe.ProcessInstance;
-import org.jbpm.integration.client.TokenImpl;
-
-/**
- * An integration wrapper
- *
- * @author thomas.diesler(a)jboss.com
- * @since 15-Nov-2008
- */
-public class ProcessImpl implements Process
-{
- private static final long serialVersionUID = 1L;
-
- private ProcessDefinitionImpl procDef;
- private ProcessInstance oldProc;
- private ProcessStatus procStatus = ProcessStatus.None;
- private Token rootToken;
-
- public ProcessImpl(ProcessDefinitionImpl procDef)
- {
- this.procDef = procDef;
- }
-
- @Override
- public ObjectName getKey()
- {
- long id = oldProc != null ? oldProc.getId() : 0;
- return ObjectNameFactory.create(Constants.ID_DOMAIN + ":proc=" + getName() + ",id=" + id);
- }
-
- @Override
- public ProcessDefinition getProcessDefinition()
- {
- return procDef;
- }
-
- @Override
- public ProcessEngine getProcessEngine()
- {
- return procDef.getProcessEngine();
- }
-
- @Override
- public ProcessStatus getProcessStatus()
- {
- if (rootToken != null && procStatus == ProcessStatus.Active)
- {
- if (rootToken.getTokenStatus() == TokenStatus.Destroyed)
- procStatus = ProcessStatus.Completed;
- }
- return procStatus;
- }
-
- public void setProcessStatus(ProcessStatus procStatus)
- {
- this.procStatus = procStatus;
- }
-
- @Override
- public String getName()
- {
- return procDef.getName();
- }
-
- @Override
- public <T extends Node> T getNode(Class<T> clazz, String name)
- {
- return procDef.getNode(clazz, name);
- }
-
- @Override
- public Node getNode(String name)
- {
- return procDef.getNode(name);
- }
-
- @Override
- public List<Node> getNodes()
- {
- return procDef.getNodes();
- }
-
- @Override
- public <T extends Node> List<T> getNodes(Class<T> clazz)
- {
- return procDef.getNodes(clazz);
- }
-
- @Override
- public Token startProcess()
- {
- return startProcess(null);
- }
-
- @Override
- public Token startProcess(Attachments att)
- {
- setProcessStatus(ProcessStatus.Active);
- oldProc = new ProcessInstance(procDef.getOldProcessDefinition());
- rootToken = new TokenImpl(this, oldProc.getRootToken(), att);
- rootToken.signal();
- return rootToken;
- }
-
- public Token getRootToken()
- {
- return rootToken;
- }
-}
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ProcessImpl.java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ProcessImpl.java)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ProcessImpl.java (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/ProcessImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,145 @@
+/*
+ * 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.model;
+
+import java.util.List;
+
+import javax.management.ObjectName;
+
+import org.jbpm.api.Constants;
+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.Process;
+import org.jbpm.api.model.ProcessDefinition;
+import org.jbpm.api.model.builder.ObjectNameFactory;
+import org.jbpm.api.runtime.Attachments;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.integration.client.TokenImpl;
+
+/**
+ * An integration wrapper
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 15-Nov-2008
+ */
+public class ProcessImpl implements Process
+{
+ private static final long serialVersionUID = 1L;
+
+ private ProcessDefinitionImpl procDef;
+ private ProcessInstance oldProc;
+ private ProcessStatus procStatus = ProcessStatus.None;
+ private Token rootToken;
+
+ public ProcessImpl(ProcessDefinitionImpl procDef)
+ {
+ this.procDef = procDef;
+ }
+
+ @Override
+ public ObjectName getKey()
+ {
+ long id = oldProc != null ? oldProc.getId() : 0;
+ return ObjectNameFactory.create(Constants.ID_DOMAIN + ":proc=" + getName() + ",id=" + id);
+ }
+
+ @Override
+ public ProcessDefinition getProcessDefinition()
+ {
+ return procDef;
+ }
+
+ @Override
+ public ProcessEngine getProcessEngine()
+ {
+ return procDef.getProcessEngine();
+ }
+
+ @Override
+ public ProcessStatus getProcessStatus()
+ {
+ if (rootToken != null && procStatus == ProcessStatus.Active)
+ {
+ if (rootToken.getTokenStatus() == TokenStatus.Destroyed)
+ procStatus = ProcessStatus.Completed;
+ }
+ return procStatus;
+ }
+
+ public void setProcessStatus(ProcessStatus procStatus)
+ {
+ this.procStatus = procStatus;
+ }
+
+ @Override
+ public String getName()
+ {
+ return procDef.getName();
+ }
+
+ @Override
+ public <T extends Node> T getNode(Class<T> clazz, String name)
+ {
+ return procDef.getNode(clazz, name);
+ }
+
+ @Override
+ public Node getNode(String name)
+ {
+ return procDef.getNode(name);
+ }
+
+ @Override
+ public List<Node> getNodes()
+ {
+ return procDef.getNodes();
+ }
+
+ @Override
+ public <T extends Node> List<T> getNodes(Class<T> clazz)
+ {
+ return procDef.getNodes(clazz);
+ }
+
+ @Override
+ public Token startProcess()
+ {
+ return startProcess(null);
+ }
+
+ @Override
+ public Token startProcess(Attachments att)
+ {
+ setProcessStatus(ProcessStatus.Active);
+ oldProc = new ProcessInstance(procDef.getOldProcessDefinition());
+ rootToken = new TokenImpl(this, oldProc.getRootToken(), att);
+ rootToken.signal();
+ return rootToken;
+ }
+
+ public Token getRootToken()
+ {
+ return rootToken;
+ }
+}
Deleted: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/SequenceFlowImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/SequenceFlowImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/SequenceFlowImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,90 +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.integration.model;
-
-import org.jbpm.api.model.Expression;
-import org.jbpm.api.model.SequenceFlow;
-import org.jbpm.api.model.Expression.ExpressionLanguage;
-import org.jbpm.graph.def.Node;
-import org.jbpm.graph.def.Transition;
-
-/**
- * An integration wrapper
- *
- * @author thomas.diesler(a)jboss.com
- * @since 15-Nov-2008
- */
-public class SequenceFlowImpl implements SequenceFlow
-{
- private static final long serialVersionUID = 1L;
-
- private Transition oldTrans;
- private ConditionType condType = ConditionType.None;
- private Expression expr;
-
- public SequenceFlowImpl(Transition oldTrans)
- {
- this.oldTrans = oldTrans;
- }
-
- public SequenceFlowImpl(Transition oldTrans, ExpressionLanguage exprLang, String exprBody)
- {
- this.oldTrans = oldTrans;
-
- if (exprLang != null && exprBody != null)
- {
- this.condType = ConditionType.Expression;
- this.expr = new ExpressionImpl(exprLang, exprBody);
- }
- }
-
- public Transition getOldTransition()
- {
- return oldTrans;
- }
-
- @Override
- public Expression getConditionExpression()
- {
- return expr;
- }
-
- @Override
- public ConditionType getConditionType()
- {
- return condType;
- }
-
- @Override
- public String getSourceRef()
- {
- Node from = oldTrans.getFrom();
- return from != null ? from.getName() : null;
- }
-
- @Override
- public String getTargetRef()
- {
- Node to = oldTrans.getTo();
- return to != null ? to.getName() : null;
- }
-}
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/SequenceFlowImpl.java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/SequenceFlowImpl.java)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/SequenceFlowImpl.java (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/SequenceFlowImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,90 @@
+/*
+ * 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.model;
+
+import org.jbpm.api.model.Expression;
+import org.jbpm.api.model.SequenceFlow;
+import org.jbpm.api.model.Expression.ExpressionLanguage;
+import org.jbpm.graph.def.Node;
+import org.jbpm.graph.def.Transition;
+
+/**
+ * An integration wrapper
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 15-Nov-2008
+ */
+public class SequenceFlowImpl implements SequenceFlow
+{
+ private static final long serialVersionUID = 1L;
+
+ private Transition oldTrans;
+ private ConditionType condType = ConditionType.None;
+ private Expression expr;
+
+ public SequenceFlowImpl(Transition oldTrans)
+ {
+ this.oldTrans = oldTrans;
+ }
+
+ public SequenceFlowImpl(Transition oldTrans, ExpressionLanguage exprLang, String exprBody)
+ {
+ this.oldTrans = oldTrans;
+
+ if (exprLang != null && exprBody != null)
+ {
+ this.condType = ConditionType.Expression;
+ this.expr = new ExpressionImpl(exprLang, exprBody);
+ }
+ }
+
+ public Transition getOldTransition()
+ {
+ return oldTrans;
+ }
+
+ @Override
+ public Expression getConditionExpression()
+ {
+ return expr;
+ }
+
+ @Override
+ public ConditionType getConditionType()
+ {
+ return condType;
+ }
+
+ @Override
+ public String getSourceRef()
+ {
+ Node from = oldTrans.getFrom();
+ return from != null ? from.getName() : null;
+ }
+
+ @Override
+ public String getTargetRef()
+ {
+ Node to = oldTrans.getTo();
+ return to != null ? to.getName() : null;
+ }
+}
Deleted: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/StartEventImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/StartEventImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/StartEventImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,80 +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.integration.model;
-
-import java.util.List;
-
-import org.jbpm.api.InvalidProcessException;
-import org.jbpm.api.NotImplementedException;
-import org.jbpm.api.model.ProcessDefinition;
-import org.jbpm.api.model.SequenceFlow;
-import org.jbpm.api.model.StartEvent;
-import org.jbpm.graph.def.Transition;
-import org.jbpm.graph.node.StartState;
-
-/**
- * An integration wrapper
- *
- * @author thomas.diesler(a)jboss.com
- * @since 15-Nov-2008
- */
-public class StartEventImpl extends NodeImpl implements StartEvent
-{
- private static final long serialVersionUID = 1L;
-
- private StartState oldStart;
-
- public StartEventImpl(ProcessDefinition procDef, StartState oldStart)
- {
- super(procDef, oldStart);
- this.oldStart = oldStart;
-
- if (oldStart.getName() == null)
- throw new InvalidProcessException("StartEvent name cannot be null");
- }
-
- @Override
- public EventDetailType getTriggerType()
- {
- return EventDetailType.None;
- }
-
- @Override
- public EventType getEventType()
- {
- return EventType.Start;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public SequenceFlow getOutFlow()
- {
- List<Transition> leavingTransitions = oldStart.getLeavingTransitions();
- if (leavingTransitions == null)
- throw new IllegalStateException ("No leaving transitions on: " + oldStart);
- if (leavingTransitions.size() > 1)
- throw new NotImplementedException ("Multiple leaving transitions on: " + oldStart);
-
- Transition to = leavingTransitions.get(0);
- return new SequenceFlowImpl(to);
- }
-}
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/StartEventImpl.java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/StartEventImpl.java)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/StartEventImpl.java (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/StartEventImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,80 @@
+/*
+ * 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.model;
+
+import java.util.List;
+
+import org.jbpm.api.InvalidProcessException;
+import org.jbpm.api.NotImplementedException;
+import org.jbpm.api.model.ProcessDefinition;
+import org.jbpm.api.model.SequenceFlow;
+import org.jbpm.api.model.StartEvent;
+import org.jbpm.graph.def.Transition;
+import org.jbpm.graph.node.StartState;
+
+/**
+ * An integration wrapper
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 15-Nov-2008
+ */
+public class StartEventImpl extends NodeImpl implements StartEvent
+{
+ private static final long serialVersionUID = 1L;
+
+ private StartState oldStart;
+
+ public StartEventImpl(ProcessDefinition procDef, StartState oldStart)
+ {
+ super(procDef, oldStart);
+ this.oldStart = oldStart;
+
+ if (oldStart.getName() == null)
+ throw new InvalidProcessException("StartEvent name cannot be null");
+ }
+
+ @Override
+ public EventDetailType getTriggerType()
+ {
+ return EventDetailType.None;
+ }
+
+ @Override
+ public EventType getEventType()
+ {
+ return EventType.Start;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public SequenceFlow getOutFlow()
+ {
+ List<Transition> leavingTransitions = oldStart.getLeavingTransitions();
+ if (leavingTransitions == null)
+ throw new IllegalStateException ("No leaving transitions on: " + oldStart);
+ if (leavingTransitions.size() > 1)
+ throw new NotImplementedException ("Multiple leaving transitions on: " + oldStart);
+
+ Transition to = leavingTransitions.get(0);
+ return new SequenceFlowImpl(to);
+ }
+}
Deleted: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/TaskImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/TaskImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/TaskImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,82 +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.integration.model;
-
-import java.util.List;
-import java.util.Set;
-
-import org.jbpm.api.NotImplementedException;
-import org.jbpm.api.model.ProcessDefinition;
-import org.jbpm.api.model.SequenceFlow;
-import org.jbpm.api.model.Task;
-import org.jbpm.graph.def.Node;
-import org.jbpm.graph.def.Transition;
-
-/**
- * An integration wrapper
- *
- * @author thomas.diesler(a)jboss.com
- * @since 15-Nov-2008
- */
-public class TaskImpl extends NodeImpl implements Task
-{
- private static final long serialVersionUID = 1L;
-
- public TaskImpl(ProcessDefinition procDef, org.jbpm.graph.def.Node oldNode)
- {
- super(procDef, oldNode);
- }
-
- @Override
- public TaskType getTaskType()
- {
- return TaskType.None;
- }
-
- @Override
- public SequenceFlow getInFlow()
- {
- Node oldNode = getOldNode();
- Set<Transition> arrivingTransitions = oldNode.getArrivingTransitions();
- if (arrivingTransitions == null)
- throw new IllegalStateException("No leaving transitions on: " + oldNode);
- if (arrivingTransitions.size() > 1)
- throw new NotImplementedException("Multiple leaving transitions on: " + oldNode);
-
- Transition from = arrivingTransitions.iterator().next();
- return new SequenceFlowImpl(from);
- }
-
- @Override
- public SequenceFlow getOutFlow()
- {
- Node oldNode = getOldNode();
- List<Transition> leavingTransitions = oldNode.getLeavingTransitions();
- if (leavingTransitions == null)
- throw new IllegalStateException("No leaving transitions on: " + oldNode);
- if (leavingTransitions.size() > 1)
- throw new NotImplementedException("Multiple leaving transitions on: " + oldNode);
-
- Transition to = leavingTransitions.get(0);
- return new SequenceFlowImpl(to);
- }
-}
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/TaskImpl.java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/TaskImpl.java)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/TaskImpl.java (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/TaskImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,82 @@
+/*
+ * 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.model;
+
+import java.util.List;
+import java.util.Set;
+
+import org.jbpm.api.NotImplementedException;
+import org.jbpm.api.model.ProcessDefinition;
+import org.jbpm.api.model.SequenceFlow;
+import org.jbpm.api.model.Task;
+import org.jbpm.graph.def.Node;
+import org.jbpm.graph.def.Transition;
+
+/**
+ * An integration wrapper
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 15-Nov-2008
+ */
+public class TaskImpl extends NodeImpl implements Task
+{
+ private static final long serialVersionUID = 1L;
+
+ public TaskImpl(ProcessDefinition procDef, org.jbpm.graph.def.Node oldNode)
+ {
+ super(procDef, oldNode);
+ }
+
+ @Override
+ public TaskType getTaskType()
+ {
+ return TaskType.None;
+ }
+
+ @Override
+ public SequenceFlow getInFlow()
+ {
+ Node oldNode = getOldNode();
+ Set<Transition> arrivingTransitions = oldNode.getArrivingTransitions();
+ if (arrivingTransitions == null)
+ throw new IllegalStateException("No leaving transitions on: " + oldNode);
+ if (arrivingTransitions.size() > 1)
+ throw new NotImplementedException("Multiple leaving transitions on: " + oldNode);
+
+ Transition from = arrivingTransitions.iterator().next();
+ return new SequenceFlowImpl(from);
+ }
+
+ @Override
+ public SequenceFlow getOutFlow()
+ {
+ Node oldNode = getOldNode();
+ List<Transition> leavingTransitions = oldNode.getLeavingTransitions();
+ if (leavingTransitions == null)
+ throw new IllegalStateException("No leaving transitions on: " + oldNode);
+ if (leavingTransitions.size() > 1)
+ throw new NotImplementedException("Multiple leaving transitions on: " + oldNode);
+
+ Transition to = leavingTransitions.get(0);
+ return new SequenceFlowImpl(to);
+ }
+}
Deleted: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/WaitStateImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/WaitStateImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/WaitStateImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,48 +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.integration.model;
-
-import org.jbpm.api.model.ProcessDefinition;
-import org.jbpm.api.model.WaitState;
-import org.jbpm.graph.node.State;
-
-/**
- * An integration wrapper
- *
- * @author thomas.diesler(a)jboss.com
- * @since 15-Nov-2008
- */
-public class WaitStateImpl extends TaskImpl implements WaitState
-{
- private static final long serialVersionUID = 1L;
-
- public WaitStateImpl(ProcessDefinition procDef, State oldState)
- {
- super(procDef, oldState);
- }
-
- @Override
- public TaskType getTaskType()
- {
- return TaskType.Wait;
- }
-}
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/WaitStateImpl.java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/WaitStateImpl.java)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/WaitStateImpl.java (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/WaitStateImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,48 @@
+/*
+ * 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.model;
+
+import org.jbpm.api.model.ProcessDefinition;
+import org.jbpm.api.model.WaitState;
+import org.jbpm.graph.node.State;
+
+/**
+ * An integration wrapper
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 15-Nov-2008
+ */
+public class WaitStateImpl extends TaskImpl implements WaitState
+{
+ private static final long serialVersionUID = 1L;
+
+ public WaitStateImpl(ProcessDefinition procDef, State oldState)
+ {
+ super(procDef, oldState);
+ }
+
+ @Override
+ public TaskType getTaskType()
+ {
+ return TaskType.Wait;
+ }
+}
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/builder (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/builder)
Deleted: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/builder/GatewayBuilderImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/builder/GatewayBuilderImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/builder/GatewayBuilderImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,62 +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.integration.model.builder;
-
-//$Id$
-
-import org.jbpm.api.NotImplementedException;
-import org.jbpm.api.model.Expression.ExpressionLanguage;
-import org.jbpm.api.model.builder.GatewayBuilder;
-
-/**
- * The GatewayBuilder can be used to build a Gateway dynamically.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 15-Nov-2008
- */
-public class GatewayBuilderImpl extends ProcessBuilderImpl implements GatewayBuilder
-{
- protected GatewayBuilderImpl(ProcessBuilderImpl procBuilder)
- {
- super(procBuilder);
- }
-
- @Override
- public GatewayBuilder addGate(String targetName)
- {
- addSequenceFlow(targetName);
- return this;
- }
-
- @Override
- public GatewayBuilder addConditionalGate(String targetName, ExpressionLanguage exprLang, String exprBody)
- {
- addSequenceFlow(targetName, exprLang, exprBody);
- return this;
- }
-
- @Override
- public GatewayBuilder addDefaultGate(String targetName)
- {
- throw new NotImplementedException();
- }
-}
\ No newline at end of file
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/builder/GatewayBuilderImpl.java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/builder/GatewayBuilderImpl.java)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/builder/GatewayBuilderImpl.java (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/builder/GatewayBuilderImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,62 @@
+/*
+ * 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.model.builder;
+
+//$Id$
+
+import org.jbpm.api.NotImplementedException;
+import org.jbpm.api.model.Expression.ExpressionLanguage;
+import org.jbpm.api.model.builder.GatewayBuilder;
+
+/**
+ * The GatewayBuilder can be used to build a Gateway dynamically.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 15-Nov-2008
+ */
+public class GatewayBuilderImpl extends ProcessBuilderImpl implements GatewayBuilder
+{
+ protected GatewayBuilderImpl(ProcessBuilderImpl procBuilder)
+ {
+ super(procBuilder);
+ }
+
+ @Override
+ public GatewayBuilder addGate(String targetName)
+ {
+ addSequenceFlow(targetName);
+ return this;
+ }
+
+ @Override
+ public GatewayBuilder addConditionalGate(String targetName, ExpressionLanguage exprLang, String exprBody)
+ {
+ addSequenceFlow(targetName, exprLang, exprBody);
+ return this;
+ }
+
+ @Override
+ public GatewayBuilder addDefaultGate(String targetName)
+ {
+ throw new NotImplementedException();
+ }
+}
\ No newline at end of file
Deleted: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/builder/ProcessBuilderImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/builder/ProcessBuilderImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/builder/ProcessBuilderImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,232 +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.integration.model.builder;
-
-//$Id$
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.jbpm.api.InvalidProcessException;
-import org.jbpm.api.NotImplementedException;
-import org.jbpm.api.client.ProcessEngine;
-import org.jbpm.api.model.EndEvent;
-import org.jbpm.api.model.Node;
-import org.jbpm.api.model.Process;
-import org.jbpm.api.model.ProcessDefinition;
-import org.jbpm.api.model.StartEvent;
-import org.jbpm.api.model.Expression.ExpressionLanguage;
-import org.jbpm.api.model.Gateway.GatewayType;
-import org.jbpm.api.model.Task.TaskType;
-import org.jbpm.api.model.builder.GatewayBuilder;
-import org.jbpm.api.model.builder.ProcessBuilder;
-import org.jbpm.graph.def.Transition;
-import org.jbpm.graph.node.Decision;
-import org.jbpm.graph.node.EndState;
-import org.jbpm.graph.node.StartState;
-import org.jbpm.graph.node.State;
-import org.jbpm.integration.model.EndEventImpl;
-import org.jbpm.integration.model.ExclusiveGatewayImpl;
-import org.jbpm.integration.model.NodeImpl;
-import org.jbpm.integration.model.ProcessDefinitionImpl;
-import org.jbpm.integration.model.SequenceFlowImpl;
-import org.jbpm.integration.model.StartEventImpl;
-import org.jbpm.integration.model.TaskImpl;
-import org.jbpm.integration.model.WaitStateImpl;
-
-/**
- * The ProcessBuilder can be used to dynamically build a {@link Process}.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 15-Nov-2008
- */
-public class ProcessBuilderImpl implements ProcessBuilder
-{
- protected ProcessEngine engine;
- protected ProcessDefinitionImpl procDefImpl;
- protected NodeImpl nodeImpl;
-
- private List<FlowSpec> flows = new ArrayList<FlowSpec>();
-
- public ProcessBuilderImpl(ProcessEngine engine)
- {
- this.engine = engine;
- }
-
- protected ProcessBuilderImpl(ProcessBuilderImpl procBuilder)
- {
- this.engine = procBuilder.engine;
- this.procDefImpl = procBuilder.procDefImpl;
- this.nodeImpl = procBuilder.nodeImpl;
- this.flows = procBuilder.flows;
- }
-
- @Override
- public ProcessBuilder addProcess(String name)
- {
- procDefImpl = new ProcessDefinitionImpl(engine, name);
- return this;
- }
-
- @Override
- public ProcessDefinition getProcessDefinition()
- {
- initProcessDefinition();
- return procDefImpl;
- }
-
- @Override
- public ProcessBuilder addStartEvent(String name)
- {
- nodeImpl = new StartEventImpl(procDefImpl, new StartState(name));
- procDefImpl.addNode(nodeImpl);
- return this;
- }
-
- @Override
- public GatewayBuilder addGateway(String name, GatewayType type)
- {
- if (type == GatewayType.Exclusive)
- {
- nodeImpl = new ExclusiveGatewayImpl(procDefImpl, new Decision(name));
- procDefImpl.addNode(nodeImpl);
- }
- else
- {
- throw new NotImplementedException("Unsupported gateway type: " + type);
- }
- return new GatewayBuilderImpl(this);
- }
-
- @Override
- public ProcessBuilder addTask(String name)
- {
- return addTask(name, TaskType.None);
- }
-
- @Override
- public ProcessBuilder addTask(String name, TaskType type)
- {
- if (type == TaskType.None)
- {
- nodeImpl = new TaskImpl(procDefImpl, new org.jbpm.graph.def.Node(name));
- procDefImpl.addNode(nodeImpl);
- }
- else if (type == TaskType.Wait)
- {
- nodeImpl = new WaitStateImpl(procDefImpl, new State(name));
- procDefImpl.addNode(nodeImpl);
- }
- else
- {
- throw new NotImplementedException("Unsupported task type: " + type);
- }
- return this;
- }
-
- @Override
- public ProcessBuilder addEndEvent(String name)
- {
- nodeImpl = new EndEventImpl(procDefImpl, new EndState(name));
- procDefImpl.addNode(nodeImpl);
- return this;
- }
-
- @Override
- public ProcessBuilder addSequenceFlow(String targetName)
- {
- return addSequenceFlow(targetName, null, null);
- }
-
- public ProcessBuilder addSequenceFlow(String targetName, ExpressionLanguage exprLang, String exprBody)
- {
- flows.add(new FlowSpec(nodeImpl.getName(), targetName, exprLang, exprBody));
- return this;
- }
-
- class FlowSpec
- {
- String source;
- String target;
- ExpressionLanguage exprLang;
- String exprBody;
-
- public FlowSpec(String source, String target, ExpressionLanguage exprLang, String exprBody)
- {
- this.source = source;
- this.target = target;
- this.exprLang = exprLang;
- this.exprBody = exprBody;
- }
- }
-
- private void initProcessDefinition()
- {
- // Initialize the flows
- for (FlowSpec flow : flows)
- {
- NodeImpl srcNode = (NodeImpl)procDefImpl.getNode(flow.source);
- if (srcNode == null)
- throw new InvalidProcessException("Cannot obtain source node: " + flow.source);
-
- NodeImpl targetNode = (NodeImpl)procDefImpl.getNode(flow.target);
- if (targetNode == null)
- throw new InvalidProcessException("Cannot obtain target node: " + flow.target);
-
- Transition trans = new Transition(flow.target);
- trans.setFrom(srcNode.getOldNode());
- trans.setTo(targetNode.getOldNode());
-
- SequenceFlowImpl seqFlow = new SequenceFlowImpl(trans, flow.exprLang, flow.exprBody);
- srcNode.addSequenceFlow(seqFlow);
- }
-
- // Verify that there is a start event
- List<StartEvent> startEvents = procDefImpl.getNodes(StartEvent.class);
- if (startEvents.size() == 0)
- throw new InvalidProcessException("Cannot obtain a start event");
-
- // Verify that there is an end event
- List<EndEvent> endEvents = procDefImpl.getNodes(EndEvent.class);
- if (endEvents.size() == 0)
- throw new InvalidProcessException("Cannot obtain an end event");
-
- // Detect unreachable nodes
- for (Node node : procDefImpl.getNodes())
- {
- NodeImpl nodeImpl = (NodeImpl)node;
- Set arriving = nodeImpl.getOldNode().getArrivingTransitions();
- if (!(node instanceof StartEvent) && arriving == null)
- throw new InvalidProcessException("Unreachable node: " + node);
- }
-
- // Detect dead end nodes
- for (Node node : procDefImpl.getNodes())
- {
- NodeImpl nodeImpl = (NodeImpl)node;
- List leaving = nodeImpl.getOldNode().getLeavingTransitions();
- if (!(node instanceof EndEvent) && leaving == null)
- throw new InvalidProcessException("Dead end node: " + node);
- }
- }
-}
\ No newline at end of file
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/builder/ProcessBuilderImpl.java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/builder/ProcessBuilderImpl.java)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/builder/ProcessBuilderImpl.java (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/model/builder/ProcessBuilderImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,232 @@
+/*
+ * 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.model.builder;
+
+//$Id$
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.jbpm.api.InvalidProcessException;
+import org.jbpm.api.NotImplementedException;
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.model.EndEvent;
+import org.jbpm.api.model.Node;
+import org.jbpm.api.model.Process;
+import org.jbpm.api.model.ProcessDefinition;
+import org.jbpm.api.model.StartEvent;
+import org.jbpm.api.model.Expression.ExpressionLanguage;
+import org.jbpm.api.model.Gateway.GatewayType;
+import org.jbpm.api.model.Task.TaskType;
+import org.jbpm.api.model.builder.GatewayBuilder;
+import org.jbpm.api.model.builder.ProcessBuilder;
+import org.jbpm.graph.def.Transition;
+import org.jbpm.graph.node.Decision;
+import org.jbpm.graph.node.EndState;
+import org.jbpm.graph.node.StartState;
+import org.jbpm.graph.node.State;
+import org.jbpm.integration.model.EndEventImpl;
+import org.jbpm.integration.model.ExclusiveGatewayImpl;
+import org.jbpm.integration.model.NodeImpl;
+import org.jbpm.integration.model.ProcessDefinitionImpl;
+import org.jbpm.integration.model.SequenceFlowImpl;
+import org.jbpm.integration.model.StartEventImpl;
+import org.jbpm.integration.model.TaskImpl;
+import org.jbpm.integration.model.WaitStateImpl;
+
+/**
+ * The ProcessBuilder can be used to dynamically build a {@link Process}.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 15-Nov-2008
+ */
+public class ProcessBuilderImpl implements ProcessBuilder
+{
+ protected ProcessEngine engine;
+ protected ProcessDefinitionImpl procDefImpl;
+ protected NodeImpl nodeImpl;
+
+ private List<FlowSpec> flows = new ArrayList<FlowSpec>();
+
+ public ProcessBuilderImpl(ProcessEngine engine)
+ {
+ this.engine = engine;
+ }
+
+ protected ProcessBuilderImpl(ProcessBuilderImpl procBuilder)
+ {
+ this.engine = procBuilder.engine;
+ this.procDefImpl = procBuilder.procDefImpl;
+ this.nodeImpl = procBuilder.nodeImpl;
+ this.flows = procBuilder.flows;
+ }
+
+ @Override
+ public ProcessBuilder addProcess(String name)
+ {
+ procDefImpl = new ProcessDefinitionImpl(engine, name);
+ return this;
+ }
+
+ @Override
+ public ProcessDefinition getProcessDefinition()
+ {
+ initProcessDefinition();
+ return procDefImpl;
+ }
+
+ @Override
+ public ProcessBuilder addStartEvent(String name)
+ {
+ nodeImpl = new StartEventImpl(procDefImpl, new StartState(name));
+ procDefImpl.addNode(nodeImpl);
+ return this;
+ }
+
+ @Override
+ public GatewayBuilder addGateway(String name, GatewayType type)
+ {
+ if (type == GatewayType.Exclusive)
+ {
+ nodeImpl = new ExclusiveGatewayImpl(procDefImpl, new Decision(name));
+ procDefImpl.addNode(nodeImpl);
+ }
+ else
+ {
+ throw new NotImplementedException("Unsupported gateway type: " + type);
+ }
+ return new GatewayBuilderImpl(this);
+ }
+
+ @Override
+ public ProcessBuilder addTask(String name)
+ {
+ return addTask(name, TaskType.None);
+ }
+
+ @Override
+ public ProcessBuilder addTask(String name, TaskType type)
+ {
+ if (type == TaskType.None)
+ {
+ nodeImpl = new TaskImpl(procDefImpl, new org.jbpm.graph.def.Node(name));
+ procDefImpl.addNode(nodeImpl);
+ }
+ else if (type == TaskType.Wait)
+ {
+ nodeImpl = new WaitStateImpl(procDefImpl, new State(name));
+ procDefImpl.addNode(nodeImpl);
+ }
+ else
+ {
+ throw new NotImplementedException("Unsupported task type: " + type);
+ }
+ return this;
+ }
+
+ @Override
+ public ProcessBuilder addEndEvent(String name)
+ {
+ nodeImpl = new EndEventImpl(procDefImpl, new EndState(name));
+ procDefImpl.addNode(nodeImpl);
+ return this;
+ }
+
+ @Override
+ public ProcessBuilder addSequenceFlow(String targetName)
+ {
+ return addSequenceFlow(targetName, null, null);
+ }
+
+ public ProcessBuilder addSequenceFlow(String targetName, ExpressionLanguage exprLang, String exprBody)
+ {
+ flows.add(new FlowSpec(nodeImpl.getName(), targetName, exprLang, exprBody));
+ return this;
+ }
+
+ class FlowSpec
+ {
+ String source;
+ String target;
+ ExpressionLanguage exprLang;
+ String exprBody;
+
+ public FlowSpec(String source, String target, ExpressionLanguage exprLang, String exprBody)
+ {
+ this.source = source;
+ this.target = target;
+ this.exprLang = exprLang;
+ this.exprBody = exprBody;
+ }
+ }
+
+ private void initProcessDefinition()
+ {
+ // Initialize the flows
+ for (FlowSpec flow : flows)
+ {
+ NodeImpl srcNode = (NodeImpl)procDefImpl.getNode(flow.source);
+ if (srcNode == null)
+ throw new InvalidProcessException("Cannot obtain source node: " + flow.source);
+
+ NodeImpl targetNode = (NodeImpl)procDefImpl.getNode(flow.target);
+ if (targetNode == null)
+ throw new InvalidProcessException("Cannot obtain target node: " + flow.target);
+
+ Transition trans = new Transition(flow.target);
+ trans.setFrom(srcNode.getOldNode());
+ trans.setTo(targetNode.getOldNode());
+
+ SequenceFlowImpl seqFlow = new SequenceFlowImpl(trans, flow.exprLang, flow.exprBody);
+ srcNode.addSequenceFlow(seqFlow);
+ }
+
+ // Verify that there is a start event
+ List<StartEvent> startEvents = procDefImpl.getNodes(StartEvent.class);
+ if (startEvents.size() == 0)
+ throw new InvalidProcessException("Cannot obtain a start event");
+
+ // Verify that there is an end event
+ List<EndEvent> endEvents = procDefImpl.getNodes(EndEvent.class);
+ if (endEvents.size() == 0)
+ throw new InvalidProcessException("Cannot obtain an end event");
+
+ // Detect unreachable nodes
+ for (Node node : procDefImpl.getNodes())
+ {
+ NodeImpl nodeImpl = (NodeImpl)node;
+ Set arriving = nodeImpl.getOldNode().getArrivingTransitions();
+ if (!(node instanceof StartEvent) && arriving == null)
+ throw new InvalidProcessException("Unreachable node: " + node);
+ }
+
+ // Detect dead end nodes
+ for (Node node : procDefImpl.getNodes())
+ {
+ NodeImpl nodeImpl = (NodeImpl)node;
+ List leaving = nodeImpl.getOldNode().getLeavingTransitions();
+ if (!(node instanceof EndEvent) && leaving == null)
+ throw new InvalidProcessException("Dead end node: " + node);
+ }
+ }
+}
\ No newline at end of file
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/runtime)
Deleted: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/ExpressionEvaluator.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/runtime/ExpressionEvaluator.java 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/ExpressionEvaluator.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,76 +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.integration.runtime;
-
-//$Id$
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jbpm.api.client.Token;
-import org.jbpm.api.model.Expression;
-import org.jbpm.api.model.Expression.ExpressionLanguage;
-import org.jbpm.api.runtime.Attachments;
-import org.jbpm.api.runtime.Attachments.Key;
-import org.mvel.MVEL;
-
-/**
- * Evaluates an expression for a given token
- *
- * @author thomas.diesler(a)jboss.com
- * @since 08-Jul-2008
- */
-public class ExpressionEvaluator
-{
- private Expression expr;
-
- public ExpressionEvaluator(Expression expr)
- {
- this.expr = expr;
- }
-
- /**
- * Evaluate an expression for a given token. <p/> Note that <code>propName.replace(".", "_")</code> applies to
- * property names for MVEL expressions, because the dot notation has special meaning in MVEL.
- */
- public Object evaluateExpression(Token token)
- {
- ExpressionLanguage exprLang = expr.getExpressionLanguage();
- if (exprLang == ExpressionLanguage.MVEL)
- {
- String mvel = expr.getExpressionBody();
- Attachments atts = token.getAttachments();
- Map<String, Object> vars = new HashMap<String, Object>();
- for (Key key : atts.getAttachmentKeys())
- {
- String name = key.getNamePart();
- Object value = atts.getAttachment(name);
- vars.put(name.replace(".", "_"), value);
- }
- return MVEL.eval(mvel, vars);
- }
- else
- {
- throw new IllegalStateException("Unsupported expression language: " + exprLang);
- }
- }
-}
\ No newline at end of file
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/ExpressionEvaluator.java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/runtime/ExpressionEvaluator.java)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/ExpressionEvaluator.java (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/ExpressionEvaluator.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,76 @@
+/*
+ * 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.HashMap;
+import java.util.Map;
+
+import org.jbpm.api.client.Token;
+import org.jbpm.api.model.Expression;
+import org.jbpm.api.model.Expression.ExpressionLanguage;
+import org.jbpm.api.runtime.Attachments;
+import org.jbpm.api.runtime.Attachments.Key;
+import org.mvel.MVEL;
+
+/**
+ * Evaluates an expression for a given token
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 08-Jul-2008
+ */
+public class ExpressionEvaluator
+{
+ private Expression expr;
+
+ public ExpressionEvaluator(Expression expr)
+ {
+ this.expr = expr;
+ }
+
+ /**
+ * Evaluate an expression for a given token. <p/> Note that <code>propName.replace(".", "_")</code> applies to
+ * property names for MVEL expressions, because the dot notation has special meaning in MVEL.
+ */
+ public Object evaluateExpression(Token token)
+ {
+ ExpressionLanguage exprLang = expr.getExpressionLanguage();
+ if (exprLang == ExpressionLanguage.MVEL)
+ {
+ String mvel = expr.getExpressionBody();
+ Attachments atts = token.getAttachments();
+ Map<String, Object> vars = new HashMap<String, Object>();
+ for (Key key : atts.getAttachmentKeys())
+ {
+ String name = key.getNamePart();
+ Object value = atts.getAttachment(name);
+ vars.put(name.replace(".", "_"), value);
+ }
+ return MVEL.eval(mvel, vars);
+ }
+ else
+ {
+ throw new IllegalStateException("Unsupported expression language: " + exprLang);
+ }
+ }
+}
\ No newline at end of file
Deleted: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/NodeExecuteInterceptor.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/runtime/NodeExecuteInterceptor.java 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/NodeExecuteInterceptor.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,41 +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.integration.runtime;
-
-//$Id$
-
-import org.jbpm.api.client.Token;
-
-/**
- * An interceptor that invokes the Node.execute
- *
- * @author thomas.diesler(a)jboss.com
- * @since 07-Oct-2008
- */
-public class NodeExecuteInterceptor implements NodeInterceptor
-{
- @Override
- public void execute(RuntimeContext rtContext)
- {
- Token token = rtContext.getToken();
- }
-}
\ No newline at end of file
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/NodeExecuteInterceptor.java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/runtime/NodeExecuteInterceptor.java)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/NodeExecuteInterceptor.java (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/NodeExecuteInterceptor.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.integration.runtime;
+
+//$Id$
+
+import org.jbpm.api.client.Token;
+
+/**
+ * An interceptor that invokes the Node.execute
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 07-Oct-2008
+ */
+public class NodeExecuteInterceptor implements NodeInterceptor
+{
+ @Override
+ public void execute(RuntimeContext rtContext)
+ {
+ Token token = rtContext.getToken();
+ }
+}
\ No newline at end of file
Deleted: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/NodeInterceptor.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/runtime/NodeInterceptor.java 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/NodeInterceptor.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,35 +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.integration.runtime;
-
-//$Id$
-
-/**
- * A node interceptor
- *
- * @author thomas.diesler(a)jboss.com
- * @since 07-Oct-2008
- */
-public interface NodeInterceptor
-{
- void execute (RuntimeContext rtContext);
-}
\ No newline at end of file
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/NodeInterceptor.java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/runtime/NodeInterceptor.java)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/NodeInterceptor.java (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/NodeInterceptor.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,35 @@
+/*
+ * 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$
+
+/**
+ * A node interceptor
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 07-Oct-2008
+ */
+public interface NodeInterceptor
+{
+ void execute (RuntimeContext rtContext);
+}
\ No newline at end of file
Deleted: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/RuntimeContext.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/runtime/RuntimeContext.java 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/RuntimeContext.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,68 +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.integration.runtime;
-
-//$Id$
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jbpm.api.client.Token;
-
-/**
- * A runtime context that passes through a chain of interceptors.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 07-Oct-2008
- */
-public class RuntimeContext
-{
- private List<NodeInterceptor> interceptors = new ArrayList<NodeInterceptor>();
- private int itorIndex;
-
- private Token token;
-
- public Token getToken()
- {
- return token;
- }
-
- public void setToken(Token token)
- {
- this.token = token;
- this.itorIndex = 0;
- }
-
- void addInterceptor(NodeInterceptor itor)
- {
- interceptors.add(itor);
- }
-
- protected void next()
- {
- if (itorIndex < interceptors.size())
- {
- NodeInterceptor itor = interceptors.get(itorIndex++);
- itor.execute(this);
- }
- }
-}
\ No newline at end of file
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/RuntimeContext.java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/runtime/RuntimeContext.java)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/RuntimeContext.java (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/runtime/RuntimeContext.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,68 @@
+/*
+ * 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.ArrayList;
+import java.util.List;
+
+import org.jbpm.api.client.Token;
+
+/**
+ * A runtime context that passes through a chain of interceptors.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 07-Oct-2008
+ */
+public class RuntimeContext
+{
+ private List<NodeInterceptor> interceptors = new ArrayList<NodeInterceptor>();
+ private int itorIndex;
+
+ private Token token;
+
+ public Token getToken()
+ {
+ return token;
+ }
+
+ public void setToken(Token token)
+ {
+ this.token = token;
+ this.itorIndex = 0;
+ }
+
+ void addInterceptor(NodeInterceptor itor)
+ {
+ interceptors.add(itor);
+ }
+
+ protected void next()
+ {
+ if (itorIndex < interceptors.size())
+ {
+ NodeInterceptor itor = interceptors.get(itorIndex++);
+ itor.execute(this);
+ }
+ }
+}
\ No newline at end of file
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/service)
Deleted: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/DialectHandlerServiceImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/service/DialectHandlerServiceImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/DialectHandlerServiceImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,51 +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.integration.service;
-
-// $Id$
-
-import java.net.URI;
-import java.util.Map;
-
-import org.jbpm.api.client.ProcessEngine;
-import org.jbpm.api.service.DialectHandler;
-import org.jbpm.api.service.DialectHandlerService;
-
-/**
- * A registry that maps namespaceURI to a {@link DialectHandler}
- *
- * @author thomas.diesler(a)jboss.com
- * @since 18-Jun-2008
- */
-public class DialectHandlerServiceImpl extends DialectHandlerService implements MutableService
-{
- @Override
- public void setProcessEngine(ProcessEngine engine)
- {
- super.setProcessEngine(engine);
- }
-
- public void setDialectHandlers(Map<URI, DialectHandler> dialectHandlers)
- {
- this.dialectHandlers = dialectHandlers;
- }
-}
\ No newline at end of file
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/DialectHandlerServiceImpl.java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/service/DialectHandlerServiceImpl.java)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/DialectHandlerServiceImpl.java (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/DialectHandlerServiceImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -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.integration.service;
+
+// $Id$
+
+import java.net.URI;
+import java.util.Map;
+
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.service.DialectHandler;
+import org.jbpm.api.service.DialectHandlerService;
+
+/**
+ * A registry that maps namespaceURI to a {@link DialectHandler}
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Jun-2008
+ */
+public class DialectHandlerServiceImpl extends DialectHandlerService implements MutableService
+{
+ @Override
+ public void setProcessEngine(ProcessEngine engine)
+ {
+ super.setProcessEngine(engine);
+ }
+
+ public void setDialectHandlers(Map<URI, DialectHandler> dialectHandlers)
+ {
+ this.dialectHandlers = dialectHandlers;
+ }
+}
\ No newline at end of file
Deleted: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/MutableService.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/service/MutableService.java 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/MutableService.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,38 +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.integration.service;
-
-// $Id$
-
-import org.jbpm.api.client.ProcessEngine;
-import org.jbpm.api.service.Service;
-
-/**
- * A mutable service
- *
- * @author thomas.diesler(a)jboss.com
- * @since 18-Jun-2008
- */
-public interface MutableService extends Service
-{
- void setProcessEngine(ProcessEngine engine);
-}
\ No newline at end of file
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/MutableService.java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/service/MutableService.java)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/MutableService.java (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/MutableService.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,38 @@
+/*
+ * 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.service;
+
+// $Id$
+
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.service.Service;
+
+/**
+ * A mutable service
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Jun-2008
+ */
+public interface MutableService extends Service
+{
+ void setProcessEngine(ProcessEngine engine);
+}
\ No newline at end of file
Deleted: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/NoopPersistenceServiceImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/service/NoopPersistenceServiceImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/NoopPersistenceServiceImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,137 +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.integration.service;
-
-// $Id$
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.management.ObjectName;
-
-import org.hibernate.Session;
-import org.jbpm.api.ProcessNotFoundException;
-import org.jbpm.api.client.ProcessEngine;
-import org.jbpm.api.model.Node;
-import org.jbpm.api.model.Process;
-import org.jbpm.api.model.ProcessDefinition;
-import org.jbpm.api.service.PersistenceService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * An in-memory persistence service.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 17-Sep-2008
- */
-public class NoopPersistenceServiceImpl extends PersistenceService implements MutableService
-{
- // Provide logging
- final Logger log = LoggerFactory.getLogger(NoopPersistenceServiceImpl.class);
-
- private Map<ObjectName, ProcessDefinition> procDefs = new HashMap<ObjectName, ProcessDefinition>();
- private Map<ObjectName, Process> procs = new HashMap<ObjectName, Process>();
- private Map<ObjectName, Node> nodes = new HashMap<ObjectName, Node>();
-
- @Override
- public void setProcessEngine(ProcessEngine engine)
- {
- super.setProcessEngine(engine);
- }
-
- @Override
- public Session createSession()
- {
- return null;
- }
-
- @Override
- public ObjectName saveProcessDefinition(ProcessDefinition procDef)
- {
- procDefs.put(procDef.getKey(), procDef);
- return procDef.getKey();
- }
-
- @Override
- public ProcessDefinition loadProcessDefinition(ObjectName procDefID)
- {
- ProcessDefinition procDef = procDefs.get(procDefID);
- if (procDef == null)
- throw new ProcessNotFoundException("Cannot find process: " + procDefID);
-
- return procDef;
- }
-
- @Override
- public void deleteProcessDefinition(ProcessDefinition procDef)
- {
- procDefs.remove(procDef.getKey());
- }
-
- @Override
- public ObjectName saveProcess(Process proc)
- {
- procs.put(proc.getKey(), proc);
-
- for (Node node : proc.getNodes())
- nodes.put(node.getKey(), node);
-
- return proc.getKey();
- }
-
- @Override
- public Process loadProcess(ObjectName procID)
- {
- Process proc = procs.get(procID);
- if (proc == null)
- throw new ProcessNotFoundException("Cannot find process: " + procID);
-
- return proc;
- }
-
- @Override
- public void deleteProcess(Process proc)
- {
- procs.remove(proc.getKey());
-
- for (Node node : proc.getNodes())
- nodes.remove(node.getKey());
- }
-
- @Override
- public ObjectName saveNode(Session session, Node node)
- {
- return node.getKey();
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends Node> T loadNode(Session session, Class<T> nodeImpl, ObjectName nodeID)
- {
- T node = (T)nodes.get(nodeID);
- if (node == null)
- throw new ProcessNotFoundException("Cannot find node: " + nodeID);
-
- return node;
- }
-}
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/NoopPersistenceServiceImpl.java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/service/NoopPersistenceServiceImpl.java)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/NoopPersistenceServiceImpl.java (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/NoopPersistenceServiceImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,137 @@
+/*
+ * 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.service;
+
+// $Id$
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.ObjectName;
+
+import org.hibernate.Session;
+import org.jbpm.api.ProcessNotFoundException;
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.model.Node;
+import org.jbpm.api.model.Process;
+import org.jbpm.api.model.ProcessDefinition;
+import org.jbpm.api.service.PersistenceService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * An in-memory persistence service.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 17-Sep-2008
+ */
+public class NoopPersistenceServiceImpl extends PersistenceService implements MutableService
+{
+ // Provide logging
+ final Logger log = LoggerFactory.getLogger(NoopPersistenceServiceImpl.class);
+
+ private Map<ObjectName, ProcessDefinition> procDefs = new HashMap<ObjectName, ProcessDefinition>();
+ private Map<ObjectName, Process> procs = new HashMap<ObjectName, Process>();
+ private Map<ObjectName, Node> nodes = new HashMap<ObjectName, Node>();
+
+ @Override
+ public void setProcessEngine(ProcessEngine engine)
+ {
+ super.setProcessEngine(engine);
+ }
+
+ @Override
+ public Session createSession()
+ {
+ return null;
+ }
+
+ @Override
+ public ObjectName saveProcessDefinition(ProcessDefinition procDef)
+ {
+ procDefs.put(procDef.getKey(), procDef);
+ return procDef.getKey();
+ }
+
+ @Override
+ public ProcessDefinition loadProcessDefinition(ObjectName procDefID)
+ {
+ ProcessDefinition procDef = procDefs.get(procDefID);
+ if (procDef == null)
+ throw new ProcessNotFoundException("Cannot find process: " + procDefID);
+
+ return procDef;
+ }
+
+ @Override
+ public void deleteProcessDefinition(ProcessDefinition procDef)
+ {
+ procDefs.remove(procDef.getKey());
+ }
+
+ @Override
+ public ObjectName saveProcess(Process proc)
+ {
+ procs.put(proc.getKey(), proc);
+
+ for (Node node : proc.getNodes())
+ nodes.put(node.getKey(), node);
+
+ return proc.getKey();
+ }
+
+ @Override
+ public Process loadProcess(ObjectName procID)
+ {
+ Process proc = procs.get(procID);
+ if (proc == null)
+ throw new ProcessNotFoundException("Cannot find process: " + procID);
+
+ return proc;
+ }
+
+ @Override
+ public void deleteProcess(Process proc)
+ {
+ procs.remove(proc.getKey());
+
+ for (Node node : proc.getNodes())
+ nodes.remove(node.getKey());
+ }
+
+ @Override
+ public ObjectName saveNode(Session session, Node node)
+ {
+ return node.getKey();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends Node> T loadNode(Session session, Class<T> nodeImpl, ObjectName nodeID)
+ {
+ T node = (T)nodes.get(nodeID);
+ if (node == null)
+ throw new ProcessNotFoundException("Cannot find node: " + nodeID);
+
+ return node;
+ }
+}
Deleted: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/ProcessBuilderServiceImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/service/ProcessBuilderServiceImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/ProcessBuilderServiceImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,50 +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.integration.service;
-
-// $Id$
-
-import org.jbpm.api.client.ProcessEngine;
-import org.jbpm.api.model.Process;
-import org.jbpm.api.service.ProcessBuilderService;
-import org.jbpm.api.model.builder.ProcessBuilder;
-import org.jbpm.integration.model.builder.ProcessBuilderImpl;
-/**
- * The ProcessBuilder can be used to build a {@link Process} dynamically.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 18-Jun-2008
- */
-public class ProcessBuilderServiceImpl extends ProcessBuilderService implements MutableService
-{
- @Override
- public void setProcessEngine(ProcessEngine engine)
- {
- super.setProcessEngine(engine);
- }
-
- @Override
- public ProcessBuilder getProcessBuilder()
- {
- return new ProcessBuilderImpl(getProcessEngine());
- }
-}
\ No newline at end of file
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/ProcessBuilderServiceImpl.java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/service/ProcessBuilderServiceImpl.java)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/ProcessBuilderServiceImpl.java (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/ProcessBuilderServiceImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,50 @@
+/*
+ * 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.service;
+
+// $Id$
+
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.model.Process;
+import org.jbpm.api.service.ProcessBuilderService;
+import org.jbpm.api.model.builder.ProcessBuilder;
+import org.jbpm.integration.model.builder.ProcessBuilderImpl;
+/**
+ * The ProcessBuilder can be used to build a {@link Process} dynamically.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Jun-2008
+ */
+public class ProcessBuilderServiceImpl extends ProcessBuilderService implements MutableService
+{
+ @Override
+ public void setProcessEngine(ProcessEngine engine)
+ {
+ super.setProcessEngine(engine);
+ }
+
+ @Override
+ public ProcessBuilder getProcessBuilder()
+ {
+ return new ProcessBuilderImpl(getProcessEngine());
+ }
+}
\ No newline at end of file
Deleted: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/ProcessDefinitionServiceImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/service/ProcessDefinitionServiceImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/ProcessDefinitionServiceImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,108 +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.integration.service;
-
-// $Id$
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import javax.management.ObjectName;
-
-import org.jbpm.api.client.ProcessEngine;
-import org.jbpm.api.model.ProcessDefinition;
-import org.jbpm.api.service.ProcessDefinitionService;
-import org.jbpm.api.service.ProcessService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * The ProcessDefinitionService is the entry point to create, find and otherwise manage process definitions.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 18-Jun-2008
- */
-public class ProcessDefinitionServiceImpl extends ProcessDefinitionService implements MutableService
-{
- // Provide logging
- final static Logger log = LoggerFactory.getLogger(ProcessDefinitionServiceImpl.class);
-
- // The set of registered ProcessDefinitions
- private Map<ObjectName, ProcessDefinition> procDefs = new HashMap<ObjectName, ProcessDefinition>();
-
- @Override
- public void setProcessEngine(ProcessEngine engine)
- {
- super.setProcessEngine(engine);
- }
-
- @Override
- public ProcessDefinition getProcessDefinition(ObjectName procDefID)
- {
- return procDefs.get(procDefID);
- }
-
- @Override
- public Set<ObjectName> getProcessDefinitions()
- {
- return Collections.unmodifiableSet(procDefs.keySet());
- }
-
- @Override
- public ObjectName registerProcessDefinition(ProcessDefinition procDef)
- {
- if (getProcessDefinition(procDef.getKey()) != null)
- throw new IllegalStateException("Process definition already registered: " + procDef);
-
- log.debug("registerProcessDefinition: " + procDef);
-
- // Save the ProcessDefinition through the PersistenceService
- ObjectName procDefID = procDef.getKey();
- procDefs.put(procDefID, procDef);
-
- return procDefID;
- }
-
- @Override
- public boolean unregisterProcessDefinition(ObjectName procDefID)
- {
- boolean removed = false;
- ProcessDefinition procDef = procDefs.get(procDefID);
- if (procDef != null)
- {
- log.debug("unregisterProcessDefinition: " + procDef);
-
- ProcessEngine engine = getProcessEngine();
-
- // Unregister the associated process instances
- ProcessService procService = engine.getService(ProcessService.class);
- for (ObjectName procID : procService.getProcesses(procDef.getName(), null))
- procService.unregisterProcess(procID);
-
- procDefs.remove(procDefID);
- removed = true;
- }
- return removed;
- }
-}
\ No newline at end of file
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/ProcessDefinitionServiceImpl.java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/service/ProcessDefinitionServiceImpl.java)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/ProcessDefinitionServiceImpl.java (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/ProcessDefinitionServiceImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,108 @@
+/*
+ * 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.service;
+
+// $Id$
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.ObjectName;
+
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.model.ProcessDefinition;
+import org.jbpm.api.service.ProcessDefinitionService;
+import org.jbpm.api.service.ProcessService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The ProcessDefinitionService is the entry point to create, find and otherwise manage process definitions.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Jun-2008
+ */
+public class ProcessDefinitionServiceImpl extends ProcessDefinitionService implements MutableService
+{
+ // Provide logging
+ final static Logger log = LoggerFactory.getLogger(ProcessDefinitionServiceImpl.class);
+
+ // The set of registered ProcessDefinitions
+ private Map<ObjectName, ProcessDefinition> procDefs = new HashMap<ObjectName, ProcessDefinition>();
+
+ @Override
+ public void setProcessEngine(ProcessEngine engine)
+ {
+ super.setProcessEngine(engine);
+ }
+
+ @Override
+ public ProcessDefinition getProcessDefinition(ObjectName procDefID)
+ {
+ return procDefs.get(procDefID);
+ }
+
+ @Override
+ public Set<ObjectName> getProcessDefinitions()
+ {
+ return Collections.unmodifiableSet(procDefs.keySet());
+ }
+
+ @Override
+ public ObjectName registerProcessDefinition(ProcessDefinition procDef)
+ {
+ if (getProcessDefinition(procDef.getKey()) != null)
+ throw new IllegalStateException("Process definition already registered: " + procDef);
+
+ log.debug("registerProcessDefinition: " + procDef);
+
+ // Save the ProcessDefinition through the PersistenceService
+ ObjectName procDefID = procDef.getKey();
+ procDefs.put(procDefID, procDef);
+
+ return procDefID;
+ }
+
+ @Override
+ public boolean unregisterProcessDefinition(ObjectName procDefID)
+ {
+ boolean removed = false;
+ ProcessDefinition procDef = procDefs.get(procDefID);
+ if (procDef != null)
+ {
+ log.debug("unregisterProcessDefinition: " + procDef);
+
+ ProcessEngine engine = getProcessEngine();
+
+ // Unregister the associated process instances
+ ProcessService procService = engine.getService(ProcessService.class);
+ for (ObjectName procID : procService.getProcesses(procDef.getName(), null))
+ procService.unregisterProcess(procID);
+
+ procDefs.remove(procDefID);
+ removed = true;
+ }
+ return removed;
+ }
+}
\ No newline at end of file
Deleted: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/ProcessServiceImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/service/ProcessServiceImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/ProcessServiceImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,188 +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.integration.service;
-
-// $Id$
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.management.ObjectName;
-
-import org.jbpm.api.client.ProcessEngine;
-import org.jbpm.api.model.Process;
-import org.jbpm.api.model.ProcessDefinition;
-import org.jbpm.api.model.Process.ProcessStatus;
-import org.jbpm.api.service.ProcessDefinitionService;
-import org.jbpm.api.service.ProcessService;
-import org.jbpm.integration.model.ProcessImpl;
-import org.jbpm.integration.runtime.NodeInterceptor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * The ProcessService is the entry point to create, find and otherwise manage processes.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 18-Jun-2008
- */
-public class ProcessServiceImpl extends ProcessService implements MutableService
-{
- // Provide logging
- final static Logger log = LoggerFactory.getLogger(ProcessServiceImpl.class);
-
- private Map<ObjectName, Process> registeredProcs = new HashMap<ObjectName, Process>();
- private List<NodeInterceptor> nodeInterceptors = new ArrayList<NodeInterceptor>();
-
- @Override
- public void setProcessEngine(ProcessEngine engine)
- {
- super.setProcessEngine(engine);
- }
-
- public void setInterceptors(List<String> itorClassNames)
- {
- for (String itorClass : itorClassNames)
- {
- NodeInterceptor itor = loadNodeInterceptor(itorClass);
- nodeInterceptors.add(itor);
- }
- }
-
- public List<NodeInterceptor> getNodeInterceptors()
- {
- return Collections.unmodifiableList(nodeInterceptors);
- }
-
- /**
- * Get a Process for a given id
- */
- @Override
- public Process getProcess(ObjectName procID)
- {
- Process proc = registeredProcs.get(procID);
- return proc;
- }
-
- /**
- * Get the set of registered Processes
- */
- @Override
- public Set<ObjectName> getProcesses()
- {
- return Collections.unmodifiableSet(registeredProcs.keySet());
- }
-
- /**
- * Find the set of Processes for a given name
- *
- * @param name The process name
- * @param status The optional process status
- * @return An empty set if the process cannot be found
- */
- @Override
- public Set<ObjectName> getProcesses(String name, ProcessStatus status)
- {
- Set<ObjectName> procSet = new HashSet<ObjectName>();
- for (Process auxProc : registeredProcs.values())
- {
- if (auxProc.getName().equals(name))
- {
- if (status == null || auxProc.getProcessStatus() == status)
- procSet.add(auxProc.getKey());
- }
- }
- return procSet;
- }
-
- /**
- * Register a Process.
- */
- public ObjectName registerProcess(Process proc)
- {
- log.debug("registerProcess: " + proc);
-
- ObjectName procID = proc.getKey();
- if (getProcess(procID) != null)
- throw new IllegalStateException("Process already registered: " + proc);
-
- ProcessStatus procStatus = proc.getProcessStatus();
- ProcessDefinition procDef = proc.getProcessDefinition();
- ProcessEngine engine = getProcessEngine();
-
- if (procStatus != ProcessStatus.None)
- throw new IllegalStateException("Cannot register process in state: " + procStatus);
-
- // Register the process definition if needed
- ProcessDefinitionService procDefService = engine.getService(ProcessDefinitionService.class);
- if (procDefService.getProcessDefinition(procDef.getKey()) == null)
- procDefService.registerProcessDefinition(procDef);
-
- // Register the process
- registeredProcs.put(procID, proc);
-
- ProcessImpl procImpl = (ProcessImpl)proc;
- procImpl.setProcessStatus(ProcessStatus.Ready);
-
- return procID;
- }
-
- /**
- * Unregister a Process.
- */
- public boolean unregisterProcess(ObjectName procID)
- {
- boolean removed = false;
- Process proc = registeredProcs.get(procID);
- if (proc != null)
- {
- log.debug("unregisterProcess: " + proc);
-
- registeredProcs.remove(procID);
- removed = true;
- }
- return removed;
- }
-
- private NodeInterceptor loadNodeInterceptor(String className)
- {
- NodeInterceptor itor = null;
- if (className != null)
- {
- try
- {
- ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
- itor = (NodeInterceptor)ctxLoader.loadClass(className).newInstance();
- }
- catch (Exception ex)
- {
- log.error("Cannot load interceptor: " + className, ex);
- }
- }
- return itor;
- }
-}
\ No newline at end of file
Copied: jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/ProcessServiceImpl.java (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/service/ProcessServiceImpl.java)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/ProcessServiceImpl.java (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/java/org/jbpm/integration/service/ProcessServiceImpl.java 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,188 @@
+/*
+ * 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.service;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.ObjectName;
+
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.model.Process;
+import org.jbpm.api.model.ProcessDefinition;
+import org.jbpm.api.model.Process.ProcessStatus;
+import org.jbpm.api.service.ProcessDefinitionService;
+import org.jbpm.api.service.ProcessService;
+import org.jbpm.integration.model.ProcessImpl;
+import org.jbpm.integration.runtime.NodeInterceptor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The ProcessService is the entry point to create, find and otherwise manage processes.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Jun-2008
+ */
+public class ProcessServiceImpl extends ProcessService implements MutableService
+{
+ // Provide logging
+ final static Logger log = LoggerFactory.getLogger(ProcessServiceImpl.class);
+
+ private Map<ObjectName, Process> registeredProcs = new HashMap<ObjectName, Process>();
+ private List<NodeInterceptor> nodeInterceptors = new ArrayList<NodeInterceptor>();
+
+ @Override
+ public void setProcessEngine(ProcessEngine engine)
+ {
+ super.setProcessEngine(engine);
+ }
+
+ public void setInterceptors(List<String> itorClassNames)
+ {
+ for (String itorClass : itorClassNames)
+ {
+ NodeInterceptor itor = loadNodeInterceptor(itorClass);
+ nodeInterceptors.add(itor);
+ }
+ }
+
+ public List<NodeInterceptor> getNodeInterceptors()
+ {
+ return Collections.unmodifiableList(nodeInterceptors);
+ }
+
+ /**
+ * Get a Process for a given id
+ */
+ @Override
+ public Process getProcess(ObjectName procID)
+ {
+ Process proc = registeredProcs.get(procID);
+ return proc;
+ }
+
+ /**
+ * Get the set of registered Processes
+ */
+ @Override
+ public Set<ObjectName> getProcesses()
+ {
+ return Collections.unmodifiableSet(registeredProcs.keySet());
+ }
+
+ /**
+ * Find the set of Processes for a given name
+ *
+ * @param name The process name
+ * @param status The optional process status
+ * @return An empty set if the process cannot be found
+ */
+ @Override
+ public Set<ObjectName> getProcesses(String name, ProcessStatus status)
+ {
+ Set<ObjectName> procSet = new HashSet<ObjectName>();
+ for (Process auxProc : registeredProcs.values())
+ {
+ if (auxProc.getName().equals(name))
+ {
+ if (status == null || auxProc.getProcessStatus() == status)
+ procSet.add(auxProc.getKey());
+ }
+ }
+ return procSet;
+ }
+
+ /**
+ * Register a Process.
+ */
+ public ObjectName registerProcess(Process proc)
+ {
+ log.debug("registerProcess: " + proc);
+
+ ObjectName procID = proc.getKey();
+ if (getProcess(procID) != null)
+ throw new IllegalStateException("Process already registered: " + proc);
+
+ ProcessStatus procStatus = proc.getProcessStatus();
+ ProcessDefinition procDef = proc.getProcessDefinition();
+ ProcessEngine engine = getProcessEngine();
+
+ if (procStatus != ProcessStatus.None)
+ throw new IllegalStateException("Cannot register process in state: " + procStatus);
+
+ // Register the process definition if needed
+ ProcessDefinitionService procDefService = engine.getService(ProcessDefinitionService.class);
+ if (procDefService.getProcessDefinition(procDef.getKey()) == null)
+ procDefService.registerProcessDefinition(procDef);
+
+ // Register the process
+ registeredProcs.put(procID, proc);
+
+ ProcessImpl procImpl = (ProcessImpl)proc;
+ procImpl.setProcessStatus(ProcessStatus.Ready);
+
+ return procID;
+ }
+
+ /**
+ * Unregister a Process.
+ */
+ public boolean unregisterProcess(ObjectName procID)
+ {
+ boolean removed = false;
+ Process proc = registeredProcs.get(procID);
+ if (proc != null)
+ {
+ log.debug("unregisterProcess: " + proc);
+
+ registeredProcs.remove(procID);
+ removed = true;
+ }
+ return removed;
+ }
+
+ private NodeInterceptor loadNodeInterceptor(String className)
+ {
+ NodeInterceptor itor = null;
+ if (className != null)
+ {
+ try
+ {
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ itor = (NodeInterceptor)ctxLoader.loadClass(className).newInstance();
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot load interceptor: " + className, ex);
+ }
+ }
+ return itor;
+ }
+}
\ No newline at end of file
Copied: jbpm3/trunk/modules/integration/src/main/resources (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/resources)
Deleted: jbpm3/trunk/modules/integration/src/main/resources/jbpm-cfg-beans.xml
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/resources/jbpm-cfg-beans.xml 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/resources/jbpm-cfg-beans.xml 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,45 +0,0 @@
-<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd"
- xmlns="urn:jboss:bean-deployer:2.0">
-
- <!-- The KernelLocator -->
- <bean name="KernelLocator" class="org.jboss.kernel.plugins.util.KernelLocator" />
-
- <!-- The ProcessEngine -->
- <bean name="jBPMProcessEngine" class="org.jbpm.integration.client.ProcessEngineImpl">
- <property name="services">
- <set elementClass="org.jbpm.api.service.Service">
- <inject bean="jBPMDialectHandlerService" />
- <inject bean="jBPMProcessBuilderService" />
- <inject bean="jBPMProcessDefinitionService" />
- <inject bean="jBPMProcessService" />
- </set>
- </property>
- </bean>
-
- <!-- The PersistenceService -->
- <bean name="jBPMPersistenceService" class="org.jbpm.integration.service.NoopPersistenceServiceImpl"/>
-
- <!-- The ProcessService -->
- <bean name="jBPMProcessService" class="org.jbpm.integration.service.ProcessServiceImpl" >
- <property name="interceptors">
- <list elementClass="java.lang.String">
- <value>org.jbpm.integration.runtime.NodeExecuteInterceptor</value>
- </list>
- </property>
- </bean>
-
- <!-- The DialectHandlerService -->
- <bean name="jBPMDialectHandlerService" class="org.jbpm.integration.service.DialectHandlerServiceImpl" >
- <property name="dialectHandlers">
- <map keyClass="java.net.URI" valueClass="org.jbpm.api.service.DialectHandler">
- <entry><key>urn:jbpm.jboss:api-0.1</key><value><inject bean="jBPMDialectHandlerAPI10"/></value></entry>
- </map>
- </property>
- </bean>
- <bean name="jBPMDialectHandlerAPI10" class="org.jbpm.dialect.api10.DialectHandlerImpl"/>
-
- <!-- Other Services -->
- <bean name="jBPMProcessBuilderService" class="org.jbpm.integration.service.ProcessBuilderServiceImpl" />
- <bean name="jBPMProcessDefinitionService" class="org.jbpm.integration.service.ProcessDefinitionServiceImpl" />
-
- </deployment>
Copied: jbpm3/trunk/modules/integration/src/main/resources/jbpm-cfg-beans.xml (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/resources/jbpm-cfg-beans.xml)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/resources/jbpm-cfg-beans.xml (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/resources/jbpm-cfg-beans.xml 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1,45 @@
+<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd"
+ xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!-- The KernelLocator -->
+ <bean name="KernelLocator" class="org.jboss.kernel.plugins.util.KernelLocator" />
+
+ <!-- The ProcessEngine -->
+ <bean name="jBPMProcessEngine" class="org.jbpm.integration.client.ProcessEngineImpl">
+ <property name="services">
+ <set elementClass="org.jbpm.api.service.Service">
+ <inject bean="jBPMDialectHandlerService" />
+ <inject bean="jBPMProcessBuilderService" />
+ <inject bean="jBPMProcessDefinitionService" />
+ <inject bean="jBPMProcessService" />
+ </set>
+ </property>
+ </bean>
+
+ <!-- The PersistenceService -->
+ <bean name="jBPMPersistenceService" class="org.jbpm.integration.service.NoopPersistenceServiceImpl"/>
+
+ <!-- The ProcessService -->
+ <bean name="jBPMProcessService" class="org.jbpm.integration.service.ProcessServiceImpl" >
+ <property name="interceptors">
+ <list elementClass="java.lang.String">
+ <value>org.jbpm.integration.runtime.NodeExecuteInterceptor</value>
+ </list>
+ </property>
+ </bean>
+
+ <!-- The DialectHandlerService -->
+ <bean name="jBPMDialectHandlerService" class="org.jbpm.integration.service.DialectHandlerServiceImpl" >
+ <property name="dialectHandlers">
+ <map keyClass="java.net.URI" valueClass="org.jbpm.api.service.DialectHandler">
+ <entry><key>urn:jbpm.jboss:api-0.1</key><value><inject bean="jBPMDialectHandlerAPI10"/></value></entry>
+ </map>
+ </property>
+ </bean>
+ <bean name="jBPMDialectHandlerAPI10" class="org.jbpm.dialect.api10.DialectHandlerImpl"/>
+
+ <!-- Other Services -->
+ <bean name="jBPMProcessBuilderService" class="org.jbpm.integration.service.ProcessBuilderServiceImpl" />
+ <bean name="jBPMProcessDefinitionService" class="org.jbpm.integration.service.ProcessDefinitionServiceImpl" />
+
+ </deployment>
Deleted: jbpm3/trunk/modules/integration/src/main/resources/org.jbpm.api.client.ConfigurationProvider
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/resources/org.jbpm.api.client.ConfigurationProvider 2008-11-17 11:41:14 UTC (rev 2952)
+++ jbpm3/trunk/modules/integration/src/main/resources/org.jbpm.api.client.ConfigurationProvider 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1 +0,0 @@
-org.jbpm.api.client.internal.MicrocontainerConfigurationProvider
\ No newline at end of file
Copied: jbpm3/trunk/modules/integration/src/main/resources/org.jbpm.api.client.ConfigurationProvider (from rev 2952, jbpm3/branches/tdiesler/modules/integration/src/main/resources/org.jbpm.api.client.ConfigurationProvider)
===================================================================
--- jbpm3/trunk/modules/integration/src/main/resources/org.jbpm.api.client.ConfigurationProvider (rev 0)
+++ jbpm3/trunk/modules/integration/src/main/resources/org.jbpm.api.client.ConfigurationProvider 2008-11-17 13:08:14 UTC (rev 2954)
@@ -0,0 +1 @@
+org.jbpm.api.client.internal.MicrocontainerConfigurationProvider
\ No newline at end of file
Modified: jbpm3/trunk/modules/simulation/.classpath
===================================================================
--- jbpm3/trunk/modules/simulation/.classpath 2008-11-17 12:57:48 UTC (rev 2953)
+++ jbpm3/trunk/modules/simulation/.classpath 2008-11-17 13:08:14 UTC (rev 2954)
@@ -1,8 +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" output="target/test-classes" path="src/test/java"/>
- <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<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"/>
Modified: jbpm3/trunk/pom.xml
===================================================================
--- jbpm3/trunk/pom.xml 2008-11-17 12:57:48 UTC (rev 2953)
+++ jbpm3/trunk/pom.xml 2008-11-17 13:08:14 UTC (rev 2954)
@@ -33,6 +33,7 @@
<module>modules/enterprise</module>
<module>modules/examples</module>
<module>modules/simulation</module>
+ <module>modules/integration</module>
</modules>
<!-- Properties -->
@@ -64,7 +65,7 @@
<javax.persistence.version>1.0</javax.persistence.version>
<javax.jaxb.version>2.1</javax.jaxb.version>
<jaxen.version>1.1.1</jaxen.version>
- <jbpm.api.version>1.0.0-Alpha2</jbpm.api.version>
+ <jbpm.api.version>1.0.0-SNAPSHOT</jbpm.api.version>
<jbpm.designer.version>3.1.5</jbpm.designer.version>
<jbpm.gwt-console.version>1.0.0-Beta1</jbpm.gwt-console.version>
<jbpm.jsf-console.version>3.3.0.GA</jbpm.jsf-console.version>
@@ -94,6 +95,17 @@
<version>${jbpm.api.version}</version>
</dependency>
<dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-spec-dialect-api10</artifactId>
+ <version>${jbpm.api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-spec-cts</artifactId>
+ <version>${jbpm.api.version}</version>
+ <type>zip</type>
+ </dependency>
+ <dependency>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jsf-console</artifactId>
<version>${jbpm.jsf-console.version}</version>
17 years, 5 months
JBoss JBPM SVN: r2953 - in projects/spec/trunk/modules/samples/airticket: client and 1 other directory.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-17 07:57:48 -0500 (Mon, 17 Nov 2008)
New Revision: 2953
Modified:
projects/spec/trunk/modules/samples/airticket/client/pom.xml
projects/spec/trunk/modules/samples/airticket/pom.xml
Log:
skip deploy
Modified: projects/spec/trunk/modules/samples/airticket/client/pom.xml
===================================================================
--- projects/spec/trunk/modules/samples/airticket/client/pom.xml 2008-11-17 11:41:14 UTC (rev 2952)
+++ projects/spec/trunk/modules/samples/airticket/client/pom.xml 2008-11-17 12:57:48 UTC (rev 2953)
@@ -47,18 +47,6 @@
</dependency>
</dependencies>
- <!-- Build -->
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
<!-- Profiles -->
<profiles>
<!--
Modified: projects/spec/trunk/modules/samples/airticket/pom.xml
===================================================================
--- projects/spec/trunk/modules/samples/airticket/pom.xml 2008-11-17 11:41:14 UTC (rev 2952)
+++ projects/spec/trunk/modules/samples/airticket/pom.xml 2008-11-17 12:57:48 UTC (rev 2953)
@@ -70,4 +70,17 @@
<scope>provided</scope>
</dependency>
</dependencies>
+
+ <!-- Build -->
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
17 years, 5 months
JBoss JBPM SVN: r2952 - in jbpm3/branches/tdiesler/modules: integration and 5 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-17 06:41:14 -0500 (Mon, 17 Nov 2008)
New Revision: 2952
Added:
jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ExclusiveGatewayImpl.java
jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ExpressionImpl.java
jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/GatewayImpl.java
jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/builder/GatewayBuilderImpl.java
jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/runtime/ExpressionEvaluator.java
Modified:
jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/Decision.java
jbpm3/branches/tdiesler/modules/integration/.classpath
jbpm3/branches/tdiesler/modules/integration/pom.xml
jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/client/TokenImpl.java
jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/NodeImpl.java
jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ProcessDefinitionImpl.java
jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ProcessImpl.java
jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/SequenceFlowImpl.java
jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/builder/ProcessBuilderImpl.java
jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/service/ProcessDefinitionServiceImpl.java
jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/service/ProcessServiceImpl.java
Log:
CTS - ok
Modified: jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/Decision.java
===================================================================
--- jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/Decision.java 2008-11-17 09:57:53 UTC (rev 2951)
+++ jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/Decision.java 2008-11-17 11:41:14 UTC (rev 2952)
@@ -81,7 +81,10 @@
try {
if (decisionDelegation != null) {
- DecisionHandler decisionHandler = (DecisionHandler) decisionDelegation.instantiate();
+ DecisionHandler decisionHandler = (DecisionHandler)decisionDelegation.getInstance();
+ if (decisionHandler == null)
+ decisionHandler = (DecisionHandler) decisionDelegation.instantiate();
+
String transitionName = decisionHandler.decide(executionContext);
transition = getLeavingTransition(transitionName);
if (transition == null) {
Modified: jbpm3/branches/tdiesler/modules/integration/.classpath
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/.classpath 2008-11-17 09:57:53 UTC (rev 2951)
+++ jbpm3/branches/tdiesler/modules/integration/.classpath 2008-11-17 11:41:14 UTC (rev 2952)
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/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"/>
Modified: jbpm3/branches/tdiesler/modules/integration/pom.xml
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/pom.xml 2008-11-17 09:57:53 UTC (rev 2951)
+++ jbpm3/branches/tdiesler/modules/integration/pom.xml 2008-11-17 11:41:14 UTC (rev 2952)
@@ -28,6 +28,11 @@
<relativePath>../../pom.xml</relativePath>
</parent>
+ <!-- Properties -->
+ <properties>
+ <mvel.version>1.3.7-java1.5</mvel.version>
+ </properties>
+
<!-- Dependencies -->
<dependencies>
<dependency>
@@ -45,6 +50,11 @@
<classifier>config</classifier>
<version>${version}</version>
</dependency>
+ <dependency>
+ <groupId>org.mvel</groupId>
+ <artifactId>mvel</artifactId>
+ <version>${mvel.version}</version>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
Modified: jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/client/TokenImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/client/TokenImpl.java 2008-11-17 09:57:53 UTC (rev 2951)
+++ jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/client/TokenImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
@@ -31,6 +31,7 @@
import org.jbpm.api.model.SequenceFlow;
import org.jbpm.api.model.Process.ProcessStatus;
import org.jbpm.api.runtime.Attachments;
+import org.jbpm.api.runtime.BasicAttachments;
import org.jbpm.integration.model.ProcessImpl;
/**
@@ -45,7 +46,7 @@
private org.jbpm.graph.exe.Token oldToken;
private ProcessImpl procImpl;
- private Attachments att;
+ private Attachments att = new BasicAttachments();
public TokenImpl(ProcessImpl proc, org.jbpm.graph.exe.Token oldToken, Attachments att)
{
Added: jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ExclusiveGatewayImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ExclusiveGatewayImpl.java (rev 0)
+++ jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ExclusiveGatewayImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
@@ -0,0 +1,124 @@
+/*
+ * 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.model;
+
+// $Id$
+
+import org.jbpm.api.client.Token;
+import org.jbpm.api.model.ExclusiveGateway;
+import org.jbpm.api.model.Expression;
+import org.jbpm.api.model.ProcessDefinition;
+import org.jbpm.api.model.SequenceFlow;
+import org.jbpm.api.model.SequenceFlow.ConditionType;
+import org.jbpm.graph.exe.ExecutionContext;
+import org.jbpm.graph.node.Decision;
+import org.jbpm.graph.node.DecisionHandler;
+import org.jbpm.instantiation.Delegation;
+import org.jbpm.integration.runtime.ExpressionEvaluator;
+
+/**
+ * An integration wrapper
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 15-Nov-2008
+ */
+public class ExclusiveGatewayImpl extends GatewayImpl implements ExclusiveGateway
+{
+ private static final long serialVersionUID = 1L;
+
+ public ExclusiveGatewayImpl(ProcessDefinition procDef, Decision oldDecision)
+ {
+ super(procDef, oldDecision);
+ ExclusiveGatewayDecisionHandler decisionHandler = new ExclusiveGatewayDecisionHandler();
+ oldDecision.setDecisionDelegation(new Delegation(decisionHandler));
+ }
+
+ @Override
+ public GatewayType getGatewayType()
+ {
+ return GatewayType.Exclusive;
+ }
+
+ @Override
+ public ExclusiveType getExclusiveType()
+ {
+ return ExclusiveType.Data;
+ }
+
+ class ExclusiveGatewayDecisionHandler implements DecisionHandler
+ {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String decide(ExecutionContext executionContext) throws Exception
+ {
+ ProcessImpl procImpl = (ProcessImpl)getProcess();
+ Token token = procImpl.getRootToken();
+
+ SequenceFlow selectedGate = null;
+ for (SequenceFlow auxGate : getGates())
+ {
+ SequenceFlow seqFlow = auxGate;
+ if (seqFlow.getConditionType() == ConditionType.Expression)
+ {
+ Expression expr = seqFlow.getConditionExpression();
+ ExpressionEvaluator exprEvaluator = new ExpressionEvaluator(expr);
+ if ((Boolean)exprEvaluator.evaluateExpression(token))
+ {
+ selectedGate = auxGate;
+ break;
+ }
+ }
+ }
+
+ // Use to the default gate if there is one
+ if (selectedGate == null)
+ {
+ for (SequenceFlow auxGate : getGates())
+ {
+ SequenceFlow seqFlow = auxGate;
+ if (seqFlow.getConditionType() == ConditionType.Default)
+ {
+ selectedGate = auxGate;
+ break;
+ }
+ }
+ }
+
+ // Fallback to the single outgoing gate that is not conditional
+ if (selectedGate == null && getGates().size() == 1)
+ {
+ SequenceFlow auxGate = getGates().get(0);
+ SequenceFlow seqFlow = auxGate;
+ if (seqFlow.getConditionType() == ConditionType.None)
+ {
+ selectedGate = auxGate;
+ }
+ }
+
+ if (selectedGate == null)
+ throw new IllegalStateException("Cannot select applicable gate in: " + getOldNode());
+
+ return selectedGate.getTargetRef();
+ }
+ }
+}
Property changes on: jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ExclusiveGatewayImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ExpressionImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ExpressionImpl.java (rev 0)
+++ jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ExpressionImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
@@ -0,0 +1,67 @@
+/*
+ * 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.model;
+
+//$Id$
+
+import org.jbpm.api.model.Expression;
+
+/**
+ * An Expression, which is used in the definition of attributes for @{link StartEvent},
+ *
+ * @{link IntermediateEvent}, @{link Activity}, @{link ComplexGateway}, and @{link SequenceFlow}
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 17-Nov-2008
+ */
+public class ExpressionImpl implements Expression
+{
+ // provide serial version UID
+ private static final long serialVersionUID = 1L;
+
+ private String body;
+ private ExpressionLanguage lang;
+
+ public ExpressionImpl(String body)
+ {
+ this.body = body;
+ this.lang = ExpressionLanguage.MVEL;
+ }
+
+ public ExpressionImpl(ExpressionLanguage lang, String body)
+ {
+ this.body = body;
+ this.lang = lang;
+ }
+
+ @Override
+ public ExpressionLanguage getExpressionLanguage()
+ {
+ return lang;
+ }
+
+ @Override
+ public String getExpressionBody()
+ {
+ return body;
+ }
+}
Property changes on: jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ExpressionImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/GatewayImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/GatewayImpl.java (rev 0)
+++ jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/GatewayImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
@@ -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.integration.model;
+
+import java.util.List;
+
+import org.jbpm.api.NotImplementedException;
+import org.jbpm.api.model.Gateway;
+import org.jbpm.api.model.ProcessDefinition;
+import org.jbpm.api.model.SequenceFlow;
+import org.jbpm.graph.node.Decision;
+
+/**
+ * An integration wrapper
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 15-Nov-2008
+ */
+public abstract class GatewayImpl extends NodeImpl implements Gateway
+{
+ private static final long serialVersionUID = 1L;
+
+ public GatewayImpl(ProcessDefinition procDef, Decision oldDecision)
+ {
+ super(procDef, oldDecision);
+ }
+
+ @Override
+ public List<SequenceFlow> getGates()
+ {
+ return getOutFlows();
+ }
+
+ @Override
+ public SequenceFlow getGateByName(String targetName)
+ {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public SequenceFlow getDefaultGate()
+ {
+ throw new NotImplementedException();
+ }
+}
Property changes on: jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/GatewayImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/NodeImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/NodeImpl.java 2008-11-17 09:57:53 UTC (rev 2951)
+++ jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/NodeImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
@@ -21,14 +21,18 @@
*/
package org.jbpm.integration.model;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
import javax.management.ObjectName;
import org.jbpm.api.Constants;
import org.jbpm.api.InvalidProcessException;
-import org.jbpm.api.NotImplementedException;
import org.jbpm.api.model.Node;
import org.jbpm.api.model.Process;
import org.jbpm.api.model.ProcessDefinition;
+import org.jbpm.api.model.SequenceFlow;
import org.jbpm.api.model.builder.ObjectNameFactory;
import org.jbpm.graph.def.Transition;
@@ -43,7 +47,10 @@
private static final long serialVersionUID = 1L;
private ProcessDefinition procDef;
+ private Process proc;
+
private org.jbpm.graph.def.Node oldNode;
+ private List<SequenceFlow> outFlows = new ArrayList<SequenceFlow>();
public NodeImpl(ProcessDefinition procDef, org.jbpm.graph.def.Node oldNode)
{
@@ -78,22 +85,32 @@
@Override
public Process getProcess()
{
- throw new NotImplementedException();
+ return proc;
}
- public void addSequenceFlow(String targetName)
+ public void setProcess(Process proc)
{
- NodeImpl targetNode = (NodeImpl)procDef.getNode(targetName);
+ this.proc = proc;
+ }
+
+ public void addSequenceFlow(SequenceFlowImpl flow)
+ {
+ String targetRef = flow.getTargetRef();
+ NodeImpl targetNode = (NodeImpl)procDef.getNode(targetRef);
if (targetNode == null)
- throw new InvalidProcessException("Cannot obtain target node: " + targetName);
+ throw new InvalidProcessException("Cannot obtain target node: " + targetRef);
- Transition trans = new Transition();
- trans.setFrom(this.getOldNode());
- trans.setTo(targetNode.getOldNode());
-
+ Transition trans = flow.getOldTransition();
oldNode.addLeavingTransition(trans);
targetNode.getOldNode().addArrivingTransition(trans);
+
+ outFlows.add(flow);
}
+
+ public List<SequenceFlow> getOutFlows()
+ {
+ return Collections.unmodifiableList(outFlows);
+ }
@Override
public String toString()
Modified: jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ProcessDefinitionImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ProcessDefinitionImpl.java 2008-11-17 09:57:53 UTC (rev 2951)
+++ jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ProcessDefinitionImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
@@ -22,7 +22,10 @@
package org.jbpm.integration.model;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
import javax.management.ObjectName;
@@ -33,9 +36,6 @@
import org.jbpm.api.model.Process;
import org.jbpm.api.model.ProcessDefinition;
import org.jbpm.api.model.builder.ObjectNameFactory;
-import org.jbpm.graph.node.EndState;
-import org.jbpm.graph.node.StartState;
-import org.jbpm.graph.node.State;
/**
* An integration wrapper
@@ -49,6 +49,7 @@
private org.jbpm.graph.def.ProcessDefinition oldProcDef;
private ProcessEngine engine;
+ private Map<String, Node> nodes = new LinkedHashMap<String, Node>();
public ProcessDefinitionImpl(ProcessEngine engine, String name)
{
@@ -88,33 +89,33 @@
@Override
public Process newInstance()
{
- return new ProcessImpl(this);
+ ProcessImpl procImpl = new ProcessImpl(this);
+ for (Node node : getNodes())
+ {
+ NodeImpl nodeImpl = (NodeImpl)node;
+ nodeImpl.setProcess(procImpl);
+ }
+ return procImpl;
}
public void addNode(NodeImpl nodeImpl)
{
org.jbpm.graph.def.Node oldNode = nodeImpl.getOldNode();
oldProcDef.addNode(oldNode);
+ nodes.put(oldNode.getName(), nodeImpl);
}
@Override
public Node getNode(String name)
{
- org.jbpm.graph.def.Node oldNode = oldProcDef.getNode(name);
- return adaptNode(oldNode);
+ return nodes.get(name);
}
@Override
- @SuppressWarnings("unchecked")
public List<Node> getNodes()
{
- List<Node> nodes = new ArrayList<Node>();
- List<org.jbpm.graph.def.Node> oldNodes = oldProcDef.getNodes();
- for (org.jbpm.graph.def.Node oldNode : oldNodes)
- {
- nodes.add(adaptNode(oldNode));
- }
- return nodes;
+ List<Node> nodeList = new ArrayList<Node>(nodes.values());
+ return Collections.unmodifiableList(nodeList);
}
@Override
@@ -141,29 +142,4 @@
}
return retNodes;
}
-
- private NodeImpl adaptNode(org.jbpm.graph.def.Node oldNode)
- {
- NodeImpl node = null;
- if (oldNode != null)
- {
- if (oldNode instanceof StartState)
- {
- node = new StartEventImpl(this, (StartState)oldNode);
- }
- else if (oldNode instanceof State)
- {
- node = new WaitStateImpl(this, (State)oldNode);
- }
- else if (oldNode instanceof EndState)
- {
- node = new EndEventImpl(this, (EndState)oldNode);
- }
- else
- {
- node = new TaskImpl(this, oldNode);
- }
- }
- return node;
- }
}
Modified: jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ProcessImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ProcessImpl.java 2008-11-17 09:57:53 UTC (rev 2951)
+++ jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/ProcessImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
@@ -79,9 +79,11 @@
@Override
public ProcessStatus getProcessStatus()
{
- if (rootToken.getTokenStatus() == TokenStatus.Destroyed)
- procStatus = ProcessStatus.Completed;
-
+ if (rootToken != null && procStatus == ProcessStatus.Active)
+ {
+ if (rootToken.getTokenStatus() == TokenStatus.Destroyed)
+ procStatus = ProcessStatus.Completed;
+ }
return procStatus;
}
@@ -91,23 +93,6 @@
}
@Override
- public Token startProcess()
- {
- setProcessStatus(ProcessStatus.Ready);
- rootToken = startProcess(null);
- return rootToken;
- }
-
- @Override
- public Token startProcess(Attachments att)
- {
- oldProc = new ProcessInstance(procDef.getOldProcessDefinition());
- TokenImpl token = new TokenImpl(this, oldProc.getRootToken(), att);
- token.signal();
- return token;
- }
-
- @Override
public String getName()
{
return procDef.getName();
@@ -136,4 +121,25 @@
{
return procDef.getNodes(clazz);
}
+
+ @Override
+ public Token startProcess()
+ {
+ return startProcess(null);
+ }
+
+ @Override
+ public Token startProcess(Attachments att)
+ {
+ setProcessStatus(ProcessStatus.Active);
+ oldProc = new ProcessInstance(procDef.getOldProcessDefinition());
+ rootToken = new TokenImpl(this, oldProc.getRootToken(), att);
+ rootToken.signal();
+ return rootToken;
+ }
+
+ public Token getRootToken()
+ {
+ return rootToken;
+ }
}
Modified: jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/SequenceFlowImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/SequenceFlowImpl.java 2008-11-17 09:57:53 UTC (rev 2951)
+++ jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/SequenceFlowImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
@@ -21,9 +21,9 @@
*/
package org.jbpm.integration.model;
-import org.jbpm.api.NotImplementedException;
import org.jbpm.api.model.Expression;
import org.jbpm.api.model.SequenceFlow;
+import org.jbpm.api.model.Expression.ExpressionLanguage;
import org.jbpm.graph.def.Node;
import org.jbpm.graph.def.Transition;
@@ -39,16 +39,33 @@
private Transition oldTrans;
private ConditionType condType = ConditionType.None;
+ private Expression expr;
public SequenceFlowImpl(Transition oldTrans)
{
this.oldTrans = oldTrans;
}
+ public SequenceFlowImpl(Transition oldTrans, ExpressionLanguage exprLang, String exprBody)
+ {
+ this.oldTrans = oldTrans;
+
+ if (exprLang != null && exprBody != null)
+ {
+ this.condType = ConditionType.Expression;
+ this.expr = new ExpressionImpl(exprLang, exprBody);
+ }
+ }
+
+ public Transition getOldTransition()
+ {
+ return oldTrans;
+ }
+
@Override
public Expression getConditionExpression()
{
- throw new NotImplementedException();
+ return expr;
}
@Override
Added: jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/builder/GatewayBuilderImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/builder/GatewayBuilderImpl.java (rev 0)
+++ jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/builder/GatewayBuilderImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
@@ -0,0 +1,62 @@
+/*
+ * 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.model.builder;
+
+//$Id$
+
+import org.jbpm.api.NotImplementedException;
+import org.jbpm.api.model.Expression.ExpressionLanguage;
+import org.jbpm.api.model.builder.GatewayBuilder;
+
+/**
+ * The GatewayBuilder can be used to build a Gateway dynamically.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 15-Nov-2008
+ */
+public class GatewayBuilderImpl extends ProcessBuilderImpl implements GatewayBuilder
+{
+ protected GatewayBuilderImpl(ProcessBuilderImpl procBuilder)
+ {
+ super(procBuilder);
+ }
+
+ @Override
+ public GatewayBuilder addGate(String targetName)
+ {
+ addSequenceFlow(targetName);
+ return this;
+ }
+
+ @Override
+ public GatewayBuilder addConditionalGate(String targetName, ExpressionLanguage exprLang, String exprBody)
+ {
+ addSequenceFlow(targetName, exprLang, exprBody);
+ return this;
+ }
+
+ @Override
+ public GatewayBuilder addDefaultGate(String targetName)
+ {
+ throw new NotImplementedException();
+ }
+}
\ No newline at end of file
Property changes on: jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/builder/GatewayBuilderImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/builder/ProcessBuilderImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/builder/ProcessBuilderImpl.java 2008-11-17 09:57:53 UTC (rev 2951)
+++ jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/model/builder/ProcessBuilderImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
@@ -35,16 +35,21 @@
import org.jbpm.api.model.Process;
import org.jbpm.api.model.ProcessDefinition;
import org.jbpm.api.model.StartEvent;
+import org.jbpm.api.model.Expression.ExpressionLanguage;
import org.jbpm.api.model.Gateway.GatewayType;
import org.jbpm.api.model.Task.TaskType;
import org.jbpm.api.model.builder.GatewayBuilder;
import org.jbpm.api.model.builder.ProcessBuilder;
+import org.jbpm.graph.def.Transition;
+import org.jbpm.graph.node.Decision;
import org.jbpm.graph.node.EndState;
import org.jbpm.graph.node.StartState;
import org.jbpm.graph.node.State;
import org.jbpm.integration.model.EndEventImpl;
+import org.jbpm.integration.model.ExclusiveGatewayImpl;
import org.jbpm.integration.model.NodeImpl;
import org.jbpm.integration.model.ProcessDefinitionImpl;
+import org.jbpm.integration.model.SequenceFlowImpl;
import org.jbpm.integration.model.StartEventImpl;
import org.jbpm.integration.model.TaskImpl;
import org.jbpm.integration.model.WaitStateImpl;
@@ -61,7 +66,7 @@
protected ProcessDefinitionImpl procDefImpl;
protected NodeImpl nodeImpl;
- private List<FlowTuple> flows = new ArrayList<FlowTuple>();
+ private List<FlowSpec> flows = new ArrayList<FlowSpec>();
public ProcessBuilderImpl(ProcessEngine engine)
{
@@ -86,43 +91,7 @@
@Override
public ProcessDefinition getProcessDefinition()
{
- // Initialize the flows
- for (FlowTuple flow : flows)
- {
- NodeImpl srcNode = (NodeImpl)procDefImpl.getNode(flow.source);
- if (srcNode == null)
- throw new InvalidProcessException("Cannot obtain source node: " + flow.source);
-
- srcNode.addSequenceFlow(flow.target);
- }
-
- // Verify that there is a start event
- List<StartEvent> startEvents = procDefImpl.getNodes(StartEvent.class);
- if (startEvents.size() == 0)
- throw new InvalidProcessException("Cannot obtain a start event");
-
- // Verify that there is an end event
- List<EndEvent> endEvents = procDefImpl.getNodes(EndEvent.class);
- if (endEvents.size() == 0)
- throw new InvalidProcessException("Cannot obtain an end event");
-
- // Detect unreachable nodes
- for (Node node : procDefImpl.getNodes())
- {
- NodeImpl nodeImpl = (NodeImpl)node;
- Set arriving = nodeImpl.getOldNode().getArrivingTransitions();
- if (!(node instanceof StartEvent) && arriving == null)
- throw new InvalidProcessException("Unreachable node: " + node);
- }
-
- // Detect dead end nodes
- for (Node node : procDefImpl.getNodes())
- {
- NodeImpl nodeImpl = (NodeImpl)node;
- List leaving = nodeImpl.getOldNode().getLeavingTransitions();
- if (!(node instanceof EndEvent) && leaving == null)
- throw new InvalidProcessException("Dead end node: " + node);
- }
+ initProcessDefinition();
return procDefImpl;
}
@@ -137,7 +106,16 @@
@Override
public GatewayBuilder addGateway(String name, GatewayType type)
{
- return null;
+ if (type == GatewayType.Exclusive)
+ {
+ nodeImpl = new ExclusiveGatewayImpl(procDefImpl, new Decision(name));
+ procDefImpl.addNode(nodeImpl);
+ }
+ else
+ {
+ throw new NotImplementedException("Unsupported gateway type: " + type);
+ }
+ return new GatewayBuilderImpl(this);
}
@Override
@@ -177,19 +155,78 @@
@Override
public ProcessBuilder addSequenceFlow(String targetName)
{
- flows.add(new FlowTuple(nodeImpl.getName(), targetName));
+ return addSequenceFlow(targetName, null, null);
+ }
+
+ public ProcessBuilder addSequenceFlow(String targetName, ExpressionLanguage exprLang, String exprBody)
+ {
+ flows.add(new FlowSpec(nodeImpl.getName(), targetName, exprLang, exprBody));
return this;
}
- private class FlowTuple
+ class FlowSpec
{
String source;
String target;
+ ExpressionLanguage exprLang;
+ String exprBody;
- public FlowTuple(String source, String target)
+ public FlowSpec(String source, String target, ExpressionLanguage exprLang, String exprBody)
{
this.source = source;
this.target = target;
+ this.exprLang = exprLang;
+ this.exprBody = exprBody;
}
}
+
+ private void initProcessDefinition()
+ {
+ // Initialize the flows
+ for (FlowSpec flow : flows)
+ {
+ NodeImpl srcNode = (NodeImpl)procDefImpl.getNode(flow.source);
+ if (srcNode == null)
+ throw new InvalidProcessException("Cannot obtain source node: " + flow.source);
+
+ NodeImpl targetNode = (NodeImpl)procDefImpl.getNode(flow.target);
+ if (targetNode == null)
+ throw new InvalidProcessException("Cannot obtain target node: " + flow.target);
+
+ Transition trans = new Transition(flow.target);
+ trans.setFrom(srcNode.getOldNode());
+ trans.setTo(targetNode.getOldNode());
+
+ SequenceFlowImpl seqFlow = new SequenceFlowImpl(trans, flow.exprLang, flow.exprBody);
+ srcNode.addSequenceFlow(seqFlow);
+ }
+
+ // Verify that there is a start event
+ List<StartEvent> startEvents = procDefImpl.getNodes(StartEvent.class);
+ if (startEvents.size() == 0)
+ throw new InvalidProcessException("Cannot obtain a start event");
+
+ // Verify that there is an end event
+ List<EndEvent> endEvents = procDefImpl.getNodes(EndEvent.class);
+ if (endEvents.size() == 0)
+ throw new InvalidProcessException("Cannot obtain an end event");
+
+ // Detect unreachable nodes
+ for (Node node : procDefImpl.getNodes())
+ {
+ NodeImpl nodeImpl = (NodeImpl)node;
+ Set arriving = nodeImpl.getOldNode().getArrivingTransitions();
+ if (!(node instanceof StartEvent) && arriving == null)
+ throw new InvalidProcessException("Unreachable node: " + node);
+ }
+
+ // Detect dead end nodes
+ for (Node node : procDefImpl.getNodes())
+ {
+ NodeImpl nodeImpl = (NodeImpl)node;
+ List leaving = nodeImpl.getOldNode().getLeavingTransitions();
+ if (!(node instanceof EndEvent) && leaving == null)
+ throw new InvalidProcessException("Dead end node: " + node);
+ }
+ }
}
\ No newline at end of file
Added: jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/runtime/ExpressionEvaluator.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/runtime/ExpressionEvaluator.java (rev 0)
+++ jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/runtime/ExpressionEvaluator.java 2008-11-17 11:41:14 UTC (rev 2952)
@@ -0,0 +1,76 @@
+/*
+ * 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.HashMap;
+import java.util.Map;
+
+import org.jbpm.api.client.Token;
+import org.jbpm.api.model.Expression;
+import org.jbpm.api.model.Expression.ExpressionLanguage;
+import org.jbpm.api.runtime.Attachments;
+import org.jbpm.api.runtime.Attachments.Key;
+import org.mvel.MVEL;
+
+/**
+ * Evaluates an expression for a given token
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 08-Jul-2008
+ */
+public class ExpressionEvaluator
+{
+ private Expression expr;
+
+ public ExpressionEvaluator(Expression expr)
+ {
+ this.expr = expr;
+ }
+
+ /**
+ * Evaluate an expression for a given token. <p/> Note that <code>propName.replace(".", "_")</code> applies to
+ * property names for MVEL expressions, because the dot notation has special meaning in MVEL.
+ */
+ public Object evaluateExpression(Token token)
+ {
+ ExpressionLanguage exprLang = expr.getExpressionLanguage();
+ if (exprLang == ExpressionLanguage.MVEL)
+ {
+ String mvel = expr.getExpressionBody();
+ Attachments atts = token.getAttachments();
+ Map<String, Object> vars = new HashMap<String, Object>();
+ for (Key key : atts.getAttachmentKeys())
+ {
+ String name = key.getNamePart();
+ Object value = atts.getAttachment(name);
+ vars.put(name.replace(".", "_"), value);
+ }
+ return MVEL.eval(mvel, vars);
+ }
+ else
+ {
+ throw new IllegalStateException("Unsupported expression language: " + exprLang);
+ }
+ }
+}
\ No newline at end of file
Property changes on: jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/runtime/ExpressionEvaluator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/service/ProcessDefinitionServiceImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/service/ProcessDefinitionServiceImpl.java 2008-11-17 09:57:53 UTC (rev 2951)
+++ jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/service/ProcessDefinitionServiceImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
@@ -33,7 +33,7 @@
import org.jbpm.api.client.ProcessEngine;
import org.jbpm.api.model.ProcessDefinition;
import org.jbpm.api.service.ProcessDefinitionService;
-import org.jbpm.api.service.ProcessInstanceService;
+import org.jbpm.api.service.ProcessService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -96,7 +96,7 @@
ProcessEngine engine = getProcessEngine();
// Unregister the associated process instances
- ProcessInstanceService procService = engine.getService(ProcessInstanceService.class);
+ ProcessService procService = engine.getService(ProcessService.class);
for (ObjectName procID : procService.getProcesses(procDef.getName(), null))
procService.unregisterProcess(procID);
Modified: jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/service/ProcessServiceImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/service/ProcessServiceImpl.java 2008-11-17 09:57:53 UTC (rev 2951)
+++ jbpm3/branches/tdiesler/modules/integration/src/main/java/org/jbpm/integration/service/ProcessServiceImpl.java 2008-11-17 11:41:14 UTC (rev 2952)
@@ -25,10 +25,21 @@
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.management.ObjectName;
+
import org.jbpm.api.client.ProcessEngine;
-import org.jbpm.api.service.ProcessInstanceService;
+import org.jbpm.api.model.Process;
+import org.jbpm.api.model.ProcessDefinition;
+import org.jbpm.api.model.Process.ProcessStatus;
+import org.jbpm.api.service.ProcessDefinitionService;
+import org.jbpm.api.service.ProcessService;
+import org.jbpm.integration.model.ProcessImpl;
import org.jbpm.integration.runtime.NodeInterceptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,11 +50,12 @@
* @author thomas.diesler(a)jboss.com
* @since 18-Jun-2008
*/
-public class ProcessServiceImpl extends ProcessInstanceService implements MutableService
+public class ProcessServiceImpl extends ProcessService implements MutableService
{
// Provide logging
final static Logger log = LoggerFactory.getLogger(ProcessServiceImpl.class);
+ private Map<ObjectName, Process> registeredProcs = new HashMap<ObjectName, Process>();
private List<NodeInterceptor> nodeInterceptors = new ArrayList<NodeInterceptor>();
@Override
@@ -66,6 +78,96 @@
return Collections.unmodifiableList(nodeInterceptors);
}
+ /**
+ * Get a Process for a given id
+ */
+ @Override
+ public Process getProcess(ObjectName procID)
+ {
+ Process proc = registeredProcs.get(procID);
+ return proc;
+ }
+
+ /**
+ * Get the set of registered Processes
+ */
+ @Override
+ public Set<ObjectName> getProcesses()
+ {
+ return Collections.unmodifiableSet(registeredProcs.keySet());
+ }
+
+ /**
+ * Find the set of Processes for a given name
+ *
+ * @param name The process name
+ * @param status The optional process status
+ * @return An empty set if the process cannot be found
+ */
+ @Override
+ public Set<ObjectName> getProcesses(String name, ProcessStatus status)
+ {
+ Set<ObjectName> procSet = new HashSet<ObjectName>();
+ for (Process auxProc : registeredProcs.values())
+ {
+ if (auxProc.getName().equals(name))
+ {
+ if (status == null || auxProc.getProcessStatus() == status)
+ procSet.add(auxProc.getKey());
+ }
+ }
+ return procSet;
+ }
+
+ /**
+ * Register a Process.
+ */
+ public ObjectName registerProcess(Process proc)
+ {
+ log.debug("registerProcess: " + proc);
+
+ ObjectName procID = proc.getKey();
+ if (getProcess(procID) != null)
+ throw new IllegalStateException("Process already registered: " + proc);
+
+ ProcessStatus procStatus = proc.getProcessStatus();
+ ProcessDefinition procDef = proc.getProcessDefinition();
+ ProcessEngine engine = getProcessEngine();
+
+ if (procStatus != ProcessStatus.None)
+ throw new IllegalStateException("Cannot register process in state: " + procStatus);
+
+ // Register the process definition if needed
+ ProcessDefinitionService procDefService = engine.getService(ProcessDefinitionService.class);
+ if (procDefService.getProcessDefinition(procDef.getKey()) == null)
+ procDefService.registerProcessDefinition(procDef);
+
+ // Register the process
+ registeredProcs.put(procID, proc);
+
+ ProcessImpl procImpl = (ProcessImpl)proc;
+ procImpl.setProcessStatus(ProcessStatus.Ready);
+
+ return procID;
+ }
+
+ /**
+ * Unregister a Process.
+ */
+ public boolean unregisterProcess(ObjectName procID)
+ {
+ boolean removed = false;
+ Process proc = registeredProcs.get(procID);
+ if (proc != null)
+ {
+ log.debug("unregisterProcess: " + proc);
+
+ registeredProcs.remove(procID);
+ removed = true;
+ }
+ return removed;
+ }
+
private NodeInterceptor loadNodeInterceptor(String className)
{
NodeInterceptor itor = null;
17 years, 5 months
JBoss JBPM SVN: r2951 - in projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client: task and 1 other directory.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-11-17 04:57:53 -0500 (Mon, 17 Nov 2008)
New Revision: 2951
Modified:
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Menu.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
Log:
Enable TaskManagemnt menu. Group task forms in tab layout
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Menu.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Menu.java 2008-11-17 09:54:08 UTC (rev 2950)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Menu.java 2008-11-17 09:57:53 UTC (rev 2951)
@@ -30,6 +30,7 @@
import com.gwtext.client.widgets.tree.event.TreeNodeListenerAdapter;
import org.jboss.bpm.console.client.metric.MetricOverviewEditor;
import org.jboss.bpm.console.client.process.ProcessDefinitionListEditor;
+import org.jboss.bpm.console.client.task.TaskListEditor;
import java.util.ArrayList;
import java.util.List;
@@ -58,7 +59,7 @@
this.setLayout(accordion);
MenuSection navPanel = new MenuSection("Process Management", "bpm-process-icon", new ProcessTree());
- MenuSection taskPanel = new MenuSection("Task Management", "bpm-task-icon", null);
+ MenuSection taskPanel = new MenuSection("Task Management", "bpm-task-icon", new TaskTree());
MenuSection metricPanel = new MenuSection("Metrics and Stats", "bpm-metric-icon", new MetricTree());
MenuSection settingsPanel = new MenuSection("Settings", "bpm-settings-icon", new SettingsTree());
@@ -84,21 +85,21 @@
TreeNode definitions = new TreeNode("View definitions");
definitions.setExpanded(true);
definitions.addListener(
- new TreeNodeListenerAdapter()
- {
- public void onClick(Node node, EventObject eventObject)
- {
- if(view.hasEditor(ProcessDefinitionListEditor.ID))
- {
- view.showEditor(ProcessDefinitionListEditor.ID);
- }
- else
- {
- view.addEditor( new ProcessDefinitionListEditor(view) );
- }
+ new TreeNodeListenerAdapter()
+ {
+ public void onClick(Node node, EventObject eventObject)
+ {
+ if(view.hasEditor(ProcessDefinitionListEditor.ID))
+ {
+ view.showEditor(ProcessDefinitionListEditor.ID);
+ }
+ else
+ {
+ view.addEditor( new ProcessDefinitionListEditor(view) );
+ }
- }
- }
+ }
+ }
);
TreeNode upload = new TreeNode("Upload new definitions");
upload.setExpanded(true);
@@ -122,21 +123,21 @@
TreeNode overview = new TreeNode("Process workload");
overview.setExpanded(true);
overview.addListener(
- new TreeNodeListenerAdapter()
- {
- public void onClick(Node node, EventObject eventObject)
- {
- if(view.hasEditor(MetricOverviewEditor.ID))
- {
- view.showEditor(MetricOverviewEditor.ID);
- }
- else
- {
- view.addEditor( new MetricOverviewEditor(view) );
- }
+ new TreeNodeListenerAdapter()
+ {
+ public void onClick(Node node, EventObject eventObject)
+ {
+ if(view.hasEditor(MetricOverviewEditor.ID))
+ {
+ view.showEditor(MetricOverviewEditor.ID);
+ }
+ else
+ {
+ view.addEditor( new MetricOverviewEditor(view) );
+ }
- }
- }
+ }
+ }
);
TreeNode export = new TreeNode("Export stats");
@@ -161,27 +162,63 @@
TreeNode overview = new TreeNode("Assigned roles");
overview.setExpanded(true);
overview.addListener(
- new TreeNodeListenerAdapter()
- {
- public void onClick(Node node, EventObject eventObject)
- {
- StringBuffer sb = new StringBuffer();
- for(String roleName : view.getRolesAssigned())
- {
- sb.append("<br> - ").append(roleName);
- }
+ new TreeNodeListenerAdapter()
+ {
+ public void onClick(Node node, EventObject eventObject)
+ {
+ StringBuffer sb = new StringBuffer();
+ for(String roleName : view.getRolesAssigned())
+ {
+ sb.append("<br> - ").append(roleName);
+ }
- view.displayMessage("Assigned roles: " + sb.toString(), false);
- }
- }
+ view.displayMessage("Assigned roles: " + sb.toString(), false);
+ }
+ }
);
root.appendChild(overview);
-
+
setRootVisible(true);
setRootNode(root);
root.setExpanded(true);
}
}
+
+ class TaskTree extends TreePanel
+ {
+
+ public TaskTree()
+ {
+ TreeNode root = new TreeNode("Your tasks");
+
+ TreeNode overview = new TreeNode("Overview");
+ overview.setExpanded(true);
+ overview.addListener(
+ new TreeNodeListenerAdapter()
+ {
+ public void onClick(Node node, EventObject eventObject)
+ {
+ if(view.hasEditor(TaskListEditor.ID))
+ {
+ view.showEditor(TaskListEditor.ID);
+ }
+ else
+ {
+ view.addEditor( new TaskListEditor(view) );
+ }
+
+ }
+ }
+ );
+
+ root.appendChild(overview);
+
+ setRootVisible(true);
+ setRootNode(root);
+ root.setExpanded(true);
+
+ }
+ }
}
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-17 09:54:08 UTC (rev 2950)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskList.java 2008-11-17 09:57:53 UTC (rev 2951)
@@ -227,8 +227,8 @@
final ColumnModel columnModel = new ColumnModel(
new ColumnConfig[]
{
- new ColumnConfig("ID", "id", 25, true),
- new ColumnConfig("Task Name", "name", 300, true, null, "expand"),
+ new ColumnConfig("ID", "id", 35, true),
+ new ColumnConfig("Task Name", "name", 290, true, null, "expand"),
new ColumnConfig("Assigned to", "actor", 75, true),
new ColumnConfig("State", "currentState", 50, true)
}
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-17 09:54:08 UTC (rev 2950)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskListEditor.java 2008-11-17 09:57:53 UTC (rev 2951)
@@ -29,7 +29,6 @@
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.DateField;
import com.gwtext.client.widgets.form.FieldSet;
import com.gwtext.client.widgets.form.FormPanel;
import com.gwtext.client.widgets.form.TextField;
@@ -59,6 +58,8 @@
private TaskReference selectedInstance;
+ private TabPanel tabPanel;
+
public TaskListEditor(MainView mainView )
{
super();
@@ -110,28 +111,38 @@
leftHand.setBorder(false);
// ----------------------------------
+
+ tabPanel = new TabPanel();
+ tabPanel.setPaddings(10);
+ tabPanel.setPlain(true);
+ tabPanel.setActiveTab(0);
+ tabPanel.setWidth(UIConstants.EDITOR_PANEL_WIDTH);
- taskList = new TaskList("Your tasks", mainView);
+ PaddedPanel tabPadding = new PaddedPanel(tabPanel, 0,10,0,10);
+
+ // ----------------------------------
+
+ taskList = new TaskList("Task overview", mainView);
leftHand.add(taskList);
// ----------------------------------
- Panel detailsFormPanel = assembleFormPanel();
- leftHand.add(detailsFormPanel);
+ Panel detailsFormPanel = assembleFormPanel();
+ tabPanel.add(detailsFormPanel);
- /*
- formContainer = new Panel();
+ formContainer = new Panel("Data");
formContainer.setPaddings(10);
formContainer.setBorder(false);
- leftHand.add(formContainer);
- */
+ tabPanel.add(formContainer);
+ leftHand.add(tabPadding);
+
// ----------------------------------
teaserPanel = new TeaserPanel();
- // ----------------------------------
-
+ // ----------------------------------
+
this.add(leftHand, new ColumnLayoutData(0.7) );
this.add(teaserPanel , new ColumnLayoutData(0.3) );
@@ -153,9 +164,9 @@
// ---------------
Panel outerFormPanel = new Panel();
+ outerFormPanel.setTitle("Assignment");
outerFormPanel.setBorder(false);
- outerFormPanel.setFrame(false);
- outerFormPanel.setPaddings(10);
+ outerFormPanel.setFrame(false);
// ---------------
@@ -164,28 +175,27 @@
formPanel.setWidth(UIConstants.EDITOR_PANEL_WIDTH);
formPanel.setHeader(false);
formPanel.setFrame(false);
+ formPanel.setBorder(false);
formPanel.setPaddings(5, 5, 5, 0);
formPanel.setLabelWidth(120);
- // ---------------
+ //the field names must match the data field values from the Store
+ TextField idField = new TextField("Id", "id", 230);
+ idField.setReadOnly(true);
+ formPanel.add(idField);
- FieldSet fieldSet = new FieldSet();
- fieldSet.setLabelWidth(90);
- fieldSet.setTitle("Task Instance Details");
- fieldSet.setAutoHeight(true);
- fieldSet.setBorder(false);
+ TextField nameField = new TextField("Name", "name", 230);
+ nameField.setReadOnly(true);
+ formPanel.add(nameField);
- // ---------------
- //the field names must match the data field values from the Store
- fieldSet.add(new TextField("Id", "id", 230));
- fieldSet.add(new TextField("Name", "name", 230));
- fieldSet.add(new TextField("Actor", "actor", 230));
- fieldSet.add(new TextField("State", "currentState", 230));
+ TextField actorField = new TextField("Actor", "actor", 230);
+ actorField.setReadOnly(true);
+ formPanel.add(actorField);
- Panel inner = new PaddedPanel(fieldSet, 0, 10, 0, 0);
+ TextField stateField = new TextField("State", "currentState", 230);
+ stateField.setReadOnly(true);
+ formPanel.add(stateField);
- formPanel.add(inner);
-
final Button startBtn = new Button("Start Progress",
new ButtonListenerAdapter()
{
17 years, 5 months
JBoss JBPM SVN: r2950 - in jbpm4/trunk/modules: api/src/main/java/org/jbpm/task and 4 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-11-17 04:54:08 -0500 (Mon, 17 Nov 2008)
New Revision: 2950
Added:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/
jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Role.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Task.java
Removed:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/Task.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/Role.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/RoleType.java
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/Assigner.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/cmd/CreateTask.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/cmd/GetTask.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/cmd/UpdateTask.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/RoleImpl.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/SwimlaneImpl.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskExecution.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskImpl.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskServiceImpl.java
jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/TaskDbTest.java
jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/TaskServiceTest.java
jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/TaskTest.java
Log:
task module clean up
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/Task.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/Task.java 2008-11-17 09:24:58 UTC (rev 2949)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/Task.java 2008-11-17 09:54:08 UTC (rev 2950)
@@ -1,49 +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;
-
-import java.io.Serializable;
-import java.util.Date;
-
-/** runtime task.
- *
- * @author Tom Baeyens
- */
-public interface Task extends Serializable {
-
- String getId();
-
- String getName();
- void setName(String name);
-
- String getDescription();
- void setDescription(String description);
-
- Date getCreate();
-
- int getPriority();
- void setPriority(int priority);
-
- Date getDueDate();
- void setDueDate(Date dueDate);
-
-}
\ No newline at end of file
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java 2008-11-17 09:24:58 UTC (rev 2949)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java 2008-11-17 09:54:08 UTC (rev 2950)
@@ -23,6 +23,9 @@
import java.util.List;
+import org.jbpm.task.Role;
+import org.jbpm.task.Task;
+
public interface TaskService {
Task newTask(String taskId);
@@ -30,6 +33,9 @@
void updateTask(Task task);
void submitTask(String taskId);
void deleteTask(String taskId);
+
+ List<String> getCandidates(String taskId);
+ List<Role> getRoles(String taskId);
/** retrieves the personal task of the given user, which might be different
* then the current authenticated user. E.g. when a manager wants to
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Role.java (from rev 2908, jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/Role.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Role.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Role.java 2008-11-17 09:54:08 UTC (rev 2950)
@@ -0,0 +1,43 @@
+/*
+ * 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.task;
+
+
+/** a role that a person fullfills for a task.
+ *
+ * @author Tom Baeyens
+ */
+public interface Role {
+
+ long getDbid();
+
+ String getIdentityId();
+ void setIdentityId(String identityId);
+
+ String getRoleType();
+ void setRoleType(String roleType);
+
+ String getDescription();
+ void setDescription(String description);
+
+ Task getTask();
+}
\ No newline at end of file
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Role.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Task.java (from rev 2935, jbpm4/trunk/modules/api/src/main/java/org/jbpm/Task.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Task.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Task.java 2008-11-17 09:54:08 UTC (rev 2950)
@@ -0,0 +1,73 @@
+/*
+ * 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.task;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/** runtime task.
+ *
+ * @author Tom Baeyens
+ */
+public interface Task extends Serializable {
+
+ /** can do anything with the task */
+ String ROLETYPE_OWNER = "owner";
+
+ /** alternative owner, but as long as this person is not the owner.
+ * This person is allowed to make comments, but nothing else. */
+ String ROLETYPE_CANDIDATE = "candidate";
+
+ /** person that will be using the result of this task. This person is
+ * allowed to make comments, but nothing else. */
+ String ROLETYPE_CLIENT = "client";
+
+ /** person that is allowed to watch-but-not-touch this task */
+ String ROLETYPE_VIEWER = "viewer";
+
+ /** a person that was assigned to a task, but got replaced because of
+ * absence or another reason. This way, a trace can be left in case
+ * This person returns and wants to take back his tasks that got
+ * reassigned. */
+ String ROLETYPE_REPLACED_ASSIGNEE = "replaced-assignee";
+
+
+ String getId();
+
+ String getName();
+ void setName(String name);
+
+ String getAssignedUserId();
+ void setAssignedUserId(String assignedUserId);
+
+ String getDescription();
+ void setDescription(String description);
+
+ Date getCreate();
+
+ int getPriority();
+ void setPriority(int priority);
+
+ Date getDueDate();
+ void setDueDate(Date dueDate);
+
+}
\ No newline at end of file
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Task.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/Assigner.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/Assigner.java 2008-11-17 09:24:58 UTC (rev 2949)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/Assigner.java 2008-11-17 09:54:08 UTC (rev 2950)
@@ -23,7 +23,6 @@
import java.io.Serializable;
-import org.jbpm.Task;
/** interface to delegate {@link Task} or {@link Swimlane} assignment.
* @author Tom Baeyens
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/Role.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/Role.java 2008-11-17 09:24:58 UTC (rev 2949)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/Role.java 2008-11-17 09:54:08 UTC (rev 2950)
@@ -1,46 +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.task;
-
-import org.jbpm.Task;
-
-/** a role that a person fullfills for a task.
- *
- * @author Tom Baeyens
- */
-public interface Role {
-
- long getDbid();
-
- String getIdentityId();
- void setIdentityId(String identityId);
-
- RoleType getRoleType();
- void setRoleType(RoleType roleType);
-
- String getDescription();
- void setDescription(String description);
-
- Task getTask();
-
- Swimlane getSwimlane();
-}
\ No newline at end of file
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/RoleType.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/RoleType.java 2008-11-17 09:24:58 UTC (rev 2949)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/RoleType.java 2008-11-17 09:54:08 UTC (rev 2950)
@@ -1,30 +0,0 @@
-package org.jbpm.task;
-
-/** roleType of a person that is related to a task determines the
- * privileges that are granted on the task. */
-public enum RoleType {
-
- /** can do anything with the task */
- OWNER,
-
- /** alternative owner, but as long as this person is not the owner.
- * This person is allowed to make comments, but nothing else. */
- CANDIDATE,
-
- /** person that will be using the result of this task. This person is
- * allowed to make comments, but nothing else. */
- CLIENT,
-
- /** person that is allowed to watch-but-not-touch this task */
- VIEWER,
-
- /** a person that was assigned to a task, but got replaced because of
- * absence or another reason. This way, a trace can be left in case
- * This person returns and wants to take back his tasks that got
- * reassigned. */
- REPLACED_ASSIGNEE;
-
- public String toString() {
- return super.toString().toLowerCase().replace('_', '-');
- }
-}
\ No newline at end of file
Modified: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/cmd/CreateTask.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/cmd/CreateTask.java 2008-11-17 09:24:58 UTC (rev 2949)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/cmd/CreateTask.java 2008-11-17 09:54:08 UTC (rev 2950)
@@ -21,11 +21,11 @@
*/
package org.jbpm.task.cmd;
-import org.jbpm.Task;
import org.jbpm.cmd.Command;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.session.DbSession;
+import org.jbpm.task.Task;
import org.jbpm.task.db.TaskDbSession;
import org.jbpm.task.impl.TaskDefinitionImpl;
import org.jbpm.task.impl.TaskImpl;
Modified: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/cmd/GetTask.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/cmd/GetTask.java 2008-11-17 09:24:58 UTC (rev 2949)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/cmd/GetTask.java 2008-11-17 09:54:08 UTC (rev 2950)
@@ -21,10 +21,10 @@
*/
package org.jbpm.task.cmd;
-import org.jbpm.Task;
import org.jbpm.cmd.Command;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.session.DbSession;
+import org.jbpm.task.Task;
import org.jbpm.task.impl.TaskImpl;
/**
Modified: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/cmd/UpdateTask.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/cmd/UpdateTask.java 2008-11-17 09:24:58 UTC (rev 2949)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/cmd/UpdateTask.java 2008-11-17 09:54:08 UTC (rev 2950)
@@ -21,10 +21,10 @@
*/
package org.jbpm.task.cmd;
-import org.jbpm.Task;
import org.jbpm.cmd.Command;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.session.DbSession;
+import org.jbpm.task.Task;
/**
Modified: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/RoleImpl.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/RoleImpl.java 2008-11-17 09:24:58 UTC (rev 2949)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/RoleImpl.java 2008-11-17 09:54:08 UTC (rev 2950)
@@ -24,7 +24,6 @@
import java.io.Serializable;
import org.jbpm.task.Role;
-import org.jbpm.task.RoleType;
/** the relation between a task and a person.
@@ -37,7 +36,7 @@
protected long dbid;
protected int dbversion;
protected String identityId;
- protected RoleType roleType;
+ protected String roleType;
protected String description;
protected TaskImpl task;
protected SwimlaneImpl swimlane;
@@ -67,16 +66,16 @@
public void setSwimlane(SwimlaneImpl swimlane) {
this.swimlane = swimlane;
}
- public RoleType getRoleType() {
- return roleType;
- }
- public void setRoleType(RoleType roleType) {
- this.roleType = roleType;
- }
public String getIdentityId() {
return identityId;
}
public void setIdentityId(String identityId) {
this.identityId = identityId;
}
+ public String getRoleType() {
+ return roleType;
+ }
+ public void setRoleType(String roleType) {
+ this.roleType = roleType;
+ }
}
Modified: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/SwimlaneImpl.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/SwimlaneImpl.java 2008-11-17 09:24:58 UTC (rev 2949)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/SwimlaneImpl.java 2008-11-17 09:54:08 UTC (rev 2950)
@@ -29,9 +29,9 @@
import org.jbpm.pvm.internal.util.EqualsUtil;
import org.jbpm.task.Role;
-import org.jbpm.task.RoleType;
import org.jbpm.task.Swimlane;
import org.jbpm.task.SwimlaneDefinition;
+import org.jbpm.task.Task;
import org.jbpm.task.TaskException;
/**
@@ -73,7 +73,7 @@
}
RoleImpl role = new RoleImpl();
role.setIdentityId(identityId);
- role.setRoleType(RoleType.CANDIDATE);
+ role.setRoleType(Task.ROLETYPE_CANDIDATE);
role.setSwimlane(this);
if (candidates==null) {
candidates = new HashSet<RoleImpl>();
Modified: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskExecution.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskExecution.java 2008-11-17 09:24:58 UTC (rev 2949)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskExecution.java 2008-11-17 09:54:08 UTC (rev 2950)
@@ -23,8 +23,8 @@
import java.util.Map;
-import org.jbpm.Task;
import org.jbpm.task.Swimlane;
+import org.jbpm.task.Task;
/**
* @author Tom Baeyens
Modified: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskImpl.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskImpl.java 2008-11-17 09:24:58 UTC (rev 2949)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskImpl.java 2008-11-17 09:54:08 UTC (rev 2950)
@@ -31,7 +31,6 @@
import java.util.Set;
import org.jbpm.Execution;
-import org.jbpm.Task;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.internal.cal.Duration;
import org.jbpm.pvm.internal.model.CommentImpl;
@@ -42,8 +41,8 @@
import org.jbpm.pvm.internal.util.ReflectUtil;
import org.jbpm.pvm.model.Comment;
import org.jbpm.task.Role;
-import org.jbpm.task.RoleType;
import org.jbpm.task.Swimlane;
+import org.jbpm.task.Task;
import org.jbpm.task.TaskDefinition;
import org.jbpm.task.TaskException;
@@ -187,7 +186,7 @@
return allRoles;
}
- public Role addRole(String identityId, RoleType roleType) {
+ public Role addRole(String identityId, String roleType) {
if (identityId==null) {
throw new TaskException("userId is null");
}
Modified: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskServiceImpl.java 2008-11-17 09:24:58 UTC (rev 2949)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskServiceImpl.java 2008-11-17 09:54:08 UTC (rev 2950)
@@ -23,10 +23,10 @@
import java.util.List;
-import org.jbpm.Task;
import org.jbpm.TaskService;
import org.jbpm.cmd.CommandService;
import org.jbpm.task.Role;
+import org.jbpm.task.Task;
import org.jbpm.task.cmd.CreateTask;
import org.jbpm.task.cmd.DeleteTask;
import org.jbpm.task.cmd.GetTask;
Modified: jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/TaskDbTest.java
===================================================================
--- jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/TaskDbTest.java 2008-11-17 09:24:58 UTC (rev 2949)
+++ jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/TaskDbTest.java 2008-11-17 09:54:08 UTC (rev 2950)
@@ -28,7 +28,6 @@
import java.util.Map;
import java.util.Set;
-import org.jbpm.Task;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
import org.jbpm.pvm.internal.util.Clock;
Modified: jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/TaskServiceTest.java
===================================================================
--- jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/TaskServiceTest.java 2008-11-17 09:24:58 UTC (rev 2949)
+++ jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/TaskServiceTest.java 2008-11-17 09:54:08 UTC (rev 2950)
@@ -25,7 +25,6 @@
import java.util.List;
import org.hibernate.Session;
-import org.jbpm.Task;
import org.jbpm.cmd.Command;
import org.jbpm.cmd.CommandService;
import org.jbpm.pvm.env.Environment;
Modified: jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/TaskTest.java
===================================================================
--- jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/TaskTest.java 2008-11-17 09:24:58 UTC (rev 2949)
+++ jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/TaskTest.java 2008-11-17 09:54:08 UTC (rev 2950)
@@ -28,7 +28,6 @@
import java.util.Map;
import java.util.Set;
-import org.jbpm.Task;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
import org.jbpm.pvm.internal.util.Clock;
@@ -88,11 +87,11 @@
assertNotNull(task.getRoles());
assertEquals(0, task.getRoles().size());
- task.addRole("john doe", RoleType.CLIENT).setDescription("uses the result");
- task.addRole("joe smoe", RoleType.OWNER).setDescription("does what he wants");
- task.addRole("jack black", RoleType.CANDIDATE).setDescription("can take this task");
- task.addRole("jim slim", RoleType.VIEWER).setDescription("is allowed to see");
- task.addRole("jeff nef", RoleType.REPLACED_ASSIGNEE).setDescription("is sick");
+ task.addRole("john doe", Task.ROLETYPE_CLIENT).setDescription("uses the result");
+ task.addRole("joe smoe", Task.ROLETYPE_OWNER).setDescription("does what he wants");
+ task.addRole("jack black", Task.ROLETYPE_CANDIDATE).setDescription("can take this task");
+ task.addRole("jim slim", Task.ROLETYPE_VIEWER).setDescription("is allowed to see");
+ task.addRole("jeff nef", Task.ROLETYPE_REPLACED_ASSIGNEE).setDescription("is sick");
Set<RoleImpl> roles = task.getRoles();
Map<String, RoleImpl> roleMap = new HashMap<String, RoleImpl>();
@@ -100,19 +99,19 @@
roleMap.put(role.getIdentityId(), role);
}
- assertEquals(RoleType.CLIENT, roleMap.get("john doe").getRoleType());
+ assertEquals(Task.ROLETYPE_CLIENT, roleMap.get("john doe").getRoleType());
assertEquals("uses the result", roleMap.get("john doe").getDescription());
- assertEquals(RoleType.OWNER, roleMap.get("joe smoe").getRoleType());
+ assertEquals(Task.ROLETYPE_OWNER, roleMap.get("joe smoe").getRoleType());
assertEquals("does what he wants", roleMap.get("joe smoe").getDescription());
- assertEquals(RoleType.CANDIDATE, roleMap.get("jack black").getRoleType());
+ assertEquals(Task.ROLETYPE_CANDIDATE, roleMap.get("jack black").getRoleType());
assertEquals("can take this task", roleMap.get("jack black").getDescription());
- assertEquals(RoleType.VIEWER, roleMap.get("jim slim").getRoleType());
+ assertEquals(Task.ROLETYPE_VIEWER, roleMap.get("jim slim").getRoleType());
assertEquals("is allowed to see", roleMap.get("jim slim").getDescription());
- assertEquals(RoleType.REPLACED_ASSIGNEE, roleMap.get("jeff nef").getRoleType());
+ assertEquals(Task.ROLETYPE_REPLACED_ASSIGNEE, roleMap.get("jeff nef").getRoleType());
assertEquals("is sick", roleMap.get("jeff nef").getDescription());
assertEquals(5, roles.size());
@@ -135,7 +134,7 @@
assertNotNull(task.getAllRoles());
assertEquals(0, task.getAllRoles().size());
- task.addRole("john doe", RoleType.CLIENT).setDescription("uses the result");
+ task.addRole("john doe", Task.ROLETYPE_CLIENT).setDescription("uses the result");
SwimlaneImpl manager = new SwimlaneImpl();
task.setSwimlane(manager);
@@ -144,7 +143,7 @@
manager.createCandidate("jack black").setDescription("the pigeon");
manager.createCandidate("jim slim").setDescription("lame duck");
- task.addRole("jeff nef", RoleType.REPLACED_ASSIGNEE).setDescription("is sick");
+ task.addRole("jeff nef", Task.ROLETYPE_REPLACED_ASSIGNEE).setDescription("is sick");
Set<RoleImpl> roles = task.getAllRoles();
Map<String, RoleImpl> roleMap = new HashMap<String, RoleImpl>();
@@ -152,19 +151,19 @@
roleMap.put(role.getIdentityId(), role);
}
- assertEquals(RoleType.CLIENT, roleMap.get("john doe").getRoleType());
+ assertEquals(Task.ROLETYPE_CLIENT, roleMap.get("john doe").getRoleType());
assertEquals("uses the result", roleMap.get("john doe").getDescription());
- assertEquals(RoleType.CANDIDATE, roleMap.get("joe smoe").getRoleType());
+ assertEquals(Task.ROLETYPE_CANDIDATE, roleMap.get("joe smoe").getRoleType());
assertEquals("tostesteron ambition", roleMap.get("joe smoe").getDescription());
- assertEquals(RoleType.CANDIDATE, roleMap.get("jack black").getRoleType());
+ assertEquals(Task.ROLETYPE_CANDIDATE, roleMap.get("jack black").getRoleType());
assertEquals("the pigeon", roleMap.get("jack black").getDescription());
- assertEquals(RoleType.CANDIDATE, roleMap.get("jim slim").getRoleType());
+ assertEquals(Task.ROLETYPE_CANDIDATE, roleMap.get("jim slim").getRoleType());
assertEquals("lame duck", roleMap.get("jim slim").getDescription());
- assertEquals(RoleType.REPLACED_ASSIGNEE, roleMap.get("jeff nef").getRoleType());
+ assertEquals(Task.ROLETYPE_REPLACED_ASSIGNEE, roleMap.get("jeff nef").getRoleType());
assertEquals("is sick", roleMap.get("jeff nef").getDescription());
assertEquals(5, roles.size());
17 years, 5 months
JBoss JBPM SVN: r2949 - projects/gwt-console/trunk/war/src/test/examples.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-11-17 04:24:58 -0500 (Mon, 17 Nov 2008)
New Revision: 2949
Added:
projects/gwt-console/trunk/war/src/test/examples/ForkJoinExample.par
Log:
Added fork join test process
Added: projects/gwt-console/trunk/war/src/test/examples/ForkJoinExample.par
===================================================================
(Binary files differ)
Property changes on: projects/gwt-console/trunk/war/src/test/examples/ForkJoinExample.par
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
17 years, 5 months
JBoss JBPM SVN: r2948 - in projects/spec/trunk/modules: ri/src/main/java/org/jbpm/ri/service and 1 other directory.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-17 03:53:10 -0500 (Mon, 17 Nov 2008)
New Revision: 2948
Modified:
projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ProcessService.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ProcessServiceImpl.java
Log:
Make ProcessService methods abstract
Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ProcessService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ProcessService.java 2008-11-17 08:42:04 UTC (rev 2947)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ProcessService.java 2008-11-17 08:53:10 UTC (rev 2948)
@@ -23,10 +23,6 @@
//$Id$
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
import java.util.Set;
import javax.management.ObjectName;
@@ -34,10 +30,7 @@
import org.jbpm.api.client.Configuration;
import org.jbpm.api.client.ProcessEngine;
import org.jbpm.api.model.Process;
-import org.jbpm.api.model.ProcessDefinition;
import org.jbpm.api.model.Process.ProcessStatus;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* The ProcessService is the entry point to create, find and otherwise manage processes.
@@ -47,12 +40,6 @@
*/
public abstract class ProcessService extends AbstractService
{
- // Provide logging
- final static Logger log = LoggerFactory.getLogger(ProcessService.class);
-
- // The set of registered processes
- private Map<ObjectName, Process> registeredProcs = new HashMap<ObjectName, Process>();
-
// Hide public constructor
protected ProcessService()
{
@@ -70,68 +57,22 @@
/**
* Register a Process.
*/
- public ObjectName registerProcess(Process proc)
- {
- log.debug("registerProcess: " + proc);
+ public abstract ObjectName registerProcess(Process proc);
- if (getProcess(proc.getKey()) != null)
- throw new IllegalStateException("Process already registered: " + proc);
-
- ProcessStatus procStatus = proc.getProcessStatus();
- ProcessDefinition procDef = proc.getProcessDefinition();
- ProcessEngine engine = getProcessEngine();
-
- if (procStatus != ProcessStatus.None)
- throw new IllegalStateException("Cannot register process in state: " + procStatus);
-
- // Register the process definition if needed
- ProcessDefinitionService procDefService = engine.getService(ProcessDefinitionService.class);
- if (procDefService.getProcessDefinition(procDef.getKey()) == null)
- procDefService.registerProcessDefinition(procDef);
-
- // Save the process through the PersistenceService
- PersistenceService persService = getProcessEngine().getService(PersistenceService.class);
- ObjectName procID = persService.saveProcess(proc);
- registeredProcs.put(procID, proc);
- return procID;
- }
-
/**
* Unregister a Process.
*/
- public boolean unregisterProcess(ObjectName procID)
- {
- boolean removed = false;
- Process proc = registeredProcs.get(procID);
- if (proc != null)
- {
- log.debug("unregisterProcess: " + proc);
+ public abstract boolean unregisterProcess(ObjectName procID);
- // Delete the process through the PersistenceService
- PersistenceService persService = getProcessEngine().getService(PersistenceService.class);
- persService.deleteProcess(proc);
- registeredProcs.remove(procID);
- removed = true;
- }
- return removed;
- }
-
/**
* Get a Process for a given id
*/
- public Process getProcess(ObjectName procID)
- {
- Process proc = registeredProcs.get(procID);
- return proc;
- }
+ public abstract Process getProcess(ObjectName procID);
/**
* Get the set of registered Processes
*/
- public Set<ObjectName> getProcesses()
- {
- return Collections.unmodifiableSet(registeredProcs.keySet());
- }
+ public abstract Set<ObjectName> getProcesses();
/**
* Find the set of Processes for a given name
@@ -140,17 +81,5 @@
* @param status The optional process status
* @return An empty set if the process cannot be found
*/
- public Set<ObjectName> getProcesses(String name, ProcessStatus status)
- {
- Set<ObjectName> procSet = new HashSet<ObjectName>();
- for (Process auxProc : registeredProcs.values())
- {
- if (auxProc.getName().equals(name))
- {
- if (status == null || auxProc.getProcessStatus() == status)
- procSet.add(auxProc.getKey());
- }
- }
- return procSet;
- }
+ public abstract Set<ObjectName> getProcesses(String name, ProcessStatus status);
}
\ No newline at end of file
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ProcessServiceImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ProcessServiceImpl.java 2008-11-17 08:42:04 UTC (rev 2947)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ProcessServiceImpl.java 2008-11-17 08:53:10 UTC (rev 2948)
@@ -25,14 +25,20 @@
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
import javax.management.ObjectName;
import org.jbpm.api.client.ProcessEngine;
import org.jbpm.api.model.Process;
+import org.jbpm.api.model.ProcessDefinition;
import org.jbpm.api.model.Process.ProcessStatus;
import org.jbpm.api.service.PersistenceService;
+import org.jbpm.api.service.ProcessDefinitionService;
import org.jbpm.api.service.ProcessService;
import org.jbpm.ri.model.ProcessImpl;
import org.jbpm.ri.runtime.NodeInterceptor;
@@ -50,6 +56,7 @@
// Provide logging
final static Logger log = LoggerFactory.getLogger(ProcessServiceImpl.class);
+ private Map<ObjectName, Process> registeredProcs = new HashMap<ObjectName, Process>();
private List<NodeInterceptor> nodeInterceptors = new ArrayList<NodeInterceptor>();
@Override
@@ -72,33 +79,104 @@
return Collections.unmodifiableList(nodeInterceptors);
}
+ /**
+ * Get a Process for a given id
+ */
@Override
+ public Process getProcess(ObjectName procID)
+ {
+ Process proc = registeredProcs.get(procID);
+ return proc;
+ }
+
+ /**
+ * Get the set of registered Processes
+ */
+ @Override
+ public Set<ObjectName> getProcesses()
+ {
+ return Collections.unmodifiableSet(registeredProcs.keySet());
+ }
+
+ /**
+ * Find the set of Processes for a given name
+ *
+ * @param name The process name
+ * @param status The optional process status
+ * @return An empty set if the process cannot be found
+ */
+ @Override
+ public Set<ObjectName> getProcesses(String name, ProcessStatus status)
+ {
+ Set<ObjectName> procSet = new HashSet<ObjectName>();
+ for (Process auxProc : registeredProcs.values())
+ {
+ if (auxProc.getName().equals(name))
+ {
+ if (status == null || auxProc.getProcessStatus() == status)
+ procSet.add(auxProc.getKey());
+ }
+ }
+ return procSet;
+ }
+
+ /**
+ * Register a Process.
+ */
public ObjectName registerProcess(Process proc)
{
- ObjectName procID = super.registerProcess(proc);
+ log.debug("registerProcess: " + proc);
+
+ if (getProcess(proc.getKey()) != null)
+ throw new IllegalStateException("Process already registered: " + proc);
+
+ ProcessStatus procStatus = proc.getProcessStatus();
+ ProcessDefinition procDef = proc.getProcessDefinition();
+ ProcessEngine engine = getProcessEngine();
+
+ if (procStatus != ProcessStatus.None)
+ throw new IllegalStateException("Cannot register process in state: " + procStatus);
+
+ // Register the process definition if needed
+ ProcessDefinitionService procDefService = engine.getService(ProcessDefinitionService.class);
+ if (procDefService.getProcessDefinition(procDef.getKey()) == null)
+ procDefService.registerProcessDefinition(procDef);
+
+ // Save the process through the PersistenceService
+ PersistenceService persService = getProcessEngine().getService(PersistenceService.class);
+ ObjectName procID = persService.saveProcess(proc);
+ registeredProcs.put(procID, proc);
ProcessImpl procImpl = (ProcessImpl)proc;
procImpl.register(proc);
procImpl.setProcessStatus(ProcessStatus.Ready);
-
- // Save the process through the PersistenceService
- PersistenceService persService = getProcessEngine().getService(PersistenceService.class);
- persService.saveProcess(proc);
-
return procID;
}
- @Override
+ /**
+ * Unregister a Process.
+ */
public boolean unregisterProcess(ObjectName procID)
{
- ProcessImpl procImpl = (ProcessImpl)getProcess(procID);
- if (procImpl != null)
+ boolean removed = false;
+ Process proc = registeredProcs.get(procID);
+ if (proc != null)
+ {
+ log.debug("unregisterProcess: " + proc);
+
+ ProcessImpl procImpl = (ProcessImpl)proc;
procImpl.unregister(procImpl);
-
- return super.unregisterProcess(procID);
+
+ // Delete the process through the PersistenceService
+ PersistenceService persService = getProcessEngine().getService(PersistenceService.class);
+ persService.deleteProcess(proc);
+ registeredProcs.remove(procID);
+ removed = true;
+ }
+ return removed;
}
-
+
private NodeInterceptor loadNodeInterceptor(String className)
{
NodeInterceptor itor = null;
17 years, 5 months
JBoss JBPM SVN: r2947 - jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-11-17 03:42:04 -0500 (Mon, 17 Nov 2008)
New Revision: 2947
Modified:
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskImpl.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskServiceImpl.java
Log:
added task component
Modified: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskImpl.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskImpl.java 2008-11-17 08:31:59 UTC (rev 2946)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskImpl.java 2008-11-17 08:42:04 UTC (rev 2947)
@@ -408,4 +408,14 @@
public void setId(String id) {
this.id = id;
}
+
+ public String getAssignedUserId() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setAssignedUserId(String assignedUserId) {
+ // TODO Auto-generated method stub
+
+ }
}
Modified: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskServiceImpl.java 2008-11-17 08:31:59 UTC (rev 2946)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskServiceImpl.java 2008-11-17 08:42:04 UTC (rev 2947)
@@ -26,6 +26,7 @@
import org.jbpm.Task;
import org.jbpm.TaskService;
import org.jbpm.cmd.CommandService;
+import org.jbpm.task.Role;
import org.jbpm.task.cmd.CreateTask;
import org.jbpm.task.cmd.DeleteTask;
import org.jbpm.task.cmd.GetTask;
@@ -127,4 +128,14 @@
// TODO Auto-generated method stub
return null;
}
+
+ public List<String> getCandidates(String taskId) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public List<Role> getRoles(String taskId) {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
17 years, 5 months
JBoss JBPM SVN: r2946 - in projects/spec/trunk/modules: api/src/main/java/org/jbpm/preview/client and 9 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-17 03:31:59 -0500 (Mon, 17 Nov 2008)
New Revision: 2946
Added:
projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ProcessService.java
Removed:
projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ProcessInstanceService.java
Modified:
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/Deployment.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/MessageService.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/process/ProcessDefinitionServiceTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/process/ProcessServiceTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/preview/startevent/StartEventSignalTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/preview/task/receive/ReceiveTaskTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/preview/task/user/UserTaskTest.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ProcessImpl.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/RunnableToken.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TokenImpl.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ExecutionServiceImpl.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ProcessDefinitionServiceImpl.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ProcessServiceImpl.java
projects/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/server/AirticketServiceImpl.java
Log:
REvert to ProcessService
Deleted: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ProcessInstanceService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ProcessInstanceService.java 2008-11-17 07:57:09 UTC (rev 2945)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ProcessInstanceService.java 2008-11-17 08:31:59 UTC (rev 2946)
@@ -1,156 +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.api.service;
-
-//$Id$
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.management.ObjectName;
-
-import org.jbpm.api.client.Configuration;
-import org.jbpm.api.client.ProcessEngine;
-import org.jbpm.api.model.Process;
-import org.jbpm.api.model.ProcessDefinition;
-import org.jbpm.api.model.Process.ProcessStatus;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * The ProcessService is the entry point to create, find and otherwise manage processes.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 25-Sep-2008
- */
-public abstract class ProcessInstanceService extends AbstractService
-{
- // Provide logging
- final static Logger log = LoggerFactory.getLogger(ProcessInstanceService.class);
-
- // The set of registered processes
- private Map<ObjectName, Process> registeredProcs = new HashMap<ObjectName, Process>();
-
- // Hide public constructor
- protected ProcessInstanceService()
- {
- }
-
- /**
- * Locate the default ProcessService
- */
- public static ProcessInstanceService locateProcessService()
- {
- ProcessEngine engine = Configuration.getProcessEngine();
- return engine.getService(ProcessInstanceService.class);
- }
-
- /**
- * Register a Process.
- */
- public ObjectName registerProcess(Process proc)
- {
- log.debug("registerProcess: " + proc);
-
- if (getProcess(proc.getKey()) != null)
- throw new IllegalStateException("Process already registered: " + proc);
-
- ProcessStatus procStatus = proc.getProcessStatus();
- ProcessDefinition procDef = proc.getProcessDefinition();
- ProcessEngine engine = getProcessEngine();
-
- if (procStatus != ProcessStatus.None)
- throw new IllegalStateException("Cannot register process in state: " + procStatus);
-
- // Register the process definition if needed
- ProcessDefinitionService procDefService = engine.getService(ProcessDefinitionService.class);
- if (procDefService.getProcessDefinition(procDef.getKey()) == null)
- procDefService.registerProcessDefinition(procDef);
-
- // Save the process through the PersistenceService
- PersistenceService persService = getProcessEngine().getService(PersistenceService.class);
- ObjectName procID = persService.saveProcess(proc);
- registeredProcs.put(procID, proc);
- return procID;
- }
-
- /**
- * Unregister a Process.
- */
- public boolean unregisterProcess(ObjectName procID)
- {
- boolean removed = false;
- Process proc = registeredProcs.get(procID);
- if (proc != null)
- {
- log.debug("unregisterProcess: " + proc);
-
- // Delete the process through the PersistenceService
- PersistenceService persService = getProcessEngine().getService(PersistenceService.class);
- persService.deleteProcess(proc);
- registeredProcs.remove(procID);
- removed = true;
- }
- return removed;
- }
-
- /**
- * Get a Process for a given id
- */
- public Process getProcess(ObjectName procID)
- {
- Process proc = registeredProcs.get(procID);
- return proc;
- }
-
- /**
- * Get the set of registered Processes
- */
- public Set<ObjectName> getProcesses()
- {
- return Collections.unmodifiableSet(registeredProcs.keySet());
- }
-
- /**
- * Find the set of Processes for a given name
- *
- * @param name The process name
- * @param status The optional process status
- * @return An empty set if the process cannot be found
- */
- public Set<ObjectName> getProcesses(String name, ProcessStatus status)
- {
- Set<ObjectName> procSet = new HashSet<ObjectName>();
- for (Process auxProc : registeredProcs.values())
- {
- if (auxProc.getName().equals(name))
- {
- if (status == null || auxProc.getProcessStatus() == status)
- procSet.add(auxProc.getKey());
- }
- }
- return procSet;
- }
-}
\ No newline at end of file
Copied: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ProcessService.java (from rev 2944, projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ProcessInstanceService.java)
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ProcessService.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ProcessService.java 2008-11-17 08:31:59 UTC (rev 2946)
@@ -0,0 +1,156 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.api.service;
+
+//$Id$
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.ObjectName;
+
+import org.jbpm.api.client.Configuration;
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.model.Process;
+import org.jbpm.api.model.ProcessDefinition;
+import org.jbpm.api.model.Process.ProcessStatus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The ProcessService is the entry point to create, find and otherwise manage processes.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 25-Sep-2008
+ */
+public abstract class ProcessService extends AbstractService
+{
+ // Provide logging
+ final static Logger log = LoggerFactory.getLogger(ProcessService.class);
+
+ // The set of registered processes
+ private Map<ObjectName, Process> registeredProcs = new HashMap<ObjectName, Process>();
+
+ // Hide public constructor
+ protected ProcessService()
+ {
+ }
+
+ /**
+ * Locate the default ProcessService
+ */
+ public static ProcessService locateProcessService()
+ {
+ ProcessEngine engine = Configuration.getProcessEngine();
+ return engine.getService(ProcessService.class);
+ }
+
+ /**
+ * Register a Process.
+ */
+ public ObjectName registerProcess(Process proc)
+ {
+ log.debug("registerProcess: " + proc);
+
+ if (getProcess(proc.getKey()) != null)
+ throw new IllegalStateException("Process already registered: " + proc);
+
+ ProcessStatus procStatus = proc.getProcessStatus();
+ ProcessDefinition procDef = proc.getProcessDefinition();
+ ProcessEngine engine = getProcessEngine();
+
+ if (procStatus != ProcessStatus.None)
+ throw new IllegalStateException("Cannot register process in state: " + procStatus);
+
+ // Register the process definition if needed
+ ProcessDefinitionService procDefService = engine.getService(ProcessDefinitionService.class);
+ if (procDefService.getProcessDefinition(procDef.getKey()) == null)
+ procDefService.registerProcessDefinition(procDef);
+
+ // Save the process through the PersistenceService
+ PersistenceService persService = getProcessEngine().getService(PersistenceService.class);
+ ObjectName procID = persService.saveProcess(proc);
+ registeredProcs.put(procID, proc);
+ return procID;
+ }
+
+ /**
+ * Unregister a Process.
+ */
+ public boolean unregisterProcess(ObjectName procID)
+ {
+ boolean removed = false;
+ Process proc = registeredProcs.get(procID);
+ if (proc != null)
+ {
+ log.debug("unregisterProcess: " + proc);
+
+ // Delete the process through the PersistenceService
+ PersistenceService persService = getProcessEngine().getService(PersistenceService.class);
+ persService.deleteProcess(proc);
+ registeredProcs.remove(procID);
+ removed = true;
+ }
+ return removed;
+ }
+
+ /**
+ * Get a Process for a given id
+ */
+ public Process getProcess(ObjectName procID)
+ {
+ Process proc = registeredProcs.get(procID);
+ return proc;
+ }
+
+ /**
+ * Get the set of registered Processes
+ */
+ public Set<ObjectName> getProcesses()
+ {
+ return Collections.unmodifiableSet(registeredProcs.keySet());
+ }
+
+ /**
+ * Find the set of Processes for a given name
+ *
+ * @param name The process name
+ * @param status The optional process status
+ * @return An empty set if the process cannot be found
+ */
+ public Set<ObjectName> getProcesses(String name, ProcessStatus status)
+ {
+ Set<ObjectName> procSet = new HashSet<ObjectName>();
+ for (Process auxProc : registeredProcs.values())
+ {
+ if (auxProc.getName().equals(name))
+ {
+ if (status == null || auxProc.getProcessStatus() == status)
+ procSet.add(auxProc.getKey());
+ }
+ }
+ return procSet;
+ }
+}
\ No newline at end of file
Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/Deployment.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/Deployment.java 2008-11-17 07:57:09 UTC (rev 2945)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/client/Deployment.java 2008-11-17 08:31:59 UTC (rev 2946)
@@ -36,12 +36,12 @@
import org.jbpm.api.model.ProcessDefinition;
import org.jbpm.api.service.DialectHandler;
import org.jbpm.api.service.DialectHandlerService;
-import org.jbpm.api.service.ProcessInstanceService;
+import org.jbpm.api.service.ProcessService;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
/**
- * A deployment, containing all information to create a process that will be deployed to the {@link ProcessInstanceService}
+ * A deployment, containing all information to create a process that will be deployed to the {@link ProcessService}
*
* @author Tom Baeyens
* @author thomas.diesler(a)jboss.com
Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/MessageService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/MessageService.java 2008-11-17 07:57:09 UTC (rev 2945)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/preview/service/MessageService.java 2008-11-17 08:31:59 UTC (rev 2946)
@@ -38,7 +38,7 @@
import org.jbpm.api.model.Process;
import org.jbpm.api.model.Task;
import org.jbpm.api.service.AbstractService;
-import org.jbpm.api.service.ProcessInstanceService;
+import org.jbpm.api.service.ProcessService;
import org.jbpm.preview.client.MessageListener;
import org.jbpm.preview.model.Message;
import org.jbpm.preview.model.Participant;
@@ -136,7 +136,7 @@
*/
public void sendMessage(ObjectName procID, String targetName, Message msg)
{
- ProcessInstanceService procService = ProcessInstanceService.locateProcessService();
+ ProcessService procService = ProcessService.locateProcessService();
Process proc = procService.getProcess(procID);
if (proc == null)
throw new IllegalStateException("Cannot obtain registered process: " + procID);
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/process/ProcessDefinitionServiceTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/process/ProcessDefinitionServiceTest.java 2008-11-17 07:57:09 UTC (rev 2945)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/process/ProcessDefinitionServiceTest.java 2008-11-17 08:31:59 UTC (rev 2946)
@@ -31,7 +31,7 @@
import org.jbpm.api.model.Process;
import org.jbpm.api.model.ProcessDefinition;
import org.jbpm.api.service.ProcessDefinitionService;
-import org.jbpm.api.service.ProcessInstanceService;
+import org.jbpm.api.service.ProcessService;
import org.jbpm.api.test.CTSTestCase;
import org.jbpm.api.test.ProcessCatalog;
@@ -64,7 +64,7 @@
ProcessEngine engine = procDef.getProcessEngine();
ProcessDefinitionService procDefService = engine.getService(ProcessDefinitionService.class);
- ProcessInstanceService procService = engine.getService(ProcessInstanceService.class);
+ ProcessService procService = engine.getService(ProcessService.class);
Process proc = procDef.newInstance();
assertNotNull("Process not null", proc);
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/process/ProcessServiceTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/process/ProcessServiceTest.java 2008-11-17 07:57:09 UTC (rev 2945)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/process/ProcessServiceTest.java 2008-11-17 08:31:59 UTC (rev 2946)
@@ -30,7 +30,7 @@
import org.jbpm.api.model.builder.ProcessBuilder;
import org.jbpm.api.service.ProcessBuilderService;
import org.jbpm.api.service.ProcessDefinitionService;
-import org.jbpm.api.service.ProcessInstanceService;
+import org.jbpm.api.service.ProcessService;
import org.jbpm.api.test.CTSTestCase;
/**
@@ -44,7 +44,7 @@
public void testRegisterProcess() throws Exception
{
ProcessDefinitionService procDefService = ProcessDefinitionService.locateProcessDefinitionService();
- ProcessInstanceService procService = ProcessInstanceService.locateProcessService();
+ ProcessService procService = ProcessService.locateProcessService();
ProcessDefinition procDef = getProcessDefinition();
Process proc = procDef.newInstance();
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/preview/startevent/StartEventSignalTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/preview/startevent/StartEventSignalTest.java 2008-11-17 07:57:09 UTC (rev 2945)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/preview/startevent/StartEventSignalTest.java 2008-11-17 08:31:59 UTC (rev 2946)
@@ -33,7 +33,7 @@
import org.jbpm.api.model.Expression.ExpressionLanguage;
import org.jbpm.api.service.ProcessBuilderService;
import org.jbpm.api.service.ProcessDefinitionService;
-import org.jbpm.api.service.ProcessInstanceService;
+import org.jbpm.api.service.ProcessService;
import org.jbpm.api.test.CTSTestCase;
import org.jbpm.preview.client.ProcessExt;
import org.jbpm.preview.client.SignalListener;
@@ -79,7 +79,7 @@
sigService.throwSignal(newSignal(getTestID(), SignalType.SYSTEM_START_TRIGGER, "A"));
// Get the just started process
- ProcessInstanceService procService = ProcessInstanceService.locateProcessService();
+ ProcessService procService = ProcessService.locateProcessService();
Set<ObjectName> procIDs = procService.getProcesses("StartEventSignal", null);
proc = (ProcessExt) procService.getProcess(procIDs.iterator().next());
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/preview/task/receive/ReceiveTaskTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/preview/task/receive/ReceiveTaskTest.java 2008-11-17 07:57:09 UTC (rev 2945)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/preview/task/receive/ReceiveTaskTest.java 2008-11-17 08:31:59 UTC (rev 2946)
@@ -33,7 +33,7 @@
import org.jbpm.api.model.Task.TaskType;
import org.jbpm.api.service.ProcessBuilderService;
import org.jbpm.api.service.ProcessDefinitionService;
-import org.jbpm.api.service.ProcessInstanceService;
+import org.jbpm.api.service.ProcessService;
import org.jbpm.api.test.CTSTestCase;
import org.jbpm.preview.client.ProcessExt;
import org.jbpm.preview.client.SignalListener;
@@ -91,7 +91,7 @@
public void testSuspendedMessage() throws Exception
{
ProcessDefinitionService procDefService = ProcessDefinitionService.locateProcessDefinitionService();
- ProcessInstanceService procService = ProcessInstanceService.locateProcessService();
+ ProcessService procService = ProcessService.locateProcessService();
ProcessDefinition procDef = unregisterOnTearDown(getProcessDefinition());
ProcessExt proc = (ProcessExt)procDef.newInstance();
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/preview/task/user/UserTaskTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/preview/task/user/UserTaskTest.java 2008-11-17 07:57:09 UTC (rev 2945)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/preview/task/user/UserTaskTest.java 2008-11-17 08:31:59 UTC (rev 2946)
@@ -35,7 +35,7 @@
import org.jbpm.api.model.builder.ObjectNameFactory;
import org.jbpm.api.runtime.BasicAttachments;
import org.jbpm.api.service.ProcessBuilderService;
-import org.jbpm.api.service.ProcessInstanceService;
+import org.jbpm.api.service.ProcessService;
import org.jbpm.api.test.CTSTestCase;
import org.jbpm.preview.client.MessageListener;
import org.jbpm.preview.client.ProcessExt;
@@ -61,7 +61,7 @@
ProcessExt proc = (ProcessExt)procDef.newInstance();
// Register the process - this assigns the procID
- ProcessInstanceService procService = ProcessInstanceService.locateProcessService();
+ ProcessService procService = ProcessService.locateProcessService();
procService.registerProcess(proc);
// Add the user message listener
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ProcessImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ProcessImpl.java 2008-11-17 07:57:09 UTC (rev 2945)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ProcessImpl.java 2008-11-17 08:31:59 UTC (rev 2946)
@@ -49,7 +49,7 @@
import org.jbpm.api.model.Event.EventDetailType;
import org.jbpm.api.model.builder.ObjectNameFactory;
import org.jbpm.api.runtime.Attachments;
-import org.jbpm.api.service.ProcessInstanceService;
+import org.jbpm.api.service.ProcessService;
import org.jbpm.preview.client.ProcessExt;
import org.jbpm.preview.model.Assignment;
import org.jbpm.preview.model.Group;
@@ -303,7 +303,7 @@
catch (RuntimeException rte)
{
// A process that cannot be started id unregistered automatically
- ProcessInstanceService procService = getProcessEngine().getService(ProcessInstanceService.class);
+ ProcessService procService = getProcessEngine().getService(ProcessService.class);
procService.unregisterProcess(getKey());
throw rte;
}
@@ -336,7 +336,7 @@
// Register the process if needed
ProcessEngine engine = getProcessEngine();
- ProcessInstanceService procService = engine.getService(ProcessInstanceService.class);
+ ProcessService procService = engine.getService(ProcessService.class);
if (procService.getProcess(getKey()) == null)
procService.registerProcess(this);
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/RunnableToken.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/RunnableToken.java 2008-11-17 07:57:09 UTC (rev 2945)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/RunnableToken.java 2008-11-17 08:31:59 UTC (rev 2946)
@@ -26,7 +26,7 @@
import org.jbpm.api.model.Node;
import org.jbpm.api.model.Process;
import org.jbpm.api.model.Process.ProcessStatus;
-import org.jbpm.api.service.ProcessInstanceService;
+import org.jbpm.api.service.ProcessService;
import org.jbpm.ri.model.ProcessImpl;
import org.jbpm.ri.service.ProcessServiceImpl;
import org.slf4j.Logger;
@@ -77,7 +77,7 @@
RuntimeContext rtContext = new RuntimeContext(tokenExecutor);
// Add the interceptors that are defined on the ProcessService
- ProcessServiceImpl procService = (ProcessServiceImpl)proc.getProcessEngine().getService(ProcessInstanceService.class);
+ ProcessServiceImpl procService = (ProcessServiceImpl)proc.getProcessEngine().getService(ProcessService.class);
for (NodeInterceptor itor : procService.getNodeInterceptors())
rtContext.addInterceptor(itor);
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TokenImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TokenImpl.java 2008-11-17 07:57:09 UTC (rev 2945)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TokenImpl.java 2008-11-17 08:31:59 UTC (rev 2946)
@@ -39,7 +39,7 @@
import org.jbpm.api.runtime.Attachments;
import org.jbpm.api.runtime.BasicAttachments;
import org.jbpm.api.runtime.Attachments.Key;
-import org.jbpm.api.service.ProcessInstanceService;
+import org.jbpm.api.service.ProcessService;
import org.jbpm.preview.runtime.TokenExecutor;
import org.jbpm.ri.service.ProcessServiceImpl;
import org.jbpm.ri.model.ProcessImpl;
@@ -186,7 +186,7 @@
RuntimeContext rtContext = new RuntimeContext(tokenExecutor);
// Add the interceptors that are defined on the ProcessService
- ProcessServiceImpl procService = (ProcessServiceImpl)proc.getProcessEngine().getService(ProcessInstanceService.class);
+ ProcessServiceImpl procService = (ProcessServiceImpl)proc.getProcessEngine().getService(ProcessService.class);
for (NodeInterceptor itor : procService.getNodeInterceptors())
rtContext.addInterceptor(itor);
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ExecutionServiceImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ExecutionServiceImpl.java 2008-11-17 07:57:09 UTC (rev 2945)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ExecutionServiceImpl.java 2008-11-17 08:31:59 UTC (rev 2946)
@@ -37,7 +37,7 @@
import org.jbpm.api.model.StartEvent;
import org.jbpm.api.model.Process.ProcessStatus;
import org.jbpm.api.runtime.Attachments;
-import org.jbpm.api.service.ProcessInstanceService;
+import org.jbpm.api.service.ProcessService;
import org.jbpm.preview.client.ProcessExt;
import org.jbpm.preview.model.Assignment;
import org.jbpm.preview.model.Assignment.AssignTime;
@@ -225,7 +225,7 @@
// this could happen when the Process never received a start signal
// and then we get here because of a ProcessTimeoutException
ProcessEngine engine = getProcessEngine();
- ProcessInstanceService procService = engine.getService(ProcessInstanceService.class);
+ ProcessService procService = engine.getService(ProcessService.class);
if (procService.getProcess(proc.getKey()) != null)
procService.unregisterProcess(proc.getKey());
}
@@ -316,7 +316,7 @@
synchronized (proc)
{
- ProcessInstanceService procService = engine.getService(ProcessInstanceService.class);
+ ProcessService procService = engine.getService(ProcessService.class);
procService.unregisterProcess(procID);
runtimeProcesses.remove(procID);
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ProcessDefinitionServiceImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ProcessDefinitionServiceImpl.java 2008-11-17 07:57:09 UTC (rev 2945)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ProcessDefinitionServiceImpl.java 2008-11-17 08:31:59 UTC (rev 2946)
@@ -34,7 +34,7 @@
import org.jbpm.api.model.ProcessDefinition;
import org.jbpm.api.service.PersistenceService;
import org.jbpm.api.service.ProcessDefinitionService;
-import org.jbpm.api.service.ProcessInstanceService;
+import org.jbpm.api.service.ProcessService;
import org.jbpm.ri.model.ProcessDefinitionImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -106,7 +106,7 @@
ProcessEngine engine = getProcessEngine();
// Unregister the associated process instances
- ProcessInstanceService procService = engine.getService(ProcessInstanceService.class);
+ ProcessService procService = engine.getService(ProcessService.class);
for (ObjectName procID : procService.getProcesses(procDef.getName(), null))
procService.unregisterProcess(procID);
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ProcessServiceImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ProcessServiceImpl.java 2008-11-17 07:57:09 UTC (rev 2945)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ProcessServiceImpl.java 2008-11-17 08:31:59 UTC (rev 2946)
@@ -33,7 +33,7 @@
import org.jbpm.api.model.Process;
import org.jbpm.api.model.Process.ProcessStatus;
import org.jbpm.api.service.PersistenceService;
-import org.jbpm.api.service.ProcessInstanceService;
+import org.jbpm.api.service.ProcessService;
import org.jbpm.ri.model.ProcessImpl;
import org.jbpm.ri.runtime.NodeInterceptor;
import org.slf4j.Logger;
@@ -45,7 +45,7 @@
* @author thomas.diesler(a)jboss.com
* @since 18-Jun-2008
*/
-public class ProcessServiceImpl extends ProcessInstanceService implements MutableService
+public class ProcessServiceImpl extends ProcessService implements MutableService
{
// Provide logging
final static Logger log = LoggerFactory.getLogger(ProcessServiceImpl.class);
Modified: projects/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/server/AirticketServiceImpl.java
===================================================================
--- projects/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/server/AirticketServiceImpl.java 2008-11-17 07:57:09 UTC (rev 2945)
+++ projects/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/server/AirticketServiceImpl.java 2008-11-17 08:31:59 UTC (rev 2946)
@@ -17,7 +17,7 @@
import org.jboss.bpm.samples.airticket.client.RequestMessage;
import org.jbpm.api.model.ProcessDefinition;
import org.jbpm.api.model.builder.ObjectNameFactory;
-import org.jbpm.api.service.ProcessInstanceService;
+import org.jbpm.api.service.ProcessService;
import org.jbpm.preview.client.MessageListener;
import org.jbpm.preview.client.ProcessExt;
import org.jbpm.preview.client.SignalListener;
@@ -37,7 +37,7 @@
public void sendMessage(GwtMessage gwtMsg)
{
- ProcessInstanceService procService = ProcessInstanceService.locateProcessService();
+ ProcessService procService = ProcessService.locateProcessService();
MessageService mm = MessageService.locateMessageService();
SignalService sm = SignalService.locateSignalService();
17 years, 5 months
JBoss JBPM SVN: r2945 - in projects/spec/trunk/modules/ri/src/test: resources and 1 other directory.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-17 02:57:09 -0500 (Mon, 17 Nov 2008)
New Revision: 2945
Modified:
projects/spec/trunk/modules/ri/src/test/java/org/jbpm/test/
projects/spec/trunk/modules/ri/src/test/resources/
Log:
svn:ignore cts stuff
Property changes on: projects/spec/trunk/modules/ri/src/test/java/org/jbpm/test
___________________________________________________________________
Name: svn:ignore
+ cts
pattern
preview
Property changes on: projects/spec/trunk/modules/ri/src/test/resources
___________________________________________________________________
Name: svn:ignore
+ cts
17 years, 5 months