[jbpm-commits] JBoss JBPM SVN: r5677 - in jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal: parser and 3 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Oct 1 16:56:20 EDT 2009
Author: tom.baeyens at jboss.com
Date: 2009-10-01 16:56:19 -0400 (Thu, 01 Oct 2009)
New Revision: 5677
Added:
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionHandlerActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/CustomActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionBuilder.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionConditionActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionExpressionActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionHandlerActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/EndActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/EndBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ForkActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/GroupActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/HqlActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JavaActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JoinActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlAutomaticActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlExternalActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailListener.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ScriptActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SqlActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StartActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StateActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessInParameterImpl.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessOutParameterImpl.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessParameterImpl.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/TaskActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/CustomBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/DecisionBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndCancelBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndErrorBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EventListenerBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ForkBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/GroupBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/HqlBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JavaBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JoinBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JpdlBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/MailBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ScriptBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SqlBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StartBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StateBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SubProcessBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/TaskBinding.java
Removed:
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/CustomActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionConditionActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionExpressionActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionHandlerActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/EndActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ForkActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/GroupActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/HqlActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JavaActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JoinActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlAutomaticActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlExternalActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailListener.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ScriptActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SqlActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StartActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StateActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/TaskActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/CustomBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/DecisionBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndCancelBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndErrorBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EventListenerBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ForkBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/GroupBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/HqlBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JavaBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JoinBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JpdlBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/MailBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ScriptBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SqlBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StartBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StateBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SubProcessBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/TaskBinding.java
Modified:
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlParser.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/JpdlParserV40.java
Log:
restoring original jpdl 4.1 parser
Copied: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionHandlerActivity.java (from rev 5676, jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionHandlerActivity.java)
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionHandlerActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionHandlerActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,105 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.ProcessDefinition;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.jpdl.DecisionHandler;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.model.Activity;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.model.Transition;
+import org.jbpm.pvm.internal.util.ReflectUtil;
+import org.jbpm.pvm.internal.wire.Descriptor;
+
+/**
+ * @author Tom Baeyens
+ */
+public class DecisionHandlerActivity extends JpdlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String decisionHandlerName;
+ protected Descriptor decisionHandlerDescriptor;
+ protected DecisionHandler decisionHandler;
+
+ public void execute(ActivityExecution execution) {
+ execute((ExecutionImpl) execution);
+ }
+
+ public void execute(ExecutionImpl execution) {
+ Activity activity = execution.getActivity();
+
+ String transitionName = null;
+
+ DecisionHandler usedDecisionHandler = null;
+ if (decisionHandlerDescriptor!=null) {
+
+ usedDecisionHandler = getDecisionHandler(activity.getProcessDefinition());
+
+ } else if (decisionHandlerName!=null) {
+ EnvironmentImpl environment = EnvironmentImpl.getCurrent();
+ Object object = environment.get(decisionHandlerName);
+ if (object==null) {
+ throw new JbpmException("decision handler for "+activity+" is null");
+ }
+ if (! (object instanceof DecisionHandler)) {
+ throw new JbpmException("handler for decision is not a "+DecisionHandler.class.getName()+": "+object.getClass().getName());
+ }
+ usedDecisionHandler = (DecisionHandler) object;
+ } else {
+ throw new JbpmException("no decision handler specified");
+ }
+
+ transitionName = usedDecisionHandler.decide(execution);
+
+ Transition transition = activity.getOutgoingTransition(transitionName);
+ if (transition==null) {
+ throw new JbpmException("handler in decision '"+activity.getName()+"' returned unexisting outgoing transition name: "+transitionName);
+ }
+
+ execution.historyDecision(transitionName);
+
+ execution.take(transition);
+ }
+
+ public synchronized DecisionHandler getDecisionHandler(ProcessDefinition processDefinition) {
+ if ( (decisionHandlerDescriptor!=null)
+ && (decisionHandler==null)
+ ) {
+ decisionHandler = (DecisionHandler) ReflectUtil.instantiateUserCode(decisionHandlerDescriptor, (ProcessDefinitionImpl) processDefinition);
+ }
+ return decisionHandler;
+ }
+
+ public void setDecisionHandlerName(String decisionHandlerName) {
+ this.decisionHandlerName = decisionHandlerName;
+ }
+ public void setDecisionHandler(DecisionHandler decisionHandler) {
+ this.decisionHandler = decisionHandler;
+ }
+ public void setDecisionHandlerDescriptor(Descriptor decisionHandlerDescriptor) {
+ this.decisionHandlerDescriptor = decisionHandlerDescriptor;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionHandlerActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java (from rev 5676, jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JavaActivity.java)
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,118 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.model.OpenExecution;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.script.ScriptManager;
+import org.jbpm.pvm.internal.util.ReflectUtil;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.WireException;
+import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.wire.operation.InvokeOperation;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JavaActivity extends JpdlAutomaticActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String targetExpression;
+ protected String targetLanguage;
+ protected Object target;
+
+ protected String methodName;
+ protected String variableName;
+ protected InvokeOperation invokeOperation;
+
+ public void perform(OpenExecution execution) throws Exception {
+
+ Object invocationTarget = null;
+
+ WireContext wireContext = new WireContext();
+
+ if (target!=null) {
+ invocationTarget = target;
+
+ } else if (targetExpression!=null) {
+ ScriptManager scriptManager = ScriptManager.getScriptManager();
+ invocationTarget = scriptManager.evaluateExpression(targetExpression, targetLanguage);
+
+ } else {
+ throw new JbpmException("no target specified");
+ }
+
+ try {
+ List<ArgDescriptor> argDescriptors = null;
+ Object[] args = null;
+ if (invokeOperation!=null) {
+ argDescriptors = invokeOperation.getArgDescriptors();
+ args = ObjectDescriptor.getArgs(wireContext, argDescriptors);
+ }
+
+ Class<?> clazz = invocationTarget.getClass();
+ Method method = ReflectUtil.findMethod(clazz, methodName, argDescriptors, args);
+ if (method==null) {
+ throw new WireException("method "+ReflectUtil.getSignature(methodName, argDescriptors, args)+" unavailable");
+ }
+
+ Object returnValue = ReflectUtil.invoke(method, invocationTarget, args);
+
+ if (variableName!=null) {
+ execution.setVariable(variableName, returnValue);
+ }
+
+ } catch (WireException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new WireException("couldn't invoke method "+methodName+": "+e.getMessage(), e);
+ }
+ }
+
+ public void setTarget(Object target) {
+ this.target = target;
+ }
+ public void setMethodName(String methodName) {
+ this.methodName = methodName;
+ }
+ public void setVariableName(String variableName) {
+ this.variableName = variableName;
+ }
+ public void setInvokeOperation(InvokeOperation invokeOperation) {
+ this.invokeOperation = invokeOperation;
+ }
+ public void setTargetExpression(String expression) {
+ this.targetExpression = expression;
+ }
+ public void setTargetLanguage(String language) {
+ this.targetLanguage = language;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,40 +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.jpdl.internal.parser;
-
-
-import org.jbpm.pvm.internal.util.TagBinding;
-
-
-/**
- * @author Tom Baeyens
- */
-public abstract class JpdlBinding extends TagBinding {
-
- public JpdlBinding(String tagName) {
- super(tagName, null, null);
- }
-
- public boolean isNameRequired() {
- return true;
- }
-}
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlParser.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlParser.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlParser.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -74,6 +74,13 @@
if (jpdlParserVersion==null) {
throw new JbpmException("no jPDL parser for namespace "+namespace);
}
- return jpdlParserVersion.parseDocumentElement(documentElement, parse);
+ parse.pushObject(this);
+ parse.pushObject(jpdlParserVersion);
+ try {
+ return jpdlParserVersion.parseDocumentElement(documentElement, parse);
+ } finally {
+ parse.popObject();
+ parse.popObject();
+ }
}
}
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/JpdlParserV40.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/JpdlParserV40.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/JpdlParserV40.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -21,6 +21,7 @@
*/
package org.jbpm.jpdl.internal.v40;
+import java.io.IOException;
import java.net.URL;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@@ -35,17 +36,15 @@
import org.jbpm.api.activity.ActivityBehaviour;
import org.jbpm.api.listener.EventListener;
import org.jbpm.api.model.Event;
-import org.jbpm.api.task.AssignmentHandler;
import org.jbpm.internal.log.Log;
import org.jbpm.jpdl.internal.activity.MailListener;
import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
-import org.jbpm.jpdl.internal.parser.JpdlBinding;
import org.jbpm.jpdl.internal.parser.JpdlBindingsParser;
import org.jbpm.jpdl.internal.parser.JpdlParser;
import org.jbpm.jpdl.internal.parser.JpdlParserVersion;
import org.jbpm.jpdl.internal.parser.UnresolvedTransition;
import org.jbpm.jpdl.internal.parser.UnresolvedTransitions;
-import org.jbpm.jpdl.internal.xml.BindingsParser;
+import org.jbpm.jpdl.internal.v40.bindings.JpdlBinding;
import org.jbpm.pvm.internal.email.impl.MailProducerImpl;
import org.jbpm.pvm.internal.email.impl.MailTemplate;
import org.jbpm.pvm.internal.email.impl.MailTemplateRegistry;
@@ -68,7 +67,6 @@
import org.jbpm.pvm.internal.task.AssignableDefinitionImpl;
import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
-import org.jbpm.pvm.internal.util.ReflectUtil;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.Descriptor;
import org.jbpm.pvm.internal.wire.UserCodeReference;
@@ -122,20 +120,24 @@
protected void parseBindings() {
for (String bindingResource: DEFAULT_BINDING_RESOURCES) {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- Enumeration<URL> resourceUrls = classLoader.getResources(bindingResource);
- if (resourceUrls.hasMoreElements()) {
- while (resourceUrls.hasMoreElements()) {
- URL resourceUrl = resourceUrls.nextElement();
- log.trace("loading jpdl bindings from resource: "+resourceUrl);
- List<JpdlBinding> activityBindings = (List<JpdlBinding>) bindingsParser.createParse()
- .pushObject(bindings)
- .setUrl(resourceUrl)
- .execute()
- .checkErrors("jpdl bindings from "+resourceUrl.toString())
- .getDocumentObject();
+ try {
+ Enumeration<URL> resourceUrls = classLoader.getResources(bindingResource);
+ if (resourceUrls.hasMoreElements()) {
+ while (resourceUrls.hasMoreElements()) {
+ URL resourceUrl = resourceUrls.nextElement();
+ log.trace("loading jpdl bindings from resource: "+resourceUrl);
+ List<JpdlBinding> activityBindings = (List<JpdlBinding>) bindingsParser.createParse()
+ .pushObject(bindings)
+ .setUrl(resourceUrl)
+ .execute()
+ .checkErrors("jpdl bindings from "+resourceUrl.toString())
+ .getDocumentObject();
+ }
+ } else {
+ log.trace("skipping unavailable jpdl bindings resource: "+bindingResource);
}
- } else {
- log.trace("skipping unavailable jpdl bindings resource: "+bindingResource);
+ } catch (IOException e) {
+ throw new JbpmException("couldn't read jpdl 4.0 binding resources", e);
}
}
}
@@ -210,45 +212,6 @@
return processDefinitions;
}
- public void parseActivityName(Element element, ActivityImpl activity, Parse parse, boolean isRequired) {
- String name = XmlUtil.attribute(element, "name", isRequired, 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 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 = 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);
-
- parseOnEvent(transitionElement, parse, transition, Event.TAKE);
- }
- }
-
protected void resolveTransitionDestinations(Parse parse, JpdlProcessDefinition processDefinition, UnresolvedTransitions unresolvedTransitions) {
for (UnresolvedTransition unresolvedTransition: unresolvedTransitions.list) {
unresolvedTransition.resolve(processDefinition, parse);
@@ -263,7 +226,7 @@
|| "timer".equals(tagName)
|| "swimlane".equals(tagName)) continue;
- JpdlBinding activityBinding = (JpdlBinding) getBinding(nestedElement, JpdlBindingsParser.CATEGORY_ACTIVITY);
+ JpdlBinding activityBinding = (JpdlBinding) bindings.getBinding(nestedElement, JpdlBindingsParser.CATEGORY_ACTIVITY);
if (activityBinding == null) {
log.debug("unrecognized activity: " + tagName);
continue;
@@ -273,7 +236,7 @@
parse.pushObject(activity);
try {
activity.setType(activityBinding.getTagName());
- parseName(nestedElement, activity, parse);
+ activityBinding.parseName(nestedElement, activity, parse);
parseTransitions(nestedElement, activity, parse);
Element descriptionElement = XmlUtil.element(documentElement, "description");
@@ -291,8 +254,9 @@
}
}
- ActivityBehaviour activityBehaviour = (ActivityBehaviour) activityBinding.parse(nestedElement, parse, this);
- activity.setBehaviour(activityBehaviour);
+ JpdlParser jpdlParser = parse.findObject(JpdlParser.class);
+ ActivityBehaviour activityBehaviour = (ActivityBehaviour) activityBinding.parse(nestedElement, parse, jpdlParser);
+ activity.setActivityBehaviour(activityBehaviour);
parseOnEvents(nestedElement, parse, activity);
@@ -386,9 +350,10 @@
}
for (Element eventListenerElement: XmlUtil.elements(element)) {
- JpdlBinding eventBinding = (JpdlBinding) getBinding(eventListenerElement, JpdlBindingsParser.CATEGORY_EVENT_LISTENER);
+ JpdlBinding eventBinding = (JpdlBinding) bindings.getBinding(eventListenerElement, JpdlBindingsParser.CATEGORY_EVENT_LISTENER);
if (eventBinding!=null) {
- EventListener eventListener = (EventListener) eventBinding.parse(eventListenerElement, parse, this);
+ JpdlParser jpdlParser = parse.findObject(JpdlParser.class);
+ EventListener eventListener = (EventListener) eventBinding.parse(eventListenerElement, parse, jpdlParser);
EventListenerReference eventListenerReference = event.createEventListenerReference(eventListener);
if (XmlUtil.attributeBoolean(eventListenerElement, "propagation", false, parse, false)) {
@@ -460,8 +425,9 @@
Element assignmentHandlerElement = XmlUtil.element(element, "assignment-handler");
if (assignmentHandlerElement!=null) {
ObjectDescriptor objectDescriptor = parseObjectDescriptor(assignmentHandlerElement, parse);
- AssignmentHandler assignmentHandler = (AssignmentHandler) WireContext.create(objectDescriptor);
- assignableDefinition.setAssignmentHandler(assignmentHandler);
+ UserCodeReference assignmentHandlerReference = new UserCodeReference();
+ assignmentHandlerReference.setDescriptor(objectDescriptor);
+ assignableDefinition.setAssignmentHandlerReference(assignmentHandlerReference);
}
String assigneeExpression = XmlUtil.attribute(element, "assignee");
@@ -510,7 +476,7 @@
}
}
- JpdlParser.parseAssignmentAttributes(element, taskDefinition, parse);
+ parseAssignmentAttributes(element, taskDefinition, parse);
// parse notification mail producer
Element notificationElement = XmlUtil.element(element, "notification");
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/CustomActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/CustomActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/CustomActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,55 +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.jpdl.internal.v40.activities;
-
-import java.util.Map;
-
-import org.jbpm.api.activity.ActivityBehaviour;
-import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.api.activity.ExternalActivityBehaviour;
-
-
-/**
- * @author Tom Baeyens
- */
-public class CustomActivity extends JpdlExternalActivity {
-
- private static final long serialVersionUID = 1L;
-
- protected ActivityBehaviour customBehaviour;
-
- public void signal(ActivityExecution execution, String signalName, Map<String, ? > parameters) throws Exception {
- ExternalActivityBehaviour externalActivityBehaviour = (ExternalActivityBehaviour)customBehaviour;
- externalActivityBehaviour.signal(execution, signalName, parameters);
- }
-
- public void execute(ActivityExecution execution) throws Exception {
- customBehaviour.execute(execution);
- }
-
- public ActivityBehaviour getCustomBehaviour() {
- return customBehaviour;
- }
- public void setCustomBehaviour(ActivityBehaviour customBehaviour) {
- this.customBehaviour = customBehaviour;
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/CustomActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/CustomActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/CustomActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -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.jpdl.internal.v40.activities;
+
+import java.util.Map;
+
+import org.jbpm.api.activity.ActivityBehaviour;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.activity.ExternalActivityBehaviour;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CustomActivity extends JpdlExternalActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected ActivityBehaviour customBehaviour;
+
+ public void signal(ActivityExecution execution, String signalName, Map<String, ? > parameters) throws Exception {
+ ExternalActivityBehaviour externalActivityBehaviour = (ExternalActivityBehaviour)customBehaviour;
+ externalActivityBehaviour.signal(execution, signalName, parameters);
+ }
+
+ public void execute(ActivityExecution execution) throws Exception {
+ customBehaviour.execute(execution);
+ }
+
+ public ActivityBehaviour getCustomBehaviour() {
+ return customBehaviour;
+ }
+ public void setCustomBehaviour(ActivityBehaviour customBehaviour) {
+ this.customBehaviour = customBehaviour;
+ }
+}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionBuilder.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionBuilder.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionBuilder.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.activities;
+
+import org.jbpm.pvm.internal.builder.ActivityBehaviourBuilder;
+import org.jbpm.pvm.internal.builder.ActivityBuilder;
+import org.jbpm.pvm.internal.builder.CompositeBuilder;
+import org.jbpm.pvm.internal.wire.Descriptor;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DecisionBuilder extends ActivityBehaviourBuilder {
+
+ public DecisionBuilder(ActivityBuilder activityBuilder) {
+ super(activityBuilder);
+ }
+
+ public DecisionBuilder handler(Descriptor descriptor) {
+ // TODO finish this
+ return null;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionBuilder.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionConditionActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionConditionActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionConditionActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,69 +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.jpdl.internal.v40.activities;
-
-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 JpdlActivity {
-
- 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;
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionConditionActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionConditionActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionConditionActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -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.jpdl.internal.v40.activities;
+
+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 JpdlActivity {
+
+ 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;
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionExpressionActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionExpressionActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionExpressionActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,75 +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.jpdl.internal.v40.activities;
-
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.pvm.internal.env.EnvironmentDefaults;
-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.script.ScriptManager;
-
-/**
- * @author Tom Baeyens
- */
-public class DecisionExpressionActivity extends JpdlActivity {
-
- private static final long serialVersionUID = 1L;
-
- protected String expr;
- protected String lang;
-
- public void execute(ActivityExecution execution) {
- execute((ExecutionImpl) execution);
- }
-
- public void execute(ExecutionImpl execution) {
- Activity activity = execution.getActivity();
- String transitionName = null;
-
- ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
- Object result = scriptManager.evaluateExpression(expr, lang);
- if ( (result!=null)
- && (! (result instanceof String))
- ) {
- throw new JbpmException("expression '"+expr+"' in decision '"+activity.getName()+"' returned "+result.getClass().getName()+" instead of a transitionName (String): "+result);
- }
- transitionName = (String) result;
-
- Transition transition = activity.getOutgoingTransition(transitionName);
- if (transition==null) {
- throw new JbpmException("expression '"+expr+"' in decision '"+activity.getName()+"' returned unexisting outgoing transition name: "+transitionName);
- }
-
- execution.historyDecision(transitionName);
-
- execution.take(transition);
- }
-
- public void setExpr(String expr) {
- this.expr = expr;
- }
- public void setLang(String lang) {
- this.lang = lang;
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionExpressionActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionExpressionActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionExpressionActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,75 @@
+/*
+ * 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.jpdl.internal.v40.activities;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.pvm.internal.env.EnvironmentDefaults;
+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.script.ScriptManager;
+
+/**
+ * @author Tom Baeyens
+ */
+public class DecisionExpressionActivity extends JpdlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String expr;
+ protected String lang;
+
+ public void execute(ActivityExecution execution) {
+ execute((ExecutionImpl) execution);
+ }
+
+ public void execute(ExecutionImpl execution) {
+ Activity activity = execution.getActivity();
+ String transitionName = null;
+
+ ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
+ Object result = scriptManager.evaluateExpression(expr, lang);
+ if ( (result!=null)
+ && (! (result instanceof String))
+ ) {
+ throw new JbpmException("expression '"+expr+"' in decision '"+activity.getName()+"' returned "+result.getClass().getName()+" instead of a transitionName (String): "+result);
+ }
+ transitionName = (String) result;
+
+ Transition transition = activity.getOutgoingTransition(transitionName);
+ if (transition==null) {
+ throw new JbpmException("expression '"+expr+"' in decision '"+activity.getName()+"' returned unexisting outgoing transition name: "+transitionName);
+ }
+
+ execution.historyDecision(transitionName);
+
+ execution.take(transition);
+ }
+
+ public void setExpr(String expr) {
+ this.expr = expr;
+ }
+ public void setLang(String lang) {
+ this.lang = lang;
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionHandlerActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionHandlerActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionHandlerActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,89 +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.jpdl.internal.v40.activities;
-
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.api.jpdl.DecisionHandler;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-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.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.WireContext;
-
-/**
- * @author Tom Baeyens
- */
-public class DecisionHandlerActivity extends JpdlActivity {
-
- private static final long serialVersionUID = 1L;
-
- protected String decisionHandlerName;
- protected DecisionHandler decisionHandler;
-
- public void execute(ActivityExecution execution) {
- execute((ExecutionImpl) execution);
- }
-
- public void execute(ExecutionImpl execution) {
- Activity activity = execution.getActivity();
-
- String transitionName = null;
-
- DecisionHandler usedDecisionHandler = null;
- if (decisionHandler!=null) {
- usedDecisionHandler = decisionHandler;
-
- } else if (decisionHandlerName!=null) {
- EnvironmentImpl environment = EnvironmentImpl.getCurrent();
- Object object = environment.get(decisionHandlerName);
- if (object==null) {
- throw new JbpmException("decision handler for "+activity+" is null");
- }
- if (! (object instanceof DecisionHandler)) {
- throw new JbpmException("handler for decision is not a "+DecisionHandler.class.getName()+": "+object.getClass().getName());
- }
- usedDecisionHandler = (DecisionHandler) object;
- } else {
- throw new JbpmException("no decision handler specified");
- }
-
- transitionName = usedDecisionHandler.decide(execution);
-
- Transition transition = activity.getOutgoingTransition(transitionName);
- if (transition==null) {
- throw new JbpmException("handler in decision '"+activity.getName()+"' returned unexisting outgoing transition name: "+transitionName);
- }
-
- execution.historyDecision(transitionName);
-
- execution.take(transition);
- }
-
- public void setDecisionHandlerName(String decisionHandlerName) {
- this.decisionHandlerName = decisionHandlerName;
- }
- public void setDecisionHandler(DecisionHandler decisionHandler) {
- this.decisionHandler = decisionHandler;
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionHandlerActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionHandlerActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionHandlerActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,89 @@
+/*
+ * 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.jpdl.internal.v40.activities;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.jpdl.DecisionHandler;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+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.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.WireContext;
+
+/**
+ * @author Tom Baeyens
+ */
+public class DecisionHandlerActivity extends JpdlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String decisionHandlerName;
+ protected DecisionHandler decisionHandler;
+
+ public void execute(ActivityExecution execution) {
+ execute((ExecutionImpl) execution);
+ }
+
+ public void execute(ExecutionImpl execution) {
+ Activity activity = execution.getActivity();
+
+ String transitionName = null;
+
+ DecisionHandler usedDecisionHandler = null;
+ if (decisionHandler!=null) {
+ usedDecisionHandler = decisionHandler;
+
+ } else if (decisionHandlerName!=null) {
+ EnvironmentImpl environment = EnvironmentImpl.getCurrent();
+ Object object = environment.get(decisionHandlerName);
+ if (object==null) {
+ throw new JbpmException("decision handler for "+activity+" is null");
+ }
+ if (! (object instanceof DecisionHandler)) {
+ throw new JbpmException("handler for decision is not a "+DecisionHandler.class.getName()+": "+object.getClass().getName());
+ }
+ usedDecisionHandler = (DecisionHandler) object;
+ } else {
+ throw new JbpmException("no decision handler specified");
+ }
+
+ transitionName = usedDecisionHandler.decide(execution);
+
+ Transition transition = activity.getOutgoingTransition(transitionName);
+ if (transition==null) {
+ throw new JbpmException("handler in decision '"+activity.getName()+"' returned unexisting outgoing transition name: "+transitionName);
+ }
+
+ execution.historyDecision(transitionName);
+
+ execution.take(transition);
+ }
+
+ public void setDecisionHandlerName(String decisionHandlerName) {
+ this.decisionHandlerName = decisionHandlerName;
+ }
+ public void setDecisionHandler(DecisionHandler decisionHandler) {
+ this.decisionHandler = decisionHandler;
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/EndActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/EndActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/EndActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,93 +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.jpdl.internal.v40.activities;
-
-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 JpdlActivity {
-
- 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 {
- ExecutionImpl executionToEnd = null;
- if (endProcessInstance) {
- executionToEnd = execution.getProcessInstance();
- } else {
- executionToEnd = execution;
- }
-
- if (state==null) {
- executionToEnd.end();
- } else {
- executionToEnd.end(state);
- }
- }
- }
-
- public void setEndProcessInstance(boolean endProcessInstance) {
- this.endProcessInstance = endProcessInstance;
- }
- public void setState(String state) {
- this.state = state;
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/EndActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/EndActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/EndActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -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.jpdl.internal.v40.activities;
+
+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 JpdlActivity {
+
+ 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 {
+ ExecutionImpl executionToEnd = null;
+ if (endProcessInstance) {
+ executionToEnd = execution.getProcessInstance();
+ } else {
+ executionToEnd = execution;
+ }
+
+ if (state==null) {
+ executionToEnd.end();
+ } else {
+ executionToEnd.end(state);
+ }
+ }
+ }
+
+ public void setEndProcessInstance(boolean endProcessInstance) {
+ this.endProcessInstance = endProcessInstance;
+ }
+ public void setState(String state) {
+ this.state = state;
+ }
+}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/EndBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/EndBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/EndBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,60 @@
+/*
+ * 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.jpdl.internal.v40.activities;
+
+import org.jbpm.jpdl.internal.v40.bindings.JpdlBinding;
+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;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EndBinding extends JpdlBinding {
+
+ public EndBinding() {
+ super("end");
+ }
+
+ protected EndBinding(String tag) {
+ super(tag);
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+
+ boolean endProcessInstance = true;
+ String ends = XmlUtil.attribute(element, "ends", false, parse);
+ if ("execution".equalsIgnoreCase(ends)) {
+ endProcessInstance = false;
+ }
+
+ String state = XmlUtil.attribute(element, "state", false, parse);
+
+ EndActivity endActivity = new EndActivity();
+ endActivity.setEndProcessInstance(endProcessInstance);
+ endActivity.setState(state);
+
+ return endActivity;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/EndBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ForkActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ForkActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ForkActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,95 +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.jpdl.internal.v40.activities;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jbpm.api.Execution;
-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 ForkActivity extends JpdlActivity {
-
- private static final long serialVersionUID = 1L;
-
- public void execute(ActivityExecution execution) {
- execute((ExecutionImpl)execution);
- }
-
- public void execute(ExecutionImpl execution) {
- Activity activity = execution.getActivity();
-
- // evaluate the conditions and find the transitions that should be forked
- List<Transition> forkingTransitions = new ArrayList<Transition>();
- List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
- for (Transition transition: outgoingTransitions) {
- Condition condition = transition.getCondition();
- if ( (condition==null)
- || (condition.evaluate(execution))
- ) {
- forkingTransitions.add(transition);
- }
- }
-
- // if no outgoing transitions should be forked,
- if (forkingTransitions.size()==0) {
- // end this execution
- execution.end();
-
- // if there is exactly 1 transition to be taken, just use the incoming execution
- } else if (forkingTransitions.size()==1) {
- execution.take(forkingTransitions.get(0));
-
- // if there are more transitions
- } else {
- ExecutionImpl concurrentRoot = null;
- if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
- concurrentRoot = execution;
- execution.setState(Execution.STATE_INACTIVE_CONCURRENT_ROOT);
- execution.setActivity(null);
- } else if (Execution.STATE_ACTIVE_CONCURRENT.equals(execution.getState())) {
- concurrentRoot = execution.getParent();
- }
-
- for (Transition transition: forkingTransitions) {
- // launch a concurrent path of execution
- String childExecutionName = transition.getName();
- ExecutionImpl concurrentExecution = concurrentRoot.createExecution(childExecutionName);
- concurrentExecution.setActivity(activity);
- concurrentExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
- concurrentExecution.take(transition);
-
- if (concurrentRoot.isEnded()) {
- break;
- }
- }
- }
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ForkActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ForkActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ForkActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,95 @@
+/*
+ * 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.jpdl.internal.v40.activities;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.api.Execution;
+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 ForkActivity extends JpdlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) {
+ execute((ExecutionImpl)execution);
+ }
+
+ public void execute(ExecutionImpl execution) {
+ Activity activity = execution.getActivity();
+
+ // evaluate the conditions and find the transitions that should be forked
+ List<Transition> forkingTransitions = new ArrayList<Transition>();
+ List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
+ for (Transition transition: outgoingTransitions) {
+ Condition condition = transition.getCondition();
+ if ( (condition==null)
+ || (condition.evaluate(execution))
+ ) {
+ forkingTransitions.add(transition);
+ }
+ }
+
+ // if no outgoing transitions should be forked,
+ if (forkingTransitions.size()==0) {
+ // end this execution
+ execution.end();
+
+ // if there is exactly 1 transition to be taken, just use the incoming execution
+ } else if (forkingTransitions.size()==1) {
+ execution.take(forkingTransitions.get(0));
+
+ // if there are more transitions
+ } else {
+ ExecutionImpl concurrentRoot = null;
+ if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
+ concurrentRoot = execution;
+ execution.setState(Execution.STATE_INACTIVE_CONCURRENT_ROOT);
+ execution.setActivity(null);
+ } else if (Execution.STATE_ACTIVE_CONCURRENT.equals(execution.getState())) {
+ concurrentRoot = execution.getParent();
+ }
+
+ for (Transition transition: forkingTransitions) {
+ // launch a concurrent path of execution
+ String childExecutionName = transition.getName();
+ ExecutionImpl concurrentExecution = concurrentRoot.createExecution(childExecutionName);
+ concurrentExecution.setActivity(activity);
+ concurrentExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
+ concurrentExecution.take(transition);
+
+ if (concurrentRoot.isEnded()) {
+ break;
+ }
+ }
+ }
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/GroupActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/GroupActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/GroupActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,107 +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.jpdl.internal.v40.activities;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.jbpm.api.Execution;
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.activity.ActivityExecution;
-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 GroupActivity extends JpdlExternalActivity {
-
- private static final long serialVersionUID = 1L;
-
- public void execute(ActivityExecution execution) {
- execute((ExecutionImpl)execution);
- }
-
- public void execute(ExecutionImpl execution) {
- // find the start activity
- Activity activity = execution.getActivity();
- List<Activity> startActivities = findStartActivities(activity);
- if (startActivities.size()==1) {
- execution.execute(startActivities.get(0));
- } else {
-
- ExecutionImpl concurrentRoot = null;
- if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
- concurrentRoot = execution;
- } else if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
- concurrentRoot = execution.getParent();
-
- } else {
- throw new JbpmException("illegal state");
- }
-
- for (Activity startActivity: startActivities) {
- ExecutionImpl concurrentExecution = concurrentRoot.createExecution();
- concurrentExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
- concurrentExecution.execute(startActivity);
- }
- }
- }
-
- private List<Activity> findStartActivities(Activity activity) {
- List<Activity> startActivities = new ArrayList<Activity>();
- List nestedActivities = activity.getActivities();
- for (ActivityImpl nestedActivity : (List<ActivityImpl>) nestedActivities) {
- if ( (nestedActivity.getIncomingTransitions()==null)
- || (nestedActivity.getIncomingTransitions().isEmpty())
- ) {
- startActivities.add(nestedActivity);
- }
- }
- return startActivities;
- }
-
- 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 {
- Transition transition = null;
- Activity activity = execution.getActivity();
- List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
-
- int nbrOfOutgoingTransitions = (outgoingTransitions!=null ? outgoingTransitions.size() : 0);
- if ( (signalName==null)
- && (nbrOfOutgoingTransitions==1)
- ) {
- transition = outgoingTransitions.get(0);
- } else {
- transition = activity.getOutgoingTransition(signalName);
- }
-
- execution.take(transition);
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/GroupActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/GroupActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/GroupActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,107 @@
+/*
+ * 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.jpdl.internal.v40.activities;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.activity.ActivityExecution;
+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 GroupActivity extends JpdlExternalActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) {
+ execute((ExecutionImpl)execution);
+ }
+
+ public void execute(ExecutionImpl execution) {
+ // find the start activity
+ Activity activity = execution.getActivity();
+ List<Activity> startActivities = findStartActivities(activity);
+ if (startActivities.size()==1) {
+ execution.execute(startActivities.get(0));
+ } else {
+
+ ExecutionImpl concurrentRoot = null;
+ if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
+ concurrentRoot = execution;
+ } else if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
+ concurrentRoot = execution.getParent();
+
+ } else {
+ throw new JbpmException("illegal state");
+ }
+
+ for (Activity startActivity: startActivities) {
+ ExecutionImpl concurrentExecution = concurrentRoot.createExecution();
+ concurrentExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
+ concurrentExecution.execute(startActivity);
+ }
+ }
+ }
+
+ private List<Activity> findStartActivities(Activity activity) {
+ List<Activity> startActivities = new ArrayList<Activity>();
+ List nestedActivities = activity.getActivities();
+ for (ActivityImpl nestedActivity : (List<ActivityImpl>) nestedActivities) {
+ if ( (nestedActivity.getIncomingTransitions()==null)
+ || (nestedActivity.getIncomingTransitions().isEmpty())
+ ) {
+ startActivities.add(nestedActivity);
+ }
+ }
+ return startActivities;
+ }
+
+ 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 {
+ Transition transition = null;
+ Activity activity = execution.getActivity();
+ List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
+
+ int nbrOfOutgoingTransitions = (outgoingTransitions!=null ? outgoingTransitions.size() : 0);
+ if ( (signalName==null)
+ && (nbrOfOutgoingTransitions==1)
+ ) {
+ transition = outgoingTransitions.get(0);
+ } else {
+ transition = activity.getOutgoingTransition(signalName);
+ }
+
+ execution.take(transition);
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/HqlActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/HqlActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/HqlActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,102 +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.jpdl.internal.v40.activities;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.model.OpenExecution;
-import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.WireContext;
-import org.jbpm.pvm.internal.wire.descriptor.ListDescriptor;
-
-
-/**
- * @author Tom Baeyens
- */
-public class HqlActivity extends JpdlAutomaticActivity {
-
- private static final Log log = Log.getLog(HqlActivity.class.getName());
-
- private static final long serialVersionUID = 1L;
-
- protected String query;
- protected ListDescriptor parametersDescriptor;
- protected String resultVariableName;
- protected boolean isResultUnique;
-
- public void perform(OpenExecution execution) {
- EnvironmentImpl environment = EnvironmentImpl.getCurrent();
- if (environment==null) {
- throw new JbpmException("no environment for jpdl activity "+HqlBinding.TAG);
- }
- Session session = environment.get(Session.class);
-
- Query q = createQuery(session);
-
- if (parametersDescriptor!=null) {
- for (Descriptor valueDescriptor: parametersDescriptor.getValueDescriptors()) {
- String parameterName = valueDescriptor.getName();
- Object value = WireContext.create(valueDescriptor);
- applyParameter(q, parameterName, value);
- }
- }
-
- Object result = null;
- if (isResultUnique) {
- result = q.uniqueResult();
- } else {
- result = q.list();
- }
-
- execution.setVariable(resultVariableName, result);
- }
-
- protected Query createQuery(Session session) {
- return session.createQuery(query);
- }
-
- public void applyParameter(Query q, String parameterName, Object value) {
- if (value instanceof String) {
- q.setString(parameterName, (String) value);
- } else if (value instanceof Long) {
- q.setLong(parameterName, (Long) value);
- } else {
- log.error("unknown hql parameter type: "+value.getClass().getName());
- }
- }
-
- public void setQuery(String query) {
- this.query = query;
- }
- public void setParametersDescriptor(ListDescriptor parametersDescriptor) {
- this.parametersDescriptor = parametersDescriptor;
- }
- public void setResultUnique(boolean isResultUnique) {
- this.isResultUnique = isResultUnique;
- }
- public void setResultVariableName(String resultVariableName) {
- this.resultVariableName = resultVariableName;
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/HqlActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/HqlActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/HqlActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,103 @@
+/*
+ * 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.jpdl.internal.v40.activities;
+
+import org.hibernate.Query;
+import org.hibernate.Session;
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.model.OpenExecution;
+import org.jbpm.internal.log.Log;
+import org.jbpm.jpdl.internal.v40.bindings.HqlBinding;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.descriptor.ListDescriptor;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class HqlActivity extends JpdlAutomaticActivity {
+
+ private static final Log log = Log.getLog(HqlActivity.class.getName());
+
+ private static final long serialVersionUID = 1L;
+
+ protected String query;
+ protected ListDescriptor parametersDescriptor;
+ protected String resultVariableName;
+ protected boolean isResultUnique;
+
+ public void perform(OpenExecution execution) {
+ EnvironmentImpl environment = EnvironmentImpl.getCurrent();
+ if (environment==null) {
+ throw new JbpmException("no environment for jpdl activity "+HqlBinding.TAG);
+ }
+ Session session = environment.get(Session.class);
+
+ Query q = createQuery(session);
+
+ if (parametersDescriptor!=null) {
+ for (Descriptor valueDescriptor: parametersDescriptor.getValueDescriptors()) {
+ String parameterName = valueDescriptor.getName();
+ Object value = WireContext.create(valueDescriptor);
+ applyParameter(q, parameterName, value);
+ }
+ }
+
+ Object result = null;
+ if (isResultUnique) {
+ result = q.uniqueResult();
+ } else {
+ result = q.list();
+ }
+
+ execution.setVariable(resultVariableName, result);
+ }
+
+ protected Query createQuery(Session session) {
+ return session.createQuery(query);
+ }
+
+ public void applyParameter(Query q, String parameterName, Object value) {
+ if (value instanceof String) {
+ q.setString(parameterName, (String) value);
+ } else if (value instanceof Long) {
+ q.setLong(parameterName, (Long) value);
+ } else {
+ log.error("unknown hql parameter type: "+value.getClass().getName());
+ }
+ }
+
+ public void setQuery(String query) {
+ this.query = query;
+ }
+ public void setParametersDescriptor(ListDescriptor parametersDescriptor) {
+ this.parametersDescriptor = parametersDescriptor;
+ }
+ public void setResultUnique(boolean isResultUnique) {
+ this.isResultUnique = isResultUnique;
+ }
+ public void setResultVariableName(String resultVariableName) {
+ this.resultVariableName = resultVariableName;
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JavaActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JavaActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JavaActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,119 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.v40.activities;
-
-import java.lang.reflect.Method;
-import java.util.List;
-
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.model.OpenExecution;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.env.EnvironmentDefaults;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.script.ScriptManager;
-import org.jbpm.pvm.internal.util.ReflectUtil;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.WireContext;
-import org.jbpm.pvm.internal.wire.WireException;
-import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.wire.operation.InvokeOperation;
-
-
-/**
- * @author Tom Baeyens
- */
-public class JavaActivity extends JpdlAutomaticActivity {
-
- private static final long serialVersionUID = 1L;
-
- protected String targetExpression;
- protected String targetLanguage;
- protected Object target;
-
- protected String methodName;
- protected String variableName;
- protected InvokeOperation invokeOperation;
-
- public void perform(OpenExecution execution) throws Exception {
-
- Object invocationTarget = null;
-
- WireContext wireContext = new WireContext();
-
- if (target!=null) {
- invocationTarget = target;
-
- } else if (targetExpression!=null) {
- ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
- invocationTarget = scriptManager.evaluateExpression(targetExpression, targetLanguage);
-
- } else {
- throw new JbpmException("no target specified");
- }
-
- try {
- List<ArgDescriptor> argDescriptors = null;
- Object[] args = null;
- if (invokeOperation!=null) {
- argDescriptors = invokeOperation.getArgDescriptors();
- args = ObjectDescriptor.getArgs(wireContext, argDescriptors);
- }
-
- Class<?> clazz = invocationTarget.getClass();
- Method method = ReflectUtil.findMethod(clazz, methodName, argDescriptors, args);
- if (method==null) {
- throw new WireException("method "+ReflectUtil.getSignature(methodName, argDescriptors, args)+" unavailable");
- }
-
- Object returnValue = ReflectUtil.invoke(method, invocationTarget, args);
-
- if (variableName!=null) {
- execution.setVariable(variableName, returnValue);
- }
-
- } catch (WireException e) {
- throw e;
- } catch (Exception e) {
- throw new WireException("couldn't invoke method "+methodName+": "+e.getMessage(), e);
- }
- }
-
- public void setTarget(Object target) {
- this.target = target;
- }
- public void setMethodName(String methodName) {
- this.methodName = methodName;
- }
- public void setVariableName(String variableName) {
- this.variableName = variableName;
- }
- public void setInvokeOperation(InvokeOperation invokeOperation) {
- this.invokeOperation = invokeOperation;
- }
- public void setTargetExpression(String expression) {
- this.targetExpression = expression;
- }
- public void setTargetLanguage(String language) {
- this.targetLanguage = language;
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JavaActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JavaActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JavaActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.activities;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.model.OpenExecution;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.env.EnvironmentDefaults;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.script.ScriptManager;
+import org.jbpm.pvm.internal.util.ReflectUtil;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.WireException;
+import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.wire.operation.InvokeOperation;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JavaActivity extends JpdlAutomaticActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String targetExpression;
+ protected String targetLanguage;
+ protected Object target;
+
+ protected String methodName;
+ protected String variableName;
+ protected InvokeOperation invokeOperation;
+
+ public void perform(OpenExecution execution) throws Exception {
+
+ Object invocationTarget = null;
+
+ WireContext wireContext = new WireContext();
+
+ if (target!=null) {
+ invocationTarget = target;
+
+ } else if (targetExpression!=null) {
+ ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
+ invocationTarget = scriptManager.evaluateExpression(targetExpression, targetLanguage);
+
+ } else {
+ throw new JbpmException("no target specified");
+ }
+
+ try {
+ List<ArgDescriptor> argDescriptors = null;
+ Object[] args = null;
+ if (invokeOperation!=null) {
+ argDescriptors = invokeOperation.getArgDescriptors();
+ args = ObjectDescriptor.getArgs(wireContext, argDescriptors);
+ }
+
+ Class<?> clazz = invocationTarget.getClass();
+ Method method = ReflectUtil.findMethod(clazz, methodName, argDescriptors, args);
+ if (method==null) {
+ throw new WireException("method "+ReflectUtil.getSignature(methodName, argDescriptors, args)+" unavailable");
+ }
+
+ Object returnValue = ReflectUtil.invoke(method, invocationTarget, args);
+
+ if (variableName!=null) {
+ execution.setVariable(variableName, returnValue);
+ }
+
+ } catch (WireException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new WireException("couldn't invoke method "+methodName+": "+e.getMessage(), e);
+ }
+ }
+
+ public void setTarget(Object target) {
+ this.target = target;
+ }
+ public void setMethodName(String methodName) {
+ this.methodName = methodName;
+ }
+ public void setVariableName(String variableName) {
+ this.variableName = variableName;
+ }
+ public void setInvokeOperation(InvokeOperation invokeOperation) {
+ this.invokeOperation = invokeOperation;
+ }
+ public void setTargetExpression(String expression) {
+ this.targetExpression = expression;
+ }
+ public void setTargetLanguage(String language) {
+ this.targetLanguage = language;
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JoinActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JoinActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JoinActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,134 +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.jpdl.internal.v40.activities;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.LockMode;
-import org.hibernate.Session;
-import org.jbpm.api.Execution;
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.model.Activity;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.Transition;
-
-
-/**
- * @author Tom Baeyens
- */
-public class JoinActivity extends JpdlActivity {
-
- private static final long serialVersionUID = 1L;
-
- int multiplicity = -1;
- LockMode lockMode = LockMode.UPGRADE;
-
- public void execute(ActivityExecution execution) {
- execute((ExecutionImpl)execution);
- }
-
- public void execute(ExecutionImpl execution) {
- Activity activity = execution.getActivity();
-
- // if this is a single, non concurrent root
- if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
- // just pass through
- Transition transition = activity.getDefaultOutgoingTransition();
- if (transition==null) {
- throw new JbpmException("join must have an outgoing transition");
- }
- execution.take(transition);
-
- } else if (Execution.STATE_ACTIVE_CONCURRENT.equals(execution.getState())) {
-
- // force version increment in the parent execution
- Session session = EnvironmentImpl.getFromCurrent(Session.class);
- session.lock(execution.getParent(), lockMode);
-
- execution.setState(Execution.STATE_INACTIVE_JOIN);
- execution.waitForSignal();
-
- ExecutionImpl concurrentRoot = execution.getParent();
- List<ExecutionImpl> joinedExecutions = getJoinedExecutions(concurrentRoot, activity);
-
- if (isComplete(joinedExecutions, activity)) {
- endJoinedExecutions(joinedExecutions);
-
- ExecutionImpl outgoingExecution = null;
- if (concurrentRoot.getExecutions().size()==0) {
- outgoingExecution = concurrentRoot;
- outgoingExecution.setState(Execution.STATE_ACTIVE_ROOT);
- } else {
- outgoingExecution = concurrentRoot.createExecution();
- outgoingExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
- }
-
- execution.setActivity(activity, outgoingExecution);
- Transition transition = activity.getDefaultOutgoingTransition();
- if (transition==null) {
- throw new JbpmException("join must have an outgoing transition");
- }
- outgoingExecution.take(transition);
- }
-
- } else {
- throw new JbpmException("invalid execution state");
- }
- }
-
- protected boolean isComplete(List<ExecutionImpl> joinedExecutions, Activity activity) {
- int nbrOfExecutionsToJoin = multiplicity;
- if (multiplicity==-1) {
- nbrOfExecutionsToJoin = activity.getIncomingTransitions().size();
- }
- return joinedExecutions.size()==nbrOfExecutionsToJoin;
- }
-
- protected List<ExecutionImpl> getJoinedExecutions(ExecutionImpl concurrentRoot, Activity activity) {
- List<ExecutionImpl> joinedExecutions = new ArrayList<ExecutionImpl>();
- List concurrentExecutions = (List)concurrentRoot.getExecutions();
- for (ExecutionImpl concurrentExecution: (List<ExecutionImpl>)concurrentExecutions) {
- if ( (Execution.STATE_INACTIVE_JOIN.equals(concurrentExecution.getState()))
- && (concurrentExecution.getActivity()==activity)
- ) {
- joinedExecutions.add(concurrentExecution);
- }
- }
- return joinedExecutions;
- }
-
- protected void endJoinedExecutions(List<ExecutionImpl> joinedExecutions) {
- for (ExecutionImpl joinedExecution: joinedExecutions) {
- joinedExecution.end();
- }
- }
-
- public void setMultiplicity(int multiplicity) {
- this.multiplicity = multiplicity;
- }
- public void setLockMode(LockMode lockMode) {
- this.lockMode = lockMode;
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JoinActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JoinActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JoinActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,134 @@
+/*
+ * 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.jpdl.internal.v40.activities;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hibernate.LockMode;
+import org.hibernate.Session;
+import org.jbpm.api.Execution;
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.model.Activity;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.Transition;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JoinActivity extends JpdlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ int multiplicity = -1;
+ LockMode lockMode = LockMode.UPGRADE;
+
+ public void execute(ActivityExecution execution) {
+ execute((ExecutionImpl)execution);
+ }
+
+ public void execute(ExecutionImpl execution) {
+ Activity activity = execution.getActivity();
+
+ // if this is a single, non concurrent root
+ if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
+ // just pass through
+ Transition transition = activity.getDefaultOutgoingTransition();
+ if (transition==null) {
+ throw new JbpmException("join must have an outgoing transition");
+ }
+ execution.take(transition);
+
+ } else if (Execution.STATE_ACTIVE_CONCURRENT.equals(execution.getState())) {
+
+ // force version increment in the parent execution
+ Session session = EnvironmentImpl.getFromCurrent(Session.class);
+ session.lock(execution.getParent(), lockMode);
+
+ execution.setState(Execution.STATE_INACTIVE_JOIN);
+ execution.waitForSignal();
+
+ ExecutionImpl concurrentRoot = execution.getParent();
+ List<ExecutionImpl> joinedExecutions = getJoinedExecutions(concurrentRoot, activity);
+
+ if (isComplete(joinedExecutions, activity)) {
+ endJoinedExecutions(joinedExecutions);
+
+ ExecutionImpl outgoingExecution = null;
+ if (concurrentRoot.getExecutions().size()==0) {
+ outgoingExecution = concurrentRoot;
+ outgoingExecution.setState(Execution.STATE_ACTIVE_ROOT);
+ } else {
+ outgoingExecution = concurrentRoot.createExecution();
+ outgoingExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
+ }
+
+ execution.setActivity(activity, outgoingExecution);
+ Transition transition = activity.getDefaultOutgoingTransition();
+ if (transition==null) {
+ throw new JbpmException("join must have an outgoing transition");
+ }
+ outgoingExecution.take(transition);
+ }
+
+ } else {
+ throw new JbpmException("invalid execution state");
+ }
+ }
+
+ protected boolean isComplete(List<ExecutionImpl> joinedExecutions, Activity activity) {
+ int nbrOfExecutionsToJoin = multiplicity;
+ if (multiplicity==-1) {
+ nbrOfExecutionsToJoin = activity.getIncomingTransitions().size();
+ }
+ return joinedExecutions.size()==nbrOfExecutionsToJoin;
+ }
+
+ protected List<ExecutionImpl> getJoinedExecutions(ExecutionImpl concurrentRoot, Activity activity) {
+ List<ExecutionImpl> joinedExecutions = new ArrayList<ExecutionImpl>();
+ List concurrentExecutions = (List)concurrentRoot.getExecutions();
+ for (ExecutionImpl concurrentExecution: (List<ExecutionImpl>)concurrentExecutions) {
+ if ( (Execution.STATE_INACTIVE_JOIN.equals(concurrentExecution.getState()))
+ && (concurrentExecution.getActivity()==activity)
+ ) {
+ joinedExecutions.add(concurrentExecution);
+ }
+ }
+ return joinedExecutions;
+ }
+
+ protected void endJoinedExecutions(List<ExecutionImpl> joinedExecutions) {
+ for (ExecutionImpl joinedExecution: joinedExecutions) {
+ joinedExecution.end();
+ }
+ }
+
+ public void setMultiplicity(int multiplicity) {
+ this.multiplicity = multiplicity;
+ }
+ public void setLockMode(LockMode lockMode) {
+ this.lockMode = lockMode;
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.v40.activities;
-
-import org.jbpm.api.activity.ActivityBehaviour;
-
-/**
- * @author Tom Baeyens
- */
-public abstract class JpdlActivity implements ActivityBehaviour {
-
- private static final long serialVersionUID = 1L;
-
- protected long dbid;
-
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.activities;
+
+import org.jbpm.api.activity.ActivityBehaviour;
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class JpdlActivity implements ActivityBehaviour {
+
+ private static final long serialVersionUID = 1L;
+
+ protected long dbid;
+
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlAutomaticActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlAutomaticActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlAutomaticActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,24 +0,0 @@
-package org.jbpm.jpdl.internal.v40.activities;
-
-import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.api.listener.EventListener;
-import org.jbpm.api.listener.EventListenerExecution;
-import org.jbpm.api.model.OpenExecution;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-
-
-public abstract class JpdlAutomaticActivity extends JpdlActivity implements EventListener {
-
- private static final long serialVersionUID = 1L;
-
- public void execute(ActivityExecution execution) throws Exception {
- perform(execution);
- ((ExecutionImpl)execution).historyAutomatic();
- }
-
- public void notify(EventListenerExecution execution) throws Exception {
- perform(execution);
- }
-
- abstract void perform(OpenExecution execution) throws Exception;
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlAutomaticActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlAutomaticActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlAutomaticActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,24 @@
+package org.jbpm.jpdl.internal.v40.activities;
+
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.listener.EventListener;
+import org.jbpm.api.listener.EventListenerExecution;
+import org.jbpm.api.model.OpenExecution;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+
+
+public abstract class JpdlAutomaticActivity extends JpdlActivity implements EventListener {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) throws Exception {
+ perform(execution);
+ ((ExecutionImpl)execution).historyAutomatic();
+ }
+
+ public void notify(EventListenerExecution execution) throws Exception {
+ perform(execution);
+ }
+
+ abstract void perform(OpenExecution execution) throws Exception;
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlExternalActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlExternalActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlExternalActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,31 +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.jpdl.internal.v40.activities;
-
-import org.jbpm.api.activity.ExternalActivityBehaviour;
-
-/**
- * @author Tom Baeyens
- */
-public abstract class JpdlExternalActivity extends JpdlActivity implements ExternalActivityBehaviour {
-
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlExternalActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlExternalActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlExternalActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,31 @@
+/*
+ * 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.jpdl.internal.v40.activities;
+
+import org.jbpm.api.activity.ExternalActivityBehaviour;
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class JpdlExternalActivity extends JpdlActivity implements ExternalActivityBehaviour {
+
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.v40.activities;
-
-import java.util.Collection;
-
-import javax.mail.Message;
-
-import org.jbpm.api.model.OpenExecution;
-import org.jbpm.pvm.internal.email.spi.MailProducer;
-import org.jbpm.pvm.internal.email.spi.MailSession;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-
-/**
- * @author Alejandro Guizar
- */
-public class MailActivity extends JpdlAutomaticActivity {
-
- protected MailProducer mailProducer;
-
- private static final long serialVersionUID = 1L;
-
- void perform(OpenExecution execution) throws Exception {
- Collection<Message> messages = mailProducer.produce(execution);
- EnvironmentImpl.getFromCurrent(MailSession.class).send(messages);
- }
-
- public void setMailProducer(MailProducer mailProducer) {
- this.mailProducer = mailProducer;
- }
-
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -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.jpdl.internal.v40.activities;
+
+import java.util.Collection;
+
+import javax.mail.Message;
+
+import org.jbpm.api.model.OpenExecution;
+import org.jbpm.pvm.internal.email.spi.MailProducer;
+import org.jbpm.pvm.internal.email.spi.MailSession;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class MailActivity extends JpdlAutomaticActivity {
+
+ protected MailProducer mailProducer;
+
+ private static final long serialVersionUID = 1L;
+
+ void perform(OpenExecution execution) throws Exception {
+ Collection<Message> messages = mailProducer.produce(execution);
+ EnvironmentImpl.getFromCurrent(MailSession.class).send(messages);
+ }
+
+ public void setMailProducer(MailProducer mailProducer) {
+ this.mailProducer = mailProducer;
+ }
+
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailListener.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailListener.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailListener.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.v40.activities;
-
-import java.util.Collection;
-
-import javax.mail.Message;
-
-import org.jbpm.api.listener.EventListener;
-import org.jbpm.api.listener.EventListenerExecution;
-import org.jbpm.pvm.internal.email.spi.MailProducer;
-import org.jbpm.pvm.internal.email.spi.MailSession;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.env.TaskContext;
-import org.jbpm.pvm.internal.session.DbSession;
-import org.jbpm.pvm.internal.task.TaskImpl;
-
-/**
- * @author Alejandro Guizar
- */
-public class MailListener implements EventListener {
-
- protected transient MailProducer mailProducer;
-
- private static final long serialVersionUID = 1L;
-
- public void notify(EventListenerExecution execution) throws Exception {
- // find current task
- EnvironmentImpl environment = EnvironmentImpl.getCurrent();
- DbSession dbSession = environment.get(DbSession.class);
- TaskImpl task = dbSession.findTaskByExecution(execution);
-
- // make task available to mail templates through task context
- TaskContext taskContext = new TaskContext(task);
- environment.setContext(taskContext);
- try {
- Collection<Message> messages = mailProducer.produce(execution);
- environment.get(MailSession.class).send(messages);
- } finally {
- environment.removeContext(taskContext);
- }
- }
-
- public void setMailProducer(MailProducer mailProducer) {
- this.mailProducer = mailProducer;
- }
-
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailListener.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailListener.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailListener.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.activities;
+
+import java.util.Collection;
+
+import javax.mail.Message;
+
+import org.jbpm.api.listener.EventListener;
+import org.jbpm.api.listener.EventListenerExecution;
+import org.jbpm.pvm.internal.email.spi.MailProducer;
+import org.jbpm.pvm.internal.email.spi.MailSession;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.env.TaskContext;
+import org.jbpm.pvm.internal.session.DbSession;
+import org.jbpm.pvm.internal.task.TaskImpl;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class MailListener implements EventListener {
+
+ protected transient MailProducer mailProducer;
+
+ private static final long serialVersionUID = 1L;
+
+ public void notify(EventListenerExecution execution) throws Exception {
+ // find current task
+ EnvironmentImpl environment = EnvironmentImpl.getCurrent();
+ DbSession dbSession = environment.get(DbSession.class);
+ TaskImpl task = dbSession.findTaskByExecution(execution);
+
+ // make task available to mail templates through task context
+ TaskContext taskContext = new TaskContext(task);
+ environment.setContext(taskContext);
+ try {
+ Collection<Message> messages = mailProducer.produce(execution);
+ environment.get(MailSession.class).send(messages);
+ } finally {
+ environment.removeContext(taskContext);
+ }
+ }
+
+ public void setMailProducer(MailProducer mailProducer) {
+ this.mailProducer = mailProducer;
+ }
+
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ScriptActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ScriptActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ScriptActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,59 +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.jpdl.internal.v40.activities;
-
-import org.jbpm.api.model.OpenExecution;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.script.ScriptManager;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ScriptActivity extends JpdlAutomaticActivity {
-
- private static final long serialVersionUID = 1L;
-
- protected String script;
- protected String language;
- protected String variableName;
-
- public void perform(OpenExecution execution) {
- ScriptManager scriptManager = EnvironmentImpl.getFromCurrent(ScriptManager.class);
- Object returnValue = scriptManager.evaluateScript(script, language);
-
- if (variableName!=null) {
- execution.setVariable(variableName, returnValue);
- }
- }
-
- public void setScript(String script) {
- this.script = script;
- }
- public void setLanguage(String language) {
- this.language = language;
- }
- public void setVariableName(String variableName) {
- this.variableName = variableName;
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ScriptActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ScriptActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ScriptActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,59 @@
+/*
+ * 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.jpdl.internal.v40.activities;
+
+import org.jbpm.api.model.OpenExecution;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.script.ScriptManager;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ScriptActivity extends JpdlAutomaticActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String script;
+ protected String language;
+ protected String variableName;
+
+ public void perform(OpenExecution execution) {
+ ScriptManager scriptManager = EnvironmentImpl.getFromCurrent(ScriptManager.class);
+ Object returnValue = scriptManager.evaluateScript(script, language);
+
+ if (variableName!=null) {
+ execution.setVariable(variableName, returnValue);
+ }
+ }
+
+ public void setScript(String script) {
+ this.script = script;
+ }
+ public void setLanguage(String language) {
+ this.language = language;
+ }
+ public void setVariableName(String variableName) {
+ this.variableName = variableName;
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SqlActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SqlActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SqlActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,37 +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.jpdl.internal.v40.activities;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-
-/**
- * @author Tom Baeyens
- */
-public class SqlActivity extends HqlActivity {
-
- private static final long serialVersionUID = 1L;
-
- protected Query createQuery(Session session) {
- return session.createSQLQuery(query);
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SqlActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SqlActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SqlActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,37 @@
+/*
+ * 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.jpdl.internal.v40.activities;
+
+import org.hibernate.Query;
+import org.hibernate.Session;
+
+/**
+ * @author Tom Baeyens
+ */
+public class SqlActivity extends HqlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Query createQuery(Session session) {
+ return session.createSQLQuery(query);
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StartActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StartActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StartActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.v40.activities;
-
-import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.pvm.internal.task.FormBehaviour;
-
-
-/**
- * @author Tom Baeyens
- */
-public class StartActivity extends JpdlActivity implements FormBehaviour {
-
- private static final long serialVersionUID = 1L;
-
- String formResourceName;
-
- public void execute(ActivityExecution execution) {
- }
-
- public String getFormResourceName() {
- return formResourceName;
- }
- public void setFormResourceName(String formResourceName) {
- this.formResourceName = formResourceName;
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StartActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StartActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StartActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -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.jpdl.internal.v40.activities;
+
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.pvm.internal.task.FormBehaviour;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class StartActivity extends JpdlActivity implements FormBehaviour {
+
+ private static final long serialVersionUID = 1L;
+
+ String formResourceName;
+
+ public void execute(ActivityExecution execution) {
+ }
+
+ public String getFormResourceName() {
+ return formResourceName;
+ }
+ public void setFormResourceName(String formResourceName) {
+ this.formResourceName = formResourceName;
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StateActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StateActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StateActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,78 +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.jpdl.internal.v40.activities;
-
-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;
-
-/**
- * @author Tom Baeyens
- */
-public class StateActivity extends JpdlExternalActivity {
-
- 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) 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);
-
- 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();
- }
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StateActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StateActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StateActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -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.jpdl.internal.v40.activities;
+
+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;
+
+/**
+ * @author Tom Baeyens
+ */
+public class StateActivity extends JpdlExternalActivity {
+
+ 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) 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);
+
+ 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();
+ }
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,185 +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.jpdl.internal.v40.activities;
-
-import java.util.List;
-import java.util.Map;
-
-import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.pvm.internal.client.ClientProcessDefinition;
-import org.jbpm.pvm.internal.env.Context;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.env.ExecutionContext;
-import org.jbpm.pvm.internal.model.Activity;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.script.ScriptManager;
-import org.jbpm.pvm.internal.session.RepositorySession;
-import org.jbpm.pvm.internal.task.SwimlaneImpl;
-
-
-/**
- * @author Tom Baeyens
- */
-public class SubProcessActivity extends JpdlExternalActivity {
-
- private static final long serialVersionUID = 1L;
-
- protected String subProcessKey;
- protected String subProcessId;
- protected Map<String, String> swimlaneMappings;
-
- protected List<SubProcessInParameterImpl> inParameters;
- protected List<SubProcessOutParameterImpl> outParameters;
-
- protected String outcomeExpression;
- protected Map<Object, String> outcomeVariableMappings;
-
- public void execute(ActivityExecution execution) {
- ExecutionImpl executionImpl = (ExecutionImpl) execution;
-
- RepositorySession repositorySession = EnvironmentImpl.getFromCurrent(RepositorySession.class);
-
- ClientProcessDefinition processDefinition = null;
-
- if (subProcessId!=null) {
- processDefinition = repositorySession.findProcessDefinitionById(subProcessId);
- } else {
- processDefinition = repositorySession.findProcessDefinitionByKey(subProcessKey);
- }
-
- ExecutionImpl subProcessInstance = (ExecutionImpl) processDefinition.createProcessInstance(null, execution);
-
- for (String swimlaneName: swimlaneMappings.keySet()) {
- String subSwimlaneName = swimlaneMappings.get(swimlaneName);
- SwimlaneImpl subSwimlane = subProcessInstance.createSwimlane(subSwimlaneName);
- SwimlaneImpl swimlane = executionImpl.getSwimlane(swimlaneName);
- if (swimlane!=null) {
- subSwimlane.initialize(swimlane);
- }
- }
-
- for (SubProcessInParameterImpl inParameter: inParameters) {
- inParameter.produce(executionImpl, subProcessInstance);
- }
-
- executionImpl.historyActivityStart();
-
- subProcessInstance.start();
- 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 {
- ExecutionImpl executionImpl = (ExecutionImpl) execution;
-
- ExecutionImpl subProcessInstance = executionImpl.getSubProcessInstance();
-
- String transitionName = null;
-
- ExecutionContext originalExecutionContext = null;
- ExecutionContext subProcessExecutionContext = null;
- EnvironmentImpl environment = EnvironmentImpl.getCurrent();
- if (environment!=null) {
- originalExecutionContext = (ExecutionContext) environment.removeContext(Context.CONTEXTNAME_EXECUTION);
- subProcessExecutionContext = new ExecutionContext((ExecutionImpl) subProcessInstance);
- environment.setContext(subProcessExecutionContext);
- }
-
- try {
- subProcessInstance.setSuperProcessExecution(null);
- executionImpl.setSubProcessInstance(null);
-
-
- for (SubProcessOutParameterImpl outParameter: outParameters) {
- outParameter.consume(executionImpl, subProcessInstance);
- }
-
- Activity activity = execution.getActivity();
- String subProcessActivityName = subProcessInstance.getActivityName();
-
- if (outcomeExpression!=null) {
- ScriptManager scriptManager = EnvironmentImpl.getFromCurrent(ScriptManager.class);
- Object value = scriptManager.evaluateExpression(outcomeExpression, null);
- // if the value is a String and matches the name of an outgoing transition
- if ( (value instanceof String)
- && (activity.hasOutgoingTransition(((String) value)))
- ) {
- // then take that one
- transitionName = (String) value;
- } else {
- // else see if there is a value mapping
- transitionName = outcomeVariableMappings.get(value);
- }
-
- } else if (activity.hasOutgoingTransition(subProcessActivityName)) {
- transitionName = subProcessActivityName;
- }
-
- } finally {
- if (subProcessExecutionContext!=null) {
- environment.removeContext(subProcessExecutionContext);
- }
- if (originalExecutionContext!=null) {
- environment.setContext(originalExecutionContext);
- }
- }
-
- executionImpl.historyActivityEnd();
-
- if (transitionName!=null) {
- execution.take(transitionName);
- } else {
- execution.takeDefaultTransition();
- }
- }
-
- public void setSwimlaneMappings(Map<String, String> swimlaneMappings) {
- this.swimlaneMappings = swimlaneMappings;
- }
- public void setOutcomeVariableMappings(Map<Object, String> outcomeVariableMappings) {
- this.outcomeVariableMappings = outcomeVariableMappings;
- }
- public void setSubProcessKey(String subProcessKey) {
- this.subProcessKey = subProcessKey;
- }
- public void setSubProcessId(String subProcessId) {
- this.subProcessId = subProcessId;
- }
- public void setOutcomeExpression(String outcomeExpression) {
- this.outcomeExpression = outcomeExpression;
- }
- public List<SubProcessInParameterImpl> getInParameters() {
- return inParameters;
- }
- public void setInParameters(List<SubProcessInParameterImpl> inParameters) {
- this.inParameters = inParameters;
- }
- public List<SubProcessOutParameterImpl> getOutParameters() {
- return outParameters;
- }
- public void setOutParameters(List<SubProcessOutParameterImpl> outParameters) {
- this.outParameters = outParameters;
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,185 @@
+/*
+ * 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.jpdl.internal.v40.activities;
+
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.pvm.internal.client.ClientProcessDefinition;
+import org.jbpm.pvm.internal.env.Context;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.env.ExecutionContext;
+import org.jbpm.pvm.internal.model.Activity;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.script.ScriptManager;
+import org.jbpm.pvm.internal.session.RepositorySession;
+import org.jbpm.pvm.internal.task.SwimlaneImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SubProcessActivity extends JpdlExternalActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String subProcessKey;
+ protected String subProcessId;
+ protected Map<String, String> swimlaneMappings;
+
+ protected List<SubProcessInParameterImpl> inParameters;
+ protected List<SubProcessOutParameterImpl> outParameters;
+
+ protected String outcomeExpression;
+ protected Map<Object, String> outcomeVariableMappings;
+
+ public void execute(ActivityExecution execution) {
+ ExecutionImpl executionImpl = (ExecutionImpl) execution;
+
+ RepositorySession repositorySession = EnvironmentImpl.getFromCurrent(RepositorySession.class);
+
+ ClientProcessDefinition processDefinition = null;
+
+ if (subProcessId!=null) {
+ processDefinition = repositorySession.findProcessDefinitionById(subProcessId);
+ } else {
+ processDefinition = repositorySession.findProcessDefinitionByKey(subProcessKey);
+ }
+
+ ExecutionImpl subProcessInstance = (ExecutionImpl) processDefinition.createProcessInstance(null, execution);
+
+ for (String swimlaneName: swimlaneMappings.keySet()) {
+ String subSwimlaneName = swimlaneMappings.get(swimlaneName);
+ SwimlaneImpl subSwimlane = subProcessInstance.createSwimlane(subSwimlaneName);
+ SwimlaneImpl swimlane = executionImpl.getSwimlane(swimlaneName);
+ if (swimlane!=null) {
+ subSwimlane.initialize(swimlane);
+ }
+ }
+
+ for (SubProcessInParameterImpl inParameter: inParameters) {
+ inParameter.produce(executionImpl, subProcessInstance);
+ }
+
+ executionImpl.historyActivityStart();
+
+ subProcessInstance.start();
+ 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 {
+ ExecutionImpl executionImpl = (ExecutionImpl) execution;
+
+ ExecutionImpl subProcessInstance = executionImpl.getSubProcessInstance();
+
+ String transitionName = null;
+
+ ExecutionContext originalExecutionContext = null;
+ ExecutionContext subProcessExecutionContext = null;
+ EnvironmentImpl environment = EnvironmentImpl.getCurrent();
+ if (environment!=null) {
+ originalExecutionContext = (ExecutionContext) environment.removeContext(Context.CONTEXTNAME_EXECUTION);
+ subProcessExecutionContext = new ExecutionContext((ExecutionImpl) subProcessInstance);
+ environment.setContext(subProcessExecutionContext);
+ }
+
+ try {
+ subProcessInstance.setSuperProcessExecution(null);
+ executionImpl.setSubProcessInstance(null);
+
+
+ for (SubProcessOutParameterImpl outParameter: outParameters) {
+ outParameter.consume(executionImpl, subProcessInstance);
+ }
+
+ Activity activity = execution.getActivity();
+ String subProcessActivityName = subProcessInstance.getActivityName();
+
+ if (outcomeExpression!=null) {
+ ScriptManager scriptManager = EnvironmentImpl.getFromCurrent(ScriptManager.class);
+ Object value = scriptManager.evaluateExpression(outcomeExpression, null);
+ // if the value is a String and matches the name of an outgoing transition
+ if ( (value instanceof String)
+ && (activity.hasOutgoingTransition(((String) value)))
+ ) {
+ // then take that one
+ transitionName = (String) value;
+ } else {
+ // else see if there is a value mapping
+ transitionName = outcomeVariableMappings.get(value);
+ }
+
+ } else if (activity.hasOutgoingTransition(subProcessActivityName)) {
+ transitionName = subProcessActivityName;
+ }
+
+ } finally {
+ if (subProcessExecutionContext!=null) {
+ environment.removeContext(subProcessExecutionContext);
+ }
+ if (originalExecutionContext!=null) {
+ environment.setContext(originalExecutionContext);
+ }
+ }
+
+ executionImpl.historyActivityEnd();
+
+ if (transitionName!=null) {
+ execution.take(transitionName);
+ } else {
+ execution.takeDefaultTransition();
+ }
+ }
+
+ public void setSwimlaneMappings(Map<String, String> swimlaneMappings) {
+ this.swimlaneMappings = swimlaneMappings;
+ }
+ public void setOutcomeVariableMappings(Map<Object, String> outcomeVariableMappings) {
+ this.outcomeVariableMappings = outcomeVariableMappings;
+ }
+ public void setSubProcessKey(String subProcessKey) {
+ this.subProcessKey = subProcessKey;
+ }
+ public void setSubProcessId(String subProcessId) {
+ this.subProcessId = subProcessId;
+ }
+ public void setOutcomeExpression(String outcomeExpression) {
+ this.outcomeExpression = outcomeExpression;
+ }
+ public List<SubProcessInParameterImpl> getInParameters() {
+ return inParameters;
+ }
+ public void setInParameters(List<SubProcessInParameterImpl> inParameters) {
+ this.inParameters = inParameters;
+ }
+ public List<SubProcessOutParameterImpl> getOutParameters() {
+ return outParameters;
+ }
+ public void setOutParameters(List<SubProcessOutParameterImpl> outParameters) {
+ this.outParameters = outParameters;
+ }
+}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessInParameterImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessInParameterImpl.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessInParameterImpl.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.activities;
+
+import org.jbpm.pvm.internal.env.EnvironmentDefaults;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.script.ScriptManager;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SubProcessInParameterImpl extends SubProcessParameterImpl {
+
+ private static final long serialVersionUID = 1L;
+
+ public void produce(ExecutionImpl superExecution, ExecutionImpl subProcessInstance) {
+ Object value = null;
+ if (variableName!=null) {
+ value = superExecution.getVariable(variableName);
+ } else {
+ ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
+ value = scriptManager.evaluateExpression(expression, language);
+ }
+
+ subProcessInstance.setVariable(subVariableName, value);
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessInParameterImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessOutParameterImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessOutParameterImpl.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessOutParameterImpl.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,49 @@
+/*
+ * 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.jpdl.internal.v40.activities;
+
+import org.jbpm.pvm.internal.env.EnvironmentDefaults;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.ScopeInstanceImpl;
+import org.jbpm.pvm.internal.script.ScriptManager;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SubProcessOutParameterImpl extends SubProcessParameterImpl {
+
+ private static final long serialVersionUID = 1L;
+
+ public void consume(ExecutionImpl superExecution, ScopeInstanceImpl subProcessInstance) {
+ Object value = null;
+
+ if (variableName!=null) {
+ value = subProcessInstance.getVariable(subVariableName);
+ } else {
+ ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
+ value = scriptManager.evaluateExpression(expression, language);
+ }
+
+ superExecution.setVariable(variableName, value);
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessOutParameterImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessParameterImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessParameterImpl.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessParameterImpl.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,63 @@
+/*
+ * 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.jpdl.internal.v40.activities;
+
+import java.io.Serializable;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SubProcessParameterImpl implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String subVariableName;
+ protected String variableName;
+ protected String expression;
+ protected String language;
+
+ public String getVariableName() {
+ return variableName;
+ }
+ public void setVariableName(String variable) {
+ this.variableName = variable;
+ }
+ public String getExpression() {
+ return expression;
+ }
+ public void setExpression(String expression) {
+ this.expression = expression;
+ }
+ public String getLanguage() {
+ return language;
+ }
+ public void setLanguage(String language) {
+ this.language = language;
+ }
+ public String getSubVariableName() {
+ return subVariableName;
+ }
+ public void setSubVariableName(String name) {
+ this.subVariableName = name;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessParameterImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/TaskActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/TaskActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/TaskActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,151 +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.jpdl.internal.v40.activities;
-
-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.EnvironmentImpl;
-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 JpdlExternalActivity {
-
- 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 = EnvironmentImpl.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 = EnvironmentImpl
- .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;
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/TaskActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/TaskActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/TaskActivity.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -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.jpdl.internal.v40.activities;
+
+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.EnvironmentImpl;
+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 JpdlExternalActivity {
+
+ 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 = EnvironmentImpl.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 = EnvironmentImpl
+ .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;
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/CustomBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/CustomBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/CustomBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,52 +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.jpdl.internal.v40.bindings;
-
-import org.jbpm.api.activity.ActivityBehaviour;
-import org.jbpm.pvm.internal.wire.WireContext;
-import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class CustomBinding extends JpdlBinding {
-
- static ObjectBinding objectBinding = new ObjectBinding();
-
- public CustomBinding() {
- super("custom");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- CustomActivity customActivity = new CustomActivity();
- ObjectDescriptor descriptor = (ObjectDescriptor)
- objectBinding.parse(element, parse, wireParser);
- ActivityBehaviour customActivityBehaviour = (ActivityBehaviour) WireContext.create(descriptor);
- customActivity.setCustomBehaviour(customActivityBehaviour);
- return customActivity;
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/CustomBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/CustomBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/CustomBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,53 @@
+/*
+ * 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.jpdl.internal.v40.bindings;
+
+import org.jbpm.api.activity.ActivityBehaviour;
+import org.jbpm.jpdl.internal.v40.activities.CustomActivity;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CustomBinding extends JpdlBinding {
+
+ static ObjectBinding objectBinding = new ObjectBinding();
+
+ public CustomBinding() {
+ super("custom");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ CustomActivity customActivity = new CustomActivity();
+ ObjectDescriptor descriptor = (ObjectDescriptor)
+ objectBinding.parse(element, parse, wireParser);
+ ActivityBehaviour customActivityBehaviour = (ActivityBehaviour) WireContext.create(descriptor);
+ customActivity.setCustomBehaviour(customActivityBehaviour);
+ return customActivity;
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/DecisionBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/DecisionBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/DecisionBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,117 +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.jpdl.internal.v40.bindings;
-
-import java.util.List;
-
-import org.jbpm.api.jpdl.DecisionHandler;
-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.WireContext;
-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 JpdlBinding {
-
- static ObjectBinding objectBinding = new ObjectBinding();
- static WireParser wireParser = WireParser.getInstance();
-
- public DecisionBinding() {
- super("decision");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- if (element.hasAttribute("expr")) {
- DecisionExpressionActivity decisionExpressionActivity = new DecisionExpressionActivity();
- String expr = element.getAttribute("expr");
- decisionExpressionActivity.setExpr(expr);
- return decisionExpressionActivity;
- }
-
- if (element.hasAttribute("handler-ref")) {
- String decisionHandlerName = element.getAttribute("handler-ref");
- DecisionHandlerActivity decisionHandlerActivity = new DecisionHandlerActivity();
- decisionHandlerActivity.setDecisionHandlerName(decisionHandlerName);
- return decisionHandlerActivity;
- }
-
- Element handlerElement = XmlUtil.element(element, "handler");
- if (handlerElement!=null) {
- DecisionHandlerActivity decisionHandlerActivity = new DecisionHandlerActivity();
- ObjectDescriptor decisionHandlerDescriptor = (ObjectDescriptor)
- objectBinding.parse(handlerElement, parse, wireParser);
- DecisionHandler decisionHandler = (DecisionHandler) WireContext.create(decisionHandlerDescriptor);
- decisionHandlerActivity.setDecisionHandler(decisionHandler);
- return decisionHandlerActivity;
- }
-
- 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;
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/DecisionBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/DecisionBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/DecisionBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -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.jpdl.internal.v40.bindings;
+
+import java.util.List;
+
+import org.jbpm.api.jpdl.DecisionHandler;
+import org.jbpm.jpdl.internal.v40.activities.DecisionConditionActivity;
+import org.jbpm.jpdl.internal.v40.activities.DecisionExpressionActivity;
+import org.jbpm.jpdl.internal.v40.activities.DecisionHandlerActivity;
+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.WireContext;
+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 JpdlBinding {
+
+ static ObjectBinding objectBinding = new ObjectBinding();
+ static WireParser wireParser = WireParser.getInstance();
+
+ public DecisionBinding() {
+ super("decision");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ if (element.hasAttribute("expr")) {
+ DecisionExpressionActivity decisionExpressionActivity = new DecisionExpressionActivity();
+ String expr = element.getAttribute("expr");
+ decisionExpressionActivity.setExpr(expr);
+ return decisionExpressionActivity;
+ }
+
+ if (element.hasAttribute("handler-ref")) {
+ String decisionHandlerName = element.getAttribute("handler-ref");
+ DecisionHandlerActivity decisionHandlerActivity = new DecisionHandlerActivity();
+ decisionHandlerActivity.setDecisionHandlerName(decisionHandlerName);
+ return decisionHandlerActivity;
+ }
+
+ Element handlerElement = XmlUtil.element(element, "handler");
+ if (handlerElement!=null) {
+ DecisionHandlerActivity decisionHandlerActivity = new DecisionHandlerActivity();
+ ObjectDescriptor decisionHandlerDescriptor = (ObjectDescriptor)
+ objectBinding.parse(handlerElement, parse, wireParser);
+ DecisionHandler decisionHandler = (DecisionHandler) WireContext.create(decisionHandlerDescriptor);
+ decisionHandlerActivity.setDecisionHandler(decisionHandler);
+ return decisionHandlerActivity;
+ }
+
+ 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;
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,59 +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.jpdl.internal.v40.bindings;
-
-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;
-
-
-/**
- * @author Tom Baeyens
- */
-public class EndBinding extends JpdlBinding {
-
- public EndBinding() {
- super("end");
- }
-
- protected EndBinding(String tag) {
- super(tag);
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
-
- boolean endProcessInstance = true;
- String ends = XmlUtil.attribute(element, "ends", false, parse);
- if ("execution".equalsIgnoreCase(ends)) {
- endProcessInstance = false;
- }
-
- String state = XmlUtil.attribute(element, "state", false, parse);
-
- EndActivity endActivity = new EndActivity();
- endActivity.setEndProcessInstance(endProcessInstance);
- endActivity.setState(state);
-
- return endActivity;
- }
-}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndCancelBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndCancelBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndCancelBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,43 +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.jpdl.internal.v40.bindings;
-
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class EndCancelBinding extends EndBinding {
-
- public EndCancelBinding() {
- super("end-cancel");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- EndActivity endActivity = (EndActivity) super.parse(element, parse, parser);
- endActivity.setState("cancel");
- return endActivity;
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndCancelBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndCancelBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndCancelBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,45 @@
+/*
+ * 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.jpdl.internal.v40.bindings;
+
+import org.jbpm.jpdl.internal.v40.activities.EndActivity;
+import org.jbpm.jpdl.internal.v40.activities.EndBinding;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EndCancelBinding extends EndBinding {
+
+ public EndCancelBinding() {
+ super("end-cancel");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ EndActivity endActivity = (EndActivity) super.parse(element, parse, parser);
+ endActivity.setState("cancel");
+ return endActivity;
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndErrorBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndErrorBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndErrorBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,43 +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.jpdl.internal.v40.bindings;
-
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class EndErrorBinding extends EndBinding {
-
- public EndErrorBinding() {
- super("end-error");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- EndActivity endActivity = (EndActivity) super.parse(element, parse, parser);
- endActivity.setState("error");
- return endActivity;
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndErrorBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndErrorBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndErrorBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,45 @@
+/*
+ * 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.jpdl.internal.v40.bindings;
+
+import org.jbpm.jpdl.internal.v40.activities.EndActivity;
+import org.jbpm.jpdl.internal.v40.activities.EndBinding;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EndErrorBinding extends EndBinding {
+
+ public EndErrorBinding() {
+ super("end-error");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ EndActivity endActivity = (EndActivity) super.parse(element, parse, parser);
+ endActivity.setState("error");
+ return endActivity;
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EventListenerBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EventListenerBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EventListenerBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.v40.bindings;
-
-import org.jbpm.api.listener.EventListener;
-import org.jbpm.jpdl.internal.xml.JpdlParser;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.WireContext;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class EventListenerBinding extends JpdlBinding {
-
- public EventListenerBinding() {
- super("event-listener");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- Descriptor descriptor = JpdlParser.parseObjectDescriptor(element, parse);
- EventListener eventListener = (EventListener) WireContext.create(descriptor);
- return eventListener;
- }
-
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EventListenerBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EventListenerBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EventListenerBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.bindings;
+
+import org.jbpm.api.listener.EventListener;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EventListenerBinding extends JpdlBinding {
+
+ public EventListenerBinding() {
+ super("event-listener");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ Descriptor descriptor = JpdlParser.parseObjectDescriptor(element, parse);
+ EventListener eventListener = (EventListener) WireContext.create(descriptor);
+ return eventListener;
+ }
+
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ForkBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ForkBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ForkBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,42 +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.jpdl.internal.v40.bindings;
-
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ForkBinding extends JpdlBinding {
-
- public ForkBinding() {
- super("fork");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- return new ForkActivity();
- }
-
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ForkBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ForkBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ForkBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.bindings;
+
+import org.jbpm.jpdl.internal.v40.activities.ForkActivity;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ForkBinding extends JpdlBinding {
+
+ public ForkBinding() {
+ super("fork");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ return new ForkActivity();
+ }
+
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/GroupBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/GroupBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/GroupBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.v40.bindings;
-
-import org.jbpm.jpdl.internal.xml.JpdlParser;
-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;
-
-
-/**
- * @author Tom Baeyens
- */
-public class GroupBinding extends JpdlBinding {
-
- public GroupBinding() {
- super("group");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- GroupActivity groupActivity = new GroupActivity();
-
- ActivityImpl activity = parse.findObject(ActivityImpl.class);
-
- JpdlParser jpdlParser = (JpdlParser) parser;
- jpdlParser.parseActivities(element, parse, activity);
-
- return groupActivity;
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/GroupBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/GroupBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/GroupBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -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.jpdl.internal.v40.bindings;
+
+import org.jbpm.jpdl.internal.v40.activities.GroupActivity;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
+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;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class GroupBinding extends JpdlBinding {
+
+ public GroupBinding() {
+ super("group");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ GroupActivity groupActivity = new GroupActivity();
+
+ ActivityImpl activity = parse.findObject(ActivityImpl.class);
+
+ JpdlParser jpdlParser = (JpdlParser) parser;
+ jpdlParser.parseActivities(element, parse, activity);
+
+ return groupActivity;
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/HqlBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/HqlBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/HqlBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,88 +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.jpdl.internal.v40.bindings;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ListDescriptor;
-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 HqlBinding extends JpdlBinding {
-
- public static final String TAG = "hql";
-
- public HqlBinding() {
- super(TAG);
- }
-
- protected HqlBinding(String tagName) {
- super(tagName);
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- HqlActivity hqlActivity = createHqlActivity();
-
- Element queryElement = XmlUtil.element(element, "query", true, parse);
- if (queryElement!=null) {
- String query = XmlUtil.getContentText(queryElement);
- hqlActivity.setQuery(query);
- }
-
- if (XmlUtil.attributeBoolean(element, "unique", false, parse, Boolean.FALSE)) {
- hqlActivity.setResultUnique(true);
- }
-
- String variableName = XmlUtil.attribute(element, "var", true, parse);
- hqlActivity.setResultVariableName(variableName);
-
- Element parametersElement = XmlUtil.element(element, "parameters");
- List<Element> paramElements = XmlUtil.elements(parametersElement);
- if (!paramElements.isEmpty()) {
- List<Descriptor> parametersDescriptor = new ArrayList<Descriptor>();
- for (Element paramElement: paramElements) {
- WireParser wireParser = WireParser.getInstance();
- Descriptor paramDescriptor = (Descriptor) wireParser.parseElement(paramElement, parse, WireParser.CATEGORY_DESCRIPTOR);
- parametersDescriptor.add(paramDescriptor);
- }
-
- ListDescriptor parametersListDescriptor = new ListDescriptor();
- parametersListDescriptor.setValueDescriptors(parametersDescriptor);
- hqlActivity.setParametersDescriptor(parametersListDescriptor);
- }
-
- return hqlActivity;
- }
-
- protected HqlActivity createHqlActivity() {
- return new HqlActivity();
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/HqlBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/HqlBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/HqlBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,89 @@
+/*
+ * 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.jpdl.internal.v40.bindings;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.jpdl.internal.v40.activities.HqlActivity;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ListDescriptor;
+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 HqlBinding extends JpdlBinding {
+
+ public static final String TAG = "hql";
+
+ public HqlBinding() {
+ super(TAG);
+ }
+
+ protected HqlBinding(String tagName) {
+ super(tagName);
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ HqlActivity hqlActivity = createHqlActivity();
+
+ Element queryElement = XmlUtil.element(element, "query", true, parse);
+ if (queryElement!=null) {
+ String query = XmlUtil.getContentText(queryElement);
+ hqlActivity.setQuery(query);
+ }
+
+ if (XmlUtil.attributeBoolean(element, "unique", false, parse, Boolean.FALSE)) {
+ hqlActivity.setResultUnique(true);
+ }
+
+ String variableName = XmlUtil.attribute(element, "var", true, parse);
+ hqlActivity.setResultVariableName(variableName);
+
+ Element parametersElement = XmlUtil.element(element, "parameters");
+ List<Element> paramElements = XmlUtil.elements(parametersElement);
+ if (!paramElements.isEmpty()) {
+ List<Descriptor> parametersDescriptor = new ArrayList<Descriptor>();
+ for (Element paramElement: paramElements) {
+ WireParser wireParser = WireParser.getInstance();
+ Descriptor paramDescriptor = (Descriptor) wireParser.parseElement(paramElement, parse, WireParser.CATEGORY_DESCRIPTOR);
+ parametersDescriptor.add(paramDescriptor);
+ }
+
+ ListDescriptor parametersListDescriptor = new ListDescriptor();
+ parametersListDescriptor.setValueDescriptors(parametersDescriptor);
+ hqlActivity.setParametersDescriptor(parametersListDescriptor);
+ }
+
+ return hqlActivity;
+ }
+
+ protected HqlActivity createHqlActivity() {
+ return new HqlActivity();
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JavaBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JavaBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JavaBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,81 +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.jpdl.internal.v40.bindings;
-
-import java.util.List;
-
-import org.jbpm.jpdl.internal.xml.JpdlParser;
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.WireContext;
-import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.wire.operation.InvokeOperation;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class JavaBinding extends JpdlBinding {
-
- public static final String TAG = "java";
-
- public JavaBinding() {
- super(TAG);
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- JavaActivity javaActivity = new JavaActivity();
-
- String methodName = XmlUtil.attribute(element, "method", 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);
- Object target = WireContext.create(objectDescriptor);
- javaActivity.setTarget(target);
-
- } 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 javaActivity;
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JavaBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JavaBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JavaBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.bindings;
+
+import java.util.List;
+
+import org.jbpm.jpdl.internal.v40.activities.JavaActivity;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.wire.operation.InvokeOperation;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JavaBinding extends JpdlBinding {
+
+ public static final String TAG = "java";
+
+ public JavaBinding() {
+ super(TAG);
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ JavaActivity javaActivity = new JavaActivity();
+
+ String methodName = XmlUtil.attribute(element, "method", 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);
+ Object target = WireContext.create(objectDescriptor);
+ javaActivity.setTarget(target);
+
+ } 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 javaActivity;
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JoinBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JoinBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JoinBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,69 +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.jpdl.internal.v40.bindings;
-
-import org.hibernate.LockMode;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class JoinBinding extends JpdlBinding {
-
- private static final String MULTIPLICITY = "multiplicity";
-
- private static final String LOCKMODE = "lockmode";
-
- public JoinBinding() {
- super("join");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- JoinActivity joinActivity = new JoinActivity();
-
- if (element.hasAttribute(MULTIPLICITY)) {
- String multiplicictyText = element.getAttribute(MULTIPLICITY);
- try {
- int multiplicity = Integer.parseInt(multiplicictyText);
- joinActivity.setMultiplicity(multiplicity);
- } catch (NumberFormatException e) {
- parse.addProblem(MULTIPLICITY + " " + multiplicictyText + " is not a valid integer", element);
- }
- }
-
- if (element.hasAttribute(LOCKMODE)) {
- String lockModeText = element.getAttribute(LOCKMODE);
- LockMode lockMode = LockMode.parse(lockModeText.toUpperCase());
- if (lockMode==null) {
- parse.addProblem(LOCKMODE + " " + lockModeText + " is not a valid lock mode", element);
- } else {
- joinActivity.setLockMode(lockMode);
- }
- }
-
- return joinActivity;
- }
-
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JoinBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JoinBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JoinBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,70 @@
+/*
+ * 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.jpdl.internal.v40.bindings;
+
+import org.hibernate.LockMode;
+import org.jbpm.jpdl.internal.v40.activities.JoinActivity;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JoinBinding extends JpdlBinding {
+
+ private static final String MULTIPLICITY = "multiplicity";
+
+ private static final String LOCKMODE = "lockmode";
+
+ public JoinBinding() {
+ super("join");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ JoinActivity joinActivity = new JoinActivity();
+
+ if (element.hasAttribute(MULTIPLICITY)) {
+ String multiplicictyText = element.getAttribute(MULTIPLICITY);
+ try {
+ int multiplicity = Integer.parseInt(multiplicictyText);
+ joinActivity.setMultiplicity(multiplicity);
+ } catch (NumberFormatException e) {
+ parse.addProblem(MULTIPLICITY + " " + multiplicictyText + " is not a valid integer", element);
+ }
+ }
+
+ if (element.hasAttribute(LOCKMODE)) {
+ String lockModeText = element.getAttribute(LOCKMODE);
+ LockMode lockMode = LockMode.parse(lockModeText.toUpperCase());
+ if (lockMode==null) {
+ parse.addProblem(LOCKMODE + " " + lockModeText + " is not a valid lock mode", element);
+ } else {
+ joinActivity.setLockMode(lockMode);
+ }
+ }
+
+ return joinActivity;
+ }
+
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JpdlBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JpdlBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JpdlBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,93 +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.jpdl.internal.v40.bindings;
-
-
-import java.util.List;
-
-import org.jbpm.api.model.Event;
-import org.jbpm.jpdl.internal.xml.JpdlParser;
-import org.jbpm.jpdl.internal.xml.UnresolvedTransitions;
-import org.jbpm.pvm.internal.model.ActivityImpl;
-import org.jbpm.pvm.internal.model.TimerDefinitionImpl;
-import org.jbpm.pvm.internal.model.TransitionImpl;
-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.Parse;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public abstract class JpdlBinding extends TagBinding {
-
- protected static final WireParser wireParser = JpdlParser.wireParser;
-
- public JpdlBinding(String tagName) {
- super(tagName, JpdlParser.JPDL_NAMESPACE, 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);
- }
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JpdlBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JpdlBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JpdlBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -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.jpdl.internal.v40.bindings;
+
+
+import java.util.List;
+
+import org.jbpm.api.model.Event;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.jpdl.internal.xml.UnresolvedTransitions;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.TimerDefinitionImpl;
+import org.jbpm.pvm.internal.model.TransitionImpl;
+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.Parse;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class JpdlBinding extends TagBinding {
+
+ protected static final WireParser wireParser = JpdlParser.wireParser;
+
+ public JpdlBinding(String tagName) {
+ super(tagName, JpdlParser.JPDL_NAMESPACE, 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);
+ }
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/MailBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/MailBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/MailBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,44 +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.jpdl.internal.v40.bindings;
-
-import org.w3c.dom.Element;
-
-import org.jbpm.jpdl.internal.xml.JpdlParser;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-
-/**
- * @author Alejandro Guizar
- */
-public class MailBinding extends JpdlBinding {
-
- public MailBinding() {
- super("mail");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- MailActivity activity = new MailActivity();
- activity.setMailProducer(JpdlParser.parseMailProducer(element, parse, null));
- return activity;
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/MailBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/MailBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/MailBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,45 @@
+/*
+ * 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.jpdl.internal.v40.bindings;
+
+import org.w3c.dom.Element;
+
+import org.jbpm.jpdl.internal.v40.activities.MailActivity;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class MailBinding extends JpdlBinding {
+
+ public MailBinding() {
+ super("mail");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ MailActivity activity = new MailActivity();
+ activity.setMailProducer(JpdlParser.parseMailProducer(element, parse, null));
+ return activity;
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ScriptBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ScriptBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ScriptBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,69 +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.jpdl.internal.v40.bindings;
-
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.script.ScriptManager;
-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;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ScriptBinding extends JpdlBinding {
-
- private static final String TAG = "script";
-
- public ScriptBinding() {
- super(TAG);
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- String language = null;
-
- String script = XmlUtil.attribute(element, "expr");
- Element textElement = XmlUtil.element(element, "text");
- if(script!=null) {
- ScriptManager scriptManager = EnvironmentImpl.getFromCurrent(ScriptManager.class);
- language = scriptManager.getDefaultExpressionLanguage();
- if (textElement!=null) {
- parse.addProblem("in <script ...> attribute expr can't be combined with a nexted text element", element);
- }
- } else {
- language = XmlUtil.attribute(element, "lang");
- script = XmlUtil.getContentText(textElement);
- }
-
- String variableName = XmlUtil.attribute(element, "var");
-
- ScriptActivity scriptActivity = new ScriptActivity();
- scriptActivity.setScript(script);
- scriptActivity.setLanguage(language);
- scriptActivity.setVariableName(variableName);
-
- return scriptActivity;
- }
-
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ScriptBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ScriptBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ScriptBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,70 @@
+/*
+ * 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.jpdl.internal.v40.bindings;
+
+import org.jbpm.jpdl.internal.v40.activities.ScriptActivity;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.script.ScriptManager;
+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;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ScriptBinding extends JpdlBinding {
+
+ private static final String TAG = "script";
+
+ public ScriptBinding() {
+ super(TAG);
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ String language = null;
+
+ String script = XmlUtil.attribute(element, "expr");
+ Element textElement = XmlUtil.element(element, "text");
+ if(script!=null) {
+ ScriptManager scriptManager = EnvironmentImpl.getFromCurrent(ScriptManager.class);
+ language = scriptManager.getDefaultExpressionLanguage();
+ if (textElement!=null) {
+ parse.addProblem("in <script ...> attribute expr can't be combined with a nexted text element", element);
+ }
+ } else {
+ language = XmlUtil.attribute(element, "lang");
+ script = XmlUtil.getContentText(textElement);
+ }
+
+ String variableName = XmlUtil.attribute(element, "var");
+
+ ScriptActivity scriptActivity = new ScriptActivity();
+ scriptActivity.setScript(script);
+ scriptActivity.setLanguage(language);
+ scriptActivity.setVariableName(variableName);
+
+ return scriptActivity;
+ }
+
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SqlBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SqlBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SqlBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,39 +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.jpdl.internal.v40.bindings;
-
-
-/**
- * @author Tom Baeyens
- */
-public class SqlBinding extends HqlBinding {
-
- public static final String TAG = "sql";
-
- public SqlBinding() {
- super(TAG);
- }
-
- protected HqlActivity createHqlActivity() {
- return new SqlActivity();
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SqlBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SqlBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SqlBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,42 @@
+/*
+ * 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.jpdl.internal.v40.bindings;
+
+import org.jbpm.jpdl.internal.v40.activities.HqlActivity;
+import org.jbpm.jpdl.internal.v40.activities.SqlActivity;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SqlBinding extends HqlBinding {
+
+ public static final String TAG = "sql";
+
+ public SqlBinding() {
+ super(TAG);
+ }
+
+ protected HqlActivity createHqlActivity() {
+ return new SqlActivity();
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StartBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StartBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StartBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.v40.bindings;
-
-import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
-import org.jbpm.pvm.internal.model.ActivityImpl;
-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;
-
-
-/**
- * @author Tom Baeyens
- */
-public class StartBinding extends JpdlBinding {
-
- public StartBinding() {
- super("start");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- ActivityImpl startActivity = parse.findObject(ActivityImpl.class);
- JpdlProcessDefinition processDefinition = parse.findObject(JpdlProcessDefinition.class);
-
- if (processDefinition.getInitial()==null) {
- processDefinition.setInitial(startActivity);
-
- } else if (startActivity.getParentActivity()==null) {
- parse.addProblem("multiple start events not yet supported", element);
- }
-
- StartActivity startActivityBehaviour = new StartActivity();
-
- startActivityBehaviour.setFormResourceName(XmlUtil.attribute(element, "form"));
-
- return startActivityBehaviour;
- }
-
- public boolean isNameRequired() {
- return false;
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StartBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StartBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StartBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,63 @@
+/*
+ * 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.jpdl.internal.v40.bindings;
+
+import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
+import org.jbpm.jpdl.internal.v40.activities.StartActivity;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+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;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class StartBinding extends JpdlBinding {
+
+ public StartBinding() {
+ super("start");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ ActivityImpl startActivity = parse.findObject(ActivityImpl.class);
+ JpdlProcessDefinition processDefinition = parse.findObject(JpdlProcessDefinition.class);
+
+ if (processDefinition.getInitial()==null) {
+ processDefinition.setInitial(startActivity);
+
+ } else if (startActivity.getParentActivity()==null) {
+ parse.addProblem("multiple start events not yet supported", element);
+ }
+
+ StartActivity startActivityBehaviour = new StartActivity();
+
+ startActivityBehaviour.setFormResourceName(XmlUtil.attribute(element, "form"));
+
+ return startActivityBehaviour;
+ }
+
+ public boolean isNameRequired() {
+ return false;
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StateBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StateBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StateBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,42 +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.jpdl.internal.v40.bindings;
-
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class StateBinding extends JpdlBinding {
-
- public StateBinding() {
- super("state");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- return new StateActivity();
- }
-
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StateBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StateBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StateBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.bindings;
+
+import org.jbpm.jpdl.internal.v40.activities.StateActivity;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class StateBinding extends JpdlBinding {
+
+ public StateBinding() {
+ super("state");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ return new StateActivity();
+ }
+
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SubProcessBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SubProcessBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SubProcessBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,164 +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.jpdl.internal.v40.bindings;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.WireContext;
-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 SubProcessBinding extends JpdlBinding {
-
- public SubProcessBinding() {
- super("sub-process");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- SubProcessActivity subProcessActivity = new SubProcessActivity();
-
- String subProcessKey = XmlUtil.attribute(element, "sub-process-key");
- subProcessActivity.setSubProcessKey(subProcessKey);
-
- String subProcessId = XmlUtil.attribute(element, "sub-process-id");
- subProcessActivity.setSubProcessId(subProcessId);
-
- List<SubProcessInParameterImpl> inParameters = new ArrayList<SubProcessInParameterImpl>();
- for (Element inElement: XmlUtil.elements(element, "parameter-in")) {
- SubProcessInParameterImpl inParameter = new SubProcessInParameterImpl();
- parseParameter(inElement, inParameter);
- inParameters.add(inParameter);
-
- if (inParameter.getSubVariableName()==null) {
- parse.addProblem("no 'subvar' specified for parameter-in", element);
- }
- if ( (inParameter.getExpression()==null)
- && (inParameter.getVariableName()==null)
- ) {
- parse.addProblem("no 'expr' or 'variable' specified for parameter-in '"+inParameter.getSubVariableName()+"'", element);
- }
- if ( (inParameter.getExpression()!=null)
- && (inParameter.getVariableName()!=null)
- ) {
- parse.addProblem("attributes 'expr' and 'variable' are mutually exclusive on parameter-in", element);
- }
- }
- subProcessActivity.setInParameters(inParameters);
-
- List<SubProcessOutParameterImpl> outParameters = new ArrayList<SubProcessOutParameterImpl>();
- for (Element outElement: XmlUtil.elements(element, "parameter-out")) {
- SubProcessOutParameterImpl outParameter = new SubProcessOutParameterImpl();
- parseParameter(outElement, outParameter);
- outParameters.add(outParameter);
-
- if (outParameter.getVariableName()==null) {
- parse.addProblem("no 'variable' specified for parameter-in", element);
- }
- if ( (outParameter.getExpression()==null)
- && (outParameter.getSubVariableName()==null)
- ) {
- parse.addProblem("no 'expr' or 'subvar' specified for parameter-out '"+outParameter.getVariableName()+"'", element);
- }
- if ( (outParameter.getExpression()!=null)
- && (outParameter.getSubVariableName()!=null)
- ) {
- parse.addProblem("attributes 'expr' and 'subvar' are mutually exclusive on parameter-out '"+outParameter.getVariableName()+"'", element);
- }
- }
- subProcessActivity.setOutParameters(outParameters);
-
- Map<String, String> swimlaneMappings = parseSwimlaneMappings(element, parse);
- subProcessActivity.setSwimlaneMappings(swimlaneMappings);
-
- Map<Object, String> outcomeVariableMappings = new HashMap<Object, String>();
-
- String outcomeExpression = XmlUtil.attribute(element, "outcome");
- if (outcomeExpression!=null) {
- subProcessActivity.setOutcomeExpression(outcomeExpression);
-
- for (Element transitionElement: XmlUtil.elements(element, "transition")) {
- Element outcomeValueElement = XmlUtil.element(transitionElement, "outcome-value");
- if (outcomeValueElement!=null) {
- String transitionName = XmlUtil.attribute(transitionElement, "name");
- if (transitionName==null) {
- parse.addProblem("transitions with an outcome-value must have a name", transitionElement);
- }
- Element valueElement = XmlUtil.element(outcomeValueElement);
- if (valueElement!=null) {
- Descriptor descriptor = (Descriptor) WireParser.getInstance().parseElement(valueElement, parse);
- Object value = WireContext.create(descriptor);
- outcomeVariableMappings.put(value, transitionName);
- } else {
- parse.addProblem("outcome-value must contain exactly one element", outcomeValueElement);
- }
- }
- }
-
- }
-
- return subProcessActivity;
- }
-
- void parseParameter(Element element, SubProcessParameterImpl parameter) {
- String name = XmlUtil.attribute(element, "subvar");
- parameter.setSubVariableName(name);
-
- String expr = XmlUtil.attribute(element, "expr");
- if (expr!=null) {
- parameter.setExpression(expr);
- }
-
- String language = XmlUtil.attribute(element, "lang");
- if (language!=null) {
- parameter.setLanguage(language);
- }
-
- String variable = XmlUtil.attribute(element, "var");
- if (variable!=null) {
- parameter.setVariableName(variable);
- }
- }
-
- public static Map<String, String> parseSwimlaneMappings(Element element, Parse parse) {
- Map<String, String> swimlaneMappings = new HashMap<String, String>();
-
- for (Element inElement: XmlUtil.elements(element, "swimlane-mapping")) {
- String swimlane = XmlUtil.attribute(inElement, "swimlane", true, parse);
- String subSwimlane = XmlUtil.attribute(inElement, "sub-swimlane", true, parse);
-
- swimlaneMappings.put(swimlane, subSwimlane);
- }
-
- return swimlaneMappings;
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SubProcessBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SubProcessBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SubProcessBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,168 @@
+/*
+ * 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.jpdl.internal.v40.bindings;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.jpdl.internal.v40.activities.SubProcessActivity;
+import org.jbpm.jpdl.internal.v40.activities.SubProcessInParameterImpl;
+import org.jbpm.jpdl.internal.v40.activities.SubProcessOutParameterImpl;
+import org.jbpm.jpdl.internal.v40.activities.SubProcessParameterImpl;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.WireContext;
+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 SubProcessBinding extends JpdlBinding {
+
+ public SubProcessBinding() {
+ super("sub-process");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ SubProcessActivity subProcessActivity = new SubProcessActivity();
+
+ String subProcessKey = XmlUtil.attribute(element, "sub-process-key");
+ subProcessActivity.setSubProcessKey(subProcessKey);
+
+ String subProcessId = XmlUtil.attribute(element, "sub-process-id");
+ subProcessActivity.setSubProcessId(subProcessId);
+
+ List<SubProcessInParameterImpl> inParameters = new ArrayList<SubProcessInParameterImpl>();
+ for (Element inElement: XmlUtil.elements(element, "parameter-in")) {
+ SubProcessInParameterImpl inParameter = new SubProcessInParameterImpl();
+ parseParameter(inElement, inParameter);
+ inParameters.add(inParameter);
+
+ if (inParameter.getSubVariableName()==null) {
+ parse.addProblem("no 'subvar' specified for parameter-in", element);
+ }
+ if ( (inParameter.getExpression()==null)
+ && (inParameter.getVariableName()==null)
+ ) {
+ parse.addProblem("no 'expr' or 'variable' specified for parameter-in '"+inParameter.getSubVariableName()+"'", element);
+ }
+ if ( (inParameter.getExpression()!=null)
+ && (inParameter.getVariableName()!=null)
+ ) {
+ parse.addProblem("attributes 'expr' and 'variable' are mutually exclusive on parameter-in", element);
+ }
+ }
+ subProcessActivity.setInParameters(inParameters);
+
+ List<SubProcessOutParameterImpl> outParameters = new ArrayList<SubProcessOutParameterImpl>();
+ for (Element outElement: XmlUtil.elements(element, "parameter-out")) {
+ SubProcessOutParameterImpl outParameter = new SubProcessOutParameterImpl();
+ parseParameter(outElement, outParameter);
+ outParameters.add(outParameter);
+
+ if (outParameter.getVariableName()==null) {
+ parse.addProblem("no 'variable' specified for parameter-in", element);
+ }
+ if ( (outParameter.getExpression()==null)
+ && (outParameter.getSubVariableName()==null)
+ ) {
+ parse.addProblem("no 'expr' or 'subvar' specified for parameter-out '"+outParameter.getVariableName()+"'", element);
+ }
+ if ( (outParameter.getExpression()!=null)
+ && (outParameter.getSubVariableName()!=null)
+ ) {
+ parse.addProblem("attributes 'expr' and 'subvar' are mutually exclusive on parameter-out '"+outParameter.getVariableName()+"'", element);
+ }
+ }
+ subProcessActivity.setOutParameters(outParameters);
+
+ Map<String, String> swimlaneMappings = parseSwimlaneMappings(element, parse);
+ subProcessActivity.setSwimlaneMappings(swimlaneMappings);
+
+ Map<Object, String> outcomeVariableMappings = new HashMap<Object, String>();
+
+ String outcomeExpression = XmlUtil.attribute(element, "outcome");
+ if (outcomeExpression!=null) {
+ subProcessActivity.setOutcomeExpression(outcomeExpression);
+
+ for (Element transitionElement: XmlUtil.elements(element, "transition")) {
+ Element outcomeValueElement = XmlUtil.element(transitionElement, "outcome-value");
+ if (outcomeValueElement!=null) {
+ String transitionName = XmlUtil.attribute(transitionElement, "name");
+ if (transitionName==null) {
+ parse.addProblem("transitions with an outcome-value must have a name", transitionElement);
+ }
+ Element valueElement = XmlUtil.element(outcomeValueElement);
+ if (valueElement!=null) {
+ Descriptor descriptor = (Descriptor) WireParser.getInstance().parseElement(valueElement, parse);
+ Object value = WireContext.create(descriptor);
+ outcomeVariableMappings.put(value, transitionName);
+ } else {
+ parse.addProblem("outcome-value must contain exactly one element", outcomeValueElement);
+ }
+ }
+ }
+
+ }
+
+ return subProcessActivity;
+ }
+
+ void parseParameter(Element element, SubProcessParameterImpl parameter) {
+ String name = XmlUtil.attribute(element, "subvar");
+ parameter.setSubVariableName(name);
+
+ String expr = XmlUtil.attribute(element, "expr");
+ if (expr!=null) {
+ parameter.setExpression(expr);
+ }
+
+ String language = XmlUtil.attribute(element, "lang");
+ if (language!=null) {
+ parameter.setLanguage(language);
+ }
+
+ String variable = XmlUtil.attribute(element, "var");
+ if (variable!=null) {
+ parameter.setVariableName(variable);
+ }
+ }
+
+ public static Map<String, String> parseSwimlaneMappings(Element element, Parse parse) {
+ Map<String, String> swimlaneMappings = new HashMap<String, String>();
+
+ for (Element inElement: XmlUtil.elements(element, "swimlane-mapping")) {
+ String swimlane = XmlUtil.attribute(inElement, "swimlane", true, parse);
+ String subSwimlane = XmlUtil.attribute(inElement, "sub-swimlane", true, parse);
+
+ swimlaneMappings.put(swimlane, subSwimlane);
+ }
+
+ return swimlaneMappings;
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/TaskBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/TaskBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/TaskBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.v40.bindings;
-
-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 JpdlBinding {
-
- private static final String TAG = "task";
-
- 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;
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/TaskBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/TaskBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/TaskBinding.java 2009-10-01 20:56:19 UTC (rev 5677)
@@ -0,0 +1,52 @@
+/*
+ * 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.jpdl.internal.v40.bindings;
+
+import org.jbpm.jpdl.internal.v40.activities.TaskActivity;
+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 JpdlBinding {
+
+ private static final String TAG = "task";
+
+ 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;
+ }
+}
More information about the jbpm-commits
mailing list