JBoss JBPM SVN: r5354 - jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-07-27 21:00:04 -0400 (Mon, 27 Jul 2009)
New Revision: 5354
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-db2-ds.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-hsqldb-ds.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-mysql-ds.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-oracle-ds.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-sybase-ds.xml
Log:
switch to DB2 type 4 driver
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-db2-ds.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-db2-ds.xml 2009-07-28 00:26:08 UTC (rev 5353)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-db2-ds.xml 2009-07-28 01:00:04 UTC (rev 5354)
@@ -8,10 +8,14 @@
<xa-datasource-property name="ServerName">${jdbc.db2.server}</xa-datasource-property>
<xa-datasource-property name="PortNumber">${jdbc.db2.port}</xa-datasource-property>
<xa-datasource-property name="DatabaseName">${jdbc.db2.database}</xa-datasource-property>
+ <!-- DriverType can be 2 or 4; type 4 does not require a DB2 client -->
+ <xa-datasource-property name="DriverType">4</xa-datasource-property>
<user-name>${jdbc.db2.username}</user-name>
<password>${jdbc.db2.password}</password>
- <!-- Must be set if using multiple DB2 XA resources in same transaction -->
+ <!-- disable transaction interleaving -->
+ <track-connection-by-tx />
+ <!-- force XAResource.isSameRM(XAResource) to return false -->
<isSameRM-override-value>false</isSameRM-override-value>
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml -->
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-hsqldb-ds.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-hsqldb-ds.xml 2009-07-28 00:26:08 UTC (rev 5353)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-hsqldb-ds.xml 2009-07-28 01:00:04 UTC (rev 5354)
@@ -15,8 +15,6 @@
<!-- disable idle connection removal, hsqldb does not reap threads on closed connections -->
<idle-timeout-minutes>0</idle-timeout-minutes>
- <!-- check all statements are closed when the connection is returned to the pool -->
- <track-statements />
<!-- hsqldb benefits from prepared statement caching -->
<prepared-statement-cache-size>32</prepared-statement-cache-size>
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-mysql-ds.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-mysql-ds.xml 2009-07-28 00:26:08 UTC (rev 5353)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-mysql-ds.xml 2009-07-28 01:00:04 UTC (rev 5354)
@@ -13,8 +13,6 @@
<!-- reduce isolation from the default level (repeatable read) -->
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
- <!-- separate connections used inside and outside a JTA transaction -->
- <no-tx-separate-pools />
<!-- disable transaction interleaving -->
<track-connection-by-tx />
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-oracle-ds.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-oracle-ds.xml 2009-07-28 00:26:08 UTC (rev 5353)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-oracle-ds.xml 2009-07-28 01:00:04 UTC (rev 5354)
@@ -9,11 +9,11 @@
<user-name>${jdbc.oracle.username}</user-name>
<password>${jdbc.oracle.password}</password>
- <!-- separate connections used inside and outside a JTA transaction -->
+ <!-- isolate connections used with JTA from those used without JTA -->
<no-tx-separate-pools />
<!-- disable transaction interleaving -->
<track-connection-by-tx />
-
+ <!-- force XAResource.isSameRM(XAResource) to return false -->
<isSameRM-override-value>false</isSameRM-override-value>
<!-- check oracle error codes and messages for fatal errors -->
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-sybase-ds.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-sybase-ds.xml 2009-07-28 00:26:08 UTC (rev 5353)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-sybase-ds.xml 2009-07-28 01:00:04 UTC (rev 5354)
@@ -11,11 +11,12 @@
<user-name>${jdbc.sybase.username}</user-name>
<password>${jdbc.sybase.password}</password>
- <!-- separate connections used inside and outside a JTA transaction -->
+ <!-- isolate connections used with JTA from those used without JTA -->
<no-tx-separate-pools />
<!-- disable transaction interleaving -->
<track-connection-by-tx />
+ <!-- check sybase error codes and messages for fatal errors -->
<exception-sorter-class-name>
org.jboss.resource.adapter.jdbc.vendor.SybaseExceptionSorter
</exception-sorter-class-name>
15 years, 3 months
JBoss JBPM SVN: r5353 - in jbpm4/trunk/modules/bpmn/src: main/java/org/jbpm/bpmn/flownodes and 2 other directories.
by do-not-reply@jboss.org
Author: kukeltje
Date: 2009-07-27 20:26:08 -0400 (Mon, 27 Jul 2009)
New Revision: 5353
Added:
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayActivity.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayBinding.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayActivity.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayBinding.java
jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ParallelGatewayTest.java
jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/parallelGateway.bpmn.xml
jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/parallelGatewayInvalid.bpmn.xml
Removed:
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionBinding.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionConditionActivity.java
Modified:
jbpm4/trunk/modules/bpmn/src/main/java/jbpm.bpmn.flownodes.xml
Log:
Initial commit of parallelgateway and renaming decision to exclusivegateway
Modified: jbpm4/trunk/modules/bpmn/src/main/java/jbpm.bpmn.flownodes.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/jbpm.bpmn.flownodes.xml 2009-07-27 21:31:26 UTC (rev 5352)
+++ jbpm4/trunk/modules/bpmn/src/main/java/jbpm.bpmn.flownodes.xml 2009-07-28 00:26:08 UTC (rev 5353)
@@ -4,5 +4,6 @@
<activity binding="org.jbpm.bpmn.flownodes.ServiceActivityBinding" />
<activity binding="org.jbpm.bpmn.flownodes.ReceiveBinding" />
<activity binding="org.jbpm.bpmn.flownodes.EndBinding" />
- <activity binding="org.jbpm.bpmn.flownodes.DecisionBinding" />
+ <activity binding="org.jbpm.bpmn.flownodes.ParallelGatewayBinding" />
+ <activity binding="org.jbpm.bpmn.flownodes.ExclusiveGatewayBinding" />
</activities>
Deleted: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionBinding.java 2009-07-27 21:31:26 UTC (rev 5352)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionBinding.java 2009-07-28 00:26:08 UTC (rev 5353)
@@ -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.bpmn.flownodes;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.jbpm.bpmn.parser.BpmnParser;
-import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.model.ActivityImpl;
-import org.jbpm.pvm.internal.model.TransitionImpl;
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
-import org.jbpm.pvm.internal.wire.descriptor.ExpressionEvaluatorDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ReferenceDescriptor;
-import org.jbpm.pvm.internal.wire.xml.WireParser;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-/**
- * @author Tom Baeyens
- */
-public class DecisionBinding extends BpmnBinding {
-
- private static final Log log = Log.getLog(DecisionBinding.class.getName());
-
- static ObjectBinding objectBinding = new ObjectBinding();
- static WireParser wireParser = WireParser.getInstance();
-
- public DecisionBinding() {
- super("exclusiveGateway");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
-
- String gatewayDirection = "unspeficied";
- String default_ = null;
-
- if (element.hasAttribute("gatewayDirection")) {
- gatewayDirection = element.getAttribute("gatewayDirection");
- // Default behaviour according to the spec is mixed. This is the
- // default in the activity
- } else {
- gatewayDirection = "unspecified";
- }
-
- if (element.hasAttribute("default")) {
- default_ = element.getAttribute("default");
- }
-
- List<Element> transitionElements = XmlUtil.elements((Element) element.getParentNode(), "sequenceFlow");
- String elementId = element.getAttribute("id");
- String elementName = element.getAttribute("name");
- // System.out.println("Element name: " + elementId);
-
- int incomming = 0;
- int outgoing = 0;
- boolean defaultExists = false;
- boolean valid = true;
-
- for (Iterator iterator = transitionElements.iterator(); iterator.hasNext();) {
- Element transitionElement = (Element) iterator.next();
- String sourceRef = transitionElement.getAttribute("sourceRef");
- if (elementId.equals(sourceRef)) {
- outgoing++;
- List<Element> ces = XmlUtil.elements(transitionElement, "conditionExpression");
- if (transitionElement.getAttribute("id").equals(default_)) {
- defaultExists = true;
- if (ces.size() != 0) {
- log.debug("Default sequenceFlow for " + elementName + " has conditionExpressio(s). Ignoring them by removing them from the Document model");
- for (Iterator iterator2 = ces.iterator(); iterator2.hasNext();) {
- Element ce = (Element) iterator2.next();
- transitionElement.removeChild(ce);
- }
- }
- } else {
- if (default_ != null && ces.size() == 0) {
- parse.addProblem("exclusiveGateway '" + elementName + "' has default sequenceFlow '" + default_ + "' but "
- + transitionElement.getAttribute("id") + " does not have a required conditionExpression", element);
- valid = false; // do not break. Parsing may find other issues;
- }
- }
- } else if (transitionElement.getAttribute("targetRef").equals(elementId)) {
- incomming++;
- }
- }
-
- log.debug(gatewayDirection +": incomming: " + incomming + ", outgoing: " + outgoing);
-
- if (("converging".equals(gatewayDirection) && (!(incomming > 1) || outgoing != 1))
- || ("diverging".equals(gatewayDirection) && (incomming != 1 || !(outgoing > 1)))
- || ("mixed".equals(gatewayDirection) && (incomming <= 1 || outgoing <= 1))) {
- parse.addProblem("exclusiveGateway '" + element.getAttribute("name") + "' has the wrong number of incomming (" + incomming + ") and outgoing ("
- + outgoing + ") transitions for gatewayDirection='" + gatewayDirection + "'", element);
-
- valid = false;
- }
-
- if (default_ != null && !defaultExists) {
- parse.addProblem("exclusiveGateway '" + element.getAttribute("name") + "' default sequenceFlow '" + default_
- + "' does not exist or is not related to this node", element);
-
- valid = false;
- }
-
- if (!valid) {
- return null;
- }
- DecisionConditionActivity decisionConditionActivity = new DecisionConditionActivity();
- if (default_ != null) {
- decisionConditionActivity.setDefault(default_);
- }
- decisionConditionActivity.setGatewayDirection(gatewayDirection);
- return decisionConditionActivity;
- }
-}
Deleted: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionConditionActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionConditionActivity.java 2009-07-27 21:31:26 UTC (rev 5352)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionConditionActivity.java 2009-07-28 00:26:08 UTC (rev 5353)
@@ -1,86 +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.bpmn.flownodes;
-
-import java.util.List;
-
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.pvm.internal.model.Activity;
-import org.jbpm.pvm.internal.model.Condition;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.Transition;
-
-/**
- * @author Tom Baeyens
- */
-public class DecisionConditionActivity extends BpmnActivity {
-
- String gatewayDirection = "unspecified"; // is the default behaviour
- String default_ = null;
-
- private static final long serialVersionUID = 1L;
-
- public void execute(ActivityExecution execution) {
- execute((ExecutionImpl) execution);
- }
-
- public void execute(ExecutionImpl execution) {
- Transition transition = findTransition(execution);
- if (transition == null) {
- throw new JbpmException("no outgoing transition condition evaluated to true for decision " + execution.getActivity());
- }
- if (transition.getName() != null) {
- execution.historyDecision(transition.getName());
- }
- execution.take(transition);
- }
-
- private Transition findTransition(ExecutionImpl execution) {
- Activity activity = execution.getActivity();
- List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
- for (Transition transition : outgoingTransitions) {
- Condition condition = transition.getCondition();
- if ((condition == null) || (condition.evaluate(execution))) {
- return transition;
- }
- }
- return null;
- }
-
- public String getGatewayDirection() {
- return gatewayDirection;
- }
-
- public void setGatewayDirection(String gatewayDirection) {
- this.gatewayDirection = gatewayDirection;
- }
-
- public String getDefault() {
- return default_;
- }
-
- public void setDefault(String default_) {
- this.default_ = default_;
- }
-
-}
Copied: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayActivity.java (from rev 5351, jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionConditionActivity.java)
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayActivity.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayActivity.java 2009-07-28 00:26:08 UTC (rev 5353)
@@ -0,0 +1,87 @@
+/*
+ * 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.bpmn.flownodes;
+
+import java.util.List;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.pvm.internal.model.Activity;
+import org.jbpm.pvm.internal.model.Condition;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.Transition;
+
+/**
+ * @author Tom Baeyens
+ * @author Ronald van Kuijk (kukeltje)
+ */
+public class ExclusiveGatewayActivity extends BpmnActivity {
+
+ String gatewayDirection = "unspecified"; // is the default behaviour
+ String default_ = null;
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) {
+ execute((ExecutionImpl) execution);
+ }
+
+ public void execute(ExecutionImpl execution) {
+ Transition transition = findTransition(execution);
+ if (transition == null) {
+ throw new JbpmException("no outgoing transition condition evaluated to true for decision " + execution.getActivity());
+ }
+ if (transition.getName() != null) {
+ execution.historyDecision(transition.getName());
+ }
+ execution.take(transition);
+ }
+
+ private Transition findTransition(ExecutionImpl execution) {
+ Activity activity = execution.getActivity();
+ List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
+ for (Transition transition : outgoingTransitions) {
+ Condition condition = transition.getCondition();
+ if ((condition == null) || (condition.evaluate(execution))) {
+ return transition;
+ }
+ }
+ return null;
+ }
+
+ public String getGatewayDirection() {
+ return gatewayDirection;
+ }
+
+ public void setGatewayDirection(String gatewayDirection) {
+ this.gatewayDirection = gatewayDirection;
+ }
+
+ public String getDefault() {
+ return default_;
+ }
+
+ public void setDefault(String default_) {
+ this.default_ = default_;
+ }
+
+}
Copied: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayBinding.java (from rev 5352, jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionBinding.java)
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayBinding.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayBinding.java 2009-07-28 00:26:08 UTC (rev 5353)
@@ -0,0 +1,135 @@
+/*
+ * 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.bpmn.flownodes;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
+import org.jbpm.pvm.internal.wire.xml.WireParser;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+/**
+ * @author Tom Baeyens
+ * @author Ronald van Kuijk (kukeltje)
+ *
+ */
+public class ExclusiveGatewayBinding extends BpmnBinding {
+
+ private static final Log log = Log.getLog(ExclusiveGatewayBinding.class.getName());
+
+ static ObjectBinding objectBinding = new ObjectBinding();
+ static WireParser wireParser = WireParser.getInstance();
+
+ public ExclusiveGatewayBinding() {
+ super("exclusiveGateway");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+
+ String gatewayDirection = "unspeficied";
+ String default_ = null;
+
+ int incomming = 0;
+ int outgoing = 0;
+
+ boolean defaultExists = false;
+ boolean valid = true;
+
+ if (element.hasAttribute("gatewayDirection")) {
+ gatewayDirection = element.getAttribute("gatewayDirection");
+ } else {
+ // unspecified should be the 'xsd' default, so maybe this is not even
+ // needed.
+ gatewayDirection = "unspecified";
+ }
+
+ if (element.hasAttribute("default")) {
+ default_ = element.getAttribute("default");
+ }
+
+ List<Element> transitionElements = XmlUtil.elements((Element) element.getParentNode(), "sequenceFlow");
+ String elementId = element.getAttribute("id");
+ String elementName = element.getAttribute("name");
+
+ Element ce;
+
+ for (Iterator<Element> iterator = transitionElements.iterator(); iterator.hasNext();) {
+ Element transitionElement = iterator.next();
+ String sourceRef = transitionElement.getAttribute("sourceRef");
+ if (elementId.equals(sourceRef)) {
+ outgoing++;
+ ce = XmlUtil.element(transitionElement, "conditionExpression");
+ if (transitionElement.getAttribute("id").equals(default_)) {
+ defaultExists = true;
+ if (ce != null) {
+ // conditionExpression on the default sequenceflow SHALL be ignored according to the spec
+ log.debug("Default sequenceFlow for " + elementName + " has conditionExpressio(s). Ignoring them by removing them from the Document model");
+ transitionElement.removeChild(ce);
+ }
+ } else if (default_ != null && ce == null) {
+ parse.addProblem("exclusiveGateway '" + elementName + "' has default sequenceFlow '" + default_ + "' but " + transitionElement.getAttribute("id")
+ + " does not have a required conditionExpression", element);
+ valid = false; // do not break. Parsing may find other issues;
+ }
+ } else if (transitionElement.getAttribute("targetRef").equals(elementId)) {
+ incomming++;
+ }
+ }
+
+ if (invalidGatewayDirection(gatewayDirection, incomming, outgoing)) {
+ parse.addProblem("exclusiveGateway '" + element.getAttribute("name") + "' has the wrong number of incomming (" + incomming + ") and outgoing ("
+ + outgoing + ") transitions for gatewayDirection='" + gatewayDirection + "'", element);
+
+ valid = false;
+ }
+
+ if (default_ != null && !defaultExists) {
+ parse.addProblem("exclusiveGateway '" + element.getAttribute("name") + "' default sequenceFlow '" + default_
+ + "' does not exist or is not related to this node", element);
+ valid = false;
+ }
+
+ if (!valid) {
+ return null;
+ }
+
+ ExclusiveGatewayActivity decisionConditionActivity = new ExclusiveGatewayActivity();
+ decisionConditionActivity.setDefault(default_);
+ decisionConditionActivity.setGatewayDirection(gatewayDirection);
+
+ return decisionConditionActivity;
+ }
+
+ private boolean invalidGatewayDirection(String gatewayDirection, int incomming, int outgoing) {
+
+ log.debug(gatewayDirection + ": incomming: " + incomming + ", outgoing: " + outgoing);
+ return ("converging".equals(gatewayDirection) && (!(incomming > 1) || outgoing != 1))
+ || ("diverging".equals(gatewayDirection) && (incomming != 1 || !(outgoing > 1)))
+ || ("mixed".equals(gatewayDirection) && (incomming <= 1 || outgoing <= 1));
+
+ }
+}
Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayActivity.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayActivity.java 2009-07-28 00:26:08 UTC (rev 5353)
@@ -0,0 +1,55 @@
+/*
+ * 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.bpmn.flownodes;
+
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+
+/**
+ * @author Ronald van Kuijk (kukeltje)
+ */
+public class ParallelGatewayActivity extends BpmnActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ //GatewayDirection indicates fork (divergence) or join (convergence). Maybe two different activities is better
+ private String gatewayDirection;
+
+ public void execute(ActivityExecution execution) {
+ execute((ExecutionImpl) execution);
+ }
+
+ public void execute(ExecutionImpl execution) {
+
+ //TODO Implement ;-)
+
+ }
+
+ public String getGatewayDirection() {
+ return gatewayDirection;
+ }
+
+ public void setGatewayDirection(String gatewayDirection) {
+ this.gatewayDirection = gatewayDirection;
+ }
+
+}
Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayBinding.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayBinding.java 2009-07-28 00:26:08 UTC (rev 5353)
@@ -0,0 +1,115 @@
+/*
+ * 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.bpmn.flownodes;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
+import org.jbpm.pvm.internal.wire.xml.WireParser;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+/**
+ * @author Tom Baeyens
+ * @author Ronald van Kuijk (kukeltje)
+ *
+ */
+public class ParallelGatewayBinding extends BpmnBinding {
+
+ private static final Log log = Log.getLog(ParallelGatewayBinding.class.getName());
+
+ static ObjectBinding objectBinding = new ObjectBinding();
+ static WireParser wireParser = WireParser.getInstance();
+
+ public ParallelGatewayBinding() {
+ super("parallelGateway");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+
+ String gatewayDirection = "unspeficied";
+
+ if (element.hasAttribute("gatewayDirection")) {
+ gatewayDirection = element.getAttribute("gatewayDirection");
+ } else {
+ // unspecified should be the 'xsd' default, so maybe this is not even
+ // needed.
+ gatewayDirection = "unspecified";
+ }
+
+
+ int incomming = 0;
+ int outgoing = 0;
+
+ boolean valid = true;
+
+ List<Element> transitionElements = XmlUtil.elements((Element) element.getParentNode(), "sequenceFlow");
+ String elementId = element.getAttribute("id");
+ String elementName = element.getAttribute("name");
+
+ if (gatewayDirection.equals("unspecified") || gatewayDirection.equals("mixed")) {
+ parse.addProblem("gatewayDirection='"+gatewayDirection+ "' currently not supported on parallelGateway '" + elementName + "'", element);
+ return null;
+ }
+
+
+ for (Iterator<Element> iterator = transitionElements.iterator(); iterator.hasNext();) {
+ Element transitionElement = iterator.next();
+ String sourceRef = transitionElement.getAttribute("sourceRef");
+ if (elementId.equals(sourceRef)) {
+ outgoing++;
+ if (XmlUtil.element(transitionElement, "conditionExpression") != null) {
+ parse.addProblem("parallelGateway '" + elementName + "' has invalid conditionExpression outgoing transition", element);
+ valid = false;
+ }
+ } else if (transitionElement.getAttribute("targetRef").equals(elementId)) {
+ incomming++;
+ }
+ }
+
+ if (invalidGatewayDirection(gatewayDirection, incomming, outgoing)) {
+ parse.addProblem("parallelGateway '" + elementName + "' has the wrong number of incomming (" + incomming + ") and outgoing (" + outgoing
+ + ") transitions for gatewayDirection='" + gatewayDirection + "'", element);
+
+ valid = false;
+ }
+
+ if (!valid) {
+ return null;
+ }
+
+ return new ParallelGatewayActivity();
+ }
+
+ private boolean invalidGatewayDirection(String gatewayDirection, int incomming, int outgoing) {
+
+ log.debug(gatewayDirection + ": incomming: " + incomming + ", outgoing: " + outgoing);
+ return ("converging".equals(gatewayDirection) && (!(incomming > 1) || outgoing != 1))
+ || ("diverging".equals(gatewayDirection) && (incomming != 1 || !(outgoing > 1)))
+ || ("mixed".equals(gatewayDirection) && (incomming <= 1 || outgoing <= 1));
+
+ }
+}
Added: jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ParallelGatewayTest.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ParallelGatewayTest.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ParallelGatewayTest.java 2009-07-28 00:26:08 UTC (rev 5353)
@@ -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.bpmn.flownodes;
+
+import java.util.List;
+
+import org.jbpm.bpmn.parser.BpmnParser;
+import org.jbpm.pvm.internal.xml.Problem;
+import org.jbpm.test.JbpmTestCase;
+
+/**
+ * @author Ronald van Kuijk (kukeltje)
+ */
+public class ParallelGatewayTest extends JbpmTestCase {
+
+ static BpmnParser bpmnParser = new BpmnParser();
+
+ public List<Problem> parse(String resource) {
+
+ List<Problem> problems = bpmnParser.createParse().setResource(resource).execute().getProblems();
+
+ return problems;
+ }
+
+ public void testNormal() {
+
+ List<Problem> problems = parse("org/jbpm/bpmn/flownodes/parallelGateway.bpmn.xml");
+
+ if (!problems.isEmpty()) {
+ fail("No problems should have occured. Problems: " + problems);
+ }
+ }
+
+ public void testInvalid() {
+
+ List<Problem> problems = parse("org/jbpm/bpmn/flownodes/parallelGatewayInvalid.bpmn.xml");
+
+ if ((problems == null) || (problems.isEmpty())) {
+ fail("expected problems during parse");
+ } else {
+ assertTextPresent("parallelGateway 'The Fork' has the wrong number of incomming (1) and outgoing (2) transitions for gatewayDirection='converging'", problems.get(0).getMsg());
+ }
+ }
+//
+// public void testNonExistingDefault() {
+//
+// List<Problem> problems = parse("org/jbpm/bpmn/flownodes/exclusiveGatewayNonExistingDefault.bpmn.xml");
+//
+// if ((problems == null) || (problems.isEmpty())) {
+// fail("expected problems during parse");
+// } else {
+// assertTextPresent("cvc-id.1: There is no ID/IDREF binding for IDREF 'flow666'", problems.get(0).getMsg());
+// }
+// }
+//
+// public void testMixedValid() {
+//
+// List<Problem> problems = parse("org/jbpm/bpmn/flownodes/exclusiveGatewayMixedValid.bpmn.xml");
+//
+// if (!problems.isEmpty()) {
+// fail("No problems should have occured. Problems: " + problems);
+// }
+// }
+//
+//
+// public void testMixedInvalid() {
+//
+// List<Problem> problems = parse("org/jbpm/bpmn/flownodes/exclusiveGatewayMixedInvalid.bpmn.xml");
+//
+// if ((problems == null) || (problems.isEmpty())) {
+// fail("expected problems during parse");
+// } else {
+// assertTextPresent("exclusiveGateway 'Just a gateway' has the wrong number of incomming (1) and outgoing (2) transitions for gatewayDirection='mixed'", problems.get(0).getMsg());
+// }
+// }
+//
+//
+//
+// public void testConvergingInvalid() {
+//
+// List<Problem> problems = parse("org/jbpm/bpmn/flownodes/exclusiveGatewayConvergingInvalid.bpmn.xml");
+//
+// if ((problems == null) || (problems.isEmpty())) {
+// fail("expected problems during parse");
+// } else {
+// assertTextPresent("exclusiveGateway 'Just a gateway' has the wrong number of incomming (1) and outgoing (2) transitions for gatewayDirection='converging'", problems.get(0).getMsg());
+// }
+// }
+//
+// public void testDivergingInvalid() {
+//
+// List<Problem> problems = parse("org/jbpm/bpmn/flownodes/exclusiveGatewayDivergingInvalid.bpmn.xml");
+//
+// if ((problems == null) || (problems.isEmpty())) {
+// fail("expected problems during parse");
+// } else {
+// assertTextPresent("exclusiveGateway 'Just a gateway' has the wrong number of incomming (2) and outgoing (2) transitions for gatewayDirection='diverging'", problems.get(0).getMsg());
+// }
+// }
+
+}
Added: jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/parallelGateway.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/parallelGateway.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/parallelGateway.bpmn.xml 2009-07-28 00:26:08 UTC (rev 5353)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ExclusiveGatewayNormal"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 /home/kukel/workspace-jbpm4/jbpm/modules/bpmn/src/main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <bpmn:process id="Shipment" name="Shipment">
+ <!-- Start-Event -->
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" sourceRef="Start"
+ targetRef="parallelGatewayFork" name="fromStartToFork" />
+
+ <bpmn:parallelGateway id="parallelGatewayFork"
+ name="The Fork" gatewayDirection="diverging"/>
+
+ <bpmn:sequenceFlow id="flow2" sourceRef="parallelGatewayFork"
+ targetRef="parallelGatewayJoin" name="Leg 1" />
+
+ <bpmn:sequenceFlow id="flow3" sourceRef="parallelGatewayFork"
+ targetRef="parallelGatewayJoin" name="Leg 2" />
+
+ <bpmn:parallelGateway id="parallelGatewayJoin"
+ name="The Join" gatewayDirection="converging"/>
+
+ <bpmn:sequenceFlow id="flow4" sourceRef="parallelGatewayJoin"
+ targetRef="End">
+ </bpmn:sequenceFlow>
+
+ <!-- End Events -->
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Added: jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/parallelGatewayInvalid.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/parallelGatewayInvalid.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/parallelGatewayInvalid.bpmn.xml 2009-07-28 00:26:08 UTC (rev 5353)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ExclusiveGatewayNormal"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 /home/kukel/workspace-jbpm4/jbpm/modules/bpmn/src/main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <bpmn:process id="Shipment" name="Shipment">
+ <!-- Start-Event -->
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" sourceRef="Start"
+ targetRef="parallelGatewayFork" name="fromStartToFork" />
+
+ <bpmn:parallelGateway id="parallelGatewayFork"
+ name="The Fork" gatewayDirection="converging"/>
+
+ <bpmn:sequenceFlow id="flow2" sourceRef="parallelGatewayFork"
+ targetRef="parallelGatewayJoin" name="Leg 1" />
+
+ <bpmn:sequenceFlow id="flow3" sourceRef="parallelGatewayFork"
+ targetRef="parallelGatewayJoin" name="Leg 2" />
+
+ <bpmn:parallelGateway id="parallelGatewayJoin"
+ name="The Join" gatewayDirection="diverging"/>
+
+ <bpmn:sequenceFlow id="flow4" sourceRef="parallelGatewayJoin"
+ targetRef="End">
+ </bpmn:sequenceFlow>
+
+ <!-- End Events -->
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
15 years, 3 months
JBoss JBPM SVN: r5352 - in jbpm4/trunk/modules/bpmn/src: main/java/org/jbpm/bpmn/parser and 4 other directories.
by do-not-reply@jboss.org
Author: kukeltje
Date: 2009-07-27 17:31:26 -0400 (Mon, 27 Jul 2009)
New Revision: 5352
Added:
jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/
jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayTest.java
jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/
jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGateway.bpmn.xml
jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayConvergingInvalid.bpmn.xml
jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayDivergingInvalid.bpmn.xml
jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayMixedInvalid.bpmn.xml
jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayMixedValid.bpmn.xml
jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayNonBoundDefault.bpmn.xml
jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayNonExistingDefault.bpmn.xml
Modified:
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionBinding.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java
Log:
Initial testcases for exclusiveGateway and small some fixes found by the tests ;-)
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionBinding.java 2009-07-27 19:39:15 UTC (rev 5351)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionBinding.java 2009-07-27 21:31:26 UTC (rev 5352)
@@ -24,6 +24,8 @@
import java.util.Iterator;
import java.util.List;
+import org.jbpm.bpmn.parser.BpmnParser;
+import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.model.ActivityImpl;
import org.jbpm.pvm.internal.model.TransitionImpl;
import org.jbpm.pvm.internal.util.XmlUtil;
@@ -41,6 +43,8 @@
*/
public class DecisionBinding extends BpmnBinding {
+ private static final Log log = Log.getLog(DecisionBinding.class.getName());
+
static ObjectBinding objectBinding = new ObjectBinding();
static WireParser wireParser = WireParser.getInstance();
@@ -67,6 +71,7 @@
List<Element> transitionElements = XmlUtil.elements((Element) element.getParentNode(), "sequenceFlow");
String elementId = element.getAttribute("id");
+ String elementName = element.getAttribute("name");
// System.out.println("Element name: " + elementId);
int incomming = 0;
@@ -83,7 +88,7 @@
if (transitionElement.getAttribute("id").equals(default_)) {
defaultExists = true;
if (ces.size() != 0) {
- System.out.println("Default sequenceFlow has conditionExpressio(s). Ignoring them by removing them from the Document model");
+ log.debug("Default sequenceFlow for " + elementName + " has conditionExpressio(s). Ignoring them by removing them from the Document model");
for (Iterator iterator2 = ces.iterator(); iterator2.hasNext();) {
Element ce = (Element) iterator2.next();
transitionElement.removeChild(ce);
@@ -91,7 +96,7 @@
}
} else {
if (default_ != null && ces.size() == 0) {
- parse.addProblem("exclusiveGateway '" + element.getAttribute("name") + "' has default sequenceFlow '" + default_ + "' but "
+ parse.addProblem("exclusiveGateway '" + elementName + "' has default sequenceFlow '" + default_ + "' but "
+ transitionElement.getAttribute("id") + " does not have a required conditionExpression", element);
valid = false; // do not break. Parsing may find other issues;
}
@@ -100,9 +105,11 @@
incomming++;
}
}
+
+ log.debug(gatewayDirection +": incomming: " + incomming + ", outgoing: " + outgoing);
- if (("converging".equals(gatewayDirection) && !(incomming > 1) && outgoing != 1)
- || ("diverging".equals(gatewayDirection) && incomming != 1 && !(outgoing > 1))
+ if (("converging".equals(gatewayDirection) && (!(incomming > 1) || outgoing != 1))
+ || ("diverging".equals(gatewayDirection) && (incomming != 1 || !(outgoing > 1)))
|| ("mixed".equals(gatewayDirection) && (incomming <= 1 || outgoing <= 1))) {
parse.addProblem("exclusiveGateway '" + element.getAttribute("name") + "' has the wrong number of incomming (" + incomming + ") and outgoing ("
+ outgoing + ") transitions for gatewayDirection='" + gatewayDirection + "'", element);
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java 2009-07-27 19:39:15 UTC (rev 5351)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java 2009-07-27 21:31:26 UTC (rev 5352)
@@ -211,8 +211,8 @@
String sourceRef = XmlUtil.attribute(transitionElement, "sourceRef", true, parse);
String targetRef = XmlUtil.attribute(transitionElement, "targetRef", true, parse);
- System.out.println(transitionId + ": " + sourceRef + " -> " + targetRef);
- System.out.println(" with " + XmlUtil.elements(transitionElement, "conditionExpression").size() + " conditionExpressions");
+ log.trace(transitionId + ": " + sourceRef + " -> " + targetRef);
+ log.trace(" with " + XmlUtil.elements(transitionElement, "conditionExpression").size() + " conditionExpressions");
TransitionImpl transition = compositeElement.findActivity(sourceRef).createOutgoingTransition();
compositeElement.findActivity(targetRef).addIncomingTransition(transition);
@@ -287,9 +287,11 @@
}
Element potentialOwner = XmlUtil.element(element, "potentialOwner");
- String potentialOwnerRef = XmlUtil.attribute(potentialOwner, "resourceRef");
- // set to fixed expression, more evaluation needed for real BPMN 2.0
- taskDefinition.setCandidateGroupsExpression(processDefinition.getResource(potentialOwnerRef));
+ if (potentialOwner != null) {
+ String potentialOwnerRef = XmlUtil.attribute(potentialOwner, "resourceRef");
+ // set to fixed expression, more evaluation needed for real BPMN 2.0
+ taskDefinition.setCandidateGroupsExpression(processDefinition.getResource(potentialOwnerRef));
+ }
return taskDefinition;
}
Copied: jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayTest.java (from rev 5345, jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/test/ShipmentTest.java)
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayTest.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayTest.java 2009-07-27 21:31:26 UTC (rev 5352)
@@ -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.bpmn.flownodes;
+
+import java.util.List;
+
+import org.jbpm.bpmn.parser.BpmnParser;
+import org.jbpm.pvm.internal.xml.Problem;
+import org.jbpm.test.JbpmTestCase;
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExclusiveGatewayTest extends JbpmTestCase {
+
+ static BpmnParser bpmnParser = new BpmnParser();
+
+ public List<Problem> parse(String resource) {
+
+ List<Problem> problems = bpmnParser.createParse().setResource(resource).execute().getProblems();
+
+ return problems;
+ }
+
+ public void testNormal() {
+
+ List<Problem> problems = parse("org/jbpm/bpmn/flownodes/exclusiveGateway.bpmn.xml");
+
+ if (!problems.isEmpty()) {
+ fail("No problems should have occured. Problems: " + problems);
+ }
+ }
+
+ public void testNonBoundDefault() {
+
+ List<Problem> problems = parse("org/jbpm/bpmn/flownodes/exclusiveGatewayNonBoundDefault.bpmn.xml");
+
+ if ((problems == null) || (problems.isEmpty())) {
+ fail("expected problems during parse");
+ } else {
+ assertTextPresent("exclusiveGateway 'Just a gateway' default sequenceFlow 'flow5' does not exist or is not related to this node", problems.get(0).getMsg());
+ }
+ }
+
+ public void testNonExistingDefault() {
+
+ List<Problem> problems = parse("org/jbpm/bpmn/flownodes/exclusiveGatewayNonExistingDefault.bpmn.xml");
+
+ if ((problems == null) || (problems.isEmpty())) {
+ fail("expected problems during parse");
+ } else {
+ assertTextPresent("cvc-id.1: There is no ID/IDREF binding for IDREF 'flow666'", problems.get(0).getMsg());
+ }
+ }
+
+ public void testMixedValid() {
+
+ List<Problem> problems = parse("org/jbpm/bpmn/flownodes/exclusiveGatewayMixedValid.bpmn.xml");
+
+ if (!problems.isEmpty()) {
+ fail("No problems should have occured. Problems: " + problems);
+ }
+ }
+
+
+ public void testMixedInvalid() {
+
+ List<Problem> problems = parse("org/jbpm/bpmn/flownodes/exclusiveGatewayMixedInvalid.bpmn.xml");
+
+ if ((problems == null) || (problems.isEmpty())) {
+ fail("expected problems during parse");
+ } else {
+ assertTextPresent("exclusiveGateway 'Just a gateway' has the wrong number of incomming (1) and outgoing (2) transitions for gatewayDirection='mixed'", problems.get(0).getMsg());
+ }
+ }
+
+
+
+ public void testConvergingInvalid() {
+
+ List<Problem> problems = parse("org/jbpm/bpmn/flownodes/exclusiveGatewayConvergingInvalid.bpmn.xml");
+
+ if ((problems == null) || (problems.isEmpty())) {
+ fail("expected problems during parse");
+ } else {
+ assertTextPresent("exclusiveGateway 'Just a gateway' has the wrong number of incomming (1) and outgoing (2) transitions for gatewayDirection='converging'", problems.get(0).getMsg());
+ }
+ }
+
+ public void testDivergingInvalid() {
+
+ List<Problem> problems = parse("org/jbpm/bpmn/flownodes/exclusiveGatewayDivergingInvalid.bpmn.xml");
+
+ if ((problems == null) || (problems.isEmpty())) {
+ fail("expected problems during parse");
+ } else {
+ assertTextPresent("exclusiveGateway 'Just a gateway' has the wrong number of incomming (2) and outgoing (2) transitions for gatewayDirection='diverging'", problems.get(0).getMsg());
+ }
+ }
+
+}
Added: jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGateway.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGateway.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGateway.bpmn.xml 2009-07-27 21:31:26 UTC (rev 5352)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ExclusiveGatewayNormal"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 /home/kukel/workspace-jbpm4/jbpm/modules/bpmn/src/main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <bpmn:process id="Shipment" name="Shipment">
+ <!-- Start-Event -->
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" sourceRef="Start"
+ targetRef="exclusiveGateway" name="Start->exclusiveGateway" />
+
+ <bpmn:exclusiveGateway id="exclusiveGateway"
+ name="Just a gateway" />
+
+ <!-- Sequence Flow -->
+
+ <bpmn:sequenceFlow id="flow2" sourceRef="exclusiveGateway"
+ targetRef="doSomething">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">
+ getDataObject('lieferungVariable')/confirmationRequired=true
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="flow3" sourceRef="exclusiveGateway"
+ targetRef="doSomethingElse">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">not(
+ getDataObject('lieferungVariable')/confirmationRequired=true )
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+
+ <bpmn:userTask id="doSomething" name="Anything at all"
+ implementation="other"></bpmn:userTask>
+ <bpmn:sequenceFlow id="flow4" sourceRef="doSomething"
+ targetRef="End" />
+
+ <bpmn:userTask id="doSomethingElse" name="But completely different"
+ implementation="other" />
+ <bpmn:sequenceFlow id="flow5" sourceRef="doSomethingElse"
+ targetRef="End" />
+
+ <!-- End Events -->
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Added: jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayConvergingInvalid.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayConvergingInvalid.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayConvergingInvalid.bpmn.xml 2009-07-27 21:31:26 UTC (rev 5352)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ExclusiveGatewayNormal"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 /home/kukel/workspace-jbpm4/jbpm/modules/bpmn/src/main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <bpmn:process id="Shipment" name="Shipment">
+ <!-- Start-Event -->
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" sourceRef="Start"
+ targetRef="exclusiveGateway" name="Start->exclusiveGateway" />
+
+ <bpmn:exclusiveGateway id="exclusiveGateway" default="flow5"
+ name="Just a gateway" gatewayDirection="converging"/>
+
+ <!-- Sequence Flow -->
+
+ <bpmn:sequenceFlow id="flow2" sourceRef="exclusiveGateway"
+ targetRef="doSomething">
+ <bpmn:conditionExpression xsi:type="bpmn:tExpression">
+ Has to be valid
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="flow3" sourceRef="exclusiveGateway"
+ targetRef="doSomethingElse">
+ <bpmn:conditionExpression xsi:type="bpmn:tExpression">
+ Otherwise this one
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+
+ <bpmn:userTask id="doSomething" name="Anything at all"
+ implementation="other"></bpmn:userTask>
+ <bpmn:sequenceFlow id="flow4" sourceRef="doSomething"
+ targetRef="End" />
+
+ <bpmn:userTask id="doSomethingElse" name="But completely different"
+ implementation="other" />
+ <bpmn:sequenceFlow id="flow5" sourceRef="doSomethingElse"
+ targetRef="End" />
+
+ <!-- End Events -->
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Added: jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayDivergingInvalid.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayDivergingInvalid.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayDivergingInvalid.bpmn.xml 2009-07-27 21:31:26 UTC (rev 5352)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ExclusiveGatewayNormal"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 /home/kukel/workspace-jbpm4/jbpm/modules/bpmn/src/main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <bpmn:process id="Shipment" name="Shipment">
+ <!-- Start-Event -->
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" sourceRef="Start"
+ targetRef="exclusiveGatewayPre" name="Start->exclusiveGateway" />
+
+ <bpmn:exclusiveGateway id="exclusiveGatewayPre"
+ name="Just a dummy gateway"/>
+
+ <bpmn:sequenceFlow id="flow6" sourceRef="exclusiveGatewayPre"
+ targetRef="exclusiveGateway" name="exclusiveGateway->exclusiveGatewayPre" />
+
+ <bpmn:sequenceFlow id="flow7" sourceRef="exclusiveGatewayPre"
+ targetRef="exclusiveGateway" name="exclusiveGateway->exclusiveGatewayPre" />
+
+ <bpmn:exclusiveGateway id="exclusiveGateway"
+ name="Just a gateway" gatewayDirection="diverging"/>
+
+ <bpmn:sequenceFlow id="flow2" sourceRef="exclusiveGateway"
+ targetRef="doSomething">
+ <bpmn:conditionExpression xsi:type="bpmn:tExpression">
+ Has to be valid
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="flow3" sourceRef="exclusiveGateway"
+ targetRef="doSomethingElse">
+ <bpmn:conditionExpression xsi:type="bpmn:tExpression">
+ Otherwise this one
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+
+ <bpmn:userTask id="doSomething" name="Anything at all"
+ implementation="other"></bpmn:userTask>
+ <bpmn:sequenceFlow id="flow4" sourceRef="doSomething"
+ targetRef="End" />
+
+ <bpmn:userTask id="doSomethingElse" name="But completely different"
+ implementation="other" />
+ <bpmn:sequenceFlow id="flow5" sourceRef="doSomethingElse"
+ targetRef="End" />
+
+ <!-- End Events -->
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Added: jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayMixedInvalid.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayMixedInvalid.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayMixedInvalid.bpmn.xml 2009-07-27 21:31:26 UTC (rev 5352)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ExclusiveGatewayNormal"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 /home/kukel/workspace-jbpm4/jbpm/modules/bpmn/src/main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <bpmn:process id="Shipment" name="Shipment">
+ <!-- Start-Event -->
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" sourceRef="Start"
+ targetRef="exclusiveGateway" name="Start->exclusiveGateway" />
+
+ <bpmn:exclusiveGateway id="exclusiveGateway" default="flow5"
+ name="Just a gateway" gatewayDirection="mixed"/>
+
+ <!-- Sequence Flow -->
+
+ <bpmn:sequenceFlow id="flow2" sourceRef="exclusiveGateway"
+ targetRef="doSomething">
+ <bpmn:conditionExpression xsi:type="bpmn:tExpression">
+ Has to be valid
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="flow3" sourceRef="exclusiveGateway"
+ targetRef="doSomethingElse">
+ <bpmn:conditionExpression xsi:type="bpmn:tExpression">
+ Otherwise this one
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+
+ <bpmn:userTask id="doSomething" name="Anything at all"
+ implementation="other"></bpmn:userTask>
+ <bpmn:sequenceFlow id="flow4" sourceRef="doSomething"
+ targetRef="End" />
+
+ <bpmn:userTask id="doSomethingElse" name="But completely different"
+ implementation="other" />
+ <bpmn:sequenceFlow id="flow5" sourceRef="doSomethingElse"
+ targetRef="End" />
+
+ <!-- End Events -->
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Added: jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayMixedValid.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayMixedValid.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayMixedValid.bpmn.xml 2009-07-27 21:31:26 UTC (rev 5352)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ExclusiveGatewayNormal"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 /home/kukel/workspace-jbpm4/jbpm/modules/bpmn/src/main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <bpmn:process id="Shipment" name="Shipment">
+ <!-- Start-Event -->
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" sourceRef="Start"
+ targetRef="exclusiveGatewayPre" name="Start->exclusiveGateway" />
+
+ <bpmn:exclusiveGateway id="exclusiveGatewayPre"
+ name="Just a dummy gateway"/>
+
+ <bpmn:sequenceFlow id="flow6" sourceRef="exclusiveGatewayPre"
+ targetRef="exclusiveGateway" name="exclusiveGateway->exclusiveGatewayPre" />
+
+ <bpmn:sequenceFlow id="flow7" sourceRef="exclusiveGatewayPre"
+ targetRef="exclusiveGateway" name="exclusiveGateway->exclusiveGatewayPre" />
+
+ <bpmn:exclusiveGateway id="exclusiveGateway"
+ name="Just a gateway" gatewayDirection="mixed"/>
+
+ <bpmn:sequenceFlow id="flow2" sourceRef="exclusiveGateway"
+ targetRef="doSomething">
+ <bpmn:conditionExpression xsi:type="bpmn:tExpression">
+ Has to be valid
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="flow3" sourceRef="exclusiveGateway"
+ targetRef="doSomethingElse">
+ <bpmn:conditionExpression xsi:type="bpmn:tExpression">
+ Otherwise this one
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+
+ <bpmn:userTask id="doSomething" name="Anything at all"
+ implementation="other"></bpmn:userTask>
+ <bpmn:sequenceFlow id="flow4" sourceRef="doSomething"
+ targetRef="End" />
+
+ <bpmn:userTask id="doSomethingElse" name="But completely different"
+ implementation="other" />
+ <bpmn:sequenceFlow id="flow5" sourceRef="doSomethingElse"
+ targetRef="End" />
+
+ <!-- End Events -->
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Added: jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayNonBoundDefault.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayNonBoundDefault.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayNonBoundDefault.bpmn.xml 2009-07-27 21:31:26 UTC (rev 5352)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ExclusiveGatewayNormal"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 /home/kukel/workspace-jbpm4/jbpm/modules/bpmn/src/main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <bpmn:process id="Shipment" name="Shipment">
+ <!-- Start-Event -->
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" sourceRef="Start"
+ targetRef="exclusiveGateway" name="Start->exclusiveGateway" />
+
+ <bpmn:exclusiveGateway id="exclusiveGateway" default="flow5"
+ name="Just a gateway" />
+
+ <!-- Sequence Flow -->
+
+ <bpmn:sequenceFlow id="flow2" sourceRef="exclusiveGateway"
+ targetRef="doSomething">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">
+ getDataObject('lieferungVariable')/confirmationRequired=true
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="flow3" sourceRef="exclusiveGateway"
+ targetRef="doSomethingElse">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">not(
+ getDataObject('lieferungVariable')/confirmationRequired=true )
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+
+ <bpmn:userTask id="doSomething" name="Anything at all"
+ implementation="other"></bpmn:userTask>
+ <bpmn:sequenceFlow id="flow4" sourceRef="doSomething"
+ targetRef="End" />
+
+ <bpmn:userTask id="doSomethingElse" name="But completely different"
+ implementation="other" />
+ <bpmn:sequenceFlow id="flow5" sourceRef="doSomethingElse"
+ targetRef="End" />
+
+ <!-- End Events -->
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Added: jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayNonExistingDefault.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayNonExistingDefault.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayNonExistingDefault.bpmn.xml 2009-07-27 21:31:26 UTC (rev 5352)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ExclusiveGatewayNormal"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 /home/kukel/workspace-jbpm4/jbpm/modules/bpmn/src/main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <bpmn:process id="Shipment" name="Shipment">
+ <!-- Start-Event -->
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" sourceRef="Start"
+ targetRef="exclusiveGateway" name="Start->exclusiveGateway" />
+
+ <bpmn:exclusiveGateway id="exclusiveGateway" default="flow666"
+ name="Just a gateway" />
+
+ <!-- Sequence Flow -->
+
+ <bpmn:sequenceFlow id="flow2" sourceRef="exclusiveGateway"
+ targetRef="doSomething">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">
+ getDataObject('lieferungVariable')/confirmationRequired=true
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="flow3" sourceRef="exclusiveGateway"
+ targetRef="doSomethingElse">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">not(
+ getDataObject('lieferungVariable')/confirmationRequired=true )
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+
+ <bpmn:userTask id="doSomething" name="Anything at all"
+ implementation="other"></bpmn:userTask>
+ <bpmn:sequenceFlow id="flow4" sourceRef="doSomething"
+ targetRef="End" />
+
+ <bpmn:userTask id="doSomethingElse" name="But completely different"
+ implementation="other" />
+ <bpmn:sequenceFlow id="flow5" sourceRef="doSomethingElse"
+ targetRef="End" />
+
+ <!-- End Events -->
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
15 years, 3 months
JBoss JBPM SVN: r5351 - jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes.
by do-not-reply@jboss.org
Author: kukeltje
Date: 2009-07-27 15:39:15 -0400 (Mon, 27 Jul 2009)
New Revision: 5351
Modified:
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionBinding.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionConditionActivity.java
Log:
Finished parsing of exclusiveGateway
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionBinding.java 2009-07-27 19:34:52 UTC (rev 5350)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionBinding.java 2009-07-27 19:39:15 UTC (rev 5351)
@@ -21,6 +21,7 @@
*/
package org.jbpm.bpmn.flownodes;
+import java.util.Iterator;
import java.util.List;
import org.jbpm.pvm.internal.model.ActivityImpl;
@@ -35,7 +36,6 @@
import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
-
/**
* @author Tom Baeyens
*/
@@ -48,45 +48,83 @@
super("exclusiveGateway");
}
- public Object parse(Element element, Parse parse, Parser parser) {
-
- boolean hasConditions = false;
- List<Element> transitionElements = XmlUtil.elements(element, "transition");
- ActivityImpl activity = parse.findObject(ActivityImpl.class);
- List<TransitionImpl> transitions = (List) activity.getOutgoingTransitions();
-
- for (int i=0; i<transitionElements.size(); i++) {
- TransitionImpl transition = transitions.get(i);
- Element transitionElement = transitionElements.get(i);
+ public Object parse(Element element, Parse parse, Parser parser) {
- Element conditionElement = XmlUtil.element(transitionElement, "condition");
- if (conditionElement!=null) {
- hasConditions = true;
-
- if (conditionElement.hasAttribute("expr")) {
- String expr = conditionElement.getAttribute("expr");
- String lang = XmlUtil.attribute(conditionElement, "expr-lang");
- ExpressionEvaluatorDescriptor expressionDescriptor = new ExpressionEvaluatorDescriptor(expr, lang);
- transition.setConditionDescriptor(expressionDescriptor);
-
- } else if (conditionElement.hasAttribute("ref")) {
- String expr = conditionElement.getAttribute("ref");
- ReferenceDescriptor refDescriptor = new ReferenceDescriptor(expr);
- transition.setConditionDescriptor(refDescriptor);
-
- } else if (ObjectBinding.isObjectDescriptor(conditionElement)) {
- ObjectDescriptor conditionDescriptor = (ObjectDescriptor) objectBinding.parse(conditionElement, parse, parser);
- transition.setConditionDescriptor(conditionDescriptor);
+ String gatewayDirection = "unspeficied";
+ String default_ = null;
+
+ if (element.hasAttribute("gatewayDirection")) {
+ gatewayDirection = element.getAttribute("gatewayDirection");
+ // Default behaviour according to the spec is mixed. This is the
+ // default in the activity
+ } else {
+ gatewayDirection = "unspecified";
+ }
+
+ if (element.hasAttribute("default")) {
+ default_ = element.getAttribute("default");
+ }
+
+ List<Element> transitionElements = XmlUtil.elements((Element) element.getParentNode(), "sequenceFlow");
+ String elementId = element.getAttribute("id");
+ // System.out.println("Element name: " + elementId);
+
+ int incomming = 0;
+ int outgoing = 0;
+ boolean defaultExists = false;
+ boolean valid = true;
+
+ for (Iterator iterator = transitionElements.iterator(); iterator.hasNext();) {
+ Element transitionElement = (Element) iterator.next();
+ String sourceRef = transitionElement.getAttribute("sourceRef");
+ if (elementId.equals(sourceRef)) {
+ outgoing++;
+ List<Element> ces = XmlUtil.elements(transitionElement, "conditionExpression");
+ if (transitionElement.getAttribute("id").equals(default_)) {
+ defaultExists = true;
+ if (ces.size() != 0) {
+ System.out.println("Default sequenceFlow has conditionExpressio(s). Ignoring them by removing them from the Document model");
+ for (Iterator iterator2 = ces.iterator(); iterator2.hasNext();) {
+ Element ce = (Element) iterator2.next();
+ transitionElement.removeChild(ce);
+ }
+ }
+ } else {
+ if (default_ != null && ces.size() == 0) {
+ parse.addProblem("exclusiveGateway '" + element.getAttribute("name") + "' has default sequenceFlow '" + default_ + "' but "
+ + transitionElement.getAttribute("id") + " does not have a required conditionExpression", element);
+ valid = false; // do not break. Parsing may find other issues;
+ }
}
+ } else if (transitionElement.getAttribute("targetRef").equals(elementId)) {
+ incomming++;
}
}
-
- if (hasConditions) {
- return new DecisionConditionActivity();
- } else {
- parse.addProblem("decision '"+element.getAttribute("name")+"' must have one of: expr attribute, handler attribute, handler element or condition expressions", element);
+
+ if (("converging".equals(gatewayDirection) && !(incomming > 1) && outgoing != 1)
+ || ("diverging".equals(gatewayDirection) && incomming != 1 && !(outgoing > 1))
+ || ("mixed".equals(gatewayDirection) && (incomming <= 1 || outgoing <= 1))) {
+ parse.addProblem("exclusiveGateway '" + element.getAttribute("name") + "' has the wrong number of incomming (" + incomming + ") and outgoing ("
+ + outgoing + ") transitions for gatewayDirection='" + gatewayDirection + "'", element);
+
+ valid = false;
}
-
- return null;
+
+ if (default_ != null && !defaultExists) {
+ parse.addProblem("exclusiveGateway '" + element.getAttribute("name") + "' default sequenceFlow '" + default_
+ + "' does not exist or is not related to this node", element);
+
+ valid = false;
+ }
+
+ if (!valid) {
+ return null;
+ }
+ DecisionConditionActivity decisionConditionActivity = new DecisionConditionActivity();
+ if (default_ != null) {
+ decisionConditionActivity.setDefault(default_);
+ }
+ decisionConditionActivity.setGatewayDirection(gatewayDirection);
+ return decisionConditionActivity;
}
}
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionConditionActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionConditionActivity.java 2009-07-27 19:34:52 UTC (rev 5350)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionConditionActivity.java 2009-07-27 19:39:15 UTC (rev 5351)
@@ -30,23 +30,26 @@
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.model.Transition;
-
/**
* @author Tom Baeyens
*/
public class DecisionConditionActivity extends BpmnActivity {
+ String gatewayDirection = "unspecified"; // is the default behaviour
+ String default_ = null;
+
private static final long serialVersionUID = 1L;
public void execute(ActivityExecution execution) {
- execute((ExecutionImpl)execution);
+ execute((ExecutionImpl) execution);
}
+
public void execute(ExecutionImpl execution) {
Transition transition = findTransition(execution);
- if (transition==null) {
- throw new JbpmException("no outgoing transition condition evaluated to true for decision "+execution.getActivity());
+ if (transition == null) {
+ throw new JbpmException("no outgoing transition condition evaluated to true for decision " + execution.getActivity());
}
- if (transition.getName()!=null) {
+ if (transition.getName() != null) {
execution.historyDecision(transition.getName());
}
execution.take(transition);
@@ -57,12 +60,27 @@
List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
for (Transition transition : outgoingTransitions) {
Condition condition = transition.getCondition();
- if ( (condition==null)
- || (condition.evaluate(execution))
- ) {
+ if ((condition == null) || (condition.evaluate(execution))) {
return transition;
}
}
return null;
}
+
+ public String getGatewayDirection() {
+ return gatewayDirection;
+ }
+
+ public void setGatewayDirection(String gatewayDirection) {
+ this.gatewayDirection = gatewayDirection;
+ }
+
+ public String getDefault() {
+ return default_;
+ }
+
+ public void setDefault(String default_) {
+ this.default_ = default_;
+ }
+
}
15 years, 3 months
JBoss JBPM SVN: r5350 - in jbpm4/trunk/modules/bpmn/src/main/java: org/jbpm/bpmn/flownodes and 1 other directories.
by do-not-reply@jboss.org
Author: kukeltje
Date: 2009-07-27 15:34:52 -0400 (Mon, 27 Jul 2009)
New Revision: 5350
Added:
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BindingsParser.java
Modified:
jbpm4/trunk/modules/bpmn/src/main/java/jbpm.bpmn.flownodes.xml
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskBinding.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java
Log:
Remove dependency on jBPM module
Modified: jbpm4/trunk/modules/bpmn/src/main/java/jbpm.bpmn.flownodes.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/jbpm.bpmn.flownodes.xml 2009-07-27 18:29:46 UTC (rev 5349)
+++ jbpm4/trunk/modules/bpmn/src/main/java/jbpm.bpmn.flownodes.xml 2009-07-27 19:34:52 UTC (rev 5350)
@@ -1,8 +1,8 @@
<activities>
- <activity binding="com.camunda.bpmn.activity.StartBinding" />
- <activity binding="com.camunda.bpmn.activity.TaskBinding" />
- <activity binding="com.camunda.bpmn.activity.ServiceActivityBinding" />
- <activity binding="com.camunda.bpmn.activity.ReceiveBinding" />
- <activity binding="com.camunda.bpmn.activity.EndBinding" />
- <activity binding="com.camunda.bpmn.activity.DecisionBinding" />
+ <activity binding="org.jbpm.bpmn.flownodes.StartBinding" />
+ <activity binding="org.jbpm.bpmn.flownodes.TaskBinding" />
+ <activity binding="org.jbpm.bpmn.flownodes.ServiceActivityBinding" />
+ <activity binding="org.jbpm.bpmn.flownodes.ReceiveBinding" />
+ <activity binding="org.jbpm.bpmn.flownodes.EndBinding" />
+ <activity binding="org.jbpm.bpmn.flownodes.DecisionBinding" />
</activities>
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskBinding.java 2009-07-27 18:29:46 UTC (rev 5349)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskBinding.java 2009-07-27 19:34:52 UTC (rev 5350)
@@ -21,7 +21,7 @@
*/
package org.jbpm.bpmn.flownodes;
-import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.bpmn.parser.BpmnParser;
import org.jbpm.pvm.internal.model.ScopeElementImpl;
import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
import org.jbpm.pvm.internal.xml.Parse;
@@ -43,7 +43,7 @@
TaskActivity taskActivity = new TaskActivity();
ScopeElementImpl scopeElement = parse.findObject(ScopeElementImpl.class);
- TaskDefinitionImpl taskDefinition = JpdlParser.parseTaskDefinition(element, parse, scopeElement);
+ TaskDefinitionImpl taskDefinition = BpmnParser.parseTaskDefinition(element, parse, scopeElement);
taskActivity.setTaskDefinition(taskDefinition);
return taskActivity;
Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BindingsParser.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BindingsParser.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BindingsParser.java 2009-07-27 19:34:52 UTC (rev 5350)
@@ -0,0 +1,69 @@
+/*
+ * 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.bpmn.parser;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.util.ReflectUtil;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.xml.Binding;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+/**
+ * @author Tom Baeyens
+ */
+public class BindingsParser extends Parser {
+
+ private static final Log log = Log.getLog(BindingsParser.class.getName());
+
+ public Object parseDocumentElement(Element documentElement, Parse parse) {
+ List<Binding> bindings = new ArrayList<Binding>();
+ parse.setDocumentObject(bindings);
+
+ for (Element bindingElement : XmlUtil.elements(documentElement)) {
+ Binding binding = instantiateBinding(bindingElement, parse);
+ bindings.add(binding);
+ }
+
+ return bindings;
+ }
+
+ protected Binding instantiateBinding(Element bindingElement, Parse parse) {
+ String bindingClassName = XmlUtil.attribute(bindingElement, "binding", true, parse);
+
+ log.trace("adding bpmn binding "+bindingClassName);
+
+ if (bindingClassName!=null) {
+ try {
+ Class<?> bindingClass = ReflectUtil.loadClass(classLoader, bindingClassName);
+ return (Binding) bindingClass.newInstance();
+ } catch (Exception e) {
+ parse.addProblem("couldn't instantiate activity binding "+bindingClassName, e);
+ }
+ }
+ return null;
+ }
+}
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java 2009-07-27 18:29:46 UTC (rev 5349)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java 2009-07-27 19:34:52 UTC (rev 5350)
@@ -27,9 +27,10 @@
import java.util.List;
import org.jbpm.api.activity.ActivityBehaviour;
+import org.jbpm.bpmn.flownodes.BpmnBinding;
import org.jbpm.bpmn.model.BpmnProcessDefinition;
import org.jbpm.internal.log.Log;
-import org.jbpm.jpdl.internal.activity.JpdlBinding;
+//import org.jbpm.jpdl.internal.activity.JpdlBinding;
import org.jbpm.jpdl.internal.xml.BindingsParser;
import org.jbpm.pvm.internal.model.ActivityImpl;
import org.jbpm.pvm.internal.model.CompositeElementImpl;
@@ -59,7 +60,7 @@
// array elements are mutable, even when final
// never make a static array public
- static final String[] DEFAULT_ACTIVITIES_RESOURCES = { "jbpm.bpmn.activities.xml" };
+ static final String[] DEFAULT_ACTIVITIES_RESOURCES = { "jbpm.bpmn.flownodes.xml" };
static final String CATEGORY_ACTIVITY = "activity";
static BindingsParser bindingsParser = new BindingsParser();
@@ -138,7 +139,7 @@
while (resourceUrls.hasMoreElements()) {
URL resourceUrl = resourceUrls.nextElement();
log.trace("loading bpmn activities from resource: " + resourceUrl);
- List<JpdlBinding> activityBindings = (List<JpdlBinding>) bindingsParser
+ List<BpmnBinding> activityBindings = (List<BpmnBinding>) bindingsParser
.createParse()
.setUrl(resourceUrl)
.execute()
@@ -210,7 +211,9 @@
String sourceRef = XmlUtil.attribute(transitionElement, "sourceRef", true, parse);
String targetRef = XmlUtil.attribute(transitionElement, "targetRef", true, parse);
- System.out.println(sourceRef + " -> " + targetRef);
+ System.out.println(transitionId + ": " + sourceRef + " -> " + targetRef);
+ System.out.println(" with " + XmlUtil.elements(transitionElement, "conditionExpression").size() + " conditionExpressions");
+
TransitionImpl transition = compositeElement.findActivity(sourceRef).createOutgoingTransition();
compositeElement.findActivity(targetRef).addIncomingTransition(transition);
15 years, 3 months
JBoss JBPM SVN: r5349 - jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-07-27 14:29:46 -0400 (Mon, 27 Jul 2009)
New Revision: 5349
Modified:
jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/command.sh
Log:
fix db2jcc version resolution
Modified: jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/command.sh
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/command.sh 2009-07-27 17:56:15 UTC (rev 5348)
+++ jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/command.sh 2009-07-27 18:29:46 UTC (rev 5349)
@@ -107,7 +107,7 @@
fi
# Install DB2 driver
-DB2JCC_VERSION=`grep com.ibm:db2jcc:jar:jar resolve.tmp | awk --field-separator : '{ print $4 }'`
+DB2JCC_VERSION=`grep com.ibm:db2jcc:jar resolve.tmp | awk --field-separator : '{ print $4 }'`
DB2JCC_JAR=~/.m2/repository/com/ibm/db2jcc/$DB2JCC_VERSION/db2jcc-$DB2JCC_VERSION.jar
if [ -f $DB2JCC_JAR ]; then
CP_CMD="cp $DB2JCC_JAR $JBOSS_HOME/server/$JBOSS_SERVER/deploy/jbpm/jbpm-service.sar"
15 years, 3 months
JBoss JBPM SVN: r5348 - jbpm4/trunk.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-07-27 13:56:15 -0400 (Mon, 27 Jul 2009)
New Revision: 5348
Modified:
jbpm4/trunk/pom.xml
Log:
Update to console 1.0.1-SNAPSHOT
Modified: jbpm4/trunk/pom.xml
===================================================================
--- jbpm4/trunk/pom.xml 2009-07-27 17:36:41 UTC (rev 5347)
+++ jbpm4/trunk/pom.xml 2009-07-27 17:56:15 UTC (rev 5348)
@@ -48,7 +48,7 @@
<apache.ant.version>1.7.0</apache.ant.version>
<cactus.version>13-1.7.1</cactus.version>
<freemarker.version>2.3.15</freemarker.version>
- <gwt.console.version>1.0.0-SNAPSHOT</gwt.console.version>
+ <gwt.console.version>1.0.1-SNAPSHOT</gwt.console.version>
<jbpm.gpd.version>4.0.0-SNAPSHOT</jbpm.gpd.version>
<hibernate.version>3.3.1.GA</hibernate.version>
<slf4j.version>1.5.2</slf4j.version>
15 years, 3 months
JBoss JBPM SVN: r5347 - in projects/gwt-console/trunk: gui and 10 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-07-27 13:36:41 -0400 (Mon, 27 Jul 2009)
New Revision: 5347
Modified:
projects/gwt-console/trunk/gui/pom.xml
projects/gwt-console/trunk/gui/profiles/drools/pom.xml
projects/gwt-console/trunk/gui/profiles/jbpm/pom.xml
projects/gwt-console/trunk/gui/profiles/pom.xml
projects/gwt-console/trunk/gui/war/pom.xml
projects/gwt-console/trunk/gui/workspace-api/pom.xml
projects/gwt-console/trunk/gui/workspace-example/pom.xml
projects/gwt-console/trunk/pom.xml
projects/gwt-console/trunk/rpc/pom.xml
projects/gwt-console/trunk/server/pom.xml
projects/gwt-console/trunk/server/server-core/pom.xml
projects/gwt-console/trunk/server/server-integration/pom.xml
Log:
Update version to 1.0.1-SNAPSHOT
Modified: projects/gwt-console/trunk/gui/pom.xml
===================================================================
--- projects/gwt-console/trunk/gui/pom.xml 2009-07-27 17:31:08 UTC (rev 5346)
+++ projects/gwt-console/trunk/gui/pom.xml 2009-07-27 17:36:41 UTC (rev 5347)
@@ -12,7 +12,7 @@
<parent>
<groupId>org.jboss.bpm</groupId>
<artifactId>gwt-console-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
Modified: projects/gwt-console/trunk/gui/profiles/drools/pom.xml
===================================================================
--- projects/gwt-console/trunk/gui/profiles/drools/pom.xml 2009-07-27 17:31:08 UTC (rev 5346)
+++ projects/gwt-console/trunk/gui/profiles/drools/pom.xml 2009-07-27 17:36:41 UTC (rev 5347)
@@ -12,7 +12,7 @@
<parent>
<groupId>org.jboss.bpm</groupId>
<artifactId>gwt-console-profiles</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
Modified: projects/gwt-console/trunk/gui/profiles/jbpm/pom.xml
===================================================================
--- projects/gwt-console/trunk/gui/profiles/jbpm/pom.xml 2009-07-27 17:31:08 UTC (rev 5346)
+++ projects/gwt-console/trunk/gui/profiles/jbpm/pom.xml 2009-07-27 17:36:41 UTC (rev 5347)
@@ -12,7 +12,7 @@
<parent>
<groupId>org.jboss.bpm</groupId>
<artifactId>gwt-console-profiles</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
Modified: projects/gwt-console/trunk/gui/profiles/pom.xml
===================================================================
--- projects/gwt-console/trunk/gui/profiles/pom.xml 2009-07-27 17:31:08 UTC (rev 5346)
+++ projects/gwt-console/trunk/gui/profiles/pom.xml 2009-07-27 17:36:41 UTC (rev 5347)
@@ -13,7 +13,7 @@
<parent>
<groupId>org.jboss.bpm</groupId>
<artifactId>gwt-console-guimodule</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
Modified: projects/gwt-console/trunk/gui/war/pom.xml
===================================================================
--- projects/gwt-console/trunk/gui/war/pom.xml 2009-07-27 17:31:08 UTC (rev 5346)
+++ projects/gwt-console/trunk/gui/war/pom.xml 2009-07-27 17:36:41 UTC (rev 5347)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.jboss.bpm</groupId>
<artifactId>gwt-console-guimodule</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
Modified: projects/gwt-console/trunk/gui/workspace-api/pom.xml
===================================================================
--- projects/gwt-console/trunk/gui/workspace-api/pom.xml 2009-07-27 17:31:08 UTC (rev 5346)
+++ projects/gwt-console/trunk/gui/workspace-api/pom.xml 2009-07-27 17:36:41 UTC (rev 5347)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.jboss.bpm</groupId>
<artifactId>gwt-console-guimodule</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
Modified: projects/gwt-console/trunk/gui/workspace-example/pom.xml
===================================================================
--- projects/gwt-console/trunk/gui/workspace-example/pom.xml 2009-07-27 17:31:08 UTC (rev 5346)
+++ projects/gwt-console/trunk/gui/workspace-example/pom.xml 2009-07-27 17:36:41 UTC (rev 5347)
@@ -4,14 +4,14 @@
<name>JBoss BPM Console - Mapsplugin</name>
<groupId>org.jboss.bpm.console</groupId>
<artifactId>mapsplugin</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<!-- Parent -->
<parent>
<groupId>org.jboss.bpm</groupId>
<artifactId>gwt-console-guimodule</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
Modified: projects/gwt-console/trunk/pom.xml
===================================================================
--- projects/gwt-console/trunk/pom.xml 2009-07-27 17:31:08 UTC (rev 5346)
+++ projects/gwt-console/trunk/pom.xml 2009-07-27 17:36:41 UTC (rev 5347)
@@ -4,7 +4,7 @@
<name>JBoss BPM - GWT Console</name>
<groupId>org.jboss.bpm</groupId>
<artifactId>gwt-console-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<!-- Parent -->
Modified: projects/gwt-console/trunk/rpc/pom.xml
===================================================================
--- projects/gwt-console/trunk/rpc/pom.xml 2009-07-27 17:31:08 UTC (rev 5346)
+++ projects/gwt-console/trunk/rpc/pom.xml 2009-07-27 17:36:41 UTC (rev 5347)
@@ -12,7 +12,7 @@
<parent>
<groupId>org.jboss.bpm</groupId>
<artifactId>gwt-console-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
Modified: projects/gwt-console/trunk/server/pom.xml
===================================================================
--- projects/gwt-console/trunk/server/pom.xml 2009-07-27 17:31:08 UTC (rev 5346)
+++ projects/gwt-console/trunk/server/pom.xml 2009-07-27 17:36:41 UTC (rev 5347)
@@ -12,7 +12,7 @@
<parent>
<groupId>org.jboss.bpm</groupId>
<artifactId>gwt-console-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
Modified: projects/gwt-console/trunk/server/server-core/pom.xml
===================================================================
--- projects/gwt-console/trunk/server/server-core/pom.xml 2009-07-27 17:31:08 UTC (rev 5346)
+++ projects/gwt-console/trunk/server/server-core/pom.xml 2009-07-27 17:36:41 UTC (rev 5347)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.jboss.bpm</groupId>
<artifactId>gwt-console-servermodule</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
Modified: projects/gwt-console/trunk/server/server-integration/pom.xml
===================================================================
--- projects/gwt-console/trunk/server/server-integration/pom.xml 2009-07-27 17:31:08 UTC (rev 5346)
+++ projects/gwt-console/trunk/server/server-integration/pom.xml 2009-07-27 17:36:41 UTC (rev 5347)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.jboss.bpm</groupId>
<artifactId>gwt-console-servermodule</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
15 years, 3 months
JBoss JBPM SVN: r5346 - in projects/gwt-console/trunk/server/server-core/src/main: webapp/WEB-INF and 1 other directory.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-07-27 13:31:08 -0400 (Mon, 27 Jul 2009)
New Revision: 5346
Modified:
projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/FormProcessingFacade.java
projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java
projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java
projects/gwt-console/trunk/server/server-core/src/main/webapp/WEB-INF/web.xml
Log:
Fix JBPM-2454: Resolve principal
Modified: projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/FormProcessingFacade.java
===================================================================
--- projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/FormProcessingFacade.java 2009-07-27 07:30:28 UTC (rev 5345)
+++ projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/FormProcessingFacade.java 2009-07-27 17:31:08 UTC (rev 5346)
@@ -150,7 +150,7 @@
Long.valueOf(taskId), // TODO: change to string id's
String.valueOf(processVars.get("outcome")), // actually a plugin implementation detail
processVars,
- request.getRemoteUser()
+ request.getUserPrincipal().getName()
);
return Response.ok("Successfully processed input").build();
Modified: projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java
===================================================================
--- projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java 2009-07-27 07:30:28 UTC (rev 5345)
+++ projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java 2009-07-27 17:31:08 UTC (rev 5346)
@@ -94,7 +94,7 @@
)
{
log.debug("Assign task " + taskId + " to '" + idRef +"'");
- getTaskManagement().assignTask(taskId, idRef, request.getRemoteUser());
+ getTaskManagement().assignTask(taskId, idRef, request.getUserPrincipal().getName());
return Response.ok().build();
}
@@ -109,7 +109,7 @@
)
{
log.debug("Release task " + taskId);
- getTaskManagement().assignTask(taskId, null, request.getRemoteUser());
+ getTaskManagement().assignTask(taskId, null, request.getUserPrincipal().getName());
return Response.ok().build();
}
@@ -124,7 +124,7 @@
)
{
log.debug("Close task " + taskId );
- getTaskManagement().completeTask(taskId, null, request.getRemoteUser());
+ getTaskManagement().completeTask(taskId, null, request.getUserPrincipal().getName());
return Response.ok().build();
}
@@ -141,7 +141,7 @@
)
{
log.debug("Close task " + taskId + " outcome " + outcome);
- getTaskManagement().completeTask(taskId, outcome, null, request.getRemoteUser());
+ getTaskManagement().completeTask(taskId, outcome, null, request.getUserPrincipal().getName());
return Response.ok().build();
}
Modified: projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java
===================================================================
--- projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java 2009-07-27 07:30:28 UTC (rev 5345)
+++ projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/UserMgmtFacade.java 2009-07-27 17:31:08 UTC (rev 5346)
@@ -80,7 +80,7 @@
if(null==roleCheck)
throw new WebApplicationException( new IllegalArgumentException("Missing parameter 'roleCheck'") );
- log.debug("Role check user: " + request.getRemoteUser() + ", actualRoles requested: " + roleCheck);
+ log.debug("Role check user: " + request.getUserPrincipal().getName() + ", actualRoles requested: " + roleCheck);
List<RoleAssignmentRef> actualRoles = new ArrayList<RoleAssignmentRef>();
Modified: projects/gwt-console/trunk/server/server-core/src/main/webapp/WEB-INF/web.xml
===================================================================
--- projects/gwt-console/trunk/server/server-core/src/main/webapp/WEB-INF/web.xml 2009-07-27 07:30:28 UTC (rev 5345)
+++ projects/gwt-console/trunk/server/server-core/src/main/webapp/WEB-INF/web.xml 2009-07-27 17:31:08 UTC (rev 5346)
@@ -51,7 +51,8 @@
<web-resource-collection>
<web-resource-name>Resteasy</web-resource-name>
<url-pattern>/rs/process/*</url-pattern>
- <!--url-pattern>/rs/task/*</url-pattern https://jira.jboss.org/jira/browse/JBPM-2229 -->
+ <url-pattern>/rs/task/*</url-pattern>
+ <!--url-pattern>/rs/form/*</url-pattern https://jira.jboss.org/jira/browse/JBPM-2229-->
<url-pattern>/rs/tasks/*</url-pattern>
<url-pattern>/rs/identity/*</url-pattern>
</web-resource-collection>
15 years, 3 months
JBoss JBPM SVN: r5345 - in jbpm4/trunk/modules/bpmn/src/main/java: org/jbpm/bpmn and 3 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-07-27 03:30:28 -0400 (Mon, 27 Jul 2009)
New Revision: 5345
Added:
jbpm4/trunk/modules/bpmn/src/main/java/jbpm.bpmn.flownodes.xml
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnAutomaticActivity.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnBinding.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnExternalActivity.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionBinding.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionConditionActivity.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/EndActivity.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/EndBinding.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ReceiveActivity.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ReceiveBinding.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ServiceActivity.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ServiceActivityBinding.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/StartActivity.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/StartBinding.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskActivity.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskBinding.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/model/
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/model/BpmnProcessDefinition.java
Removed:
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flowobjects/
Modified:
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java
Log:
merging bernds bpmn work
Added: jbpm4/trunk/modules/bpmn/src/main/java/jbpm.bpmn.flownodes.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/jbpm.bpmn.flownodes.xml (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/jbpm.bpmn.flownodes.xml 2009-07-27 07:30:28 UTC (rev 5345)
@@ -0,0 +1,8 @@
+<activities>
+ <activity binding="com.camunda.bpmn.activity.StartBinding" />
+ <activity binding="com.camunda.bpmn.activity.TaskBinding" />
+ <activity binding="com.camunda.bpmn.activity.ServiceActivityBinding" />
+ <activity binding="com.camunda.bpmn.activity.ReceiveBinding" />
+ <activity binding="com.camunda.bpmn.activity.EndBinding" />
+ <activity binding="com.camunda.bpmn.activity.DecisionBinding" />
+</activities>
Property changes on: jbpm4/trunk/modules/bpmn/src/main/java/jbpm.bpmn.flownodes.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java 2009-07-27 07:30:28 UTC (rev 5345)
@@ -0,0 +1,33 @@
+/*
+ * 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.bpmn.flownodes;
+
+import org.jbpm.api.activity.ActivityBehaviour;
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class BpmnActivity implements ActivityBehaviour {
+
+ private static final long serialVersionUID = 1L;
+
+}
Property changes on: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnAutomaticActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnAutomaticActivity.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnAutomaticActivity.java 2009-07-27 07:30:28 UTC (rev 5345)
@@ -0,0 +1,24 @@
+package org.jbpm.bpmn.flownodes;
+
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.listener.EventListener;
+import org.jbpm.api.listener.EventListenerExecution;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+
+
+public abstract class BpmnAutomaticActivity extends BpmnActivity implements EventListener {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) throws Exception {
+ ExecutionImpl executionImpl = (ExecutionImpl)execution;
+ perform(executionImpl);
+ executionImpl.historyAutomatic();
+ }
+
+ public void notify(EventListenerExecution execution) throws Exception {
+ perform((ExecutionImpl)execution);
+ }
+
+ abstract void perform(ExecutionImpl execution) throws Exception;
+}
Property changes on: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnAutomaticActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnBinding.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnBinding.java 2009-07-27 07:30:28 UTC (rev 5345)
@@ -0,0 +1,78 @@
+/*
+ * 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.bpmn.flownodes;
+
+import org.jbpm.pvm.internal.util.TagBinding;
+
+
+
+public abstract class BpmnBinding extends TagBinding {
+
+// protected static final WireParser wireParser = BpmnParser.wireParser;
+
+ public BpmnBinding(String tagName) {
+ super(tagName, "http://schema.omg.org/spec/BPMN/2.0", null);
+ }
+//
+// public void parseName(Element element, ActivityImpl activity, Parse parse) {
+// String name = XmlUtil.attribute(element, "name", isNameRequired(), parse);
+//
+// if (name!=null) {
+// // basic name validation
+// if ("".equals(name)) {
+// parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name, "is empty"), element);
+// } else if (name.indexOf('/')!=-1) {
+// parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name, "contains slash (/)"), element);
+// }
+// activity.setName(name);
+// }
+// }
+//
+// public boolean isNameRequired() {
+// return true;
+// }
+//
+// public void parseTransitions(Element element, ActivityImpl activity, Parse parse, JpdlParser jpdlParser) {
+// List<Element> transitionElements = XmlUtil.elements(element, "transition");
+// UnresolvedTransitions unresolvedTransitions = parse.findObject(UnresolvedTransitions.class);
+// for (Element transitionElement: transitionElements) {
+// String transitionName = XmlUtil.attribute(transitionElement, "name", false, parse);
+//
+// Element timerElement = XmlUtil.element(transitionElement, "timer");
+// if (timerElement!=null) {
+// if (transitionName!=null) {
+// TimerDefinitionImpl timerDefinitionImpl = jpdlParser.parseTimerDefinition(timerElement, parse, activity);
+// timerDefinitionImpl.setSignalName(transitionName);
+// } else {
+// parse.addProblem("a transition name is required when a timer is placed on a transition", element);
+// }
+// }
+//
+// TransitionImpl transition = activity.createOutgoingTransition();
+// transition.setName(transitionName);
+//
+// unresolvedTransitions.add(transition, transitionElement);
+//
+// jpdlParser.parseOnEvent(transitionElement, parse, transition, Event.TAKE);
+// }
+// }
+}
Property changes on: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnExternalActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnExternalActivity.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnExternalActivity.java 2009-07-27 07:30:28 UTC (rev 5345)
@@ -0,0 +1,9 @@
+package org.jbpm.bpmn.flownodes;
+
+import org.jbpm.api.activity.ExternalActivityBehaviour;
+
+public abstract class BpmnExternalActivity extends BpmnActivity implements ExternalActivityBehaviour {
+
+ private static final long serialVersionUID = 1L;
+
+}
Property changes on: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnExternalActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionBinding.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionBinding.java 2009-07-27 07:30:28 UTC (rev 5345)
@@ -0,0 +1,92 @@
+/*
+ * 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.bpmn.flownodes;
+
+import java.util.List;
+
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.TransitionImpl;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
+import org.jbpm.pvm.internal.wire.descriptor.ExpressionEvaluatorDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ReferenceDescriptor;
+import org.jbpm.pvm.internal.wire.xml.WireParser;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DecisionBinding extends BpmnBinding {
+
+ static ObjectBinding objectBinding = new ObjectBinding();
+ static WireParser wireParser = WireParser.getInstance();
+
+ public DecisionBinding() {
+ super("exclusiveGateway");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+
+ boolean hasConditions = false;
+ List<Element> transitionElements = XmlUtil.elements(element, "transition");
+ ActivityImpl activity = parse.findObject(ActivityImpl.class);
+ List<TransitionImpl> transitions = (List) activity.getOutgoingTransitions();
+
+ for (int i=0; i<transitionElements.size(); i++) {
+ TransitionImpl transition = transitions.get(i);
+ Element transitionElement = transitionElements.get(i);
+
+ Element conditionElement = XmlUtil.element(transitionElement, "condition");
+ if (conditionElement!=null) {
+ hasConditions = true;
+
+ if (conditionElement.hasAttribute("expr")) {
+ String expr = conditionElement.getAttribute("expr");
+ String lang = XmlUtil.attribute(conditionElement, "expr-lang");
+ ExpressionEvaluatorDescriptor expressionDescriptor = new ExpressionEvaluatorDescriptor(expr, lang);
+ transition.setConditionDescriptor(expressionDescriptor);
+
+ } else if (conditionElement.hasAttribute("ref")) {
+ String expr = conditionElement.getAttribute("ref");
+ ReferenceDescriptor refDescriptor = new ReferenceDescriptor(expr);
+ transition.setConditionDescriptor(refDescriptor);
+
+ } else if (ObjectBinding.isObjectDescriptor(conditionElement)) {
+ ObjectDescriptor conditionDescriptor = (ObjectDescriptor) objectBinding.parse(conditionElement, parse, parser);
+ transition.setConditionDescriptor(conditionDescriptor);
+ }
+ }
+ }
+
+ if (hasConditions) {
+ return new DecisionConditionActivity();
+ } else {
+ parse.addProblem("decision '"+element.getAttribute("name")+"' must have one of: expr attribute, handler attribute, handler element or condition expressions", element);
+ }
+
+ return null;
+ }
+}
Property changes on: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionConditionActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionConditionActivity.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionConditionActivity.java 2009-07-27 07:30:28 UTC (rev 5345)
@@ -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.bpmn.flownodes;
+
+import java.util.List;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.pvm.internal.model.Activity;
+import org.jbpm.pvm.internal.model.Condition;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.Transition;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DecisionConditionActivity extends BpmnActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) {
+ execute((ExecutionImpl)execution);
+ }
+ public void execute(ExecutionImpl execution) {
+ Transition transition = findTransition(execution);
+ if (transition==null) {
+ throw new JbpmException("no outgoing transition condition evaluated to true for decision "+execution.getActivity());
+ }
+ if (transition.getName()!=null) {
+ execution.historyDecision(transition.getName());
+ }
+ execution.take(transition);
+ }
+
+ private Transition findTransition(ExecutionImpl execution) {
+ Activity activity = execution.getActivity();
+ List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
+ for (Transition transition : outgoingTransitions) {
+ Condition condition = transition.getCondition();
+ if ( (condition==null)
+ || (condition.evaluate(execution))
+ ) {
+ return transition;
+ }
+ }
+ return null;
+ }
+}
Property changes on: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DecisionConditionActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/EndActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/EndActivity.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/EndActivity.java 2009-07-27 07:30:28 UTC (rev 5345)
@@ -0,0 +1,93 @@
+/*
+ * 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.bpmn.flownodes;
+
+import java.util.List;
+
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.model.OpenExecution;
+import org.jbpm.pvm.internal.model.Activity;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.Transition;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EndActivity extends BpmnActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected boolean endProcessInstance = true;
+ protected String state = null;
+
+ public void execute(ActivityExecution execution) {
+ execute((ExecutionImpl)execution);
+ }
+
+ public void execute(ExecutionImpl execution) {
+ Activity activity = execution.getActivity();
+ List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
+ ActivityImpl parentActivity = (ActivityImpl) activity.getParentActivity();
+
+ if ( (parentActivity!=null)
+ && ("group".equals(parentActivity.getType()))
+ ) {
+ // if the end activity itself has an outgoing transition
+ // (such end activities should be drawn on the border of the group)
+ if ( (outgoingTransitions!=null)
+ && (outgoingTransitions.size()==1)
+ ) {
+ Transition outgoingTransition = outgoingTransitions.get(0);
+ // taking the transition that goes over the group boundaries will
+ // destroy the scope automatically (see atomic operation TakeTransition)
+ execution.take(outgoingTransition);
+
+ } else {
+ execution.setActivity(parentActivity);
+ execution.signal();
+ }
+
+ } else {
+ OpenExecution executionToEnd = null;
+ if (endProcessInstance) {
+ executionToEnd = execution.getProcessInstance();
+ } else {
+ executionToEnd = execution;
+ }
+
+ if (state==null) {
+ execution.end(executionToEnd);
+ } else {
+ execution.end(executionToEnd, state);
+ }
+ }
+ }
+
+ public void setEndProcessInstance(boolean endProcessInstance) {
+ this.endProcessInstance = endProcessInstance;
+ }
+ public void setState(String state) {
+ this.state = state;
+ }
+}
Property changes on: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/EndActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/EndBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/EndBinding.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/EndBinding.java 2009-07-27 07:30:28 UTC (rev 5345)
@@ -0,0 +1,46 @@
+/*
+ * 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.bpmn.flownodes;
+
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EndBinding extends BpmnBinding {
+
+ public EndBinding() {
+ super("endEvent");
+ }
+
+ protected EndBinding(String tag) {
+ super(tag);
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ EndActivity endActivity = new EndActivity();
+ return endActivity;
+ }
+}
Property changes on: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/EndBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ReceiveActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ReceiveActivity.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ReceiveActivity.java 2009-07-27 07:30:28 UTC (rev 5345)
@@ -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.bpmn.flownodes;
+
+import java.util.Map;
+
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.pvm.internal.model.Activity;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.Transition;
+
+public class ReceiveActivity extends BpmnExternalActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) {
+ execute((ExecutionImpl)execution);
+ }
+ public void execute(ExecutionImpl execution) {
+ execution.historyActivityStart();
+
+ execution.waitForSignal();
+ }
+
+ public void signal(ActivityExecution execution, String signalName, Map<String, ?> parameters) {
+ signal((ExecutionImpl) execution, signalName, parameters);
+ }
+ public void signal(ExecutionImpl execution, String signalName, Map<String, ?> parameters) {
+ Activity activity = execution.getActivity();
+
+ if (parameters!=null) {
+ execution.setVariables(parameters);
+ }
+
+ execution.fire(signalName, activity);
+
+ Transition transition = null;
+ if ( (signalName==null)
+ && (activity.getOutgoingTransitions()!=null)
+ && (activity.getOutgoingTransitions().size()==1)
+ ) {
+ transition = activity.getOutgoingTransitions().get(0);
+ } else {
+ transition = activity.findOutgoingTransition(signalName);
+ }
+
+ if (transition!=null) {
+ execution.historyActivityEnd(signalName);
+ execution.take(transition);
+ } else {
+ execution.waitForSignal();
+ }
+ }
+}
Property changes on: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ReceiveActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ReceiveBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ReceiveBinding.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ReceiveBinding.java 2009-07-27 07:30:28 UTC (rev 5345)
@@ -0,0 +1,39 @@
+/*
+ * 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.bpmn.flownodes;
+
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+public class ReceiveBinding extends BpmnBinding {
+
+ public ReceiveBinding() {
+ super("receiveTask");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ return new ReceiveActivity();
+ }
+
+}
Property changes on: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ReceiveBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ServiceActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ServiceActivity.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ServiceActivity.java 2009-07-27 07:30:28 UTC (rev 5345)
@@ -0,0 +1,208 @@
+/*
+ * 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.bpmn.flownodes;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.wire.WireException;
+
+public class ServiceActivity extends BpmnAutomaticActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ public static class Data {
+ private String id;
+ private String xmlSchemaType;
+ }
+
+ public static class Assignment {
+ private String fromExpression;
+ private String toExpression;
+ }
+
+ // inputs
+ Data inputData = null; // more than one allowed in BPMN 2
+ List<Assignment> inputAssociation = new ArrayList<Assignment>();
+
+ // outputs
+ Data outputData = null; // more than one allowed in BPMN 2
+ List<Assignment> outputAssociation = new ArrayList<Assignment>();
+
+ // endpoint and binding
+ private String operation;
+ private String endpointAddress;
+ private String portName;
+ private String serviceName;
+
+ public void perform(ExecutionImpl execution) throws Exception {
+ try {
+ callWebservice();
+ } catch (Exception e) {
+ throw new WireException("couldn't invoke WS " + operation + ": " + e.getMessage(), e);
+ }
+ }
+
+ private void callWebservice() {
+ System.out.println("calling ws: " + getOperation());
+ // // Qnames for service as defined in wsdl.
+ // QName serviceName =
+ // new QName(getNamespace(), getServiceName());
+ //
+ // //QName for Port As defined in wsdl.
+ // QName portName =
+ // new QName(getNamespace(), getPort());
+ //
+ // //Endpoint Address
+ // String endpointAddress = getEndpointAdress();
+ //
+ // // Create a dynamic Service instance
+ // Service service = Service.create(serviceName);
+ //
+ // // Add a port to the Service
+ // service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
+ // endpointAddress);
+ //
+ // //Create a dispatch instance
+ // Dispatch<SOAPMessage> dispatch =
+ // service.createDispatch(portName, SOAPMessage.class,
+ // Service.Mode.MESSAGE);
+ //
+ // // Use Dispatch as BindingProvider
+ // BindingProvider bp = (BindingProvider) dispatch;
+ //
+ // // Optionally Configure RequestContext to send SOAPAction HTTP Header
+ // Map<String, Object> rc = bp.getRequestContext();
+ // rc.put(BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
+ // rc.put(BindingProvider.SOAPACTION_URI_PROPERTY, "hello");
+ //
+ // // Obtain a preconfigured SAAJ MessageFactory
+ // MessageFactory factory =
+ // ((SOAPBinding) bp.getBinding()).getMessageFactory();
+ //
+ // // Create SOAPMessage Request
+ // SOAPMessage request = factory.createMessage();
+ //
+ // // Request Header
+ // SOAPHeader header = request.getSOAPHeader();
+ //
+ // // Request Body
+ // SOAPBody body = request.getSOAPBody();
+ //
+ // // Compose the soap:Body payload
+ // QName payloadName =
+ // new QName("http://www.example.com/schemas/HelloWorld", "hello",
+ // "ns1");
+ //
+ // SOAPBodyElement payload = body.addBodyElement(payloadName);
+ //
+ // SOAPElement message = payload.addChildElement("message");
+ //
+ // message.addTextNode("Hello World!");
+ //
+ // // Invoke the endpoint synchronously
+ // SOAPMessage reply = null;
+ //
+ // try {
+ // //Invoke Endpoint Operation and read response
+ // reply = dispatch.invoke(request);
+ // } catch (WebServiceException wse){
+ // wse.printStackTrace();
+ // }
+ //
+ // // process the reply
+ // body = reply.getSOAPBody();
+ //
+ // QName responseName =
+ // new QName("http://www.example.com/schemas/HelloWorld",
+ // "helloResponse");
+ //
+ // SOAPBodyElement bodyElement =
+ // body.getChildElements(responseName).next());
+ // String message = bodyElement.getValue();
+ }
+
+ public Data getInputData() {
+ return inputData;
+ }
+
+ public void setInputData(Data inputData) {
+ this.inputData = inputData;
+ }
+
+ public List<Assignment> getInputAssociation() {
+ return inputAssociation;
+ }
+
+ public void setInputAssociation(List<Assignment> inputAssociation) {
+ this.inputAssociation = inputAssociation;
+ }
+
+ public Data getOutputData() {
+ return outputData;
+ }
+
+ public void setOutputData(Data outputData) {
+ this.outputData = outputData;
+ }
+
+ public List<Assignment> getOutputAssociation() {
+ return outputAssociation;
+ }
+
+ public void setOutputAssociation(List<Assignment> outputAssociation) {
+ this.outputAssociation = outputAssociation;
+ }
+
+ public String getOperation() {
+ return operation;
+ }
+
+ public void setOperation(String operation) {
+ this.operation = operation;
+ }
+
+ public String getEndpointAddress() {
+ return endpointAddress;
+ }
+
+ public void setEndpointAddress(String endpointAddress) {
+ this.endpointAddress = endpointAddress;
+ }
+
+ public String getPortName() {
+ return portName;
+ }
+
+ public void setPortName(String portName) {
+ this.portName = portName;
+ }
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+}
Property changes on: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ServiceActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ServiceActivityBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ServiceActivityBinding.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ServiceActivityBinding.java 2009-07-27 07:30:28 UTC (rev 5345)
@@ -0,0 +1,69 @@
+/*
+ * 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.bpmn.flownodes;
+
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+public class ServiceActivityBinding extends BpmnBinding {
+
+
+ public ServiceActivityBinding() {
+ super("serviceTask");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ ServiceActivity wsActivity = new ServiceActivity();
+
+ String methodName = XmlUtil.attribute(element, "operationRef", true, parse, null);
+// javaActivity.setMethodName(methodName);
+
+ String variableName = XmlUtil.attribute(element, "var");
+// javaActivity.setVariableName(variableName);
+
+// List<Element> argElements = XmlUtil.elements(element, "arg");
+// if (!argElements.isEmpty()) {
+// List<ArgDescriptor> argDescriptors = wireParser.parseArgs(argElements, parse);
+// InvokeOperation invokeOperation = new InvokeOperation();
+// invokeOperation.setArgDescriptors(argDescriptors);
+// javaActivity.setInvokeOperation(invokeOperation);
+// }
+//
+// if (element.hasAttribute("class")) {
+// ObjectDescriptor objectDescriptor = JpdlParser.parseObjectDescriptor(element, parse);
+// javaActivity.setTargetDescriptor(objectDescriptor);
+//
+// } else if (element.hasAttribute("expr")) {
+// String expression = element.getAttribute("expr");
+// javaActivity.setTargetExpression(expression);
+// javaActivity.setTargetLanguage(XmlUtil.attribute(element, "lang"));
+//
+// } else {
+// // parse.addProblem("no target specified in "+TAG+": must specify attribute 'class' or 'expr'", element);
+// }
+
+ return wsActivity;
+ }
+}
Property changes on: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ServiceActivityBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/StartActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/StartActivity.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/StartActivity.java 2009-07-27 07:30:28 UTC (rev 5345)
@@ -0,0 +1,33 @@
+/*
+ * 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.bpmn.flownodes;
+
+import org.jbpm.api.activity.ActivityExecution;
+
+
+public class StartActivity extends BpmnActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) {
+ }
+}
Property changes on: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/StartActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/StartBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/StartBinding.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/StartBinding.java 2009-07-27 07:30:28 UTC (rev 5345)
@@ -0,0 +1,55 @@
+/*
+ * 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.bpmn.flownodes;
+
+import org.jbpm.bpmn.model.BpmnProcessDefinition;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+
+public class StartBinding extends BpmnBinding {
+
+ public StartBinding() {
+ super("startEvent");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ ActivityImpl startActivity = parse.findObject(ActivityImpl.class);
+ BpmnProcessDefinition processDefinition = parse.findObject(BpmnProcessDefinition.class);
+
+ if (processDefinition.getInitial()==null) {
+ processDefinition.setInitial(startActivity);
+
+ } else if (startActivity.getParentActivity()==null) {
+ parse.addProblem("multiple start events not yet supported", element);
+ }
+
+ return new StartActivity();
+ }
+
+ public boolean isNameRequired() {
+ return false;
+ }
+}
Property changes on: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/StartBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskActivity.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskActivity.java 2009-07-27 07:30:28 UTC (rev 5345)
@@ -0,0 +1,151 @@
+/*
+ * 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.bpmn.flownodes;
+
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.task.Task;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.HistoryEvent;
+import org.jbpm.pvm.internal.history.events.TaskActivityStart;
+import org.jbpm.pvm.internal.model.Activity;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.Transition;
+import org.jbpm.pvm.internal.session.DbSession;
+import org.jbpm.pvm.internal.task.ParticipationImpl;
+import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
+import org.jbpm.pvm.internal.task.SwimlaneImpl;
+import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
+import org.jbpm.pvm.internal.task.TaskImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskActivity extends BpmnExternalActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final Log log = Log.getLog(TaskActivity.class.getName());
+
+ protected TaskDefinitionImpl taskDefinition;
+
+ public void execute(ActivityExecution execution) {
+ execute((ExecutionImpl)execution);
+ }
+
+ public void execute(ExecutionImpl execution) {
+ DbSession dbSession = Environment.getFromCurrent(DbSession.class);
+ TaskImpl task = (TaskImpl) dbSession.createTask();
+ task.setTaskDefinition(taskDefinition);
+ task.setExecution(execution);
+ task.setProcessInstance(execution.getProcessInstance());
+ task.setSignalling(true);
+
+ // initialize the name
+ if (taskDefinition.getName()!=null) {
+ task.setName(taskDefinition.getName());
+ } else {
+ task.setName(execution.getActivityName());
+ }
+
+ task.setDescription(taskDefinition.getDescription());
+ task.setPriority(taskDefinition.getPriority());
+ task.setFormResourceName(taskDefinition.getFormResourceName());
+
+ // save task so that TaskDbSession.findTaskByExecution works for assign event listeners
+ dbSession.save(task);
+
+ SwimlaneDefinitionImpl swimlaneDefinition = taskDefinition.getSwimlaneDefinition();
+ if (swimlaneDefinition!=null) {
+ SwimlaneImpl swimlane = execution.getInitializedSwimlane(swimlaneDefinition);
+ task.setSwimlane(swimlane);
+
+ // copy the swimlane assignments to the task
+ task.setAssignee(swimlane.getAssignee());
+ for (ParticipationImpl participant: swimlane.getParticipations()) {
+ task.addParticipation(participant.getUserId(), participant.getGroupId(), participant.getType());
+ }
+ }
+
+ execution.initializeAssignments(taskDefinition, task);
+
+ HistoryEvent.fire(new TaskActivityStart(task), execution);
+
+ execution.waitForSignal();
+ }
+
+ public void signal(ActivityExecution execution, String signalName, Map<String, ?> parameters) throws Exception {
+ signal((ExecutionImpl)execution, signalName, parameters);
+ }
+
+ public void signal(ExecutionImpl execution, String signalName, Map<String, ?> parameters) throws Exception {
+ Activity activity = execution.getActivity();
+
+ if (parameters!=null) {
+ execution.setVariables(parameters);
+ }
+
+ execution.fire(signalName, activity);
+
+ DbSession taskDbSession = Environment
+ .getFromCurrent(DbSession.class);
+ TaskImpl task = (TaskImpl) taskDbSession.findTaskByExecution(execution);
+ task.setSignalling(false);
+
+ Transition transition = null;
+ List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
+ if ( (outgoingTransitions!=null)
+ && (!outgoingTransitions.isEmpty())
+ ) {
+ transition = activity.findOutgoingTransition(signalName);
+ if (transition==null) {
+ if (Task.STATE_COMPLETED.equals(signalName)) {
+ if (outgoingTransitions.size()==1) {
+ transition = outgoingTransitions.get(0);
+ } else {
+ transition = activity.getDefaultOutgoingTransition();
+ }
+ } else {
+ // if a user specified outcome was provided and it doesn't
+ // match with an outgoing transition name, then an exception is
+ // thrown since this is likely a programmatic error.
+ throw new JbpmException("No outcome named '" + signalName + "' was found.");
+ }
+ }
+ if (transition!=null) {
+ execution.take(transition);
+ }
+ }
+ }
+
+ public TaskDefinitionImpl getTaskDefinition() {
+ return taskDefinition;
+ }
+ public void setTaskDefinition(TaskDefinitionImpl taskDefinition) {
+ this.taskDefinition = taskDefinition;
+ }
+}
Property changes on: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskBinding.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskBinding.java 2009-07-27 07:30:28 UTC (rev 5345)
@@ -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.bpmn.flownodes;
+
+import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.pvm.internal.model.ScopeElementImpl;
+import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskBinding extends BpmnBinding {
+
+ private static final String TAG = "userTask";
+
+ public TaskBinding() {
+ super(TAG);
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ TaskActivity taskActivity = new TaskActivity();
+
+ ScopeElementImpl scopeElement = parse.findObject(ScopeElementImpl.class);
+ TaskDefinitionImpl taskDefinition = JpdlParser.parseTaskDefinition(element, parse, scopeElement);
+ taskActivity.setTaskDefinition(taskDefinition);
+
+ return taskActivity;
+ }
+}
Property changes on: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/model/BpmnProcessDefinition.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/model/BpmnProcessDefinition.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/model/BpmnProcessDefinition.java 2009-07-27 07:30:28 UTC (rev 5345)
@@ -0,0 +1,71 @@
+/*
+ * 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.bpmn.model;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.model.VariableDefinitionImpl;
+import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
+import org.w3c.dom.Element;
+
+public class BpmnProcessDefinition extends ProcessDefinitionImpl {
+
+ private static final long serialVersionUID = 1L;
+
+ Map<String, TaskDefinitionImpl> taskDefinitions = new HashMap<String, TaskDefinitionImpl>();
+ List<VariableDefinitionImpl> processVariableDefinitions = new ArrayList<VariableDefinitionImpl>();
+ Map<String, Element> messages = new HashMap<String, Element>();
+ Map<String, String> itemDefinitions = new HashMap<String, String>();
+ Map<String, Element> interfaces = new HashMap<String, Element>();
+ Map<String, String> resources = new HashMap<String, String>();
+
+ protected ExecutionImpl newProcessInstance() {
+ return new ExecutionImpl();
+ }
+
+ public TaskDefinitionImpl createTaskDefinition(String name) {
+ TaskDefinitionImpl taskDefinition = new TaskDefinitionImpl();
+ taskDefinitions.put(name, taskDefinition);
+ return taskDefinition;
+ }
+
+ public Map<String, TaskDefinitionImpl> getTaskDefinitions() {
+ return taskDefinitions;
+ }
+
+ public String getType(String typeRef) {
+ return itemDefinitions.get(typeRef);
+ }
+
+ public void setVariableDefinition(List<VariableDefinitionImpl> variableDefinitions) {
+ this.processVariableDefinitions = variableDefinitions;
+ }
+
+ public String getResource(String ref) {
+ return resources.get(ref);
+ }
+}
Property changes on: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/model/BpmnProcessDefinition.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java 2009-07-24 06:17:41 UTC (rev 5344)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java 2009-07-27 07:30:28 UTC (rev 5345)
@@ -21,14 +21,28 @@
*/
package org.jbpm.bpmn.parser;
+import java.net.URL;
import java.util.ArrayList;
+import java.util.Enumeration;
import java.util.List;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.SAXParserFactory;
-
+import org.jbpm.api.activity.ActivityBehaviour;
+import org.jbpm.bpmn.model.BpmnProcessDefinition;
+import org.jbpm.internal.log.Log;
+import org.jbpm.jpdl.internal.activity.JpdlBinding;
+import org.jbpm.jpdl.internal.xml.BindingsParser;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.CompositeElementImpl;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.model.ScopeElementImpl;
+import org.jbpm.pvm.internal.model.TransitionImpl;
+import org.jbpm.pvm.internal.model.VariableDefinitionImpl;
+import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
+import org.jbpm.pvm.internal.util.ReflectUtil;
+import org.jbpm.pvm.internal.util.TagBinding;
import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.xml.WireParser;
+import org.jbpm.pvm.internal.xml.Bindings;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
@@ -39,20 +53,42 @@
*/
public class BpmnParser extends Parser {
+ private static final Log log = Log.getLog(BpmnParser.class.getName());
+
+ public static final WireParser wireParser = WireParser.getInstance();
+
+ // array elements are mutable, even when final
+ // never make a static array public
+ static final String[] DEFAULT_ACTIVITIES_RESOURCES = { "jbpm.bpmn.activities.xml" };
+ static final String CATEGORY_ACTIVITY = "activity";
+
+ static BindingsParser bindingsParser = new BindingsParser();
+
+ public BpmnParser() {
+ initialize();
+ parseBindings();
+ List<String> schemaResources = new ArrayList<String>();
+ schemaResources.add("BPMN20.xsd");
+ // schemaResources.add("Semantic.xsd");
+ setSchemaResources(schemaResources);
+ }
+
+
public Object parseDocumentElement(Element documentElement, Parse parse) {
List<ProcessDefinitionImpl> processDefinitions = new ArrayList<ProcessDefinitionImpl>();
+
+ parseDefinition(documentElement, parse);
+
for (Element processElement: XmlUtil.elements(documentElement, "process")) {
ProcessDefinitionImpl processDefinition = parseProcess(processElement, parse);
processDefinitions.add(processDefinition);
}
- // TODO unify document object of JpdlParser with BpmnParser so that ProcessDeployer can be refactored accordingly
-
return processDefinitions;
}
public ProcessDefinitionImpl parseProcess(Element processElement, Parse parse) {
- ProcessDefinitionImpl processDefinition = new ProcessDefinitionImpl();
+ BpmnProcessDefinition processDefinition = new BpmnProcessDefinition();
parse.pushObject(processDefinition);
try {
@@ -60,9 +96,25 @@
// process attribues
String name = XmlUtil.attribute(processElement, "name", true, parse);
processDefinition.setName(name);
-
- // TODO finish rest of parsing
+ String key = XmlUtil.attribute(processElement, "id", false, parse);
+ if (key != null) {
+ processDefinition.setKey(key);
+ }
+
+ Element descriptionElement = XmlUtil.element(processElement, "documentation");
+ if (descriptionElement != null) {
+ String description = XmlUtil.getContentText(descriptionElement);
+ processDefinition.setDescription(description);
+ }
+
+ parseDataObjects(processElement, parse, processDefinition);
+
+ // activities
+ parseActivities(processElement, parse, processDefinition);
+
+ // bind activities to their destinations
+ parseTransitions(processElement, parse, processDefinition);
} finally {
parse.popObject();
@@ -70,4 +122,192 @@
return processDefinition;
}
+
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+
+
+
+ protected void parseBindings() {
+ Bindings bindings = new Bindings();
+ setBindings(bindings);
+
+ for (String activityResource : DEFAULT_ACTIVITIES_RESOURCES) {
+ Enumeration<URL> resourceUrls = ReflectUtil.getResources(null, activityResource);
+ if (resourceUrls.hasMoreElements()) {
+ while (resourceUrls.hasMoreElements()) {
+ URL resourceUrl = resourceUrls.nextElement();
+ log.trace("loading bpmn activities from resource: " + resourceUrl);
+ List<JpdlBinding> activityBindings = (List<JpdlBinding>) bindingsParser
+ .createParse()
+ .setUrl(resourceUrl)
+ .execute()
+ .checkErrors("bpmn activities from " + resourceUrl.toString())
+ .getDocumentObject();
+
+ for (TagBinding binding : activityBindings) {
+ binding.setCategory(CATEGORY_ACTIVITY);
+ bindings.addBinding(binding);
+ }
+ }
+ } else {
+ log.trace("skipping unavailable jpdl activities resource: " + activityResource);
+ }
+ }
+ }
+
+ private void parseDataObjects(Element element, Parse parse, BpmnProcessDefinition processDefinition) {
+ List<VariableDefinitionImpl> variableDefinitions = new ArrayList<VariableDefinitionImpl>();
+
+ for (Element dataElement : XmlUtil.elements(element, "dataObject")) {
+ VariableDefinitionImpl variableDefinition = new VariableDefinitionImpl();
+
+ String name = XmlUtil.attribute(dataElement, "id", true, parse);
+ variableDefinition.setName(name);
+
+ String typeRef = XmlUtil.attribute(dataElement, "itemSubjectRef");
+ variableDefinition.setTypeName(processDefinition.getType(typeRef));
+
+ variableDefinitions.add(variableDefinition);
+ }
+
+ processDefinition.setVariableDefinition(variableDefinitions);
+ }
+
+ public void parseActivities(Element element, Parse parse, CompositeElementImpl compositeElement) {
+ List<Element> elements = XmlUtil.elements(element);
+ for (Element nestedElement : elements) {
+ String tagName = XmlUtil.getTagLocalName(nestedElement);
+ String name = XmlUtil.attribute(nestedElement, "name", false, parse);
+ String id = XmlUtil.attribute(nestedElement, "id", true, parse);
+
+ TagBinding activityBinding = (TagBinding) getBinding(nestedElement, CATEGORY_ACTIVITY);
+ if (activityBinding == null) {
+ log.debug("unrecognized activity: " + tagName);
+ continue;
+ }
+
+ ActivityImpl activity = compositeElement.createActivity();
+ parse.pushObject(activity);
+ try {
+ activity.setType(activityBinding.getTagName());
+ activity.setName(id);
+ activity.setDescription(name);
+
+ ActivityBehaviour activityBehaviour = (ActivityBehaviour) activityBinding.parse(nestedElement, parse, this);
+ activity.setBehaviour(activityBehaviour);
+ } finally {
+ parse.popObject();
+ }
+ }
+ }
+
+ public void parseTransitions(Element element, Parse parse, CompositeElementImpl compositeElement) {
+ List<Element> transitionElements = XmlUtil.elements(element, "sequenceFlow");
+ for (Element transitionElement : transitionElements) {
+ String transitionName = XmlUtil.attribute(transitionElement, "name", false, parse);
+ String transitionId = XmlUtil.attribute(transitionElement, "id", true, parse);
+ String sourceRef = XmlUtil.attribute(transitionElement, "sourceRef", true, parse);
+ String targetRef = XmlUtil.attribute(transitionElement, "targetRef", true, parse);
+
+ System.out.println(sourceRef + " -> " + targetRef);
+ TransitionImpl transition = compositeElement.findActivity(sourceRef).createOutgoingTransition();
+ compositeElement.findActivity(targetRef).addIncomingTransition(transition);
+
+ transition.setName(transitionName);
+ transition.setDescription(transitionId);
+ }
+ }
+
+ public void parseDefinition(Element documentElement, Parse parse) {
+ parseImports(documentElement, parse);
+ parseItemDefinitions(documentElement, parse);
+ parseMessages(documentElement, parse);
+ parseInterfaces(documentElement, parse);
+ parseResources(documentElement, parse);
+ }
+
+ // public static void parseAssignmentAttributes(Element element,
+ // AssignableDefinitionImpl assignableDefinition, Parse parse) {
+ // Element descriptionElement = XmlUtil.element(element, "description");
+ // if (descriptionElement!=null) {
+ // String description = XmlUtil.getContentText(descriptionElement);
+ // assignableDefinition.setDescription(description);
+ // }
+ //
+ // Element assignmentHandlerElement = XmlUtil.element(element,
+ // "assignment-handler");
+ // if (assignmentHandlerElement!=null) {
+ // ObjectDescriptor objectDescriptor =
+ // parseObjectDescriptor(assignmentHandlerElement, parse);
+ // assignableDefinition.setAssignmentHandlerDescriptor(objectDescriptor);
+ // }
+ //
+ // String assigneeExpression = XmlUtil.attribute(element, "assignee");
+ // assignableDefinition.setAssigneeExpression(assigneeExpression);
+ //
+ // String assigneeExpressionLanguage = XmlUtil.attribute(element,
+ // "assignee-lang");
+ // assignableDefinition.setAssigneeExpressionLanguage(assigneeExpressionLanguage);
+ //
+ // String candidateUsersExpression = XmlUtil.attribute(element,
+ // "candidate-users");
+ // assignableDefinition.setCandidateUsersExpression(candidateUsersExpression);
+ //
+ // String candidateUsersExpressionLanguage = XmlUtil.attribute(element,
+ // "candidate-users-lang");
+ // assignableDefinition.setCandidateUsersExpressionLanguage(candidateUsersExpressionLanguage);
+ //
+ // String candidateGroupsExpression = XmlUtil.attribute(element,
+ // "candidate-groups");
+ // assignableDefinition.setCandidateGroupsExpression(candidateGroupsExpression);
+ //
+ // String candidateGroupsExpressionLanguage = XmlUtil.attribute(element,
+ // "candidate-groups-lang");
+ // assignableDefinition.setCandidateGroupsExpressionLanguage(candidateGroupsExpressionLanguage);
+ // }
+
+ public static TaskDefinitionImpl parseTaskDefinition(Element element, Parse parse, ScopeElementImpl scopeElement) {
+ TaskDefinitionImpl taskDefinition = new TaskDefinitionImpl();
+
+ String taskName = XmlUtil.attribute(element, "name");
+ taskDefinition.setName(taskName);
+
+ // String form = XmlUtil.attribute(element, "form");
+ // taskDefinition.setForm(form);
+
+ BpmnProcessDefinition processDefinition = parse.findObject(BpmnProcessDefinition.class);
+ if (processDefinition.getTaskDefinition(taskName) != null) {
+ parse.addProblem("duplicate task name " + taskName, element);
+ } else {
+ processDefinition.addTaskDefinitionImpl(taskDefinition);
+ }
+
+ Element potentialOwner = XmlUtil.element(element, "potentialOwner");
+ String potentialOwnerRef = XmlUtil.attribute(potentialOwner, "resourceRef");
+ // set to fixed expression, more evaluation needed for real BPMN 2.0
+ taskDefinition.setCandidateGroupsExpression(processDefinition.getResource(potentialOwnerRef));
+ return taskDefinition;
+ }
+
+ private void parseResources(Element documentElement, Parse parse) {
+
+ }
+
+ private void parseInterfaces(Element documentElement, Parse parse) {
+
+ }
+
+ private void parseMessages(Element documentElement, Parse parse) {
+
+ }
+
+ private void parseItemDefinitions(Element documentElement, Parse parse) {
+
+ }
+
+ private void parseImports(Element documentElement, Parse parse) {
+
+ }
+
}
15 years, 3 months