JBoss JBPM SVN: r4309 - in jbpm4/trunk/modules: examples/src/test/resources and 2 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-03-23 10:18:52 -0400 (Mon, 23 Mar 2009)
New Revision: 4309
Added:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/JuelScriptEngine.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/JuelScriptEngineFactory.java
Modified:
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/part3.jbpm.cfg.xml
jbpm4/trunk/modules/examples/src/test/resources/jbpm.cfg.xml
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/ScriptManager.java
jbpm4/trunk/modules/pvm/src/test/resources/jbpm.cfg.xml
Log:
JBPM-2120: javax.el.* API conflict in AS 5
Modified: jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/part3.jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/part3.jbpm.cfg.xml 2009-03-23 10:13:16 UTC (rev 4308)
+++ jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/part3.jbpm.cfg.xml 2009-03-23 14:18:52 UTC (rev 4309)
@@ -7,7 +7,7 @@
default-script-language="juel"
read-contexts="execution, environment, process-engine"
write-context="">
- <script-language name="juel" factory="com.sun.script.juel.JuelScriptEngineFactory" />
+ <script-language name="juel" factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
</script-manager>
<authentication />
Modified: jbpm4/trunk/modules/examples/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.cfg.xml 2009-03-23 10:13:16 UTC (rev 4308)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.cfg.xml 2009-03-23 14:18:52 UTC (rev 4309)
@@ -38,7 +38,7 @@
default-script-language="juel"
read-contexts="execution, environment, process-engine"
write-context="">
- <script-language name="juel" factory="com.sun.script.juel.JuelScriptEngineFactory" />
+ <script-language name="juel" factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
</script-manager>
<authentication />
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/JuelScriptEngine.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/JuelScriptEngine.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/JuelScriptEngine.java 2009-03-23 14:18:52 UTC (rev 4309)
@@ -0,0 +1,387 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.script;
+
+import de.odysseus.el.util.SimpleResolver;
+
+import javax.el.*;
+import javax.script.*;
+import java.io.IOException;
+import java.io.Reader;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+class JuelScriptEngine extends AbstractScriptEngine
+ implements Compilable
+{
+ private ScriptEngineFactory factory;
+ private ExpressionFactory exprFactory;
+
+ public JuelScriptEngine(ScriptEngineFactory factory)
+ {
+ this.factory = factory;
+ this.exprFactory = new de.odysseus.el.ExpressionFactoryImpl();
+ }
+
+ public CompiledScript compile(String script)
+ throws ScriptException
+ {
+ ValueExpression expr = parse(script, this.context);
+
+ return new JuelCompiledScript(this, expr);
+ }
+
+ public CompiledScript compile(Reader reader)
+ throws ScriptException
+ {
+ return compile(readFully(reader));
+ }
+
+ public Object eval(String script, ScriptContext ctx)
+ throws ScriptException
+ {
+ ValueExpression expr = parse(script, ctx);
+
+ return evalExpr(expr, ctx);
+ }
+
+ public Object eval(Reader reader, ScriptContext ctx)
+ throws ScriptException
+ {
+ return eval(readFully(reader), ctx);
+ }
+
+ public ScriptEngineFactory getFactory()
+ {
+ synchronized (this)
+ {
+ if (this.factory == null)
+ {
+ this.factory = new JuelScriptEngineFactory();
+ }
+
+ }
+
+ return this.factory;
+ }
+
+ public Bindings createBindings()
+ {
+ return new SimpleBindings();
+ }
+
+ private ELContext toELContext(final ScriptContext ctx)
+ {
+ Object tmp = ctx.getAttribute("elcontext");
+
+ if (tmp instanceof ELContext)
+ {
+ return ((ELContext)tmp);
+ }
+
+ ctx.setAttribute("context", ctx, 100);
+
+ ctx.setAttribute("out:print", getPrintMethod(), 100);
+
+ SecurityManager manager = System.getSecurityManager();
+
+ if (manager == null)
+ {
+ ctx.setAttribute("lang:import", getImportMethod(), 100);
+ }
+
+ ELContext elContext = new ELContext()
+ {
+ ELResolver resolver = makeResolver();
+ VariableMapper varMapper = new ScriptContextVariableMapper(ctx);
+ FunctionMapper funcMapper = new ScriptContextFunctionMapper(ctx);
+
+ public ELResolver getELResolver()
+ {
+ return this.resolver;
+ }
+
+ public VariableMapper getVariableMapper()
+ {
+ return this.varMapper;
+ }
+
+ public FunctionMapper getFunctionMapper()
+ {
+ return this.funcMapper;
+ }
+
+ };
+
+ ctx.setAttribute("elcontext", elContext, 100);
+
+ return elContext;
+ }
+
+ private ELResolver makeResolver()
+ {
+ CompositeELResolver chain = new CompositeELResolver();
+
+ chain.add(new ArrayELResolver());
+
+ chain.add(new ListELResolver());
+
+ chain.add(new MapELResolver());
+
+ chain.add(new ResourceBundleELResolver());
+
+ chain.add(new BeanELResolver());
+
+ return new SimpleResolver(chain);
+ }
+
+ private ValueExpression parse(String script, ScriptContext ctx)
+ throws ScriptException
+ {
+ try
+ {
+ return this.exprFactory.createValueExpression(
+ toELContext(ctx), script, Object.class);
+ }
+ catch (ELException elexp)
+ {
+ throw new ScriptException(elexp);
+ }
+ }
+
+ private Object evalExpr(ValueExpression expr, ScriptContext ctx)
+ throws ScriptException
+ {
+ try
+ {
+ return expr.getValue(toELContext(ctx));
+ }
+ catch (ELException elexp)
+ {
+ throw new ScriptException(elexp);
+ }
+ }
+
+ private String readFully(Reader reader)
+ throws ScriptException
+ {
+ int numChars;
+ char[] arr = new char[8192];
+
+ StringBuilder buf = new StringBuilder();
+ try
+ {
+ while ((numChars = reader.read(arr, 0, arr.length)) > 0)
+ {
+ buf.append(arr, 0, numChars);
+ }
+
+ }
+ catch (IOException exp)
+ {
+ throw new ScriptException(exp);
+ }
+
+ return buf.toString();
+ }
+
+ private static Method getPrintMethod()
+ {
+ Class myClass;
+ try
+ {
+ myClass = JuelScriptEngine.class;
+
+ Method method = myClass.getMethod(
+ "print", new Class[] { Object.class });
+
+ return method;
+ }
+ catch (Exception exp)
+ {
+ }
+
+ return null;
+ }
+
+ public static void print(Object obj)
+ {
+ System.out.print(obj);
+ }
+
+ private static Method getImportMethod()
+ {
+ Class myClass;
+ try
+ {
+ myClass = JuelScriptEngine.class;
+
+ Method method = myClass.getMethod(
+ "importFunctions",
+ new Class[] { ScriptContext.class,
+ String.class,
+ Object.class });
+
+ return method;
+ }
+ catch (Exception exp)
+ {
+ }
+
+ return null;
+ }
+
+ public static void importFunctions(ScriptContext ctx, String namespace, Object obj)
+ {
+ Class clazz = null;
+
+ if (obj instanceof Class)
+ {
+ clazz = (Class)obj;
+ } else {
+ if (obj instanceof String)
+ {
+ try
+ {
+ clazz = Class.forName((String)obj);
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ throw new ELException(cnfe);
+ }
+
+ }
+
+ throw new ELException("Class or class name is missing");
+ }
+
+ Method[] methods = clazz.getMethods();
+
+ for (Method m : methods)
+ {
+ int mod = m.getModifiers();
+
+ if ((Modifier.isStatic(mod)) &&
+ (Modifier.isPublic(mod)))
+ {
+ String name = namespace + ":" + m.getName();
+
+ ctx.setAttribute(name, m,
+ 100);
+ }
+ }
+ }
+
+ private class JuelCompiledScript extends CompiledScript
+ {
+ private ValueExpression expr;
+ private ScriptEngine engine;
+
+ JuelCompiledScript(ScriptEngine engine, ValueExpression expr)
+ {
+ this.engine = engine;
+ this.expr = expr;
+ }
+
+ public ScriptEngine getEngine()
+ {
+ return engine;
+ }
+
+ public Object eval(ScriptContext ctx)
+ throws ScriptException
+ {
+ return engine.eval(this.expr.getExpressionString(), ctx);
+ }
+ }
+
+ private class ScriptContextFunctionMapper extends FunctionMapper
+ {
+ private ScriptContext ctx;
+
+ ScriptContextFunctionMapper(ScriptContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ private String getFullName(String prefix, String localName)
+ {
+ return prefix + ":" + localName;
+ }
+
+ public Method resolveFunction(String prefix, String localName)
+ {
+ String fullName = getFullName(prefix, localName);
+
+ int scope = this.ctx.getAttributesScope(fullName);
+
+ if (scope != -1)
+ {
+ Object tmp = this.ctx.getAttribute(fullName);
+
+ return ((tmp instanceof Method) ? (Method)tmp : null);
+ }
+
+ return null;
+ }
+ }
+
+ private class ScriptContextVariableMapper extends VariableMapper
+ {
+ private ScriptContext ctx;
+
+ ScriptContextVariableMapper(ScriptContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public ValueExpression resolveVariable(String variable)
+ {
+ int scope = this.ctx.getAttributesScope(variable);
+
+ if (scope != -1)
+ {
+ Object value = this.ctx.getAttribute(variable, scope);
+
+ if (value instanceof ValueExpression)
+ {
+ return ((ValueExpression)value);
+ }
+
+ return exprFactory.createValueExpression(
+ value, Object.class);
+ }
+
+ return null;
+ }
+
+
+ public ValueExpression setVariable(String variable, ValueExpression value)
+ {
+ ValueExpression oldValue = resolveVariable(variable);
+
+ this.ctx.setAttribute(variable, value, 100);
+
+ return oldValue;
+ }
+ }
+}
\ No newline at end of file
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/JuelScriptEngineFactory.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/JuelScriptEngineFactory.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/JuelScriptEngineFactory.java 2009-03-23 14:18:52 UTC (rev 4309)
@@ -0,0 +1,187 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.script;
+
+import javax.script.ScriptEngineFactory;
+import javax.script.ScriptEngine;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Collections;
+
+/**
+ * https://jira.jboss.org/jira/browse/JBPM-2120
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class JuelScriptEngineFactory implements ScriptEngineFactory
+{
+
+ private static List<String> names = new ArrayList(1);
+ private static List<String> extensions;
+ private static List<String> mimeTypes;
+
+ public JuelScriptEngineFactory()
+ {
+ super();
+ }
+
+ static
+ {
+ names.add("juel");
+
+ names = Collections.unmodifiableList(names);
+
+ extensions = names;
+
+ mimeTypes = new ArrayList(0);
+
+ mimeTypes = Collections.unmodifiableList(mimeTypes);
+ }
+
+ public String getEngineName()
+ {
+ return "juel";
+ }
+
+ public String getEngineVersion()
+ {
+ return de.odysseus.el.ExpressionFactoryImpl.class.getPackage().getImplementationVersion();
+ }
+
+ public List<String> getExtensions()
+ {
+ return extensions;
+ }
+
+ public String getLanguageName()
+ {
+ return "JSP 2.1 EL";
+ }
+
+ public String getLanguageVersion()
+ {
+ return "2.1";
+ }
+
+ public String getMethodCallSyntax(String obj, String m, String[] args)
+ {
+ throw new UnsupportedOperationException("getMethodCallSyntax");
+ }
+
+ public List<String> getMimeTypes()
+ {
+ return mimeTypes;
+ }
+
+ public List<String> getNames()
+ {
+ return names;
+ }
+
+ public String getOutputStatement(String toDisplay)
+ {
+ StringBuilder buf = new StringBuilder();
+
+ buf.append("out:print(\"");
+
+ int len = toDisplay.length();
+
+ for (int i = 0; i < len; ++i)
+ {
+ char ch = toDisplay.charAt(i);
+
+ switch (ch)
+ {
+ case '"':
+ buf.append("\\\"");
+
+ break;
+ case '\\':
+ buf.append("\\\\");
+
+ break;
+ default:
+ buf.append(ch);
+ }
+
+ }
+
+ buf.append("\")");
+
+ return buf.toString();
+ }
+
+ public String getParameter(String key)
+ {
+ if (key.equals("javax.script.name"))
+ {
+ return getLanguageName();
+ }
+ if (key.equals("javax.script.engine"))
+ {
+ return getEngineName();
+ }
+ if (key.equals("javax.script.engine_version"))
+ {
+ return getEngineVersion();
+ }
+ if (key.equals("javax.script.language"))
+ {
+ return getLanguageName();
+ }
+ if (key.equals("javax.script.language_version"))
+ {
+ return getLanguageVersion();
+ }
+ if (key.equals("THREADING"))
+ {
+ return "MULTITHREADED";
+ }
+
+ return null;
+ }
+
+ public String getProgram(String[] statements)
+ {
+ StringBuilder buf = new StringBuilder();
+
+ if (statements.length != 0)
+ {
+ for (int i = 0; i < statements.length; ++i)
+ {
+ buf.append("${");
+
+ buf.append(statements[i]);
+
+ buf.append("} ");
+ }
+
+ }
+
+ return buf.toString();
+ }
+
+ public ScriptEngine getScriptEngine()
+ {
+ return new JuelScriptEngine(this);
+ }
+}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/ScriptManager.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/ScriptManager.java 2009-03-23 10:13:16 UTC (rev 4308)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/ScriptManager.java 2009-03-23 14:18:52 UTC (rev 4309)
@@ -62,7 +62,7 @@
" default-script-language='beanshell' " +
" read-contexts='execution, environment, process-engine' " +
" write-context=''>" +
- " <script-language name='juel' factory='com.sun.script.juel.JuelScriptEngineFactory' />" +
+ " <script-language name='juel' factory='org.jbpm.pvm.internal.script.JuelScriptEngineFactory' />" +
" </script-manager>" +
"</objects>"
)
Modified: jbpm4/trunk/modules/pvm/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/jbpm.cfg.xml 2009-03-23 10:13:16 UTC (rev 4308)
+++ jbpm4/trunk/modules/pvm/src/test/resources/jbpm.cfg.xml 2009-03-23 14:18:52 UTC (rev 4309)
@@ -34,7 +34,7 @@
default-script-language="juel"
read-contexts="execution, environment, process-engine"
write-context="">
- <script-language name="juel" factory="com.sun.script.juel.JuelScriptEngineFactory" />
+ <script-language name="juel" factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
</script-manager>
<authentication />
17 years, 1 month
JBoss JBPM SVN: r4308 - in jbpm4/trunk: modules/api and 17 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-03-23 06:13:16 -0400 (Mon, 23 Mar 2009)
New Revision: 4308
Modified:
jbpm4/trunk/.project
jbpm4/trunk/modules/api/.project
jbpm4/trunk/modules/db/.project
jbpm4/trunk/modules/devguide/.project
jbpm4/trunk/modules/distro/.project
jbpm4/trunk/modules/enterprise/.project
jbpm4/trunk/modules/examples/.project
jbpm4/trunk/modules/integration/console/.project
jbpm4/trunk/modules/integration/jboss4/.project
jbpm4/trunk/modules/integration/jboss5/.project
jbpm4/trunk/modules/integration/spi/.project
jbpm4/trunk/modules/jpdl/.project
jbpm4/trunk/modules/log/.project
jbpm4/trunk/modules/pvm/.project
jbpm4/trunk/modules/test-base/.project
jbpm4/trunk/modules/test-db/.project
jbpm4/trunk/modules/test-load/.project
jbpm4/trunk/modules/test-pojo/.project
jbpm4/trunk/modules/userguide/.project
Log:
removed maven builders from eclipse project files
Modified: jbpm4/trunk/.project
===================================================================
--- jbpm4/trunk/.project 2009-03-22 15:27:33 UTC (rev 4307)
+++ jbpm4/trunk/.project 2009-03-23 10:13:16 UTC (rev 4308)
@@ -5,11 +5,6 @@
<projects>
</projects>
<buildSpec>
- <buildCommand>
- <name>org.maven.ide.eclipse.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
Modified: jbpm4/trunk/modules/api/.project
===================================================================
--- jbpm4/trunk/modules/api/.project 2009-03-22 15:27:33 UTC (rev 4307)
+++ jbpm4/trunk/modules/api/.project 2009-03-23 10:13:16 UTC (rev 4308)
@@ -10,11 +10,6 @@
<arguments>
</arguments>
</buildCommand>
- <buildCommand>
- <name>org.maven.ide.eclipse.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
Modified: jbpm4/trunk/modules/db/.project
===================================================================
--- jbpm4/trunk/modules/db/.project 2009-03-22 15:27:33 UTC (rev 4307)
+++ jbpm4/trunk/modules/db/.project 2009-03-23 10:13:16 UTC (rev 4308)
@@ -10,11 +10,6 @@
<arguments>
</arguments>
</buildCommand>
- <buildCommand>
- <name>org.maven.ide.eclipse.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
Modified: jbpm4/trunk/modules/devguide/.project
===================================================================
--- jbpm4/trunk/modules/devguide/.project 2009-03-22 15:27:33 UTC (rev 4307)
+++ jbpm4/trunk/modules/devguide/.project 2009-03-23 10:13:16 UTC (rev 4308)
@@ -5,11 +5,6 @@
<projects>
</projects>
<buildSpec>
- <buildCommand>
- <name>org.maven.ide.eclipse.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
Modified: jbpm4/trunk/modules/distro/.project
===================================================================
--- jbpm4/trunk/modules/distro/.project 2009-03-22 15:27:33 UTC (rev 4307)
+++ jbpm4/trunk/modules/distro/.project 2009-03-23 10:13:16 UTC (rev 4308)
@@ -5,19 +5,8 @@
<projects>
</projects>
<buildSpec>
- <buildCommand>
- <name>org.maven.ide.eclipse.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.stp.bpmn.validation.BatchValidationBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
- <nature>org.eclipse.stp.bpmn.validation.BatchValidationBuildAbleNature</nature>
</natures>
</projectDescription>
Modified: jbpm4/trunk/modules/enterprise/.project
===================================================================
--- jbpm4/trunk/modules/enterprise/.project 2009-03-22 15:27:33 UTC (rev 4307)
+++ jbpm4/trunk/modules/enterprise/.project 2009-03-23 10:13:16 UTC (rev 4308)
@@ -10,11 +10,6 @@
<arguments>
</arguments>
</buildCommand>
- <buildCommand>
- <name>org.maven.ide.eclipse.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
Modified: jbpm4/trunk/modules/examples/.project
===================================================================
--- jbpm4/trunk/modules/examples/.project 2009-03-22 15:27:33 UTC (rev 4307)
+++ jbpm4/trunk/modules/examples/.project 2009-03-23 10:13:16 UTC (rev 4308)
@@ -10,16 +10,6 @@
<arguments>
</arguments>
</buildCommand>
- <buildCommand>
- <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
- <triggers>full,incremental,</triggers>
- <arguments>
- <dictionary>
- <key>LaunchConfigHandle</key>
- <value><project>/.externalToolBuilders/org.maven.ide.eclipse.maven2Builder.launch</value>
- </dictionary>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
Modified: jbpm4/trunk/modules/integration/console/.project
===================================================================
--- jbpm4/trunk/modules/integration/console/.project 2009-03-22 15:27:33 UTC (rev 4307)
+++ jbpm4/trunk/modules/integration/console/.project 2009-03-23 10:13:16 UTC (rev 4308)
@@ -10,11 +10,6 @@
<arguments>
</arguments>
</buildCommand>
- <buildCommand>
- <name>org.maven.ide.eclipse.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
Modified: jbpm4/trunk/modules/integration/jboss4/.project
===================================================================
--- jbpm4/trunk/modules/integration/jboss4/.project 2009-03-22 15:27:33 UTC (rev 4307)
+++ jbpm4/trunk/modules/integration/jboss4/.project 2009-03-23 10:13:16 UTC (rev 4308)
@@ -10,11 +10,6 @@
<arguments>
</arguments>
</buildCommand>
- <buildCommand>
- <name>org.maven.ide.eclipse.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
Modified: jbpm4/trunk/modules/integration/jboss5/.project
===================================================================
--- jbpm4/trunk/modules/integration/jboss5/.project 2009-03-22 15:27:33 UTC (rev 4307)
+++ jbpm4/trunk/modules/integration/jboss5/.project 2009-03-23 10:13:16 UTC (rev 4308)
@@ -10,11 +10,6 @@
<arguments>
</arguments>
</buildCommand>
- <buildCommand>
- <name>org.maven.ide.eclipse.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
Modified: jbpm4/trunk/modules/integration/spi/.project
===================================================================
--- jbpm4/trunk/modules/integration/spi/.project 2009-03-22 15:27:33 UTC (rev 4307)
+++ jbpm4/trunk/modules/integration/spi/.project 2009-03-23 10:13:16 UTC (rev 4308)
@@ -10,11 +10,6 @@
<arguments>
</arguments>
</buildCommand>
- <buildCommand>
- <name>org.maven.ide.eclipse.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
Modified: jbpm4/trunk/modules/jpdl/.project
===================================================================
--- jbpm4/trunk/modules/jpdl/.project 2009-03-22 15:27:33 UTC (rev 4307)
+++ jbpm4/trunk/modules/jpdl/.project 2009-03-23 10:13:16 UTC (rev 4308)
@@ -10,11 +10,6 @@
<arguments>
</arguments>
</buildCommand>
- <buildCommand>
- <name>org.maven.ide.eclipse.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
Modified: jbpm4/trunk/modules/log/.project
===================================================================
--- jbpm4/trunk/modules/log/.project 2009-03-22 15:27:33 UTC (rev 4307)
+++ jbpm4/trunk/modules/log/.project 2009-03-23 10:13:16 UTC (rev 4308)
@@ -10,11 +10,6 @@
<arguments>
</arguments>
</buildCommand>
- <buildCommand>
- <name>org.maven.ide.eclipse.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
Modified: jbpm4/trunk/modules/pvm/.project
===================================================================
--- jbpm4/trunk/modules/pvm/.project 2009-03-22 15:27:33 UTC (rev 4307)
+++ jbpm4/trunk/modules/pvm/.project 2009-03-23 10:13:16 UTC (rev 4308)
@@ -10,11 +10,6 @@
<arguments>
</arguments>
</buildCommand>
- <buildCommand>
- <name>org.maven.ide.eclipse.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
Modified: jbpm4/trunk/modules/test-base/.project
===================================================================
--- jbpm4/trunk/modules/test-base/.project 2009-03-22 15:27:33 UTC (rev 4307)
+++ jbpm4/trunk/modules/test-base/.project 2009-03-23 10:13:16 UTC (rev 4308)
@@ -10,11 +10,6 @@
<arguments>
</arguments>
</buildCommand>
- <buildCommand>
- <name>org.maven.ide.eclipse.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
Modified: jbpm4/trunk/modules/test-db/.project
===================================================================
--- jbpm4/trunk/modules/test-db/.project 2009-03-22 15:27:33 UTC (rev 4307)
+++ jbpm4/trunk/modules/test-db/.project 2009-03-23 10:13:16 UTC (rev 4308)
@@ -10,11 +10,6 @@
<arguments>
</arguments>
</buildCommand>
- <buildCommand>
- <name>org.maven.ide.eclipse.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
Modified: jbpm4/trunk/modules/test-load/.project
===================================================================
--- jbpm4/trunk/modules/test-load/.project 2009-03-22 15:27:33 UTC (rev 4307)
+++ jbpm4/trunk/modules/test-load/.project 2009-03-23 10:13:16 UTC (rev 4308)
@@ -10,11 +10,6 @@
<arguments>
</arguments>
</buildCommand>
- <buildCommand>
- <name>org.maven.ide.eclipse.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
Modified: jbpm4/trunk/modules/test-pojo/.project
===================================================================
--- jbpm4/trunk/modules/test-pojo/.project 2009-03-22 15:27:33 UTC (rev 4307)
+++ jbpm4/trunk/modules/test-pojo/.project 2009-03-23 10:13:16 UTC (rev 4308)
@@ -10,11 +10,6 @@
<arguments>
</arguments>
</buildCommand>
- <buildCommand>
- <name>org.maven.ide.eclipse.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
Modified: jbpm4/trunk/modules/userguide/.project
===================================================================
--- jbpm4/trunk/modules/userguide/.project 2009-03-22 15:27:33 UTC (rev 4307)
+++ jbpm4/trunk/modules/userguide/.project 2009-03-23 10:13:16 UTC (rev 4308)
@@ -10,14 +10,8 @@
<arguments>
</arguments>
</buildCommand>
- <buildCommand>
- <name>org.eclipse.stp.bpmn.validation.BatchValidationBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
- <nature>org.eclipse.stp.bpmn.validation.BatchValidationBuildAbleNature</nature>
</natures>
</projectDescription>
17 years, 1 month
JBoss JBPM SVN: r4307 - jbpm4/branches.
by do-not-reply@jboss.org
Author: ainze
Date: 2009-03-22 11:27:33 -0400 (Sun, 22 Mar 2009)
New Revision: 4307
Added:
jbpm4/branches/ainze/
Log:
fresh from the trunk, will updat with spring diff
Copied: jbpm4/branches/ainze (from rev 4306, jbpm4/trunk)
17 years, 1 month
JBoss JBPM SVN: r4306 - jbpm4/branches.
by do-not-reply@jboss.org
Author: ainze
Date: 2009-03-22 11:22:36 -0400 (Sun, 22 Mar 2009)
New Revision: 4306
Removed:
jbpm4/branches/ainze/
Log:
removing my branch, creating it again with updates from trunk
17 years, 1 month
JBoss JBPM SVN: r4305 - in jbpm4/trunk/modules: api/src/main/java/org/jbpm/task and 19 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-03-21 13:50:09 -0400 (Sat, 21 Mar 2009)
New Revision: 4305
Added:
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/TaskExtension.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/Assignable.java
Removed:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/TaskExtension.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/StartActivities.java
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/session/TaskDbSession.java
jbpm4/trunk/modules/api/src/main/resources/jpdl.xsd
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.definition.hbm.xml
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.execution.hbm.xml
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.jpdl.hbm.xml
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.task.hbm.xml
jbpm4/trunk/modules/examples/.project
jbpm4/trunk/modules/examples/src/test/resources/jbpm.definition.hbm.xml
jbpm4/trunk/modules/examples/src/test/resources/jbpm.execution.hbm.xml
jbpm4/trunk/modules/examples/src/test/resources/jbpm.jpdl.hbm.xml
jbpm4/trunk/modules/examples/src/test/resources/jbpm.task.hbm.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/swimlane/process.jpdl.xml
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlExecution.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinition.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.definition.hbm.xml
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.execution.hbm.xml
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.jpdl.hbm.xml
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.task.hbm.xml
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteTaskCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/NewTaskCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessDeployer.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/DeployerManager.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernateTaskDbSession.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/ParticipantImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/SwimlaneDefinitionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/SwimlaneImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskDefinitionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/StandardTransaction.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/HibernateSessionDescriptor.java
jbpm4/trunk/modules/pvm/src/test/resources/jbpm.definition.hbm.xml
jbpm4/trunk/modules/pvm/src/test/resources/jbpm.execution.hbm.xml
jbpm4/trunk/modules/pvm/src/test/resources/jbpm.task.hbm.xml
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.definition.hbm.xml
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.execution.hbm.xml
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.jpdl.hbm.xml
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.task.hbm.xml
Log:
JBPM-2080 JBPM-2024 JBPM-2104 added swimlanes
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/session/TaskDbSession.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/session/TaskDbSession.java 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/session/TaskDbSession.java 2009-03-21 17:50:09 UTC (rev 4305)
@@ -30,7 +30,7 @@
*/
public interface TaskDbSession extends DbSession {
- Task newTask();
+ Task createTask();
Task findTaskByDbid(long taskDbid);
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/TaskExtension.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/TaskExtension.java 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/TaskExtension.java 2009-03-21 17:50:09 UTC (rev 4305)
@@ -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.task;
-
-
-/**
- * @author Tom Baeyens
- */
-public interface TaskExtension {
-
- TaskDefinition getTaskDefinition();
- TaskDefinition getTaskDefinition(String name);
-
- Task createTask(TaskDefinition taskDefinition);
-
- SwimlaneDefinition getSwimlaneDefinition(String name);
-
- Swimlane getSwimlane(String name);
- Swimlane createSwimlane(SwimlaneDefinition swimlaneDefinition);
-}
Modified: jbpm4/trunk/modules/api/src/main/resources/jpdl.xsd
===================================================================
--- jbpm4/trunk/modules/api/src/main/resources/jpdl.xsd 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/api/src/main/resources/jpdl.xsd 2009-03-21 17:50:09 UTC (rev 4305)
@@ -315,7 +315,7 @@
</documentation></annotation>
<complexType>
<sequence>
- <element name="handler" type="tns:wireObjectType"></element>
+ <element name="handler" minOccurs="0" type="tns:wireObjectType" />
<element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
</sequence>
<attributeGroup ref="tns:activityAttributes" />
@@ -661,11 +661,13 @@
<annotation><documentation>Elements of type swimlaneType will be used in the
process to enumerate all the participating swimlanes.
</documentation></annotation>
+ <sequence>
+ </sequence>
<attribute name="name" type="string"/>
<attributeGroup ref="tns:assignmentAttributes"></attributeGroup>
</complexType>
- <element name="swimlane" type="tns:swimlaneType">
+ <element name="swimlane" type="tns:swimlaneType" >
<annotation><documentation>A participating swimlane for this process
</documentation></annotation>
</element>
Modified: jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.definition.hbm.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.definition.hbm.xml 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.definition.hbm.xml 2009-03-21 17:50:09 UTC (rev 4305)
@@ -4,11 +4,15 @@
<hibernate-mapping package="org.jbpm.pvm.internal.model" default-access="field">
<!-- ### PROCESS DEFINITION ############################################# -->
- <class name="ProcessDefinitionImpl" table="JBPM_PROCESS">
+ <class name="ProcessDefinitionImpl"
+ table="JBPM_PROCESS"
+ discriminator-value="pvm">
<!-- ProcessElementImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
+ <discriminator><column name="CLASS_" /></discriminator>
+
<version name="dbversion" column="DBVERSION_" />
<many-to-one name="properties"
class="WireProperties"
Modified: jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.execution.hbm.xml 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.execution.hbm.xml 2009-03-21 17:50:09 UTC (rev 4305)
@@ -19,10 +19,13 @@
</typedef>
<!-- ### PROCESS DEFINITION ############################################# -->
- <class name="ExecutionImpl" table="JBPM_EXECUTION">
+ <class name="ExecutionImpl"
+ table="JBPM_EXECUTION"
+ discriminator-value="pvm">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
+ <discriminator><column name="CLASS_" /></discriminator>
<version name="dbversion" column="DBVERSION_" />
<many-to-one name="activity"
@@ -34,8 +37,7 @@
<property name="hasVariables" column="HASVARS_" />
<map name="variables"
- cascade="all-delete-orphan"
- table="JBPM_VARIABLE">
+ cascade="all-delete-orphan">
<key foreign-key="FK_VAR_EXECUTION">
<column name="EXECUTION_" index="IDX_VAR_EXECUTION"/>
</key>
Modified: jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.jpdl.hbm.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.jpdl.hbm.xml 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.jpdl.hbm.xml 2009-03-21 17:50:09 UTC (rev 4305)
@@ -3,13 +3,39 @@
<hibernate-mapping default-access="field">
- <joined-subclass name="org.jbpm.jpdl.internal.model.JpdlProcessDefinition" table="JBPM_JPDL_PROCDEF" extends="org.jbpm.pvm.internal.model.ProcessDefinitionImpl">
- <key column="DBID_"/>
- </joined-subclass>
+ <subclass name="org.jbpm.jpdl.internal.model.JpdlProcessDefinition"
+ extends="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
+ discriminator-value="jpdl">
+ <map name="swimlaneDefinitions"
+ cascade="all-delete-orphan">
+ <key foreign-key="FK_SWLDEF_PROCESS">
+ <column name="PROCESS_SWL_" index="IDX_SWLDEF_PROCESS"/>
+ </key>
+ <map-key type="string" column="NAME_" />
+ <one-to-many class="org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl" />
+ </map>
+ <map name="taskDefinitions"
+ cascade="all-delete-orphan">
+ <key foreign-key="FK_TSKDEF_PROCESS">
+ <column name="PROCESS_" index="IDX_TSKDEF_PROCESS"/>
+ </key>
+ <map-key type="string" column="NAME_" />
+ <one-to-many class="org.jbpm.pvm.internal.task.TaskDefinitionImpl" />
+ </map>
+ </subclass>
- <joined-subclass name="org.jbpm.jpdl.internal.model.JpdlExecution" table="JBPM_JPDL_EXECUTION" extends="org.jbpm.pvm.internal.model.ExecutionImpl">
- <key column="DBID_"/>
- </joined-subclass>
+ <subclass name="org.jbpm.jpdl.internal.model.JpdlExecution"
+ extends="org.jbpm.pvm.internal.model.ExecutionImpl"
+ discriminator-value="jpdl">
+ <map name="swimlanes"
+ cascade="all-delete-orphan">
+ <key foreign-key="FK_SWIMLANE_EXEC">
+ <column name="EXECUTION_" index="IDX_SWIMLANE_EXEC"/>
+ </key>
+ <map-key type="string" column="NAME_" />
+ <one-to-many class="org.jbpm.pvm.internal.task.SwimlaneImpl" />
+ </map>
+ </subclass>
<class name="org.jbpm.jpdl.internal.activity.JpdlActivity" table="JBPM_JPDL_ACTIVITY" abstract="true" discriminator-value="X">
<id name="dbid" column="DBID_">
Modified: jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.task.hbm.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.task.hbm.xml 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.task.hbm.xml 2009-03-21 17:50:09 UTC (rev 4305)
@@ -4,21 +4,19 @@
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping auto-import="false" package="org.jbpm.pvm.internal.task" default-access="field">
- <!-- ### TASK DEFINITION ################################################ -->
- <class name="TaskDefinitionImpl" discriminator-value="T">
+ <!-- ### SWIMLANE DEFINITION ############################################ -->
+ <class name="SwimlaneDefinitionImpl"
+ table="JBPM_TASKDEF"
+ discriminator-value="S" >
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
- <discriminator type="char" column="CLASS_"/>
- <version name="dbversion" column="DBVERSION_" />
+ <discriminator><column name="CLASS_" /></discriminator>
+ <version name="dbversion" column="DBVERSION_" />
<property name="name" column="NAME_"/>
<property name="description" column="DESCR_"/>
- <property name="priority" column="PRIORITY_"/>
- <property name="dueDateDuration" column="DUEDATE_"/>
- <property name="isBlocking" column="BLOCK_"/>
- <property name="isSignalling" column="SIGNAL_"/>
<property name="assigneeExpression" column="ASS_EXPR_"/>
<property name="assigneeExpressionLanguage" column="ASS_EXPR_LANG_"/>
<property name="candidateUsersExpression" column="CNDUSR_EXPR_"/>
@@ -30,25 +28,35 @@
column="ASSIGNER_DESCR_"
cascade="all"
class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
- foreign-key="FK_TSK_ASIG_DESCR"
- index="IDX_TSK_ASIG_DESCR" />
+ foreign-key="FK_SWL_ASIG_DESCR"
+ index="IDX_SWL_ASIG_DESCR" />
- <many-to-one name="swimlaneDefinition"
- column="SWIMLANE_DEF_"
- cascade="all"
- class="SwimlaneDefinitionImpl"
- foreign-key="FK_TSK_SWIML_DEF"
- index="IDX_TSK_SWIML_DEF" />
-
- <list name="subTaskDefinitions" cascade="all-delete-orphan">
- <key column="TASKDEF_" />
- <list-index column="TASKDEF_IDX_" />
- <one-to-many class="TaskDefinitionImpl" />
- </list>
- </class>
+ <!-- ### TASK DEFINITION ################################################ -->
+ <subclass name="TaskDefinitionImpl" discriminator-value="T">
+ <property name="priority" column="PRIORITY_"/>
+ <property name="dueDateDuration" column="DUEDATE_"/>
+ <property name="isBlocking" column="BLOCK_"/>
+ <property name="isSignalling" column="SIGNAL_"/>
+
+ <many-to-one name="swimlaneDefinition"
+ column="SWIMLANE_DEF_"
+ cascade="all"
+ class="SwimlaneDefinitionImpl"
+ foreign-key="FK_TSK_SWIML_DEF"
+ index="IDX_TSK_SWIML_DEF" />
+
+ <list name="subTaskDefinitions" cascade="all-delete-orphan">
+ <key column="TASKDEF_" />
+ <list-index column="TASKDEF_IDX_" />
+ <one-to-many class="TaskDefinitionImpl" />
+ </list>
+ </subclass>
+ </class>
+
<!-- ### TASK ########################################################### -->
<class name="TaskImpl"
+ table="JBPM_TASK"
discriminator-value="T">
<id name="dbid" column="DBID_">
<generator class="native" />
@@ -109,7 +117,7 @@
</class>
<!-- ### PARTICIPANT #################################################### -->
- <class name="ParticipantImpl">
+ <class name="ParticipantImpl" table="JBPM_PARTICIPANT">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -132,19 +140,8 @@
</class>
- <!-- ### SWIMLANE DEFINITION ############################################ -->
- <class name="SwimlaneDefinitionImpl">
- <id name="dbid" column="DBID_">
- <generator class="native" />
- </id>
- <version name="dbversion" column="DBVERSION_" />
-
- <property name="name" column="NAME_"/>
- </class>
-
-
<!-- ### SWIMLANE ####################################################### -->
- <class name="SwimlaneImpl">
+ <class name="SwimlaneImpl" table="JBPM_SWIMLANE">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -161,7 +158,7 @@
<many-to-one name="execution"
class="org.jbpm.pvm.internal.model.ExecutionImpl"
column="EXECUTION_"
- foreign-key="FK_SWIMLANE_EXEC" />
+ foreign-key="none" />
<set name="participants" cascade="all-delete-orphan">
<key column="SWIMLANE_" />
@@ -169,8 +166,8 @@
</set>
</class>
+
-
<!-- ### QUERIES ######################################################## -->
<query name="findTasks">
Modified: jbpm4/trunk/modules/examples/.project
===================================================================
--- jbpm4/trunk/modules/examples/.project 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/examples/.project 2009-03-21 17:50:09 UTC (rev 4305)
@@ -11,8 +11,13 @@
</arguments>
</buildCommand>
<buildCommand>
- <name>org.maven.ide.eclipse.maven2Builder</name>
+ <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
+ <triggers>full,incremental,</triggers>
<arguments>
+ <dictionary>
+ <key>LaunchConfigHandle</key>
+ <value><project>/.externalToolBuilders/org.maven.ide.eclipse.maven2Builder.launch</value>
+ </dictionary>
</arguments>
</buildCommand>
</buildSpec>
Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java 2009-03-21 17:50:09 UTC (rev 4305)
@@ -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.examples.task.swimlane;
+
+import java.util.List;
+
+import org.jbpm.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskSwimlaneTest extends JbpmTestCase {
+
+ public void testTaskSwimlane() {
+ // create johndoe and joesmoe as members of the sales group
+ String salesGroupId = identityService.createGroup("sales");
+
+ identityService.createUser("johndoe", "John", "Doe");
+ identityService.createMembership("johndoe", salesGroupId);
+
+ deployJpdlResource("org/jbpm/examples/task/swimlane/process.jpdl.xml");
+
+ executionService.startProcessInstanceByKey("TaskSwimlane");
+
+ List<Task> taskList = taskService.getGroupTaskList("johndoe", 0, 10);
+ assertEquals(1, taskList.size());
+ Task task = taskList.get(0);
+ long taskDbid = task.getDbid();
+ assertEquals("enter order data", task.getName());
+ assertNull(task.getAssignee());
+
+ // lets assume that johndoe takes the task
+ taskService.setUserId("johndoe");
+ taskService.takeTask(taskDbid);
+
+ // submit the task
+ taskService.submitTask(taskDbid);
+
+ // the next task will be created and assigned directly to johndoe
+ // this is because johndoe was the person that took the previous task
+ // in the salesRepresentative swimlane. so that person is most likely
+ // to know the context of this case
+
+ // we'll check that the group task lists for johndoe and joesmoe are empty
+ assertEquals(0, taskService.getGroupTaskList("johndoe", 0, 10).size());
+
+ // and that the task is directly assigned to johndoe
+ taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ assertEquals(1, taskList.size());
+ task = taskList.get(0);
+ assertEquals("calculate quote", task.getName());
+ assertEquals("johndoe", task.getAssignee());
+ }
+}
Property changes on: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/examples/src/test/resources/jbpm.definition.hbm.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.definition.hbm.xml 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.definition.hbm.xml 2009-03-21 17:50:09 UTC (rev 4305)
@@ -4,11 +4,15 @@
<hibernate-mapping package="org.jbpm.pvm.internal.model" default-access="field">
<!-- ### PROCESS DEFINITION ############################################# -->
- <class name="ProcessDefinitionImpl" table="JBPM_PROCESS">
+ <class name="ProcessDefinitionImpl"
+ table="JBPM_PROCESS"
+ discriminator-value="pvm">
<!-- ProcessElementImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
+ <discriminator><column name="CLASS_" /></discriminator>
+
<version name="dbversion" column="DBVERSION_" />
<many-to-one name="properties"
class="WireProperties"
Modified: jbpm4/trunk/modules/examples/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.execution.hbm.xml 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.execution.hbm.xml 2009-03-21 17:50:09 UTC (rev 4305)
@@ -19,10 +19,13 @@
</typedef>
<!-- ### PROCESS DEFINITION ############################################# -->
- <class name="ExecutionImpl" table="JBPM_EXECUTION">
+ <class name="ExecutionImpl"
+ table="JBPM_EXECUTION"
+ discriminator-value="pvm">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
+ <discriminator><column name="CLASS_" /></discriminator>
<version name="dbversion" column="DBVERSION_" />
<many-to-one name="activity"
@@ -34,8 +37,7 @@
<property name="hasVariables" column="HASVARS_" />
<map name="variables"
- cascade="all-delete-orphan"
- table="JBPM_VARIABLE">
+ cascade="all-delete-orphan">
<key foreign-key="FK_VAR_EXECUTION">
<column name="EXECUTION_" index="IDX_VAR_EXECUTION"/>
</key>
@@ -203,7 +205,7 @@
<generator class="native" />
</id>
<version name="dbversion" column="DBVERSION_" />
- <property name="blob" type="blob" column="BLOB_VALUE_" />
+ <property name="blob" type="blob"><column name="BLOB_VALUE_" /></property>
<property name="bytes" type="binary" column="BINARY_VALUE_"/>
<property name="clob" type="clob" column="CLOB_VALUE_" />
<property name="text" type="text" column="TEXT_VALUE_"/>
Modified: jbpm4/trunk/modules/examples/src/test/resources/jbpm.jpdl.hbm.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.jpdl.hbm.xml 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.jpdl.hbm.xml 2009-03-21 17:50:09 UTC (rev 4305)
@@ -3,13 +3,39 @@
<hibernate-mapping default-access="field">
- <joined-subclass name="org.jbpm.jpdl.internal.model.JpdlProcessDefinition" table="JBPM_JPDL_PROCDEF" extends="org.jbpm.pvm.internal.model.ProcessDefinitionImpl">
- <key column="DBID_"/>
- </joined-subclass>
+ <subclass name="org.jbpm.jpdl.internal.model.JpdlProcessDefinition"
+ extends="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
+ discriminator-value="jpdl">
+ <map name="swimlaneDefinitions"
+ cascade="all-delete-orphan">
+ <key foreign-key="FK_SWLDEF_PROCESS">
+ <column name="PROCESS_SWL_" index="IDX_SWLDEF_PROCESS"/>
+ </key>
+ <map-key type="string" column="NAME_" />
+ <one-to-many class="org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl" />
+ </map>
+ <map name="taskDefinitions"
+ cascade="all-delete-orphan">
+ <key foreign-key="FK_TSKDEF_PROCESS">
+ <column name="PROCESS_" index="IDX_TSKDEF_PROCESS"/>
+ </key>
+ <map-key type="string" column="NAME_" />
+ <one-to-many class="org.jbpm.pvm.internal.task.TaskDefinitionImpl" />
+ </map>
+ </subclass>
- <joined-subclass name="org.jbpm.jpdl.internal.model.JpdlExecution" table="JBPM_JPDL_EXECUTION" extends="org.jbpm.pvm.internal.model.ExecutionImpl">
- <key column="DBID_"/>
- </joined-subclass>
+ <subclass name="org.jbpm.jpdl.internal.model.JpdlExecution"
+ extends="org.jbpm.pvm.internal.model.ExecutionImpl"
+ discriminator-value="jpdl">
+ <map name="swimlanes"
+ cascade="all-delete-orphan">
+ <key foreign-key="FK_SWIMLANE_EXEC">
+ <column name="EXECUTION_" index="IDX_SWIMLANE_EXEC"/>
+ </key>
+ <map-key type="string" column="NAME_" />
+ <one-to-many class="org.jbpm.pvm.internal.task.SwimlaneImpl" />
+ </map>
+ </subclass>
<class name="org.jbpm.jpdl.internal.activity.JpdlActivity" table="JBPM_JPDL_ACTIVITY" abstract="true" discriminator-value="X">
<id name="dbid" column="DBID_">
Modified: jbpm4/trunk/modules/examples/src/test/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.task.hbm.xml 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.task.hbm.xml 2009-03-21 17:50:09 UTC (rev 4305)
@@ -4,21 +4,19 @@
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping auto-import="false" package="org.jbpm.pvm.internal.task" default-access="field">
- <!-- ### TASK DEFINITION ################################################ -->
- <class name="TaskDefinitionImpl" discriminator-value="T">
+ <!-- ### SWIMLANE DEFINITION ############################################ -->
+ <class name="SwimlaneDefinitionImpl"
+ table="JBPM_TASKDEF"
+ discriminator-value="S" >
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
- <discriminator type="char" column="CLASS_"/>
- <version name="dbversion" column="DBVERSION_" />
+ <discriminator><column name="CLASS_" /></discriminator>
+ <version name="dbversion" column="DBVERSION_" />
<property name="name" column="NAME_"/>
<property name="description" column="DESCR_"/>
- <property name="priority" column="PRIORITY_"/>
- <property name="dueDateDuration" column="DUEDATE_"/>
- <property name="isBlocking" column="BLOCK_"/>
- <property name="isSignalling" column="SIGNAL_"/>
<property name="assigneeExpression" column="ASS_EXPR_"/>
<property name="assigneeExpressionLanguage" column="ASS_EXPR_LANG_"/>
<property name="candidateUsersExpression" column="CNDUSR_EXPR_"/>
@@ -30,25 +28,35 @@
column="ASSIGNER_DESCR_"
cascade="all"
class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
- foreign-key="FK_TSK_ASIG_DESCR"
- index="IDX_TSK_ASIG_DESCR" />
+ foreign-key="FK_SWL_ASIG_DESCR"
+ index="IDX_SWL_ASIG_DESCR" />
- <many-to-one name="swimlaneDefinition"
- column="SWIMLANE_DEF_"
- cascade="all"
- class="SwimlaneDefinitionImpl"
- foreign-key="FK_TSK_SWIML_DEF"
- index="IDX_TSK_SWIML_DEF" />
-
- <list name="subTaskDefinitions" cascade="all-delete-orphan">
- <key column="TASKDEF_" />
- <list-index column="TASKDEF_IDX_" />
- <one-to-many class="TaskDefinitionImpl" />
- </list>
- </class>
+ <!-- ### TASK DEFINITION ################################################ -->
+ <subclass name="TaskDefinitionImpl" discriminator-value="T">
+ <property name="priority" column="PRIORITY_"/>
+ <property name="dueDateDuration" column="DUEDATE_"/>
+ <property name="isBlocking" column="BLOCK_"/>
+ <property name="isSignalling" column="SIGNAL_"/>
+
+ <many-to-one name="swimlaneDefinition"
+ column="SWIMLANE_DEF_"
+ cascade="all"
+ class="SwimlaneDefinitionImpl"
+ foreign-key="FK_TSK_SWIML_DEF"
+ index="IDX_TSK_SWIML_DEF" />
+
+ <list name="subTaskDefinitions" cascade="all-delete-orphan">
+ <key column="TASKDEF_" />
+ <list-index column="TASKDEF_IDX_" />
+ <one-to-many class="TaskDefinitionImpl" />
+ </list>
+ </subclass>
+ </class>
+
<!-- ### TASK ########################################################### -->
<class name="TaskImpl"
+ table="JBPM_TASK"
discriminator-value="T">
<id name="dbid" column="DBID_">
<generator class="native" />
@@ -109,7 +117,7 @@
</class>
<!-- ### PARTICIPANT #################################################### -->
- <class name="ParticipantImpl">
+ <class name="ParticipantImpl" table="JBPM_PARTICIPANT">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -132,19 +140,8 @@
</class>
- <!-- ### SWIMLANE DEFINITION ############################################ -->
- <class name="SwimlaneDefinitionImpl">
- <id name="dbid" column="DBID_">
- <generator class="native" />
- </id>
- <version name="dbversion" column="DBVERSION_" />
-
- <property name="name" column="NAME_"/>
- </class>
-
-
<!-- ### SWIMLANE ####################################################### -->
- <class name="SwimlaneImpl">
+ <class name="SwimlaneImpl" table="JBPM_SWIMLANE">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -161,7 +158,7 @@
<many-to-one name="execution"
class="org.jbpm.pvm.internal.model.ExecutionImpl"
column="EXECUTION_"
- foreign-key="FK_SWIMLANE_EXEC" />
+ foreign-key="none" />
<set name="participants" cascade="all-delete-orphan">
<key column="SWIMLANE_" />
@@ -169,8 +166,8 @@
</set>
</class>
+
-
<!-- ### QUERIES ######################################################## -->
<query name="findTasks">
Modified: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/swimlane/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/swimlane/process.jpdl.xml 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/swimlane/process.jpdl.xml 2009-03-21 17:50:09 UTC (rev 4305)
@@ -1,26 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
-<process name="swimlane" xmlns="http://jbpm.org/4/jpdl">
+<process name="TaskSwimlane" xmlns="http://jbpm.org/4/jpdl">
- <swimlane name="customer"
- assignee="johndoe">
- </swimlane>
+ <swimlane name="sales representative"
+ candidate-groups="sales" />
<start g="20,20,48,48">
- <transition to="open case" />
+ <transition to="enter order data" />
</start>
- <task
- name="open case"
- swimlane="customer"
- g="96,16,127,52">
+ <task name="enter order data"
+ swimlane="sales representative"
+ g="96,16,127,52">
- <transition to="verify"/>
+ <transition to="calculate quote"/>
</task>
<task
- name="verify"
- swimlane="customer"
+ name="calculate quote"
+ swimlane="sales representative"
g="255,16,88,52">
</task>
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java 2009-03-21 17:50:09 UTC (rev 4305)
@@ -21,7 +21,7 @@
*/
package org.jbpm.jpdl.internal.activity;
-import org.jbpm.jpdl.internal.xml.StartActivities;
+import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
import org.jbpm.pvm.internal.model.ActivityImpl;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
@@ -39,8 +39,15 @@
public Object parse(Element element, Parse parse, Parser parser) {
ActivityImpl startActivity = parse.findObject(ActivityImpl.class);
- StartActivities startActivities = parse.findObject(StartActivities.class);
- startActivities.add(startActivity);
+ JpdlProcessDefinition processDefinition = parse.findObject(JpdlProcessDefinition.class);
+
+ if (processDefinition.getInitial()==null) {
+ processDefinition.setInitial(startActivity);
+
+ } else {
+ parse.addProblem("multiple start events not yet supported");
+ }
+
return new StartActivity();
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskActivity.java 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskActivity.java 2009-03-21 17:50:09 UTC (rev 4305)
@@ -26,8 +26,10 @@
import org.jbpm.JbpmException;
import org.jbpm.activity.ActivityExecution;
import org.jbpm.env.Environment;
+import org.jbpm.jpdl.internal.model.JpdlExecution;
import org.jbpm.model.Activity;
import org.jbpm.model.Transition;
+import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
import org.jbpm.pvm.internal.task.TaskImpl;
import org.jbpm.session.TaskDbSession;
@@ -44,15 +46,13 @@
public void execute(ActivityExecution execution) {
TaskDbSession taskDbSession = Environment.getFromCurrent(TaskDbSession.class);
- TaskImpl task = TaskImpl.create();
+ TaskImpl task = (TaskImpl) taskDbSession.createTask();
task.setExecution(execution);
+ task.setName(execution.getActivityName());
- taskDefinition.initialize(task);
+ JpdlExecution jpdlExecution = (JpdlExecution) execution;
+ jpdlExecution.initializeTask(task, taskDefinition);
- if (task.getName()==null) {
- task.setName(execution.getActivityName());
- }
-
taskDbSession.saveTask(task);
execution.historyTaskStart(task);
@@ -77,7 +77,7 @@
}
}
- public TaskDefinitionImpl getTaskDefinition() {
+ public SwimlaneDefinitionImpl getTaskDefinition() {
return taskDefinition;
}
public void setTaskDefinition(TaskDefinitionImpl taskDefinition) {
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java 2009-03-21 17:50:09 UTC (rev 4305)
@@ -21,13 +21,14 @@
*/
package org.jbpm.jpdl.internal.activity;
+import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
+import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
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
*/
@@ -50,25 +51,48 @@
public static TaskDefinitionImpl parseTaskDefinition(Element element, Parse parse, Parser parser) {
TaskDefinitionImpl taskDefinition = new TaskDefinitionImpl();
+
+ taskDefinition.setName(XmlUtil.attribute(element, "name"));
+
+ String swimlaneName = XmlUtil.attribute(element, "swimlane");
+ if (swimlaneName!=null) {
+ JpdlProcessDefinition jpdlProcessDefinition = parse.findObject(JpdlProcessDefinition.class);
+ SwimlaneDefinitionImpl swimlaneDefinition = jpdlProcessDefinition.getSwimlaneDefinition(swimlaneName);
+ if (swimlaneDefinition!=null) {
+ taskDefinition.setSwimlaneDefinition(swimlaneDefinition);
+ } else {
+ parse.addProblem("swimlane "+swimlaneName+" not declared");
+ }
+ }
+
+ parseAssignmentAttributes(element, taskDefinition);
+ return taskDefinition;
+ }
+
+ public static void parseAssignmentAttributes(Element element, SwimlaneDefinitionImpl swimlaneDefinition) {
+ Element descriptionElement = XmlUtil.element(element, "description");
+ if (descriptionElement!=null) {
+ String description = XmlUtil.getContentText(descriptionElement);
+ swimlaneDefinition.setDescription(description);
+ }
+
String assigneeExpression = XmlUtil.attribute(element, "assignee");
- taskDefinition.setAssigneeExpression(assigneeExpression);
+ swimlaneDefinition.setAssigneeExpression(assigneeExpression);
String assigneeExpressionLanguage = XmlUtil.attribute(element, "assignee-lang");
- taskDefinition.setAssigneeExpressionLanguage(assigneeExpressionLanguage);
+ swimlaneDefinition.setAssigneeExpressionLanguage(assigneeExpressionLanguage);
String candidateUsersExpression = XmlUtil.attribute(element, "candidate-users");
- taskDefinition.setCandidateUsersExpression(candidateUsersExpression);
+ swimlaneDefinition.setCandidateUsersExpression(candidateUsersExpression);
String candidateUsersExpressionLanguage = XmlUtil.attribute(element, "candidate-users-lang");
- taskDefinition.setCandidateUsersExpressionLanguage(candidateUsersExpressionLanguage);
+ swimlaneDefinition.setCandidateUsersExpressionLanguage(candidateUsersExpressionLanguage);
String candidateGroupsExpression = XmlUtil.attribute(element, "candidate-groups");
- taskDefinition.setCandidateGroupsExpression(candidateGroupsExpression);
+ swimlaneDefinition.setCandidateGroupsExpression(candidateGroupsExpression);
String candidateGroupsExpressionLanguage = XmlUtil.attribute(element, "candidate-groups-lang");
- taskDefinition.setCandidateGroupsExpressionLanguage(candidateGroupsExpressionLanguage);
-
- return taskDefinition;
+ swimlaneDefinition.setCandidateGroupsExpressionLanguage(candidateGroupsExpressionLanguage);
}
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlExecution.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlExecution.java 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlExecution.java 2009-03-21 17:50:09 UTC (rev 4305)
@@ -22,21 +22,25 @@
package org.jbpm.jpdl.internal.model;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Map;
-import java.util.Set;
+import java.util.StringTokenizer;
+import org.hibernate.Session;
import org.jbpm.JbpmException;
import org.jbpm.env.Environment;
+import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.script.ScriptManager;
+import org.jbpm.pvm.internal.task.Assignable;
+import org.jbpm.pvm.internal.task.ParticipantImpl;
+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;
import org.jbpm.session.TaskDbSession;
-import org.jbpm.task.Swimlane;
-import org.jbpm.task.SwimlaneDefinition;
-import org.jbpm.task.Task;
-import org.jbpm.task.TaskDefinition;
-import org.jbpm.task.TaskExtension;
+import org.jbpm.task.GroupRef;
+import org.jbpm.task.Participant;
+import org.jbpm.task.UserRef;
/**
* @author Tom Baeyens
@@ -44,22 +48,11 @@
public class JpdlExecution extends ExecutionImpl implements TaskExtension {
private static final long serialVersionUID = 1L;
+
+ private static Log log = Log.getLog(JpdlExecution.class.getName());
- protected Set<TaskImpl> tasks = new HashSet<TaskImpl>();
protected Map<String, SwimlaneImpl> swimlanes = new HashMap<String, SwimlaneImpl>();
- public <T> T getExtension(Class<T> extensionClass) {
- if (extensionClass==null) {
- throw new JbpmException("extensionClass is null.");
- }
-
- if (extensionClass.equals(TaskExtension.class)) {
- return (T) this;
- }
-
- throw new JbpmException("unsuppported extension "+extensionClass);
- }
-
public void deleting() {
TaskDbSession taskDbSession = Environment.getFromCurrent(TaskDbSession.class);
if (taskDbSession!=null) {
@@ -67,28 +60,98 @@
}
}
- public Swimlane createSwimlane(SwimlaneDefinition swimlaneDefinition) {
- return null;
- }
+ public void initializeTask(TaskImpl task, TaskDefinitionImpl taskDefinition) {
+ if (taskDefinition.getName()!=null) {
+ task.setName(taskDefinition.getName());
+ }
+ task.setDescription(taskDefinition.getDescription());
+ task.setBlocking(taskDefinition.isBlocking());
+ task.setSignalling(taskDefinition.isSignalling());
+ task.setPriority(taskDefinition.getPriority());
+
+ SwimlaneDefinitionImpl swimlaneDefinition = taskDefinition.getSwimlaneDefinition();
+ if (swimlaneDefinition!=null) {
+ SwimlaneImpl swimlane = getInitializedSwimlane(swimlaneDefinition);
+ task.setSwimlane(swimlane);
+
+ // copy the swimlane assignments to the task
+ task.setAssignee(swimlane.getAssignee());
+ for (ParticipantImpl participant: swimlane.getParticipants()) {
+ task.addParticipant(participant.getIdentityRef(), participant.getParticipation());
+ }
+ }
- public Swimlane getSwimlane(String name) {
- return null;
+ initializeAssignments(taskDefinition, task);
}
- public SwimlaneDefinition getSwimlaneDefinition(String name) {
- return null;
- }
+ public SwimlaneImpl getInitializedSwimlane(SwimlaneDefinitionImpl swimlaneDefinition) {
+ Session session = Environment.getFromCurrent(Session.class);
+ JpdlExecution jpdlProcessInstance = (JpdlExecution) session.load(JpdlExecution.class, getProcessInstance().getDbid());
+
+ String swimlaneName = swimlaneDefinition.getName();
+ SwimlaneImpl swimlane = jpdlProcessInstance.getSwimlanes().get(swimlaneName);
+ if (swimlane==null) {
+ // initialize swimlane
+ swimlane = new SwimlaneImpl();
+ swimlane.setName(swimlaneName);
+ swimlane.setExecution(this);
+ jpdlProcessInstance.getSwimlanes().put(swimlaneName, swimlane);
+ initializeAssignments(swimlaneDefinition, swimlane);
+ }
- public TaskDefinition getTaskDefinition() {
- return null;
+ return swimlane;
}
- public TaskDefinition getTaskDefinition(String name) {
- return null;
+ public void initializeAssignments(SwimlaneDefinitionImpl assignmentDefinition, Assignable assignable) {
+ String assigneeExpression = assignmentDefinition.getAssigneeExpression();
+ if (assigneeExpression!=null) {
+ String assignee = resolveAssignmentExpression(assigneeExpression,
+ assignmentDefinition.getAssigneeExpressionLanguage());
+ assignable.setAssignee(assignee);
+
+ if (log.isTraceEnabled()) log.trace("task "+name+" assigned to "+assignee+" using expression "+assigneeExpression);
+ }
+
+ String candidateUsersExpression = assignmentDefinition.getCandidateUsersExpression();
+ if (candidateUsersExpression!=null) {
+ String candidateUsers =
+ resolveAssignmentExpression(candidateUsersExpression,
+ assignmentDefinition.getCandidateUsersExpressionLanguage());
+ StringTokenizer tokenizer = new StringTokenizer(candidateUsers, ",");
+ while (tokenizer.hasMoreTokens()) {
+ String candidateUser = tokenizer.nextToken();
+ assignable.addParticipant(new UserRef(candidateUser), Participant.CANDIDATE);
+ }
+ }
+
+ String candidateGroupsExpression = assignmentDefinition.getCandidateGroupsExpression();
+ if (candidateGroupsExpression!=null) {
+ String candidateGroups =
+ resolveAssignmentExpression(candidateGroupsExpression,
+ assignmentDefinition.getCandidateGroupsExpressionLanguage());
+ StringTokenizer tokenizer = new StringTokenizer(candidateGroups, ",");
+ while (tokenizer.hasMoreTokens()) {
+ String candidateGroup = tokenizer.nextToken();
+ assignable.addParticipant(new GroupRef(candidateGroup), Participant.CANDIDATE);
+ }
+ }
}
- public Task createTask(TaskDefinition taskDefinition) {
- TaskDbSession taskDbSession = Environment.getFromCurrent(TaskDbSession.class);
- return null;
+ protected String resolveAssignmentExpression(String expression, String expressionLanguage) {
+ ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
+ Object result = scriptManager.evaluateExpression(expression, this, expressionLanguage);
+ if ( (result ==null)
+ || (result instanceof String)
+ ) {
+ return (String) result;
+ }
+ throw new JbpmException("result of assignment expression "+expression+" is "+result+" ("+result.getClass().getName()+") instead of String");
}
+
+ public Map<String, SwimlaneImpl> getSwimlanes() {
+ return swimlanes;
+ }
+ public void setSwimlanes(Map<String, SwimlaneImpl> swimlanes) {
+ this.swimlanes = swimlanes;
+ }
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinition.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinition.java 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinition.java 2009-03-21 17:50:09 UTC (rev 4305)
@@ -21,9 +21,13 @@
*/
package org.jbpm.jpdl.internal.model;
-import org.jbpm.client.ClientProcessInstance;
+import java.util.HashMap;
+import java.util.Map;
+
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
+import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
/**
* @author Tom Baeyens
@@ -31,8 +35,31 @@
public class JpdlProcessDefinition extends ProcessDefinitionImpl {
private static final long serialVersionUID = 1L;
+
+ Map<String, SwimlaneDefinitionImpl> swimlaneDefinitions = new HashMap<String, SwimlaneDefinitionImpl>();
+ Map<String, TaskDefinitionImpl> taskDefinitions = new HashMap<String, TaskDefinitionImpl>();
protected ExecutionImpl newProcessInstance() {
return new JpdlExecution();
}
+
+ public SwimlaneDefinitionImpl createSwimlaneDefinition(String name) {
+ SwimlaneDefinitionImpl swimlaneDefinition = new SwimlaneDefinitionImpl();
+ swimlaneDefinitions.put(name, swimlaneDefinition);
+ return swimlaneDefinition;
+ }
+
+ public SwimlaneDefinitionImpl getSwimlaneDefinition(String name) {
+ return swimlaneDefinitions.get(name);
+ }
+
+ public TaskDefinitionImpl createTaskDefinition(String name) {
+ TaskDefinitionImpl taskDefinition = new TaskDefinitionImpl();
+ taskDefinitions.put(name, taskDefinition);
+ return taskDefinition;
+ }
+
+ public Map<String, TaskDefinitionImpl> getTaskDefinitions() {
+ return taskDefinitions;
+ }
}
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/TaskExtension.java (from rev 4304, jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/TaskExtension.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/TaskExtension.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/TaskExtension.java 2009-03-21 17:50:09 UTC (rev 4305)
@@ -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.model;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface TaskExtension {
+
+
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/TaskExtension.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-03-21 17:50:09 UTC (rev 4305)
@@ -25,24 +25,18 @@
import java.util.Enumeration;
import java.util.List;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.SAXParser;
-
import org.jbpm.activity.ActivityBehaviour;
import org.jbpm.internal.log.Log;
import org.jbpm.jpdl.internal.activity.JpdlActivityBinding;
+import org.jbpm.jpdl.internal.activity.TaskBinding;
import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
import org.jbpm.pvm.internal.model.ActivityImpl;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
import org.jbpm.pvm.internal.util.ReflectUtil;
import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.xml.DomBuilder;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
/**
* @author Tom Baeyens
@@ -90,13 +84,13 @@
}
public Object parseDocumentElement(Element documentElement, Parse parse) {
- ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) parse.getDocumentObject();
+ JpdlProcessDefinition processDefinition = (JpdlProcessDefinition) parse.getDocumentObject();
if (processDefinition==null) {
processDefinition = new JpdlProcessDefinition();
+ parse.setDocumentObject(processDefinition);
}
- StartActivities startActivities = new StartActivities();
- parse.pushObject(startActivities);
+ parse.pushObject(processDefinition);
try {
// process attribues
String name = XmlUtil.attribute(documentElement, "name", true, parse);
@@ -125,8 +119,16 @@
parse.pushObject(unresolvedTransitions);
// swimlanes
+ List<Element> swimlaneElements = XmlUtil.elements(documentElement, "swimlane");
+ for (Element swimlaneElement: swimlaneElements) {
+ String swimlaneName = XmlUtil.attribute(swimlaneElement, "name", true, parse);
+ if (swimlaneName!=null) {
+ SwimlaneDefinitionImpl swimlaneDefinition =
+ processDefinition.createSwimlaneDefinition(swimlaneName);
+ TaskBinding.parseAssignmentAttributes(swimlaneElement, swimlaneDefinition);
+ }
+ }
-
// activities
List<Element> elements = XmlUtil.elements(documentElement);
for (Element element: elements) {
@@ -156,14 +158,8 @@
}
- if (startActivities.size()==0) {
+ if (processDefinition.getInitial()==null) {
parse.addProblem("no start activity in process");
- } else if (startActivities.size()>1) {
- parse.addProblem("multiple start events not yet supported");
- // TODO verify that all start events have conditions
- } else {
- ActivityImpl uniqueStartEvent = startActivities.get(0);
- processDefinition.setInitial(uniqueStartEvent);
}
return processDefinition;
Deleted: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/StartActivities.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/StartActivities.java 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/StartActivities.java 2009-03-21 17:50:09 UTC (rev 4305)
@@ -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.xml;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jbpm.pvm.internal.model.ActivityImpl;
-
-
-/**
- * @author Tom Baeyens
- */
-public class StartActivities {
-
- List<ActivityImpl> startEvents = new ArrayList<ActivityImpl>();
-
-
- public void add(ActivityImpl startEventActivity) {
- startEvents.add(startEventActivity);
- }
-
- public int size() {
- return startEvents.size();
- }
-
- public ActivityImpl get(int i) {
- return startEvents.get(i);
- }
-
-}
Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.definition.hbm.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.definition.hbm.xml 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.definition.hbm.xml 2009-03-21 17:50:09 UTC (rev 4305)
@@ -4,11 +4,15 @@
<hibernate-mapping package="org.jbpm.pvm.internal.model" default-access="field">
<!-- ### PROCESS DEFINITION ############################################# -->
- <class name="ProcessDefinitionImpl" table="JBPM_PROCESS">
+ <class name="ProcessDefinitionImpl"
+ table="JBPM_PROCESS"
+ discriminator-value="pvm">
<!-- ProcessElementImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
+ <discriminator><column name="CLASS_" /></discriminator>
+
<version name="dbversion" column="DBVERSION_" />
<many-to-one name="properties"
class="WireProperties"
Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.execution.hbm.xml 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.execution.hbm.xml 2009-03-21 17:50:09 UTC (rev 4305)
@@ -19,10 +19,13 @@
</typedef>
<!-- ### PROCESS DEFINITION ############################################# -->
- <class name="ExecutionImpl" table="JBPM_EXECUTION">
+ <class name="ExecutionImpl"
+ table="JBPM_EXECUTION"
+ discriminator-value="pvm">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
+ <discriminator><column name="CLASS_" /></discriminator>
<version name="dbversion" column="DBVERSION_" />
<many-to-one name="activity"
@@ -34,8 +37,7 @@
<property name="hasVariables" column="HASVARS_" />
<map name="variables"
- cascade="all-delete-orphan"
- table="JBPM_VARIABLE">
+ cascade="all-delete-orphan">
<key foreign-key="FK_VAR_EXECUTION">
<column name="EXECUTION_" index="IDX_VAR_EXECUTION"/>
</key>
@@ -203,7 +205,7 @@
<generator class="native" />
</id>
<version name="dbversion" column="DBVERSION_" />
- <property name="blob" type="blob" column="BLOB_VALUE_" />
+ <property name="blob" type="blob"><column name="BLOB_VALUE_" /></property>
<property name="bytes" type="binary" column="BINARY_VALUE_"/>
<property name="clob" type="clob" column="CLOB_VALUE_" />
<property name="text" type="text" column="TEXT_VALUE_"/>
Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.jpdl.hbm.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.jpdl.hbm.xml 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.jpdl.hbm.xml 2009-03-21 17:50:09 UTC (rev 4305)
@@ -3,13 +3,39 @@
<hibernate-mapping default-access="field">
- <joined-subclass name="org.jbpm.jpdl.internal.model.JpdlProcessDefinition" table="JBPM_JPDL_PROCDEF" extends="org.jbpm.pvm.internal.model.ProcessDefinitionImpl">
- <key column="DBID_"/>
- </joined-subclass>
+ <subclass name="org.jbpm.jpdl.internal.model.JpdlProcessDefinition"
+ extends="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
+ discriminator-value="jpdl">
+ <map name="swimlaneDefinitions"
+ cascade="all-delete-orphan">
+ <key foreign-key="FK_SWLDEF_PROCESS">
+ <column name="PROCESS_SWL_" index="IDX_SWLDEF_PROCESS"/>
+ </key>
+ <map-key type="string" column="NAME_" />
+ <one-to-many class="org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl" />
+ </map>
+ <map name="taskDefinitions"
+ cascade="all-delete-orphan">
+ <key foreign-key="FK_TSKDEF_PROCESS">
+ <column name="PROCESS_" index="IDX_TSKDEF_PROCESS"/>
+ </key>
+ <map-key type="string" column="NAME_" />
+ <one-to-many class="org.jbpm.pvm.internal.task.TaskDefinitionImpl" />
+ </map>
+ </subclass>
- <joined-subclass name="org.jbpm.jpdl.internal.model.JpdlExecution" table="JBPM_JPDL_EXECUTION" extends="org.jbpm.pvm.internal.model.ExecutionImpl">
- <key column="DBID_"/>
- </joined-subclass>
+ <subclass name="org.jbpm.jpdl.internal.model.JpdlExecution"
+ extends="org.jbpm.pvm.internal.model.ExecutionImpl"
+ discriminator-value="jpdl">
+ <map name="swimlanes"
+ cascade="all-delete-orphan">
+ <key foreign-key="FK_SWIMLANE_EXEC">
+ <column name="EXECUTION_" index="IDX_SWIMLANE_EXEC"/>
+ </key>
+ <map-key type="string" column="NAME_" />
+ <one-to-many class="org.jbpm.pvm.internal.task.SwimlaneImpl" />
+ </map>
+ </subclass>
<class name="org.jbpm.jpdl.internal.activity.JpdlActivity" table="JBPM_JPDL_ACTIVITY" abstract="true" discriminator-value="X">
<id name="dbid" column="DBID_">
Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.task.hbm.xml 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.task.hbm.xml 2009-03-21 17:50:09 UTC (rev 4305)
@@ -4,21 +4,19 @@
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping auto-import="false" package="org.jbpm.pvm.internal.task" default-access="field">
- <!-- ### TASK DEFINITION ################################################ -->
- <class name="TaskDefinitionImpl" discriminator-value="T">
+ <!-- ### SWIMLANE DEFINITION ############################################ -->
+ <class name="SwimlaneDefinitionImpl"
+ table="JBPM_TASKDEF"
+ discriminator-value="S" >
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
- <discriminator type="char" column="CLASS_"/>
- <version name="dbversion" column="DBVERSION_" />
+ <discriminator><column name="CLASS_" /></discriminator>
+ <version name="dbversion" column="DBVERSION_" />
<property name="name" column="NAME_"/>
<property name="description" column="DESCR_"/>
- <property name="priority" column="PRIORITY_"/>
- <property name="dueDateDuration" column="DUEDATE_"/>
- <property name="isBlocking" column="BLOCK_"/>
- <property name="isSignalling" column="SIGNAL_"/>
<property name="assigneeExpression" column="ASS_EXPR_"/>
<property name="assigneeExpressionLanguage" column="ASS_EXPR_LANG_"/>
<property name="candidateUsersExpression" column="CNDUSR_EXPR_"/>
@@ -30,25 +28,35 @@
column="ASSIGNER_DESCR_"
cascade="all"
class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
- foreign-key="FK_TSK_ASIG_DESCR"
- index="IDX_TSK_ASIG_DESCR" />
+ foreign-key="FK_SWL_ASIG_DESCR"
+ index="IDX_SWL_ASIG_DESCR" />
- <many-to-one name="swimlaneDefinition"
- column="SWIMLANE_DEF_"
- cascade="all"
- class="SwimlaneDefinitionImpl"
- foreign-key="FK_TSK_SWIML_DEF"
- index="IDX_TSK_SWIML_DEF" />
-
- <list name="subTaskDefinitions" cascade="all-delete-orphan">
- <key column="TASKDEF_" />
- <list-index column="TASKDEF_IDX_" />
- <one-to-many class="TaskDefinitionImpl" />
- </list>
- </class>
+ <!-- ### TASK DEFINITION ################################################ -->
+ <subclass name="TaskDefinitionImpl" discriminator-value="T">
+ <property name="priority" column="PRIORITY_"/>
+ <property name="dueDateDuration" column="DUEDATE_"/>
+ <property name="isBlocking" column="BLOCK_"/>
+ <property name="isSignalling" column="SIGNAL_"/>
+
+ <many-to-one name="swimlaneDefinition"
+ column="SWIMLANE_DEF_"
+ cascade="all"
+ class="SwimlaneDefinitionImpl"
+ foreign-key="FK_TSK_SWIML_DEF"
+ index="IDX_TSK_SWIML_DEF" />
+
+ <list name="subTaskDefinitions" cascade="all-delete-orphan">
+ <key column="TASKDEF_" />
+ <list-index column="TASKDEF_IDX_" />
+ <one-to-many class="TaskDefinitionImpl" />
+ </list>
+ </subclass>
+ </class>
+
<!-- ### TASK ########################################################### -->
<class name="TaskImpl"
+ table="JBPM_TASK"
discriminator-value="T">
<id name="dbid" column="DBID_">
<generator class="native" />
@@ -109,7 +117,7 @@
</class>
<!-- ### PARTICIPANT #################################################### -->
- <class name="ParticipantImpl">
+ <class name="ParticipantImpl" table="JBPM_PARTICIPANT">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -132,19 +140,8 @@
</class>
- <!-- ### SWIMLANE DEFINITION ############################################ -->
- <class name="SwimlaneDefinitionImpl">
- <id name="dbid" column="DBID_">
- <generator class="native" />
- </id>
- <version name="dbversion" column="DBVERSION_" />
-
- <property name="name" column="NAME_"/>
- </class>
-
-
<!-- ### SWIMLANE ####################################################### -->
- <class name="SwimlaneImpl">
+ <class name="SwimlaneImpl" table="JBPM_SWIMLANE">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -161,7 +158,7 @@
<many-to-one name="execution"
class="org.jbpm.pvm.internal.model.ExecutionImpl"
column="EXECUTION_"
- foreign-key="FK_SWIMLANE_EXEC" />
+ foreign-key="none" />
<set name="participants" cascade="all-delete-orphan">
<key column="SWIMLANE_" />
@@ -169,8 +166,8 @@
</set>
</class>
+
-
<!-- ### QUERIES ######################################################## -->
<query name="findTasks">
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteTaskCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteTaskCmd.java 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteTaskCmd.java 2009-03-21 17:50:09 UTC (rev 4305)
@@ -24,6 +24,7 @@
import org.jbpm.JbpmException;
import org.jbpm.cmd.Command;
import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.task.Assignable;
import org.jbpm.pvm.internal.task.TaskImpl;
import org.jbpm.session.DbSession;
@@ -42,7 +43,7 @@
public Void execute(Environment environment) throws Exception {
DbSession dbSession = environment.get(DbSession.class);
- TaskImpl task = (TaskImpl) dbSession.get(TaskImpl.class, taskDbid);
+ Assignable task = (Assignable) dbSession.get(TaskImpl.class, taskDbid);
if (task!=null) {
dbSession.delete(task);
} else {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/NewTaskCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/NewTaskCmd.java 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/NewTaskCmd.java 2009-03-21 17:50:09 UTC (rev 4305)
@@ -21,9 +21,9 @@
*/
package org.jbpm.pvm.internal.cmd;
-import org.jbpm.cmd.Command;
import org.jbpm.env.Environment;
import org.jbpm.pvm.internal.task.TaskImpl;
+import org.jbpm.session.TaskDbSession;
import org.jbpm.task.Task;
/**
@@ -40,7 +40,8 @@
}
public Task execute(Environment environment) throws Exception {
- TaskImpl task = TaskImpl.create();
+ TaskDbSession taskDbSession = environment.get(TaskDbSession.class);
+ TaskImpl task = (TaskImpl) taskDbSession.createTask();
task.setParentTaskDbid(parentTaskDbid);
return task;
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessDeployer.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessDeployer.java 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessDeployer.java 2009-03-21 17:50:09 UTC (rev 4305)
@@ -22,7 +22,6 @@
package org.jbpm.pvm.internal.deploy;
import java.io.Serializable;
-import java.util.List;
import org.jbpm.ProcessDefinition;
import org.jbpm.client.ClientProcessDefinition;
@@ -69,7 +68,7 @@
// A problem was already added by the JpdlParser
return;
}
-
+
checkKey((ProcessDefinitionImpl)processDefinition, deployment, pvmDbSession);
checkVersion((ProcessDefinitionImpl)processDefinition, deployment, pvmDbSession);
checkId((ProcessDefinitionImpl)processDefinition, deployment, pvmDbSession);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/DeployerManager.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/DeployerManager.java 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/DeployerManager.java 2009-03-21 17:50:09 UTC (rev 4305)
@@ -57,7 +57,7 @@
}
for (Deployer deployer: deployers) {
- log.debug("applying deployer "+deployer+" to "+deployment);
+ if (log.isTraceEnabled()) log.trace("applying deployer "+deployer+" to "+deployment);
deployer.deploy(deployment);
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernateTaskDbSession.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernateTaskDbSession.java 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernateTaskDbSession.java 2009-03-21 17:50:09 UTC (rev 4305)
@@ -26,8 +26,10 @@
import org.hibernate.Query;
import org.jbpm.Execution;
import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.task.LifeCycle;
import org.jbpm.pvm.internal.task.SwimlaneImpl;
import org.jbpm.pvm.internal.task.TaskImpl;
+import org.jbpm.pvm.internal.util.Clock;
import org.jbpm.session.TaskDbSession;
import org.jbpm.task.Task;
@@ -62,10 +64,18 @@
}
}
- public Task newTask() {
- return TaskImpl.create();
+ public Task createTask() {
+ TaskImpl task = newTask();
+ task.setCreate(Clock.getCurrentTime());
+ task.setState(LifeCycle.initialise(task));
+ return task;
}
+ /** override to customize task type */
+ protected TaskImpl newTask() {
+ return new TaskImpl();
+ }
+
public void deletingExecution(Execution execution) {
deleteTasks(execution);
deleteSwimlanes(execution);
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/Assignable.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/Assignable.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/Assignable.java 2009-03-21 17:50:09 UTC (rev 4305)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.task;
+
+import org.jbpm.task.IdentityRef;
+import org.jbpm.task.Participant;
+
+/**
+ * @author Tom Baeyens
+ */
+public interface Assignable {
+
+ void setAssignee(String assigned);
+ Participant addParticipant(IdentityRef identityRef, String participation);
+}
\ No newline at end of file
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/Assignable.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/ParticipantImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/ParticipantImpl.java 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/ParticipantImpl.java 2009-03-21 17:50:09 UTC (rev 4305)
@@ -43,7 +43,7 @@
protected String userId;
protected String groupId;
protected String participation;
- protected TaskImpl task;
+ protected Assignable task;
protected SwimlaneImpl swimlane;
public ParticipantImpl() {
@@ -75,10 +75,10 @@
}
}
- public TaskImpl getTask() {
+ public Assignable getTask() {
return task;
}
- public void setTask(TaskImpl task) {
+ public void setTask(Assignable task) {
this.task = task;
}
public long getDbid() {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/SwimlaneDefinitionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/SwimlaneDefinitionImpl.java 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/SwimlaneDefinitionImpl.java 2009-03-21 17:50:09 UTC (rev 4305)
@@ -22,35 +22,37 @@
package org.jbpm.pvm.internal.task;
import java.io.Serializable;
+import java.util.StringTokenizer;
+import org.jbpm.JbpmException;
+import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.ProcessElementImpl;
+import org.jbpm.pvm.internal.script.ScriptManager;
import org.jbpm.pvm.internal.util.EqualsUtil;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.task.GroupRef;
+import org.jbpm.task.Participant;
+import org.jbpm.task.UserRef;
/**
* is a process role (aka participant).
*/
-public class SwimlaneDefinitionImpl implements Serializable {
+public class SwimlaneDefinitionImpl extends ProcessElementImpl implements Serializable {
private static final long serialVersionUID = 1L;
- protected long dbid;
- protected int dbversion;
- protected String name = null;
+ protected String name;
+ protected String description;
- /**
- * expression that resolves to 1 single actorId.
- */
- protected String actorIdExpression = null;
+ protected String assigneeExpression;
+ protected String assigneeExpressionLanguage;
+ protected String candidateUsersExpression;
+ protected String candidateUsersExpressionLanguage;
+ protected String candidateGroupsExpression;
+ protected String candidateGroupsExpressionLanguage;
+ protected Descriptor assignerDescriptor;
- /**
- * expression that resolves to a comma separated list of actorIds.
- */
- protected String candidatesExpression = null;
-
- /**
- * expression that resolves to an AssignmentHandler implementation.
- */
- protected String assignmentExpression = null;
-
// equals ///////////////////////////////////////////////////////////////////
// hack to support comparing hibernate proxies against the real objects
// since this always falls back to ==, we don't need to overwrite the hashcode
@@ -58,41 +60,60 @@
return EqualsUtil.equals(this, o);
}
- public void setActorIdExpression(String actorIdExpression) {
- // Note: combination of actorIdExpression and candidatesExpression is allowed
- this.actorIdExpression = actorIdExpression;
- this.assignmentExpression = null;
- }
- public void setCandidatesExpression(String pooledActorsExpression) {
- // Note: combination of actorIdExpression and pooledActorsExpression is allowed
- this.candidatesExpression = pooledActorsExpression;
- this.assignmentExpression = null;
- }
- public void setAssignmentExpression(String assignmentExpression) {
- // assignment expressions and assignmentDelegation are mutually exclusive
- this.actorIdExpression = null;
- this.candidatesExpression = null;
- this.assignmentExpression = assignmentExpression;
- }
-
// getters and setters //////////////////////////////////////////////////////
- public long getDbid() {
- return dbid;
+ public String getAssigneeExpression() {
+ return assigneeExpression;
}
+ public String getName() {
+ return name;
+ }
public void setName(String name) {
this.name = name;
}
- public String getName() {
- return name;
+ public String getDescription() {
+ return description;
}
- public String getActorIdExpression() {
- return actorIdExpression;
+ public void setDescription(String description) {
+ this.description = description;
}
- public String getCandidatesExpression() {
- return candidatesExpression;
+ public void setAssigneeExpression(String assigneeExpression) {
+ this.assigneeExpression = assigneeExpression;
}
- public String getAssignmentExpression() {
- return assignmentExpression;
+ public Descriptor getAssignerDescriptor() {
+ return assignerDescriptor;
}
+ public void setAssignerDescriptor(Descriptor assignerDescriptor) {
+ this.assignerDescriptor = assignerDescriptor;
+ }
+ public String getAssigneeExpressionLanguage() {
+ return assigneeExpressionLanguage;
+ }
+ public void setAssigneeExpressionLanguage(String assigneeExpressionLanguage) {
+ this.assigneeExpressionLanguage = assigneeExpressionLanguage;
+ }
+ public String getCandidateUsersExpression() {
+ return candidateUsersExpression;
+ }
+ public void setCandidateUsersExpression(String candidateUsersExpression) {
+ this.candidateUsersExpression = candidateUsersExpression;
+ }
+ public String getCandidateUsersExpressionLanguage() {
+ return candidateUsersExpressionLanguage;
+ }
+ public void setCandidateUsersExpressionLanguage(String candidateUsersExpressionLanguage) {
+ this.candidateUsersExpressionLanguage = candidateUsersExpressionLanguage;
+ }
+ public String getCandidateGroupsExpression() {
+ return candidateGroupsExpression;
+ }
+ public void setCandidateGroupsExpression(String candidateGroupsExpression) {
+ this.candidateGroupsExpression = candidateGroupsExpression;
+ }
+ public String getCandidateGroupsExpressionLanguage() {
+ return candidateGroupsExpressionLanguage;
+ }
+ public void setCandidateGroupsExpressionLanguage(String candidateGroupsExpressionLanguage) {
+ this.candidateGroupsExpressionLanguage = candidateGroupsExpressionLanguage;
+ }
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/SwimlaneImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/SwimlaneImpl.java 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/SwimlaneImpl.java 2009-03-21 17:50:09 UTC (rev 4305)
@@ -36,7 +36,7 @@
/**
* runtime process role for a specific process instance.
*/
-public class SwimlaneImpl implements Serializable, Swimlane {
+public class SwimlaneImpl implements Serializable, Swimlane, Assignable {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskDefinitionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskDefinitionImpl.java 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskDefinitionImpl.java 2009-03-21 17:50:09 UTC (rev 4305)
@@ -22,32 +22,17 @@
package org.jbpm.pvm.internal.task;
import java.io.Serializable;
-import java.util.Date;
import java.util.List;
-import java.util.StringTokenizer;
-import org.jbpm.JbpmException;
-import org.jbpm.env.Environment;
-import org.jbpm.pvm.internal.cal.Duration;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.ProcessElementImpl;
-import org.jbpm.pvm.internal.script.ScriptManager;
import org.jbpm.pvm.internal.util.Priority;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.task.GroupRef;
-import org.jbpm.task.Participant;
-import org.jbpm.task.UserRef;
/**
* defines a task and how the actor(s) must be calculated at runtime.
*/
-public class TaskDefinitionImpl extends ProcessElementImpl implements Serializable {
+public class TaskDefinitionImpl extends SwimlaneDefinitionImpl implements Serializable {
private static final long serialVersionUID = 1L;
- protected String name;
- protected String description;
-
/** @see #isBlocking() */
protected boolean isBlocking;
@@ -59,102 +44,7 @@
protected List<TaskDefinitionImpl> subTaskDefinitions;
protected int priority = Priority.NORMAL;
protected SwimlaneDefinitionImpl swimlaneDefinition;
- protected String assigneeExpression;
- protected String assigneeExpressionLanguage;
- protected String candidateUsersExpression;
- protected String candidateUsersExpressionLanguage;
- protected String candidateGroupsExpression;
- protected String candidateGroupsExpressionLanguage;
- protected Descriptor assignerDescriptor;
- public void initialize(TaskImpl task) {
- task.setName(name);
- task.setDescription(description);
- task.setBlocking(isBlocking);
- task.setSignalling(isSignalling);
- task.setPriority(priority);
-
- // TODO duedate calculation
-
- if (assigneeExpression!=null) {
- String assignee = resolveAssignmentExpression(assigneeExpression, assigneeExpressionLanguage, task.getExecution());
- task.setAssignee(assignee);
- }
-
- if (candidateUsersExpression!=null) {
- String candidateUsers = resolveAssignmentExpression(candidateUsersExpression, candidateUsersExpressionLanguage, task.getExecution());
- StringTokenizer tokenizer = new StringTokenizer(candidateUsers, ",");
- while (tokenizer.hasMoreTokens()) {
- String candidateUser = tokenizer.nextToken();
- task.addParticipant(new UserRef(candidateUser), Participant.CANDIDATE);
- }
- }
-
- if (candidateGroupsExpression!=null) {
- String candidateGroups = resolveAssignmentExpression(candidateGroupsExpression, candidateGroupsExpressionLanguage, task.getExecution());
- StringTokenizer tokenizer = new StringTokenizer(candidateGroups, ",");
- while (tokenizer.hasMoreTokens()) {
- String candidateGroup = tokenizer.nextToken();
- task.addParticipant(new GroupRef(candidateGroup), Participant.CANDIDATE);
- }
- }
- }
-
- protected String resolveAssignmentExpression(String expression, String expressionLanguage, ExecutionImpl execution) {
- ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
- Object result = scriptManager.evaluateExpression(expression, execution, expressionLanguage);
- if ( (result ==null)
- || (result instanceof String)
- ) {
- return (String) result;
- }
- throw new JbpmException("result of assignment expression is "+result.getClass().getName()+" instead of String");
- }
-
- // getters and setters //////////////////////////////////////////////////////
-
- public String getAssigneeExpression() {
- return assigneeExpression;
- }
- public void setAssigneeExpression(String assigneeExpression) {
- this.assigneeExpression = assigneeExpression;
- }
- public Descriptor getAssignerDescriptor() {
- return assignerDescriptor;
- }
- public void setAssignerDescriptor(Descriptor assignerDescriptor) {
- this.assignerDescriptor = assignerDescriptor;
- }
- public String getAssigneeExpressionLanguage() {
- return assigneeExpressionLanguage;
- }
- public void setAssigneeExpressionLanguage(String assigneeExpressionLanguage) {
- this.assigneeExpressionLanguage = assigneeExpressionLanguage;
- }
- public String getCandidateUsersExpression() {
- return candidateUsersExpression;
- }
- public void setCandidateUsersExpression(String candidateUsersExpression) {
- this.candidateUsersExpression = candidateUsersExpression;
- }
- public String getCandidateUsersExpressionLanguage() {
- return candidateUsersExpressionLanguage;
- }
- public void setCandidateUsersExpressionLanguage(String candidateUsersExpressionLanguage) {
- this.candidateUsersExpressionLanguage = candidateUsersExpressionLanguage;
- }
- public String getCandidateGroupsExpression() {
- return candidateGroupsExpression;
- }
- public void setCandidateGroupsExpression(String candidateGroupsExpression) {
- this.candidateGroupsExpression = candidateGroupsExpression;
- }
- public String getCandidateGroupsExpressionLanguage() {
- return candidateGroupsExpressionLanguage;
- }
- public void setCandidateGroupsExpressionLanguage(String candidateGroupsExpressionLanguage) {
- this.candidateGroupsExpressionLanguage = candidateGroupsExpressionLanguage;
- }
public boolean isBlocking() {
return isBlocking;
}
@@ -185,18 +75,6 @@
public void setSwimlaneDefinition(SwimlaneDefinitionImpl swimlaneDefinition) {
this.swimlaneDefinition = swimlaneDefinition;
}
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String getDescription() {
- return description;
- }
- public void setDescription(String description) {
- this.description = description;
- }
public String getDueDateDuration() {
return dueDateDuration;
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-03-21 17:50:09 UTC (rev 4305)
@@ -28,33 +28,40 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import java.util.StringTokenizer;
import org.jbpm.Execution;
import org.jbpm.JbpmException;
+import org.jbpm.activity.ActivityExecution;
import org.jbpm.env.Environment;
+import org.jbpm.internal.log.Log;
import org.jbpm.model.Comment;
import org.jbpm.pvm.internal.env.Authentication;
import org.jbpm.pvm.internal.model.CommentImpl;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.model.ScopeInstanceImpl;
+import org.jbpm.pvm.internal.script.ScriptManager;
import org.jbpm.pvm.internal.util.Clock;
import org.jbpm.pvm.internal.util.EqualsUtil;
import org.jbpm.pvm.internal.util.Priority;
+import org.jbpm.task.GroupRef;
import org.jbpm.task.IdentityRef;
import org.jbpm.task.Participant;
import org.jbpm.task.Swimlane;
import org.jbpm.task.Task;
+import org.jbpm.task.UserRef;
/**
* is one task instance that can be assigned to an actor (read: put in
* someones task list) and that can trigger the continuation of execution
* of the token upon completion.
*/
-public class TaskImpl extends ScopeInstanceImpl implements Serializable, Task {
+public class TaskImpl extends ScopeInstanceImpl implements Serializable, Task, Assignable {
private static final long serialVersionUID = 1L;
- // private static final Logger log = Logger.getLogger(TaskImpl.class.getName());
+ private static Log log = Log.getLog(TaskImpl.class.getName());
+
protected String id;
protected String name;
protected String description;
@@ -79,47 +86,47 @@
protected SwimlaneImpl swimlane;
- protected TaskImpl superTask;
+ protected Assignable superTask;
protected Set<TaskImpl> subTasks;
protected Long executionDbid;
protected Long parentTaskDbid;
- protected TaskImpl() {
+ public TaskImpl() {
}
- // creating a task
+ // parent for variable lookup ///////////////////////////////////////////////
- public static TaskImpl create() {
- TaskImpl task = new TaskImpl();
-
- /*
- // if a task class name is configured
- Environment environment = Environment.getCurrent();
- String taskClassName = environment!=null ? (String) environment.get(TaskImpl.CONTEXTKEY_TASK_CLASS_NAME, TaskImpl.SEARCHORDER_TASK_CLASS_NAME) : null;
- if (taskClassName!=null) {
- // dynamically instantiate it
- ClassLoader classLoader = environment.getClassLoader();
- Class<?> taskClass = ReflectUtil.loadClass(classLoader, taskClassName);
- task = (TaskImpl) ReflectUtil.newInstance(taskClass);
+ public ScopeInstanceImpl getParentVariableScope() {
+ return execution;
+ }
+
+ // assignment ///////////////////////////////////////////////////////////////
+
+ public void take() {
+ if (assignee!=null) {
+ throw new JbpmException("task "+dbid+" is already taken by "+assignee);
}
- // otherwise just use the default task implementation type
- else {
- task = new TaskImpl();
+ Authentication authentication = Environment.getFromCurrent(Authentication.class);
+ assignee = authentication.getUserId();
+ if (assignee==null) {
+ throw new JbpmException("no currently authenticated user");
}
- */
+ log.trace("user "+assignee+" takes "+this);
+
+ propagateAssigneeToSwimlane();
+ }
- task.setCreate(Clock.getCurrentTime());
+ public void setAssignee(String assigned) {
+ this.assignee = assigned;
+ propagateAssigneeToSwimlane();
+ }
- // initialise the task state
- task.state = LifeCycle.initialise(task);
-
- return task;
+ protected void propagateAssigneeToSwimlane() {
+ if (swimlane!=null) {
+ swimlane.setAssignee(assignee);
+ }
}
-
- public ScopeInstanceImpl getParentVariableScope() {
- return execution;
- }
// participants /////////////////////////////////////////////////////////////
@@ -150,7 +157,10 @@
if (participation==null) {
throw new JbpmException("participation is null");
}
- ParticipantImpl participant = new ParticipantImpl(identityRef, participation);
+ return addParticipant(new ParticipantImpl(identityRef, participation));
+ }
+
+ public Participant addParticipant(ParticipantImpl participant) {
participant.setTask(this);
if (participants==null) {
participants = new HashSet<ParticipantImpl>();
@@ -189,17 +199,6 @@
return null;
}
- public void take() {
- if (assignee!=null) {
- throw new JbpmException("task "+dbid+" is already taken by "+assignee);
- }
- Authentication authentication = Environment.getFromCurrent(Authentication.class);
- assignee = authentication.getUserId();
- if (assignee==null) {
- throw new JbpmException("no currently authenticated user");
- }
- }
-
// comments /////////////////////////////////////////////////////////////////
public List<Comment> getComments() {
@@ -364,19 +363,16 @@
public String getAssignee() {
return assignee;
}
- public void setAssignee(String assigned) {
- this.assignee = assigned;
- }
public Swimlane getSwimlane() {
return swimlane;
}
public void setSwimlane(SwimlaneImpl swimlane) {
this.swimlane = swimlane;
}
- public TaskImpl getSuperTask() {
+ public Assignable getSuperTask() {
return superTask;
}
- public void setSuperTask(TaskImpl superTask) {
+ public void setSuperTask(Assignable superTask) {
this.superTask = superTask;
}
public Integer getProgress() {
@@ -394,4 +390,16 @@
public void setParentTaskDbid(Long parentTaskDbid) {
this.parentTaskDbid = parentTaskDbid;
}
+ public void setParticipants(Set<ParticipantImpl> participants) {
+ this.participants = participants;
+ }
+ public void setState(String state) {
+ this.state = state;
+ }
+ public void setExecution(ExecutionImpl execution) {
+ this.execution = execution;
+ }
+ public void setSubTasks(Set<TaskImpl> subTasks) {
+ this.subTasks = subTasks;
+ }
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/StandardTransaction.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/StandardTransaction.java 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/StandardTransaction.java 2009-03-21 17:50:09 UTC (rev 4305)
@@ -56,7 +56,7 @@
// methods for interceptor //////////////////////////////////////////////////
public void begin() {
- log.debug("beginning "+this);
+ if (log.isTraceEnabled()) log.trace("beginning "+this);
state = State.ACTIVE;
}
@@ -102,7 +102,7 @@
// prepare //////////////////////////////////////////////////////////////
// the prepare loop will be skipped at the first exception
for (StandardResource standardResource: resources) {
- log.trace("preparing resource "+standardResource);
+ if (log.isTraceEnabled()) log.trace("preparing resource "+standardResource);
standardResource.prepare();
}
}
@@ -110,7 +110,7 @@
// for any exception in the prepare phase, we'll rollback
} catch (Exception exception) {
try {
- log.debug("resource threw exception in prepare. rolling back.");
+ if (log.isTraceEnabled()) log.trace("resource threw exception in prepare. rolling back.");
rollbackResources();
} catch (Exception rollbackException) {
log.error("rollback failed as well", rollbackException);
@@ -134,7 +134,7 @@
// all the resources are commited
for (StandardResource standardResource: resources) {
try {
- log.trace("committing resource "+standardResource);
+ if (log.isTraceEnabled()) log.trace("committing resource "+standardResource);
standardResource.commit();
// Exceptions in the commit phase will not lead to rollback, since some resources
@@ -151,7 +151,7 @@
state = State.COMMITTED;
afterCompletion();
- log.debug("committed "+this);
+ if (log.isTraceEnabled()) log.trace("committed "+this);
if (commitException!=null) {
if (commitException instanceof RuntimeException) {
@@ -172,7 +172,7 @@
throw new TransactionException("rollback on transaction in state "+state);
}
- log.trace("rolling back "+this);
+ if (log.isTraceEnabled()) log.trace("rolling back "+this);
beforeCompletion();
rollbackResources();
@@ -183,7 +183,7 @@
if (resources!=null) {
for (StandardResource resource: resources) {
try {
- log.trace("rolling back resource "+resource);
+ if (log.isTraceEnabled()) log.trace("rolling back resource "+resource);
resource.rollback();
} catch (Exception e) {
log.error("rollback failed for resource "+resource);
@@ -195,7 +195,7 @@
afterCompletion();
- log.debug("rolled back");
+ if (log.isTraceEnabled()) log.trace("rolled back");
}
// synchronizations /////////////////////////////////////////////////////////
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/HibernateSessionDescriptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/HibernateSessionDescriptor.java 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/HibernateSessionDescriptor.java 2009-03-21 17:50:09 UTC (rev 4305)
@@ -69,16 +69,16 @@
// open the hibernate-session
Session session = null;
if (useCurrent) {
- log.debug("getting current hibernate session");
+ if (log.isTraceEnabled()) log.trace("getting current hibernate session");
session = sessionFactory.getCurrentSession();
} else if (connectionName!=null) {
Connection connection = (Connection) wireContext.get(connectionName);
- log.debug("creating hibernate session with connection "+connection);
+ if (log.isTraceEnabled()) log.trace("creating hibernate session with connection "+connection);
session = sessionFactory.openSession(connection);
} else {
- log.debug("creating hibernate session");
+ if (log.isTraceEnabled()) log.trace("creating hibernate session");
session = sessionFactory.openSession();
}
Modified: jbpm4/trunk/modules/pvm/src/test/resources/jbpm.definition.hbm.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/jbpm.definition.hbm.xml 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/pvm/src/test/resources/jbpm.definition.hbm.xml 2009-03-21 17:50:09 UTC (rev 4305)
@@ -4,11 +4,15 @@
<hibernate-mapping package="org.jbpm.pvm.internal.model" default-access="field">
<!-- ### PROCESS DEFINITION ############################################# -->
- <class name="ProcessDefinitionImpl" table="JBPM_PROCESS">
+ <class name="ProcessDefinitionImpl"
+ table="JBPM_PROCESS"
+ discriminator-value="pvm">
<!-- ProcessElementImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
+ <discriminator><column name="CLASS_" /></discriminator>
+
<version name="dbversion" column="DBVERSION_" />
<many-to-one name="properties"
class="WireProperties"
Modified: jbpm4/trunk/modules/pvm/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/jbpm.execution.hbm.xml 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/pvm/src/test/resources/jbpm.execution.hbm.xml 2009-03-21 17:50:09 UTC (rev 4305)
@@ -19,10 +19,13 @@
</typedef>
<!-- ### PROCESS DEFINITION ############################################# -->
- <class name="ExecutionImpl" table="JBPM_EXECUTION">
+ <class name="ExecutionImpl"
+ table="JBPM_EXECUTION"
+ discriminator-value="pvm">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
+ <discriminator><column name="CLASS_" /></discriminator>
<version name="dbversion" column="DBVERSION_" />
<many-to-one name="activity"
@@ -34,8 +37,7 @@
<property name="hasVariables" column="HASVARS_" />
<map name="variables"
- cascade="all-delete-orphan"
- table="JBPM_VARIABLE">
+ cascade="all-delete-orphan">
<key foreign-key="FK_VAR_EXECUTION">
<column name="EXECUTION_" index="IDX_VAR_EXECUTION"/>
</key>
@@ -203,7 +205,7 @@
<generator class="native" />
</id>
<version name="dbversion" column="DBVERSION_" />
- <property name="blob" type="blob" column="BLOB_VALUE_" />
+ <property name="blob" type="blob"><column name="BLOB_VALUE_" /></property>
<property name="bytes" type="binary" column="BINARY_VALUE_"/>
<property name="clob" type="clob" column="CLOB_VALUE_" />
<property name="text" type="text" column="TEXT_VALUE_"/>
Modified: jbpm4/trunk/modules/pvm/src/test/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/jbpm.task.hbm.xml 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/pvm/src/test/resources/jbpm.task.hbm.xml 2009-03-21 17:50:09 UTC (rev 4305)
@@ -4,21 +4,19 @@
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping auto-import="false" package="org.jbpm.pvm.internal.task" default-access="field">
- <!-- ### TASK DEFINITION ################################################ -->
- <class name="TaskDefinitionImpl" discriminator-value="T">
+ <!-- ### SWIMLANE DEFINITION ############################################ -->
+ <class name="SwimlaneDefinitionImpl"
+ table="JBPM_TASKDEF"
+ discriminator-value="S" >
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
- <discriminator type="char" column="CLASS_"/>
- <version name="dbversion" column="DBVERSION_" />
+ <discriminator><column name="CLASS_" /></discriminator>
+ <version name="dbversion" column="DBVERSION_" />
<property name="name" column="NAME_"/>
<property name="description" column="DESCR_"/>
- <property name="priority" column="PRIORITY_"/>
- <property name="dueDateDuration" column="DUEDATE_"/>
- <property name="isBlocking" column="BLOCK_"/>
- <property name="isSignalling" column="SIGNAL_"/>
<property name="assigneeExpression" column="ASS_EXPR_"/>
<property name="assigneeExpressionLanguage" column="ASS_EXPR_LANG_"/>
<property name="candidateUsersExpression" column="CNDUSR_EXPR_"/>
@@ -30,25 +28,35 @@
column="ASSIGNER_DESCR_"
cascade="all"
class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
- foreign-key="FK_TSK_ASIG_DESCR"
- index="IDX_TSK_ASIG_DESCR" />
+ foreign-key="FK_SWL_ASIG_DESCR"
+ index="IDX_SWL_ASIG_DESCR" />
- <many-to-one name="swimlaneDefinition"
- column="SWIMLANE_DEF_"
- cascade="all"
- class="SwimlaneDefinitionImpl"
- foreign-key="FK_TSK_SWIML_DEF"
- index="IDX_TSK_SWIML_DEF" />
-
- <list name="subTaskDefinitions" cascade="all-delete-orphan">
- <key column="TASKDEF_" />
- <list-index column="TASKDEF_IDX_" />
- <one-to-many class="TaskDefinitionImpl" />
- </list>
- </class>
+ <!-- ### TASK DEFINITION ################################################ -->
+ <subclass name="TaskDefinitionImpl" discriminator-value="T">
+ <property name="priority" column="PRIORITY_"/>
+ <property name="dueDateDuration" column="DUEDATE_"/>
+ <property name="isBlocking" column="BLOCK_"/>
+ <property name="isSignalling" column="SIGNAL_"/>
+
+ <many-to-one name="swimlaneDefinition"
+ column="SWIMLANE_DEF_"
+ cascade="all"
+ class="SwimlaneDefinitionImpl"
+ foreign-key="FK_TSK_SWIML_DEF"
+ index="IDX_TSK_SWIML_DEF" />
+
+ <list name="subTaskDefinitions" cascade="all-delete-orphan">
+ <key column="TASKDEF_" />
+ <list-index column="TASKDEF_IDX_" />
+ <one-to-many class="TaskDefinitionImpl" />
+ </list>
+ </subclass>
+ </class>
+
<!-- ### TASK ########################################################### -->
<class name="TaskImpl"
+ table="JBPM_TASK"
discriminator-value="T">
<id name="dbid" column="DBID_">
<generator class="native" />
@@ -109,7 +117,7 @@
</class>
<!-- ### PARTICIPANT #################################################### -->
- <class name="ParticipantImpl">
+ <class name="ParticipantImpl" table="JBPM_PARTICIPANT">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -132,19 +140,8 @@
</class>
- <!-- ### SWIMLANE DEFINITION ############################################ -->
- <class name="SwimlaneDefinitionImpl">
- <id name="dbid" column="DBID_">
- <generator class="native" />
- </id>
- <version name="dbversion" column="DBVERSION_" />
-
- <property name="name" column="NAME_"/>
- </class>
-
-
<!-- ### SWIMLANE ####################################################### -->
- <class name="SwimlaneImpl">
+ <class name="SwimlaneImpl" table="JBPM_SWIMLANE">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -161,7 +158,7 @@
<many-to-one name="execution"
class="org.jbpm.pvm.internal.model.ExecutionImpl"
column="EXECUTION_"
- foreign-key="FK_SWIMLANE_EXEC" />
+ foreign-key="none" />
<set name="participants" cascade="all-delete-orphan">
<key column="SWIMLANE_" />
@@ -169,8 +166,8 @@
</set>
</class>
+
-
<!-- ### QUERIES ######################################################## -->
<query name="findTasks">
Modified: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.definition.hbm.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.definition.hbm.xml 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.definition.hbm.xml 2009-03-21 17:50:09 UTC (rev 4305)
@@ -4,11 +4,15 @@
<hibernate-mapping package="org.jbpm.pvm.internal.model" default-access="field">
<!-- ### PROCESS DEFINITION ############################################# -->
- <class name="ProcessDefinitionImpl" table="JBPM_PROCESS">
+ <class name="ProcessDefinitionImpl"
+ table="JBPM_PROCESS"
+ discriminator-value="pvm">
<!-- ProcessElementImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
+ <discriminator><column name="CLASS_" /></discriminator>
+
<version name="dbversion" column="DBVERSION_" />
<many-to-one name="properties"
class="WireProperties"
Modified: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.execution.hbm.xml 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.execution.hbm.xml 2009-03-21 17:50:09 UTC (rev 4305)
@@ -19,10 +19,13 @@
</typedef>
<!-- ### PROCESS DEFINITION ############################################# -->
- <class name="ExecutionImpl" table="JBPM_EXECUTION">
+ <class name="ExecutionImpl"
+ table="JBPM_EXECUTION"
+ discriminator-value="pvm">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
+ <discriminator><column name="CLASS_" /></discriminator>
<version name="dbversion" column="DBVERSION_" />
<many-to-one name="activity"
@@ -34,8 +37,7 @@
<property name="hasVariables" column="HASVARS_" />
<map name="variables"
- cascade="all-delete-orphan"
- table="JBPM_VARIABLE">
+ cascade="all-delete-orphan">
<key foreign-key="FK_VAR_EXECUTION">
<column name="EXECUTION_" index="IDX_VAR_EXECUTION"/>
</key>
@@ -203,7 +205,7 @@
<generator class="native" />
</id>
<version name="dbversion" column="DBVERSION_" />
- <property name="blob" type="blob" column="BLOB_VALUE_" />
+ <property name="blob" type="blob"><column name="BLOB_VALUE_" /></property>
<property name="bytes" type="binary" column="BINARY_VALUE_"/>
<property name="clob" type="clob" column="CLOB_VALUE_" />
<property name="text" type="text" column="TEXT_VALUE_"/>
Modified: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.jpdl.hbm.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.jpdl.hbm.xml 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.jpdl.hbm.xml 2009-03-21 17:50:09 UTC (rev 4305)
@@ -3,13 +3,39 @@
<hibernate-mapping default-access="field">
- <joined-subclass name="org.jbpm.jpdl.internal.model.JpdlProcessDefinition" table="JBPM_JPDL_PROCDEF" extends="org.jbpm.pvm.internal.model.ProcessDefinitionImpl">
- <key column="DBID_"/>
- </joined-subclass>
+ <subclass name="org.jbpm.jpdl.internal.model.JpdlProcessDefinition"
+ extends="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
+ discriminator-value="jpdl">
+ <map name="swimlaneDefinitions"
+ cascade="all-delete-orphan">
+ <key foreign-key="FK_SWLDEF_PROCESS">
+ <column name="PROCESS_SWL_" index="IDX_SWLDEF_PROCESS"/>
+ </key>
+ <map-key type="string" column="NAME_" />
+ <one-to-many class="org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl" />
+ </map>
+ <map name="taskDefinitions"
+ cascade="all-delete-orphan">
+ <key foreign-key="FK_TSKDEF_PROCESS">
+ <column name="PROCESS_" index="IDX_TSKDEF_PROCESS"/>
+ </key>
+ <map-key type="string" column="NAME_" />
+ <one-to-many class="org.jbpm.pvm.internal.task.TaskDefinitionImpl" />
+ </map>
+ </subclass>
- <joined-subclass name="org.jbpm.jpdl.internal.model.JpdlExecution" table="JBPM_JPDL_EXECUTION" extends="org.jbpm.pvm.internal.model.ExecutionImpl">
- <key column="DBID_"/>
- </joined-subclass>
+ <subclass name="org.jbpm.jpdl.internal.model.JpdlExecution"
+ extends="org.jbpm.pvm.internal.model.ExecutionImpl"
+ discriminator-value="jpdl">
+ <map name="swimlanes"
+ cascade="all-delete-orphan">
+ <key foreign-key="FK_SWIMLANE_EXEC">
+ <column name="EXECUTION_" index="IDX_SWIMLANE_EXEC"/>
+ </key>
+ <map-key type="string" column="NAME_" />
+ <one-to-many class="org.jbpm.pvm.internal.task.SwimlaneImpl" />
+ </map>
+ </subclass>
<class name="org.jbpm.jpdl.internal.activity.JpdlActivity" table="JBPM_JPDL_ACTIVITY" abstract="true" discriminator-value="X">
<id name="dbid" column="DBID_">
Modified: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.task.hbm.xml 2009-03-21 09:33:54 UTC (rev 4304)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.task.hbm.xml 2009-03-21 17:50:09 UTC (rev 4305)
@@ -4,21 +4,19 @@
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping auto-import="false" package="org.jbpm.pvm.internal.task" default-access="field">
- <!-- ### TASK DEFINITION ################################################ -->
- <class name="TaskDefinitionImpl" discriminator-value="T">
+ <!-- ### SWIMLANE DEFINITION ############################################ -->
+ <class name="SwimlaneDefinitionImpl"
+ table="JBPM_TASKDEF"
+ discriminator-value="S" >
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
- <discriminator type="char" column="CLASS_"/>
- <version name="dbversion" column="DBVERSION_" />
+ <discriminator><column name="CLASS_" /></discriminator>
+ <version name="dbversion" column="DBVERSION_" />
<property name="name" column="NAME_"/>
<property name="description" column="DESCR_"/>
- <property name="priority" column="PRIORITY_"/>
- <property name="dueDateDuration" column="DUEDATE_"/>
- <property name="isBlocking" column="BLOCK_"/>
- <property name="isSignalling" column="SIGNAL_"/>
<property name="assigneeExpression" column="ASS_EXPR_"/>
<property name="assigneeExpressionLanguage" column="ASS_EXPR_LANG_"/>
<property name="candidateUsersExpression" column="CNDUSR_EXPR_"/>
@@ -30,25 +28,35 @@
column="ASSIGNER_DESCR_"
cascade="all"
class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
- foreign-key="FK_TSK_ASIG_DESCR"
- index="IDX_TSK_ASIG_DESCR" />
+ foreign-key="FK_SWL_ASIG_DESCR"
+ index="IDX_SWL_ASIG_DESCR" />
- <many-to-one name="swimlaneDefinition"
- column="SWIMLANE_DEF_"
- cascade="all"
- class="SwimlaneDefinitionImpl"
- foreign-key="FK_TSK_SWIML_DEF"
- index="IDX_TSK_SWIML_DEF" />
-
- <list name="subTaskDefinitions" cascade="all-delete-orphan">
- <key column="TASKDEF_" />
- <list-index column="TASKDEF_IDX_" />
- <one-to-many class="TaskDefinitionImpl" />
- </list>
- </class>
+ <!-- ### TASK DEFINITION ################################################ -->
+ <subclass name="TaskDefinitionImpl" discriminator-value="T">
+ <property name="priority" column="PRIORITY_"/>
+ <property name="dueDateDuration" column="DUEDATE_"/>
+ <property name="isBlocking" column="BLOCK_"/>
+ <property name="isSignalling" column="SIGNAL_"/>
+
+ <many-to-one name="swimlaneDefinition"
+ column="SWIMLANE_DEF_"
+ cascade="all"
+ class="SwimlaneDefinitionImpl"
+ foreign-key="FK_TSK_SWIML_DEF"
+ index="IDX_TSK_SWIML_DEF" />
+
+ <list name="subTaskDefinitions" cascade="all-delete-orphan">
+ <key column="TASKDEF_" />
+ <list-index column="TASKDEF_IDX_" />
+ <one-to-many class="TaskDefinitionImpl" />
+ </list>
+ </subclass>
+ </class>
+
<!-- ### TASK ########################################################### -->
<class name="TaskImpl"
+ table="JBPM_TASK"
discriminator-value="T">
<id name="dbid" column="DBID_">
<generator class="native" />
@@ -109,7 +117,7 @@
</class>
<!-- ### PARTICIPANT #################################################### -->
- <class name="ParticipantImpl">
+ <class name="ParticipantImpl" table="JBPM_PARTICIPANT">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -132,19 +140,8 @@
</class>
- <!-- ### SWIMLANE DEFINITION ############################################ -->
- <class name="SwimlaneDefinitionImpl">
- <id name="dbid" column="DBID_">
- <generator class="native" />
- </id>
- <version name="dbversion" column="DBVERSION_" />
-
- <property name="name" column="NAME_"/>
- </class>
-
-
<!-- ### SWIMLANE ####################################################### -->
- <class name="SwimlaneImpl">
+ <class name="SwimlaneImpl" table="JBPM_SWIMLANE">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -161,7 +158,7 @@
<many-to-one name="execution"
class="org.jbpm.pvm.internal.model.ExecutionImpl"
column="EXECUTION_"
- foreign-key="FK_SWIMLANE_EXEC" />
+ foreign-key="none" />
<set name="participants" cascade="all-delete-orphan">
<key column="SWIMLANE_" />
@@ -169,8 +166,8 @@
</set>
</class>
+
-
<!-- ### QUERIES ######################################################## -->
<query name="findTasks">
17 years, 1 month
JBoss JBPM SVN: r4304 - in jbpm4/trunk/modules/jpdl/src: test/java/org/jbpm/jpdl/parsing and 1 other directory.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-03-21 05:33:54 -0400 (Sat, 21 Mar 2009)
New Revision: 4304
Modified:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/ProcessParsingTest.java
Log:
removed obsolete initial parsing
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-03-20 21:08:31 UTC (rev 4303)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-03-21 09:33:54 UTC (rev 4304)
@@ -98,6 +98,7 @@
StartActivities startActivities = new StartActivities();
parse.pushObject(startActivities);
try {
+ // process attribues
String name = XmlUtil.attribute(documentElement, "name", true, parse);
processDefinition.setName(name);
@@ -123,6 +124,10 @@
UnresolvedTransitions unresolvedTransitions = new UnresolvedTransitions();
parse.pushObject(unresolvedTransitions);
+ // swimlanes
+
+
+ // activities
List<Element> elements = XmlUtil.elements(documentElement);
for (Element element: elements) {
JpdlActivityBinding activityBinding = (JpdlActivityBinding) getBinding(element, "activity");
@@ -146,17 +151,6 @@
unresolvedTransition.resolve(processDefinition, parse);
}
- // TODO remove the initial attribute parsing
- String initialActivityName = XmlUtil.attribute(documentElement, "initial", false, parse);
- if (initialActivityName!=null) {
- ActivityImpl initial = processDefinition.getActivity(initialActivityName);
- if (initial==null) {
- parse.addProblem("initial activity '"+initialActivityName+"' was not found");
- } else {
- processDefinition.setInitial(initial);
- }
- }
-
} finally {
parse.popObject();
}
Modified: jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/ProcessParsingTest.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/ProcessParsingTest.java 2009-03-20 21:08:31 UTC (rev 4303)
+++ jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/ProcessParsingTest.java 2009-03-21 09:33:54 UTC (rev 4304)
@@ -58,12 +58,4 @@
assertTextPresent("attribute <process name=\"\" is empty", problems.get(0).getMsg());
assertTextPresent("no start activity in process", problems.get(1).getMsg());
}
-
- public void testProcessWithUnexistingInitial() {
- List<Problem> problems = parseProblems(
- "<process name='p' initial='ufo' />"
- );
- assertTextPresent("initial activity 'ufo' was not found", problems.get(0).getMsg());
- assertTextPresent("no start activity in process", problems.get(1).getMsg());
- }
}
17 years, 1 month
JBoss JBPM SVN: r4303 - in jbpm4/trunk/modules: pvm/src/main/java/org/jbpm/pvm/internal/model and 8 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-03-20 17:08:31 -0400 (Fri, 20 Mar 2009)
New Revision: 4303
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessDeployer.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/DefaultIdGenerator.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/execution/PvmProcessExecutionTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/StateTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/SignalExecutionTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/StartExecutionTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/AvgDurationTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/ChoiceDistributionTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/ProcessInstanceHistoryTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/ProcessDefinitionQueryTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/ProcessServiceTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/variables/BasicVariablesTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/variables/VariableBasicTypesTest.java
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Services.xml
Log:
JBPM-2054 rest friendly ids
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessDeployer.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessDeployer.java 2009-03-20 20:39:04 UTC (rev 4302)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessDeployer.java 2009-03-20 21:08:31 UTC (rev 4303)
@@ -129,7 +129,7 @@
protected void checkId(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment, PvmDbSession pvmDbSession) {
String id = processDefinition.getId();
if (id==null) {
- id = processDefinition.getKey()+":"+processDefinition.getVersion();
+ id = processDefinition.getKey()+"-"+processDefinition.getVersion();
log.trace("created id '"+id+"' for "+processDefinition);
processDefinition.setId(id);
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/DefaultIdGenerator.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/DefaultIdGenerator.java 2009-03-20 20:39:04 UTC (rev 4302)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/DefaultIdGenerator.java 2009-03-20 21:08:31 UTC (rev 4303)
@@ -61,7 +61,7 @@
executionPart = Long.toString(executionImpl.getDbid());
}
- String executionId = base+"/"+executionPart;
+ String executionId = base+"."+executionPart;
if (log.isDebugEnabled()) log.debug("generated execution id "+executionId);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java 2009-03-20 20:39:04 UTC (rev 4302)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java 2009-03-20 21:08:31 UTC (rev 4303)
@@ -29,7 +29,6 @@
import org.jbpm.Execution;
import org.jbpm.ExecutionQuery;
import org.jbpm.ExecutionService;
-import org.jbpm.cmd.CommandService;
import org.jbpm.pvm.internal.cmd.DeleteProcessInstance;
import org.jbpm.pvm.internal.cmd.EndProcessInstance;
import org.jbpm.pvm.internal.cmd.FindExecutionCmd;
@@ -100,19 +99,19 @@
public Execution signalExecutionByKey(String processDefinitionKey, String executionKey) {
- return signalExecutionById(processDefinitionKey+"/"+executionKey, null, null);
+ return signalExecutionById(processDefinitionKey+"."+executionKey, null, null);
}
public Execution signalExecutionByKey(String processDefinitionKey, String executionKey, String signalName) {
- return signalExecutionById(processDefinitionKey+"/"+executionKey, signalName, null);
+ return signalExecutionById(processDefinitionKey+"."+executionKey, signalName, null);
}
public Execution signalExecutionByKey(String processDefinitionKey, String executionKey, String signalName, Map<String, Object> parameters) {
- return signalExecutionById(processDefinitionKey+"/"+executionKey, signalName, parameters);
+ return signalExecutionById(processDefinitionKey+"."+executionKey, signalName, parameters);
}
public Execution signalExecutionByKey(String processDefinitionKey, String executionKey, Map<String, Object> parameters) {
- return signalExecutionById(processDefinitionKey+"/"+executionKey, null, parameters);
+ return signalExecutionById(processDefinitionKey+"."+executionKey, null, parameters);
}
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/execution/PvmProcessExecutionTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/execution/PvmProcessExecutionTest.java 2009-03-20 20:39:04 UTC (rev 4302)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/execution/PvmProcessExecutionTest.java 2009-03-20 21:08:31 UTC (rev 4303)
@@ -60,13 +60,13 @@
public void testStartProcessInstance() {
JbpmConfiguration environmentFactory = (JbpmConfiguration) getEnvironmentFactory();
ExecutionService executionService = environmentFactory.get(ExecutionService.class);
- Execution execution = executionService.startProcessInstanceById("test:1", "request17");
+ Execution execution = executionService.startProcessInstanceById("test-1", "request17");
}
public void testResumeProcessInstance() {
JbpmConfiguration environmentFactory = (JbpmConfiguration) getEnvironmentFactory();
ExecutionService executionService = environmentFactory.get(ExecutionService.class);
- Execution execution = executionService.signalExecutionById("test/request17", "end");
+ Execution execution = executionService.signalExecutionById("test.request17", "end");
}
}
\ No newline at end of file
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/StateTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/StateTest.java 2009-03-20 20:39:04 UTC (rev 4302)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/StateTest.java 2009-03-20 21:08:31 UTC (rev 4303)
@@ -46,7 +46,7 @@
"</process>"
);
- Execution execution = executionService.startProcessInstanceById("ThreeStates:1");
+ Execution execution = executionService.startProcessInstanceById("ThreeStates-1");
assertEquals("b", execution.getActivityName());
String executionId = execution.getId();
@@ -77,15 +77,15 @@
Execution execution = executionService.startProcessInstanceByKey("p", "one");
assertEquals("ed", execution.getActivityName());
- execution = executionService.signalExecutionById("p/one", "left");
+ execution = executionService.signalExecutionById("p.one", "left");
assertEquals("b", execution.getActivityName());
- executionService.startProcessInstanceById("p:1", "two");
- execution = executionService.signalExecutionById("p/two", "middle");
+ executionService.startProcessInstanceById("p-1", "two");
+ execution = executionService.signalExecutionById("p.two", "middle");
assertEquals("c", execution.getActivityName());
- executionService.startProcessInstanceById("p:1", "three");
- execution = executionService.signalExecutionById("p/three", "right");
+ executionService.startProcessInstanceById("p-1", "three");
+ execution = executionService.signalExecutionById("p.three", "right");
assertEquals("d", execution.getActivityName());
}
@@ -108,7 +108,7 @@
executionService.startProcessInstanceByKey("p", "one");
try {
- executionService.signalExecutionById("p/one", "left");
+ executionService.signalExecutionById("p.one", "left");
} catch (JbpmException e) {
assertTextPresent("no matching transition or event for default signal in state(a)", e.getMessage());
}
@@ -132,7 +132,7 @@
);
executionService.startProcessInstanceByKey("p", "one");
- Execution execution = executionService.signalExecutionById("p/one", "up");
+ Execution execution = executionService.signalExecutionById("p.one", "up");
assertEquals("a", execution.getActivityName());
}
@@ -147,7 +147,7 @@
);
executionService.startProcessInstanceByKey("p", "one");
- Execution execution = executionService.signalExecutionById("p/one");
+ Execution execution = executionService.signalExecutionById("p.one");
assertEquals("a", execution.getActivityName());
}
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/SignalExecutionTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/SignalExecutionTest.java 2009-03-20 20:39:04 UTC (rev 4302)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/SignalExecutionTest.java 2009-03-20 21:08:31 UTC (rev 4303)
@@ -84,11 +84,11 @@
assertEquals("a", execution.getActivityName());
- execution = executionService.signalExecutionById("ICL/82436");
+ execution = executionService.signalExecutionById("ICL.82436");
assertEquals("b", execution.getActivityName());
- execution = executionService.signalExecutionById("ICL/82436");
+ execution = executionService.signalExecutionById("ICL.82436");
assertEquals("c", execution.getActivityName());
}
@@ -113,7 +113,7 @@
variables.put("type", "Accident");
variables.put("amount", new Float(763.74));
- execution = executionService.signalExecutionById("ICL/82436", variables);
+ execution = executionService.signalExecutionById("ICL.82436", variables);
assertNotNull(execution);
String executionId = execution.getId();
@@ -143,112 +143,4 @@
execution = executionService.signalExecutionById(execution.getId());
assertEquals("a", execution.getActivityName());
}
-
- /*
-
- public void testSetVariable()
- {
- Execution execution = startExecution();
-
- String executionId = execution.getId();
- // set variable a to value text
- executionService.setVariable(executionId, "a", "text");
- // check if we can read that value back
- assertEquals("text", executionService.getVariable(executionId, "a"));
-
- // overwrite the value of variable a with another text
- executionService.setVariable(executionId, "a", "another text");
- // see if we can read another text back from the variable
- assertEquals("another text", executionService.getVariable(executionId, "a"));
- }
-
- public void testSetVariables()
- {
- Execution execution = startExecution();
-
- Map<String, Object> variables = new HashMap<String, Object>();
- variables.put("a", new Integer(1));
- variables.put("b", "text");
-
- // set variables in bulk by providing a map
- executionService.setVariables(execution.getId(), variables);
-
- Map<String, Object> expected = new HashMap<String, Object>(variables);
-
- Set<String> variableNames = new HashSet<String>();
- variableNames.add("a");
- variableNames.add("b");
-
- // read the variables back and compare
- assertEquals(expected, executionService.getVariables(execution.getId(), variableNames));
-
- // now set variables b and c with a map
- variables = new HashMap<String, Object>();
- variables.put("b", new Integer(99));
- variables.put("c", "another text");
-
- // this should leave a untouched, overwrite b and create c
- executionService.setVariables(execution.getId(), variables);
-
- // update the expected map
- expected.put("b", new Integer(99));
- expected.put("c", "another text");
-
- // add c to the variable names that should be collected
- variableNames.add("c");
-
- // read the variables back and compare
- assertEquals(expected, executionService.getVariables(execution.getId(), variableNames));
- }
-
- // helper methods ///////////////////////////////////////////////////////////
-
- /**
- * deploys 3 versions of process with name 'nuclear fusion', 2 versions of the processes 'ultimate seduction' and
- * 'publish book'
- void deployMultipleVersionsOfProcesses()
- {
- ProcessService processService = getEnvironmentFactory().get(ProcessService.class);
-
- ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion").key("NFU").activity("initial").initial().behaviour(
- WaitState.class).done();
- DeploymentImpl deploymentImpl = new DeploymentImpl(processDefinition);
- processService.deploy(deploymentImpl);
-
- processDefinition = ProcessFactory.build("ultimate seduction").key("USD").activity("initial").initial().behaviour(WaitState.class).done();
- deploymentImpl = new DeploymentImpl(processDefinition);
- processService.deploy(deploymentImpl);
-
- processDefinition = ProcessFactory.build("ultimate seduction").key("USD").activity("initial").initial().behaviour(WaitState.class).done();
- deploymentImpl = new DeploymentImpl(processDefinition);
- processService.deploy(deploymentImpl);
-
- processDefinition = ProcessFactory.build("nuclear fusion").key("NFU").activity("initial").initial().behaviour(WaitState.class).done();
- deploymentImpl = new DeploymentImpl(processDefinition);
- processService.deploy(deploymentImpl);
-
- processDefinition = ProcessFactory.build("publish book").key("PBO").activity("initial").initial().behaviour(WaitState.class).done();
- deploymentImpl = new DeploymentImpl(processDefinition);
- processService.deploy(deploymentImpl);
-
- processDefinition = ProcessFactory.build("nuclear fusion").key("NFU").activity("initial").initial().behaviour(WaitState.class).done();
- deploymentImpl = new DeploymentImpl(processDefinition);
- processService.deploy(deploymentImpl);
- }
-
- Execution startExecution()
- {
- ProcessService processService = getEnvironmentFactory().get(ProcessService.class);
-
- ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion").activity("initial").initial().behaviour(WaitState.class)
- .done();
- DeploymentImpl deploymentImpl = new DeploymentImpl(processDefinition);
- processService.deploy(deploymentImpl);
-
- ExecutionService executionService = getEnvironmentFactory().get(ExecutionService.class);
-
- return executionService.startExecutionByName("nuclear fusion");
- }
-
- */
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/StartExecutionTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/StartExecutionTest.java 2009-03-20 20:39:04 UTC (rev 4302)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/StartExecutionTest.java 2009-03-20 21:08:31 UTC (rev 4303)
@@ -116,7 +116,7 @@
assertEquals("text", executionService.getVariable(executionId, "b"));
// in the generated id, we can see if the right process definition version was taken
- assertTrue(execution.getId().startsWith("ICL/"));
+ assertTrue(execution.getId().startsWith("ICL."));
}
public void testStartNewProcessInstanceWithAKey() {
@@ -132,7 +132,7 @@
Execution execution = executionService.startProcessInstanceByKey("ICL", "one");
assertNotNull(execution);
- assertEquals("ICL/one", execution.getId());
+ assertEquals("ICL.one", execution.getId());
}
public void testStartNewProcessInstanceWithVariables() {
@@ -178,7 +178,7 @@
ProcessDefinition processDefinition = processService.findProcessDefinitionsByKey("ICL").get(0);
// start an execution for the process with the given id
- Execution execution = executionService.startProcessInstanceById("ICL:1");
+ Execution execution = executionService.startProcessInstanceById("ICL-1");
assertNotNull(execution);
// checking the state
@@ -189,7 +189,7 @@
assertNull(execution.getKey());
// if there is no user defined name or key specified in the execution,
// the default id generator will create a unique id like this: processDefinitionId/execution.dbid
- assertTrue(execution.getId().startsWith("ICL/"));
+ assertTrue(execution.getId().startsWith("ICL."));
// the last part of the execution key should be the dbid.
Long.parseLong(execution.getId().substring(4));
}
@@ -210,7 +210,7 @@
variables.put("b", "text");
// provide the variables in the start execution method
- Execution execution = executionService.startProcessInstanceById("ICL:1", variables);
+ Execution execution = executionService.startProcessInstanceById("ICL-1", variables);
String executionId = execution.getId();
assertEquals(new Integer(1), executionService.getVariable(executionId, "a"));
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/AvgDurationTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/AvgDurationTest.java 2009-03-20 20:39:04 UTC (rev 4302)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/AvgDurationTest.java 2009-03-20 21:08:31 UTC (rev 4303)
@@ -55,7 +55,7 @@
executeProcess();
executeProcess();
- Map<String, Long> avgDurations = historyService.avgDurationPerActivity("ICL:1");
+ Map<String, Long> avgDurations = historyService.avgDurationPerActivity("ICL-1");
Long avgDurationOne = avgDurations.get("one");
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/ChoiceDistributionTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/ChoiceDistributionTest.java 2009-03-20 20:39:04 UTC (rev 4302)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/ChoiceDistributionTest.java 2009-03-20 21:08:31 UTC (rev 4303)
@@ -24,7 +24,6 @@
import java.util.HashMap;
import java.util.Map;
-import org.jbpm.Execution;
import org.jbpm.test.JbpmTestCase;
@@ -63,7 +62,7 @@
executionService.startProcessInstanceByKey("TRS", variables);
executionService.startProcessInstanceByKey("TRS", variables);
- Map<String, Integer> choiceDistribution = historyService.choiceDistribution("TRS:1", "How far?");
+ Map<String, Integer> choiceDistribution = historyService.choiceDistribution("TRS-1", "How far?");
assertEquals(1, (int)choiceDistribution.get("far"));
assertEquals(3, (int)choiceDistribution.get("nearby"));
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/ProcessInstanceHistoryTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/ProcessInstanceHistoryTest.java 2009-03-20 20:39:04 UTC (rev 4302)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/ProcessInstanceHistoryTest.java 2009-03-20 21:08:31 UTC (rev 4303)
@@ -50,7 +50,7 @@
List<HistoryProcessInstance> historyProcessInstances = historyService
.createHistoryProcessInstanceQuery()
- .processDefinitionId("ICL:1")
+ .processDefinitionId("ICL-1")
.orderAsc(HistoryProcessInstanceQuery.PROPERTY_STARTTIME)
.execute();
@@ -67,7 +67,7 @@
// runtime database
List<Execution> executions = executionService
.createExecutionQuery()
- .processDefinitionId("ICL:1")
+ .processDefinitionId("ICL-1")
.execute();
assertEquals(0, executions.size());
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/ProcessDefinitionQueryTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/ProcessDefinitionQueryTest.java 2009-03-20 20:39:04 UTC (rev 4302)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/ProcessDefinitionQueryTest.java 2009-03-20 21:08:31 UTC (rev 4303)
@@ -131,9 +131,9 @@
.orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
.execute();
- assertEquals("make_friends:3", processDefinitions.get(0).getId());
- assertEquals("make_friends:2", processDefinitions.get(1).getId());
- assertEquals("make_friends:1", processDefinitions.get(2).getId());
- assertEquals("make_print:1", processDefinitions.get(3).getId());
+ assertEquals("make_friends-3", processDefinitions.get(0).getId());
+ assertEquals("make_friends-2", processDefinitions.get(1).getId());
+ assertEquals("make_friends-1", processDefinitions.get(2).getId());
+ assertEquals("make_print-1", processDefinitions.get(3).getId());
}
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/ProcessServiceTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/ProcessServiceTest.java 2009-03-20 20:39:04 UTC (rev 4302)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/ProcessServiceTest.java 2009-03-20 21:08:31 UTC (rev 4303)
@@ -46,7 +46,7 @@
assertEquals("Insurance claim", processDefinition.getName());
assertEquals("Insurance_claim", processDefinition.getKey());
assertEquals(1, processDefinition.getVersion());
- assertEquals("Insurance_claim:1", processDefinition.getId());
+ assertEquals("Insurance_claim-1", processDefinition.getId());
}
public void testProcessWithNameAndKey() {
@@ -62,7 +62,7 @@
assertEquals("Insurance claim", processDefinition.getName());
assertEquals("ICL", processDefinition.getKey());
assertEquals(1, processDefinition.getVersion());
- assertEquals("ICL:1", processDefinition.getId());
+ assertEquals("ICL-1", processDefinition.getId());
}
// interface methods ////////////////////////////////////////////////////////
@@ -93,7 +93,7 @@
assertEquals("Name with spaces", processDefinition.getName());
assertEquals("Name_with_spaces", processDefinition.getKey());
assertEquals(1, processDefinition.getVersion());
- assertEquals("Name_with_spaces:1", processDefinition.getId());
+ assertEquals("Name_with_spaces-1", processDefinition.getId());
}
public void testFindProcessDefinitions() {
@@ -132,7 +132,7 @@
);
// load it
- ProcessDefinition processDefinition = processService.findProcessDefinitionById("given:33");
+ ProcessDefinition processDefinition = processService.findProcessDefinitionById("given-33");
assertNotNull(processDefinition);
assertEquals("given", processDefinition.getName());
assertEquals(33, processDefinition.getVersion());
@@ -147,7 +147,7 @@
.deploy();
// delete it
- processService.deleteProcessDefinition("deleteme:33");
+ processService.deleteProcessDefinition("deleteme-33");
// check if the db is empty
assertEquals(0, processService.createProcessDefinitionQuery().execute().size());
@@ -170,7 +170,7 @@
executionService.startProcessInstanceByKey("deleteme");
// delete it all
- processService.deleteProcessDefinitionCascade("deleteme:33");
+ processService.deleteProcessDefinitionCascade("deleteme-33");
// check if the db is empty
assertEquals(0, processService.createProcessDefinitionQuery().execute().size());
@@ -194,10 +194,10 @@
// delete it all
try {
- processService.deleteProcessDefinition("deleteme:33");
+ processService.deleteProcessDefinition("deleteme-33");
fail("expected exception");
} catch (JbpmException e) {
- assertTextPresent("still 4 process instances for process definition deleteme:33", e.getMessage());
+ assertTextPresent("still 4 process instances for process definition deleteme-33", e.getMessage());
}
}
@@ -266,7 +266,7 @@
);
fail("expected exception");
} catch (JbpmException e) {
- assertTextPresent("process 'takethis:234' already exists", e.getMessage());
+ assertTextPresent("process 'takethis-234' already exists", e.getMessage());
}
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/variables/BasicVariablesTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/variables/BasicVariablesTest.java 2009-03-20 20:39:04 UTC (rev 4302)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/variables/BasicVariablesTest.java 2009-03-20 21:08:31 UTC (rev 4303)
@@ -45,7 +45,7 @@
);
executionService.startProcessInstanceByKey("var", "one");
- Set<String> variableNames = executionService.getVariableNames("var/one");
+ Set<String> variableNames = executionService.getVariableNames("var.one");
assertNotNull(variableNames);
assertEquals(0, variableNames.size());
}
@@ -70,12 +70,12 @@
executionService.startProcessInstanceByKey("var", variables, "one");
- Set<String> variableNames = executionService.getVariableNames("var/one");
+ Set<String> variableNames = executionService.getVariableNames("var.one");
assertNotNull(variableNames);
assertEquals(expectedVariableNames, variableNames);
- variables = executionService.getVariables("var/one", variableNames);
+ variables = executionService.getVariables("var.one", variableNames);
assertEquals(expectedVariables, variables);
}
@@ -91,10 +91,10 @@
);
executionService.startProcessInstanceByKey("var", "one");
- executionService.setVariable("var/one", "msg", "hello");
- assertEquals("hello", executionService.getVariable("var/one", "msg"));
- executionService.setVariable("var/one", "msg", "world");
- assertEquals("world", executionService.getVariable("var/one", "msg"));
+ executionService.setVariable("var.one", "msg", "hello");
+ assertEquals("hello", executionService.getVariable("var.one", "msg"));
+ executionService.setVariable("var.one", "msg", "world");
+ assertEquals("world", executionService.getVariable("var.one", "msg"));
}
public void testUpdateVariableToDifferentType() {
@@ -108,9 +108,9 @@
);
executionService.startProcessInstanceByKey("var", "one");
- executionService.setVariable("var/one", "msg", "hello");
- assertEquals("hello", executionService.getVariable("var/one", "msg"));
- executionService.setVariable("var/one", "msg", new Integer(5));
- assertEquals(new Integer(5), executionService.getVariable("var/one", "msg"));
+ executionService.setVariable("var.one", "msg", "hello");
+ assertEquals("hello", executionService.getVariable("var.one", "msg"));
+ executionService.setVariable("var.one", "msg", new Integer(5));
+ assertEquals(new Integer(5), executionService.getVariable("var.one", "msg"));
}
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/variables/VariableBasicTypesTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/variables/VariableBasicTypesTest.java 2009-03-20 20:39:04 UTC (rev 4302)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/variables/VariableBasicTypesTest.java 2009-03-20 21:08:31 UTC (rev 4303)
@@ -43,8 +43,8 @@
);
executionService.startProcessInstanceByKey("var", "one");
- executionService.setVariable("var/one", "msg", variableValue);
- assertEquals(variableValue, executionService.getVariable("var/one", "msg"));
+ executionService.setVariable("var.one", "msg", variableValue);
+ assertEquals(variableValue, executionService.getVariable("var.one", "msg"));
}
public void testVariableTypeString() {
@@ -123,8 +123,8 @@
// now check if an update still works ok
// updating a serialized object might fail when the blob is cached by hibernate
SerializeMe newValue = new SerializeMe(generateString("another text ", 500));
- executionService.setVariable("var/one", "msg", newValue);
- assertEquals(newValue, executionService.getVariable("var/one", "msg"));
+ executionService.setVariable("var.one", "msg", newValue);
+ assertEquals(newValue, executionService.getVariable("var.one", "msg"));
}
protected String generateString(String base, int multiplier) {
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Services.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Services.xml 2009-03-20 20:39:04 UTC (rev 4302)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Services.xml 2009-03-20 21:08:31 UTC (rev 4303)
@@ -74,7 +74,7 @@
</para>
<para>During deployment, an <literal>id</literal> is assigned to the process
definitions. The <literal>id</literal> will have format
- <literal>{key}:{version}</literal>
+ <literal>{key}-{version}</literal> with a dash between key and version
</para>
<para>If <literal>key</literal> is not provided, it is generated automatically
based on the name. All non alpha numeric characters in the name will be replaced
@@ -196,7 +196,7 @@
<para>If instead you want to start a new process instance in a very
specific version, you can use the id of the process definition like this:
</para>
- <programlisting>executionService.startProcessInstanceById("ICL:1");</programlisting>
+ <programlisting>executionService.startProcessInstanceById("ICL-1");</programlisting>
</section>
<section id="withakey">
@@ -209,9 +209,10 @@
</para>
<programlisting>executionService.startProcessInstanceByKey("ICL", "CL92837");</programlisting>
<para>The key is used to create the id of the process instance.
- The format used is <literal>{process-key}/{execution-id}</literal>.
+ The format used is <literal>{process-key}.{execution-id}</literal>.
+ With a dot between process-key and execution-id.
So execution created in the previous code snippet will have id
- <literal>ICL/CL92837</literal>.
+ <literal>ICL.CL92837</literal>.
</para>
<para>If no user defined key is provided, the DB primary key is taken
as the key. In that case, the id can be retrieved like this:
@@ -265,9 +266,9 @@
</para>
<programlisting>executionService.signalExecutionByKey("ICL", "82436");</programlisting>
<para>Alternatively, the execution that must be signaled can be referenced
- by a unique execution id. In the next snippet, <literal>ICL/82436</literal>
+ by a unique execution id. In the next snippet, <literal>ICL.82436</literal>
refers to the executionId.</para>
- <programlisting>executionService.signalExecutionById("ICL/82436");</programlisting>
+ <programlisting>executionService.signalExecutionById("ICL.82436");</programlisting>
<para>Optionally some data can be passed along with a signal: a <literal>signalName</literal>
and <literal>parameters</literal>. How the signalName gets used depends on
the execution's current activity. The parameters get stored as process variables.
17 years, 1 month
JBoss JBPM SVN: r4302 - in jbpm4/trunk/modules: examples/src/test/java/org/jbpm/examples/task and 9 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-03-20 16:39:04 -0400 (Fri, 20 Mar 2009)
New Revision: 4302
Added:
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/variables/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/variables/TaskVariablesTest.java
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/variables/
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/variables/process.jpdl.xml
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AbstractServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/IdentityServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java
Removed:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentityServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskServiceImpl.java
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/HistoryService.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/IdentityService.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/ManagementService.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessService.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskActivity.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariableNamesCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariablesCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SetVariablesCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/HistoryServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ManagementServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskDefinitionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IdentityServiceBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TaskServiceBinding.java
Log:
JBPM-2118 process variables
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java 2009-03-20 16:51:42 UTC (rev 4301)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java 2009-03-20 20:39:04 UTC (rev 4302)
@@ -21,6 +21,7 @@
*/
package org.jbpm;
+import java.sql.Connection;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -121,10 +122,10 @@
ExecutionQuery createProcessInstanceQuery();
/** creates or overwrites a variable value on the referenced execution */
- Execution setVariable(String executionId, String name, Object value);
+ void setVariable(String executionId, String name, Object value);
/** creates or overwrites the variable values on the referenced execution */
- Execution setVariables(String executionId, Map<String, Object> variables);
+ void setVariables(String executionId, Map<String, Object> variables);
/** retrieves a variable */
Object getVariable(String executionId, String variableName);
@@ -140,4 +141,13 @@
/** delete a process instance */
void deleteProcessInstance(String processInstanceId);
+
+
+ /** provide a userId that will be used in the next method invocation
+ * on this service by this thread. */
+ void setUserId(String userId);
+
+ /** provide a JDBC connection that will be used in the next method
+ * invocation on this service by this thread. */
+ void setConnection(Connection connection);
}
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/HistoryService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/HistoryService.java 2009-03-20 16:51:42 UTC (rev 4301)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/HistoryService.java 2009-03-20 20:39:04 UTC (rev 4302)
@@ -21,6 +21,7 @@
*/
package org.jbpm;
+import java.sql.Connection;
import java.util.Map;
import org.jbpm.history.HistoryActivityInstanceQuery;
@@ -43,4 +44,14 @@
/** returns for each transitionName, the number of times that transition was taken */
Map<String, Integer> choiceDistribution(String processDefinitionId, String activityName);
+
+
+ /** provide a userId that will be used in the next method invocation
+ * on this service by this thread. */
+ void setUserId(String userId);
+
+ /** provide a JDBC connection that will be used in the next method
+ * invocation on this service by this thread. */
+ void setConnection(Connection connection);
+
}
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/IdentityService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/IdentityService.java 2009-03-20 16:51:42 UTC (rev 4301)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/IdentityService.java 2009-03-20 20:39:04 UTC (rev 4302)
@@ -21,6 +21,7 @@
*/
package org.jbpm;
+import java.sql.Connection;
import java.util.List;
import org.jbpm.identity.Group;
@@ -88,4 +89,11 @@
* not throw an exception and have no effect. */
void deleteMembership(String userId, String groupId, String role);
+ /** provide a userId that will be used in the next method invocation
+ * on this service by this thread. */
+ void setUserId(String userId);
+
+ /** provide a JDBC connection that will be used in the next method
+ * invocation on this service by this thread. */
+ void setConnection(Connection connection);
}
\ No newline at end of file
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ManagementService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ManagementService.java 2009-03-20 16:51:42 UTC (rev 4301)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ManagementService.java 2009-03-20 20:39:04 UTC (rev 4302)
@@ -21,8 +21,10 @@
*/
package org.jbpm;
+import java.sql.Connection;
+
/** operations targeted to system operators that need to keep
* the process engine up and running. This functionality is typically
* exposed through a management web console.
@@ -41,4 +43,11 @@
/** search for jobs */
JobQuery createJobQuery();
+ /** provide a userId that will be used in the next method invocation
+ * on this service by this thread. */
+ void setUserId(String userId);
+
+ /** provide a JDBC connection that will be used in the next method
+ * invocation on this service by this thread. */
+ void setConnection(Connection connection);
}
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessService.java 2009-03-20 16:51:42 UTC (rev 4301)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessService.java 2009-03-20 20:39:04 UTC (rev 4302)
@@ -21,6 +21,7 @@
*/
package org.jbpm;
+import java.sql.Connection;
import java.util.List;
@@ -59,4 +60,13 @@
/** retrieves an attachment of a process definition */
byte[] getAttachment(String processDefinitionId, String name);
+
+
+ /** provide a userId that will be used in the next method invocation
+ * on this service by this thread. */
+ void setUserId(String userId);
+
+ /** provide a JDBC connection that will be used in the next method
+ * invocation on this service by this thread. */
+ void setConnection(Connection connection);
}
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java 2009-03-20 16:51:42 UTC (rev 4301)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java 2009-03-20 20:39:04 UTC (rev 4302)
@@ -23,6 +23,8 @@
import java.sql.Connection;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
import org.jbpm.model.Comment;
import org.jbpm.task.GroupRef;
@@ -61,8 +63,12 @@
Task getTask(long taskDbid);
/** Marks the task with the given identifier as completed.
- * This operation may result in a process instance being resumed. */
+ * This operation may result in a process instance being triggered. */
void submitTask(long taskDbid);
+
+ /** Marks the task with the given identifier as completed.
+ * This operation may result in a process instance being triggered. */
+ void submit(long taskDbid, Map<String, Object> variables);
/** Removes the task with the given identifier from persistent storage. */
void deleteTask(long taskDbid);
@@ -133,6 +139,22 @@
* this will recursively delete all replies to this comment. */
void deleteComment(long commentDbid);
+ /** creates or overwrites a variable value on the given task */
+ void setVariable(long taskDbid, String name, Object value);
+
+ /** creates or overwrites the variable values on the given task */
+ void setVariables(long taskDbid, Map<String, Object> variables);
+
+ /** retrieves a variable */
+ Object getVariable(long taskDbid, String variableName);
+
+ /** all the variables visible in the given task */
+ Set<String> getVariableNames(long taskDbid);
+
+ /** retrieves a map of variables */
+ Map<String, Object> getVariables(long taskDbid, Set<String> variableNames);
+
+
/** provide a userId that will be used in the next method invocation
* on this service by this thread. */
void setUserId(String userId);
Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/variables/TaskVariablesTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/variables/TaskVariablesTest.java (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/variables/TaskVariablesTest.java 2009-03-20 20:39:04 UTC (rev 4302)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.examples.task.variables;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jbpm.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskVariablesTest extends JbpmTestCase {
+
+ public void testTaskAssignee() {
+ deployJpdlResource("org/jbpm/examples/task/variables/process.jpdl.xml");
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("category", "big");
+ variables.put("dollars", 100000);
+ executionService.startProcessInstanceByKey("TaskVariables", variables);
+
+ List<Task> taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ Task task = taskList.get(0);
+ long taskDbid = task.getDbid();
+
+ Set<String> variableNames = taskService.getVariableNames(taskDbid);
+
+ Set<String> expectedVariableNames = new HashSet<String>();
+ expectedVariableNames.add("category");
+ expectedVariableNames.add("dollars");
+
+ assertEquals(expectedVariableNames, variableNames);
+
+ Map<String, Object> expectedVariables = variables;
+
+ variables = taskService.getVariables(taskDbid, variableNames);
+
+ assertEquals(expectedVariables, variables);
+ }
+}
Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/variables/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/variables/process.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/variables/process.jpdl.xml 2009-03-20 20:39:04 UTC (rev 4302)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="TaskVariables">
+
+ <start g="20,20,48,48">
+ <transition to="review" />
+ </start>
+
+ <task name="review"
+ assignee="johndoe"
+ g="96,16,127,52">
+
+ <transition to="wait" />
+ </task>
+
+ <state name="wait" g="255,16,88,52"/>
+
+</process>
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskActivity.java 2009-03-20 16:51:42 UTC (rev 4301)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskActivity.java 2009-03-20 20:39:04 UTC (rev 4302)
@@ -46,10 +46,13 @@
TaskDbSession taskDbSession = Environment.getFromCurrent(TaskDbSession.class);
TaskImpl task = TaskImpl.create();
task.setExecution(execution);
- task.setName(execution.getActivityName());
taskDefinition.initialize(task);
+ if (task.getName()==null) {
+ task.setName(execution.getActivityName());
+ }
+
taskDbSession.saveTask(task);
execution.historyTaskStart(task);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariableNamesCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariableNamesCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariableNamesCmd.java 2009-03-20 20:39:04 UTC (rev 4302)
@@ -25,9 +25,10 @@
import org.jbpm.JbpmException;
import org.jbpm.client.ClientExecution;
-import org.jbpm.cmd.Command;
import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.task.TaskImpl;
import org.jbpm.session.PvmDbSession;
+import org.jbpm.session.TaskDbSession;
/**
@@ -38,6 +39,7 @@
private static final long serialVersionUID = 1L;
String executionId;
+ long taskDbid;
public GetVariableNamesCmd(String executionId) {
if (executionId==null) {
@@ -46,10 +48,21 @@
this.executionId = executionId;
}
+ public GetVariableNamesCmd(long taskDbid) {
+ this.taskDbid = taskDbid;
+ }
+
public Set<String> execute(Environment environment) throws Exception {
- PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
- ClientExecution execution = pvmDbSession.findExecutionById(executionId);
- return execution.getVariableKeys();
+ if (executionId!=null) {
+ PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
+ ClientExecution execution = pvmDbSession.findExecutionById(executionId);
+ return execution.getVariableKeys();
+
+ } else {
+ TaskDbSession taskDbSession = environment.get(TaskDbSession.class);
+ TaskImpl task = (TaskImpl) taskDbSession.findTaskByDbid(taskDbid);
+ return task.getVariableKeys();
+ }
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariablesCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariablesCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariablesCmd.java 2009-03-20 20:39:04 UTC (rev 4302)
@@ -27,9 +27,10 @@
import org.jbpm.JbpmException;
import org.jbpm.client.ClientExecution;
-import org.jbpm.cmd.Command;
import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.task.TaskImpl;
import org.jbpm.session.PvmDbSession;
+import org.jbpm.session.TaskDbSession;
/**
* @author Tom Baeyens
@@ -39,6 +40,7 @@
private static final long serialVersionUID = 1L;
protected String executionId;
+ protected long taskDbid;
protected Set<String> variableNames;
public GetVariablesCmd(String executionId, Set<String> variableNames) {
@@ -52,15 +54,29 @@
this.variableNames = variableNames;
}
+ public GetVariablesCmd(long taskDbid, Set<String> variableNames) {
+ this.taskDbid = taskDbid;
+ this.variableNames = variableNames;
+ }
+
public Map<String, Object> execute(Environment environment) throws Exception {
- PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
-
- ClientExecution execution = pvmDbSession.findExecutionById(executionId);
-
Map<String, Object> variables = new HashMap<String, Object>();
- for (String variableName : variableNames) {
- Object value = execution.getVariable(variableName);
- variables.put(variableName, value);
+
+ if (executionId!=null) {
+ PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
+ ClientExecution execution = pvmDbSession.findExecutionById(executionId);
+ for (String variableName : variableNames) {
+ Object value = execution.getVariable(variableName);
+ variables.put(variableName, value);
+ }
+
+ } else {
+ TaskDbSession taskDbSession = environment.get(TaskDbSession.class);
+ TaskImpl task = (TaskImpl) taskDbSession.findTaskByDbid(taskDbid);
+ for (String variableName : variableNames) {
+ Object value = task.getVariable(variableName);
+ variables.put(variableName, value);
+ }
}
return variables;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SetVariablesCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SetVariablesCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SetVariablesCmd.java 2009-03-20 20:39:04 UTC (rev 4302)
@@ -21,20 +21,24 @@
*/
package org.jbpm.pvm.internal.cmd;
-import org.jbpm.Execution;
+import java.util.Map;
+
import org.jbpm.JbpmException;
import org.jbpm.client.ClientExecution;
import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.task.TaskImpl;
+import org.jbpm.session.TaskDbSession;
/**
* @author Tom Baeyens
*/
-public class SetVariablesCmd extends VariablesCmd<Execution> {
+public class SetVariablesCmd extends VariablesCmd<Void> {
private static final long serialVersionUID = 1L;
protected String executionId = null;
+ protected long taskDbid;
public SetVariablesCmd(String executionId) {
if (executionId==null) {
@@ -43,15 +47,22 @@
this.executionId = executionId;
}
- public SetVariablesCmd(String executionId, String key, Object variable) {
- this(executionId);
- addVariable(key, variable);
+ public SetVariablesCmd(long taskDbid) {
+ this.taskDbid = taskDbid;
}
- public Execution execute(Environment environment) throws Exception {
- ClientExecution execution = getExecution(environment, executionId);
- execution.setVariables(variables);
- return execution;
+ public Void execute(Environment environment) throws Exception {
+ if (executionId!=null) {
+ ClientExecution execution = getExecution(environment, executionId);
+ execution.setVariables(variables);
+
+ } else {
+ TaskDbSession taskDbSession = environment.get(TaskDbSession.class);
+ TaskImpl task = (TaskImpl) taskDbSession.findTaskByDbid(taskDbid);
+ task.setVariables(variables);
+ }
+
+ return null;
}
public String getExecutionId() {
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentityServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentityServiceImpl.java 2009-03-20 16:51:42 UTC (rev 4301)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentityServiceImpl.java 2009-03-20 20:39:04 UTC (rev 4302)
@@ -1,105 +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.pvm.internal.identity.impl;
-
-import java.util.List;
-
-import org.jbpm.IdentityService;
-import org.jbpm.cmd.CommandService;
-import org.jbpm.identity.Group;
-import org.jbpm.identity.User;
-import org.jbpm.pvm.internal.identity.cmd.CreateGroup;
-import org.jbpm.pvm.internal.identity.cmd.CreateMembership;
-import org.jbpm.pvm.internal.identity.cmd.CreateUser;
-import org.jbpm.pvm.internal.identity.cmd.DeleteGroup;
-import org.jbpm.pvm.internal.identity.cmd.DeleteMembership;
-import org.jbpm.pvm.internal.identity.cmd.DeleteUser;
-import org.jbpm.pvm.internal.identity.cmd.FindGroup;
-import org.jbpm.pvm.internal.identity.cmd.FindGroups;
-import org.jbpm.pvm.internal.identity.cmd.FindUser;
-import org.jbpm.pvm.internal.identity.cmd.FindUsers;
-
-
-/**
- * @author Tom Baeyens
- */
-public class IdentityServiceImpl implements IdentityService {
-
- protected CommandService commandService;
-
- public void createUser(String userId, String givenName, String familyName) {
- commandService.execute(new CreateUser(userId, givenName, familyName));
- }
-
- public User findUserById(String userId) {
- return commandService.execute(new FindUser(userId));
- }
-
- public List<User> findUsers() {
- return commandService.execute(new FindUsers());
- }
-
- public void deleteUser(String userId) {
- commandService.execute(new DeleteUser(userId));
- }
-
- public String createGroup(String groupName) {
- return commandService.execute(new CreateGroup(groupName, null, null));
- }
-
- public String createGroup(String groupName, String groupType) {
- return commandService.execute(new CreateGroup(groupName, groupType, null));
- }
-
- public String createGroup(String groupName, String groupType, String parentGroupId) {
- return commandService.execute(new CreateGroup(groupName, groupType, parentGroupId));
- }
-
- public Group findGroupById(String groupId) {
- return commandService.execute(new FindGroup(groupId));
- }
-
- public List<Group> findGroupsByUser(String userId) {
- return commandService.execute(new FindGroups(userId));
- }
-
- public List<Group> findGroupsByUserAndGroupType(String userId, String groupType) {
- return commandService.execute(new FindGroups(userId, groupType));
- }
-
- public void deleteGroup(String groupId) {
- commandService.execute(new DeleteGroup(groupId));
- }
-
- public void createMembership(String userId, String groupId) {
- commandService.execute(new CreateMembership(userId, groupId, null));
- }
-
- public void createMembership(String userId, String groupId, String role) {
- commandService.execute(new CreateMembership(userId, groupId, role));
- }
-
-
- public void deleteMembership(String userId, String groupId, String role) {
- commandService.execute(new DeleteMembership(userId, groupId, role));
- }
-}
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AbstractServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AbstractServiceImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AbstractServiceImpl.java 2009-03-20 20:39:04 UTC (rev 4302)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.svc;
+
+import java.sql.Connection;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.cmd.CommandService;
+import org.jbpm.env.WireObject;
+import org.jbpm.pvm.internal.cmd.AbstractCommand;
+import org.jbpm.pvm.internal.env.ProvidedAuthentication;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class AbstractServiceImpl {
+
+ protected CommandService commandService;
+ protected ThreadLocal<List<WireObject>> contextThreadLocal;
+
+ public CommandService getCommandService() {
+ return commandService;
+ }
+
+ public void setCommandService(CommandService commandService) {
+ this.commandService = commandService;
+ }
+
+ public void setUserId(String userId) {
+ addTxWireObject(new WireObject(new ProvidedAuthentication(userId)));
+ }
+
+ public void setConnection(Connection connection) {
+ addTxWireObject(new WireObject(connection));
+ }
+
+ protected synchronized void addTxWireObject(WireObject wireObject) {
+ if (contextThreadLocal==null) {
+ contextThreadLocal = new ThreadLocal<List<WireObject>>();
+ }
+ List<WireObject> txWireObjects = contextThreadLocal.get();
+ if (txWireObjects==null) {
+ txWireObjects = new ArrayList<WireObject>();
+ contextThreadLocal.set(txWireObjects);
+ }
+ txWireObjects.add(wireObject);
+ }
+
+ protected void addTxWireObjects(AbstractCommand cmd) {
+ if (contextThreadLocal!=null) {
+ cmd.setTxWireObjects(contextThreadLocal.get());
+ contextThreadLocal.set(null);
+ }
+ }
+}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java 2009-03-20 16:51:42 UTC (rev 4301)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java 2009-03-20 20:39:04 UTC (rev 4302)
@@ -30,12 +30,10 @@
import org.jbpm.ExecutionQuery;
import org.jbpm.ExecutionService;
import org.jbpm.cmd.CommandService;
-import org.jbpm.history.HistoryActivityInstanceQuery;
-import org.jbpm.history.HistoryProcessInstanceQuery;
import org.jbpm.pvm.internal.cmd.DeleteProcessInstance;
import org.jbpm.pvm.internal.cmd.EndProcessInstance;
-import org.jbpm.pvm.internal.cmd.FindExecutionsCmd;
import org.jbpm.pvm.internal.cmd.FindExecutionCmd;
+import org.jbpm.pvm.internal.cmd.FindExecutionsCmd;
import org.jbpm.pvm.internal.cmd.GetVariableNamesCmd;
import org.jbpm.pvm.internal.cmd.GetVariablesCmd;
import org.jbpm.pvm.internal.cmd.SetVariablesCmd;
@@ -43,17 +41,13 @@
import org.jbpm.pvm.internal.cmd.StartExecutionCmd;
import org.jbpm.pvm.internal.cmd.StartExecutionInLatestCmd;
import org.jbpm.pvm.internal.query.ExecutionQueryImpl;
-import org.jbpm.pvm.internal.query.HistoryActivityInstanceQueryImpl;
-import org.jbpm.pvm.internal.query.HistoryProcessInstanceQueryImpl;
/**
* @author Tom Baeyens
*/
-public class ExecutionServiceImpl implements ExecutionService {
+public class ExecutionServiceImpl extends AbstractServiceImpl implements ExecutionService {
- protected CommandService commandService;
-
public Execution startProcessInstanceById(String processDefinitionId){
return commandService.execute(new StartExecutionCmd(processDefinitionId, null, null));
}
@@ -69,8 +63,6 @@
public Execution startProcessInstanceById(String processDefinitionId, Map<String, Object> variables, String executionKey){
return commandService.execute(new StartExecutionCmd(processDefinitionId, variables, executionKey));
}
-
-
public Execution startProcessInstanceByKey(String processDefinitionKey) {
return commandService.execute(new StartExecutionInLatestCmd(processDefinitionKey, null, null));
@@ -168,15 +160,15 @@
return commandService.execute(new GetVariablesCmd(executionId, variableNames));
}
- public Execution setVariable(String executionId, String name, Object value) {
+ public void setVariable(String executionId, String name, Object value) {
SetVariablesCmd cmd = new SetVariablesCmd(executionId);
cmd.addVariable(name, value);
- return commandService.execute(cmd);
+ commandService.execute(cmd);
}
- public Execution setVariables(String executionId, Map<String, Object> variables) {
+ public void setVariables(String executionId, Map<String, Object> variables) {
SetVariablesCmd cmd = new SetVariablesCmd(executionId);
cmd.setVariables(variables);
- return commandService.execute(cmd);
+ commandService.execute(cmd);
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/HistoryServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/HistoryServiceImpl.java 2009-03-20 16:51:42 UTC (rev 4301)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/HistoryServiceImpl.java 2009-03-20 20:39:04 UTC (rev 4302)
@@ -24,7 +24,6 @@
import java.util.Map;
import org.jbpm.HistoryService;
-import org.jbpm.cmd.CommandService;
import org.jbpm.history.HistoryActivityInstanceQuery;
import org.jbpm.history.HistoryProcessInstanceQuery;
import org.jbpm.pvm.internal.query.AvgDurationPerActivityQueryCmd;
@@ -36,10 +35,8 @@
/**
* @author Tom Baeyens
*/
-public class HistoryServiceImpl implements HistoryService {
+public class HistoryServiceImpl extends AbstractServiceImpl implements HistoryService {
- protected CommandService commandService;
-
public Map<String, Long> avgDurationPerActivity(String processDefinitionId) {
return (Map) commandService.execute(new AvgDurationPerActivityQueryCmd(processDefinitionId));
}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/IdentityServiceImpl.java (from rev 4301, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentityServiceImpl.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/IdentityServiceImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/IdentityServiceImpl.java 2009-03-20 20:39:04 UTC (rev 4302)
@@ -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.pvm.internal.svc;
+
+import java.util.List;
+
+import org.jbpm.IdentityService;
+import org.jbpm.cmd.CommandService;
+import org.jbpm.identity.Group;
+import org.jbpm.identity.User;
+import org.jbpm.pvm.internal.identity.cmd.CreateGroup;
+import org.jbpm.pvm.internal.identity.cmd.CreateMembership;
+import org.jbpm.pvm.internal.identity.cmd.CreateUser;
+import org.jbpm.pvm.internal.identity.cmd.DeleteGroup;
+import org.jbpm.pvm.internal.identity.cmd.DeleteMembership;
+import org.jbpm.pvm.internal.identity.cmd.DeleteUser;
+import org.jbpm.pvm.internal.identity.cmd.FindGroup;
+import org.jbpm.pvm.internal.identity.cmd.FindGroups;
+import org.jbpm.pvm.internal.identity.cmd.FindUser;
+import org.jbpm.pvm.internal.identity.cmd.FindUsers;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class IdentityServiceImpl extends AbstractServiceImpl implements IdentityService {
+
+ protected CommandService commandService;
+
+ public void createUser(String userId, String givenName, String familyName) {
+ commandService.execute(new CreateUser(userId, givenName, familyName));
+ }
+
+ public User findUserById(String userId) {
+ return commandService.execute(new FindUser(userId));
+ }
+
+ public List<User> findUsers() {
+ return commandService.execute(new FindUsers());
+ }
+
+ public void deleteUser(String userId) {
+ commandService.execute(new DeleteUser(userId));
+ }
+
+ public String createGroup(String groupName) {
+ return commandService.execute(new CreateGroup(groupName, null, null));
+ }
+
+ public String createGroup(String groupName, String groupType) {
+ return commandService.execute(new CreateGroup(groupName, groupType, null));
+ }
+
+ public String createGroup(String groupName, String groupType, String parentGroupId) {
+ return commandService.execute(new CreateGroup(groupName, groupType, parentGroupId));
+ }
+
+ public Group findGroupById(String groupId) {
+ return commandService.execute(new FindGroup(groupId));
+ }
+
+ public List<Group> findGroupsByUser(String userId) {
+ return commandService.execute(new FindGroups(userId));
+ }
+
+ public List<Group> findGroupsByUserAndGroupType(String userId, String groupType) {
+ return commandService.execute(new FindGroups(userId, groupType));
+ }
+
+ public void deleteGroup(String groupId) {
+ commandService.execute(new DeleteGroup(groupId));
+ }
+
+ public void createMembership(String userId, String groupId) {
+ commandService.execute(new CreateMembership(userId, groupId, null));
+ }
+
+ public void createMembership(String userId, String groupId, String role) {
+ commandService.execute(new CreateMembership(userId, groupId, role));
+ }
+
+
+ public void deleteMembership(String userId, String groupId, String role) {
+ commandService.execute(new DeleteMembership(userId, groupId, role));
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/IdentityServiceImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ManagementServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ManagementServiceImpl.java 2009-03-20 16:51:42 UTC (rev 4301)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ManagementServiceImpl.java 2009-03-20 20:39:04 UTC (rev 4302)
@@ -23,7 +23,6 @@
import org.jbpm.JobQuery;
import org.jbpm.ManagementService;
-import org.jbpm.cmd.CommandService;
import org.jbpm.pvm.internal.cmd.ExecuteJobCmd;
import org.jbpm.pvm.internal.query.JobQueryImpl;
@@ -31,10 +30,8 @@
/**
* @author Tom Baeyens
*/
-public class ManagementServiceImpl implements ManagementService {
+public class ManagementServiceImpl extends AbstractServiceImpl implements ManagementService {
- protected CommandService commandService;
-
public void executeJob(long jobDbid) {
commandService.execute(new ExecuteJobCmd(jobDbid));
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java 2009-03-20 16:51:42 UTC (rev 4301)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java 2009-03-20 20:39:04 UTC (rev 4302)
@@ -28,7 +28,6 @@
import org.jbpm.ProcessDefinitionQuery;
import org.jbpm.ProcessService;
import org.jbpm.cmd.CommandService;
-import org.jbpm.model.OpenProcessDefinition;
import org.jbpm.pvm.internal.cmd.DeleteProcessDefinitionCmd;
import org.jbpm.pvm.internal.cmd.DeployCmd;
import org.jbpm.pvm.internal.cmd.FindLatestProcessDefinitionByKeyCmd;
@@ -43,10 +42,8 @@
*
* @author Tom Baeyens
*/
-public class ProcessServiceImpl implements ProcessService {
+public class ProcessServiceImpl extends AbstractServiceImpl implements ProcessService {
- protected CommandService commandService;
-
public Deployment createDeployment() {
return new DeploymentImpl(this);
}
@@ -78,7 +75,6 @@
public byte[] getAttachment(String processDefinitionId, String name) {
return commandService.execute(new GetAttachment(processDefinitionId, name));
}
-
public ProcessDefinitionQuery createProcessDefinitionQuery() {
return new ProcessDefinitionQueryImpl(commandService);
@@ -87,11 +83,4 @@
public List<ProcessDefinition> deploy(Deployment deployment) {
return commandService.execute(new DeployCmd((DeploymentImpl)deployment));
}
-
- public CommandService getCommandService() {
- return commandService;
- }
- public void setCommandService(CommandService commandService) {
- this.commandService = commandService;
- }
}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java (from rev 4301, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskServiceImpl.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java 2009-03-20 20:39:04 UTC (rev 4302)
@@ -0,0 +1,210 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.svc;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jbpm.TaskQuery;
+import org.jbpm.TaskService;
+import org.jbpm.model.Comment;
+import org.jbpm.pvm.internal.cmd.AddParticipantCmd;
+import org.jbpm.pvm.internal.cmd.AddReplyCommentCmd;
+import org.jbpm.pvm.internal.cmd.AddTaskCommentCmd;
+import org.jbpm.pvm.internal.cmd.CompositeCmd;
+import org.jbpm.pvm.internal.cmd.DeleteCommentCmd;
+import org.jbpm.pvm.internal.cmd.DeleteTaskCmd;
+import org.jbpm.pvm.internal.cmd.GetParticipantsCmd;
+import org.jbpm.pvm.internal.cmd.GetSubTasksCmd;
+import org.jbpm.pvm.internal.cmd.GetTaskCmd;
+import org.jbpm.pvm.internal.cmd.GetTaskCommentsCmd;
+import org.jbpm.pvm.internal.cmd.GetVariableNamesCmd;
+import org.jbpm.pvm.internal.cmd.GetVariablesCmd;
+import org.jbpm.pvm.internal.cmd.NewTaskCmd;
+import org.jbpm.pvm.internal.cmd.RemoveParticipantCmd;
+import org.jbpm.pvm.internal.cmd.SaveTaskCmd;
+import org.jbpm.pvm.internal.cmd.SetVariablesCmd;
+import org.jbpm.pvm.internal.cmd.SubmitTaskCmd;
+import org.jbpm.pvm.internal.cmd.TakeTaskCmd;
+import org.jbpm.pvm.internal.task.TaskImpl;
+import org.jbpm.pvm.internal.task.TaskQueryImpl;
+import org.jbpm.task.IdentityRef;
+import org.jbpm.task.Participant;
+import org.jbpm.task.Task;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class TaskServiceImpl extends AbstractServiceImpl implements TaskService {
+
+ public Task newTask() {
+ NewTaskCmd cmd = new NewTaskCmd(null);
+ addTxWireObjects(cmd);
+ return commandService.execute(cmd);
+ }
+
+ public Task getTask(long taskDbid) {
+ GetTaskCmd cmd = new GetTaskCmd(taskDbid);
+ return commandService.execute(cmd);
+ }
+
+ public long saveTask(Task task) {
+ SaveTaskCmd cmd = new SaveTaskCmd((TaskImpl) task);
+ return commandService.execute(cmd);
+ }
+
+ public void deleteTask(long taskDbid) {
+ DeleteTaskCmd cmd = new DeleteTaskCmd(taskDbid);
+ commandService.execute(cmd);
+ }
+
+ public void submitTask(long taskDbid) {
+ SubmitTaskCmd cmd = new SubmitTaskCmd(taskDbid);
+ commandService.execute(cmd);
+ }
+
+ public void submit(long taskDbid, Map<String, Object> variables) {
+ CompositeCmd compositeCmd = new CompositeCmd();
+ SetVariablesCmd setVariablesCommand = new SetVariablesCmd(taskDbid);
+ setVariablesCommand.setVariables(variables);
+ compositeCmd.addCommand(setVariablesCommand);
+ compositeCmd.addCommand(new SubmitTaskCmd(taskDbid));
+ commandService.execute(compositeCmd);
+ }
+
+ public void addTaskParticipant(long taskDbid, IdentityRef identityRef, String participation) {
+ AddParticipantCmd cmd = new AddParticipantCmd(taskDbid, null, identityRef, participation);
+ commandService.execute(cmd);
+ }
+
+ public List<Participant> getTaskParticipants(long taskDbid) {
+ GetParticipantsCmd cmd = new GetParticipantsCmd(taskDbid, null);
+ return commandService.execute(cmd);
+ }
+
+ public void removeTaskParticipant(long taskDbid, IdentityRef identityRef, String participation) {
+ RemoveParticipantCmd cmd = new RemoveParticipantCmd(taskDbid, null, identityRef, participation);
+ commandService.execute(cmd);
+ }
+
+ public void addSwimlaneParticipant(long szimlaneDbid, IdentityRef identityRef, String participation) {
+ AddParticipantCmd cmd = new AddParticipantCmd(null, szimlaneDbid, identityRef, participation);
+ commandService.execute(cmd);
+ }
+
+ public List<Participant> getSwimlaneParticipants(long szimlaneDbid) {
+ GetParticipantsCmd cmd = new GetParticipantsCmd(null, szimlaneDbid);
+ return commandService.execute(cmd);
+ }
+
+ public void removeSwimlaneParticipant(long szimlaneDbid, IdentityRef identityRef, String participation) {
+ RemoveParticipantCmd cmd = new RemoveParticipantCmd(null, szimlaneDbid, identityRef, participation);
+ commandService.execute(cmd);
+ }
+
+ public List<Task> getPersonalTaskList(String userId, int firstResult, int maxResults) {
+ return createTaskQuery()
+ .assignee(userId)
+ .orderDesc(TaskQuery.PROPERTY_PRIORITY)
+ .page(firstResult, maxResults)
+ .execute();
+ }
+
+ public List<Task> getGroupTaskList(String userId, int firstResult, int maxResults) {
+ return createTaskQuery()
+ .unassigned()
+ .candidate(userId)
+ .orderDesc(TaskQuery.PROPERTY_PRIORITY)
+ .page(firstResult, maxResults)
+ .execute();
+ }
+
+ public TaskQuery createTaskQuery() {
+ return new TaskQueryImpl(commandService);
+ }
+
+ public List<Task> getSubTasks(long taskDbid) {
+ GetSubTasksCmd cmd = new GetSubTasksCmd(taskDbid);
+ return commandService.execute(cmd);
+ }
+
+ public Task newTask(long parentTaskDbid) {
+ NewTaskCmd cmd = new NewTaskCmd(parentTaskDbid);
+ return commandService.execute(cmd);
+ }
+
+ public Comment addTaskComment(long taskDbid, String message) {
+ AddTaskCommentCmd cmd = new AddTaskCommentCmd(taskDbid, message);
+ return commandService.execute(cmd);
+ }
+
+ public List<Comment> getTaskComments(long taskDbid) {
+ GetTaskCommentsCmd cmd = new GetTaskCommentsCmd(taskDbid);
+ return commandService.execute(cmd);
+ }
+
+ public void deleteComment(long commentDbid) {
+ DeleteCommentCmd cmd = new DeleteCommentCmd(commentDbid);
+ commandService.execute(cmd);
+ }
+
+ public Comment addReplyComment(long commentDbid, String message) {
+ AddReplyCommentCmd cmd = new AddReplyCommentCmd(commentDbid, message);
+ return commandService.execute(cmd);
+ }
+
+ public void takeTask(long taskDbid) {
+ TakeTaskCmd cmd = new TakeTaskCmd(taskDbid);
+ addTxWireObjects(cmd);
+ commandService.execute(cmd);
+ }
+
+ public Object getVariable(long taskDbid, String variableName) {
+ Set<String> variableNames = new HashSet<String>();
+ variableNames.add(variableName);
+ GetVariablesCmd cmd = new GetVariablesCmd(taskDbid, variableNames);
+ Map<String, Object> variables = commandService.execute(cmd);
+ return variables.get(variableName);
+ }
+
+ public Set<String> getVariableNames(long taskDbid) {
+ return commandService.execute(new GetVariableNamesCmd(taskDbid));
+ }
+
+ public Map<String, Object> getVariables(long taskDbid, Set<String> variableNames) {
+ return commandService.execute(new GetVariablesCmd(taskDbid, variableNames));
+ }
+
+ public void setVariable(long taskDbid, String name, Object value) {
+ SetVariablesCmd cmd = new SetVariablesCmd(taskDbid);
+ cmd.addVariable(name, value);
+ commandService.execute(cmd);
+ }
+
+ public void setVariables(long taskDbid, Map<String, Object> variables) {
+ SetVariablesCmd cmd = new SetVariablesCmd(taskDbid);
+ cmd.setVariables(variables);
+ commandService.execute(cmd);
+ }
+}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskDefinitionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskDefinitionImpl.java 2009-03-20 16:51:42 UTC (rev 4301)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskDefinitionImpl.java 2009-03-20 20:39:04 UTC (rev 4302)
@@ -22,11 +22,13 @@
package org.jbpm.pvm.internal.task;
import java.io.Serializable;
+import java.util.Date;
import java.util.List;
import java.util.StringTokenizer;
import org.jbpm.JbpmException;
import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.cal.Duration;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.model.ProcessElementImpl;
import org.jbpm.pvm.internal.script.ScriptManager;
@@ -66,8 +68,14 @@
protected Descriptor assignerDescriptor;
public void initialize(TaskImpl task) {
+ task.setName(name);
+ task.setDescription(description);
+ task.setBlocking(isBlocking);
+ task.setSignalling(isSignalling);
task.setPriority(priority);
+ // TODO duedate calculation
+
if (assigneeExpression!=null) {
String assignee = resolveAssignmentExpression(assigneeExpression, assigneeExpressionLanguage, task.getExecution());
task.setAssignee(assignee);
@@ -91,7 +99,7 @@
}
}
}
-
+
protected String resolveAssignmentExpression(String expression, String expressionLanguage, ExecutionImpl execution) {
ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
Object result = scriptManager.evaluateExpression(expression, execution, expressionLanguage);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-03-20 16:51:42 UTC (rev 4301)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-03-20 20:39:04 UTC (rev 4302)
@@ -33,7 +33,6 @@
import org.jbpm.JbpmException;
import org.jbpm.env.Environment;
import org.jbpm.model.Comment;
-import org.jbpm.pvm.internal.cal.Duration;
import org.jbpm.pvm.internal.env.Authentication;
import org.jbpm.pvm.internal.model.CommentImpl;
import org.jbpm.pvm.internal.model.ExecutionImpl;
@@ -117,25 +116,9 @@
return task;
}
-
- public void setTaskDefinition(TaskDefinitionImpl taskDefinition) {
- if (taskDefinition!=null) {
- this.name = taskDefinition.getName();
- this.description = taskDefinition.getDescription();
- this.isBlocking = taskDefinition.isBlocking();
- this.isSignalling = taskDefinition.isSignalling();
- this.priority = taskDefinition.getPriority();
-
- String durationText = taskDefinition.getDueDateDuration();
- if (durationText!=null) {
- this.dueDate = calculateDueDate(new Duration(durationText));
- }
- }
- }
- protected static Date calculateDueDate(Duration dueDate) {
- // TODO
- return null;
+ public ScopeInstanceImpl getParentVariableScope() {
+ return execution;
}
// participants /////////////////////////////////////////////////////////////
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskServiceImpl.java 2009-03-20 16:51:42 UTC (rev 4301)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskServiceImpl.java 2009-03-20 20:39:04 UTC (rev 4302)
@@ -1,216 +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.pvm.internal.task;
-
-import java.sql.Connection;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jbpm.TaskQuery;
-import org.jbpm.TaskService;
-import org.jbpm.cmd.CommandService;
-import org.jbpm.env.WireObject;
-import org.jbpm.model.Comment;
-import org.jbpm.pvm.internal.cmd.AbstractCommand;
-import org.jbpm.pvm.internal.cmd.AddParticipantCmd;
-import org.jbpm.pvm.internal.cmd.AddReplyCommentCmd;
-import org.jbpm.pvm.internal.cmd.AddTaskCommentCmd;
-import org.jbpm.pvm.internal.cmd.DeleteCommentCmd;
-import org.jbpm.pvm.internal.cmd.DeleteTaskCmd;
-import org.jbpm.pvm.internal.cmd.GetParticipantsCmd;
-import org.jbpm.pvm.internal.cmd.GetSubTasksCmd;
-import org.jbpm.pvm.internal.cmd.GetTaskCmd;
-import org.jbpm.pvm.internal.cmd.GetTaskCommentsCmd;
-import org.jbpm.pvm.internal.cmd.NewTaskCmd;
-import org.jbpm.pvm.internal.cmd.RemoveParticipantCmd;
-import org.jbpm.pvm.internal.cmd.SaveTaskCmd;
-import org.jbpm.pvm.internal.cmd.SubmitTaskCmd;
-import org.jbpm.pvm.internal.cmd.TakeTaskCmd;
-import org.jbpm.pvm.internal.env.ProvidedAuthentication;
-import org.jbpm.task.IdentityRef;
-import org.jbpm.task.Participant;
-import org.jbpm.task.Task;
-
-/**
- * @author Alejandro Guizar
- */
-public class TaskServiceImpl implements TaskService {
-
- protected CommandService commandService;
-
- protected ThreadLocal<List<WireObject>> contextThreadLocal;
-
- public TaskServiceImpl() {
- }
-
- public TaskServiceImpl(CommandService commandService) {
- this.commandService = commandService;
- }
-
- public CommandService getCommandService() {
- return commandService;
- }
-
- public void setCommandService(CommandService commandService) {
- this.commandService = commandService;
- }
-
- public Task newTask() {
- NewTaskCmd cmd = new NewTaskCmd(null);
- addTxWireObjects(cmd);
- return commandService.execute(cmd);
- }
-
- public Task getTask(long taskDbid) {
- GetTaskCmd cmd = new GetTaskCmd(taskDbid);
- return commandService.execute(cmd);
- }
-
- public long saveTask(Task task) {
- SaveTaskCmd cmd = new SaveTaskCmd((TaskImpl) task);
- return commandService.execute(cmd);
- }
-
- public void deleteTask(long taskDbid) {
- DeleteTaskCmd cmd = new DeleteTaskCmd(taskDbid);
- commandService.execute(cmd);
- }
-
- public void submitTask(long taskDbid) {
- SubmitTaskCmd cmd = new SubmitTaskCmd(taskDbid);
- commandService.execute(cmd);
- }
-
- public void addTaskParticipant(long taskDbid, IdentityRef identityRef, String participation) {
- AddParticipantCmd cmd = new AddParticipantCmd(taskDbid, null, identityRef, participation);
- commandService.execute(cmd);
- }
-
- public List<Participant> getTaskParticipants(long taskDbid) {
- GetParticipantsCmd cmd = new GetParticipantsCmd(taskDbid, null);
- return commandService.execute(cmd);
- }
-
- public void removeTaskParticipant(long taskDbid, IdentityRef identityRef, String participation) {
- RemoveParticipantCmd cmd = new RemoveParticipantCmd(taskDbid, null, identityRef, participation);
- commandService.execute(cmd);
- }
-
- public void addSwimlaneParticipant(long szimlaneDbid, IdentityRef identityRef, String participation) {
- AddParticipantCmd cmd = new AddParticipantCmd(null, szimlaneDbid, identityRef, participation);
- commandService.execute(cmd);
- }
-
- public List<Participant> getSwimlaneParticipants(long szimlaneDbid) {
- GetParticipantsCmd cmd = new GetParticipantsCmd(null, szimlaneDbid);
- return commandService.execute(cmd);
- }
-
- public void removeSwimlaneParticipant(long szimlaneDbid, IdentityRef identityRef, String participation) {
- RemoveParticipantCmd cmd = new RemoveParticipantCmd(null, szimlaneDbid, identityRef, participation);
- commandService.execute(cmd);
- }
-
- public List<Task> getPersonalTaskList(String userId, int firstResult, int maxResults) {
- return createTaskQuery()
- .assignee(userId)
- .orderDesc(TaskQuery.PROPERTY_PRIORITY)
- .page(firstResult, maxResults)
- .execute();
- }
-
- public List<Task> getGroupTaskList(String userId, int firstResult, int maxResults) {
- return createTaskQuery()
- .unassigned()
- .candidate(userId)
- .orderDesc(TaskQuery.PROPERTY_PRIORITY)
- .page(firstResult, maxResults)
- .execute();
- }
-
- public TaskQuery createTaskQuery() {
- return new TaskQueryImpl(commandService);
- }
-
- public List<Task> getSubTasks(long taskDbid) {
- GetSubTasksCmd cmd = new GetSubTasksCmd(taskDbid);
- return commandService.execute(cmd);
- }
-
- public Task newTask(long parentTaskDbid) {
- NewTaskCmd cmd = new NewTaskCmd(parentTaskDbid);
- return commandService.execute(cmd);
- }
-
- public Comment addTaskComment(long taskDbid, String message) {
- AddTaskCommentCmd cmd = new AddTaskCommentCmd(taskDbid, message);
- return commandService.execute(cmd);
- }
-
- public List<Comment> getTaskComments(long taskDbid) {
- GetTaskCommentsCmd cmd = new GetTaskCommentsCmd(taskDbid);
- return commandService.execute(cmd);
- }
-
- public void deleteComment(long commentDbid) {
- DeleteCommentCmd cmd = new DeleteCommentCmd(commentDbid);
- commandService.execute(cmd);
- }
-
- public Comment addReplyComment(long commentDbid, String message) {
- AddReplyCommentCmd cmd = new AddReplyCommentCmd(commentDbid, message);
- return commandService.execute(cmd);
- }
-
- public void takeTask(long taskDbid) {
- TakeTaskCmd cmd = new TakeTaskCmd(taskDbid);
- addTxWireObjects(cmd);
- commandService.execute(cmd);
- }
-
- public void setUserId(String userId) {
- addTxWireObject(new WireObject(new ProvidedAuthentication(userId)));
- }
-
- public void setConnection(Connection connection) {
- addTxWireObject(new WireObject(connection));
- }
-
- protected synchronized void addTxWireObject(WireObject wireObject) {
- if (contextThreadLocal==null) {
- contextThreadLocal = new ThreadLocal<List<WireObject>>();
- }
- List<WireObject> txWireObjects = contextThreadLocal.get();
- if (txWireObjects==null) {
- txWireObjects = new ArrayList<WireObject>();
- contextThreadLocal.set(txWireObjects);
- }
- txWireObjects.add(wireObject);
- }
-
- protected void addTxWireObjects(AbstractCommand cmd) {
- if (contextThreadLocal!=null) {
- cmd.setTxWireObjects(contextThreadLocal.get());
- contextThreadLocal.set(null);
- }
- }
-}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IdentityServiceBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IdentityServiceBinding.java 2009-03-20 16:51:42 UTC (rev 4301)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IdentityServiceBinding.java 2009-03-20 20:39:04 UTC (rev 4302)
@@ -22,7 +22,7 @@
package org.jbpm.pvm.internal.wire.binding;
import org.jbpm.cmd.CommandService;
-import org.jbpm.pvm.internal.identity.impl.IdentityServiceImpl;
+import org.jbpm.pvm.internal.svc.IdentityServiceImpl;
import org.jbpm.pvm.internal.wire.descriptor.ContextTypeRefDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
import org.jbpm.pvm.internal.xml.Parse;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TaskServiceBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TaskServiceBinding.java 2009-03-20 16:51:42 UTC (rev 4301)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TaskServiceBinding.java 2009-03-20 20:39:04 UTC (rev 4302)
@@ -22,7 +22,7 @@
package org.jbpm.pvm.internal.wire.binding;
import org.jbpm.cmd.CommandService;
-import org.jbpm.pvm.internal.task.TaskServiceImpl;
+import org.jbpm.pvm.internal.svc.TaskServiceImpl;
import org.jbpm.pvm.internal.wire.descriptor.ContextTypeRefDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
import org.jbpm.pvm.internal.xml.Parse;
17 years, 1 month
JBoss JBPM SVN: r4301 - in jbpm4/trunk/modules: api/src/main/java/org/jbpm/env and 16 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-03-20 12:51:42 -0400 (Fri, 20 Mar 2009)
New Revision: 4301
Added:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/WireObject.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/ProvidedAuthentication.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCandidatesTest.java
Removed:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/EnvironmentObject.java
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/candidate/
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/IdentityService.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessEngine.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskQuery.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/EnvironmentFactory.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/assignee/TaskAssigneeTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.identity.hbm.xml
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.task.hbm.xml
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/SpringConfiguration.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AbstractCommand.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddParticipantCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddReplyCommentCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddTaskCommentCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CompositeCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteCommentCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessDefinitionCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessInstance.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteTaskCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/EndProcessInstance.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ExecuteJobCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionsCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindLatestProcessDefinitionByKeyCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionByIdCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionKeysCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionsByKeyCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetAttachment.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetParticipantsCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetSubTasksCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCommentsCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariableNamesCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariablesCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/NewTaskCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/QueryCommand.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/RemoveParticipantCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SaveTaskCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SendMessageCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SignalCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SubmitTaskCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/TakeTaskCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/VariablesCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironmentFactoryParser.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentityServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentitySessionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/EnvironmentInterceptor.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireDefinition.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ProvidedObjectDescriptor.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/identity/IdentityTest.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
Log:
JBPM-2080 task candidates
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/IdentityService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/IdentityService.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/IdentityService.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -49,6 +49,14 @@
/** create a group new group
* @return the generated id for this group. */
+ String createGroup(String string);
+
+ /** create a group new group
+ * @return the generated id for this group. */
+ String createGroup(String string, String groupType);
+
+ /** create a group new group
+ * @return the generated id for this group. */
String createGroup(String groupName, String groupType, String parentGroupId);
/** lookup a group.
@@ -69,10 +77,15 @@
/** makes the given user a member of the given group with the given role.
* Role can be null. */
+ void createMembership(String string, String groupId);
+
+ /** makes the given user a member of the given group with the given role.
+ * Role can be null. */
void createMembership(String userId, String groupId, String role);
/** makes the given user a member of the given group with the given role.
* Role can be null. If no such membership exists, this method will
* not throw an exception and have no effect. */
void deleteMembership(String userId, String groupId, String role);
+
}
\ No newline at end of file
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessEngine.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessEngine.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessEngine.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -21,7 +21,6 @@
*/
package org.jbpm;
-import java.util.Map;
/** central starting point for all process engine API
* interactions.
@@ -34,51 +33,33 @@
* to the process repository. */
ProcessService getProcessService();
- /** the {@link ProcessService process service} and supply some
- * transactional resources. The given transactional resources will only
- * be associated to the returned process service. */
- ProcessService getProcessService(Map<String, Object> envObjects);
-
/** the {@link ExecutionService execution service} that provides access
* to the runtime executions repository. */
ExecutionService getExecutionService();
- /** the {@link ExecutionService execution service} and supply some
- * transactional resources. The given transactional resources will only
- * be associated to the returned execution service. */
- ExecutionService getExecutionService(Map<String, Object> envObjects);
-
/** the {@link HistoryService history service} that provides access
* to the history executions repository. */
HistoryService getHistoryService();
- /** the {@link HistoryService history service} that provides access
- * to the history executions repository. The given transactional resources will only
- * be associated to the returned history service. */
- HistoryService getHistoryService(Map<String, Object> envObjects);
-
/** the {@link TaskService task service} that exposes the
* runtime human task lists. */
TaskService getTaskService();
- /** the {@link TaskService task service} and supply some
- * transactional resources. The given transactional resources will only
- * be associated to the returned task service. */
- TaskService getTaskService(Map<String, Object> envObjects);
+ /** the {@link IdentityService identity service} that exposes the
+ * user and group operations management operations. */
+ IdentityService getIdentityService();
/** the {@link ManagementService management service} that exposes the
* management operations to operators that have to keep the jBPM system
* up and running. */
ManagementService getManagementService();
- /** the {@link ManagementService management service} and supply some
- * transactional resources. The given transactional resources will only
- * be associated to the returned management service. */
- ManagementService getManagementService(Map<String, Object> envObjects);
-
/** retrieve and object defined in the process engine by type */
<T> T get(Class<T> type);
/** retrieve and object defined in the process engine by name */
Object get(String name);
+
+ /** programmatically provide a hibernate session factory */
+ void setSessionFactory(Object sessionFactory);
}
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskQuery.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskQuery.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskQuery.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -40,6 +40,10 @@
/** only find tasks for which the given user is the assignee */
TaskQuery assignee(String userId);
+
+ /** only find tasks that are unassigned. These tasks can still
+ * potentially have candidates. */
+ TaskQuery unassigned();
/** only find tasks for which the given user is a candidate */
TaskQuery candidate(String userId);
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -21,6 +21,7 @@
*/
package org.jbpm;
+import java.sql.Connection;
import java.util.List;
import org.jbpm.model.Comment;
@@ -131,4 +132,12 @@
/** delete a comment.
* this will recursively delete all replies to this comment. */
void deleteComment(long commentDbid);
+
+ /** provide a userId that will be used in the next method invocation
+ * on this service by this thread. */
+ void setUserId(String userId);
+
+ /** provide a JDBC connection that will be used in the next method
+ * invocation on this service by this thread. */
+ void setConnection(Connection connection);
}
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/EnvironmentFactory.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/EnvironmentFactory.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/EnvironmentFactory.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -58,11 +58,11 @@
/**
* open a new Environment and pass in a list of objects
- * that must be placed/exposed in the environment context.
+ * that must be placed/exposed in the transaction context.
* The client is responsible for
* closing the environment with {@link Environment#close()}.
*/
- // Environment openEnvironment(List<EnvironmentObject> environmentObjects);
+ Environment openEnvironment(List<WireObject> txWireObjects);
/**
* closes this environment factory and cleans any allocated
@@ -70,4 +70,5 @@
*/
void close();
+
}
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/EnvironmentObject.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/EnvironmentObject.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/EnvironmentObject.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -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.env;
-
-
-/**
- * @author Tom Baeyens
- */
-public class EnvironmentObject {
-
- protected String name;
- protected Object object;
- protected boolean exposeType;
-
- public EnvironmentObject(Object object) {
- this.object = object;
- this.exposeType = true;
- }
-
- public EnvironmentObject(Object object, String name) {
- this.object = object;
- this.name = name;
- }
-
- public EnvironmentObject(Object object, String name, boolean exposeType) {
- this.object = object;
- this.exposeType = exposeType;
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
- public Object getObject() {
- return object;
- }
- public boolean isExposeType() {
- return exposeType;
- }
-}
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/WireObject.java (from rev 4298, jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/EnvironmentObject.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/WireObject.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/WireObject.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.env;
+
+import org.jbpm.JbpmException;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class WireObject {
+
+ protected String name;
+ protected Object object;
+ protected boolean isTypeExposed;
+
+ public WireObject(Object object) {
+ this(object, null, true);
+ }
+
+ public WireObject(Object object, String name) {
+ this(object, null, true);
+ }
+
+ public WireObject(Object object, String name, boolean isTypeExposed) {
+ if (object==null) {
+ throw new JbpmException("object is null");
+ }
+ this.object = object;
+ this.isTypeExposed = isTypeExposed;
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+ public Object getObject() {
+ return object;
+ }
+ public boolean isTypeExposed() {
+ return isTypeExposed;
+ }
+}
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/WireObject.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/assignee/TaskAssigneeTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/assignee/TaskAssigneeTest.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/assignee/TaskAssigneeTest.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -36,29 +36,29 @@
public class TaskAssigneeTest extends JbpmTestCase {
public void testTaskAssignee() {
-// deployJpdlResource("org/jbpm/examples/task/assignee/process.jpdl.xml");
-//
-// Map<String, Object> variables = new HashMap<String, Object>();
-// variables.put("order", new Order("johndoe"));
-// Execution execution = executionService.startProcessInstanceByKey("TaskAssignee", variables);
-// String executionId = execution.getId();
-//
-// List<Task> taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
-// assertEquals(1, taskList.size());
-// Task task = taskList.get(0);
-// assertEquals("review", task.getName());
-// assertEquals("johndoe", task.getAssignee());
-//
-// // submit the task
-// taskService.submitTask(task.getDbid());
-//
-// // verify that the task list is now empty
-// taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
-// assertEquals(0, taskList.size());
-//
-// // verify that process moved to the next state
-// execution = executionService.findExecution(executionId);
-// assertEquals("wait", execution.getActivityName());
+ deployJpdlResource("org/jbpm/examples/task/assignee/process.jpdl.xml");
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("order", new Order("johndoe"));
+ Execution execution = executionService.startProcessInstanceByKey("TaskAssignee", variables);
+ String executionId = execution.getId();
+
+ List<Task> taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ assertEquals(1, taskList.size());
+ Task task = taskList.get(0);
+ assertEquals("review", task.getName());
+ assertEquals("johndoe", task.getAssignee());
+
+ // submit the task
+ taskService.submitTask(task.getDbid());
+
+ // verify that the task list is now empty
+ taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ assertEquals(0, taskList.size());
+
+ // verify that process moved to the next state
+ execution = executionService.findExecution(executionId);
+ assertEquals("wait", execution.getActivityName());
}
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -21,12 +21,9 @@
*/
package org.jbpm.examples.task.candidates;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import org.jbpm.Execution;
-import org.jbpm.examples.task.assignee.Order;
import org.jbpm.task.Task;
import org.jbpm.test.JbpmTestCase;
@@ -36,12 +33,20 @@
*/
public class TaskCandidatesTest extends JbpmTestCase {
- public void testTaskAssignee() {
+ public void testGroupCandidateAssignment() {
+ // create johndoe and joesmoe as members of the sales group
+ String salesGroupId = identityService.createGroup("sales");
+
+ identityService.createUser("johndoe", "John", "Doe");
+ identityService.createMembership("johndoe", salesGroupId);
+
+ identityService.createUser("joesmoe", "Joe", "Smoe");
+ identityService.createMembership("joesmoe", salesGroupId);
+
+ // deploy the process
deployJpdlResource("org/jbpm/examples/task/candidates/process.jpdl.xml");
- Map<String, Object> variables = new HashMap<String, Object>();
- variables.put("order", new Order("johndoe"));
- Execution execution = executionService.startProcessInstanceByKey("TaskCandidates", variables);
+ Execution execution = executionService.startProcessInstanceByKey("TaskCandidates");
String executionId = execution.getId();
List<Task> taskList = taskService.getGroupTaskList("johndoe", 0, 10);
@@ -54,8 +59,8 @@
task = taskList.get(0);
assertEquals("review", task.getName());
- /*
- // submit the task
+ // lets assume that johndoe takes the task
+ taskService.setUserId("johndoe");
taskService.takeTask(task.getDbid());
// verify that the group task lists are now empty
@@ -81,6 +86,5 @@
// verify that process moved to the next state
execution = executionService.findExecution(executionId);
assertEquals("wait", execution.getActivityName());
- */
}
}
Modified: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml 2009-03-20 16:51:42 UTC (rev 4301)
@@ -6,11 +6,11 @@
<transition to="review" />
</start>
- <task name="review"
- candidate-users="johndoe, joesmoe"
+ <task name="review"
+ candidate-groups="sales"
g="96,16,127,52">
-
- <transition to="wait" />
+
+ <transition to="wait" />
</task>
<state name="wait" g="255,16,88,52"/>
Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml 2009-03-20 16:51:42 UTC (rev 4301)
@@ -33,13 +33,15 @@
<check-problems />
<save />
</deployer-manager>
-
+
<script-manager default-expression-language="juel"
default-script-language="juel"
read-contexts="execution, environment, process-engine"
write-context="">
<script-language name="juel" factory="com.sun.script.juel.JuelScriptEngineFactory" />
</script-manager>
+
+ <authentication />
<job-executor auto-start="false" />
@@ -58,7 +60,6 @@
</process-engine-context>
<transaction-context>
- <hibernate-session />
<transaction />
<pvm-db-session />
<job-db-session />
@@ -66,6 +67,7 @@
<message-session />
<timer-session />
<history-session />
+ <hibernate-session />
<identity-session />
</transaction-context>
Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.identity.hbm.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.identity.hbm.xml 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.identity.hbm.xml 2009-03-20 16:51:42 UTC (rev 4301)
@@ -10,7 +10,7 @@
</id>
<version name="dbversion" column="DBVERSION_" />
- <property name="name" column="NAME_" />
+ <property name="id" column="ID_" />
<property name="givenName" column="GIVENNAME_" />
<property name="familyName" column="FAMILYNAME_" />
</class>
@@ -44,6 +44,7 @@
</id>
<version name="dbversion" column="DBVERSION_" />
+ <property name="id" column="ID_" />
<property name="name" column="NAME_" />
<property name="type" column="TYPE_" />
Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.task.hbm.xml 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.task.hbm.xml 2009-03-20 16:51:42 UTC (rev 4301)
@@ -19,8 +19,12 @@
<property name="dueDateDuration" column="DUEDATE_"/>
<property name="isBlocking" column="BLOCK_"/>
<property name="isSignalling" column="SIGNAL_"/>
- <property name="assigneeExpression" column="ASSIGNEE_EXPR_"/>
- <property name="candidatesExpression" column="CANDIDATES_EXPR_"/>
+ <property name="assigneeExpression" column="ASS_EXPR_"/>
+ <property name="assigneeExpressionLanguage" column="ASS_EXPR_LANG_"/>
+ <property name="candidateUsersExpression" column="CNDUSR_EXPR_"/>
+ <property name="candidateUsersExpressionLanguage" column="CNDUSR_EXPRLANG_"/>
+ <property name="candidateGroupsExpression" column="CNDGRP_EXPR_"/>
+ <property name="candidateGroupsExpressionLanguage" column="CNDGRP_EXPRLANG_"/>
<many-to-one name="assignerDescriptor"
column="ASSIGNER_DESCR_"
@@ -111,8 +115,8 @@
</id>
<version name="dbversion" column="DBVERSION_" />
- <property name="identityType" column="IDENTITYTYPE_"/>
- <property name="identityId" column="IDENTITYID_"/>
+ <property name="groupId" column="GROUPID_"/>
+ <property name="userId" column="USERID_"/>
<property name="participation" column="PARTICIPATION_" />
<many-to-one name="task"
@@ -154,6 +158,11 @@
column="SWIMLANEDEF_"
foreign-key="FK_SWIMLANE_DEF" />
+ <many-to-one name="execution"
+ class="org.jbpm.pvm.internal.model.ExecutionImpl"
+ column="EXECUTION_"
+ foreign-key="FK_SWIMLANE_EXEC" />
+
<set name="participants" cascade="all-delete-orphan">
<key column="SWIMLANE_" />
<one-to-many class="ParticipantImpl" />
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -24,12 +24,14 @@
import java.io.File;
import java.io.InputStream;
import java.net.URL;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import org.jbpm.Configuration;
import org.jbpm.ExecutionService;
import org.jbpm.HistoryService;
+import org.jbpm.IdentityService;
import org.jbpm.ManagementService;
import org.jbpm.ProcessEngine;
import org.jbpm.ProcessService;
@@ -37,6 +39,7 @@
import org.jbpm.env.Context;
import org.jbpm.env.Environment;
import org.jbpm.env.EnvironmentFactory;
+import org.jbpm.env.WireObject;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.env.PvmEnvironment;
import org.jbpm.pvm.internal.env.PvmEnvironmentFactoryParser;
@@ -48,6 +51,7 @@
import org.jbpm.pvm.internal.stream.UrlStreamInput;
import org.jbpm.pvm.internal.wire.WireContext;
import org.jbpm.pvm.internal.wire.WireDefinition;
+import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
/**
* an environment factory that also is the process-engine context.
@@ -87,7 +91,7 @@
protected boolean isConfigured = false;
protected WireContext environmentFactoryCtxWireContext = null;
- protected WireDefinition environmentCtxWireDefinition = null;
+ protected WireDefinition transactionCtxWireDefinition = null;
public JbpmConfiguration() {
super((Configuration)null);
@@ -100,6 +104,12 @@
return this;
}
+ public void setSessionFactory(Object sessionFactory) {
+ environmentFactoryCtxWireContext
+ .getWireDefinition()
+ .addDescriptor(new ProvidedObjectDescriptor(sessionFactory));
+ }
+
public Configuration setInputStream(InputStream inputStream) {
parse(new InputStreamInput(inputStream));
return this;
@@ -150,24 +160,10 @@
public TaskService getTaskService() {
return environmentFactoryCtxWireContext.get(TaskService.class);
}
-
- public TaskService getTaskService(Map<String, Object> txResources) {
- throw new UnsupportedOperationException("please implement me");
+ public IdentityService getIdentityService() {
+ return environmentFactoryCtxWireContext.get(IdentityService.class);
}
- public HistoryService getHistoryService(Map<String, Object> txResources) {
- throw new UnsupportedOperationException("please implement me");
- }
- public ExecutionService getExecutionService(Map<String, Object> txResources) {
- throw new UnsupportedOperationException("please implement me");
- }
- public ProcessService getProcessService(Map<String, Object> txResources) {
- throw new UnsupportedOperationException("please implement me");
- }
- public ManagementService getManagementService(Map<String, Object> txResources) {
- throw new UnsupportedOperationException("please implement me");
- }
-
public static EnvironmentFactory parseXmlString(String xmlString) {
JbpmConfiguration jbpmConfiguration = new JbpmConfiguration();
jbpmConfiguration.setXmlString(xmlString);
@@ -175,7 +171,12 @@
return jbpmConfiguration;
}
+
public Environment openEnvironment() {
+ return openEnvironment(null);
+ }
+
+ public Environment openEnvironment(List<WireObject> txWireObjects) {
PvmEnvironment environment = new PvmEnvironment(this);
if (log.isTraceEnabled()) log.trace("opening " + environment);
@@ -189,15 +190,20 @@
// add the process-engine context
environment.addContext(environmentFactoryCtxWireContext);
- // add the environment block context
- WireContext environmentContext = new WireContext(environmentCtxWireDefinition, Context.CONTEXTNAME_TRANSACTION, environment, true);
+ // add the transaction context
+ WireDefinition usedWireDefinition = transactionCtxWireDefinition;
+ if (txWireObjects!=null) {
+ usedWireDefinition = new WireDefinition(transactionCtxWireDefinition, txWireObjects);
+ }
+
+ WireContext transactionContext = new WireContext(usedWireDefinition, Context.CONTEXTNAME_TRANSACTION, environment, true);
// add the environment block context to the environment
- environment.addContext(environmentContext);
+ environment.addContext(transactionContext);
Environment.pushEnvironment(environment);
try {
// finish the creation of the environment wire context
- environmentContext.create();
+ transactionContext.create();
} catch (RuntimeException e) {
Environment.popEnvironment();
@@ -241,8 +247,8 @@
// getters and setters //////////////////////////////////////////////////////
- public void setEnvironmentCtxWireDefinition(WireDefinition blockWireDefinition) {
- this.environmentCtxWireDefinition = blockWireDefinition;
+ public void setTransactionCtxWireDefinition(WireDefinition blockWireDefinition) {
+ this.transactionCtxWireDefinition = blockWireDefinition;
}
public WireContext getEnvironmentFactoryCtxWireContext() {
return environmentFactoryCtxWireContext;
@@ -250,7 +256,7 @@
public void setEnvironmentFactoryCtxWireContext(WireContext applicationWireContext) {
this.environmentFactoryCtxWireContext = applicationWireContext;
}
- public WireDefinition getEnvironmentCtxWireDefinition() {
- return environmentCtxWireDefinition;
+ public WireDefinition getTransactionCtxWireDefinition() {
+ return transactionCtxWireDefinition;
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/SpringConfiguration.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/SpringConfiguration.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/SpringConfiguration.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -22,9 +22,12 @@
package org.jbpm.pvm.internal.cfg;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
+import org.jbpm.env.Environment;
import org.jbpm.env.EnvironmentFactory;
+import org.jbpm.env.WireObject;
import org.jbpm.pvm.internal.spring.SpringEnvironment;
import org.jbpm.pvm.internal.util.ReflectUtil;
import org.springframework.context.ApplicationContext;
@@ -95,4 +98,8 @@
public Object set(String key, Object value) {
return null;
}
+
+ public Environment openEnvironment(List<WireObject> txWireObjects) {
+ return null;
+ }
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AbstractCommand.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AbstractCommand.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AbstractCommand.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -21,34 +21,25 @@
*/
package org.jbpm.pvm.internal.cmd;
-import org.jbpm.client.ClientExecution;
+import java.util.List;
+
import org.jbpm.cmd.Command;
-import org.jbpm.env.Environment;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.session.DbSession;
-import org.jbpm.session.PvmDbSession;
+import org.jbpm.env.WireObject;
/**
* @author Tom Baeyens
*/
public abstract class AbstractCommand<T> implements Command<T> {
+
+ private static final long serialVersionUID = 1L;
- // TODO: REMOVE
- protected ClientExecution getExecution(Environment environment, long executionDbid) {
- DbSession dbSession = environment.get(DbSession.class);
- ClientExecution execution = dbSession.get(ExecutionImpl.class, executionDbid);
- if (execution==null) {
- throw new CommandException("execution "+executionDbid+" doesn't exist");
- }
- return execution;
- }
+ protected List<WireObject> txWireObjects;
- protected ClientExecution getExecution(Environment environment, String executionId) {
- PvmDbSession dbSession = environment.get(PvmDbSession.class);
- ClientExecution execution = dbSession.findExecutionById(executionId);
- if (execution==null) {
- throw new CommandException("execution "+executionId+" doesn't exist");
- }
- return execution;
+ public List<WireObject> getTxWireObjects() {
+ return txWireObjects;
}
+
+ public void setTxWireObjects(List<WireObject> txWireObjects) {
+ this.txWireObjects = txWireObjects;
+ }
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddParticipantCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddParticipantCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddParticipantCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -23,7 +23,6 @@
import org.hibernate.Session;
import org.jbpm.JbpmException;
-import org.jbpm.cmd.Command;
import org.jbpm.env.Environment;
import org.jbpm.pvm.internal.task.TaskImpl;
import org.jbpm.task.IdentityRef;
@@ -31,7 +30,7 @@
/**
* @author Tom Baeyens
*/
-public class AddParticipantCmd implements Command<Object> {
+public class AddParticipantCmd extends AbstractCommand<Object> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddReplyCommentCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddReplyCommentCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddReplyCommentCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -32,7 +32,7 @@
/**
* @author Tom Baeyens
*/
-public class AddReplyCommentCmd implements Command<Comment> {
+public class AddReplyCommentCmd extends AbstractCommand<Comment> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddTaskCommentCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddTaskCommentCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddTaskCommentCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -31,7 +31,7 @@
/**
* @author Tom Baeyens
*/
-public class AddTaskCommentCmd implements Command<Comment> {
+public class AddTaskCommentCmd extends AbstractCommand<Comment> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CompositeCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CompositeCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CompositeCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -32,7 +32,7 @@
*
* @author Tom Baeyens
*/
-public class CompositeCmd implements Command<Void> {
+public class CompositeCmd extends AbstractCommand<Void> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteCommentCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteCommentCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteCommentCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -32,7 +32,7 @@
/**
* @author Tom Baeyens
*/
-public class DeleteCommentCmd implements Command<Object> {
+public class DeleteCommentCmd extends AbstractCommand<Object> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessDefinitionCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessDefinitionCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessDefinitionCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -31,7 +31,7 @@
/**
* @author Tom Baeyens
*/
-public class DeleteProcessDefinitionCmd implements Command<Void> {
+public class DeleteProcessDefinitionCmd extends AbstractCommand<Void> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessInstance.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessInstance.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessInstance.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -29,7 +29,7 @@
/**
* @author Tom Baeyens
*/
-public class DeleteProcessInstance implements Command<Void> {
+public class DeleteProcessInstance extends AbstractCommand<Void> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteTaskCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteTaskCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteTaskCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -30,7 +30,7 @@
/**
* @author Alejandro Guizar
*/
-public class DeleteTaskCmd implements Command<Void> {
+public class DeleteTaskCmd extends AbstractCommand<Void> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -33,7 +33,7 @@
/**
* @author Tom Baeyens
*/
-public class DeployCmd implements Command<List<ProcessDefinition>> {
+public class DeployCmd extends AbstractCommand<List<ProcessDefinition>> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/EndProcessInstance.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/EndProcessInstance.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/EndProcessInstance.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -30,7 +30,7 @@
/**
* @author Tom Baeyens
*/
-public class EndProcessInstance implements Command<Object> {
+public class EndProcessInstance extends AbstractCommand<Object> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ExecuteJobCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ExecuteJobCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ExecuteJobCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -39,7 +39,7 @@
/**
* @author Tom Baeyens
*/
-public class ExecuteJobCmd implements Command<Job> {
+public class ExecuteJobCmd extends AbstractCommand<Job> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -31,7 +31,7 @@
/**
* @author Tom Baeyens
*/
-public class FindExecutionCmd implements Command<Execution> {
+public class FindExecutionCmd extends AbstractCommand<Execution> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionsCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionsCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionsCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -38,7 +38,7 @@
/**
* @author Tom Baeyens
*/
-public class FindExecutionsCmd implements Command<List<Execution>> {
+public class FindExecutionsCmd extends AbstractCommand<List<Execution>> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindLatestProcessDefinitionByKeyCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindLatestProcessDefinitionByKeyCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindLatestProcessDefinitionByKeyCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -31,7 +31,7 @@
/**
* @author Tom Baeyens
*/
-public class FindLatestProcessDefinitionByKeyCmd implements Command<ProcessDefinition> {
+public class FindLatestProcessDefinitionByKeyCmd extends AbstractCommand<ProcessDefinition> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionByIdCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionByIdCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionByIdCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -30,7 +30,7 @@
/**
* @author Tom Baeyens
*/
-public class FindProcessDefinitionByIdCmd implements Command<OpenProcessDefinition> {
+public class FindProcessDefinitionByIdCmd extends AbstractCommand<OpenProcessDefinition> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionKeysCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionKeysCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionKeysCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -31,7 +31,7 @@
/**
* @author Tom Baeyens
*/
-public class FindProcessDefinitionKeysCmd implements Command<List<String>> {
+public class FindProcessDefinitionKeysCmd extends AbstractCommand<List<String>> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionsByKeyCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionsByKeyCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionsByKeyCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -32,7 +32,7 @@
/**
* @author Tom Baeyens
*/
-public class FindProcessDefinitionsByKeyCmd implements Command<List<ClientProcessDefinition>> {
+public class FindProcessDefinitionsByKeyCmd extends AbstractCommand<List<ClientProcessDefinition>> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetAttachment.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetAttachment.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetAttachment.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -30,7 +30,7 @@
/**
* @author Tom Baeyens
*/
-public class GetAttachment implements Command<byte[]> {
+public class GetAttachment extends AbstractCommand<byte[]> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetParticipantsCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetParticipantsCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetParticipantsCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -35,7 +35,7 @@
/**
* @author Tom Baeyens
*/
-public class GetParticipantsCmd implements Command<List<Participant>> {
+public class GetParticipantsCmd extends AbstractCommand<List<Participant>> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetSubTasksCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetSubTasksCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetSubTasksCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -34,7 +34,7 @@
/**
* @author Tom Baeyens
*/
-public class GetSubTasksCmd implements Command<List<Task>> {
+public class GetSubTasksCmd extends AbstractCommand<List<Task>> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -29,7 +29,7 @@
/**
* @author Alejandro Guizar
*/
-public class GetTaskCmd implements Command<Task> {
+public class GetTaskCmd extends AbstractCommand<Task> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCommentsCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCommentsCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCommentsCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -34,7 +34,7 @@
/**
* @author Tom Baeyens
*/
-public class GetTaskCommentsCmd implements Command<List<Comment>> {
+public class GetTaskCommentsCmd extends AbstractCommand<List<Comment>> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariableNamesCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariableNamesCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariableNamesCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -33,7 +33,7 @@
/**
* @author Tom Baeyens
*/
-public class GetVariableNamesCmd implements Command<Set<String>> {
+public class GetVariableNamesCmd extends AbstractCommand<Set<String>> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariablesCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariablesCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariablesCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -34,7 +34,7 @@
/**
* @author Tom Baeyens
*/
-public class GetVariablesCmd implements Command<Map<String, Object>> {
+public class GetVariablesCmd extends AbstractCommand<Map<String, Object>> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/NewTaskCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/NewTaskCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/NewTaskCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -29,7 +29,7 @@
/**
* @author Tom Baeyens
*/
-public class NewTaskCmd implements Command<Task> {
+public class NewTaskCmd extends AbstractCommand<Task> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/QueryCommand.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/QueryCommand.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/QueryCommand.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -27,7 +27,7 @@
*
* @author Tom Baeyens
*/
-public abstract class QueryCommand<T> implements Command<T>{
+public abstract class QueryCommand<T> extends AbstractCommand<T>{
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/RemoveParticipantCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/RemoveParticipantCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/RemoveParticipantCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -36,7 +36,7 @@
/**
* @author Tom Baeyens
*/
-public class RemoveParticipantCmd implements Command<Object> {
+public class RemoveParticipantCmd extends AbstractCommand<Object> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SaveTaskCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SaveTaskCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SaveTaskCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -29,7 +29,7 @@
/**
* @author Alejandro Guizar
*/
-public class SaveTaskCmd implements Command<Long> {
+public class SaveTaskCmd extends AbstractCommand<Long> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SendMessageCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SendMessageCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SendMessageCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -30,7 +30,7 @@
*
* @author Tom Baeyens
*/
-public class SendMessageCmd implements Command<Object> {
+public class SendMessageCmd extends AbstractCommand<Object> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SignalCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SignalCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SignalCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -33,7 +33,7 @@
/**
* @author Tom Baeyens
*/
-public class SignalCmd implements Command<Execution> {
+public class SignalCmd extends AbstractCommand<Execution> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SubmitTaskCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SubmitTaskCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SubmitTaskCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -30,7 +30,7 @@
/**
* @author Tom Baeyens
*/
-public class SubmitTaskCmd implements Command<Void> {
+public class SubmitTaskCmd extends AbstractCommand<Void> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/TakeTaskCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/TakeTaskCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/TakeTaskCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -31,7 +31,7 @@
/**
* @author Tom Baeyens
*/
-public class TakeTaskCmd implements Command<Void> {
+public class TakeTaskCmd extends AbstractCommand<Void> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/VariablesCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/VariablesCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/VariablesCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -24,6 +24,11 @@
import java.util.HashMap;
import java.util.Map;
+import org.jbpm.JbpmException;
+import org.jbpm.client.ClientExecution;
+import org.jbpm.env.Environment;
+import org.jbpm.session.PvmDbSession;
+
/**
* @author Tom Baeyens
*/
@@ -47,4 +52,14 @@
public void setVariables(Map<String, Object> variables) {
this.variables = variables;
}
+
+ protected ClientExecution getExecution(Environment environment, String executionId) {
+ PvmDbSession dbSession = environment.get(PvmDbSession.class);
+ ClientExecution execution = dbSession.findExecutionById(executionId);
+ if (execution==null) {
+ throw new JbpmException("execution "+executionId+" doesn't exist");
+ }
+ return execution;
+ }
+
}
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/ProvidedAuthentication.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/ProvidedAuthentication.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/ProvidedAuthentication.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.env;
+
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ProvidedAuthentication extends Authentication {
+
+ protected String userId;
+
+ public ProvidedAuthentication(String userId) {
+ this.userId = userId;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/ProvidedAuthentication.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironmentFactoryParser.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironmentFactoryParser.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironmentFactoryParser.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -86,7 +86,7 @@
// configure the default environment factory
jbpmConfiguration.setEnvironmentFactoryCtxWireContext(environmentFactoryWireContext);
- jbpmConfiguration.setEnvironmentCtxWireDefinition(environmentWireDefinition);
+ jbpmConfiguration.setTransactionCtxWireDefinition(environmentWireDefinition);
parse.setDocumentObject(jbpmConfiguration);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentityServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentityServiceImpl.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentityServiceImpl.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -62,6 +62,14 @@
commandService.execute(new DeleteUser(userId));
}
+ public String createGroup(String groupName) {
+ return commandService.execute(new CreateGroup(groupName, null, null));
+ }
+
+ public String createGroup(String groupName, String groupType) {
+ return commandService.execute(new CreateGroup(groupName, groupType, null));
+ }
+
public String createGroup(String groupName, String groupType, String parentGroupId) {
return commandService.execute(new CreateGroup(groupName, groupType, parentGroupId));
}
@@ -82,12 +90,16 @@
commandService.execute(new DeleteGroup(groupId));
}
+ public void createMembership(String userId, String groupId) {
+ commandService.execute(new CreateMembership(userId, groupId, null));
+ }
+
public void createMembership(String userId, String groupId, String role) {
commandService.execute(new CreateMembership(userId, groupId, role));
}
+
public void deleteMembership(String userId, String groupId, String role) {
commandService.execute(new DeleteMembership(userId, groupId, role));
}
-
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentitySessionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentitySessionImpl.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentitySessionImpl.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -42,7 +42,6 @@
user.setId(userName);
user.setGivenName(givenName);
user.setFamilyName(familyName);
-
session.save(user);
}
@@ -68,7 +67,8 @@
public String createGroup(String groupName, String groupType, String parentGroupId) {
GroupImpl group = new GroupImpl();
- group.setId("group://"+groupType+"/"+groupName);
+ String groupId = (groupType!=null ? groupType+"."+groupName : groupName);
+ group.setId(groupId);
group.setName(groupName);
group.setType(groupType);
@@ -134,6 +134,7 @@
}
public void deleteMembership(String userId, String groupId, String role) {
+ throw new UnsupportedOperationException("please implement me");
}
public void setSession(Session session) {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/EnvironmentInterceptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/EnvironmentInterceptor.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/EnvironmentInterceptor.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -21,9 +21,13 @@
*/
package org.jbpm.pvm.internal.svc;
+import java.util.List;
+
import org.jbpm.cmd.Command;
import org.jbpm.env.Environment;
import org.jbpm.env.EnvironmentFactory;
+import org.jbpm.env.WireObject;
+import org.jbpm.pvm.internal.cmd.AbstractCommand;
/** sets up an environment around the execution of the command.
@@ -35,8 +39,17 @@
protected EnvironmentFactory environmentFactory;
public <T> T execute(Command<T> command) {
- Environment environment = environmentFactory.openEnvironment();
+ Environment environment;
+ if (command instanceof AbstractCommand) {
+ AbstractCommand abstractCommand = (AbstractCommand) command;
+ List<WireObject> txWireObjects = abstractCommand.getTxWireObjects();
+ environment = environmentFactory.openEnvironment(txWireObjects);
+
+ } else {
+ environment = environmentFactory.openEnvironment();
+ }
+
try {
return next.execute(command);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskServiceImpl.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskServiceImpl.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -21,12 +21,16 @@
*/
package org.jbpm.pvm.internal.task;
+import java.sql.Connection;
+import java.util.ArrayList;
import java.util.List;
import org.jbpm.TaskQuery;
import org.jbpm.TaskService;
import org.jbpm.cmd.CommandService;
+import org.jbpm.env.WireObject;
import org.jbpm.model.Comment;
+import org.jbpm.pvm.internal.cmd.AbstractCommand;
import org.jbpm.pvm.internal.cmd.AddParticipantCmd;
import org.jbpm.pvm.internal.cmd.AddReplyCommentCmd;
import org.jbpm.pvm.internal.cmd.AddTaskCommentCmd;
@@ -41,6 +45,7 @@
import org.jbpm.pvm.internal.cmd.SaveTaskCmd;
import org.jbpm.pvm.internal.cmd.SubmitTaskCmd;
import org.jbpm.pvm.internal.cmd.TakeTaskCmd;
+import org.jbpm.pvm.internal.env.ProvidedAuthentication;
import org.jbpm.task.IdentityRef;
import org.jbpm.task.Participant;
import org.jbpm.task.Task;
@@ -51,6 +56,8 @@
public class TaskServiceImpl implements TaskService {
protected CommandService commandService;
+
+ protected ThreadLocal<List<WireObject>> contextThreadLocal;
public TaskServiceImpl() {
}
@@ -68,47 +75,59 @@
}
public Task newTask() {
- return commandService.execute(new NewTaskCmd(null));
+ NewTaskCmd cmd = new NewTaskCmd(null);
+ addTxWireObjects(cmd);
+ return commandService.execute(cmd);
}
public Task getTask(long taskDbid) {
- return commandService.execute(new GetTaskCmd(taskDbid));
+ GetTaskCmd cmd = new GetTaskCmd(taskDbid);
+ return commandService.execute(cmd);
}
public long saveTask(Task task) {
- return commandService.execute(new SaveTaskCmd((TaskImpl) task));
+ SaveTaskCmd cmd = new SaveTaskCmd((TaskImpl) task);
+ return commandService.execute(cmd);
}
public void deleteTask(long taskDbid) {
- commandService.execute(new DeleteTaskCmd(taskDbid));
+ DeleteTaskCmd cmd = new DeleteTaskCmd(taskDbid);
+ commandService.execute(cmd);
}
public void submitTask(long taskDbid) {
- commandService.execute(new SubmitTaskCmd(taskDbid));
+ SubmitTaskCmd cmd = new SubmitTaskCmd(taskDbid);
+ commandService.execute(cmd);
}
public void addTaskParticipant(long taskDbid, IdentityRef identityRef, String participation) {
- commandService.execute(new AddParticipantCmd(taskDbid, null, identityRef, participation));
+ AddParticipantCmd cmd = new AddParticipantCmd(taskDbid, null, identityRef, participation);
+ commandService.execute(cmd);
}
public List<Participant> getTaskParticipants(long taskDbid) {
- return commandService.execute(new GetParticipantsCmd(taskDbid, null));
+ GetParticipantsCmd cmd = new GetParticipantsCmd(taskDbid, null);
+ return commandService.execute(cmd);
}
public void removeTaskParticipant(long taskDbid, IdentityRef identityRef, String participation) {
- commandService.execute(new RemoveParticipantCmd(taskDbid, null, identityRef, participation));
+ RemoveParticipantCmd cmd = new RemoveParticipantCmd(taskDbid, null, identityRef, participation);
+ commandService.execute(cmd);
}
public void addSwimlaneParticipant(long szimlaneDbid, IdentityRef identityRef, String participation) {
- commandService.execute(new AddParticipantCmd(null, szimlaneDbid, identityRef, participation));
+ AddParticipantCmd cmd = new AddParticipantCmd(null, szimlaneDbid, identityRef, participation);
+ commandService.execute(cmd);
}
public List<Participant> getSwimlaneParticipants(long szimlaneDbid) {
- return commandService.execute(new GetParticipantsCmd(null, szimlaneDbid));
+ GetParticipantsCmd cmd = new GetParticipantsCmd(null, szimlaneDbid);
+ return commandService.execute(cmd);
}
public void removeSwimlaneParticipant(long szimlaneDbid, IdentityRef identityRef, String participation) {
- commandService.execute(new RemoveParticipantCmd(null, szimlaneDbid, identityRef, participation));
+ RemoveParticipantCmd cmd = new RemoveParticipantCmd(null, szimlaneDbid, identityRef, participation);
+ commandService.execute(cmd);
}
public List<Task> getPersonalTaskList(String userId, int firstResult, int maxResults) {
@@ -121,6 +140,7 @@
public List<Task> getGroupTaskList(String userId, int firstResult, int maxResults) {
return createTaskQuery()
+ .unassigned()
.candidate(userId)
.orderDesc(TaskQuery.PROPERTY_PRIORITY)
.page(firstResult, maxResults)
@@ -132,30 +152,65 @@
}
public List<Task> getSubTasks(long taskDbid) {
- return commandService.execute(new GetSubTasksCmd(taskDbid));
+ GetSubTasksCmd cmd = new GetSubTasksCmd(taskDbid);
+ return commandService.execute(cmd);
}
public Task newTask(long parentTaskDbid) {
- return commandService.execute(new NewTaskCmd(parentTaskDbid));
+ NewTaskCmd cmd = new NewTaskCmd(parentTaskDbid);
+ return commandService.execute(cmd);
}
public Comment addTaskComment(long taskDbid, String message) {
- return commandService.execute(new AddTaskCommentCmd(taskDbid, message));
+ AddTaskCommentCmd cmd = new AddTaskCommentCmd(taskDbid, message);
+ return commandService.execute(cmd);
}
public List<Comment> getTaskComments(long taskDbid) {
- return commandService.execute(new GetTaskCommentsCmd(taskDbid));
+ GetTaskCommentsCmd cmd = new GetTaskCommentsCmd(taskDbid);
+ return commandService.execute(cmd);
}
public void deleteComment(long commentDbid) {
- commandService.execute(new DeleteCommentCmd(commentDbid));
+ DeleteCommentCmd cmd = new DeleteCommentCmd(commentDbid);
+ commandService.execute(cmd);
}
public Comment addReplyComment(long commentDbid, String message) {
- return commandService.execute(new AddReplyCommentCmd(commentDbid, message));
+ AddReplyCommentCmd cmd = new AddReplyCommentCmd(commentDbid, message);
+ return commandService.execute(cmd);
}
public void takeTask(long taskDbid) {
- commandService.execute(new TakeTaskCmd(taskDbid));
+ TakeTaskCmd cmd = new TakeTaskCmd(taskDbid);
+ addTxWireObjects(cmd);
+ commandService.execute(cmd);
}
+
+ public void setUserId(String userId) {
+ addTxWireObject(new WireObject(new ProvidedAuthentication(userId)));
+ }
+
+ public void setConnection(Connection connection) {
+ addTxWireObject(new WireObject(connection));
+ }
+
+ protected synchronized void addTxWireObject(WireObject wireObject) {
+ if (contextThreadLocal==null) {
+ contextThreadLocal = new ThreadLocal<List<WireObject>>();
+ }
+ List<WireObject> txWireObjects = contextThreadLocal.get();
+ if (txWireObjects==null) {
+ txWireObjects = new ArrayList<WireObject>();
+ contextThreadLocal.set(txWireObjects);
+ }
+ txWireObjects.add(wireObject);
+ }
+
+ protected void addTxWireObjects(AbstractCommand cmd) {
+ if (contextThreadLocal!=null) {
+ cmd.setTxWireObjects(contextThreadLocal.get());
+ contextThreadLocal.set(null);
+ }
+ }
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireDefinition.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireDefinition.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireDefinition.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -27,8 +27,10 @@
import java.util.List;
import java.util.Map;
+import org.jbpm.env.WireObject;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
/**
@@ -56,11 +58,26 @@
public WireDefinition() {
}
- public WireDefinition(WireDefinition other) {
- this.descriptors = new HashMap<String, Descriptor>(other.descriptors);
- this.descriptorNames = new HashMap<Class<?>, String>(other.descriptorNames);
+ public WireDefinition(WireDefinition other, List<WireObject> txWireObjects) {
+ if (other.descriptors!=null) {
+ this.descriptors = new HashMap<String, Descriptor>(other.descriptors);
+ }
+ if (other.descriptorNames!=null) {
+ this.descriptorNames = new HashMap<Class<?>, String>(other.descriptorNames);
+ }
+ if (other.eagerInitNames!=null) {
+ this.eagerInitNames = new ArrayList<String>(other.eagerInitNames);
+ }
this.useTypes = other.useTypes;
- this.eagerInitNames = new ArrayList<String>(other.eagerInitNames);
+
+ for (WireObject wireObject: txWireObjects) {
+ ProvidedObjectDescriptor descriptor = new ProvidedObjectDescriptor(
+ wireObject.getObject(),
+ wireObject.isTypeExposed(),
+ wireObject.getName()
+ );
+ addDescriptor(descriptor);
+ }
}
public void addDescriptor(Descriptor descriptor) {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ProvidedObjectDescriptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ProvidedObjectDescriptor.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ProvidedObjectDescriptor.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -47,6 +47,12 @@
this.exposeType = exposeType;
}
+ public ProvidedObjectDescriptor(Object providedObject, boolean exposeType, String name) {
+ this.exposeType = exposeType;
+ this.providedObject = providedObject;
+ this.name = name;
+ }
+
public Object construct(WireContext wireContext) {
return providedObject;
}
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/identity/IdentityTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/identity/IdentityTest.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/identity/IdentityTest.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -73,6 +73,6 @@
assertEquals(1, groups.size());
Group group = groups.get(0);
- assertEquals("group://unit/jboss", group.getId());
+ assertEquals("unit.jboss", group.getId());
}
}
Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -29,6 +29,7 @@
import org.jbpm.Execution;
import org.jbpm.ExecutionService;
import org.jbpm.HistoryService;
+import org.jbpm.IdentityService;
import org.jbpm.ManagementService;
import org.jbpm.ProcessDefinition;
import org.jbpm.ProcessEngine;
@@ -72,6 +73,7 @@
protected static ManagementService managementService;
protected static TaskService taskService;
protected static HistoryService historyService;
+ protected static IdentityService identityService;
protected static CommandService commandService;
@@ -105,6 +107,7 @@
historyService = processEngine.getHistoryService();
managementService = processEngine.getManagementService();
taskService = processEngine.getTaskService();
+ identityService = processEngine.getIdentityService();
commandService = processEngine.get(CommandService.class);
}
}
Copied: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCandidatesTest.java (from rev 4298, jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCandidatesTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCandidatesTest.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -0,0 +1,152 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.task;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.Execution;
+import org.jbpm.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskCandidatesTest extends JbpmTestCase {
+
+ public void testCommaSeparatedTaskCandidates() {
+ deployJpdlXmlString(
+ "<process name='TaskCandidates'>" +
+ " <start>" +
+ " <transition to='review' />" +
+ " </start>" +
+ " <task name='review' " +
+ " candidate-users='johndoe, joesmoe'>" +
+ " <transition to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ Execution execution = executionService.startProcessInstanceByKey("TaskCandidates");
+ String executionId = execution.getId();
+
+ List<Task> taskList = taskService.getGroupTaskList("johndoe", 0, 10);
+ assertEquals(1, taskList.size());
+ Task task = taskList.get(0);
+ assertEquals("review", task.getName());
+
+ taskList = taskService.getGroupTaskList("joesmoe", 0, 10);
+ assertEquals(1, taskList.size());
+ task = taskList.get(0);
+ assertEquals("review", task.getName());
+
+ // lets assume that johndoe takes the task
+ taskService.setUserId("johndoe");
+ taskService.takeTask(task.getDbid());
+
+ // verify that the group task lists are now empty
+ taskList = taskService.getGroupTaskList("johndoe", 0, 10);
+ assertEquals(0, taskList.size());
+ taskList = taskService.getGroupTaskList("joesmoe", 0, 10);
+ assertEquals(0, taskList.size());
+
+ // verify that the task now shows up in the personal task list for johndoe
+ taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ assertEquals(1, taskList.size());
+ task = taskList.get(0);
+ assertEquals("review", task.getName());
+ assertEquals("johndoe", task.getAssignee());
+
+ // submit the task
+ taskService.submitTask(task.getDbid());
+
+ // verify that the task list is now empty
+ taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ assertEquals(0, taskList.size());
+
+ // verify that process moved to the next state
+ execution = executionService.findExecution(executionId);
+ assertEquals("wait", execution.getActivityName());
+ }
+
+ public void testTaskCandidatesExpression() {
+ deployJpdlXmlString(
+ "<process name='TaskCandidates'>" +
+ " <start>" +
+ " <transition to='review' />" +
+ " </start>" +
+ " <task name='review' " +
+ " candidate-users='#{userone}, #{usertwo}'>" +
+ " <transition to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("userone", "johndoe");
+ variables.put("usertwo", "joesmoe");
+ Execution execution = executionService.startProcessInstanceByKey("TaskCandidates", variables);
+ String executionId = execution.getId();
+
+ List<Task> taskList = taskService.getGroupTaskList("johndoe", 0, 10);
+ assertEquals(1, taskList.size());
+ Task task = taskList.get(0);
+ assertEquals("review", task.getName());
+
+ taskList = taskService.getGroupTaskList("joesmoe", 0, 10);
+ assertEquals(1, taskList.size());
+ task = taskList.get(0);
+ assertEquals("review", task.getName());
+
+ // submit the task
+ taskService.setUserId("johndoe");
+ taskService.takeTask(task.getDbid());
+
+ // verify that the group task lists are now empty
+ taskList = taskService.getGroupTaskList("johndoe", 0, 10);
+ assertEquals(0, taskList.size());
+ taskList = taskService.getGroupTaskList("joesmoe", 0, 10);
+ assertEquals(0, taskList.size());
+
+ // verify that the task now shows up in the personal task list for johndoe
+ taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ assertEquals(1, taskList.size());
+ task = taskList.get(0);
+ assertEquals("review", task.getName());
+ assertEquals("johndoe", task.getAssignee());
+
+ // submit the task
+ taskService.submitTask(task.getDbid());
+
+ // verify that the task list is now empty
+ taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ assertEquals(0, taskList.size());
+
+ // verify that process moved to the next state
+ execution = executionService.findExecution(executionId);
+ assertEquals("wait", execution.getActivityName());
+ }
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCandidatesTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
17 years, 1 month
JBoss JBPM SVN: r4300 - jbpm4/trunk/modules/api/src/main/resources.
by do-not-reply@jboss.org
Author: koen.aers(a)jboss.com
Date: 2009-03-19 17:35:58 -0400 (Thu, 19 Mar 2009)
New Revision: 4300
Modified:
jbpm4/trunk/modules/api/src/main/resources/jpdl.xsd
Log:
addition of the assignee-lang, candidate-groups-lang and candidate-users-lang attributes
Modified: jbpm4/trunk/modules/api/src/main/resources/jpdl.xsd
===================================================================
--- jbpm4/trunk/modules/api/src/main/resources/jpdl.xsd 2009-03-19 15:50:39 UTC (rev 4299)
+++ jbpm4/trunk/modules/api/src/main/resources/jpdl.xsd 2009-03-19 21:35:58 UTC (rev 4300)
@@ -593,16 +593,31 @@
the actual actor that needs to execute the task. It can be a literal as well.
</documentation></annotation>
</attribute>
+ <attribute name="assignee-lang" type="string">
+ <annotation><documentation>The expression language to use to evaluate the assignee
+ expression.
+ </documentation></annotation>
+ </attribute>
<attribute name="candidate-groups" type="string">
<annotation><documentation>An expression '#{expr}' that resolves to a comma separated
list of groups of actors with candidates to execute the task.
</documentation></annotation>
</attribute>
+ <attribute name="candidate-groups-lang" type="string">
+ <annotation><documentation>The expression language to use to evaluate the candidate-groups
+ expression.
+ </documentation></annotation>
+ </attribute>
<attribute name="candidate-users" type="string">
<annotation><documentation>An expression '#{expr}' that resolves to a comma separated
list of actors that are candidate to execute the task.
</documentation></annotation>
</attribute>
+ <attribute name="candidate-users-lang" type="string">
+ <annotation><documentation>The expression language to use to evaluate the candidate-users
+ expression.
+ </documentation></annotation>
+ </attribute>
<attribute name="swimlane" type="string">
<annotation><documentation>The name of the swimlane that will contain the actor that
needs to execute the task.
17 years, 1 month