JBoss JBPM SVN: r4584 - projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-20 10:23:39 -0400 (Mon, 20 Apr 2009)
New Revision: 4584
Added:
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/AbstractContextAwareAction.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/StartNewInstanceAction.java
Modified:
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/DefinitionListView.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/InstanceListView.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/LoadDefinitionsAction.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/LoadInstancesAction.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditor.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditorNavigation.java
Log:
Re-implement start new instance
Added: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/AbstractContextAwareAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/AbstractContextAwareAction.java (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/AbstractContextAwareAction.java 2009-04-20 14:23:39 UTC (rev 4584)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.v2.process;
+
+import com.mvc4g.client.ActionInterface;
+import org.jboss.bpm.console.client.ApplicationContext;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+abstract class AbstractContextAwareAction implements ActionInterface
+{
+ ApplicationContext appContext;
+
+ public AbstractContextAwareAction(ApplicationContext appContext)
+ {
+ this.appContext = appContext;
+ }
+}
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/DefinitionListView.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/DefinitionListView.java 2009-04-20 13:11:35 UTC (rev 4583)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/DefinitionListView.java 2009-04-20 14:23:39 UTC (rev 4584)
@@ -21,14 +21,13 @@
*/
package org.jboss.bpm.console.client.v2.process;
+import com.google.gwt.user.client.ui.ChangeListener;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Widget;
-import com.google.gwt.user.client.ui.ChangeListener;
import com.mvc4g.client.Controller;
import com.mvc4g.client.Event;
import com.mvc4g.client.ViewInterface;
import org.gwt.mosaic.ui.client.ListBox;
-import org.gwt.mosaic.ui.client.MessageBox;
import org.gwt.mosaic.ui.client.ToolBar;
import org.gwt.mosaic.ui.client.ToolButton;
import org.gwt.mosaic.ui.client.layout.BoxLayout;
@@ -43,7 +42,7 @@
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
-public class DefinitionListView extends LayoutPanel
+class DefinitionListView extends LayoutPanel
implements ViewInterface, LazyPanel
{
public final static String ID = DefinitionListView.class.getName();
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/InstanceListView.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/InstanceListView.java 2009-04-20 13:11:35 UTC (rev 4583)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/InstanceListView.java 2009-04-20 14:23:39 UTC (rev 4584)
@@ -41,7 +41,7 @@
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
-public class InstanceListView extends LayoutPanel implements ViewInterface
+class InstanceListView extends LayoutPanel implements ViewInterface
{
public final static String ID = InstanceListView.class.getName();
@@ -110,12 +110,30 @@
)
);
+ toolBar.addSeparator();
+
+ toolBar.add(
+ new ToolButton("Start new instance", new ClickListener() {
+ public void onClick(Widget sender) {
+ controller.handleEvent(
+ new Event(
+ StartNewInstanceAction.ID,
+ getCurrentDefinition()
+ )
+ );
+ }
+ }
+ )
+ );
+
+
toolBox.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
instanceList.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
instanceList.add(listBox, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
this.add(instanceList);
+
}
private ProcessDefinitionRef getCurrentDefinition()
@@ -130,18 +148,18 @@
public void update(final ProcessDefinitionRef def, List<ProcessInstanceRef> instances)
- {
+ {
this.currentDefinition = def;
final DefaultListModel<ProcessInstanceRef> model =
(DefaultListModel<ProcessInstanceRef>) listBox.getModel();
model.clear();
-
+
for(ProcessInstanceRef inst : instances)
{
model.add(inst);
}
-
+
// layout again
this.invalidate();
}
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/LoadDefinitionsAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/LoadDefinitionsAction.java 2009-04-20 13:11:35 UTC (rev 4583)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/LoadDefinitionsAction.java 2009-04-20 14:23:39 UTC (rev 4584)
@@ -37,15 +37,13 @@
*
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
-public class LoadDefinitionsAction implements ActionInterface
+class LoadDefinitionsAction extends AbstractContextAwareAction
{
public final static String ID = LoadDefinitionsAction.class.getName();
- ApplicationContext appContext;
-
public LoadDefinitionsAction(ApplicationContext appContext)
{
- this.appContext = appContext;
+ super(appContext);
}
public void execute(final Controller controller, Object object)
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/LoadInstancesAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/LoadInstancesAction.java 2009-04-20 13:11:35 UTC (rev 4583)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/LoadInstancesAction.java 2009-04-20 14:23:39 UTC (rev 4584)
@@ -21,13 +21,12 @@
*/
package org.jboss.bpm.console.client.v2.process;
-import com.mvc4g.client.ActionInterface;
-import com.mvc4g.client.Controller;
import com.google.gwt.core.client.JavaScriptObject;
+import com.mvc4g.client.Controller;
import org.jboss.bpm.console.client.ApplicationContext;
-import org.jboss.bpm.console.client.model.ProcessInstanceRef;
-import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.client.model.DTOParser;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.client.util.JSONRequest;
import org.jboss.bpm.console.client.util.JSONRequestHandler;
@@ -36,16 +35,13 @@
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
-public class LoadInstancesAction implements ActionInterface
+class LoadInstancesAction extends AbstractContextAwareAction
{
-
public final static String ID = LoadInstancesAction.class.getName();
- private ApplicationContext appContext;
-
public LoadInstancesAction(ApplicationContext appContext)
{
- this.appContext = appContext;
+ super(appContext);
}
public void execute(final Controller controller, Object object)
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditor.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditor.java 2009-04-20 13:11:35 UTC (rev 4583)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditor.java 2009-04-20 14:23:39 UTC (rev 4584)
@@ -66,7 +66,8 @@
// create and register actions
addAction(LoadDefinitionsAction.ID, new LoadDefinitionsAction(appContext));
addAction(LoadInstancesAction.ID, new LoadInstancesAction(appContext));
-
+ addAction(StartNewInstanceAction.ID, new StartNewInstanceAction(appContext));
+
// tab Listener
tabPanel.addTabListener(
new TabListener()
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditorNavigation.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditorNavigation.java 2009-04-20 13:11:35 UTC (rev 4583)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditorNavigation.java 2009-04-20 14:23:39 UTC (rev 4584)
@@ -30,7 +30,7 @@
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
-public class ProcessEditorNavigation extends Tree
+class ProcessEditorNavigation extends Tree
{
public ProcessEditorNavigation(final ApplicationContext appContext)
Added: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/StartNewInstanceAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/StartNewInstanceAction.java (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/StartNewInstanceAction.java 2009-04-20 14:23:39 UTC (rev 4584)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.v2.process;
+
+import com.mvc4g.client.Controller;
+import com.mvc4g.client.Event;
+import com.google.gwt.http.client.*;
+import org.jboss.bpm.console.client.ApplicationContext;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+class StartNewInstanceAction extends AbstractContextAwareAction
+{
+ public final static String ID = StartNewInstanceAction.class.getName();
+
+ public StartNewInstanceAction(ApplicationContext appContext)
+ {
+ super(appContext);
+ }
+
+ public void execute(final Controller controller, Object object)
+ {
+ final ProcessDefinitionRef def = (ProcessDefinitionRef)object;
+
+ String url = appContext.getUrlBuilder().getStartNewInstanceURL(def.getId());
+ RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(url));
+
+ try {
+ Request request = builder.sendRequest(null, new RequestCallback() {
+ public void onError(Request request, Throwable exception) {
+ // Couldn't connect to server (could be timeout, SOP violation, etc.)
+ handleError(exception);
+ }
+
+ public void onResponseReceived(Request request, Response response) {
+ if (200 == response.getStatusCode()) {
+
+ // force reload instance list
+ controller.handleEvent(
+ new Event(LoadInstancesAction.ID, def)
+ );
+
+ } else {
+ // Handle the error. Can get the status text from response.getStatusText()
+ appContext.displayMessage("Failed to start new instance. " +
+ "HTTP " + response.getStatusCode()+
+ ": " +response.getText(),
+ true
+ );
+ }
+ }
+ });
+ }
+ catch (RequestException e)
+ {
+ // Couldn't connect to server
+ handleError(e);
+ }
+ }
+
+ private void handleError(Throwable t)
+ {
+ // Couldn't connect to server
+ appContext.displayMessage("Failed to start new instance. " +
+ "RequestException( "+t.getClass() +"): "+
+ t.getMessage(),
+ true
+ );
+ }
+}
17 years
JBoss JBPM SVN: r4583 - in projects/gwt-console/branches/hbraun: war/src/main/java/org/jboss/bpm/console/client/v2/process and 1 other directory.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-20 09:11:35 -0400 (Mon, 20 Apr 2009)
New Revision: 4583
Modified:
projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/v2/LazyPanel.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/DefinitionListView.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditor.java
Log:
Load instances upon row selection
Modified: projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/v2/LazyPanel.java
===================================================================
--- projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/v2/LazyPanel.java 2009-04-20 13:09:19 UTC (rev 4582)
+++ projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/v2/LazyPanel.java 2009-04-20 13:11:35 UTC (rev 4583)
@@ -28,5 +28,8 @@
{
boolean isInitialized();
+ /**
+ * Expected to be an idempotent implementation
+ */
void initialize();
}
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/DefinitionListView.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/DefinitionListView.java 2009-04-20 13:09:19 UTC (rev 4582)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/DefinitionListView.java 2009-04-20 13:11:35 UTC (rev 4583)
@@ -23,6 +23,7 @@
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.ui.ChangeListener;
import com.mvc4g.client.Controller;
import com.mvc4g.client.Event;
import com.mvc4g.client.ViewInterface;
@@ -72,7 +73,7 @@
{
System.out.println("init DefinitionListView");
-
+
definitionList = new LayoutPanel( new BoxLayout(BoxLayout.Orientation.VERTICAL));
definitionList.setPadding(0);
definitionList.setWidgetSpacing(0);
@@ -106,6 +107,23 @@
}
});
+ listBox.addChangeListener(new ChangeListener()
+ {
+ public void onChange(Widget widget)
+ {
+ int index = listBox.getSelectedIndex();
+ if(index!=-1)
+ {
+ controller.handleEvent(
+ new Event(
+ LoadInstancesAction.ID,
+ listBox.getItem( index )
+ )
+ );
+ }
+ }
+ });
+
final DefaultListModel<ProcessDefinitionRef> model =
(DefaultListModel<ProcessDefinitionRef>) listBox.getModel();
@@ -128,28 +146,7 @@
}
)
);
-
- toolBar.addSeparator();
-
- toolBar.add(
- new ToolButton("View Instances", new ClickListener() {
- public void onClick(Widget sender) {
- int index = listBox.getSelectedIndex();
- if(index==-1)
- MessageBox.alert("Missing selection", "Please select a process");
- else
- controller.handleEvent(
- new Event(
- LoadInstancesAction.ID,
- listBox.getItem( listBox.getSelectedIndex())
- )
- );
- }
- }
- )
- );
-
-
+
toolBox.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
this.definitionList.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
@@ -171,7 +168,7 @@
{
// lazy init
initialize();
-
+
final DefaultListModel<ProcessDefinitionRef> model =
(DefaultListModel<ProcessDefinitionRef>) listBox.getModel();
@@ -182,4 +179,12 @@
model.add(def);
}
}
+
+ public ProcessDefinitionRef getSelection()
+ {
+ ProcessDefinitionRef selection = null;
+ if(isInitialized() && listBox.getSelectedIndex()!=-1)
+ selection = listBox.getItem( listBox.getSelectedIndex());
+ return selection;
+ }
}
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditor.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditor.java 2009-04-20 13:09:19 UTC (rev 4582)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditor.java 2009-04-20 13:11:35 UTC (rev 4583)
@@ -21,18 +21,17 @@
*/
package org.jboss.bpm.console.client.v2.process;
+import com.google.gwt.user.client.ui.SourcesTabEvents;
+import com.google.gwt.user.client.ui.TabListener;
import com.google.gwt.user.client.ui.Widget;
-import com.google.gwt.user.client.ui.TabListener;
-import com.google.gwt.user.client.ui.SourcesTabEvents;
-import com.google.gwt.user.client.Window;
import com.mvc4g.client.ActionInterface;
import com.mvc4g.client.Event;
import com.mvc4g.client.ViewInterface;
import org.gwt.mosaic.ui.client.DecoratedTabLayoutPanel;
+import org.gwt.mosaic.ui.client.MessageBox;
import org.gwt.mosaic.ui.client.TabLayoutPanel;
import static org.gwt.mosaic.ui.client.layout.BorderLayout.Region;
import org.gwt.mosaic.ui.client.layout.BorderLayoutData;
-import org.gwt.mosaic.ui.client.layout.LayoutPanel;
import org.jboss.bpm.console.client.ApplicationContext;
import org.jboss.bpm.console.client.Editor;
import org.jboss.bpm.console.client.MenuSection;
@@ -48,7 +47,7 @@
public ProcessEditor(ApplicationContext appContext)
{
- super(appContext);
+ super(appContext);
}
public void initialize()
@@ -57,7 +56,7 @@
{
// create inner tab layout
tabPanel = new DecoratedTabLayoutPanel();
- tabPanel.setPadding(5);
+ tabPanel.setPadding(5);
this.add(tabPanel, new BorderLayoutData(Region.CENTER));
// create and register views
@@ -68,6 +67,34 @@
addAction(LoadDefinitionsAction.ID, new LoadDefinitionsAction(appContext));
addAction(LoadInstancesAction.ID, new LoadInstancesAction(appContext));
+ // tab Listener
+ tabPanel.addTabListener(
+ new TabListener()
+ {
+
+ public boolean onBeforeTabSelected(SourcesTabEvents sourcesTabEvents, int i)
+ {
+
+ if(i==0) return true; // definition tab
+
+ DefinitionListView view = ((DefinitionListView) controller.getView(DefinitionListView.ID));
+ boolean hasSelection = view.getSelection() != null;
+ if(hasSelection)
+ return true;
+ else
+ {
+ MessageBox.alert("Missing selection", "Please select a process");
+ return false;
+ }
+ }
+
+ public void onTabSelected(SourcesTabEvents sourcesTabEvents, int i)
+ {
+
+ }
+ }
+ );
+
// display tab, needs to visible for correct rendering
tabPanel.selectTab(0);
17 years
JBoss JBPM SVN: r4582 - in jbpm4/trunk/modules: api/src/main/resources and 19 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-04-20 09:09:19 -0400 (Mon, 20 Apr 2009)
New Revision: 4582
Added:
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/variables/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/variables/SubProcessVariablesTest.java
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/variables/
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/variables/SubProcessDocument.jpdl.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/variables/SubProcessReview.jpdl.xml
jbpm4/trunk/modules/userguide/src/main/docbook/en/images/process.subprocess.review.png
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/client/ClientProcessDefinition.java
jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd
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/jbpm/jbpm.jpdl.activities.xml
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/part1.jbpm.wire.bindings.xml
jbpm4/trunk/modules/examples/src/test/resources/jbpm.execution.hbm.xml
jbpm4/trunk/modules/examples/src/test/resources/jbpm.jpdl.activities.xml
jbpm4/trunk/modules/examples/src/test/resources/jbpm.wire.bindings.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/state/choice/process.jpdl.xml
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.execution.hbm.xml
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.jpdl.activities.xml
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.wire.bindings.xml
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionSet.java
jbpm4/trunk/modules/pvm/src/test/resources/jbpm.execution.hbm.xml
jbpm4/trunk/modules/pvm/src/test/resources/jbpm.jpdl.activities.xml
jbpm4/trunk/modules/pvm/src/test/resources/jbpm.wire.bindings.xml
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.execution.hbm.xml
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.jpdl.activities.xml
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.wire.bindings.xml
jbpm4/trunk/modules/userguide/src/main/docbook/en/images/process.state.choice.png
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml
Log:
JBPM-2025 sub-process example and docs
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/client/ClientProcessDefinition.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/client/ClientProcessDefinition.java 2009-04-20 12:49:13 UTC (rev 4581)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/client/ClientProcessDefinition.java 2009-04-20 13:09:19 UTC (rev 4582)
@@ -21,6 +21,7 @@
*/
package org.jbpm.api.client;
+import org.jbpm.api.Execution;
import org.jbpm.api.model.OpenExecution;
import org.jbpm.api.model.OpenProcessDefinition;
@@ -46,6 +47,15 @@
* @param key is a user provided reference that uniquely identifies this
* process instance in the scope of the process name. */
ClientProcessInstance createProcessInstance(String key);
+
+ /** creates a new process instances with a given key. The returned process instance
+ * is not started yet. This way,
+ * {@link OpenExecution#setVariable(String, Object) variables can be set}
+ * before execution is started. Invoke {@link ClientProcessInstance#start()}
+ * to start execution of the process.
+ * @param key is a user provided reference that uniquely identifies this
+ * process instance in the scope of the process name. key is allowed to be null.*/
+ ClientProcessInstance createProcessInstance(String key, Execution superProcessExecution);
/** creates the process instance and immediately start its execution. */
ClientExecution startProcessInstance();
Modified: jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd
===================================================================
--- jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd 2009-04-20 12:49:13 UTC (rev 4581)
+++ jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd 2009-04-20 13:09:19 UTC (rev 4582)
@@ -214,6 +214,7 @@
</complexType>
</element>
+ <!-- ~~~ FORK ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="fork">
<annotation><documentation>Spawns multiple concurrent paths of
execution.
@@ -227,6 +228,7 @@
</complexType>
</element>
+ <!-- ~~~ JOIN ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="join">
<annotation><documentation>Spawns multiple concurrent paths of
execution.
@@ -240,6 +242,7 @@
</complexType>
</element>
+ <!-- ~~~ SCRIPT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="script">
<annotation><documentation>Evaluates a piece of text as a script
</documentation></annotation>
@@ -256,6 +259,7 @@
</complexType>
</element>
+ <!-- ~~~ HQL ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="hql">
<annotation><documentation>Performs a hibernate query
</documentation></annotation>
@@ -272,6 +276,7 @@
</complexType>
</element>
+ <!-- ~~~ SQL ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="sql">
<annotation><documentation>Performs a hibernate SQL query
</documentation></annotation>
@@ -288,6 +293,7 @@
</complexType>
</element>
+ <!-- ~~~ JAVA ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="java">
<annotation><documentation>Invokes a method on a java object.
Either the java class is instantiated with reflection, or the
@@ -307,6 +313,7 @@
</complexType>
</element>
+ <!-- ~~~ ESB ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="esb">
<annotation><documentation>Invokes a service over the ESB.
</documentation></annotation>
@@ -323,6 +330,7 @@
</complexType>
</element>
+ <!-- ~~~ TASK ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="task">
<annotation><documentation>Creates a task in the task component.
</documentation></annotation>
@@ -358,29 +366,68 @@
</complexType>
</element>
- <!--
- <element name="process-state">
+ <!-- ~~~ SUB-PROCESS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <element name="sub-process">
<annotation><documentation>Waits while a sub process instance is
being executed and continues when the sub process instance ends.
</documentation></annotation>
- < ! - - take into account the following situation:
- Unlike in jBPM 3, a process-state should not signal the newly created
- process instance. The signal in jBPM 3 is probably historically there
- because in the beginning there was no initial attribute on the process
- definition.
- - - >
<complexType>
- <sequence>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <element ref="tns:variable" minOccurs="0" maxOccurs="unbounded" />
+ <element ref="tns:out-variable" minOccurs="0" maxOccurs="unbounded" />
+ <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
<element ref="tns:on" minOccurs="0" maxOccurs="unbounded">
<annotation><documentation>Events on which listeners can be registered.</documentation></annotation>
</element>
- <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="swimlane-mapping" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <attribute name="swimlane" type="string" use="required" />
+ <attribute name="sub-swimlane" type="string" use="required" />
+ </complexType>
+ </element>
+ <element name="transition" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <complexContent>
+ <extension base="tns:transitionType">
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <element name="outcome-value">
+ <complexType>
+ <group ref="tns:wireObjectGroup" />
+ </complexType>
+ </element>
+ <element name="outcome">
+ <complexType>
+ <attribute name="activity" type="string" use="required" />
+ </complexType>
+ </element>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
</sequence>
+ <attribute name="sub-process-id" type="string">
+ <annotation><documentation>Identifies the sub process by the id. This means that a specific
+ version of a process definition is referenced
+ </documentation></annotation>
+ </attribute>
+ <attribute name="sub-process-key" type="string">
+ <annotation><documentation>Identifies the sub process by the key. This means that the latest
+ version of the process definition with the given key is referenced. The latest version
+ of the process is looked up each time the activity executes.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="outcome" type="string">
+ <annotation><documentation>Expression that is evaluated when the sub process
+ instance ends. The value is then used for outcome transition mapping.
+ </documentation></annotation>
+ </attribute>
<attributeGroup ref="tns:activityAttributes" />
</complexType>
</element>
+ <!-- ~~~ SUPER-STATE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <!--
<element name="super-state">
<annotation><documentation>Scope enclosing a number of activities.
</documentation></annotation>
@@ -644,6 +691,35 @@
</complexType>
</element>
+ <element name="variable">
+ <complexType>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of the variable.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="init" type="string">
+ <annotation><documentation>An expression for which the resulting
+ value will be used as initial value for the variable.
+ </documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="out-variable">
+ <complexType>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of the variable.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="init" type="string">
+ <annotation><documentation>An expression that will be resolved in the
+ inner scope and for which the resulting value will be set as a variable
+ in the outer scope.
+ </documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+
<element name="timer">
<complexType>
<sequence>
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-04-20 12:49:13 UTC (rev 4581)
+++ jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.execution.hbm.xml 2009-04-20 13:09:19 UTC (rev 4582)
@@ -94,6 +94,12 @@
foreign-key="FK_EXEC_SUPEREXEC"
index="IDX_EXEC_SUPEREXEC" />
+ <many-to-one name="subProcessInstance"
+ column="SUBPROCINST_"
+ class="ExecutionImpl"
+ foreign-key="FK_EXEC_SUBPI"
+ index="IDX_EXEC_SUBPI" />
+
</class>
<!-- ### COMMENTS ####################################################### -->
Modified: jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/jbpm.jpdl.activities.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/jbpm.jpdl.activities.xml 2009-04-20 12:49:13 UTC (rev 4581)
+++ jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/jbpm.jpdl.activities.xml 2009-04-20 13:09:19 UTC (rev 4582)
@@ -13,4 +13,5 @@
<activity binding="org.jbpm.jpdl.internal.activity.ScriptBinding" />
<activity binding="org.jbpm.jpdl.internal.activity.EsbBinding" />
<activity binding="org.jbpm.jpdl.internal.activity.TaskBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.SubProcessBinding" />
</activities>
Modified: jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/part1.jbpm.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/part1.jbpm.wire.bindings.xml 2009-04-20 12:49:13 UTC (rev 4581)
+++ jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/part1.jbpm.wire.bindings.xml 2009-04-20 13:09:19 UTC (rev 4582)
@@ -52,6 +52,8 @@
<binding class="org.jbpm.pvm.internal.wire.binding.JbossIdmIdentitySessionFactoryBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.JbossIdmIdentitySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.RepositorySessionBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.MailSessionBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.MailTemplateBinding" />
<!-- db sessions -->
<binding class="org.jbpm.pvm.internal.wire.binding.PvmDbSessionBinding" />
Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/variables/SubProcessVariablesTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/variables/SubProcessVariablesTest.java (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/variables/SubProcessVariablesTest.java 2009-04-20 13:09:19 UTC (rev 4582)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.examples.subprocess.variables;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SubProcessVariablesTest extends JbpmTestCase {
+
+ long reviewDeploymentDbid;
+ long subProcessDeploymentDbid;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ reviewDeploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/subprocess/variables/SubProcessReview.jpdl.xml")
+ .deploy();
+
+ subProcessDeploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/subprocess/variables/SubProcessDocument.jpdl.xml")
+ .deploy();
+ }
+
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(reviewDeploymentDbid);
+ repositoryService.deleteDeploymentCascade(subProcessDeploymentDbid);
+
+ super.tearDown();
+ }
+
+ public void testWaitStatesSequence() {
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("document", "This document describes how we can make more money...");
+
+ ProcessInstance processInstance = executionService
+ .startProcessInstanceByKey("SubProcessDocument", variables);
+
+ assertNotNull(processInstance.findActiveExecutionIn("review"));
+
+ List<Task> taskList = taskService.findAssignedTasks("johndoe");
+ Task task = taskList.get(0);
+
+ // first we show that the document has been passed to the sub process instance
+ // and is available as a task variable
+ String document = (String) taskService.getVariable(task.getDbid(), "document");
+ assertEquals("This document describes how we can make more money...", document);
+
+ // the result variable is set in the task
+ taskService.setVariable(task.getDbid(), "result", "accept");
+
+ // the task in the sub process instance is completed
+ taskService.completeTask(task.getDbid());
+
+ // we check that the process instance has moved to the wait state activity
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+ assertNotNull(processInstance.findActiveExecutionIn("wait"));
+
+ // and we check that the result has been propagated from the sub process
+ // into the parent process
+ String result = (String) executionService.getVariable(processInstance.getId(), "reviewResult");
+ assertEquals("accept", result);
+ }
+}
Property changes on: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/variables/SubProcessVariablesTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/examples/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.execution.hbm.xml 2009-04-20 12:49:13 UTC (rev 4581)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.execution.hbm.xml 2009-04-20 13:09:19 UTC (rev 4582)
@@ -94,6 +94,12 @@
foreign-key="FK_EXEC_SUPEREXEC"
index="IDX_EXEC_SUPEREXEC" />
+ <many-to-one name="subProcessInstance"
+ column="SUBPROCINST_"
+ class="ExecutionImpl"
+ foreign-key="FK_EXEC_SUBPI"
+ index="IDX_EXEC_SUBPI" />
+
</class>
<!-- ### COMMENTS ####################################################### -->
Modified: jbpm4/trunk/modules/examples/src/test/resources/jbpm.jpdl.activities.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.jpdl.activities.xml 2009-04-20 12:49:13 UTC (rev 4581)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.jpdl.activities.xml 2009-04-20 13:09:19 UTC (rev 4582)
@@ -13,4 +13,5 @@
<activity binding="org.jbpm.jpdl.internal.activity.ScriptBinding" />
<activity binding="org.jbpm.jpdl.internal.activity.EsbBinding" />
<activity binding="org.jbpm.jpdl.internal.activity.TaskBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.SubProcessBinding" />
</activities>
Modified: jbpm4/trunk/modules/examples/src/test/resources/jbpm.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.wire.bindings.xml 2009-04-20 12:49:13 UTC (rev 4581)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.wire.bindings.xml 2009-04-20 13:09:19 UTC (rev 4582)
@@ -52,6 +52,8 @@
<binding class="org.jbpm.pvm.internal.wire.binding.JbossIdmIdentitySessionFactoryBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.JbossIdmIdentitySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.RepositorySessionBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.MailSessionBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.MailTemplateBinding" />
<!-- db sessions -->
<binding class="org.jbpm.pvm.internal.wire.binding.PvmDbSessionBinding" />
Modified: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/state/choice/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/state/choice/process.jpdl.xml 2009-04-20 12:49:13 UTC (rev 4581)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/state/choice/process.jpdl.xml 2009-04-20 13:09:19 UTC (rev 4582)
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
-<process name="StateChoice" xmlns="http://jbpm.org/4/jpdl">
-
- <start g="16,60,48,48">
- <transition to="wait for response"/>
- </start>
-
- <state name="wait for response" g="96,58,109,52">
- <transition name="accept" to="submit document" g="151,41:-48,0" />
- <transition name="reject" to="try again" g="151,125:-47,-17" />
- </state>
-
- <state name="submit document" g="237,16,114,52" />
- <state name="try again" g="237,100,114,52" />
-
+<process name="StateChoice" xmlns="http://jbpm.org/4/jpdl">
+
+ <start g="16,60,48,48">
+ <transition to="wait for response"/>
+ </start>
+
+ <state name="wait for response" g="96,58,109,52" >
+ <transition name="accept" to="submit document" g="148,34:3,-15" />
+ <transition name="reject" to="try again" g="151,133:3,2" />
+ </state>
+
+ <state name="submit document" g="238,8,114,52" />
+ <state name="try again" g="238,108,114,52" />
+
</process>
\ No newline at end of file
Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/variables/SubProcessDocument.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/variables/SubProcessDocument.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/variables/SubProcessDocument.jpdl.xml 2009-04-20 13:09:19 UTC (rev 4582)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="SubProcessDocument" xmlns="http://jbpm.org/4/jpdl">
+
+ <start g="20,20,48,48">
+ <transition to="review" />
+ </start>
+
+ <sub-process name="review"
+ sub-process-key="SubProcessReview"
+ g="96,16,127,52">
+
+ <variable name="document" init="#{document}" />
+ <out-variable name="reviewResult" init="#{result}" />
+
+ <transition to="wait" />
+ </sub-process>
+
+ <state name="wait" g="255,16,88,52"/>
+
+</process>
Property changes on: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/variables/SubProcessDocument.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/variables/SubProcessReview.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/variables/SubProcessReview.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/variables/SubProcessReview.jpdl.xml 2009-04-20 13:09:19 UTC (rev 4582)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="SubProcessReview" xmlns="http://jbpm.org/4/jpdl">
+
+ <start g="20,20,48,48">
+ <transition to="get approval"/>
+ </start>
+
+ <task name="get approval"
+ assignee="johndoe"
+ g="96,16,127,52">
+
+ <transition to="end"/>
+ </task>
+
+ <end name="end" g="254,19,88,52" />
+
+</process>
\ No newline at end of file
Property changes on: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/variables/SubProcessReview.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java 2009-04-20 12:49:13 UTC (rev 4581)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java 2009-04-20 13:09:19 UTC (rev 4582)
@@ -66,11 +66,8 @@
processDefinition = repositorySession.findProcessDefinitionByKey(subProcessKey);
}
- JpdlExecution subProcessInstance = (JpdlExecution) processDefinition.createProcessInstance();
+ JpdlExecution subProcessInstance = (JpdlExecution) processDefinition.createProcessInstance(null, execution);
- subProcessInstance.setSuperProcessExecution(jpdlExecution);
- jpdlExecution.setSubProcessInstance(subProcessInstance);
-
for (String swimlaneName: swimlaneMappings.keySet()) {
String subSwimlaneName = swimlaneMappings.get(swimlaneName);
SwimlaneImpl subSwimlane = subProcessInstance.createSwimlane(subSwimlaneName);
@@ -87,14 +84,18 @@
}
subProcessInstance.start();
+ execution.waitForSignal();
}
public void signal(ActivityExecution execution, String signalName, Map<String, Object> parameters) {
JpdlExecution jpdlExecution = execution.getExtension(JpdlExecution.class);
ExecutionImpl subProcessInstance = jpdlExecution.getSubProcessInstance();
+ jpdlExecution.setSubProcessInstance(null);
+
variableOutDefinitionSet.processOutVariables(jpdlExecution, subProcessInstance);
+
String transitionName = null;
if (outcomeExpression!=null) {
@@ -102,7 +103,9 @@
Object value = scriptManager.evaluateExpression(outcomeExpression, subProcessInstance, null);
transitionName = outcomeActivityMappings.get(value);
- } else if (!outcomeActivityMappings.isEmpty()) {
+ } else if ( (outcomeActivityMappings!=null)
+ && (!outcomeActivityMappings.isEmpty())
+ ) {
String subProcessActivityName = subProcessInstance.getActivityName();
transitionName = outcomeActivityMappings.get(subProcessActivityName);
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java 2009-04-20 12:49:13 UTC (rev 4581)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java 2009-04-20 13:09:19 UTC (rev 4582)
@@ -27,7 +27,6 @@
import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.pvm.internal.model.VariableDefinitionImpl;
-import org.jbpm.pvm.internal.model.VariableOutDefinitionImpl;
import org.jbpm.pvm.internal.model.VariableOutDefinitionSet;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.Descriptor;
@@ -50,10 +49,10 @@
public Object parse(Element element, Parse parse, Parser parser) {
SubProcessActivity subProcessActivity = new SubProcessActivity();
- String subProcessKey = XmlUtil.attribute(element, "process-key");
+ String subProcessKey = XmlUtil.attribute(element, "sub-process-key");
subProcessActivity.setSubProcessKey(subProcessKey);
- String subProcessId = XmlUtil.attribute(element, "process-id");
+ String subProcessId = XmlUtil.attribute(element, "sub-process-id");
subProcessActivity.setSubProcessId(subProcessId);
List<VariableDefinitionImpl> variableDefinitions = JpdlParser.parseVariableDefinitions(element, parse, true);
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-04-20 12:49:13 UTC (rev 4581)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-04-20 13:09:19 UTC (rev 4582)
@@ -469,6 +469,8 @@
if (sources>1) {
parse.addProblem("init attribute and init element are mutually exclusive on element variable", inElement);
}
+
+ variableDefinitions.add(variableDefinition);
}
return variableDefinitions;
Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.execution.hbm.xml 2009-04-20 12:49:13 UTC (rev 4581)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.execution.hbm.xml 2009-04-20 13:09:19 UTC (rev 4582)
@@ -94,6 +94,12 @@
foreign-key="FK_EXEC_SUPEREXEC"
index="IDX_EXEC_SUPEREXEC" />
+ <many-to-one name="subProcessInstance"
+ column="SUBPROCINST_"
+ class="ExecutionImpl"
+ foreign-key="FK_EXEC_SUBPI"
+ index="IDX_EXEC_SUBPI" />
+
</class>
<!-- ### COMMENTS ####################################################### -->
Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.jpdl.activities.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.jpdl.activities.xml 2009-04-20 12:49:13 UTC (rev 4581)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.jpdl.activities.xml 2009-04-20 13:09:19 UTC (rev 4582)
@@ -13,4 +13,5 @@
<activity binding="org.jbpm.jpdl.internal.activity.ScriptBinding" />
<activity binding="org.jbpm.jpdl.internal.activity.EsbBinding" />
<activity binding="org.jbpm.jpdl.internal.activity.TaskBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.SubProcessBinding" />
</activities>
Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.wire.bindings.xml 2009-04-20 12:49:13 UTC (rev 4581)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.wire.bindings.xml 2009-04-20 13:09:19 UTC (rev 4582)
@@ -52,6 +52,8 @@
<binding class="org.jbpm.pvm.internal.wire.binding.JbossIdmIdentitySessionFactoryBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.JbossIdmIdentitySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.RepositorySessionBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.MailSessionBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.MailTemplateBinding" />
<!-- db sessions -->
<binding class="org.jbpm.pvm.internal.wire.binding.PvmDbSessionBinding" />
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java 2009-04-20 12:49:13 UTC (rev 4581)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java 2009-04-20 13:09:19 UTC (rev 4582)
@@ -23,6 +23,8 @@
import java.io.Serializable;
+import org.jbpm.api.env.Environment;
+import org.jbpm.pvm.internal.script.ScriptManager;
import org.jbpm.pvm.internal.wire.Descriptor;
import org.jbpm.pvm.internal.wire.WireContext;
@@ -43,6 +45,7 @@
protected String typeName;
protected String initExpression;
+ protected String initLanguage;
protected Descriptor initDescriptor;
public Object getInitValue(ExecutionImpl execution) {
@@ -50,7 +53,8 @@
return WireContext.create(initDescriptor);
}
if (initExpression!=null) {
- throw new UnsupportedOperationException("TODO add variable in expression resolution");
+ ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
+ return scriptManager.evaluateExpression(initExpression, execution, initLanguage);
}
return null;
}
@@ -79,4 +83,10 @@
public void setTypeName(String typeName) {
this.typeName = typeName;
}
+ public String getInitLanguage() {
+ return initLanguage;
+ }
+ public void setInitLanguage(String initLanguage) {
+ this.initLanguage = initLanguage;
+ }
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionSet.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionSet.java 2009-04-20 12:49:13 UTC (rev 4581)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionSet.java 2009-04-20 13:09:19 UTC (rev 4582)
@@ -47,17 +47,10 @@
ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
// TODO update evaluateExpression so that scopeInstance can be passed in directly
- ExecutionImpl innerExecution = null;
- if (innerScopeInstance instanceof ExecutionImpl) {
- innerExecution = (ExecutionImpl) innerScopeInstance;
- } else {
- throw new UnsupportedOperationException("implement me");
- }
-
String expression = variableOutDefinition.getExpression();
String language = variableOutDefinition.getLanguage();
- Object value = scriptManager.evaluateExpression(expression, innerExecution, language);
+ Object value = scriptManager.evaluateExpression(expression, (ExecutionImpl)innerScopeInstance, language);
outerExecution.setVariable(variableName, value);
}
}
@@ -65,9 +58,9 @@
}
public boolean hasVariableOutDefinitions() {
- return ( (variableOutDefinitions==null)
- || (variableOutDefinitions.isEmpty())
- );
+ return ( (variableOutDefinitions!=null)
+ && (!variableOutDefinitions.isEmpty())
+ );
}
public List<VariableOutDefinitionImpl> getVariableOutDefinitions() {
Modified: jbpm4/trunk/modules/pvm/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/jbpm.execution.hbm.xml 2009-04-20 12:49:13 UTC (rev 4581)
+++ jbpm4/trunk/modules/pvm/src/test/resources/jbpm.execution.hbm.xml 2009-04-20 13:09:19 UTC (rev 4582)
@@ -94,6 +94,12 @@
foreign-key="FK_EXEC_SUPEREXEC"
index="IDX_EXEC_SUPEREXEC" />
+ <many-to-one name="subProcessInstance"
+ column="SUBPROCINST_"
+ class="ExecutionImpl"
+ foreign-key="FK_EXEC_SUBPI"
+ index="IDX_EXEC_SUBPI" />
+
</class>
<!-- ### COMMENTS ####################################################### -->
Modified: jbpm4/trunk/modules/pvm/src/test/resources/jbpm.jpdl.activities.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/jbpm.jpdl.activities.xml 2009-04-20 12:49:13 UTC (rev 4581)
+++ jbpm4/trunk/modules/pvm/src/test/resources/jbpm.jpdl.activities.xml 2009-04-20 13:09:19 UTC (rev 4582)
@@ -13,4 +13,5 @@
<activity binding="org.jbpm.jpdl.internal.activity.ScriptBinding" />
<activity binding="org.jbpm.jpdl.internal.activity.EsbBinding" />
<activity binding="org.jbpm.jpdl.internal.activity.TaskBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.SubProcessBinding" />
</activities>
Modified: jbpm4/trunk/modules/pvm/src/test/resources/jbpm.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/jbpm.wire.bindings.xml 2009-04-20 12:49:13 UTC (rev 4581)
+++ jbpm4/trunk/modules/pvm/src/test/resources/jbpm.wire.bindings.xml 2009-04-20 13:09:19 UTC (rev 4582)
@@ -39,7 +39,6 @@
<binding class="org.jbpm.pvm.internal.wire.binding.BusinessCalendarBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.IdGeneratorBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.AuthenticationBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.MailTemplateBinding" />
<!-- hibernate bindings -->
<binding class="org.jbpm.pvm.internal.wire.binding.HibernateConfigurationBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.SeamHibernateSessionBinding" />
@@ -54,6 +53,7 @@
<binding class="org.jbpm.pvm.internal.wire.binding.JbossIdmIdentitySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.RepositorySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.MailSessionBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.MailTemplateBinding" />
<!-- db sessions -->
<binding class="org.jbpm.pvm.internal.wire.binding.PvmDbSessionBinding" />
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-04-20 12:49:13 UTC (rev 4581)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.execution.hbm.xml 2009-04-20 13:09:19 UTC (rev 4582)
@@ -94,6 +94,12 @@
foreign-key="FK_EXEC_SUPEREXEC"
index="IDX_EXEC_SUPEREXEC" />
+ <many-to-one name="subProcessInstance"
+ column="SUBPROCINST_"
+ class="ExecutionImpl"
+ foreign-key="FK_EXEC_SUBPI"
+ index="IDX_EXEC_SUBPI" />
+
</class>
<!-- ### COMMENTS ####################################################### -->
Modified: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.jpdl.activities.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.jpdl.activities.xml 2009-04-20 12:49:13 UTC (rev 4581)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.jpdl.activities.xml 2009-04-20 13:09:19 UTC (rev 4582)
@@ -13,4 +13,5 @@
<activity binding="org.jbpm.jpdl.internal.activity.ScriptBinding" />
<activity binding="org.jbpm.jpdl.internal.activity.EsbBinding" />
<activity binding="org.jbpm.jpdl.internal.activity.TaskBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.SubProcessBinding" />
</activities>
Modified: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.wire.bindings.xml 2009-04-20 12:49:13 UTC (rev 4581)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.wire.bindings.xml 2009-04-20 13:09:19 UTC (rev 4582)
@@ -52,6 +52,8 @@
<binding class="org.jbpm.pvm.internal.wire.binding.JbossIdmIdentitySessionFactoryBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.JbossIdmIdentitySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.RepositorySessionBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.MailSessionBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.MailTemplateBinding" />
<!-- db sessions -->
<binding class="org.jbpm.pvm.internal.wire.binding.PvmDbSessionBinding" />
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/images/process.state.choice.png
===================================================================
(Binary files differ)
Added: jbpm4/trunk/modules/userguide/src/main/docbook/en/images/process.subprocess.review.png
===================================================================
(Binary files differ)
Property changes on: jbpm4/trunk/modules/userguide/src/main/docbook/en/images/process.subprocess.review.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml 2009-04-20 12:49:13 UTC (rev 4581)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml 2009-04-20 13:09:19 UTC (rev 4582)
@@ -1125,6 +1125,249 @@
taskService.setVariables(taskDbid, variables);</programlisting>
</section>
</section>
+
+ <!-- ### SUB-PROCESS ################################################## -->
+
+ <section id="subprocess">
+ <title><literal>sub-process</literal></title>
+
+ <para>Creates a sub process instance and waits till it is completed. When
+ the sub process instance completes, then the execution in the sub-process
+ will continue.
+ </para>
+
+ <table><title><literal>sub-process</literal> attributes:</title>
+ <tgroup cols="5" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Attribute</entry>
+ <entry>Type</entry>
+ <entry>Default</entry>
+ <entry>Required?</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>sub-process-id</literal></entry>
+ <entry>string</entry>
+ <entry></entry>
+ <entry>either this or sub-process-key is required</entry>
+ <entry>Identifies the sub process by the id. This means that a specific
+ version of a process definition is referenced.</entry>
+ </row>
+ <row>
+ <entry><literal>sub-process-key</literal></entry>
+ <entry>string</entry>
+ <entry></entry>
+ <entry>either this or sub-process-key is required</entry>
+ <entry>Identifies the sub process by the key. This means that the latest
+ version of the process definition with the given key is referenced. The latest version
+ of the process is looked up each time the activity executes.
+ </entry>
+ </row>
+ <row>
+ <entry><literal>outcome</literal></entry>
+ <entry>expression</entry>
+ <entry></entry>
+ <entry>required when transitions have <literal>outcome-value</literal>'s specified</entry>
+ <entry>Expression that is evaluated when the sub process
+ instance ends. The value is then used for outcome transition mapping.
+ Add <literal>outcome-value</literal> elements to the outgoing transitions
+ of this <literal>sub-process</literal> activity.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <table><title><literal>process</literal> elements:</title>
+ <tgroup cols="3" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Element</entry>
+ <entry>Multiplicity</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>variable</literal></entry>
+ <entry>0..*</entry>
+ <entry>Declares a variable that is passed to the sub process instance
+ when it is created.
+ </entry>
+ </row>
+ <row>
+ <entry><literal>swimlane-mapping</literal></entry>
+ <entry>0..*</entry>
+ <entry>Declares a swimlane that will be propagated to the sub process
+ instance when the sub process is created.
+ </entry>
+ </row>
+ <row>
+ <entry><literal>out-variable</literal></entry>
+ <entry>0..*</entry>
+ <entry>Declares a variable that will be set in the parent execution
+ when the sub process ends.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <table><title>Extra <literal>transition</literal> elements in case of outcome variable mappings:</title>
+ <tgroup cols="3" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Element</entry>
+ <entry>Multiplicity</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>outcome-value</literal></entry>
+ <entry>0..1</entry>
+ <entry>If the <literal>outcome</literal> matches the value, this
+ transition is taken after the sub-process ended. The value is specified with one child
+ element.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <table><title>Extra <literal>transition</literal> elements in case of activity mappings:</title>
+ <tgroup cols="3" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Element</entry>
+ <entry>Multiplicity</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>outcome</literal></entry>
+ <entry>0..1</entry>
+ <entry>Specifies
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <table><title><literal>outcome</literal> attributes:</title>
+ <tgroup cols="5" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Attribute</entry>
+ <entry>Type</entry>
+ <entry>Default</entry>
+ <entry>Required?</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>activity</literal></entry>
+ <entry>string</entry>
+ <entry></entry>
+ <entry><emphasis role="bold">required</emphasis></entry>
+ <entry>Refers to an <literal>end</literal> activity name of the
+ sub-process. This transition is taken when the sub process ends in
+ that specific <literal>end</literal> activity.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <!-- ~~~ SUB PROCESS VARIABLES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+ <section id="subprocessvariables">
+ <title><literal>sub-process</literal> variables</title>
+ <para>The SubProcessVariables example scenario will show the basic workings of the
+ sub-process activity, how to feed information in the sub process when it starts
+ and how to extract information out of the subprocess when it ends.
+ </para>
+ <para>The parent process involves a document that needs to be reviewed.</para>
+ <figure id="process.subprocess.document">
+ <title>The subprocess document example process</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.subprocess.document.png"/></imageobject></mediaobject>
+ </figure>
+ <programlisting><process name="SubProcessDocument" xmlns="http://jbpm.org/4/jpdl">
+
+ <start>
+ <transition to="review" />
+ </start>
+
+ <emphasis role="bold"><sub-process name="review"
+ sub-process-key="SubProcessReview">
+
+ <variable name="document" init="#{document}" />
+ <out-variable name="reviewResult" init="#{result}" />
+
+ <transition to="wait" />
+ </sub-process></emphasis>
+
+ <state name="wait"/>
+
+</process></programlisting>
+ <para>The review process is a reusable process for all kinds of reviews.</para>
+ <figure id="process.subprocess.review">
+ <title>The subprocess review example process</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.subprocess.review.png"/></imageobject></mediaobject>
+ </figure>
+ <programlisting><process name="SubProcessReview" xmlns="http://jbpm.org/4/jpdl">
+
+ <start>
+ <transition to="get approval"/>
+ </start>
+
+ <task name="get approval"
+ assignee="johndoe">
+
+ <transition to="end"/>
+ </task>
+
+ <end name="end" />
+
+</process></programlisting>
+ <para>The document process is started with a document variable:</para>
+ <programlisting>Map<String, Object> variables = new HashMap<String, Object>();
+variables.put("document", "This document describes how we can make more money...");
+
+ProcessInstance processInstance = executionService
+ .startProcessInstanceByKey("SubProcessDocument", variables);</programlisting>
+ <para>Then the parent process execution will arrive in the sub process
+ activity. A sub process instance is created and linked with the super
+ process execution. When the <literal>SubProcessReview</literal> process
+ instance starts, it arrives in the <literal>task</literal>. A task will be
+ created for <literal>johndoe</literal>.
+ </para>
+ <programlisting>List<Task> taskList = taskService.findAssignedTasks("johndoe");
+Task task = taskList.get(0);</programlisting>
+ <para>We can see that the document has been passed from the super process
+ instance to the sub process instance:
+ </para>
+ <programlisting>String document = (String) taskService.getVariable(task.getDbid(), "document");
+assertEquals("This document describes how we can make more money...", document);</programlisting>
+ <para>Then we set a variable on the task. This is typically done through a form. But
+ here we'll show how it is done programmatically.
+ </para>
+ <programlisting>taskService.setVariable(task.getDbid(), "result", "accept");</programlisting>
+ <para>Completing this task, will cause the sub process instance to end.
+ </para>
+ <programlisting>taskService.completeTask(task.getDbid());</programlisting>
+ <para>When the sub process ends, the super process execution will get signalled(=notified).
+ First the <literal>result</literal> variable from the sub process instance
+ will be copied into the <literal>reviewResult</literal> variable in the
+ super process execution. Then the super process execution will continue
+ and leave the <link>review</link> activity.
+ </para>
+ </section>
+ </section>
</section>
<!-- ##################################################################### -->
17 years
JBoss JBPM SVN: r4581 - in projects/gwt-console/branches/hbraun: plugin-api/src/main/java/org/jboss/bpm/console/client/v2 and 4 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-20 08:49:13 -0400 (Mon, 20 Apr 2009)
New Revision: 4581
Added:
projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/v2/
projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/v2/LazyPanel.java
Modified:
projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/ApplicationContext.java
projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/Editor.java
projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/Workspace.java
projects/gwt-console/branches/hbraun/plugin-example/src/main/java/org/jboss/bpm/console/client/mapsplugin/MapsEditor.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/MainView.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/LoginView.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/MainLayout.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/DefinitionListView.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditor.java
Log:
Added LazyPanel. Fix ProcessEditor rendering bug
Modified: projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/ApplicationContext.java
===================================================================
--- projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/ApplicationContext.java 2009-04-19 18:34:59 UTC (rev 4580)
+++ projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/ApplicationContext.java 2009-04-20 12:49:13 UTC (rev 4581)
@@ -22,6 +22,7 @@
package org.jboss.bpm.console.client;
import com.mvc4g.client.Controller;
+import org.gwt.mosaic.ui.client.Viewport;
/**
* Provides context information to console components and plugins.
@@ -42,4 +43,6 @@
Controller getController();
+ Viewport getViewport();
+
}
Modified: projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/Editor.java
===================================================================
--- projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/Editor.java 2009-04-19 18:34:59 UTC (rev 4580)
+++ projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/Editor.java 2009-04-20 12:49:13 UTC (rev 4581)
@@ -22,8 +22,10 @@
package org.jboss.bpm.console.client;
import com.mvc4g.client.Controller;
+import com.google.gwt.user.client.Window;
import org.gwt.mosaic.ui.client.layout.LayoutPanel;
import org.gwt.mosaic.ui.client.layout.BorderLayout;
+import org.jboss.bpm.console.client.v2.LazyPanel;
/**
@@ -37,15 +39,17 @@
*
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
-public abstract class Editor extends LayoutPanel
+public abstract class Editor extends LayoutPanel implements LazyPanel
{
protected ApplicationContext appContext;
protected Controller controller;
+ protected boolean isInitialized;
+
public Editor(ApplicationContext appContext)
{
- super( new BorderLayout() );
+ super(new BorderLayout());
this.appContext = appContext;
// hmvc controller chain.
@@ -53,6 +57,13 @@
this.controller.setParent(appContext.getController());
}
+ public boolean isInitialized()
+ {
+ return this.isInitialized;
+ }
+
+ public abstract void initialize();
+
public abstract String getEditorId();
public abstract String getTitle();
@@ -70,7 +81,7 @@
@Deprecated
public void showView(String viewId)
{
- appContext.getWorkpace().showEditor(viewId);
+ throw new RuntimeException("Not implemented");
}
@Deprecated
@@ -89,4 +100,15 @@
System.out.println("*** addView should be re-implemented ***");
}
+
+ /**
+ * hack in order to correctly display widgets that have
+ * been rendered hidden
+ */
+ protected void refreshView()
+ {
+ final int width = Window.getClientWidth();
+ final int height = Window.getClientHeight();
+ appContext.getViewport().onWindowResized(width, height);
+ }
}
Modified: projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/Workspace.java
===================================================================
--- projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/Workspace.java 2009-04-19 18:34:59 UTC (rev 4580)
+++ projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/Workspace.java 2009-04-20 12:49:13 UTC (rev 4581)
@@ -23,8 +23,6 @@
import org.gwt.mosaic.ui.client.DeckLayoutPanel;
import org.gwt.mosaic.ui.client.layout.LayoutPanel;
-import com.mvc4g.client.ActionInterface;
-import com.mvc4g.client.Controller;
/**
* Maintains {@link Editor}'s
@@ -66,6 +64,8 @@
if(null==deck)
throw new IllegalArgumentException("No such editor: " +id);
this.showWidget(deck.index);
+
+ deck.editor.initialize();
}
private EditorDeck createDeck(Editor editor)
Added: projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/v2/LazyPanel.java
===================================================================
--- projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/v2/LazyPanel.java (rev 0)
+++ projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/v2/LazyPanel.java 2009-04-20 12:49:13 UTC (rev 4581)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.v2;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface LazyPanel
+{
+ boolean isInitialized();
+
+ void initialize();
+}
Modified: projects/gwt-console/branches/hbraun/plugin-example/src/main/java/org/jboss/bpm/console/client/mapsplugin/MapsEditor.java
===================================================================
--- projects/gwt-console/branches/hbraun/plugin-example/src/main/java/org/jboss/bpm/console/client/mapsplugin/MapsEditor.java 2009-04-19 18:34:59 UTC (rev 4580)
+++ projects/gwt-console/branches/hbraun/plugin-example/src/main/java/org/jboss/bpm/console/client/mapsplugin/MapsEditor.java 2009-04-20 12:49:13 UTC (rev 4581)
@@ -68,6 +68,12 @@
addView(defaultView, false);
}
+
+ public void initialize()
+ {
+ isInitialized = true;
+ }
+
public String getEditorId()
{
return ID;
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/MainView.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/MainView.java 2009-04-19 18:34:59 UTC (rev 4580)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/MainView.java 2009-04-20 12:49:13 UTC (rev 4581)
@@ -67,6 +67,11 @@
}
+ public Viewport getViewport()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
public Controller getController()
{
throw new RuntimeException("NYI");
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/LoginView.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/LoginView.java 2009-04-19 18:34:59 UTC (rev 4580)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/LoginView.java 2009-04-20 12:49:13 UTC (rev 4581)
@@ -90,6 +90,11 @@
public void display()
{
createLayoutWindowPanel();
+
+ // remove later on
+ usernameInput.setText("alex");
+ passwordInput.setText("password");
+
window.center();
}
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/MainLayout.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/MainLayout.java 2009-04-19 18:34:59 UTC (rev 4580)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/MainLayout.java 2009-04-20 12:49:13 UTC (rev 4581)
@@ -23,18 +23,16 @@
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;
import com.mvc4g.client.Controller;
+import org.gwt.mosaic.ui.client.InfoPanel;
import org.gwt.mosaic.ui.client.MessageBox;
import org.gwt.mosaic.ui.client.Viewport;
-import org.gwt.mosaic.ui.client.InfoPanel;
import org.gwt.mosaic.ui.client.layout.BorderLayout;
import static org.gwt.mosaic.ui.client.layout.BorderLayout.Region;
import org.gwt.mosaic.ui.client.layout.BorderLayoutData;
import org.gwt.mosaic.ui.client.layout.LayoutPanel;
import org.jboss.bpm.console.client.*;
-import org.jboss.bpm.console.client.v2.process.ProcessEditor;
/**
* The main composite that assembles the gwt console application.
@@ -45,19 +43,18 @@
{
public final static String NAME = "mainLayout";
-
- private HTML status = new HTML();
+
private Header header;
private Menu menu;
+
private Workspace workspace;
-
private URLBuilder urlBuilder;
private Authentication auth;
-
private ConsoleConfig config;
private Controller controller;
-
+ private Viewport viewport;
+
public MainLayout(Controller controller, Authentication auth, URLBuilder urlBuilder, ConsoleConfig config)
{
this.controller = controller;
@@ -70,7 +67,7 @@
public void display()
{
- Viewport viewport = new Viewport();
+ viewport = new Viewport();
LayoutPanel layout = createLayout();
viewport.add(layout);
@@ -108,6 +105,11 @@
// ---- ApplicationContext interface ----
+ public Viewport getViewport()
+ {
+ return viewport;
+ }
+
public Controller getController()
{
return this.controller;
@@ -120,8 +122,6 @@
public void displayMessage(final String message, final boolean isError)
{
- status.setText(message);
-
if(isError)
MessageBox.error("Error", message);
else
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/DefinitionListView.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/DefinitionListView.java 2009-04-19 18:34:59 UTC (rev 4580)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/DefinitionListView.java 2009-04-20 12:49:13 UTC (rev 4581)
@@ -35,13 +35,15 @@
import org.gwt.mosaic.ui.client.layout.LayoutPanel;
import org.gwt.mosaic.ui.client.list.DefaultListModel;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+import org.jboss.bpm.console.client.v2.LazyPanel;
import java.util.List;
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
-public class DefinitionListView extends LayoutPanel implements ViewInterface
+public class DefinitionListView extends LayoutPanel
+ implements ViewInterface, LazyPanel
{
public final static String ID = DefinitionListView.class.getName();
@@ -51,95 +53,115 @@
private ListBox<ProcessDefinitionRef> listBox;
+ private boolean isInitialized;
+
public DefinitionListView()
{
super();
setTitle("Process Definitions");
+ }
- definitionList = new LayoutPanel( new BoxLayout(BoxLayout.Orientation.VERTICAL));
- definitionList.setPadding(0);
- definitionList.setWidgetSpacing(0);
+ public boolean isInitialized()
+ {
+ return isInitialized;
+ }
- listBox =
- new ListBox<ProcessDefinitionRef>(
- new String[] {
- "Process ID", "Name", "Key", "Version"}
- );
+ public void initialize()
+ {
+ if(!isInitialized)
+ {
+ System.out.println("init DefinitionListView");
+
+ definitionList = new LayoutPanel( new BoxLayout(BoxLayout.Orientation.VERTICAL));
+ definitionList.setPadding(0);
+ definitionList.setWidgetSpacing(0);
- listBox.setCellRenderer(new ListBox.CellRenderer<ProcessDefinitionRef>() {
- public void renderCell(ListBox<ProcessDefinitionRef> listBox, int row, int column,
- ProcessDefinitionRef item) {
- switch (column) {
- case 0:
- listBox.setText(row, column, item.getId());
- break;
- case 1:
- listBox.setText(row, column, item.getName());
- break;
- case 2:
- listBox.setText(row, column, item.getKey());
- break;
- case 3:
- listBox.setText(row, column, String.valueOf(item.getVersion()));
- break;
- default:
- throw new RuntimeException("Unexpected column size");
- }
- }
- });
+ listBox =
+ new ListBox<ProcessDefinitionRef>(
+ new String[] {
+ "Process ID", "Name", "Key", "Version"}
+ );
- final DefaultListModel<ProcessDefinitionRef> model =
- (DefaultListModel<ProcessDefinitionRef>) listBox.getModel();
- // toolbar
-
- final LayoutPanel toolBox = new LayoutPanel();
- toolBox.setPadding(0);
- toolBox.setWidgetSpacing(5);
- //toolBox.setLayout(new BoxLayout(BoxLayout.Orientation.VERTICAL));
-
- final ToolBar toolBar = new ToolBar();
- toolBar.add(
- new ToolButton("Refresh", new ClickListener() {
- public void onClick(Widget sender) {
- // force loading
- controller.handleEvent(
- new Event(LoadDefinitionsAction.ID, null)
- );
+ listBox.setCellRenderer(new ListBox.CellRenderer<ProcessDefinitionRef>() {
+ public void renderCell(ListBox<ProcessDefinitionRef> listBox, int row, int column,
+ ProcessDefinitionRef item) {
+ switch (column) {
+ case 0:
+ listBox.setText(row, column, item.getId());
+ break;
+ case 1:
+ listBox.setText(row, column, item.getName());
+ break;
+ case 2:
+ listBox.setText(row, column, item.getKey());
+ break;
+ case 3:
+ listBox.setText(row, column, String.valueOf(item.getVersion()));
+ break;
+ default:
+ throw new RuntimeException("Unexpected column size");
}
}
- )
- );
+ });
- toolBar.addSeparator();
+ final DefaultListModel<ProcessDefinitionRef> model =
+ (DefaultListModel<ProcessDefinitionRef>) listBox.getModel();
- toolBar.add(
- new ToolButton("View Instances", new ClickListener() {
- public void onClick(Widget sender) {
- int index = listBox.getSelectedIndex();
- if(index==-1)
- MessageBox.alert("Missing selection", "Please select a process");
- else
+ // toolbar
+
+ final LayoutPanel toolBox = new LayoutPanel();
+ toolBox.setPadding(0);
+ toolBox.setWidgetSpacing(5);
+ //toolBox.setLayout(new BoxLayout(BoxLayout.Orientation.VERTICAL));
+
+ final ToolBar toolBar = new ToolBar();
+ toolBar.add(
+ new ToolButton("Refresh", new ClickListener() {
+ public void onClick(Widget sender) {
+ // force loading
controller.handleEvent(
- new Event(
- LoadInstancesAction.ID,
- listBox.getItem( listBox.getSelectedIndex())
- )
+ new Event(LoadDefinitionsAction.ID, null)
);
+ }
}
- }
- )
- );
+ )
+ );
- toolBox.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
+ toolBar.addSeparator();
- this.definitionList.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
- this.definitionList.add(listBox, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
+ toolBar.add(
+ new ToolButton("View Instances", new ClickListener() {
+ public void onClick(Widget sender) {
+ int index = listBox.getSelectedIndex();
+ if(index==-1)
+ MessageBox.alert("Missing selection", "Please select a process");
+ else
+ controller.handleEvent(
+ new Event(
+ LoadInstancesAction.ID,
+ listBox.getItem( listBox.getSelectedIndex())
+ )
+ );
+ }
+ }
+ )
+ );
- this.add(definitionList);
+
+ toolBox.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
+
+ this.definitionList.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
+ this.definitionList.add(listBox, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
+
+ this.add(definitionList);
+
+ isInitialized = true;
+ }
}
+
public void setController(Controller controller)
{
this.controller = controller;
@@ -147,17 +169,17 @@
public void update(List<ProcessDefinitionRef> definitions)
{
+ // lazy init
+ initialize();
+
final DefaultListModel<ProcessDefinitionRef> model =
(DefaultListModel<ProcessDefinitionRef>) listBox.getModel();
model.clear();
-
+
for(ProcessDefinitionRef def : definitions)
{
model.add(def);
}
-
- // layout again
- this.invalidate();
}
}
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditor.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditor.java 2009-04-19 18:34:59 UTC (rev 4580)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditor.java 2009-04-20 12:49:13 UTC (rev 4581)
@@ -22,6 +22,9 @@
package org.jboss.bpm.console.client.v2.process;
import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.ui.TabListener;
+import com.google.gwt.user.client.ui.SourcesTabEvents;
+import com.google.gwt.user.client.Window;
import com.mvc4g.client.ActionInterface;
import com.mvc4g.client.Event;
import com.mvc4g.client.ViewInterface;
@@ -29,6 +32,7 @@
import org.gwt.mosaic.ui.client.TabLayoutPanel;
import static org.gwt.mosaic.ui.client.layout.BorderLayout.Region;
import org.gwt.mosaic.ui.client.layout.BorderLayoutData;
+import org.gwt.mosaic.ui.client.layout.LayoutPanel;
import org.jboss.bpm.console.client.ApplicationContext;
import org.jboss.bpm.console.client.Editor;
import org.jboss.bpm.console.client.MenuSection;
@@ -44,28 +48,38 @@
public ProcessEditor(ApplicationContext appContext)
{
- super(appContext);
+ super(appContext);
+ }
- // create inner tab layout
- this.tabPanel = new DecoratedTabLayoutPanel();
- tabPanel.setPadding(5);
- this.add(tabPanel, new BorderLayoutData(Region.CENTER, false));
+ public void initialize()
+ {
+ if(!isInitialized)
+ {
+ // create inner tab layout
+ tabPanel = new DecoratedTabLayoutPanel();
+ tabPanel.setPadding(5);
+ this.add(tabPanel, new BorderLayoutData(Region.CENTER));
- // create and register views
- addView(DefinitionListView.ID, new DefinitionListView());
- addView(InstanceListView.ID, new InstanceListView());
-
- // create and register actions
- addAction(LoadDefinitionsAction.ID, new LoadDefinitionsAction(appContext));
- addAction(LoadInstancesAction.ID, new LoadInstancesAction(appContext));
+ // create and register views
+ addView(DefinitionListView.ID, new DefinitionListView());
+ addView(InstanceListView.ID, new InstanceListView());
- // force loading
- super.controller.handleEvent(
- new Event(LoadDefinitionsAction.ID, null)
- );
+ // create and register actions
+ addAction(LoadDefinitionsAction.ID, new LoadDefinitionsAction(appContext));
+ addAction(LoadInstancesAction.ID, new LoadInstancesAction(appContext));
- tabPanel.selectTab(0);
-
+ // display tab, needs to visible for correct rendering
+ tabPanel.selectTab(0);
+
+ // force loading
+ super.controller.handleEvent(
+ new Event(LoadDefinitionsAction.ID, null)
+ );
+
+ refreshView();
+
+ isInitialized = true;
+ }
}
private void addView(String id, Widget view)
@@ -79,7 +93,7 @@
private void addAction(String name, ActionInterface action)
{
- super.controller.addAction(name, action);
+ super.controller.addAction(name, action);
}
public String getEditorId()
17 years
JBoss JBPM SVN: r4580 - in jbpm4/trunk/modules: jpdl/src/main/java/org/jbpm/jpdl/internal/xml and 1 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-04-19 14:34:59 -0400 (Sun, 19 Apr 2009)
New Revision: 4580
Modified:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionSet.java
Log:
JBPM-2025 sub process activity signal implementation
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java 2009-04-18 19:47:17 UTC (rev 4579)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java 2009-04-19 18:34:59 UTC (rev 4580)
@@ -29,8 +29,10 @@
import org.jbpm.api.env.Environment;
import org.jbpm.api.session.RepositorySession;
import org.jbpm.jpdl.internal.model.JpdlExecution;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.model.VariableDefinitionImpl;
-import org.jbpm.pvm.internal.model.VariableOutDefinitionImpl;
+import org.jbpm.pvm.internal.model.VariableOutDefinitionSet;
+import org.jbpm.pvm.internal.script.ScriptManager;
import org.jbpm.pvm.internal.task.SwimlaneImpl;
@@ -46,7 +48,7 @@
protected Map<String, String> swimlaneMappings;
protected List<VariableDefinitionImpl> variableDefinitions;
- protected List<VariableOutDefinitionImpl> variableOutDefinitions;
+ protected VariableOutDefinitionSet variableOutDefinitionSet;
protected Map<String, String> outcomeActivityMappings;
protected String outcomeExpression;
protected Map<Object, String> outcomeVariableMappings;
@@ -88,7 +90,28 @@
}
public void signal(ActivityExecution execution, String signalName, Map<String, Object> parameters) {
- // see VariableOutDefinitionSet: that is currently not yet used
+ JpdlExecution jpdlExecution = execution.getExtension(JpdlExecution.class);
+
+ ExecutionImpl subProcessInstance = jpdlExecution.getSubProcessInstance();
+ variableOutDefinitionSet.processOutVariables(jpdlExecution, subProcessInstance);
+
+ String transitionName = null;
+
+ if (outcomeExpression!=null) {
+ ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
+ Object value = scriptManager.evaluateExpression(outcomeExpression, subProcessInstance, null);
+ transitionName = outcomeActivityMappings.get(value);
+
+ } else if (!outcomeActivityMappings.isEmpty()) {
+ String subProcessActivityName = subProcessInstance.getActivityName();
+ transitionName = outcomeActivityMappings.get(subProcessActivityName);
+ }
+
+ if (transitionName!=null) {
+ execution.take(transitionName);
+ } else {
+ execution.takeDefaultTransition();
+ }
}
public void setSwimlaneMappings(Map<String, String> swimlaneMappings) {
@@ -109,8 +132,8 @@
public void setVariableDefinitions(List<VariableDefinitionImpl> variableDefinitions) {
this.variableDefinitions = variableDefinitions;
}
- public void setVariableOutDefinitions(List<VariableOutDefinitionImpl> variableOutDefinitions) {
- this.variableOutDefinitions = variableOutDefinitions;
+ public void setVariableOutDefinitionSet(VariableOutDefinitionSet variableOutDefinitionSet) {
+ this.variableOutDefinitionSet = variableOutDefinitionSet;
}
public void setOutcomeExpression(String outcomeExpression) {
this.outcomeExpression = outcomeExpression;
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java 2009-04-18 19:47:17 UTC (rev 4579)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java 2009-04-19 18:34:59 UTC (rev 4580)
@@ -28,6 +28,7 @@
import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.pvm.internal.model.VariableDefinitionImpl;
import org.jbpm.pvm.internal.model.VariableOutDefinitionImpl;
+import org.jbpm.pvm.internal.model.VariableOutDefinitionSet;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.Descriptor;
import org.jbpm.pvm.internal.wire.WireContext;
@@ -58,8 +59,8 @@
List<VariableDefinitionImpl> variableDefinitions = JpdlParser.parseVariableDefinitions(element, parse, true);
subProcessActivity.setVariableDefinitions(variableDefinitions);
- List<VariableOutDefinitionImpl> variableOutDefinitions = JpdlParser.parseVariableOutDefinitions(element, parse);
- subProcessActivity.setVariableOutDefinitions(variableOutDefinitions);
+ VariableOutDefinitionSet variableOutDefinitionSet = JpdlParser.parseVariableOutDefinitionSet(element, parse);
+ subProcessActivity.setVariableOutDefinitionSet(variableOutDefinitionSet);
Map<String, String> swimlaneMappings = parseSwimlaneMappings(element, parse);
subProcessActivity.setSwimlaneMappings(swimlaneMappings);
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-04-18 19:47:17 UTC (rev 4579)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-04-19 18:34:59 UTC (rev 4580)
@@ -46,6 +46,7 @@
import org.jbpm.pvm.internal.model.TimerDefinitionImpl;
import org.jbpm.pvm.internal.model.VariableDefinitionImpl;
import org.jbpm.pvm.internal.model.VariableOutDefinitionImpl;
+import org.jbpm.pvm.internal.model.VariableOutDefinitionSet;
import org.jbpm.pvm.internal.task.AssignableDefinitionImpl;
import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
@@ -473,11 +474,11 @@
return variableDefinitions;
}
- public static List<VariableOutDefinitionImpl> parseVariableOutDefinitions(Element element, Parse parse) {
- List<VariableOutDefinitionImpl> variableOutDefinitions = new ArrayList<VariableOutDefinitionImpl>();
+ public static VariableOutDefinitionSet parseVariableOutDefinitionSet(Element element, Parse parse) {
+ VariableOutDefinitionSet variableOutDefinitionSet = new VariableOutDefinitionSet();
for (Element inElement: XmlUtil.elements(element, "out-variable")) {
- VariableOutDefinitionImpl variableOutDefinition = new VariableOutDefinitionImpl();
+ VariableOutDefinitionImpl variableOutDefinition = variableOutDefinitionSet.createVariableOutDefinition();
String name = XmlUtil.attribute(inElement, "name", true, parse);
variableOutDefinition.setName(name);
@@ -488,7 +489,7 @@
}
}
- return variableOutDefinitions;
+ return variableOutDefinitionSet;
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionImpl.java 2009-04-18 19:47:17 UTC (rev 4579)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionImpl.java 2009-04-19 18:34:59 UTC (rev 4580)
@@ -23,10 +23,7 @@
import java.io.Serializable;
-import org.jbpm.api.env.Environment;
-import org.jbpm.pvm.internal.script.ScriptManager;
-
/**
* @author Tom Baeyens
*/
@@ -38,11 +35,6 @@
protected String expression;
protected String language;
- public Object getOutValue(ExecutionImpl execution) {
- ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
- return scriptManager.evaluateExpression(expression, execution, language);
- }
-
public String getName() {
return name;
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionSet.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionSet.java 2009-04-18 19:47:17 UTC (rev 4579)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionSet.java 2009-04-19 18:34:59 UTC (rev 4580)
@@ -26,6 +26,9 @@
import java.util.Collections;
import java.util.List;
+import org.jbpm.api.env.Environment;
+import org.jbpm.pvm.internal.script.ScriptManager;
+
/**
* @author Tom Baeyens
*/
@@ -35,13 +38,26 @@
protected List<VariableOutDefinitionImpl> variableOutDefinitions;
- protected void destroy(ExecutionImpl outerExecution) {
+ public void processOutVariables(ExecutionImpl outerExecution, ScopeInstanceImpl innerScopeInstance) {
// loop over all variable definitions
if (hasVariableOutDefinitions()) {
for (VariableOutDefinitionImpl variableOutDefinition: variableOutDefinitions) {
String variableName = variableOutDefinition.getName();
if (variableName!=null) {
- Object value = variableOutDefinition.getOutValue(outerExecution);
+ ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
+
+ // TODO update evaluateExpression so that scopeInstance can be passed in directly
+ ExecutionImpl innerExecution = null;
+ if (innerScopeInstance instanceof ExecutionImpl) {
+ innerExecution = (ExecutionImpl) innerScopeInstance;
+ } else {
+ throw new UnsupportedOperationException("implement me");
+ }
+
+ String expression = variableOutDefinition.getExpression();
+ String language = variableOutDefinition.getLanguage();
+
+ Object value = scriptManager.evaluateExpression(expression, innerExecution, language);
outerExecution.setVariable(variableName, value);
}
}
17 years
JBoss JBPM SVN: r4579 - in jbpm4/trunk/modules: api/src/main/java/org/jbpm/api/session and 9 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-04-18 15:47:17 -0400 (Sat, 18 Apr 2009)
New Revision: 4579
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/activity/ActivityBehaviour.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/session/RepositorySession.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.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/xml/JpdlParser.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/builder/VariableBuilder.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetActivityCoordinates.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceInLatestCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionSet.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/SwimlaneImpl.java
Log:
JBPM-2025 started parsing and implementation of sub-process
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/activity/ActivityBehaviour.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/activity/ActivityBehaviour.java 2009-04-18 17:43:48 UTC (rev 4578)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/activity/ActivityBehaviour.java 2009-04-18 19:47:17 UTC (rev 4579)
@@ -24,7 +24,7 @@
import java.io.Serializable;
/** piece of Java code that is to be included in a process as the runtime
- * activity behaviour or as a hidden listener to process events.
+ * activity behaviour.
*
* @author Tom Baeyens
*/
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/session/RepositorySession.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/session/RepositorySession.java 2009-04-18 17:43:48 UTC (rev 4578)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/session/RepositorySession.java 2009-04-18 19:47:17 UTC (rev 4579)
@@ -41,5 +41,7 @@
ProcessDefinitionQuery createProcessDefinitionQuery();
- ClientProcessDefinition loadProcessDefinitionById(String processDefinitionId);
+ ClientProcessDefinition findProcessDefinitionById(String processDefinitionId);
+
+ ClientProcessDefinition findProcessDefinitionByKey(String processDefinitionKey);
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java 2009-04-18 17:43:48 UTC (rev 4578)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java 2009-04-18 19:47:17 UTC (rev 4579)
@@ -25,7 +25,13 @@
import java.util.Map;
import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.client.ClientProcessDefinition;
+import org.jbpm.api.env.Environment;
+import org.jbpm.api.session.RepositorySession;
+import org.jbpm.jpdl.internal.model.JpdlExecution;
import org.jbpm.pvm.internal.model.VariableDefinitionImpl;
+import org.jbpm.pvm.internal.model.VariableOutDefinitionImpl;
+import org.jbpm.pvm.internal.task.SwimlaneImpl;
/**
@@ -35,31 +41,78 @@
private static final long serialVersionUID = 1L;
- protected Map<String, String> inSwimlaneMappings;
- protected List<VariableDefinitionImpl> inDefinitions;
- protected List<VariableDefinitionImpl> outDefinitions;
- protected Map<String, String> outcomeStateMappings;
- protected Map<String, String> outcomeVariableMappings;
+ protected String subProcessKey;
+ protected String subProcessId;
+ protected Map<String, String> swimlaneMappings;
+ protected List<VariableDefinitionImpl> variableDefinitions;
- public void execute(ActivityExecution execution) throws Exception {
+ protected List<VariableOutDefinitionImpl> variableOutDefinitions;
+ protected Map<String, String> outcomeActivityMappings;
+ protected String outcomeExpression;
+ protected Map<Object, String> outcomeVariableMappings;
+
+ public void execute(ActivityExecution execution) {
+ JpdlExecution jpdlExecution = execution.getExtension(JpdlExecution.class);
+
+ RepositorySession repositorySession = Environment.getFromCurrent(RepositorySession.class);
+
+ ClientProcessDefinition processDefinition = null;
+
+ if (subProcessId!=null) {
+ processDefinition = repositorySession.findProcessDefinitionById(subProcessId);
+ } else {
+ processDefinition = repositorySession.findProcessDefinitionByKey(subProcessKey);
+ }
+
+ JpdlExecution subProcessInstance = (JpdlExecution) processDefinition.createProcessInstance();
+
+ subProcessInstance.setSuperProcessExecution(jpdlExecution);
+ jpdlExecution.setSubProcessInstance(subProcessInstance);
+
+ for (String swimlaneName: swimlaneMappings.keySet()) {
+ String subSwimlaneName = swimlaneMappings.get(swimlaneName);
+ SwimlaneImpl subSwimlane = subProcessInstance.createSwimlane(subSwimlaneName);
+ SwimlaneImpl swimlane = jpdlExecution.getSwimlane(swimlaneName);
+ if (swimlane!=null) {
+ subSwimlane.initialize(swimlane);
+ }
+ }
+
+ for (VariableDefinitionImpl variableDefinition: variableDefinitions) {
+ String variableName = variableDefinition.getName();
+ Object value = variableDefinition.getInitValue(jpdlExecution);
+ subProcessInstance.setVariable(variableName, value);
+ }
+
+ subProcessInstance.start();
}
- public void signal(ActivityExecution execution, String signalName, Map<String, Object> parameters) throws Exception {
+ public void signal(ActivityExecution execution, String signalName, Map<String, Object> parameters) {
+ // see VariableOutDefinitionSet: that is currently not yet used
}
- public void setInSwimlaneMappings(Map<String, String> inSwimlaneMappings) {
- this.inSwimlaneMappings = inSwimlaneMappings;
+ public void setSwimlaneMappings(Map<String, String> swimlaneMappings) {
+ this.swimlaneMappings = swimlaneMappings;
}
- public void setInDefinitions(List<VariableDefinitionImpl> inDefinitions) {
- this.inDefinitions = inDefinitions;
+ public void setOutcomeActivityMappings(Map<String, String> outcomeActivityMappings) {
+ this.outcomeActivityMappings = outcomeActivityMappings;
}
- public void setOutDefinitions(List<VariableDefinitionImpl> outDefinitions) {
- this.outDefinitions = outDefinitions;
+ public void setOutcomeVariableMappings(Map<Object, String> outcomeVariableMappings) {
+ this.outcomeVariableMappings = outcomeVariableMappings;
}
- public void setOutcomeStateMappings(Map<String, String> outcomeStateMappings) {
- this.outcomeStateMappings = outcomeStateMappings;
+ public void setSubProcessKey(String subProcessKey) {
+ this.subProcessKey = subProcessKey;
}
- public void setOutcomeVariableMappings(Map<String, String> outcomeVariableMappings) {
- this.outcomeVariableMappings = outcomeVariableMappings;
+ public void setSubProcessId(String subProcessId) {
+ this.subProcessId = subProcessId;
}
+ public void setVariableDefinitions(List<VariableDefinitionImpl> variableDefinitions) {
+ this.variableDefinitions = variableDefinitions;
+ }
+ public void setVariableOutDefinitions(List<VariableOutDefinitionImpl> variableOutDefinitions) {
+ this.variableOutDefinitions = variableOutDefinitions;
+ }
+ public void setOutcomeExpression(String outcomeExpression) {
+ this.outcomeExpression = outcomeExpression;
+ }
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java 2009-04-18 17:43:48 UTC (rev 4578)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java 2009-04-18 19:47:17 UTC (rev 4579)
@@ -21,7 +21,17 @@
*/
package org.jbpm.jpdl.internal.activity;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.pvm.internal.model.VariableDefinitionImpl;
+import org.jbpm.pvm.internal.model.VariableOutDefinitionImpl;
import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.xml.WireParser;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
@@ -37,13 +47,77 @@
}
public Object parse(Element element, Parse parse, Parser parser) {
+ SubProcessActivity subProcessActivity = new SubProcessActivity();
String subProcessKey = XmlUtil.attribute(element, "process-key");
+ subProcessActivity.setSubProcessKey(subProcessKey);
+
String subProcessId = XmlUtil.attribute(element, "process-id");
+ subProcessActivity.setSubProcessId(subProcessId);
+ List<VariableDefinitionImpl> variableDefinitions = JpdlParser.parseVariableDefinitions(element, parse, true);
+ subProcessActivity.setVariableDefinitions(variableDefinitions);
+ List<VariableOutDefinitionImpl> variableOutDefinitions = JpdlParser.parseVariableOutDefinitions(element, parse);
+ subProcessActivity.setVariableOutDefinitions(variableOutDefinitions);
- return null;
+ Map<String, String> swimlaneMappings = parseSwimlaneMappings(element, parse);
+ subProcessActivity.setSwimlaneMappings(swimlaneMappings);
+
+ Map<String, String> outcomeActivityMappings = new HashMap<String, String>();
+ Map<Object, String> outcomeVariableMappings = new HashMap<Object, String>();
+
+ String outcomeExpression = XmlUtil.attribute(element, "outcome");
+ if (outcomeExpression!=null) {
+ for (Element transitionElement: XmlUtil.elements(element, "transition")) {
+ Element outcomeValueElement = XmlUtil.element(transitionElement, "outcome-value");
+ if (outcomeValueElement!=null) {
+ String transitionName = XmlUtil.attribute(transitionElement, "name");
+ if (transitionName==null) {
+ parse.addProblem("transitions with an outcome-value must have a name", transitionElement);
+ }
+ Element valueElement = XmlUtil.element(outcomeValueElement);
+ if (valueElement!=null) {
+ Descriptor descriptor = (Descriptor) WireParser.getInstance().parseElement(valueElement, parse);
+ Object value = WireContext.create(descriptor);
+ outcomeVariableMappings.put(value, transitionName);
+ } else {
+ parse.addProblem("outcome-value must contain exactly one element", outcomeValueElement);
+ }
+ }
+ }
+
+ } else { // no outcome expression
+
+ // search for end activity mappings
+ for (Element transitionElement: XmlUtil.elements(element, "transition")) {
+ Element outcomeElement = XmlUtil.element(transitionElement, "outcome");
+ if (outcomeElement!=null) {
+ String transitionName = XmlUtil.attribute(transitionElement, "name");
+ if (transitionName==null) {
+ parse.addProblem("transitions with an outcome must have a name", transitionElement);
+ }
+ String activity = XmlUtil.attribute(outcomeElement, "activity");
+ if (activity!=null) {
+ outcomeActivityMappings.put(activity, transitionName);
+ }
+ }
+ }
+ }
+
+ return subProcessActivity;
}
+ public static Map<String, String> parseSwimlaneMappings(Element element, Parse parse) {
+ Map<String, String> swimlaneMappings = new HashMap<String, String>();
+
+ for (Element inElement: XmlUtil.elements(element, "swimlane-mapping")) {
+ String swimlane = XmlUtil.attribute(inElement, "swimlane", true, parse);
+ String subSwimlane = XmlUtil.attribute(inElement, "sub-swimlane", true, parse);
+
+ swimlaneMappings.put(swimlane, subSwimlane);
+ }
+
+ return swimlaneMappings;
+ }
}
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-04-18 17:43:48 UTC (rev 4578)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlExecution.java 2009-04-18 19:47:17 UTC (rev 4579)
@@ -172,6 +172,13 @@
swimlane.setExecution(this);
}
+ public SwimlaneImpl getSwimlane(String swimlaneName) {
+ if (swimlanes==null) {
+ return null;
+ }
+ return swimlanes.get(swimlaneName);
+ }
+
public void removeSwimlane(SwimlaneImpl swimlane) {
swimlanes.remove(swimlane.getName());
swimlane.setExecution(null);
@@ -186,14 +193,18 @@
SwimlaneImpl swimlane = swimlanes.get(swimlaneName);
if (swimlane==null) {
- // initialize swimlane
- swimlane = new SwimlaneImpl();
- swimlane.setName(swimlaneName);
- swimlane.setExecution(this);
- swimlanes.put(swimlaneName, swimlane);
+ swimlane = createSwimlane(swimlaneName);
initializeAssignments(swimlaneDefinition, swimlane);
}
return swimlane;
}
+
+ public SwimlaneImpl createSwimlane(String swimlaneName) {
+ SwimlaneImpl swimlane = new SwimlaneImpl();
+ swimlane.setName(swimlaneName);
+ swimlane.setExecution(this);
+ swimlanes.put(swimlaneName, swimlane);
+ return swimlane;
+ }
}
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-04-18 17:43:48 UTC (rev 4578)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-04-18 19:47:17 UTC (rev 4579)
@@ -45,6 +45,7 @@
import org.jbpm.pvm.internal.model.ScopeElementImpl;
import org.jbpm.pvm.internal.model.TimerDefinitionImpl;
import org.jbpm.pvm.internal.model.VariableDefinitionImpl;
+import org.jbpm.pvm.internal.model.VariableOutDefinitionImpl;
import org.jbpm.pvm.internal.task.AssignableDefinitionImpl;
import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
@@ -450,14 +451,14 @@
String initExpr = XmlUtil.attribute(inElement, "init");
if (initExpr!=null) {
- variableDefinition.setInExpression(initExpr);
+ variableDefinition.setInitExpression(initExpr);
sources++;
}
- Element initElement = XmlUtil.element(inElement, "init");
- if (initElement!=null) {
- Descriptor initValueDescriptor = (Descriptor) WireParser.getInstance().parseElement(initElement, parse);
- variableDefinition.setInDescriptor(initValueDescriptor);
+ Element valueElement = XmlUtil.element(inElement);
+ if (valueElement!=null) {
+ Descriptor initValueDescriptor = (Descriptor) WireParser.getInstance().parseElement(valueElement, parse);
+ variableDefinition.setInitDescriptor(initValueDescriptor);
sources++;
}
@@ -472,4 +473,22 @@
return variableDefinitions;
}
+ public static List<VariableOutDefinitionImpl> parseVariableOutDefinitions(Element element, Parse parse) {
+ List<VariableOutDefinitionImpl> variableOutDefinitions = new ArrayList<VariableOutDefinitionImpl>();
+
+ for (Element inElement: XmlUtil.elements(element, "out-variable")) {
+ VariableOutDefinitionImpl variableOutDefinition = new VariableOutDefinitionImpl();
+
+ String name = XmlUtil.attribute(inElement, "name", true, parse);
+ variableOutDefinition.setName(name);
+
+ String expression = XmlUtil.attribute(inElement, "init");
+ if (expression!=null) {
+ variableOutDefinition.setExpression(expression);
+ }
+ }
+
+ return variableOutDefinitions;
+ }
+
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/builder/VariableBuilder.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/builder/VariableBuilder.java 2009-04-18 17:43:48 UTC (rev 4578)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/builder/VariableBuilder.java 2009-04-18 19:47:17 UTC (rev 4579)
@@ -49,22 +49,16 @@
}
public VariableBuilder initialValue(Descriptor initialValueDescriptor) {
- variableDefinition.setInDescriptor(initialValueDescriptor);
+ variableDefinition.setInitDescriptor(initialValueDescriptor);
return this;
}
public VariableBuilder initialExpression(String initialExpression) {
- variableDefinition.setInExpression(initialExpression);
+ variableDefinition.setInitExpression(initialExpression);
return this;
}
- public VariableBuilder initialVariable(String initialVariable) {
- variableDefinition.setInVariableName(initialVariable);
- return this;
- }
-
public CompositeBuilder endVariable() {
return compositeBuilder;
}
-
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetActivityCoordinates.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetActivityCoordinates.java 2009-04-18 17:43:48 UTC (rev 4578)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetActivityCoordinates.java 2009-04-18 19:47:17 UTC (rev 4579)
@@ -47,7 +47,7 @@
public ActivityCoordinates execute(Environment environment) throws Exception {
RepositorySession repositorySession = environment.get(RepositorySession.class);
- ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) repositorySession.loadProcessDefinitionById(processDefinitionId);
+ ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) repositorySession.findProcessDefinitionById(processDefinitionId);
if (processDefinition==null) {
throw new JbpmException("process definition "+processDefinitionId+" doesn't exist");
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceCmd.java 2009-04-18 17:43:48 UTC (rev 4578)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceCmd.java 2009-04-18 19:47:17 UTC (rev 4579)
@@ -51,7 +51,7 @@
RepositorySession repositorySession = environment.get(RepositorySession.class);
ClientProcessDefinition processDefinition = (ClientProcessDefinition)
- repositorySession.loadProcessDefinitionById(processDefinitionId);
+ repositorySession.findProcessDefinitionById(processDefinitionId);
if (processDefinition==null) {
throw new JbpmException("no process definition with id '"+processDefinitionId+"'");
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceInLatestCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceInLatestCmd.java 2009-04-18 17:43:48 UTC (rev 4578)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceInLatestCmd.java 2009-04-18 19:47:17 UTC (rev 4579)
@@ -56,18 +56,8 @@
ClientProcessDefinition processDefinition = null;
RepositorySession repositorySession = environment.get(RepositorySession.class);
- processDefinition = (ClientProcessDefinition) repositorySession.createProcessDefinitionQuery()
- .key(processDefinitionKey)
- .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
- .page(0, 1)
- .uniqueResult();
+ processDefinition = (ClientProcessDefinition) repositorySession.findProcessDefinitionByKey(processDefinitionKey);
- if (processDefinition==null) {
- throw new JbpmException("no process definition with key '"+processDefinitionKey+"'");
- }
-
- processDefinition = repositorySession.loadProcessDefinitionById(processDefinition.getId());
-
ClientProcessInstance processInstance = processDefinition.createProcessInstance(executionKey);
processInstance.setVariables(variables);
processInstance.start();
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-04-18 17:43:48 UTC (rev 4578)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-04-18 19:47:17 UTC (rev 4579)
@@ -1063,7 +1063,7 @@
&& (processDefinitionId!=null)
) {
RepositorySession repositorySession = Environment.getFromCurrent(RepositorySession.class);
- processDefinition = (ProcessDefinitionImpl) repositorySession.loadProcessDefinitionById(processDefinitionId);
+ processDefinition = (ProcessDefinitionImpl) repositorySession.findProcessDefinitionById(processDefinitionId);
if (processDefinition==null) {
throw new JbpmException("couldn't find process definition "+processDefinitionId+" in the repository");
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java 2009-04-18 17:43:48 UTC (rev 4578)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java 2009-04-18 19:47:17 UTC (rev 4579)
@@ -76,7 +76,7 @@
variables = new HashMap<String, Variable>();
for (VariableDefinitionImpl variableDefinition: variableDefinitions) {
String key = variableDefinition.getName();
- Object value = variableDefinition.getInValue(outerExecution);
+ Object value = variableDefinition.getInitValue(outerExecution);
String typeName = variableDefinition.getTypeName();
createVariable(key, value, typeName);
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java 2009-04-18 17:43:48 UTC (rev 4578)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java 2009-04-18 19:47:17 UTC (rev 4579)
@@ -42,18 +42,14 @@
protected String name;
protected String typeName;
- protected String inVariableName;
- protected String inExpression;
- protected Descriptor inDescriptor;
+ protected String initExpression;
+ protected Descriptor initDescriptor;
- public Object getInValue(ExecutionImpl execution) {
- if (inDescriptor!=null) {
- return WireContext.create(inDescriptor);
+ public Object getInitValue(ExecutionImpl execution) {
+ if (initDescriptor!=null) {
+ return WireContext.create(initDescriptor);
}
- if (inVariableName!=null) {
- return execution.getVariable(name);
- }
- if (inExpression!=null) {
+ if (initExpression!=null) {
throw new UnsupportedOperationException("TODO add variable in expression resolution");
}
return null;
@@ -65,24 +61,18 @@
public void setName(String name) {
this.name = name;
}
- public String getInVariableName() {
- return inVariableName;
+ public String getInitExpression() {
+ return initExpression;
}
- public void setInVariableName(String inVariableName) {
- this.inVariableName = inVariableName;
+ public void setInitExpression(String initExpression) {
+ this.initExpression = initExpression;
}
- public String getInExpression() {
- return inExpression;
+ public Descriptor getInitDescriptor() {
+ return initDescriptor;
}
- public void setInExpression(String inExpression) {
- this.inExpression = inExpression;
+ public void setInitDescriptor(Descriptor inDescriptor) {
+ this.initDescriptor = inDescriptor;
}
- public Descriptor getInDescriptor() {
- return inDescriptor;
- }
- public void setInDescriptor(Descriptor inDescriptor) {
- this.inDescriptor = inDescriptor;
- }
public String getTypeName() {
return typeName;
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionImpl.java 2009-04-18 17:43:48 UTC (rev 4578)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionImpl.java 2009-04-18 19:47:17 UTC (rev 4579)
@@ -34,7 +34,7 @@
private static final long serialVersionUID = 1L;
- protected String variableName;
+ protected String name;
protected String expression;
protected String language;
@@ -43,11 +43,11 @@
return scriptManager.evaluateExpression(expression, execution, language);
}
- public String getVariableName() {
- return variableName;
+ public String getName() {
+ return name;
}
- public void setVariableName(String variableName) {
- this.variableName = variableName;
+ public void setName(String name) {
+ this.name = name;
}
public String getExpression() {
return expression;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionSet.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionSet.java 2009-04-18 17:43:48 UTC (rev 4578)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionSet.java 2009-04-18 19:47:17 UTC (rev 4579)
@@ -39,10 +39,10 @@
// loop over all variable definitions
if (hasVariableOutDefinitions()) {
for (VariableOutDefinitionImpl variableOutDefinition: variableOutDefinitions) {
- String destination = variableOutDefinition.getVariableName();
- if (destination!=null) {
+ String variableName = variableOutDefinition.getName();
+ if (variableName!=null) {
Object value = variableOutDefinition.getOutValue(outerExecution);
- outerExecution.setVariable(destination, value);
+ outerExecution.setVariable(variableName, value);
}
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java 2009-04-18 17:43:48 UTC (rev 4578)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java 2009-04-18 19:47:17 UTC (rev 4579)
@@ -30,12 +30,23 @@
import org.jbpm.api.ProcessDefinition;
import org.jbpm.api.ProcessDefinitionQuery;
import org.jbpm.api.cmd.CommandService;
+import org.jbpm.api.session.RepositorySession;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
import org.jbpm.pvm.internal.repository.DeploymentImpl;
import org.jbpm.pvm.internal.repository.DeploymentProperty;
-/**
+/** returns partially initialized ProcessDefinitionImpl's that can only be exposed
+ * as {@link ProcessDefinition}.
+ *
+ * To get the properly initialized {@link ProcessDefinitionImpl} objects,
+ * use {@link RepositorySession#findProcessDefinitionById(String)} or
+ * {@link RepositorySession#findProcessDefinitionByKey(String)}
+ *
+ * You can use the query query capabilities in this class to find the id
+ * and then use {@link RepositorySession#findProcessDefinitionById(String)}
+ * to get the properly initialized ProcessDefinitionImpl.
+ *
* @author Tom Baeyens
*/
public class ProcessDefinitionQueryImpl extends AbstractQuery implements ProcessDefinitionQuery {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java 2009-04-18 17:43:48 UTC (rev 4578)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java 2009-04-18 19:47:17 UTC (rev 4579)
@@ -28,6 +28,7 @@
import org.jbpm.api.Deployment;
import org.jbpm.api.JbpmException;
import org.jbpm.api.Problem;
+import org.jbpm.api.ProcessDefinition;
import org.jbpm.api.ProcessDefinitionQuery;
import org.jbpm.api.client.ClientProcessDefinition;
import org.jbpm.api.session.RepositorySession;
@@ -101,8 +102,22 @@
public ProcessDefinitionQuery createProcessDefinitionQuery() {
return new ProcessDefinitionQueryImpl(session);
}
+
+ public ClientProcessDefinition findProcessDefinitionByKey(String processDefinitionKey) {
+ ProcessDefinition processDefinition = createProcessDefinitionQuery()
+ .key(processDefinitionKey)
+ .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+ .page(0, 1)
+ .uniqueResult();
- public ClientProcessDefinition loadProcessDefinitionById(String processDefinitionId) {
+ if (processDefinition!=null) {
+ return findProcessDefinitionById(processDefinition.getId());
+ }
+
+ return null;
+ }
+
+ public ClientProcessDefinition findProcessDefinitionById(String processDefinitionId) {
DeploymentProperty deploymentProperty = (DeploymentProperty) session.createQuery(
"select deploymentProperty " +
"from "+DeploymentProperty.class.getName()+" as deploymentProperty " +
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-04-18 17:43:48 UTC (rev 4578)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/SwimlaneImpl.java 2009-04-18 19:47:17 UTC (rev 4579)
@@ -48,6 +48,23 @@
protected Set<ParticipationImpl> participations = null;
protected SwimlaneDefinitionImpl swimlaneDefinition = null;
+ // cloning //////////////////////////////////////////////////////////////////
+
+ /** initialize this swimlane's assignee and participations from the
+ * other swimlane. */
+ public void initialize(SwimlaneImpl other) {
+ this.assignee = other.getAssignee();
+ if (other.getParticipations()!=null) {
+ for (ParticipationImpl otherParticipation: other.getParticipations()) {
+ addParticipation(
+ otherParticipation.getUserId(),
+ otherParticipation.getGroupId(),
+ otherParticipation.getType()
+ );
+ }
+ }
+ }
+
// assignment methods ///////////////////////////////////////////////////////
public String getAssignee() {
@@ -76,16 +93,16 @@
}
public Participation addParticipation(String userId, String groupId, String type) {
- return addParticipant(new ParticipationImpl(userId, groupId, type));
+ return addParticipation(new ParticipationImpl(userId, groupId, type));
}
- private Participation addParticipant(ParticipationImpl participant) {
- participant.setSwimlane(this);
+ private Participation addParticipation(ParticipationImpl participation) {
+ participation.setSwimlane(this);
if (participations ==null) {
participations = new HashSet<ParticipationImpl>();
}
- participations.add(participant);
- return participant;
+ participations.add(participation);
+ return participation;
}
public void removeParticipant(ParticipationImpl participant) {
17 years
JBoss JBPM SVN: r4578 - in jbpm4/trunk/modules: examples/src/test/java/org/jbpm/examples/concurrency/graphbased and 38 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-04-18 13:43:48 -0400 (Sat, 18 Apr 2009)
New Revision: 4578
Added:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateGroupCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateMembershipCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateUserCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteGroupCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteMembershipCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteUserCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindGroupCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindGroupsCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindUserCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindUsersCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionSet.java
Removed:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateGroup.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateMembership.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateUser.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteGroup.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteMembership.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteUser.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindGroup.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindGroups.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindUser.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindUsers.java
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/IdentityService.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/TaskService.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/concurrency/graphbased/ConcurrencyGraphBasedTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/conditions/DecisionConditionsTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/expression/DecisionExpressionTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/handler/DecisionHandlerTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/multiple/EndMultipleTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/processinstance/EndProcessInstanceTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/state/EndStateTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/esb/EsbTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/eventlistener/EventListenerTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/hql/HqlTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/JavaInstantiateTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/script/expression/ScriptExpressionTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/script/text/ScriptTextTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/services/ServicesTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/sql/SqlTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/state/choice/StateChoiceTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/state/sequence/StateSequenceTest.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/assignmenthandler/TaskAssignmentHandlerTest.java
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/swimlane/TaskSwimlaneTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/variables/TaskVariablesTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/businesstime/TimerBusinessTimeTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/event/TimerEventTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/repeat/TimerRepeatTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/state/choice/process.jpdl.xml
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/builder/VariableBuilder.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/identity/impl/UserImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeElementImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/FindGroupIds.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
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/DomBuilder.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parse.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/ProblemList.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/eventlistener/HqlEventListenerTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/SubTaskTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCommentsTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCreateUpdateDeleteTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskHandlerTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskListTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskParticipationsTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryTest.java
Log:
JBPM-2162 revert process archive deployment in examples
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/IdentityService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/IdentityService.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/IdentityService.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -44,16 +44,18 @@
List<User> findUsers();
/** delete the given user.
- * No effect (no exception) if the user does not exist. */
+ * No effect (no exception) if the user does not exist.
+ * Deletes also the memberships related to the given user, but does not delete the
+ * associated groups. */
void deleteUser(String userId);
/** create a group new group
* @return the generated id for this group. */
- String createGroup(String string);
+ String createGroup(String groupId);
/** create a group new group
* @return the generated id for this group. */
- String createGroup(String string, String groupType);
+ String createGroup(String groupId, String groupType);
/** create a group new group
* @return the generated id for this group. */
@@ -76,7 +78,9 @@
List<String> findGroupIdsByUser(String userId);
/** deletes the given group.
- * No effect (no exception) if the group does not exist. */
+ * No effect (no exception) if the group does not exist.
+ * Deleting a group also deletes all the memberships associated to that group,
+ * but not the associated users. */
void deleteGroup(String groupId);
/** makes the given user a member of the given group with the given role.
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/TaskService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/TaskService.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/TaskService.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -80,16 +80,16 @@
* transition in the process. */
void completeTask(long taskDbid, String outcome);
- /** Deletes the task.
+ /** Deletes the task without completing it.
* If this task was created in the context of a process execution, one
* of three things might happen depending on configurations of the task
* in the process definition:
* a) process executions resumes
* b) whole process execution is cancelled as well.
* c) exception is thrown */
- void cancelTask(long taskDbid);
+ void deleteTask(long taskDbid);
- /** Deletes the task providing an indication of the reason. Example reasons
+ /** Deletes the task without completing indicating the reason. Example reasons
* could be: "failed", "error", "exited", "obsolete" or "deleted".
* If this task was created in the context of a process execution, one
* of three things might happen depending on configurations of the task
@@ -97,7 +97,7 @@
* a) process executions resumes
* b) whole process execution is cancelled as well.
* c) exception is thrown */
- void cancelTask(long taskDbid, String reason);
+ void deleteTask(long taskDbid, String reason);
/** add a role to a given task.
* @param participation specifies the kind of involvement of the participatingUser
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/concurrency/graphbased/ConcurrencyGraphBasedTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/concurrency/graphbased/ConcurrencyGraphBasedTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/concurrency/graphbased/ConcurrencyGraphBasedTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -34,24 +34,24 @@
* @author Tom Baeyens
*/
public class ConcurrencyGraphBasedTest extends JbpmTestCase {
-
-
- protected void setUp() throws Exception
- {
+
+ long deploymentDbid;
+
+ protected void setUp() throws Exception {
super.setUp();
- deploy("jbpm-ConcurrencyGraphBasedTest.jpdl");
-
+
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/concurrency/graphbased/process.jpdl.xml")
+ .deploy();
}
-
- protected void tearDown() throws Exception
- {
- undeploy("jbpm-ConcurrencyGraphBasedTest.jpdl");
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
super.tearDown();
}
public void testConcurrencyGraphBased() {
-
ProcessInstance processInstance = executionService.startProcessInstanceByKey("ConcurrencyGraphBased");
String pid = processInstance.getId();
@@ -117,6 +117,4 @@
}
return activityNames;
}
-
}
-
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/conditions/DecisionConditionsTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/conditions/DecisionConditionsTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/conditions/DecisionConditionsTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -32,17 +32,20 @@
* @author Tom Baeyens
*/
public class DecisionConditionsTest extends JbpmTestCase {
-
- protected void setUp() throws Exception
- {
+
+ long deploymentDbid;
+
+ protected void setUp() throws Exception {
super.setUp();
- deploy("jbpm-DecisionConditionsTest.jpdl");
-
+
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/decision/conditions/process.jpdl.xml")
+ .deploy();
}
- protected void tearDown() throws Exception
- {
- undeploy("jbpm-DecisionConditionsTest.jpdl");
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
super.tearDown();
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/expression/DecisionExpressionTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/expression/DecisionExpressionTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/expression/DecisionExpressionTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -33,16 +33,19 @@
*/
public class DecisionExpressionTest extends JbpmTestCase {
- protected void setUp() throws Exception
- {
+ long deploymentDbid;
+
+ protected void setUp() throws Exception {
super.setUp();
- deploy("jbpm-DecisionExpressionTest.jpdl");
-
+
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/decision/expression/process.jpdl.xml")
+ .deploy();
}
- protected void tearDown() throws Exception
- {
- undeploy("jbpm-DecisionExpressionTest.jpdl");
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
super.tearDown();
}
@@ -66,5 +69,4 @@
Execution execution = executionService.startProcessInstanceByKey("DecisionExpression", variables);
assertEquals("give up", execution.getActivityName());
}
-
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/handler/DecisionHandlerTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/handler/DecisionHandlerTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/handler/DecisionHandlerTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -33,15 +33,19 @@
*/
public class DecisionHandlerTest extends JbpmTestCase {
- protected void setUp() throws Exception
- {
+ long deploymentDbid;
+
+ protected void setUp() throws Exception {
super.setUp();
- deploy("jbpm-DecisionHandlerTest.jpdl");
+
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/decision/handler/process.jpdl.xml")
+ .deploy();
}
- protected void tearDown() throws Exception
- {
- undeploy("jbpm-DecisionHandlerTest.jpdl");
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
super.tearDown();
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/multiple/EndMultipleTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/multiple/EndMultipleTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/multiple/EndMultipleTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -30,16 +30,19 @@
*/
public class EndMultipleTest extends JbpmTestCase {
- protected void setUp() throws Exception
- {
+ long deploymentDbid;
+
+ protected void setUp() throws Exception {
super.setUp();
- deploy("jbpm-EndMultipleTest.jpdl");
+
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/end/multiple/process.jpdl.xml")
+ .deploy();
}
-
- protected void tearDown() throws Exception
- {
- undeploy("jbpm-EndMultipleTest.jpdl");
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
super.tearDown();
}
@@ -60,7 +63,6 @@
}
public void testEndMultipleInternalServerError() {
-
Execution execution = executionService.startProcessInstanceByKey("EndMultiple");
String executionId = execution.getId();
execution = executionService.signalExecutionById(executionId, "500");
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/processinstance/EndProcessInstanceTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/processinstance/EndProcessInstanceTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/processinstance/EndProcessInstanceTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -30,20 +30,23 @@
*/
public class EndProcessInstanceTest extends JbpmTestCase {
- protected void setUp() throws Exception
- {
+ long deploymentDbid;
+
+ protected void setUp() throws Exception {
super.setUp();
- deploy("jbpm-EndProcessInstanceTest.jpdl");
+
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/end/processinstance/process.jpdl.xml")
+ .deploy();
}
- protected void tearDown() throws Exception
- {
- undeploy("jbpm-EndProcessInstanceTest.jpdl");
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
super.tearDown();
}
public void testEndProcessInstance() {
-
Execution execution = executionService.startProcessInstanceByKey("EndProcessInstance");
assertTrue(execution.isEnded());
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/state/EndStateTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/state/EndStateTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/state/EndStateTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -28,19 +28,21 @@
/**
* @author Tom Baeyens
*/
-public class EndStateTest extends JbpmTestCase
-{
+public class EndStateTest extends JbpmTestCase {
- protected void setUp() throws Exception
- {
+ long deploymentDbid;
+
+ protected void setUp() throws Exception {
super.setUp();
- deploy("jbpm-EndStateTest.jpdl");
+
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/end/state/process.jpdl.xml")
+ .deploy();
}
-
- protected void tearDown() throws Exception
- {
- undeploy("jbpm-EndStateTest.jpdl");
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
super.tearDown();
}
@@ -53,7 +55,6 @@
}
public void testEndStateErrorBadRequest() {
-
Execution execution = executionService.startProcessInstanceByKey("EndState");
String executionId = execution.getId();
execution = executionService.signalExecutionById(executionId, "400");
@@ -62,7 +63,6 @@
}
public void testEndStateErrorInternalServerError() {
-
Execution execution = executionService.startProcessInstanceByKey("EndState");
String executionId = execution.getId();
execution = executionService.signalExecutionById(executionId, "500");
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/esb/EsbTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/esb/EsbTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/esb/EsbTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -30,7 +30,6 @@
import org.jboss.soa.esb.addressing.EPR;
import org.jboss.soa.esb.message.Body;
import org.jboss.soa.esb.message.Message;
-import org.jbpm.api.Execution;
import org.jbpm.test.JbpmTestCase;
@@ -39,6 +38,7 @@
*/
public class EsbTest extends JbpmTestCase {
+ long deploymentDbid;
public JbpmMockCourier courier;
public void setUp() throws Exception {
@@ -49,24 +49,23 @@
EPR epr = new EPR(new URI("epr"));
courier = new JbpmMockCourier();
MockRegistry.register("orderProcessing", "bookSold", epr, courier);
-
- deploy("jbpm-EsbTest.jpdl");
+
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/esb/process.jpdl.xml")
+ .deploy();
}
- protected void tearDown() throws Exception
- {
- undeploy("jbpm-EsbTest.jpdl");
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
+ MockRegistry.uninstall();
+ MockCourierFactory.uninstall();
+
super.tearDown();
}
+
public void testEsb() {
-
- if(isIntegrationTest())
- {
- System.out.println("FIXME JBPM-2137: Implement and execute esb integration tests");
- return;
- }
-
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("title", "Internetworking with TCP/IP");
@@ -77,5 +76,4 @@
assertEquals("Internetworking with TCP/IP", body.get("bookTitle"));
assertEquals("deliver asap", body.get("goal"));
}
-
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/eventlistener/EventListenerTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/eventlistener/EventListenerTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/eventlistener/EventListenerTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -9,9 +9,23 @@
public class EventListenerTest extends JbpmTestCase {
+ long deploymentDbid;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/eventlistener/process.jpdl.xml")
+ .deploy();
+ }
+
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
+ super.tearDown();
+ }
+
public void testEventListener() {
- deployJpdlResource("org/jbpm/examples/eventlistener/process.jpdl.xml");
-
LogListener.logs = new ArrayList<String>();
Execution execution = executionService.startProcessInstanceByKey("EventListener");
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/hql/HqlTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/hql/HqlTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/hql/HqlTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -35,35 +35,46 @@
*/
public class HqlTest extends JbpmTestCase {
+ long deploymentDbid;
- protected void setUp() throws Exception
- {
+ long taskLaundryDbid;
+ long taskDishesDbid;
+ long taskIronDbid;
+
+ protected void setUp() throws Exception {
super.setUp();
- deploy("jbpm-HqlTest.jpdl");
- }
-
- protected void tearDown() throws Exception
- {
- undeploy("jbpm-HqlTest.jpdl");
- super.tearDown();
- }
-
- public void testHql() {
+
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/hql/process.jpdl.xml")
+ .deploy();
+
// add task laundry
Task task = taskService.newTask();
task.setName("laundry");
- saveAndRegisterTask(task);
-
+ taskLaundryDbid = taskService.saveTask(task);
+
// add task dishes
task = taskService.newTask();
task.setName("dishes");
- saveAndRegisterTask(task);
-
+ taskDishesDbid = taskService.saveTask(task);
+
// add task iron
task = taskService.newTask();
task.setName("iron");
- saveAndRegisterTask(task);
+ taskIronDbid = taskService.saveTask(task);
+ }
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
+ taskService.deleteTask(taskLaundryDbid);
+ taskService.deleteTask(taskDishesDbid);
+ taskService.deleteTask(taskIronDbid);
+
+ super.tearDown();
+ }
+
+ public void testHql() {
Execution execution = executionService.startProcessInstanceByKey("Hql");
String executionId = execution.getId();
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/JavaInstantiateTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/JavaInstantiateTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/JavaInstantiateTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -30,15 +30,19 @@
*/
public class JavaInstantiateTest extends JbpmTestCase {
- protected void setUp() throws Exception
- {
+ long deploymentDbid;
+
+ protected void setUp() throws Exception {
super.setUp();
- deploy("jbpm-JavaInstantiateTest.jpdl");
+
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/java/process.jpdl.xml")
+ .deploy();
}
- protected void tearDown() throws Exception
- {
- undeploy("jbpm-JavaInstantiateTest.jpdl");
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
super.tearDown();
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/script/expression/ScriptExpressionTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/script/expression/ScriptExpressionTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/script/expression/ScriptExpressionTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -25,7 +25,6 @@
import java.util.Map;
import org.jbpm.api.Execution;
-import org.jbpm.examples.script.text.Person;
import org.jbpm.test.JbpmTestCase;
@@ -34,21 +33,23 @@
*/
public class ScriptExpressionTest extends JbpmTestCase {
- protected void setUp() throws Exception
- {
+ long deploymentDbid;
+
+ protected void setUp() throws Exception {
super.setUp();
- deploy("jbpm-ScriptExpressionTest.jpdl");
+
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/script/expression/process.jpdl.xml")
+ .deploy();
}
-
- protected void tearDown() throws Exception
- {
- undeploy("jbpm-ScriptExpressionTest.jpdl");
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
super.tearDown();
}
public void testScriptText() {
-
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("order", new Order("Berlin"));
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/script/text/ScriptTextTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/script/text/ScriptTextTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/script/text/ScriptTextTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -33,19 +33,22 @@
*/
public class ScriptTextTest extends JbpmTestCase {
- protected void setUp() throws Exception
- {
+ long deploymentDbid;
+
+ protected void setUp() throws Exception {
super.setUp();
- deploy("jbpm-ScriptTextTest.jpdl");
+
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/script/text/process.jpdl.xml")
+ .deploy();
}
- protected void tearDown() throws Exception
- {
- undeploy("jbpm-ScriptTextTest.jpdl");
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
super.tearDown();
}
-
public void testScriptText() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("person", new Person("Honolulu"));
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/services/ServicesTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/services/ServicesTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/services/ServicesTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -9,7 +9,6 @@
import org.jbpm.api.ProcessEngine;
import org.jbpm.api.RepositoryService;
import org.jbpm.api.TaskService;
-import org.jbpm.test.JbpmTestCase;
/** shows explicitely the part of the API that is
* provided by JbpmTestCase as a convenience.
@@ -19,13 +18,6 @@
public class ServicesTest extends TestCase {
public void testObtainServicesAndDeployProcess() {
-
- if(JbpmTestCase.isIntegrationTest())
- {
- // Not part of the integration test suite
- return;
- }
-
// create a configuration
Configuration configuration = new Configuration();
// build a process engine from a configuration
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/sql/SqlTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/sql/SqlTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/sql/SqlTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -22,7 +22,6 @@
package org.jbpm.examples.sql;
import java.util.Collection;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
@@ -36,34 +35,46 @@
*/
public class SqlTest extends JbpmTestCase {
- protected void setUp() throws Exception
- {
+ long deploymentDbid;
+
+ long taskLaundryDbid;
+ long taskDishesDbid;
+ long taskIronDbid;
+
+ protected void setUp() throws Exception {
super.setUp();
- deploy("jbpm-SqlTest.jpdl");
- }
-
- protected void tearDown() throws Exception
- {
- undeploy("jbpm-SqlTest.jpdl");
- super.tearDown();
- }
-
- public void testSql() {
+
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/sql/process.jpdl.xml")
+ .deploy();
+
// add task laundry
Task task = taskService.newTask();
task.setName("laundry");
- saveAndRegisterTask(task);
+ taskLaundryDbid = taskService.saveTask(task);
// add task dishes
task = taskService.newTask();
task.setName("dishes");
- saveAndRegisterTask(task);
+ taskDishesDbid = taskService.saveTask(task);
// add task iron
task = taskService.newTask();
task.setName("iron");
- saveAndRegisterTask(task);
+ taskIronDbid = taskService.saveTask(task);
+ }
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
+ taskService.deleteTask(taskLaundryDbid);
+ taskService.deleteTask(taskDishesDbid);
+ taskService.deleteTask(taskIronDbid);
+
+ super.tearDown();
+ }
+
+ public void testSql() {
Execution execution = executionService.startProcessInstanceByKey("Sql");
String executionId = execution.getId();
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/state/choice/StateChoiceTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/state/choice/StateChoiceTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/state/choice/StateChoiceTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -21,7 +21,7 @@
*/
package org.jbpm.examples.state.choice;
-import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
import org.jbpm.test.JbpmTestCase;
@@ -30,29 +30,45 @@
*/
public class StateChoiceTest extends JbpmTestCase {
- protected void setUp() throws Exception
- {
+ long deploymentDbid;
+
+ protected void setUp() throws Exception {
super.setUp();
- deploy("jbpm-StateChoiceTest.jpdl");
+
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/state/choice/process.jpdl.xml")
+ .deploy();
}
- protected void tearDown() throws Exception
- {
- undeploy("jbpm-StateChoiceTest.jpdl");
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
super.tearDown();
}
public void testStateChoiceAccept() {
- Execution execution = executionService.startProcessInstanceByKey("StateChoice");
- String executionId = execution.getId();
- execution = executionService.signalExecutionById(executionId, "accept");
- assertEquals("submit document", execution.getActivityName());
+ ProcessInstance processInstance = executionService
+ .startProcessInstanceByKey("StateChoice");
+
+ String executionId = processInstance
+ .findActiveExecutionIn("wait for response")
+ .getId();
+
+ processInstance = executionService.signalExecutionById(executionId, "accept");
+
+ assertEquals("submit document", processInstance.getActivityName());
}
public void testStateChoiceReject() {
- Execution execution = executionService.startProcessInstanceByKey("StateChoice");
- String executionId = execution.getId();
- execution = executionService.signalExecutionById(executionId, "reject");
- assertEquals("try again", execution.getActivityName());
+ ProcessInstance processInstance = executionService
+ .startProcessInstanceByKey("StateChoice");
+
+ String executionId = processInstance
+ .findActiveExecutionIn("wait for response")
+ .getId();
+
+ processInstance = executionService.signalExecutionById(executionId, "reject");
+
+ assertEquals("try again", processInstance.getActivityName());
}
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/state/sequence/StateSequenceTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/state/sequence/StateSequenceTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/state/sequence/StateSequenceTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -22,6 +22,7 @@
package org.jbpm.examples.state.sequence;
import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
import org.jbpm.test.JbpmTestCase;
@@ -30,28 +31,33 @@
*/
public class StateSequenceTest extends JbpmTestCase {
- protected void setUp() throws Exception
- {
+ long deploymentDbid;
+
+ protected void setUp() throws Exception {
super.setUp();
- deploy("jbpm-StateSequenceTest.jpdl");
+
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/state/sequence/process.jpdl.xml")
+ .deploy();
}
- protected void tearDown() throws Exception
- {
- undeploy("jbpm-StateSequenceTest.jpdl");
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
super.tearDown();
}
public void testWaitStatesSequence() {
- Execution execution = executionService.startProcessInstanceByKey("StateSequence");
- assertEquals("a", execution.getActivityName());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("StateSequence");
+ Execution executionInA = processInstance.findActiveExecutionIn("a");
+ assertNotNull(executionInA);
- String executionId = execution.getId();
- execution = executionService.signalExecutionById(executionId);
- assertEquals("b", execution.getActivityName());
+ processInstance = executionService.signalExecutionById(executionInA.getId());
+ Execution executionInB = processInstance.findActiveExecutionIn("b");
+ assertNotNull(executionInB);
- execution = executionService.signalExecutionById(executionId);
- assertEquals("c", execution.getActivityName());
+ processInstance = executionService.signalExecutionById(executionInB.getId());
+ Execution executionInC = processInstance.findActiveExecutionIn("c");
+ assertNotNull(executionInC);
}
-
}
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-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/assignee/TaskAssigneeTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -35,15 +35,19 @@
*/
public class TaskAssigneeTest extends JbpmTestCase {
- protected void setUp() throws Exception
- {
+ long deploymentDbid;
+
+ protected void setUp() throws Exception {
super.setUp();
- deploy("jbpm-TaskAssigneeTest.jpdl");
+
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/task/assignee/process.jpdl.xml")
+ .deploy();
}
- protected void tearDown() throws Exception
- {
- undeploy("jbpm-TaskAssigneeTest.jpdl");
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
super.tearDown();
}
@@ -70,5 +74,4 @@
execution = executionService.findExecutionById(executionId);
assertEquals("wait", execution.getActivityName());
}
-
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/assignmenthandler/TaskAssignmentHandlerTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/assignmenthandler/TaskAssignmentHandlerTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/assignmenthandler/TaskAssignmentHandlerTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -31,20 +31,23 @@
*/
public class TaskAssignmentHandlerTest extends JbpmTestCase {
- protected void setUp() throws Exception
- {
+ long deploymentDbid;
+
+ protected void setUp() throws Exception {
super.setUp();
- deploy("jbpm-TaskAssignmentHandlerTest.jpdl");
+
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/task/assignmenthandler/process.jpdl.xml")
+ .deploy();
}
- protected void tearDown() throws Exception
- {
- undeploy("jbpm-TaskAssignmentHandlerTest.jpdl");
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
super.tearDown();
}
public void testTaskAssignmentHandler() {
-
executionService.startProcessInstanceByKey("TaskAssignmentHandler");
List<Task> taskList = taskService.findAssignedTasks("johndoe");
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-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -33,28 +33,35 @@
*/
public class TaskCandidatesTest extends JbpmTestCase {
- protected void setUp() throws Exception
- {
+ long deploymentDbid;
+
+ protected void setUp() throws Exception {
super.setUp();
- deploy("jbpm-TaskCandidatesTest.jpdl");
+ // create identities
+ identityService.createGroup("sales-dept");
- if(identityService.findGroupById("sales-dept")==null)
- {
- // create johndoe and joesmoe as members of the sales group
- identityService.createGroup("sales-dept");
+ identityService.createUser("johndoe", "johndoe", "John", "Doe");
+ identityService.createMembership("johndoe", "sales-dept");
- identityService.createUser("johndoe", "johndoe", "John", "Doe");
- identityService.createMembership("johndoe", "sales-dept");
+ identityService.createUser("joesmoe", "joesmoe", "Joe", "Smoe");
+ identityService.createMembership("joesmoe", "sales-dept");
- identityService.createUser("joesmoe", "joesmoe", "Joe", "Smoe");
- identityService.createMembership("joesmoe", "sales-dept");
- }
+ // deploy process
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/task/candidates/process.jpdl.xml")
+ .deploy();
}
- protected void tearDown() throws Exception
- {
- undeploy("jbpm-TaskCandidatesTest.jpdl");
+ protected void tearDown() throws Exception {
+ // delete process deployment
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
+ // delete identities
+ identityService.deleteGroup("sales-dept");
+ identityService.deleteUser("johndoe");
+ identityService.deleteUser("joesmoe");
+
super.tearDown();
}
Modified: 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 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -32,24 +32,32 @@
*/
public class TaskSwimlaneTest extends JbpmTestCase {
- protected void setUp() throws Exception
- {
+ long deploymentDbid;
+
+ protected void setUp() throws Exception {
super.setUp();
- deploy("jbpm-TaskSwimlaneTest.jpdl");
+
+ // create identities
+ identityService.createGroup("sales-dept");
- if(identityService.findGroupById("sales-dept")==null)
- {
- // create johndoe and joesmoe as members of the sales group
- identityService.createGroup("sales-dept");
-
- identityService.createUser("johndoe", "johndoe", "John", "Doe");
- identityService.createMembership("johndoe", "sales-dept");
- }
+ identityService.createUser("johndoe", "johndoe", "John", "Doe");
+ identityService.createMembership("johndoe", "sales-dept");
+
+ // deploy process
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/task/swimlane/process.jpdl.xml")
+ .deploy();
+
}
- protected void tearDown() throws Exception
- {
- undeploy("jbpm-TaskSwimlaneTest.jpdl");
+ protected void tearDown() throws Exception {
+ // delete process deployment
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
+ // delete identities
+ identityService.deleteGroup("sales-dept");
+ identityService.deleteUser("johndoe");
+
super.tearDown();
}
Modified: 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 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/variables/TaskVariablesTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -38,15 +38,19 @@
*/
public class TaskVariablesTest extends JbpmTestCase {
- protected void setUp() throws Exception
- {
+ long deploymentDbid;
+
+ protected void setUp() throws Exception {
super.setUp();
- deploy("jbpm-TaskVariablesTest.jpdl");
+
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/task/variables/process.jpdl.xml")
+ .deploy();
}
- protected void tearDown() throws Exception
- {
- undeploy("jbpm-TaskVariablesTest.jpdl");
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
super.tearDown();
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/businesstime/TimerBusinessTimeTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/businesstime/TimerBusinessTimeTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/businesstime/TimerBusinessTimeTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -33,9 +33,23 @@
static long HOUR_IN_MILLIS = 60*60*100;
+ long deploymentDbid;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/timer/businesstime/process.jpdl.xml")
+ .deploy();
+ }
+
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
+ super.tearDown();
+ }
+
public void testBusinessTime() {
- deployJpdlResource("org/jbpm/examples/timer/businesstime/process.jpdl.xml");
-
long now = System.currentTimeMillis();
ProcessInstance processInstance = executionService.startProcessInstanceByKey("TimerBusinessTime");
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/event/TimerEventTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/event/TimerEventTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/event/TimerEventTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -36,9 +36,23 @@
*/
public class TimerEventTest extends JbpmTestCase {
+ long deploymentDbid;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/timer/event/process.jpdl.xml")
+ .deploy();
+ }
+
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
+ super.tearDown();
+ }
+
public void testTimerEventTimerFires() {
- deployJpdlResource("org/jbpm/examples/timer/event/process.jpdl.xml");
-
ProcessInstance processInstance = executionService.startProcessInstanceByKey("TimerEvent");
Job job = managementService.createJobQuery()
@@ -57,8 +71,6 @@
}
public void testTimerEventContinueBeforeTimerFires() {
- deployJpdlResource("org/jbpm/examples/timer/event/process.jpdl.xml");
-
ProcessInstance processInstance = executionService.startProcessInstanceByKey("TimerEvent");
String executionId = processInstance.findActiveExecutionIn("guardedWait").getId();
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/repeat/TimerRepeatTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/repeat/TimerRepeatTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/repeat/TimerRepeatTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -31,9 +31,23 @@
*/
public class TimerRepeatTest extends JbpmTestCase {
+ long deploymentDbid;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/timer/repeat/process.jpdl.xml")
+ .deploy();
+ }
+
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
+ super.tearDown();
+ }
+
public void testTimerRepeat() {
- deployJpdlResource("org/jbpm/examples/timer/repeat/process.jpdl.xml");
-
ProcessInstance processInstance = executionService.startProcessInstanceByKey("TimerRepeat");
Job job = managementService.createJobQuery()
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -33,9 +33,23 @@
*/
public class TimerTransitionTest extends JbpmTestCase {
+ long deploymentDbid;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/timer/transition/process.jpdl.xml")
+ .deploy();
+ }
+
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
+ super.tearDown();
+ }
+
public void testTimerTransitionTimerFires() {
- deployJpdlResource("org/jbpm/examples/timer/transition/process.jpdl.xml");
-
Execution processInstance = executionService.startProcessInstanceByKey("TimerTransition");
Job job = managementService.createJobQuery()
@@ -51,8 +65,6 @@
}
public void testTimerTransitionContinueBeforeTimerFires() {
- deployJpdlResource("org/jbpm/examples/timer/transition/process.jpdl.xml");
-
Execution processInstance = executionService.startProcessInstanceByKey("TimerTransition");
String executionId = processInstance.findActiveExecutionIn("guardedWait").getId();
Modified: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/state/choice/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/state/choice/process.jpdl.xml 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/state/choice/process.jpdl.xml 2009-04-18 17:43:48 UTC (rev 4578)
@@ -2,16 +2,16 @@
<process name="StateChoice" xmlns="http://jbpm.org/4/jpdl">
- <start g="16,60,48,48">
- <transition to="wait for response" name=""/>
+ <start g="16,60,48,48">
+ <transition to="wait for response"/>
</start>
- <state g="96,58,109,52" name="wait for response">
- <transition g="151,41:-48,0" name="accept" to="submit document"/>
- <transition g="151,125:-47,-17" name="reject" to="try again"/>
+ <state name="wait for response" g="96,58,109,52">
+ <transition name="accept" to="submit document" g="151,41:-48,0" />
+ <transition name="reject" to="try again" g="151,125:-47,-17" />
</state>
- <state g="237,16,114,52" name="submit document"/>
- <state g="237,100,114,52" name="try again"/>
+ <state name="submit document" g="237,16,114,52" />
+ <state name="try again" g="237,100,114,52" />
</process>
\ No newline at end of file
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateBinding.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateBinding.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -21,8 +21,6 @@
*/
package org.jbpm.jpdl.internal.activity;
-import org.jbpm.pvm.internal.model.ActivityImpl;
-import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
Added: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -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.jpdl.internal.activity;
+
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.pvm.internal.model.VariableDefinitionImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SubProcessActivity extends JpdlExternalActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Map<String, String> inSwimlaneMappings;
+ protected List<VariableDefinitionImpl> inDefinitions;
+ protected List<VariableDefinitionImpl> outDefinitions;
+ protected Map<String, String> outcomeStateMappings;
+ protected Map<String, String> outcomeVariableMappings;
+
+ public void execute(ActivityExecution execution) throws Exception {
+ }
+
+ public void signal(ActivityExecution execution, String signalName, Map<String, Object> parameters) throws Exception {
+ }
+
+ public void setInSwimlaneMappings(Map<String, String> inSwimlaneMappings) {
+ this.inSwimlaneMappings = inSwimlaneMappings;
+ }
+ public void setInDefinitions(List<VariableDefinitionImpl> inDefinitions) {
+ this.inDefinitions = inDefinitions;
+ }
+ public void setOutDefinitions(List<VariableDefinitionImpl> outDefinitions) {
+ this.outDefinitions = outDefinitions;
+ }
+ public void setOutcomeStateMappings(Map<String, String> outcomeStateMappings) {
+ this.outcomeStateMappings = outcomeStateMappings;
+ }
+ public void setOutcomeVariableMappings(Map<String, String> outcomeVariableMappings) {
+ this.outcomeVariableMappings = outcomeVariableMappings;
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.activity;
+
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SubProcessBinding extends JpdlBinding {
+
+ public SubProcessBinding() {
+ super("sub-process");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+
+ String subProcessKey = XmlUtil.attribute(element, "process-key");
+ String subProcessId = XmlUtil.attribute(element, "process-id");
+
+
+
+ return null;
+ }
+
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -44,11 +44,13 @@
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
import org.jbpm.pvm.internal.model.ScopeElementImpl;
import org.jbpm.pvm.internal.model.TimerDefinitionImpl;
+import org.jbpm.pvm.internal.model.VariableDefinitionImpl;
import org.jbpm.pvm.internal.task.AssignableDefinitionImpl;
import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
import org.jbpm.pvm.internal.util.ReflectUtil;
import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.Descriptor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
import org.jbpm.pvm.internal.wire.operation.Operation;
import org.jbpm.pvm.internal.wire.xml.WireParser;
@@ -206,13 +208,13 @@
return processDefinition;
}
- private void resolveTransitionDestinations(Parse parse, JpdlProcessDefinition processDefinition, UnresolvedTransitions unresolvedTransitions) {
+ protected void resolveTransitionDestinations(Parse parse, JpdlProcessDefinition processDefinition, UnresolvedTransitions unresolvedTransitions) {
for (UnresolvedTransition unresolvedTransition: unresolvedTransitions.list) {
unresolvedTransition.resolve(processDefinition, parse);
}
}
- private void parseActivities(Element documentElement, Parse parse, JpdlProcessDefinition processDefinition) {
+ public void parseActivities(Element documentElement, Parse parse, JpdlProcessDefinition processDefinition) {
List<Element> elements = XmlUtil.elements(documentElement);
for (Element element: elements) {
if ( !"on".equals(XmlUtil.getTagLocalName(element))
@@ -369,6 +371,9 @@
String taskName = XmlUtil.attribute(element, "name");
taskDefinition.setName(taskName);
+
+ String form = XmlUtil.attribute(element, "form");
+ taskDefinition.setForm(form);
ProcessDefinitionImpl processDefinition = parse.findObject(ProcessDefinitionImpl.class);
if (processDefinition.getTaskDefinition(taskName)!=null) {
@@ -430,4 +435,41 @@
}
return objectDescriptor;
}
+
+
+ public static List<VariableDefinitionImpl> parseVariableDefinitions(Element element, Parse parse, boolean initRequired) {
+ List<VariableDefinitionImpl> variableDefinitions = new ArrayList<VariableDefinitionImpl>();
+
+ for (Element inElement: XmlUtil.elements(element, "variable")) {
+ VariableDefinitionImpl variableDefinition = new VariableDefinitionImpl();
+
+ String name = XmlUtil.attribute(inElement, "name", true, parse);
+ variableDefinition.setName(name);
+
+ int sources = 0;
+
+ String initExpr = XmlUtil.attribute(inElement, "init");
+ if (initExpr!=null) {
+ variableDefinition.setInExpression(initExpr);
+ sources++;
+ }
+
+ Element initElement = XmlUtil.element(inElement, "init");
+ if (initElement!=null) {
+ Descriptor initValueDescriptor = (Descriptor) WireParser.getInstance().parseElement(initElement, parse);
+ variableDefinition.setInDescriptor(initValueDescriptor);
+ sources++;
+ }
+
+ if (initRequired && sources==0) {
+ parse.addProblem("no init specified", inElement);
+ }
+ if (sources>1) {
+ parse.addProblem("init attribute and init element are mutually exclusive on element variable", inElement);
+ }
+ }
+
+ return variableDefinitions;
+ }
+
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/builder/VariableBuilder.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/builder/VariableBuilder.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/builder/VariableBuilder.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -63,11 +63,6 @@
return this;
}
- public VariableBuilder outVariable(String outVariable) {
- variableDefinition.setOutVariableName(outVariable);
- return this;
- }
-
public CompositeBuilder endVariable() {
return compositeBuilder;
}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateGroup.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateGroup.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateGroup.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -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.pvm.internal.identity.cmd;
-
-import org.jbpm.api.cmd.Command;
-import org.jbpm.api.env.Environment;
-import org.jbpm.pvm.internal.identity.spi.IdentitySession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class CreateGroup implements Command<String> {
-
- private static final long serialVersionUID = 1L;
-
- protected String groupName;
- protected String groupType;
- protected String parentGroupId;
-
- public CreateGroup(String groupName, String groupType, String parentGroupId) {
- this.groupName = groupName;
- this.groupType = groupType;
- this.parentGroupId = parentGroupId;
- }
-
- public String execute(Environment environment) throws Exception {
- IdentitySession identitySession = environment.get(IdentitySession.class);
- return identitySession.createGroup(groupName, groupType, parentGroupId);
- }
-}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateGroupCmd.java (from rev 4573, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateGroup.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateGroupCmd.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateGroupCmd.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.identity.cmd;
+
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.env.Environment;
+import org.jbpm.pvm.internal.identity.spi.IdentitySession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CreateGroupCmd implements Command<String> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String groupName;
+ protected String groupType;
+ protected String parentGroupId;
+
+ public CreateGroupCmd(String groupName, String groupType, String parentGroupId) {
+ this.groupName = groupName;
+ this.groupType = groupType;
+ this.parentGroupId = parentGroupId;
+ }
+
+ public String execute(Environment environment) throws Exception {
+ IdentitySession identitySession = environment.get(IdentitySession.class);
+ return identitySession.createGroup(groupName, groupType, parentGroupId);
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateGroupCmd.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateMembership.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateMembership.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateMembership.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.identity.cmd;
-
-import org.jbpm.api.cmd.Command;
-import org.jbpm.api.env.Environment;
-import org.jbpm.pvm.internal.identity.spi.IdentitySession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class CreateMembership implements Command<Object> {
-
- private static final long serialVersionUID = 1L;
-
- protected String userId;
- protected String groupId;
- protected String role;
-
- public CreateMembership(String userId, String groupId, String role) {
- this.userId = userId;
- this.groupId = groupId;
- this.role = role;
- }
-
- public Object execute(Environment environment) throws Exception {
- IdentitySession identitySession = environment.get(IdentitySession.class);
- identitySession.createMembership(userId, groupId, role);
- return null;
- }
-}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateMembershipCmd.java (from rev 4573, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateMembership.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateMembershipCmd.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateMembershipCmd.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.identity.cmd;
+
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.env.Environment;
+import org.jbpm.pvm.internal.identity.spi.IdentitySession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CreateMembershipCmd implements Command<Object> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String userId;
+ protected String groupId;
+ protected String role;
+
+ public CreateMembershipCmd(String userId, String groupId, String role) {
+ this.userId = userId;
+ this.groupId = groupId;
+ this.role = role;
+ }
+
+ public Object execute(Environment environment) throws Exception {
+ IdentitySession identitySession = environment.get(IdentitySession.class);
+ identitySession.createMembership(userId, groupId, role);
+ return null;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateMembershipCmd.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateUser.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateUser.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateUser.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.identity.cmd;
-
-import org.jbpm.api.cmd.Command;
-import org.jbpm.api.env.Environment;
-import org.jbpm.pvm.internal.identity.spi.IdentitySession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class CreateUser implements Command<Void> {
-
- private static final long serialVersionUID = 1L;
-
- protected String userId;
- protected String password;
- protected String givenName;
- protected String familyName;
-
- public CreateUser(String userId, String password, String givenName, String familyName) {
- this.userId = userId;
- this.password = password;
- this.givenName = givenName;
- this.familyName = familyName;
- }
-
-
- public Void execute(Environment environment) throws Exception {
- IdentitySession identitySession = environment.get(IdentitySession.class);
- identitySession.createUser(userId, password, givenName, familyName);
- return null;
- }
-
-}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateUserCmd.java (from rev 4573, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateUser.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateUserCmd.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateUserCmd.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.identity.cmd;
+
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.env.Environment;
+import org.jbpm.pvm.internal.identity.spi.IdentitySession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CreateUserCmd implements Command<Void> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String userId;
+ protected String password;
+ protected String givenName;
+ protected String familyName;
+
+ public CreateUserCmd(String userId, String password, String givenName, String familyName) {
+ this.userId = userId;
+ this.password = password;
+ this.givenName = givenName;
+ this.familyName = familyName;
+ }
+
+
+ public Void execute(Environment environment) throws Exception {
+ IdentitySession identitySession = environment.get(IdentitySession.class);
+ identitySession.createUser(userId, password, givenName, familyName);
+ return null;
+ }
+
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateUserCmd.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteGroup.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteGroup.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteGroup.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -1,47 +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.cmd;
-
-import org.jbpm.api.cmd.Command;
-import org.jbpm.api.env.Environment;
-import org.jbpm.pvm.internal.identity.spi.IdentitySession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DeleteGroup implements Command<Void> {
-
- private static final long serialVersionUID = 1L;
-
- protected String groupId;
-
- public DeleteGroup(String groupId) {
- this.groupId = groupId;
- }
-
- public Void execute(Environment environment) throws Exception {
- IdentitySession identitySession = environment.get(IdentitySession.class);
- identitySession.deleteGroup(groupId);
- return null;
- }
-}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteGroupCmd.java (from rev 4573, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteGroup.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteGroupCmd.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteGroupCmd.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.identity.cmd;
+
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.env.Environment;
+import org.jbpm.pvm.internal.identity.spi.IdentitySession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeleteGroupCmd implements Command<Void> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String groupId;
+
+ public DeleteGroupCmd(String groupId) {
+ this.groupId = groupId;
+ }
+
+ public Void execute(Environment environment) throws Exception {
+ IdentitySession identitySession = environment.get(IdentitySession.class);
+ identitySession.deleteGroup(groupId);
+ return null;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteGroupCmd.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteMembership.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteMembership.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteMembership.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -1,52 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.identity.cmd;
-
-import org.jbpm.api.cmd.Command;
-import org.jbpm.api.env.Environment;
-import org.jbpm.pvm.internal.identity.spi.IdentitySession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DeleteMembership implements Command<Object> {
-
- private static final long serialVersionUID = 1L;
-
- protected String userId;
- protected String groupId;
- protected String role;
-
- public DeleteMembership(String userId, String groupId, String role) {
- this.userId = userId;
- this.groupId = groupId;
- this.role = role;
- }
-
- public Object execute(Environment environment) throws Exception {
- IdentitySession identitySession = environment.get(IdentitySession.class);
- identitySession.deleteMembership(userId, groupId, role);
- return null;
- }
-
-}
\ No newline at end of file
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteMembershipCmd.java (from rev 4573, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteMembership.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteMembershipCmd.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteMembershipCmd.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.identity.cmd;
+
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.env.Environment;
+import org.jbpm.pvm.internal.identity.spi.IdentitySession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeleteMembershipCmd implements Command<Object> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String userId;
+ protected String groupId;
+ protected String role;
+
+ public DeleteMembershipCmd(String userId, String groupId, String role) {
+ this.userId = userId;
+ this.groupId = groupId;
+ this.role = role;
+ }
+
+ public Object execute(Environment environment) throws Exception {
+ IdentitySession identitySession = environment.get(IdentitySession.class);
+ identitySession.deleteMembership(userId, groupId, role);
+ return null;
+ }
+
+}
\ No newline at end of file
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteMembershipCmd.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteUser.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteUser.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteUser.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.identity.cmd;
-
-import org.jbpm.api.cmd.Command;
-import org.jbpm.api.env.Environment;
-import org.jbpm.pvm.internal.identity.spi.IdentitySession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DeleteUser implements Command<Void> {
-
- private static final long serialVersionUID = 1L;
-
- protected String userId;
-
- public DeleteUser(String userId) {
- this.userId = userId;
- }
-
- public Void execute(Environment environment) throws Exception {
- IdentitySession identitySession = environment.get(IdentitySession.class);
- identitySession.deleteUser(userId);
- return null;
- }
-
-}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteUserCmd.java (from rev 4573, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteUser.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteUserCmd.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteUserCmd.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.identity.cmd;
+
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.env.Environment;
+import org.jbpm.pvm.internal.identity.spi.IdentitySession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeleteUserCmd implements Command<Void> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String userId;
+
+ public DeleteUserCmd(String userId) {
+ this.userId = userId;
+ }
+
+ public Void execute(Environment environment) throws Exception {
+ IdentitySession identitySession = environment.get(IdentitySession.class);
+ identitySession.deleteUser(userId);
+ return null;
+ }
+
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/DeleteUserCmd.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindGroup.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindGroup.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindGroup.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -1,47 +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.cmd;
-
-import org.jbpm.api.cmd.Command;
-import org.jbpm.api.env.Environment;
-import org.jbpm.api.identity.Group;
-import org.jbpm.pvm.internal.identity.spi.IdentitySession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class FindGroup implements Command<Group> {
-
- private static final long serialVersionUID = 1L;
-
- String groupId;
-
- public FindGroup(String groupId) {
- this.groupId = groupId;
- }
-
- public Group execute(Environment environment) {
- IdentitySession identitySession = environment.get(IdentitySession.class);
- return identitySession.findGroupById(groupId);
- }
-}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindGroupCmd.java (from rev 4573, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindGroup.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindGroupCmd.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindGroupCmd.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.identity.cmd;
+
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.env.Environment;
+import org.jbpm.api.identity.Group;
+import org.jbpm.pvm.internal.identity.spi.IdentitySession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class FindGroupCmd implements Command<Group> {
+
+ private static final long serialVersionUID = 1L;
+
+ String groupId;
+
+ public FindGroupCmd(String groupId) {
+ this.groupId = groupId;
+ }
+
+ public Group execute(Environment environment) {
+ IdentitySession identitySession = environment.get(IdentitySession.class);
+ return identitySession.findGroupById(groupId);
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindGroupCmd.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindGroups.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindGroups.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindGroups.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -1,58 +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.cmd;
-
-import java.util.List;
-
-import org.jbpm.api.cmd.Command;
-import org.jbpm.api.env.Environment;
-import org.jbpm.api.identity.Group;
-import org.jbpm.pvm.internal.identity.spi.IdentitySession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class FindGroups implements Command<List<Group>> {
-
- private static final long serialVersionUID = 1L;
-
- protected String userId;
- protected String groupType;
-
- public FindGroups(String userId) {
- this.userId = userId;
- }
-
- public FindGroups(String userId, String groupType) {
- this.userId = userId;
- this.groupType = groupType;
- }
-
- public List<Group> execute(Environment environment) throws Exception {
- IdentitySession identitySession = environment.get(IdentitySession.class);
- if (groupType!=null) {
- return identitySession.findGroupsByUserAndGroupType(userId, groupType);
- }
- return identitySession.findGroupsByUser(userId);
- }
-}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindGroupsCmd.java (from rev 4573, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindGroups.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindGroupsCmd.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindGroupsCmd.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -0,0 +1,58 @@
+/*
+ * 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.cmd;
+
+import java.util.List;
+
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.env.Environment;
+import org.jbpm.api.identity.Group;
+import org.jbpm.pvm.internal.identity.spi.IdentitySession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class FindGroupsCmd implements Command<List<Group>> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String userId;
+ protected String groupType;
+
+ public FindGroupsCmd(String userId) {
+ this.userId = userId;
+ }
+
+ public FindGroupsCmd(String userId, String groupType) {
+ this.userId = userId;
+ this.groupType = groupType;
+ }
+
+ public List<Group> execute(Environment environment) throws Exception {
+ IdentitySession identitySession = environment.get(IdentitySession.class);
+ if (groupType!=null) {
+ return identitySession.findGroupsByUserAndGroupType(userId, groupType);
+ }
+ return identitySession.findGroupsByUser(userId);
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindGroupsCmd.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindUser.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindUser.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindUser.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -1,47 +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.cmd;
-
-import org.jbpm.api.cmd.Command;
-import org.jbpm.api.env.Environment;
-import org.jbpm.api.identity.User;
-import org.jbpm.pvm.internal.identity.spi.IdentitySession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class FindUser implements Command<User> {
-
- private static final long serialVersionUID = 1L;
-
- String userId;
-
- public FindUser(String userId) {
- this.userId = userId;
- }
-
- public User execute(Environment environment) {
- IdentitySession identitySession = environment.get(IdentitySession.class);
- return identitySession.findUserById(userId);
- }
-}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindUserCmd.java (from rev 4573, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindUser.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindUserCmd.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindUserCmd.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.identity.cmd;
+
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.env.Environment;
+import org.jbpm.api.identity.User;
+import org.jbpm.pvm.internal.identity.spi.IdentitySession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class FindUserCmd implements Command<User> {
+
+ private static final long serialVersionUID = 1L;
+
+ String userId;
+
+ public FindUserCmd(String userId) {
+ this.userId = userId;
+ }
+
+ public User execute(Environment environment) {
+ IdentitySession identitySession = environment.get(IdentitySession.class);
+ return identitySession.findUserById(userId);
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindUserCmd.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindUsers.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindUsers.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindUsers.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.identity.cmd;
-
-import java.util.List;
-
-import org.jbpm.api.cmd.Command;
-import org.jbpm.api.env.Environment;
-import org.jbpm.api.identity.User;
-import org.jbpm.pvm.internal.identity.spi.IdentitySession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class FindUsers implements Command<List<User>> {
-
- private static final long serialVersionUID = 1L;
-
- public List<User> execute(Environment environment) {
- IdentitySession identitySession = environment.get(IdentitySession.class);
- return identitySession.findUsers();
- }
-}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindUsersCmd.java (from rev 4573, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindUsers.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindUsersCmd.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindUsersCmd.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.identity.cmd;
+
+import java.util.List;
+
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.env.Environment;
+import org.jbpm.api.identity.User;
+import org.jbpm.pvm.internal.identity.spi.IdentitySession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class FindUsersCmd implements Command<List<User>> {
+
+ private static final long serialVersionUID = 1L;
+
+ public List<User> execute(Environment environment) {
+ IdentitySession identitySession = environment.get(IdentitySession.class);
+ return identitySession.findUsers();
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/FindUsersCmd.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/identity/impl/IdentitySessionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentitySessionImpl.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentitySessionImpl.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -66,7 +66,23 @@
}
public void deleteUser(String userId) {
+ // lookup the user
User user = findUserById(userId);
+
+ // cascade the deletion to the memberships
+ Query query = session.createQuery(
+ "from "+MembershipImpl.class.getName()+" as m "+
+ "where m.user is :user"
+ );
+ query.setEntity("user", user);
+ List<MembershipImpl> memberships = query.list();
+
+ // delete the related memberships
+ for (MembershipImpl membership: memberships) {
+ session.delete(membership);
+ }
+
+ // delete the user
session.delete(user);
}
@@ -128,7 +144,23 @@
}
public void deleteGroup(String groupId) {
+ // look up the group
GroupImpl group = findGroupById(groupId);
+
+ // cascade the deletion to the memberships
+ Query query = session.createQuery(
+ "from "+MembershipImpl.class.getName()+" as m "+
+ "where m.group is :group"
+ );
+ query.setEntity("group", group);
+ List<MembershipImpl> memberships = query.list();
+
+ // delete the related memberships
+ for (MembershipImpl membership: memberships) {
+ session.delete(membership);
+ }
+
+ // delete the group
session.delete(group);
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/UserImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/UserImpl.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/UserImpl.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -22,6 +22,7 @@
package org.jbpm.pvm.internal.identity.impl;
import java.io.Serializable;
+import java.util.Set;
import org.jbpm.api.identity.User;
@@ -41,7 +42,7 @@
protected String familyName;
protected String emailAddress;
protected String password;
-
+
public UserImpl() {
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -252,7 +252,6 @@
public ExecutionImpl destroyScope(CompositeElementImpl scope) {
destroyTimers(scope);
- destroyVariables(scope, parent);
// copy the current state from the child execution to the parent execution
getParent().setActivity(getActivity());
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeElementImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeElementImpl.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeElementImpl.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -34,22 +34,26 @@
private static final long serialVersionUID = 1L;
- protected boolean hasVariableDefinitions;
protected List<VariableDefinitionImpl> variableDefinitions;
- protected boolean hasTimerDefinitions;
protected Set<TimerDefinitionImpl> timerDefinitions;
public boolean isLocalScope() {
- return hasVariableDefinitions || hasTimerDefinitions;
+ return hasVariableDefinitions() || hasTimerDefinitions();
}
// variable definitions /////////////////////////////////////////////////////
+ public boolean hasVariableDefinitions() {
+ return ( (variableDefinitions!=null)
+ && (!variableDefinitions.isEmpty())
+ );
+ }
+
public List<VariableDefinitionImpl> getVariableDefinitions() {
- if (!hasVariableDefinitions) {
+ if (!hasVariableDefinitions()) {
return Collections.EMPTY_LIST;
}
- return (List) variableDefinitions;
+ return variableDefinitions;
}
public VariableDefinitionImpl createVariableDefinition() {
@@ -58,14 +62,19 @@
variableDefinitions = new ArrayList<VariableDefinitionImpl>();
}
variableDefinitions.add(variableDefinition);
- hasVariableDefinitions = true;
return variableDefinition;
}
// timer definitions ////////////////////////////////////////////////////////
-
+
+ public boolean hasTimerDefinitions() {
+ return ( (timerDefinitions!=null)
+ && (!timerDefinitions.isEmpty())
+ );
+ }
+
public Set<TimerDefinitionImpl> getTimerDefinitions() {
- if (!hasTimerDefinitions) {
+ if (!hasTimerDefinitions()) {
return Collections.EMPTY_SET;
}
return timerDefinitions;
@@ -77,7 +86,6 @@
timerDefinitions = new HashSet<TimerDefinitionImpl>();
}
timerDefinitions.add(timerDefinition);
- hasTimerDefinitions = true;
return timerDefinition;
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -83,26 +83,6 @@
}
}
- protected void destroyVariables(ScopeElementImpl scope, ExecutionImpl outerExecution) {
- // loop over all variable definitions
- List<VariableDefinitionImpl> variableDefinitions = scope.getVariableDefinitions();
- if (variableDefinitions!=null) {
- if (log.isTraceEnabled()) {
- log.trace("destroying var scope "+scope);
- }
-
- for (VariableDefinitionImpl variableDefinition: variableDefinitions) {
- String destination = variableDefinition.getOutVariableName();
- if (destination!=null) {
- String key = variableDefinition.getName();
- Object value = variableDefinition.getOutValue(this);
- outerExecution.setVariable(key, value);
- }
- }
- }
- }
-
-
public void createVariable(String key, Object value) {
createVariable(key, value, null);
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -39,9 +39,6 @@
private static final long serialVersionUID = 1L;
- protected long dbid;
- protected int dbversion;
-
protected String name;
protected String typeName;
@@ -49,9 +46,6 @@
protected String inExpression;
protected Descriptor inDescriptor;
- protected String outVariableName;
- protected String outExpression;
-
public Object getInValue(ExecutionImpl execution) {
if (inDescriptor!=null) {
return WireContext.create(inDescriptor);
@@ -65,19 +59,6 @@
return null;
}
- public Object getOutValue(ScopeInstanceImpl scopeInstanceImpl) {
- if (outExpression!=null) {
- throw new UnsupportedOperationException("TODO add variable out expression resolution");
- }
- if (name!=null) {
- return scopeInstanceImpl.getVariable(name);
- }
- return null;
- }
-
- public long getDbid() {
- return dbid;
- }
public String getName() {
return name;
}
@@ -102,18 +83,6 @@
public void setInDescriptor(Descriptor inDescriptor) {
this.inDescriptor = inDescriptor;
}
- public String getOutVariableName() {
- return outVariableName;
- }
- public void setOutVariableName(String outVariableName) {
- this.outVariableName = outVariableName;
- }
- public String getOutExpression() {
- return outExpression;
- }
- public void setOutExpression(String outExpression) {
- this.outExpression = outExpression;
- }
public String getTypeName() {
return typeName;
}
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionImpl.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.model;
+
+import java.io.Serializable;
+
+import org.jbpm.api.env.Environment;
+import org.jbpm.pvm.internal.script.ScriptManager;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class VariableOutDefinitionImpl implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String variableName;
+ protected String expression;
+ protected String language;
+
+ public Object getOutValue(ExecutionImpl execution) {
+ ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
+ return scriptManager.evaluateExpression(expression, execution, language);
+ }
+
+ public String getVariableName() {
+ return variableName;
+ }
+ public void setVariableName(String variableName) {
+ this.variableName = variableName;
+ }
+ public String getExpression() {
+ return expression;
+ }
+ public void setExpression(String expression) {
+ this.expression = expression;
+ }
+ public String getLanguage() {
+ return language;
+ }
+ public void setLanguage(String language) {
+ this.language = language;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionSet.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionSet.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionSet.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -0,0 +1,72 @@
+/*
+ * 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.model;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author Tom Baeyens
+ */
+public class VariableOutDefinitionSet implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected List<VariableOutDefinitionImpl> variableOutDefinitions;
+
+ protected void destroy(ExecutionImpl outerExecution) {
+ // loop over all variable definitions
+ if (hasVariableOutDefinitions()) {
+ for (VariableOutDefinitionImpl variableOutDefinition: variableOutDefinitions) {
+ String destination = variableOutDefinition.getVariableName();
+ if (destination!=null) {
+ Object value = variableOutDefinition.getOutValue(outerExecution);
+ outerExecution.setVariable(destination, value);
+ }
+ }
+ }
+ }
+
+ public boolean hasVariableOutDefinitions() {
+ return ( (variableOutDefinitions==null)
+ || (variableOutDefinitions.isEmpty())
+ );
+ }
+
+ public List<VariableOutDefinitionImpl> getVariableOutDefinitions() {
+ if (variableOutDefinitions==null) {
+ return Collections.EMPTY_LIST;
+ }
+ return variableOutDefinitions;
+ }
+
+ public VariableOutDefinitionImpl createVariableOutDefinition() {
+ VariableOutDefinitionImpl variableOutDefinition = new VariableOutDefinitionImpl();
+ if (variableOutDefinitions==null) {
+ variableOutDefinitions = new ArrayList<VariableOutDefinitionImpl>();
+ }
+ variableOutDefinitions.add(variableOutDefinition);
+ return variableOutDefinition;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableOutDefinitionSet.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/FindGroupIds.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/FindGroupIds.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/FindGroupIds.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -6,7 +6,7 @@
import org.jbpm.api.cmd.Command;
import org.jbpm.api.env.Environment;
import org.jbpm.api.identity.Group;
-import org.jbpm.pvm.internal.identity.cmd.FindGroups;
+import org.jbpm.pvm.internal.identity.cmd.FindGroupsCmd;
public class FindGroupIds implements Command<List<String>> {
@@ -22,7 +22,7 @@
public List<String> execute(Environment environment) throws Exception {
List<String> groupIds = new ArrayList<String>();
- FindGroups findGroupsCmd = new FindGroups(userId);
+ FindGroupsCmd findGroupsCmd = new FindGroupsCmd(userId);
List<Group> groups = findGroupsCmd.execute(environment);
for (Group group: groups) {
groupIds.add(group.getId());
Modified: 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/IdentityServiceImpl.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/IdentityServiceImpl.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -27,16 +27,16 @@
import org.jbpm.api.cmd.CommandService;
import org.jbpm.api.identity.Group;
import org.jbpm.api.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;
+import org.jbpm.pvm.internal.identity.cmd.CreateGroupCmd;
+import org.jbpm.pvm.internal.identity.cmd.CreateMembershipCmd;
+import org.jbpm.pvm.internal.identity.cmd.CreateUserCmd;
+import org.jbpm.pvm.internal.identity.cmd.DeleteGroupCmd;
+import org.jbpm.pvm.internal.identity.cmd.DeleteMembershipCmd;
+import org.jbpm.pvm.internal.identity.cmd.DeleteUserCmd;
+import org.jbpm.pvm.internal.identity.cmd.FindGroupCmd;
+import org.jbpm.pvm.internal.identity.cmd.FindGroupsCmd;
+import org.jbpm.pvm.internal.identity.cmd.FindUserCmd;
+import org.jbpm.pvm.internal.identity.cmd.FindUsersCmd;
/**
@@ -47,35 +47,35 @@
protected CommandService commandService;
public void createUser(String userId, String password, String givenName, String familyName) {
- commandService.execute(new CreateUser(userId, password, givenName, familyName));
+ commandService.execute(new CreateUserCmd(userId, password, givenName, familyName));
}
public User findUserById(String userId) {
- return commandService.execute(new FindUser(userId));
+ return commandService.execute(new FindUserCmd(userId));
}
public List<User> findUsers() {
- return commandService.execute(new FindUsers());
+ return commandService.execute(new FindUsersCmd());
}
public void deleteUser(String userId) {
- commandService.execute(new DeleteUser(userId));
+ commandService.execute(new DeleteUserCmd(userId));
}
public String createGroup(String groupName) {
- return commandService.execute(new CreateGroup(groupName, null, null));
+ return commandService.execute(new CreateGroupCmd(groupName, null, null));
}
public String createGroup(String groupName, String groupType) {
- return commandService.execute(new CreateGroup(groupName, groupType, null));
+ return commandService.execute(new CreateGroupCmd(groupName, groupType, null));
}
public String createGroup(String groupName, String groupType, String parentGroupId) {
- return commandService.execute(new CreateGroup(groupName, groupType, parentGroupId));
+ return commandService.execute(new CreateGroupCmd(groupName, groupType, parentGroupId));
}
public Group findGroupById(String groupId) {
- return commandService.execute(new FindGroup(groupId));
+ return commandService.execute(new FindGroupCmd(groupId));
}
public List<String> findGroupIdsByUser(String userId) {
@@ -83,27 +83,27 @@
}
public List<Group> findGroupsByUser(String userId) {
- return commandService.execute(new FindGroups(userId));
+ return commandService.execute(new FindGroupsCmd(userId));
}
public List<Group> findGroupsByUserAndGroupType(String userId, String groupType) {
- return commandService.execute(new FindGroups(userId, groupType));
+ return commandService.execute(new FindGroupsCmd(userId, groupType));
}
public void deleteGroup(String groupId) {
- commandService.execute(new DeleteGroup(groupId));
+ commandService.execute(new DeleteGroupCmd(groupId));
}
public void createMembership(String userId, String groupId) {
- commandService.execute(new CreateMembership(userId, groupId, null));
+ commandService.execute(new CreateMembershipCmd(userId, groupId, null));
}
public void createMembership(String userId, String groupId, String role) {
- commandService.execute(new CreateMembership(userId, groupId, role));
+ commandService.execute(new CreateMembershipCmd(userId, groupId, role));
}
public void deleteMembership(String userId, String groupId, String role) {
- commandService.execute(new DeleteMembership(userId, groupId, role));
+ commandService.execute(new DeleteMembershipCmd(userId, groupId, role));
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -52,11 +52,11 @@
return commandService.execute(new SaveTaskCmd((TaskImpl) task));
}
- public void cancelTask(long taskDbid) {
+ public void deleteTask(long taskDbid) {
commandService.execute(new CancelTaskCmd(taskDbid));
}
- public void cancelTask(long taskDbid, String reason) {
+ public void deleteTask(long taskDbid, String reason) {
commandService.execute(new CancelTaskCmd(taskDbid, reason));
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/DomBuilder.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/DomBuilder.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/DomBuilder.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -29,7 +29,6 @@
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.Text;
-import org.w3c.dom.UserDataHandler;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.Locator;
@@ -43,7 +42,7 @@
public Document document;
protected String lineAttributeName = "line";
- protected String columnAttributeName = null;
+ protected String columnAttributeName = "column";
/** Current activity */
protected Node currentNode = null;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parse.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parse.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parse.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -37,6 +37,7 @@
import org.jbpm.pvm.internal.stream.StringStreamInput;
import org.jbpm.pvm.internal.stream.UrlStreamInput;
import org.w3c.dom.Document;
+import org.w3c.dom.Element;
import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXParseException;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/ProblemList.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/ProblemList.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/ProblemList.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -29,6 +29,7 @@
import org.jbpm.api.JbpmException;
import org.jbpm.api.Problem;
import org.jbpm.pvm.internal.repository.DeploymentImpl;
+import org.w3c.dom.Element;
/** list of problems. Base class for {@link Parse}
* and {@link DeploymentImpl}.
@@ -43,6 +44,51 @@
protected List<ProblemImpl> problems;
+ // problem constructor method ///////////////////////////////////////////////
+
+ public void addProblem(String msg, Exception e, String severity, Element element) {
+ ProblemImpl problem = new ProblemImpl(msg, e, severity);
+
+ if (element!=null) {
+ Integer line = (Integer) element.getUserData("line");
+ if (line!=null) {
+ problem.setLine(line);
+ }
+ Integer column = (Integer) element.getUserData("column");
+ if (column!=null) {
+ problem.setColumn(column);
+ }
+ }
+
+ addProblem(problem);
+ }
+
+ // problem constructor methods with default values //////////////////////////
+
+ /** add a problem with {@link ProblemImpl#TYPE_ERROR the default severity}.*/
+ public void addProblem(String msg) {
+ addProblem(msg, null, ProblemImpl.TYPE_ERROR, null);
+ }
+
+ /** add a problem with an exception cause and
+ * {@link ProblemImpl#TYPE_ERROR the default severity}.*/
+ public void addProblem(String msg, Exception e) {
+ addProblem(msg, e, ProblemImpl.TYPE_ERROR, null);
+ }
+
+ /** add a problem with {@link ProblemImpl#TYPE_ERROR the default severity}.*/
+ public void addProblem(String msg, Element element) {
+ addProblem(msg, null, ProblemImpl.TYPE_ERROR, element);
+ }
+
+ /** add a problem with an exception cause and
+ * {@link ProblemImpl#TYPE_ERROR the default severity}.*/
+ public void addProblem(String msg, Exception e, Element element) {
+ addProblem(msg, e, ProblemImpl.TYPE_ERROR, element);
+ }
+
+ // problem mgmt methods /////////////////////////////////////////////////////
+
/** all problems encountered */
public List<Problem> getProblems() {
if (problems==null) {
@@ -59,17 +105,6 @@
problems.add(problem);
}
- /** add a problem with {@link ProblemImpl#TYPE_ERROR the default severity}.*/
- public void addProblem(String msg) {
- addProblem(msg, null);
- }
-
- /** add a problem with an exception cause and
- * {@link ProblemImpl#TYPE_ERROR the default severity}.*/
- public void addProblem(String msg, Exception e) {
- addProblem(msg, e, ProblemImpl.TYPE_ERROR);
- }
-
/** add all problems */
public void addProblems(List<Problem> problems) {
if (this.problems==null) {
@@ -78,22 +113,6 @@
this.problems.addAll((List)problems);
}
- /** adds a problem with {@link ProblemImpl#TYPE_WARNING severity warning}.*/
- public void addWarning(String msg) {
- addWarning(msg, null);
- }
-
- /** adds a problem with {@link ProblemImpl#TYPE_WARNING severity warning}
- * and an exception as the cause.*/
- public void addWarning(String msg, Exception e) {
- addProblem(msg, e, ProblemImpl.TYPE_WARNING);
- }
-
- /** adds a problem given message, exception cause and severity */
- public void addProblem(String msg, Exception e, String severity) {
- addProblem(new ProblemImpl(msg, e, severity));
- }
-
/** indicates presence of problems */
public boolean hasProblems() {
return ((problems != null) && (problems.size() > 0));
@@ -104,7 +123,7 @@
public void setProblems(List<Problem> problems) {
this.problems = (List)problems;
}
-
+
public JbpmException getJbpmException() {
if (! hasProblems()) {
return null;
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-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -21,19 +21,20 @@
*/
package org.jbpm.test;
-import org.jbpm.api.*;
-import org.jbpm.api.cmd.CommandService;
-import org.jbpm.api.job.Job;
-import org.jbpm.api.task.Task;
-import org.jbpm.test.enterprise.IntegrationTestHelper;
-
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
-import java.util.zip.ZipInputStream;
-import java.net.URL;
-import java.io.IOException;
+import org.jbpm.api.Configuration;
+import org.jbpm.api.ExecutionService;
+import org.jbpm.api.HistoryService;
+import org.jbpm.api.IdentityService;
+import org.jbpm.api.ManagementService;
+import org.jbpm.api.ProcessEngine;
+import org.jbpm.api.RepositoryService;
+import org.jbpm.api.TaskService;
+import org.jbpm.api.cmd.CommandService;
+import org.jbpm.api.task.Task;
+
/** base class for persistent jBPM tests.
*
* This class exposes a lot of extra convenience methods for testing
@@ -49,13 +50,6 @@
* empty. If not, that is logged with a F I X M E and the DB tables
* are cleaned.
*
- * Convenience method {@link #deployJpdlResource(String)} will automatically keep track
- * of the deployed process and delete it (and all the related executions)
- * before the check is done.
- *
- * Similarly, the {@link #saveAndRegisterTask(Task)} will delete
- * the task before the check is done in the tearDown.
- *
* @author Tom Baeyens
* @author Heiko Braun
*/
@@ -75,12 +69,7 @@
/** registered deployments. registered deployments will be deleted automatically
* in the tearDown. This is a convenience function as each test is expected to clean up the DB. */
protected List<Long> registeredDeployments = new ArrayList<Long>();
- /** registered tasks will be deleted automatically in the tearDown.
- * This is a convenience function as each test is expected to clean up the DB. */
- protected List<Long> registeredTaskIds = new ArrayList<Long>();
- private IntegrationTestHelper testHelper = null;
-
protected void setUp() throws Exception {
super.setUp();
initialize();
@@ -110,77 +99,19 @@
}
protected void tearDown() throws Exception {
-
for (Long deploymentDbid : registeredDeployments) {
repositoryService.deleteDeploymentCascade(deploymentDbid);
}
- for (Long taskDbid : registeredTaskIds) {
- taskService.cancelTask(taskDbid);
- }
-
Db.verifyClean(processEngine);
super.tearDown();
}
- @Deprecated
- protected void deploy(String archive) {
- if (isIntegrationTest())
- remoteDeploy(archive);
- else
- localDeploy(archive);
- }
+ // deployment helper methods ////////////////////////////////////////////////
- @Deprecated
- private void remoteDeploy(String archive) {
- try {
- getTestHelper().deploy(archive);
- } catch (Exception e) {
- throw new RuntimeException("Failed to deploy " + archive, e);
- }
- }
-
- @Deprecated
- protected void undeploy(String archive) {
- if (isIntegrationTest())
- remoteUndeploy(archive);
-
- // TODO: localUndeploy() happens in tearDown()
- }
-
- @Deprecated
- private void localUndeploy(String archive) {
- // TODO: Match archive with dbId, but for now undeploy any
- for (Long deploymentDbid : registeredDeployments) {
- repositoryService.deleteDeploymentCascade(deploymentDbid);
- }
- }
-
- @Deprecated
- private void remoteUndeploy(String archive) {
- try {
- getTestHelper().undeploy(archive);
- } catch (Exception e) {
- throw new RuntimeException("Failed to undeploy " + archive, e);
- }
- }
-
- protected IntegrationTestHelper getTestHelper() {
- if(!isIntegrationTest())
- throw new IllegalArgumentException("'jboss.bind.address' system property is missing");
-
- if(null==testHelper)
- testHelper = new IntegrationTestHelper();
-
- return testHelper;
- }
-
- @Deprecated
- public static boolean isIntegrationTest() {
- return System.getProperty("jboss.bind.address")!=null;
- }
-
+ /** deploys the process, keeps a reference to the deployment and
+ * automatically deletes the deployment in the tearDown */
public long deployJpdlXmlString(String jpdlXmlString) {
long deploymentDbid =
repositoryService.createDeployment()
@@ -192,45 +123,25 @@
return deploymentDbid;
}
- public void deployJpdlResource(String resource) {
- long deploymentDbid =
- repositoryService.createDeployment()
- .addResourceFromClasspath(resource)
- .deploy();
-
- registerDeployment(deploymentDbid);
+ /** registered deployments will be deleted in the tearDown */
+ protected void registerDeployment(long deploymentDbid) {
+ registeredDeployments.add(deploymentDbid);
}
- @Deprecated
- public void localDeploy(String archive) {
-
- URL archiveUrl = IntegrationTestHelper.getTestArchiveURL(archive);
-
- try
- {
- long deploymentDbid =
- repositoryService.createDeployment()
- .addResourcesFromZipInputStream(new ZipInputStream(archiveUrl.openStream()))
- .deploy();
-
- registerDeployment(deploymentDbid);
+ // task helper methods //////////////////////////////////////////////////////
+
+ public static void assertContainsTask(List<Task> taskList, String taskName) {
+ if (getTask(taskList, taskName)==null) {
+ fail("tasklist doesn't contain task '"+taskName+"': "+taskList);
}
- catch (IOException e)
- {
- throw new RuntimeException("local deploy failed", e);
- }
}
- protected void registerDeployment(long deploymentDbid) {
- registeredDeployments.add(deploymentDbid);
+ public static void assertContainsTask(List<Task> taskList, String taskName, String assignee) {
+ if (getTask(taskList, taskName, assignee)==null) {
+ fail("tasklist doesn't contain task '"+taskName+"' for assignee '"+assignee+"': "+taskList);
+ }
}
- public long saveAndRegisterTask(Task task) {
- long taskDbid = taskService.saveTask(task);
- registeredTaskIds.add(taskDbid);
- return taskDbid;
- }
-
public static Task getTask(List<Task> taskList, String taskName) {
for (Task task : taskList) {
if (taskName.equals(task.getName())) {
@@ -239,13 +150,7 @@
}
return null;
}
-
- public static void assertContainsTask(List<Task> taskList, String taskName) {
- if (getTask(taskList, taskName)==null) {
- fail("tasklist doesn't contain task '"+taskName+"': "+taskList);
- }
- }
-
+
public static Task getTask(List<Task> taskList, String taskName, String assignee) {
for (Task task : taskList) {
if (taskName.equals(task.getName())) {
@@ -262,28 +167,4 @@
}
return null;
}
-
- public void executeAsyncMessage(Execution execution) {
- List<Job> jobs = managementService
- .createJobQuery()
- .messages()
- .processInstanceId(execution.getId())
- .list();
-
- if (jobs.isEmpty()) {
- fail("no async message");
- }
-
- if (jobs.size()>1) {
- fail("more then one async message");
- }
-
- managementService.executeJob(jobs.get(0).getDbid());
- }
-
- public static void assertContainsTask(List<Task> taskList, String taskName, String assignee) {
- if (getTask(taskList, taskName, assignee)==null) {
- fail("tasklist doesn't contain task '"+taskName+"' for assignee '"+assignee+"': "+taskList);
- }
- }
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/eventlistener/HqlEventListenerTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/eventlistener/HqlEventListenerTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/eventlistener/HqlEventListenerTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -11,6 +11,38 @@
public class HqlEventListenerTest extends JbpmTestCase {
+ long taskLaundryDbid;
+ long taskDishesDbid;
+ long taskIronDbid;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ // add task laundry
+ Task task = taskService.newTask();
+ task.setName("laundry");
+ taskLaundryDbid = taskService.saveTask(task);
+
+ // add task dishes
+ task = taskService.newTask();
+ task.setName("dishes");
+ taskDishesDbid = taskService.saveTask(task);
+
+ // add task iron
+ task = taskService.newTask();
+ task.setName("iron");
+ taskIronDbid = taskService.saveTask(task);
+ }
+
+ protected void tearDown() throws Exception {
+ taskService.deleteTask(taskLaundryDbid);
+ taskService.deleteTask(taskDishesDbid);
+ taskService.deleteTask(taskIronDbid);
+
+ super.tearDown();
+ }
+
+
public void testHql() {
deployJpdlXmlString(
"<process name='HqlEventListener' xmlns='http://jbpm.org/4/jpdl'>" +
@@ -34,21 +66,6 @@
"</process>"
);
- // add task laundry
- Task task = taskService.newTask();
- task.setName("laundry");
- saveAndRegisterTask(task);
-
- // add task dishes
- task = taskService.newTask();
- task.setName("dishes");
- saveAndRegisterTask(task);
-
- // add task iron
- task = taskService.newTask();
- task.setName("iron");
- saveAndRegisterTask(task);
-
Execution execution = executionService.startProcessInstanceByKey("HqlEventListener");
String executionId = execution.getId();
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -39,13 +39,6 @@
public class DeploymentResourcesTest extends JbpmTestCase {
public void testProcessWithNameOnly() {
-
- if(isIntegrationTest())
- {
- // Not part of the integration test suite
- return;
- }
-
byte[] lotOfBytes = generateString("a lot of bytes ", 5000).getBytes();
byte[] otherBytes = generateString("other bytes ", 5000).getBytes();
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/SubTaskTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/SubTaskTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/SubTaskTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -41,7 +41,7 @@
Task task = taskService.newTask();
task.setName("clean da house");
- long taskDbid = saveAndRegisterTask(task);
+ long taskDbid = taskService.saveTask(task);
// create 3 sub tasks:
// * clean da house
@@ -116,7 +116,7 @@
assertEquals(expectedTaskNames, subTaskNames);
// delete task dishes
- taskService.cancelTask(dishesTaskDbid);
+ taskService.deleteTask(dishesTaskDbid);
// verify all the sub tasks of 'clean da house' and 'sweep floor'
@@ -139,8 +139,8 @@
// delete laundry and delete sweep floor
// NOTE: deleting sweep floor should recursively delete the subtasks
- taskService.cancelTask(laundryTaskDbid);
- taskService.cancelTask(sweepFloorTaskDbid);
+ taskService.deleteTask(laundryTaskDbid);
+ taskService.deleteTask(sweepFloorTaskDbid);
subTaskNames = getTaskNames(taskService.getSubTasks(taskDbid));
@@ -151,6 +151,8 @@
expectedTaskNames = new HashSet<String>();
assertEquals(expectedTaskNames, subTaskNames);
+
+ taskService.deleteTask(taskDbid);
}
private Set<String> getTaskNames(List<Task> tasks) {
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCommentsTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCommentsTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCommentsTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -67,6 +67,6 @@
// the following should delete the remaining comment. if not, this
// will show up as a fixme.
- taskService.cancelTask(taskDbid);
+ taskService.deleteTask(taskDbid);
}
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCreateUpdateDeleteTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCreateUpdateDeleteTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCreateUpdateDeleteTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -41,7 +41,7 @@
public void testSaveTask() {
Task task = taskService.newTask();
- long taskDbid = saveAndRegisterTask(task);
+ long taskDbid = taskService.saveTask(task);
// task was made persistent
task = taskService.getTask(taskDbid);
assertNotNull("expected non-null task", task);
@@ -55,6 +55,8 @@
// task.getDueDate() return an java.sql.Timestamp
DateFormat df = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG);
assertEquals(df.format(dueDate), df.format(task.getDueDate()));
+
+ taskService.deleteTask(taskDbid);
}
public void testDeleteTask() {
@@ -64,7 +66,7 @@
// task was made persistent
assertNotNull("expected non-null task", taskService.getTask(taskDbid));
// delete task and verify it does not exist
- taskService.cancelTask(taskDbid);
+ taskService.deleteTask(taskDbid);
task = taskService.getTask(taskDbid);
assertNull("expected null, but was " + task, task);
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskHandlerTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskHandlerTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskHandlerTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -138,7 +138,7 @@
Task task = taskService.createTaskQuery().list().get(0);
long taskDbid = task.getDbid();
- taskService.cancelTask(taskDbid);
+ taskService.deleteTask(taskDbid);
assertTrue(isTaskCancelCalled);
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskListTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskListTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskListTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -40,22 +40,22 @@
Task task = taskService.newTask();
task.setName("do laundry");
task.setAssignee("johndoe");
- saveAndRegisterTask(task);
+ long laundryTaskDbid = taskService.saveTask(task);
task = taskService.newTask();
task.setName("get good idea");
task.setAssignee("joesmoe");
- saveAndRegisterTask(task);
+ long ideaTaskDbid = taskService.saveTask(task);
task = taskService.newTask();
task.setName("find venture capital");
task.setAssignee("joesmoe");
- saveAndRegisterTask(task);
+ long capitalTaskDbid = taskService.saveTask(task);
task = taskService.newTask();
task.setName("start new business");
task.setAssignee("joesmoe");
- saveAndRegisterTask(task);
+ long startBusinessTaskDbid = taskService.saveTask(task);
List<Task> taskList = taskService.findAssignedTasks("johndoe");
assertNotNull(taskList);
@@ -71,6 +71,11 @@
assertContainsTask(taskList, "find venture capital");
assertEquals(3, taskList.size());
+
+ taskService.deleteTask(startBusinessTaskDbid);
+ taskService.deleteTask(capitalTaskDbid);
+ taskService.deleteTask(ideaTaskDbid);
+ taskService.deleteTask(laundryTaskDbid);
}
public void testPersonalTaskListDefaultSortOrder() {
@@ -78,31 +83,31 @@
task.setName("get good idea");
task.setAssignee("joesmoe");
task.setPriority(3);
- saveAndRegisterTask(task);
+ long ideaTaskDbid = taskService.saveTask(task);
task = taskService.newTask();
task.setName("find venture capital");
task.setAssignee("joesmoe");
task.setPriority(2);
- saveAndRegisterTask(task);
+ long capitalTaskDbid = taskService.saveTask(task);
task = taskService.newTask();
task.setName("start new business");
task.setAssignee("joesmoe");
task.setPriority(1);
- saveAndRegisterTask(task);
+ long startBusinessTaskDbid = taskService.saveTask(task);
task = taskService.newTask();
task.setName("take a day off");
task.setAssignee("joesmoe");
task.setPriority(-5);
- saveAndRegisterTask(task);
+ long dayOffTaskDbid = taskService.saveTask(task);
task = taskService.newTask();
task.setName("make profit");
task.setAssignee("joesmoe");
task.setPriority(10);
- saveAndRegisterTask(task);
+ long profitTaskDbid = taskService.saveTask(task);
List<Task> taskList = taskService.findAssignedTasks("joesmoe");
assertNotNull(taskList);
@@ -115,5 +120,11 @@
assertEquals("take a day off", taskList.get(4).getName());
assertEquals(5, taskList.size());
+
+ taskService.deleteTask(profitTaskDbid);
+ taskService.deleteTask(dayOffTaskDbid);
+ taskService.deleteTask(startBusinessTaskDbid);
+ taskService.deleteTask(capitalTaskDbid);
+ taskService.deleteTask(ideaTaskDbid);
}
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskParticipationsTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskParticipationsTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskParticipationsTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -38,7 +38,7 @@
public void testTaskParticipants() {
Task task = taskService.newTask();
task.setName("do laundry");
- long taskDbid = saveAndRegisterTask(task);
+ long taskDbid = taskService.saveTask(task);
taskService.addTaskParticipatingUser(taskDbid, "johndoe", Participation.CANDIDATE);
taskService.addTaskParticipatingUser(taskDbid, "joesmoe", Participation.CANDIDATE);
@@ -92,6 +92,8 @@
expectedIds.add("dummies");
assertEquals(expectedIds, candidateGroupIds);
+
+ taskService.deleteTask(taskDbid);
}
public Set<String> extractParticipatingUserIds(List<Participation> taskParticipations, String participationType) {
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryTest.java 2009-04-17 20:12:41 UTC (rev 4577)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryTest.java 2009-04-18 17:43:48 UTC (rev 4578)
@@ -38,24 +38,24 @@
task.setName("do laundry");
task.setAssignee("johndoe");
task.setPriority(3);
- saveAndRegisterTask(task);
+ long laudryTaskDbid = taskService.saveTask(task);
task = taskService.newTask();
task.setName("change dyper");
task.setAssignee("johndoe");
task.setPriority(1);
- saveAndRegisterTask(task);
+ long dyperTaskDbid = taskService.saveTask(task);
task = taskService.newTask();
task.setName("start new business");
task.setAssignee("joesmoe");
task.setPriority(4);
- saveAndRegisterTask(task);
+ long startBusinessTaskDbid = taskService.saveTask(task);
task = taskService.newTask();
task.setName("find venture capital");
task.setPriority(4);
- saveAndRegisterTask(task);
+ long capitalTaskDbid = taskService.saveTask(task);
List<Task> taskList = taskService
.createTaskQuery()
@@ -68,6 +68,11 @@
assertContainsTask(taskList, "find venture capital");
assertEquals(4, taskList.size());
+
+ taskService.deleteTask(capitalTaskDbid);
+ taskService.deleteTask(startBusinessTaskDbid);
+ taskService.deleteTask(dyperTaskDbid);
+ taskService.deleteTask(laudryTaskDbid);
}
public void testSimplestTaskQuerySortBy() {
@@ -75,24 +80,24 @@
task.setName("do laundry");
task.setAssignee("johndoe");
task.setPriority(3);
- saveAndRegisterTask(task);
+ long laudryTaskDbid = taskService.saveTask(task);
task = taskService.newTask();
task.setName("change dyper");
task.setAssignee("johndoe");
task.setPriority(1);
- saveAndRegisterTask(task);
+ long dyperTaskDbid = taskService.saveTask(task);
task = taskService.newTask();
task.setName("start new business");
task.setAssignee("joesmoe");
task.setPriority(4);
- saveAndRegisterTask(task);
+ long startBusinessTaskDbid = taskService.saveTask(task);
task = taskService.newTask();
task.setName("find venture capital");
task.setPriority(7);
- saveAndRegisterTask(task);
+ long capitalTaskDbid = taskService.saveTask(task);
List<Task> taskList = taskService
.createTaskQuery()
@@ -106,6 +111,11 @@
assertEquals("start new business", taskList.get(3).getName());
assertEquals(4, taskList.size());
+
+ taskService.deleteTask(capitalTaskDbid);
+ taskService.deleteTask(startBusinessTaskDbid);
+ taskService.deleteTask(dyperTaskDbid);
+ taskService.deleteTask(laudryTaskDbid);
}
}
17 years
JBoss JBPM SVN: r4577 - in jbpm4/trunk/modules: api/src/main/java/org/jbpm/api/model and 6 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-04-17 16:12:41 -0400 (Fri, 17 Apr 2009)
New Revision: 4577
Added:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/model/ActivityCoordinates.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetActivityCoordinates.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ActivityCoordinatesImpl.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/ActivityCoordinatesTest.java
Removed:
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/states/
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/RepositoryService.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ActivityImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/CompositeElementImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java
Log:
JBPM-2177 added activity coordinates retrieval through api
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/RepositoryService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/RepositoryService.java 2009-04-17 15:36:53 UTC (rev 4576)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/RepositoryService.java 2009-04-17 20:12:41 UTC (rev 4577)
@@ -23,7 +23,9 @@
import java.io.InputStream;
+import org.jbpm.api.model.ActivityCoordinates;
+
/**
* @author Tom Baeyens
*/
@@ -37,5 +39,7 @@
InputStream getResourceAsStream(long deploymentDbid, String resourceName);
ProcessDefinitionQuery createProcessDefinitionQuery();
+
+ ActivityCoordinates getActivityCoordinates(String processDefinitionId, String activityName);
}
Added: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/model/ActivityCoordinates.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/model/ActivityCoordinates.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/model/ActivityCoordinates.java 2009-04-17 20:12:41 UTC (rev 4577)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.api.model;
+
+/** activity coordinates indicating the graphical position in the diagram.
+ *
+ * @author Tom Baeyens
+ */
+public interface ActivityCoordinates {
+
+ int getX();
+
+ int getY();
+
+ int getWidth();
+
+ int getHeight();
+
+}
\ No newline at end of file
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/model/ActivityCoordinates.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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-04-17 15:36:53 UTC (rev 4576)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-04-17 20:12:41 UTC (rev 4577)
@@ -29,6 +29,7 @@
import java.util.Enumeration;
import java.util.List;
import java.util.Set;
+import java.util.StringTokenizer;
import org.jbpm.api.activity.ActivityBehaviour;
import org.jbpm.api.env.Environment;
@@ -36,6 +37,7 @@
import org.jbpm.internal.log.Log;
import org.jbpm.jpdl.internal.activity.JpdlBinding;
import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
+import org.jbpm.pvm.internal.model.ActivityCoordinatesImpl;
import org.jbpm.pvm.internal.model.ActivityImpl;
import org.jbpm.pvm.internal.model.EventImpl;
import org.jbpm.pvm.internal.model.ObservableElementImpl;
@@ -234,16 +236,37 @@
parseOnEvents(element, parse, activity);
+ String g = XmlUtil.attribute(element, "g");
+ if (g!=null) {
+ StringTokenizer stringTokenizer = new StringTokenizer(g, ",");
+ ActivityCoordinatesImpl coordinates = null;
+ if (stringTokenizer.countTokens()==4) {
+ try {
+ int x = Integer.parseInt(stringTokenizer.nextToken());
+ int y = Integer.parseInt(stringTokenizer.nextToken());
+ int width = Integer.parseInt(stringTokenizer.nextToken());
+ int height = Integer.parseInt(stringTokenizer.nextToken());
+ coordinates = new ActivityCoordinatesImpl(x, y, width, height);
+ } catch (NumberFormatException e) {
+ coordinates = null;
+ }
+ }
+ if (coordinates!=null) {
+ activity.setCoordinates(coordinates);
+ } else {
+ parse.addProblem("invalid coordinates g=\""+g+"\" in "+activity);
+ }
+ }
} finally {
parse.popObject();
}
} else {
log.debug("unrecognized activity: "+XmlUtil.getTagLocalName(element));
}
+ }
}
- }
}
-
+
public TimerDefinitionImpl parseTimerDefinition(Element timerElement, Parse parse, ScopeElementImpl scopeElement) {
TimerDefinitionImpl timerDefinition = scopeElement.createTimerDefinition();
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetActivityCoordinates.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetActivityCoordinates.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetActivityCoordinates.java 2009-04-17 20:12:41 UTC (rev 4577)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.cmd;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.env.Environment;
+import org.jbpm.api.model.ActivityCoordinates;
+import org.jbpm.api.session.RepositorySession;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class GetActivityCoordinates implements Command<ActivityCoordinates> {
+
+ private static final long serialVersionUID = 1L;
+
+ String processDefinitionId;
+ String activityName;
+
+ public GetActivityCoordinates(String processDefinitionId, String activityName) {
+ this.processDefinitionId = processDefinitionId;
+ this.activityName = activityName;
+ }
+
+ public ActivityCoordinates execute(Environment environment) throws Exception {
+ RepositorySession repositorySession = environment.get(RepositorySession.class);
+ ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) repositorySession.loadProcessDefinitionById(processDefinitionId);
+ if (processDefinition==null) {
+ throw new JbpmException("process definition "+processDefinitionId+" doesn't exist");
+ }
+ ActivityImpl activity = processDefinition.findActivity(activityName);
+ if (activity==null) {
+ throw new JbpmException("activity '"+activityName+"' doesn't exist in process definition "+processDefinitionId);
+ }
+ return activity.getCoordinates();
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetActivityCoordinates.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ActivityCoordinatesImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ActivityCoordinatesImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ActivityCoordinatesImpl.java 2009-04-17 20:12:41 UTC (rev 4577)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.model;
+
+import java.io.Serializable;
+
+import org.jbpm.api.model.ActivityCoordinates;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ActivityCoordinatesImpl implements Serializable, ActivityCoordinates {
+
+ private static final long serialVersionUID = 1L;
+
+ int x;
+ int y;
+ int width;
+ int height;
+
+ public ActivityCoordinatesImpl(int x, int y, int width, int height) {
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
+ }
+
+ public int getX() {
+ return x;
+ }
+
+ public int getY() {
+ return y;
+ }
+
+ public int getWidth() {
+ return width;
+ }
+
+ public int getHeight() {
+ return height;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ActivityCoordinatesImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ActivityImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ActivityImpl.java 2009-04-17 15:36:53 UTC (rev 4576)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ActivityImpl.java 2009-04-17 20:12:41 UTC (rev 4577)
@@ -50,6 +50,8 @@
protected boolean isSignalAsync;
protected boolean isLeaveAsync;
protected boolean isPreviousNeeded;
+
+ protected ActivityCoordinatesImpl coordinates;
transient protected Map<String, TransitionImpl> outgoingTransitionsMap;
@@ -483,4 +485,10 @@
public void setType(String type) {
this.type = type;
}
+ public ActivityCoordinatesImpl getCoordinates() {
+ return coordinates;
+ }
+ public void setCoordinates(ActivityCoordinatesImpl coordinates) {
+ this.coordinates = coordinates;
+ }
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/CompositeElementImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/CompositeElementImpl.java 2009-04-17 15:36:53 UTC (rev 4576)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/CompositeElementImpl.java 2009-04-17 20:12:41 UTC (rev 4577)
@@ -139,7 +139,7 @@
* Beware: the actual member is returned. No copy is made.
*/
public Map<String, Activity> getActivitiesMap() {
- if(activitiesMap == null){
+ if (activitiesMap == null) {
this.activitiesMap = ActivityImpl.getActivitiesMap(activities);
}
return (Map) activitiesMap;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java 2009-04-17 15:36:53 UTC (rev 4576)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java 2009-04-17 20:12:41 UTC (rev 4577)
@@ -27,7 +27,9 @@
import org.jbpm.api.ProcessDefinitionQuery;
import org.jbpm.api.RepositoryService;
import org.jbpm.api.cmd.CommandService;
+import org.jbpm.api.model.ActivityCoordinates;
import org.jbpm.pvm.internal.cmd.DeleteDeploymentCmd;
+import org.jbpm.pvm.internal.cmd.GetActivityCoordinates;
import org.jbpm.pvm.internal.cmd.GetResourceAsStreamCmd;
import org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl;
@@ -58,4 +60,7 @@
return new ProcessDefinitionQueryImpl(commandService);
}
+ public ActivityCoordinates getActivityCoordinates(String processDefinitionId, String activityName) {
+ return commandService.execute(new GetActivityCoordinates(processDefinitionId, activityName));
+ }
}
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/ActivityCoordinatesTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/ActivityCoordinatesTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/ActivityCoordinatesTest.java 2009-04-17 20:12:41 UTC (rev 4577)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.process;
+
+import org.jbpm.api.model.ActivityCoordinates;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ActivityCoordinatesTest extends JbpmTestCase {
+
+ public void testActivityCoordinates() {
+ deployJpdlXmlString(
+ "<process name='ActivityCoordinatesProcess'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a' g='96,16,75,52' />" +
+ "</process>"
+ );
+
+ String processDefinitionId = repositoryService.createProcessDefinitionQuery()
+ .key("ActivityCoordinatesProcess")
+ .uniqueResult()
+ .getId();
+
+ ActivityCoordinates activityCoordinates = repositoryService.getActivityCoordinates(processDefinitionId, "a");
+ assertEquals(96, activityCoordinates.getX());
+ assertEquals(16, activityCoordinates.getY());
+ assertEquals(75, activityCoordinates.getWidth());
+ assertEquals(52, activityCoordinates.getHeight());
+ }
+
+ public void testUnexistingCoordinates() {
+ deployJpdlXmlString(
+ "<process name='ActivityCoordinatesProcess'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a' />" +
+ "</process>"
+ );
+
+ String processDefinitionId = repositoryService.createProcessDefinitionQuery()
+ .key("ActivityCoordinatesProcess")
+ .uniqueResult()
+ .getId();
+
+ ActivityCoordinates activityCoordinates = repositoryService.getActivityCoordinates(processDefinitionId, "a");
+ assertNull(activityCoordinates);
+ }
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/ActivityCoordinatesTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
17 years
JBoss JBPM SVN: r4576 - in jbpm4/trunk/modules: api/src/main/resources and 17 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-04-17 11:36:53 -0400 (Fri, 17 Apr 2009)
New Revision: 4576
Added:
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/businesstime/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/businesstime/TimerBusinessTimeTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/event/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/event/Escalate.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/event/TimerEventTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/repeat/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/repeat/Escalate.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/repeat/TimerRepeatTest.java
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/businesstime/
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/businesstime/process.jpdl.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/event/
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/event/process.jpdl.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/repeat/
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/repeat/process.jpdl.xml
jbpm4/trunk/modules/userguide/src/main/docbook/en/images/process.timer.event.png
jbpm4/trunk/modules/userguide/src/main/docbook/en/images/process.timer.transition.png
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Execution.java
jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/JohnDoe.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/transition/process.jpdl.xml
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/mgmt/JobQueryTest.java
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml
Log:
JBPM-2029 timers examples and docs
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Execution.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Execution.java 2009-04-17 09:23:24 UTC (rev 4575)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Execution.java 2009-04-17 15:36:53 UTC (rev 4576)
@@ -24,6 +24,7 @@
import java.io.Serializable;
import java.util.Collection;
import java.util.Map;
+import java.util.Set;
import org.jbpm.api.client.ClientExecution;
import org.jbpm.api.client.ClientProcessDefinition;
@@ -195,5 +196,13 @@
/** indicates if this execution has a child execution with the given executionName */
boolean hasExecution(String executionName);
+ /** search for an execution that is active and in the given activityName.
+ * Returns null in case there is no such execution.
+ * @see #findActiveActivityNames() */
Execution findActiveExecutionIn(String activityName);
+
+ /** get the set of all activities that are active.
+ * Returns an empty set in case there are no activities active.
+ * @see #findActiveExecutionIn(String) */
+ Set<String> findActiveActivityNames();
}
Modified: jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd
===================================================================
--- jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd 2009-04-17 09:23:24 UTC (rev 4575)
+++ jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd 2009-04-17 15:36:53 UTC (rev 4576)
@@ -152,8 +152,17 @@
<complexType>
<sequence>
<element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ <element name="transition" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <complexContent>
+ <extension base="tns:transitionType">
+ <sequence>
+ <element ref="tns:timer" minOccurs="0" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
</sequence>
<attributeGroup ref="tns:activityAttributes" />
</complexType>
@@ -322,7 +331,17 @@
<element name="assignment-handler" minOccurs="0" type="tns:wireObjectType" />
<element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
<element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ <element name="transition" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <complexContent>
+ <extension base="tns:transitionType">
+ <sequence>
+ <element ref="tns:timer" minOccurs="0" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
</sequence>
<attributeGroup ref="tns:activityAttributes" />
<attributeGroup ref="tns:assignmentAttributes"/>
@@ -611,6 +630,7 @@
<element name="on">
<complexType>
<sequence>
+ <element ref="tns:timer" minOccurs="0" />
<group ref="tns:eventListenerGroup" minOccurs="0" maxOccurs="unbounded">
<annotation><documentation>A list of event listeners that will
be notified when the event is fired</documentation></annotation>
@@ -632,15 +652,6 @@
be notified when the timer fires</documentation></annotation>
</group>
</sequence>
- <attribute name="event" type="string">
- <annotation><documentation>The event identification for this timer event.
- </documentation></annotation>
- </attribute>
- <attribute name="transition" type="string">
- <annotation><documentation>The name of the outgoing transition that must be
- taken when this timer fires.
- </documentation></annotation>
- </attribute>
<attribute name="duedate" type="string">
<annotation><documentation>Timer duedate expression that defines the duedate of this
timer relative to the creation time of the timer. E.g. '2 hours' or '4 business days'
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/JohnDoe.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/JohnDoe.java 2009-04-17 09:23:24 UTC (rev 4575)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/JohnDoe.java 2009-04-17 15:36:53 UTC (rev 4576)
@@ -21,9 +21,6 @@
*/
package org.jbpm.examples.java;
-import org.hibernate.Session;
-
-
/**
* @author Tom Baeyens
*/
Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/businesstime/TimerBusinessTimeTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/businesstime/TimerBusinessTimeTest.java (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/businesstime/TimerBusinessTimeTest.java 2009-04-17 15:36:53 UTC (rev 4576)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.examples.timer.businesstime;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.job.Job;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TimerBusinessTimeTest extends JbpmTestCase {
+
+ static long HOUR_IN_MILLIS = 60*60*100;
+
+ public void testBusinessTime() {
+ deployJpdlResource("org/jbpm/examples/timer/businesstime/process.jpdl.xml");
+
+ long now = System.currentTimeMillis();
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("TimerBusinessTime");
+
+ Job job = managementService.createJobQuery()
+ .processInstanceId(processInstance.getId())
+ .uniqueResult();
+
+ long difference = job.getDueDate().getTime() - now;
+
+ // we do not know when this test will be run. So the exact actual duedate of the timer
+ // can not be calculated easily. But we do know for sure that each working day only
+ // has 8 business hours. So we know that 9 business hours later always means at
+ // least 24 hours later
+ assertTrue( 24 * HOUR_IN_MILLIS < difference );
+ }
+}
Property changes on: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/businesstime/TimerBusinessTimeTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/event/Escalate.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/event/Escalate.java (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/event/Escalate.java 2009-04-17 15:36:53 UTC (rev 4576)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.examples.timer.event;
+
+import org.jbpm.api.listener.EventListener;
+import org.jbpm.api.listener.EventListenerExecution;
+
+/**
+ * @author Tom Baeyens
+ */
+public class Escalate implements EventListener {
+
+ private static final long serialVersionUID = 1L;
+
+ public void notify(EventListenerExecution execution) {
+ execution.setVariable("escalation", Boolean.TRUE);
+ }
+}
Property changes on: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/event/Escalate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/event/TimerEventTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/event/TimerEventTest.java (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/event/TimerEventTest.java 2009-04-17 15:36:53 UTC (rev 4576)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.examples.timer.event;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.job.Job;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TimerEventTest extends JbpmTestCase {
+
+ public void testTimerEventTimerFires() {
+ deployJpdlResource("org/jbpm/examples/timer/event/process.jpdl.xml");
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("TimerEvent");
+
+ Job job = managementService.createJobQuery()
+ .processInstanceId(processInstance.getId())
+ .uniqueResult();
+
+ managementService.executeJob(job.getDbid());
+
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+
+ Set<String> expectedActivityNames = new HashSet<String>();
+ expectedActivityNames.add("guardedWait");
+ assertEquals(expectedActivityNames, processInstance.findActiveActivityNames());
+
+ assertEquals(Boolean.TRUE, executionService.getVariable(processInstance.getId(), "escalation"));
+ }
+
+ public void testTimerEventContinueBeforeTimerFires() {
+ deployJpdlResource("org/jbpm/examples/timer/event/process.jpdl.xml");
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("TimerEvent");
+
+ String executionId = processInstance.findActiveExecutionIn("guardedWait").getId();
+
+ executionService.signalExecutionById(executionId, "go on");
+
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+
+ assertEquals("next step", processInstance.getActivityName());
+
+ List<Job> jobs = managementService.createJobQuery()
+ .processInstanceId(processInstance.getId())
+ .list();
+
+ assertEquals(new ArrayList<Job>(), new ArrayList<Job>(jobs));
+ }
+}
Property changes on: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/event/TimerEventTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/repeat/Escalate.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/repeat/Escalate.java (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/repeat/Escalate.java 2009-04-17 15:36:53 UTC (rev 4576)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.examples.timer.repeat;
+
+import org.jbpm.api.listener.EventListener;
+import org.jbpm.api.listener.EventListenerExecution;
+
+/**
+ * @author Tom Baeyens
+ */
+public class Escalate implements EventListener {
+
+ private static final long serialVersionUID = 1L;
+
+ public void notify(EventListenerExecution execution) {
+ Integer escalations = (Integer) execution.getVariable("escalations");
+ if (escalations==null) {
+ execution.setVariable("escalations", 1);
+ } else {
+ execution.setVariable("escalations", escalations+1);
+ }
+ }
+}
Property changes on: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/repeat/Escalate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/repeat/TimerRepeatTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/repeat/TimerRepeatTest.java (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/repeat/TimerRepeatTest.java 2009-04-17 15:36:53 UTC (rev 4576)
@@ -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.timer.repeat;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.job.Job;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TimerRepeatTest extends JbpmTestCase {
+
+ public void testTimerRepeat() {
+ deployJpdlResource("org/jbpm/examples/timer/repeat/process.jpdl.xml");
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("TimerRepeat");
+
+ Job job = managementService.createJobQuery()
+ .processInstanceId(processInstance.getId())
+ .uniqueResult();
+
+ assertNull(executionService.getVariable(processInstance.getId(), "escalations"));
+
+ managementService.executeJob(job.getDbid());
+
+ assertEquals(1, executionService.getVariable(processInstance.getId(), "escalations"));
+
+ job = managementService.createJobQuery()
+ .processInstanceId(processInstance.getId())
+ .uniqueResult();
+
+ assertNotNull(job);
+
+ managementService.executeJob(job.getDbid());
+
+ assertEquals(2, executionService.getVariable(processInstance.getId(), "escalations"));
+
+ job = managementService.createJobQuery()
+ .processInstanceId(processInstance.getId())
+ .uniqueResult();
+
+ assertNotNull(job);
+
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+ String processInstanceId = processInstance.findActiveExecutionIn("guardedWait").getId();
+ executionService.signalExecutionById(processInstanceId, "go on");
+
+ job = managementService.createJobQuery()
+ .processInstanceId(processInstance.getId())
+ .uniqueResult();
+
+ assertNull(job);
+ }
+}
Property changes on: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/repeat/TimerRepeatTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java 2009-04-17 09:23:24 UTC (rev 4575)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java 2009-04-17 15:36:53 UTC (rev 4576)
@@ -1,3 +1,24 @@
+/*
+ * 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.timer.transition;
import java.util.ArrayList;
@@ -7,7 +28,9 @@
import org.jbpm.api.job.Job;
import org.jbpm.test.JbpmTestCase;
-
+/**
+ * @author Tom Baeyens
+ */
public class TimerTransitionTest extends JbpmTestCase {
public void testTimerTransitionTimerFires() {
@@ -16,6 +39,7 @@
Execution processInstance = executionService.startProcessInstanceByKey("TimerTransition");
Job job = managementService.createJobQuery()
+ .timers()
.processInstanceId(processInstance.getId())
.uniqueResult();
@@ -26,7 +50,7 @@
assertEquals("escalation", processInstance.getActivityName());
}
- public void testTimerTransitionTakeTransition() {
+ public void testTimerTransitionContinueBeforeTimerFires() {
deployJpdlResource("org/jbpm/examples/timer/transition/process.jpdl.xml");
Execution processInstance = executionService.startProcessInstanceByKey("TimerTransition");
Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/businesstime/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/businesstime/process.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/businesstime/process.jpdl.xml 2009-04-17 15:36:53 UTC (rev 4576)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="TimerBusinessTime" xmlns="http://jbpm.org/4/jpdl">
+
+ <start g="19,50,48,48">
+ <transition to="guardedWait" />
+ </start>
+
+ <state name="guardedWait" g="98,46,127,52">
+ <transition name="go on" to="next step" g="-16,-17" />
+ <transition name="timeout" to="escalation" g="-43,-16">
+ <timer duedate="9 business hours" />
+ </transition>
+ </state>
+
+ <state name="next step" g="283,46,83,53" />
+ <state name="escalation" g="118,140,88,52" />
+
+</process>
Property changes on: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/businesstime/process.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/event/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/event/process.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/event/process.jpdl.xml 2009-04-17 15:36:53 UTC (rev 4576)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="TimerEvent" xmlns="http://jbpm.org/4/jpdl">
+
+ <start g="19,50,48,48">
+ <transition to="guardedWait" />
+ </start>
+
+ <state name="guardedWait" g="98,46,127,52">
+ <on event="timeout">
+ <timer duedate="10 minutes"/>
+ <event-listener class="org.jbpm.examples.timer.event.Escalate" />
+ </on>
+ <transition name="go on" to="next step" g="-16,-17" />
+ </state>
+
+ <state name="next step" g="283,46,83,53" />
+
+</process>
Property changes on: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/event/process.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/repeat/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/repeat/process.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/repeat/process.jpdl.xml 2009-04-17 15:36:53 UTC (rev 4576)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="TimerRepeat" xmlns="http://jbpm.org/4/jpdl">
+
+ <start g="19,50,48,48">
+ <transition to="guardedWait" />
+ </start>
+
+ <state name="guardedWait" g="98,46,127,52">
+ <on event="timeout">
+ <timer duedate="20 minutes" repeat="10 seconds" />
+ <event-listener class="org.jbpm.examples.timer.repeat.Escalate" />
+ </on>
+ <transition name="go on" to="next step" g="-16,-17"/>
+ </state>
+
+ <state name="next step" g="283,46,83,53"/>
+
+</process>
Property changes on: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/repeat/process.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/transition/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/transition/process.jpdl.xml 2009-04-17 09:23:24 UTC (rev 4575)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/transition/process.jpdl.xml 2009-04-17 15:36:53 UTC (rev 4576)
@@ -1,18 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
-<process name="TimerTransition" xmlns="http://jbpm.org/4/jpdl">
-
- <start g="20,20,48,48">
- <transition to="guardedWait" />
- </start>
-
- <state name="guardedWait" g="96,16,127,52">
- <timer duedate="10 minutes" transition="timout" />
- <transition name="go on" to="next step" />
- <transition name="timout" to="escalation" />
- </state>
-
- <state name="next step" />
- <state name="escalation" g="255,16,88,52"/>
-
-</process>
+<process name="TimerTransition" xmlns="http://jbpm.org/4/jpdl">
+
+ <start g="19,50,48,48">
+ <transition to="guardedWait" />
+ </start>
+
+ <state name="guardedWait" g="98,46,127,52">
+ <transition name="go on" to="next step" g="-16,-17"/>
+ <transition name="timeout" to="escalation" g="-43,-16">
+ <timer duedate="10 minutes" />
+ </transition>
+ </state>
+
+ <state name="next step" g="283,46,83,53"/>
+ <state name="escalation" g="118,140,88,52" />
+
+</process>
\ No newline at end of file
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java 2009-04-17 09:23:24 UTC (rev 4575)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java 2009-04-17 15:36:53 UTC (rev 4576)
@@ -27,6 +27,7 @@
import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.jpdl.internal.xml.UnresolvedTransitions;
import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.TimerDefinitionImpl;
import org.jbpm.pvm.internal.model.TransitionImpl;
import org.jbpm.pvm.internal.util.TagBinding;
import org.jbpm.pvm.internal.util.XmlUtil;
@@ -69,10 +70,21 @@
UnresolvedTransitions unresolvedTransitions = parse.findObject(UnresolvedTransitions.class);
for (Element transitionElement: transitionElements) {
String transitionName = XmlUtil.attribute(transitionElement, "name", false, parse);
+
+ Element timerElement = XmlUtil.element(transitionElement, "timer");
+ if (timerElement!=null) {
+ if (transitionName!=null) {
+ TimerDefinitionImpl timerDefinitionImpl = jpdlParser.parseTimerDefinition(timerElement, parse, activity);
+ timerDefinitionImpl.setSignalName(transitionName);
+ } else {
+ parse.addProblem("a transition name is required when a timer is placed on a transition");
+ }
+ }
+
TransitionImpl transition = activity.createOutgoingTransition(transitionName);
unresolvedTransitions.add(transition, transitionElement);
- jpdlParser.parseEventListeners(transitionElement, transition, Event.TAKE, parse);
+ jpdlParser.parseOnEvent(transitionElement, transition, Event.TAKE, parse);
}
}
}
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-04-17 09:23:24 UTC (rev 4575)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-04-17 15:36:53 UTC (rev 4576)
@@ -186,9 +186,6 @@
// on events
parseOnEvents(documentElement, parse, processDefinition);
- // timers
- parseTimers(documentElement, parse, processDefinition);
-
// activities
parseActivities(documentElement, parse, processDefinition);
@@ -236,7 +233,6 @@
activity.setBehaviour(activityBehaviour);
parseOnEvents(element, parse, activity);
- parseTimers(element, parse, activity);
} finally {
parse.popObject();
@@ -248,23 +244,9 @@
}
}
- public void parseTimers(Element element, Parse parse, ScopeElementImpl scopeElement) {
- List<Element> timerElements = XmlUtil.elements(element, "timer");
- for (Element timerElement: timerElements) {
- parseTimerDefinition(timerElement, parse, scopeElement);
- }
- }
-
- private void parseTimerDefinition(Element timerElement, Parse parse, ScopeElementImpl scopeElement) {
+ public TimerDefinitionImpl parseTimerDefinition(Element timerElement, Parse parse, ScopeElementImpl scopeElement) {
TimerDefinitionImpl timerDefinition = scopeElement.createTimerDefinition();
- String eventName = XmlUtil.attribute(timerElement, "event");
- timerDefinition.setEventName(eventName);
- parseEventListeners(timerElement, scopeElement, eventName, parse);
-
- String transition = XmlUtil.attribute(timerElement, "transition");
- timerDefinition.setSignalName(transition);
-
String duedate = XmlUtil.attribute(timerElement, "duedate");
String duedatetime = XmlUtil.attribute(timerElement, "duedatetime");
@@ -289,22 +271,30 @@
String repeat = XmlUtil.attribute(timerElement, "repeat");
timerDefinition.setRepeat(repeat);
+
+ return timerDefinition;
}
- public void parseOnEvents(Element element, Parse parse, ObservableElementImpl observableElement) {
+ public void parseOnEvents(Element element, Parse parse, ScopeElementImpl scopeElement) {
// event listeners
List<Element> onElements = XmlUtil.elements(element, "on");
for (Element onElement: onElements) {
String eventName = XmlUtil.attribute(onElement, "event", true, parse);
- parseEventListeners(onElement, observableElement, eventName, parse);
+ parseOnEvent(onElement, scopeElement, eventName, parse);
+
+ Element timerElement = XmlUtil.element(onElement, "timer");
+ if (timerElement!=null) {
+ TimerDefinitionImpl timerDefinitionImpl = parseTimerDefinition(timerElement, parse, scopeElement);
+ timerDefinitionImpl.setEventName(eventName);
+ }
}
}
- public void parseEventListeners(Element element, ObservableElementImpl observableElement, String eventName, Parse parse) {
+ public void parseOnEvent(Element element, ObservableElementImpl scopeElement, String eventName, Parse parse) {
if (eventName!=null) {
- EventImpl event = observableElement.getEvent(eventName);
+ EventImpl event = scopeElement.getEvent(eventName);
if (event==null) {
- event = observableElement.createEvent(eventName);
+ event = scopeElement.createEvent(eventName);
}
for (Element eventListenerElement: XmlUtil.elements(element)) {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-04-17 09:23:24 UTC (rev 4575)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-04-17 15:36:53 UTC (rev 4576)
@@ -27,6 +27,7 @@
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
@@ -862,6 +863,26 @@
);
}
+ public Set<String> findActiveActivityNames() {
+ return addActiveActivityNames(new HashSet<String>());
+ }
+
+ protected Set<String> addActiveActivityNames(Set<String> activityNames) {
+ if ( (state.equals(STATE_ACTIVE))
+ && (activityName!=null)
+ ) {
+ activityNames.add(activityName);
+ }
+
+ if (executions!=null) {
+ for (ExecutionImpl childExecution: executions) {
+ childExecution.addActiveActivityNames(activityNames);
+ }
+ }
+
+ return activityNames;
+ }
+
public ExecutionImpl findActiveExecutionIn(String activityName) {
if ( activityName.equals(this.activityName)
&& state.equals(STATE_ACTIVE)) {
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/mgmt/JobQueryTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/mgmt/JobQueryTest.java 2009-04-17 09:23:24 UTC (rev 4575)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/mgmt/JobQueryTest.java 2009-04-17 15:36:53 UTC (rev 4576)
@@ -15,8 +15,9 @@
" <transition to='t' />" +
" </start>" +
" <state name='t'>" +
- " <timer duedate='20 seconds' transition='timeout' />" +
- " <transition name='timeout' to='t' />" +
+ " <transition name='timeout' to='t'>" +
+ " <timer duedate='20 seconds' />" +
+ " </transition>" +
" </state>" +
"</process>"
);
Added: jbpm4/trunk/modules/userguide/src/main/docbook/en/images/process.timer.event.png
===================================================================
(Binary files differ)
Property changes on: jbpm4/trunk/modules/userguide/src/main/docbook/en/images/process.timer.event.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: jbpm4/trunk/modules/userguide/src/main/docbook/en/images/process.timer.transition.png
===================================================================
(Binary files differ)
Property changes on: jbpm4/trunk/modules/userguide/src/main/docbook/en/images/process.timer.transition.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml 2009-04-17 09:23:24 UTC (rev 4575)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml 2009-04-17 15:36:53 UTC (rev 4576)
@@ -1840,12 +1840,268 @@
<section id="timer">
<title><literal>timer</literal> </title>
- <para>A timer can be specified in <literal>state</literal>s,
- <literal>task</literal>s and <literal>super-state</literal>s.
- Timers are created when the activity is entered and cancelled
- then the activity is left. When the duedate arrives before the
- activity ends, then the
+ <para>A timer can be specified in the <literal>transition</literal>
+ element in wait state activities such as <literal>state</literal>s,
+ <literal>task</literal>s, <literal>sub-process</literal>es and
+ <literal>super-state</literal>s.
+ When such a timer fires, that transition is taken.
</para>
+ <para>A timer can also be specified in custom events in wait state
+ activities such as <literal>state</literal>s,
+ <literal>task</literal>s, <literal>sub-process</literal>es and
+ <literal>super-state</literal>s. The <literal>timer</literal> element
+ should then be the first element in the <literal>on</literal> element representing
+ the event. In that case the event fires upon the duedate of the timer.
+ </para>
+ <para>Timers are created when the activity is entered. The timer can fire
+ when the execution remains in the activity until the <literal>duedate</literal>.
+ When the execution leaves the activity, the timer is cancelled.
+ </para>
+ <table><title><literal>timer</literal> attributes:</title>
+ <tgroup cols="5" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Attribute</entry>
+ <entry>Type</entry>
+ <entry>Default</entry>
+ <entry>Required?</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>duedate</literal></entry>
+ <entry><link linkend="duedateexpressions">duedate expression</link></entry>
+ <entry></entry>
+ <entry><emphasis role="bold">required</emphasis></entry>
+ <entry>Specifies when the timer needs to fire. For
+ example: <literal>20 minutes</literal> or
+ <literal>3 business days</literal>
+ </entry>
+ </row>
+ <row>
+ <entry><literal>repeat</literal></entry>
+ <entry><link linkend="duedateexpressions">duedate expression</link></entry>
+ <entry></entry>
+ <entry>optional</entry>
+ <entry>When a timer fires, this attribute specifies when the timer
+ needs to fire again. For example: <literal>20 minutes</literal> or
+ <literal>3 business days</literal>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <section id="duedateexpressions">
+ <title>Duedate expressions</title>
+ <para>A duedate expression has the following syntax:</para>
+ <programlisting>quantity [business] {second | seconds | minute | minutes |
+ hour | hours | day | days | week |
+ weeks | month | months | year | years}</programlisting>
+ <para>where <literal>quantity</literal> is a positive integer.
+ </para>
+ <para>And adding the optional indication <literal>business</literal> means
+ that only business hours should be taken into account for this duration. Without
+ the indication business, the duration will be interpreted as an absolute time period.
+ How to configure business hours is explained in <xref linkend="businesscalendar"/>
+ </para>
+ </section>
+
+ <section id="businesscalendar">
+ <title>Business calendar</title>
+ <para>The default configuration will contain a reference to the file
+ <literal>jbpm.business.calendar.xml</literal>. That contains a
+ configuration of business hours in the following format:
+ </para>
+ <programlisting><?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration xmlns="http://jbpm.org/xsd/cfg">
+
+ <process-engine-context>
+
+ <business-calendar>
+ <monday hours="9:00-12:00 and 12:30-17:00"/>
+ <tuesday hours="9:00-12:00 and 12:30-17:00"/>
+ <wednesday hours="9:00-12:00 and 12:30-17:00"/>
+ <thursday hours="9:00-12:00 and 12:30-17:00"/>
+ <friday hours="9:00-12:00 and 12:30-17:00"/>
+ <holiday period="01/07/2008 - 31/08/2008"/>
+ </business-calendar>
+
+ </process-engine-context>
+
+</jbpm-configuration></programlisting>
+ <para>For an example of where the business calendar is used, see
+ <xref linkedn="timerbusinesstime" />
+ </para>
+ </section>
+
+ <section id="timertransition">
+ <title>Timer transition</title>
+ <para>Example TimerTransitionTest shows how to put a timer on a transition.</para>
+ <figure id="process.timer.transition">
+ <title>The timer transition example process</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.timer.transition.png"/></imageobject></mediaobject>
+ </figure>
+ <programlisting><process name="TimerTransition" xmlns="http://jbpm.org/4/jpdl">
+
+ <start>
+ <transition to="guardedWait" />
+ </start>
+
+ <state name="guardedWait">
+ <transition name="go on" to="next step" />
+ <transition name="timeout" to="escalation">
+ <emphasis role="bold"><timer duedate="10 minutes" /></emphasis>
+ </transition>
+ </state>
+
+ <state name="next step" />
+ <state name="escalation" />
+
+</process></programlisting>
+ <para>When an process instance for this process is started, it arrives immediately
+ in the <literal>guardedWait</literal> state. At that time, a timer is created that will fire
+ after 10 minutes.
+ </para>
+ <programlisting>Execution processInstance = executionService
+ .startProcessInstanceByKey("TimerTransition");</programlisting>
+ <para>With the following query, we can query for the timers related to the newly created
+ processInstance. We know that there should be exactly one such timer.
+ </para>
+ <programlisting>Job job = managementService.createJobQuery()
+ .timers()
+ .processInstanceId(processInstance.getId())
+ .uniqueResult();
+ </programlisting>
+ <para>In a unit test, we won't use the JobExecutor to execute the timer. Instead,
+ we execute timers directly in the thread of the unit test. That way it is easy to
+ simulate one scenario though an execution.
+ </para>
+ <para>So as the next step, we assume that the timer will fire. We simulate this
+ by executing the timer programmatically:
+ </para>
+ <programlisting>managementService.executeJob(job.getDbid());</programlisting>
+ <para>After that the process instance will have taken the
+ <literal>timeout</literal> transition and moved to the escalation state.
+ </para>
+ <programlisting>processInstance = executionService.findExecutionById(processInstance.getId());
+assertEquals("escalation", processInstance.getActivityName());</programlisting>
+ <para>The second scenario in TimerTransitionTest shows that the
+ timer is cancelled in case the signal <literal>go on</literal> is given
+ before the timer fires. In that case the execution ends up in the
+ <literal>next step</literal>.
+ </para>
+ </section>
+
+ <section id="timerevent">
+ <title>Timer event</title>
+ <para>Example TimerEventTest shows how to put a timer on a custom event.</para>
+ <figure id="process.timer.event">
+ <title>The timer event example process</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.timer.event.png"/></imageobject></mediaobject>
+ </figure>
+ <programlisting><process name="TimerEvent" xmlns="http://jbpm.org/4/jpdl">
+
+ <start>
+ <transition to="guardedWait" />
+ </start>
+
+ <state name="guardedWait" >
+ <emphasis role="bold"><on event="timeout">
+ <timer duedate="10 minutes"/>
+ <event-listener class="org.jbpm.examples.timer.event.Escalate" />
+ </on></emphasis>
+ <transition name="go on" to="next step" />
+ </state>
+
+ <state name="next step" />
+
+</process></programlisting>
+ <para>In this case, if the execution is not signalled within 10 minutes after the
+ activity is started, the event <literal>timeout</literal> is fired
+ and the event listener <literal>org.jbpm.examples.timer.event.Escalate</literal>
+ will be notified.
+ </para>
+ <para>Again, if the <literal>guardedWait</literal> activity is ended within
+ 10 minutes, then the timer is cancelled and the <literal>Escalate</literal>
+ event listener will not be notified.
+ </para>
+ </section>
+
+ <section id="timerbusinesstime">
+ <title>Timer business time</title>
+ <para>Example TimerBusinessTimeTest shows how business time works.</para>
+ <figure id="process.timer.event">
+ <title>The timer businesstime example process</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.timer.transition.png"/></imageobject></mediaobject>
+ </figure>
+ <programlisting><process name="TimerBusinessTime" xmlns="http://jbpm.org/4/jpdl">
+
+ <start>
+ <transition to="guardedWait" />
+ </start>
+
+ <state name="guardedWait" >
+ <transition name="go on" to="next step" />
+ <transition name="timeout" to="escalation" >
+ <timer <emphasis role="bold">duedate="9 business hours"</emphasis> />
+ </transition>
+ </state>
+
+ <state name="next step" />
+ <state name="escalation" />
+
+</process></programlisting>
+ <para>Suppose that a new <literal>TimerBusinessTime</literal> process instance is started
+ at 11:30am on a tuesday. The default configured business calendar specifies working hours
+ between 9:00-12:00 and 12:30-17:00. So 9 business hours later results in an actual duedate
+ for the timer of wednesday 13:00 (1pm).
+ </para>
+ <para>Since we do not know when the TimerBusinessTimeTest will be ran, we only assert
+ in the test that the actual duedate of the scheduled timer at least 24 hours ahead.
+ </para>
+ </section>
+
+ <section id="timerrepeat">
+ <title>Timer repeat</title>
+ <para>Example TimerRepeatTest shows how to put a timer with a repeat. The attribute
+ <literal>repeat</literal> on a timer will cause the timer to be rescheduled automatically
+ after it is executed.
+ </para>
+ <figure id="process.timer.repeat">
+ <title>The timer repeat example process</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.timer.event.png"/></imageobject></mediaobject>
+ </figure>
+ <programlisting><process name="TimerRepeat" xmlns="http://jbpm.org/4/jpdl">
+
+ <start>
+ <transition to="guardedWait" />
+ </start>
+
+ <state name="guardedWait">
+ <on event="timeout">
+ <timer duedate="20 minutes" <emphasis role="bold">repeat="10 seconds"</emphasis> />
+ <event-listener class="org.jbpm.examples.timer.repeat.Escalate" />
+ </on>
+ <transition name="go on" to="next step"/>
+ </state>
+
+ <state name="next step"/>
+
+</process></programlisting>
+ <para>When a new process is started, a timer is created and the duedate
+ will be 20 minutes ahead. When the timer fires, a new timer will be created
+ with a duedate of 10 seconds ahead. When that timer fires, a new timer will
+ be created again 10 seconds ahead. And so on.
+ </para>
+ <para>New timers will be created each time the timer fires until the
+ <literal>guardedWait</literal> state activity is ended with a signal.
+ When the <literal>guardedWait</literal> state activity is ended, the
+ existing timer will be cancelled.
+ </para>
+ </section>
</section>
<section id="usercode">
17 years
JBoss JBPM SVN: r4575 - in jbpm4/trunk/modules: jpdl/src/main/java/org/jbpm/jpdl/internal/xml and 1 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-04-17 05:23:24 -0400 (Fri, 17 Apr 2009)
New Revision: 4575
Added:
jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd
Removed:
jbpm4/trunk/modules/api/src/main/resources/jpdl.xsd
Modified:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Installation.xml
Log:
JBPM-2165 rename xsd to jpdl-4.0.xsd
Copied: jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd (from rev 4573, jbpm4/trunk/modules/api/src/main/resources/jpdl.xsd)
===================================================================
--- jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd (rev 0)
+++ jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd 2009-04-17 09:23:24 UTC (rev 4575)
@@ -0,0 +1,775 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://jbpm.org/4/jpdl"
+ xmlns:tns="http://jbpm.org/4/jpdl"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified">
+
+ <annotation>
+ <documentation>Schema for jPDL 4 process descriptions;
+ element process is the top level element.
+
+ TODO: Add activity pluggability. (add the proper any's and
+ anyAttributes)
+
+ TODO: Pull up expression. The expression element in the
+ delegation group can be pulled up as an expression
+ attribute in each use case of the delegationGroup
+
+ TODO: Investigate if object-refs to centrally defined objects would
+ add value over inline defined objects.
+ </documentation>
+ </annotation>
+
+ <!-- ### PROCESS DEFINITION ############################################# -->
+
+ <element name="process">
+ <annotation><documentation>A jPDL process definition description; This
+ is the top level element in a jPDL process file.</documentation></annotation>
+ <complexType>
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <element ref="tns:swimlane" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
+ <group ref="tns:activityGroup" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attribute name="name" use="required" type="string">
+ <annotation>
+ <documentation>
+ The process name. Multiple processes can be deployed with the same name, as long as they have a different
+ version.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="key" type="string">
+ <annotation>
+ <documentation>
+ The key can be used to provide a short acronym that will replace the name as the basis for the generated
+ process definition id
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="version" type="int">
+ <annotation>
+ <documentation>
+ Indicates the sequence number of this version for all processes with the same name. By specifying a version
+ automatic deployment can figure out if this process is already deployed or not.
+ </documentation>
+ </annotation>
+ </attribute>
+ <anyAttribute processContents="skip">
+ <annotation><documentation>for extensibility
+ </documentation></annotation>
+ </anyAttribute>
+ </complexType>
+ </element>
+
+ <!-- ### ACTIVITIES ##################################################### -->
+
+ <group name="activityGroup">
+ <choice>
+ <!-- ~~~ START ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <element name="start">
+ <annotation><documentation>Start event
+ </documentation></annotation>
+ <complexType>
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ </complexType>
+ </element>
+
+ <!-- ~~~ END ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <element name="end">
+ <annotation><documentation>End event.
+ </documentation></annotation>
+ <complexType>
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ <attribute name="ends" default="process-instance">
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="execution"/>
+ <enumeration value="process-instance"/>
+ </restriction>
+ </simpleType>
+ </attribute>
+ <attribute name="state" default="ended" type="string">
+ <annotation><documentation>sets the state of the execution explicitely</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="end-cancel">
+ <annotation><documentation>End cancel event.
+ </documentation></annotation>
+ <complexType>
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ <attribute name="ends" default="process-instance">
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="execution"/>
+ <enumeration value="process-instance"/>
+ </restriction>
+ </simpleType>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="end-error">
+ <annotation><documentation>End cancel event.
+ </documentation></annotation>
+ <complexType>
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ <attribute name="ends" default="process-instance">
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="execution"/>
+ <enumeration value="process-instance"/>
+ </restriction>
+ </simpleType>
+ </attribute>
+ </complexType>
+ </element>
+
+ <!-- ~~~ STATE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <element name="state">
+ <annotation><documentation>A wait state. When an execution arrives in this
+ activity, the execution will wait until an external trigger is received
+ with execution.signal() or execution.getActivityInstance().signal()
+ </documentation></annotation>
+ <complexType>
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ </complexType>
+ </element>
+
+ <!-- ~~~ DECISION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <element name="decision">
+ <annotation><documentation>Decision gateway: selects one path out of many alternatives.
+ When an execution comes in, exactly one outgoing transition is taken.
+ </documentation></annotation>
+ <complexType>
+ <sequence>
+ <element name="handler" minOccurs="0" type="tns:wireObjectType" />
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="transition" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <complexContent>
+ <extension base="tns:transitionType">
+ <sequence>
+ <element name="condition" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <attribute name="expr" type="string">
+ <annotation><documentation>The script text that will be evaluated.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="lang" type="string">
+ <annotation><documentation>Identification of the scripting language
+ to use.</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ <!-- TODO add conditions -->
+ </element>
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ <attribute name="expr" type="string">
+ <annotation><documentation>The script that will be evaluated and resolve to
+ the name of the outgoing transition.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="lang" type="string">
+ <annotation><documentation>Identification of the scripting language
+ to use for the expr attribute.</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="fork">
+ <annotation><documentation>Spawns multiple concurrent paths of
+ execution.
+ </documentation></annotation>
+ <complexType>
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ </complexType>
+ </element>
+
+ <element name="join">
+ <annotation><documentation>Spawns multiple concurrent paths of
+ execution.
+ </documentation></annotation>
+ <complexType>
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ </complexType>
+ </element>
+
+ <element name="script">
+ <annotation><documentation>Evaluates a piece of text as a script
+ </documentation></annotation>
+ <complexType>
+ <complexContent>
+ <extension base="tns:scriptType">
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+
+ <element name="hql">
+ <annotation><documentation>Performs a hibernate query
+ </documentation></annotation>
+ <complexType>
+ <complexContent>
+ <extension base="tns:qlType">
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+
+ <element name="sql">
+ <annotation><documentation>Performs a hibernate SQL query
+ </documentation></annotation>
+ <complexType>
+ <complexContent>
+ <extension base="tns:qlType">
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+
+ <element name="java">
+ <annotation><documentation>Invokes a method on a java object.
+ Either the java class is instantiated with reflection, or the
+ java object is fetched from the environment. Then values from the
+ environment are injected into the fields and a method is executed.
+ </documentation></annotation>
+ <complexType>
+ <complexContent>
+ <extension base="tns:javaType">
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+
+ <element name="esb">
+ <annotation><documentation>Invokes a service over the ESB.
+ </documentation></annotation>
+ <complexType>
+ <complexContent>
+ <extension base="tns:esbType">
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+
+ <element name="task">
+ <annotation><documentation>Creates a task in the task component.
+ </documentation></annotation>
+ <complexType>
+ <sequence>
+ <element name="assignment-handler" minOccurs="0" type="tns:wireObjectType" />
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ <attributeGroup ref="tns:assignmentAttributes"/>
+ <attribute name="swimlane" type="string" />
+ <attribute name="on-transition" default="cancel">
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="keep"/>
+ <enumeration value="cancel"/>
+ </restriction>
+ </simpleType>
+ </attribute>
+ <attribute name="completion" type="string" default="complete" />
+ </complexType>
+ </element>
+
+ <!--
+ <element name="process-state">
+ <annotation><documentation>Waits while a sub process instance is
+ being executed and continues when the sub process instance ends.
+ </documentation></annotation>
+ < ! - - take into account the following situation:
+ Unlike in jBPM 3, a process-state should not signal the newly created
+ process instance. The signal in jBPM 3 is probably historically there
+ because in the beginning there was no initial attribute on the process
+ definition.
+ - - >
+ <complexType>
+ <sequence>
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded">
+ <annotation><documentation>Events on which listeners can be registered.</documentation></annotation>
+ </element>
+ <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ </complexType>
+ </element>
+
+ <element name="super-state">
+ <annotation><documentation>Scope enclosing a number of activities.
+ </documentation></annotation>
+ <complexType>
+ <sequence>
+ <group ref="tns:activityGroup" minOccurs="0" maxOccurs="unbounded" />
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded">
+ <annotation><documentation>Events on which listeners can be registered.</documentation></annotation>
+ </element>
+ <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ </complexType>
+ </element>
+ -->
+ </choice>
+ </group>
+
+ <group name="wireObjectGroup">
+ <choice>
+ <element name="string">
+ <complexType>
+ <attribute name="name">
+ <annotation><documentation>the name of the string object</documentation></annotation>
+ </attribute>
+ <attribute name="value">
+ <annotation><documentation>the actual string value</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+ <element name="object" type="tns:wireObjectType" />
+ </choice>
+ </group>
+
+ <complexType name="wireObjectType">
+ <sequence>
+ <element name="field" minOccurs="0" maxOccurs="unbounded">
+ <annotation><documentation>Field injections from the environment
+ invocation.</documentation></annotation>
+ <complexType >
+ <group ref="tns:wireObjectGroup" />
+ <attribute name="name" type="string">
+ <annotation><documentation>Name of the field in which the value should be injected.
+ </documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+ </sequence>
+ <attribute name="object" type="string">
+ <annotation><documentation>Name of the object in the environment
+ </documentation></annotation>
+ </attribute>
+ <attribute name="class" type="string">
+ <annotation><documentation>The class to instantiate.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of this object.
+ </documentation></annotation>
+ </attribute>
+ </complexType>
+
+ <complexType name="javaType">
+ <sequence>
+ <element name="field" minOccurs="0" maxOccurs="unbounded">
+ <annotation><documentation>Field injections from the environment
+ invocation.</documentation></annotation>
+ </element>
+ <element name="arg" minOccurs="0" maxOccurs="unbounded">
+ <annotation><documentation>Method arguments.</documentation></annotation>
+ </element>
+ </sequence>
+ <attribute name="object" type="string">
+ <annotation><documentation>Name of the object in the environment
+ </documentation></annotation>
+ </attribute>
+ <attribute name="method" type="string" use="required">
+ <annotation><documentation>The name of the method to invoke.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="class" type="string">
+ <annotation><documentation>The class to instantiate.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="var" type="string">
+ <annotation><documentation>The variable name to store the return value
+ </documentation></annotation>
+ </attribute>
+ </complexType>
+
+ <complexType name="scriptType">
+ <sequence>
+ <element name="text" type="string" minOccurs="0">
+ <annotation><documentation>The content of this expression element
+ is the script text that will be evaluated. This is mutually
+ exclusive with the expression attribute.</documentation></annotation>
+ </element>
+ </sequence>
+ <attribute name="expr" type="string">
+ <annotation><documentation>The script text that will be evaluated. This
+ is mutually exclusive with the expression element.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="lang" type="string">
+ <annotation><documentation>Identification of the scripting language
+ to use.</documentation></annotation>
+ </attribute>
+ <attribute name="var" type="string">
+ <annotation><documentation>Name of the variable in which the result
+ of the script evaluation will be stored</documentation></annotation>
+ </attribute>
+ </complexType>
+
+ <complexType name="qlType">
+ <sequence>
+ <element name="query" type="string">
+ <annotation><documentation>The query text.</documentation></annotation>
+ </element>
+ <element name="parameters" minOccurs="0">
+ <annotation><documentation>Query parameters.</documentation></annotation>
+ <complexType>
+ <sequence>
+ <group ref="tns:wireObjectGroup" maxOccurs="unbounded" />
+ </sequence>
+ </complexType>
+ </element>
+ </sequence>
+ <attribute name="var" type="string">
+ <annotation><documentation>Name of the variable in which the result
+ of the script evaluation will be stored</documentation></annotation>
+ </attribute>
+ <attribute name="unique" type="string">
+ <annotation><documentation>Does this query return a unique result or a list
+ </documentation></annotation>
+ </attribute>
+ </complexType>
+
+ <complexType name="esbType">
+ <sequence>
+ <element name="part" minOccurs="0" maxOccurs="unbounded">
+ <annotation><documentation>The content of this expression element
+ is the script text that will be evaluated. This is mutually
+ exclusive with the expression attribute.</documentation></annotation>
+ <complexType>
+ <choice minOccurs="0">
+ <group ref="tns:wireObjectGroup" />
+ </choice>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of the message body part.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="expr" type="string">
+ <annotation><documentation>The script text that will be evaluated and
+ used and the object in this message body part.
+ </documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+ </sequence>
+ <attribute name="category" type="string">
+ <annotation><documentation>The category of the service in the esb.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="service" type="string">
+ <annotation><documentation>The name of the service in the esb.
+ </documentation></annotation>
+ </attribute>
+ </complexType>
+
+ <attributeGroup name="activityAttributes">
+ <attribute name="name" type="string">
+ <annotation><documentation>The id of this activity. The name should be unique
+ in the complete scope of the process.</documentation></annotation>
+ </attribute>
+ <attribute name="g" type="string">
+ <annotation><documentation>Graphical information used by process designer tool.
+ </documentation></annotation>
+ </attribute>
+ </attributeGroup>
+
+ <attributeGroup name="assignmentAttributes">
+ <annotation><documentation>the assignment attributes will be used in
+ tasks and swimlanes to specify to whom these respectively are assigned.
+ </documentation></annotation>
+ <attribute name="assignee" type="string">
+ <annotation><documentation>Expression that resolves to a userId referencing
+ the person to which the task or swimlane will be assigned.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="assignee-lang" type="string">
+ <annotation><documentation>Expression language for the assignee attribute.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="candidate-users" type="string">
+ <annotation><documentation>Expression that resolves to a comma separated
+ list of userId's. All the referred people will be candidates for
+ take the task or swimlane.</documentation></annotation>
+ </attribute>
+ <attribute name="candidate-users-lang" type="string">
+ <annotation><documentation>Expression language for the
+ candidate-users attribute.</documentation></annotation>
+ </attribute>
+ <attribute name="candidate-groups" type="string">
+ <annotation><documentation>Resolves to a comma separated list of groupId's.
+ All the referred people will be candidates to
+ take the task or swimlane.</documentation></annotation>
+ </attribute>
+ <attribute name="candidate-groups-lang" type="string">
+ <annotation><documentation>Expression language for the
+ candidate-groups attribute.</documentation></annotation>
+ </attribute>
+ </attributeGroup>
+
+ <element name="swimlane">
+ <annotation><documentation>A process role.</documentation></annotation>
+ <complexType>
+ <attribute name="name" type="string" use="required" />
+ <attributeGroup ref="tns:assignmentAttributes" />
+ </complexType>
+ </element>
+
+ <complexType name="transitionType">
+ <annotation><documentation>The outgoing transitions. The first in the list
+ will be the default outgoing transition.
+ </documentation></annotation>
+ <sequence>
+ <group ref="tns:eventListenerGroup" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attribute name="name" type="string">
+ <annotation><documentation>Name of this outgoing transition</documentation></annotation>
+ </attribute>
+ <attribute name="to" type="string">
+ <annotation><documentation>Name of the destination activity of this transition.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="g" type="string">
+ <annotation><documentation>Graphical information used by process designer tool.
+ </documentation></annotation>
+ </attribute>
+ </complexType>
+
+ <element name="transition" type="tns:transitionType">
+ <annotation><documentation>A transition from one activity to another.</documentation></annotation>
+ </element>
+
+ <element name="on">
+ <complexType>
+ <sequence>
+ <group ref="tns:eventListenerGroup" minOccurs="0" maxOccurs="unbounded">
+ <annotation><documentation>A list of event listeners that will
+ be notified when the event is fired</documentation></annotation>
+ </group>
+ </sequence>
+ <attribute name="event" type="string">
+ <annotation><documentation>The event identification. start, end, take or
+ any other custom event.
+ </documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="timer">
+ <complexType>
+ <sequence>
+ <group ref="tns:eventListenerGroup" minOccurs="0" maxOccurs="unbounded">
+ <annotation><documentation>A list of event listeners that will
+ be notified when the timer fires</documentation></annotation>
+ </group>
+ </sequence>
+ <attribute name="event" type="string">
+ <annotation><documentation>The event identification for this timer event.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="transition" type="string">
+ <annotation><documentation>The name of the outgoing transition that must be
+ taken when this timer fires.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="duedate" type="string">
+ <annotation><documentation>Timer duedate expression that defines the duedate of this
+ timer relative to the creation time of the timer. E.g. '2 hours' or '4 business days'
+ </documentation></annotation>
+ </attribute>
+ <attribute name="repeat" type="string">
+ <annotation><documentation>Timer duedate expression that defines repeated scheduling
+ relative to the last timer fire event. E.g. '2 hours' or '4 business days'
+ </documentation></annotation>
+ </attribute>
+ <attribute name="duedatetime" type="string">
+ <annotation><documentation>Absolute time in format <code>HH:mm dd/MM/yyyy</code>
+ (see SimpleDateFormat). The format for the absolute time can be customized in the
+ jbpm configuration.
+ </documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <group name="eventListenerGroup">
+ <choice>
+ <element name="event-listener" type="tns:wireObjectType" />
+ <element name="hql" type="tns:qlType" />
+ <element name="sql" type="tns:qlType" />
+ <element name="java" type="tns:javaType" />
+ <element name="script" type="tns:scriptType" />
+ <element name="esb" type="tns:esbType" />
+ </choice>
+ </group>
+
+ <complexType name="emailType">
+ <sequence>
+ <element name="property">
+ <annotation><documentation>Template property value</documentation></annotation>
+ <complexType>
+ <attribute name="name" type="string" />
+ <attribute name="value" type="string" />
+ </complexType>
+ </element>
+ </sequence>
+ <attribute name="to" type="string" />
+ <attribute name="type" type="string">
+ <annotation><documentation>Reference to the email template</documentation></annotation>
+ </attribute>
+ </complexType>
+
+ <complexType name="taskType" >
+ <!--
+ <sequence>
+ <element name="reminder">
+ <complexType>
+ <attribute name="duedate" type="string" use="required" />
+ <attribute name="repeat" type="string" />
+ </complexType>
+ </element>
+ </sequence>
+ -->
+ <attributeGroup ref="tns:assignmentAttributes" />
+ <attribute name="form" type="string">
+ </attribute>
+ <attribute name="swimlane" type="string">
+ </attribute>
+ <attribute name="description" type="string" />
+ <attribute name="duedate" type="string" />
+ <attribute name="notify" type="boolean" default="false"/>
+ <!--
+ <attribute name="subtasksync">
+ <simpleType>
+ <union>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="last">
+ <annotation><documentation>When the last subtask completes,
+ this task is completed.</documentation></annotation>
+ </enumeration>
+ <enumeration value="first">
+ <annotation><documentation>When the first subtask completes,
+ this task is completed.</documentation></annotation>
+ </enumeration>
+ </restriction>
+ </simpleType>
+ <simpleType>
+ <restriction base="int">
+ <annotation><documentation>The number of subtasks that
+ have to complete before this task is considered
+ completed.</documentation></annotation>
+ </restriction>
+ </simpleType>
+ </union>
+ </simpleType>
+ </attribute>
+ -->
+ </complexType>
+
+ <!--
+ <element name="timer">
+ <annotation><documentation>A timer that will be bound to the most inner enclosing scope.
+ Timers can give a signal to an activity instance. The signal will correspond to a transition
+ or to an event being fired.
+ </documentation></annotation>
+ <complexType>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <group ref="tns:eventListenerGroup">
+ <annotation><documentation>An inline list of event listeners
+ on a timer is a short cut for defining the event separately.
+ </documentation></annotation>
+ </group>
+ </choice>
+ <attribute name="duedate" type="string" use="required" />
+ <attribute name="signal" type="string" use="required">
+ <annotation><documentation>Refers to the signal that will be used.
+ If inline event listeners are declared, the signal name can not be
+ the same as an event that is declared in this scope.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="repeat" type="string" />
+ </complexType>
+ </element>
+
+ <simpleType name="priorityType">
+ <restriction base="string">
+ <enumeration value="highest"/>
+ <enumeration value="high"/>
+ <enumeration value="normal"/>
+ <enumeration value="low"/>
+ <enumeration value="lowest"/>
+ </restriction>
+ </simpleType>
+
+ -->
+
+</schema>
Deleted: jbpm4/trunk/modules/api/src/main/resources/jpdl.xsd
===================================================================
--- jbpm4/trunk/modules/api/src/main/resources/jpdl.xsd 2009-04-17 09:21:43 UTC (rev 4574)
+++ jbpm4/trunk/modules/api/src/main/resources/jpdl.xsd 2009-04-17 09:23:24 UTC (rev 4575)
@@ -1,775 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://jbpm.org/4/jpdl"
- xmlns:tns="http://jbpm.org/4/jpdl"
- elementFormDefault="qualified"
- attributeFormDefault="unqualified">
-
- <annotation>
- <documentation>Schema for jPDL 4 process descriptions;
- element process is the top level element.
-
- TODO: Add activity pluggability. (add the proper any's and
- anyAttributes)
-
- TODO: Pull up expression. The expression element in the
- delegation group can be pulled up as an expression
- attribute in each use case of the delegationGroup
-
- TODO: Investigate if object-refs to centrally defined objects would
- add value over inline defined objects.
- </documentation>
- </annotation>
-
- <!-- ### PROCESS DEFINITION ############################################# -->
-
- <element name="process">
- <annotation><documentation>A jPDL process definition description; This
- is the top level element in a jPDL process file.</documentation></annotation>
- <complexType>
- <sequence minOccurs="0" maxOccurs="unbounded">
- <element ref="tns:swimlane" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
- <group ref="tns:activityGroup" minOccurs="0" maxOccurs="unbounded" />
- </sequence>
- <attribute name="name" use="required" type="string">
- <annotation>
- <documentation>
- The process name. Multiple processes can be deployed with the same name, as long as they have a different
- version.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="key" type="string">
- <annotation>
- <documentation>
- The key can be used to provide a short acronym that will replace the name as the basis for the generated
- process definition id
- </documentation>
- </annotation>
- </attribute>
- <attribute name="version" type="int">
- <annotation>
- <documentation>
- Indicates the sequence number of this version for all processes with the same name. By specifying a version
- automatic deployment can figure out if this process is already deployed or not.
- </documentation>
- </annotation>
- </attribute>
- <anyAttribute processContents="skip">
- <annotation><documentation>for extensibility
- </documentation></annotation>
- </anyAttribute>
- </complexType>
- </element>
-
- <!-- ### ACTIVITIES ##################################################### -->
-
- <group name="activityGroup">
- <choice>
- <!-- ~~~ START ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
- <element name="start">
- <annotation><documentation>Start event
- </documentation></annotation>
- <complexType>
- <sequence>
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
- </sequence>
- <attributeGroup ref="tns:activityAttributes" />
- </complexType>
- </element>
-
- <!-- ~~~ END ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
- <element name="end">
- <annotation><documentation>End event.
- </documentation></annotation>
- <complexType>
- <sequence>
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attributeGroup ref="tns:activityAttributes" />
- <attribute name="ends" default="process-instance">
- <simpleType>
- <restriction base="string">
- <enumeration value="execution"/>
- <enumeration value="process-instance"/>
- </restriction>
- </simpleType>
- </attribute>
- <attribute name="state" default="ended" type="string">
- <annotation><documentation>sets the state of the execution explicitely</documentation></annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="end-cancel">
- <annotation><documentation>End cancel event.
- </documentation></annotation>
- <complexType>
- <sequence>
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attributeGroup ref="tns:activityAttributes" />
- <attribute name="ends" default="process-instance">
- <simpleType>
- <restriction base="string">
- <enumeration value="execution"/>
- <enumeration value="process-instance"/>
- </restriction>
- </simpleType>
- </attribute>
- </complexType>
- </element>
-
- <element name="end-error">
- <annotation><documentation>End cancel event.
- </documentation></annotation>
- <complexType>
- <sequence>
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attributeGroup ref="tns:activityAttributes" />
- <attribute name="ends" default="process-instance">
- <simpleType>
- <restriction base="string">
- <enumeration value="execution"/>
- <enumeration value="process-instance"/>
- </restriction>
- </simpleType>
- </attribute>
- </complexType>
- </element>
-
- <!-- ~~~ STATE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
- <element name="state">
- <annotation><documentation>A wait state. When an execution arrives in this
- activity, the execution will wait until an external trigger is received
- with execution.signal() or execution.getActivityInstance().signal()
- </documentation></annotation>
- <complexType>
- <sequence>
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
- </sequence>
- <attributeGroup ref="tns:activityAttributes" />
- </complexType>
- </element>
-
- <!-- ~~~ DECISION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
- <element name="decision">
- <annotation><documentation>Decision gateway: selects one path out of many alternatives.
- When an execution comes in, exactly one outgoing transition is taken.
- </documentation></annotation>
- <complexType>
- <sequence>
- <element name="handler" minOccurs="0" type="tns:wireObjectType" />
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element name="transition" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <complexContent>
- <extension base="tns:transitionType">
- <sequence>
- <element name="condition" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <attribute name="expr" type="string">
- <annotation><documentation>The script text that will be evaluated.
- </documentation></annotation>
- </attribute>
- <attribute name="lang" type="string">
- <annotation><documentation>Identification of the scripting language
- to use.</documentation></annotation>
- </attribute>
- </complexType>
- </element>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- <!-- TODO add conditions -->
- </element>
- </sequence>
- <attributeGroup ref="tns:activityAttributes" />
- <attribute name="expr" type="string">
- <annotation><documentation>The script that will be evaluated and resolve to
- the name of the outgoing transition.
- </documentation></annotation>
- </attribute>
- <attribute name="lang" type="string">
- <annotation><documentation>Identification of the scripting language
- to use for the expr attribute.</documentation></annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="fork">
- <annotation><documentation>Spawns multiple concurrent paths of
- execution.
- </documentation></annotation>
- <complexType>
- <sequence>
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
- </sequence>
- <attributeGroup ref="tns:activityAttributes" />
- </complexType>
- </element>
-
- <element name="join">
- <annotation><documentation>Spawns multiple concurrent paths of
- execution.
- </documentation></annotation>
- <complexType>
- <sequence>
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
- </sequence>
- <attributeGroup ref="tns:activityAttributes" />
- </complexType>
- </element>
-
- <element name="script">
- <annotation><documentation>Evaluates a piece of text as a script
- </documentation></annotation>
- <complexType>
- <complexContent>
- <extension base="tns:scriptType">
- <sequence>
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
- </sequence>
- <attributeGroup ref="tns:activityAttributes" />
- </extension>
- </complexContent>
- </complexType>
- </element>
-
- <element name="hql">
- <annotation><documentation>Performs a hibernate query
- </documentation></annotation>
- <complexType>
- <complexContent>
- <extension base="tns:qlType">
- <sequence>
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
- </sequence>
- <attributeGroup ref="tns:activityAttributes" />
- </extension>
- </complexContent>
- </complexType>
- </element>
-
- <element name="sql">
- <annotation><documentation>Performs a hibernate SQL query
- </documentation></annotation>
- <complexType>
- <complexContent>
- <extension base="tns:qlType">
- <sequence>
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
- </sequence>
- <attributeGroup ref="tns:activityAttributes" />
- </extension>
- </complexContent>
- </complexType>
- </element>
-
- <element name="java">
- <annotation><documentation>Invokes a method on a java object.
- Either the java class is instantiated with reflection, or the
- java object is fetched from the environment. Then values from the
- environment are injected into the fields and a method is executed.
- </documentation></annotation>
- <complexType>
- <complexContent>
- <extension base="tns:javaType">
- <sequence>
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
- </sequence>
- <attributeGroup ref="tns:activityAttributes" />
- </extension>
- </complexContent>
- </complexType>
- </element>
-
- <element name="esb">
- <annotation><documentation>Invokes a service over the ESB.
- </documentation></annotation>
- <complexType>
- <complexContent>
- <extension base="tns:esbType">
- <sequence>
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
- </sequence>
- <attributeGroup ref="tns:activityAttributes" />
- </extension>
- </complexContent>
- </complexType>
- </element>
-
- <element name="task">
- <annotation><documentation>Creates a task in the task component.
- </documentation></annotation>
- <complexType>
- <sequence>
- <element name="assignment-handler" minOccurs="0" type="tns:wireObjectType" />
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
- </sequence>
- <attributeGroup ref="tns:activityAttributes" />
- <attributeGroup ref="tns:assignmentAttributes"/>
- <attribute name="swimlane" type="string" />
- <attribute name="on-transition" default="cancel">
- <simpleType>
- <restriction base="string">
- <enumeration value="keep"/>
- <enumeration value="cancel"/>
- </restriction>
- </simpleType>
- </attribute>
- <attribute name="completion" type="string" default="complete" />
- </complexType>
- </element>
-
- <!--
- <element name="process-state">
- <annotation><documentation>Waits while a sub process instance is
- being executed and continues when the sub process instance ends.
- </documentation></annotation>
- < ! - - take into account the following situation:
- Unlike in jBPM 3, a process-state should not signal the newly created
- process instance. The signal in jBPM 3 is probably historically there
- because in the beginning there was no initial attribute on the process
- definition.
- - - >
- <complexType>
- <sequence>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded">
- <annotation><documentation>Events on which listeners can be registered.</documentation></annotation>
- </element>
- <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attributeGroup ref="tns:activityAttributes" />
- </complexType>
- </element>
-
- <element name="super-state">
- <annotation><documentation>Scope enclosing a number of activities.
- </documentation></annotation>
- <complexType>
- <sequence>
- <group ref="tns:activityGroup" minOccurs="0" maxOccurs="unbounded" />
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded">
- <annotation><documentation>Events on which listeners can be registered.</documentation></annotation>
- </element>
- <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attributeGroup ref="tns:activityAttributes" />
- </complexType>
- </element>
- -->
- </choice>
- </group>
-
- <group name="wireObjectGroup">
- <choice>
- <element name="string">
- <complexType>
- <attribute name="name">
- <annotation><documentation>the name of the string object</documentation></annotation>
- </attribute>
- <attribute name="value">
- <annotation><documentation>the actual string value</documentation></annotation>
- </attribute>
- </complexType>
- </element>
- <element name="object" type="tns:wireObjectType" />
- </choice>
- </group>
-
- <complexType name="wireObjectType">
- <sequence>
- <element name="field" minOccurs="0" maxOccurs="unbounded">
- <annotation><documentation>Field injections from the environment
- invocation.</documentation></annotation>
- <complexType >
- <group ref="tns:wireObjectGroup" />
- <attribute name="name" type="string">
- <annotation><documentation>Name of the field in which the value should be injected.
- </documentation></annotation>
- </attribute>
- </complexType>
- </element>
- </sequence>
- <attribute name="object" type="string">
- <annotation><documentation>Name of the object in the environment
- </documentation></annotation>
- </attribute>
- <attribute name="class" type="string">
- <annotation><documentation>The class to instantiate.
- </documentation></annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation><documentation>The name of this object.
- </documentation></annotation>
- </attribute>
- </complexType>
-
- <complexType name="javaType">
- <sequence>
- <element name="field" minOccurs="0" maxOccurs="unbounded">
- <annotation><documentation>Field injections from the environment
- invocation.</documentation></annotation>
- </element>
- <element name="arg" minOccurs="0" maxOccurs="unbounded">
- <annotation><documentation>Method arguments.</documentation></annotation>
- </element>
- </sequence>
- <attribute name="object" type="string">
- <annotation><documentation>Name of the object in the environment
- </documentation></annotation>
- </attribute>
- <attribute name="method" type="string" use="required">
- <annotation><documentation>The name of the method to invoke.
- </documentation></annotation>
- </attribute>
- <attribute name="class" type="string">
- <annotation><documentation>The class to instantiate.
- </documentation></annotation>
- </attribute>
- <attribute name="var" type="string">
- <annotation><documentation>The variable name to store the return value
- </documentation></annotation>
- </attribute>
- </complexType>
-
- <complexType name="scriptType">
- <sequence>
- <element name="text" type="string" minOccurs="0">
- <annotation><documentation>The content of this expression element
- is the script text that will be evaluated. This is mutually
- exclusive with the expression attribute.</documentation></annotation>
- </element>
- </sequence>
- <attribute name="expr" type="string">
- <annotation><documentation>The script text that will be evaluated. This
- is mutually exclusive with the expression element.
- </documentation></annotation>
- </attribute>
- <attribute name="lang" type="string">
- <annotation><documentation>Identification of the scripting language
- to use.</documentation></annotation>
- </attribute>
- <attribute name="var" type="string">
- <annotation><documentation>Name of the variable in which the result
- of the script evaluation will be stored</documentation></annotation>
- </attribute>
- </complexType>
-
- <complexType name="qlType">
- <sequence>
- <element name="query" type="string">
- <annotation><documentation>The query text.</documentation></annotation>
- </element>
- <element name="parameters" minOccurs="0">
- <annotation><documentation>Query parameters.</documentation></annotation>
- <complexType>
- <sequence>
- <group ref="tns:wireObjectGroup" maxOccurs="unbounded" />
- </sequence>
- </complexType>
- </element>
- </sequence>
- <attribute name="var" type="string">
- <annotation><documentation>Name of the variable in which the result
- of the script evaluation will be stored</documentation></annotation>
- </attribute>
- <attribute name="unique" type="string">
- <annotation><documentation>Does this query return a unique result or a list
- </documentation></annotation>
- </attribute>
- </complexType>
-
- <complexType name="esbType">
- <sequence>
- <element name="part" minOccurs="0" maxOccurs="unbounded">
- <annotation><documentation>The content of this expression element
- is the script text that will be evaluated. This is mutually
- exclusive with the expression attribute.</documentation></annotation>
- <complexType>
- <choice minOccurs="0">
- <group ref="tns:wireObjectGroup" />
- </choice>
- <attribute name="name" type="string">
- <annotation><documentation>The name of the message body part.
- </documentation></annotation>
- </attribute>
- <attribute name="expr" type="string">
- <annotation><documentation>The script text that will be evaluated and
- used and the object in this message body part.
- </documentation></annotation>
- </attribute>
- </complexType>
- </element>
- </sequence>
- <attribute name="category" type="string">
- <annotation><documentation>The category of the service in the esb.
- </documentation></annotation>
- </attribute>
- <attribute name="service" type="string">
- <annotation><documentation>The name of the service in the esb.
- </documentation></annotation>
- </attribute>
- </complexType>
-
- <attributeGroup name="activityAttributes">
- <attribute name="name" type="string">
- <annotation><documentation>The id of this activity. The name should be unique
- in the complete scope of the process.</documentation></annotation>
- </attribute>
- <attribute name="g" type="string">
- <annotation><documentation>Graphical information used by process designer tool.
- </documentation></annotation>
- </attribute>
- </attributeGroup>
-
- <attributeGroup name="assignmentAttributes">
- <annotation><documentation>the assignment attributes will be used in
- tasks and swimlanes to specify to whom these respectively are assigned.
- </documentation></annotation>
- <attribute name="assignee" type="string">
- <annotation><documentation>Expression that resolves to a userId referencing
- the person to which the task or swimlane will be assigned.
- </documentation></annotation>
- </attribute>
- <attribute name="assignee-lang" type="string">
- <annotation><documentation>Expression language for the assignee attribute.
- </documentation></annotation>
- </attribute>
- <attribute name="candidate-users" type="string">
- <annotation><documentation>Expression that resolves to a comma separated
- list of userId's. All the referred people will be candidates for
- take the task or swimlane.</documentation></annotation>
- </attribute>
- <attribute name="candidate-users-lang" type="string">
- <annotation><documentation>Expression language for the
- candidate-users attribute.</documentation></annotation>
- </attribute>
- <attribute name="candidate-groups" type="string">
- <annotation><documentation>Resolves to a comma separated list of groupId's.
- All the referred people will be candidates to
- take the task or swimlane.</documentation></annotation>
- </attribute>
- <attribute name="candidate-groups-lang" type="string">
- <annotation><documentation>Expression language for the
- candidate-groups attribute.</documentation></annotation>
- </attribute>
- </attributeGroup>
-
- <element name="swimlane">
- <annotation><documentation>A process role.</documentation></annotation>
- <complexType>
- <attribute name="name" type="string" use="required" />
- <attributeGroup ref="tns:assignmentAttributes" />
- </complexType>
- </element>
-
- <complexType name="transitionType">
- <annotation><documentation>The outgoing transitions. The first in the list
- will be the default outgoing transition.
- </documentation></annotation>
- <sequence>
- <group ref="tns:eventListenerGroup" minOccurs="0" maxOccurs="unbounded" />
- </sequence>
- <attribute name="name" type="string">
- <annotation><documentation>Name of this outgoing transition</documentation></annotation>
- </attribute>
- <attribute name="to" type="string">
- <annotation><documentation>Name of the destination activity of this transition.
- </documentation></annotation>
- </attribute>
- <attribute name="g" type="string">
- <annotation><documentation>Graphical information used by process designer tool.
- </documentation></annotation>
- </attribute>
- </complexType>
-
- <element name="transition" type="tns:transitionType">
- <annotation><documentation>A transition from one activity to another.</documentation></annotation>
- </element>
-
- <element name="on">
- <complexType>
- <sequence>
- <group ref="tns:eventListenerGroup" minOccurs="0" maxOccurs="unbounded">
- <annotation><documentation>A list of event listeners that will
- be notified when the event is fired</documentation></annotation>
- </group>
- </sequence>
- <attribute name="event" type="string">
- <annotation><documentation>The event identification. start, end, take or
- any other custom event.
- </documentation></annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="timer">
- <complexType>
- <sequence>
- <group ref="tns:eventListenerGroup" minOccurs="0" maxOccurs="unbounded">
- <annotation><documentation>A list of event listeners that will
- be notified when the timer fires</documentation></annotation>
- </group>
- </sequence>
- <attribute name="event" type="string">
- <annotation><documentation>The event identification for this timer event.
- </documentation></annotation>
- </attribute>
- <attribute name="transition" type="string">
- <annotation><documentation>The name of the outgoing transition that must be
- taken when this timer fires.
- </documentation></annotation>
- </attribute>
- <attribute name="duedate" type="string">
- <annotation><documentation>Timer duedate expression that defines the duedate of this
- timer relative to the creation time of the timer. E.g. '2 hours' or '4 business days'
- </documentation></annotation>
- </attribute>
- <attribute name="repeat" type="string">
- <annotation><documentation>Timer duedate expression that defines repeated scheduling
- relative to the last timer fire event. E.g. '2 hours' or '4 business days'
- </documentation></annotation>
- </attribute>
- <attribute name="duedatetime" type="string">
- <annotation><documentation>Absolute time in format <code>HH:mm dd/MM/yyyy</code>
- (see SimpleDateFormat). The format for the absolute time can be customized in the
- jbpm configuration.
- </documentation></annotation>
- </attribute>
- </complexType>
- </element>
-
- <group name="eventListenerGroup">
- <choice>
- <element name="event-listener" type="tns:wireObjectType" />
- <element name="hql" type="tns:qlType" />
- <element name="sql" type="tns:qlType" />
- <element name="java" type="tns:javaType" />
- <element name="script" type="tns:scriptType" />
- <element name="esb" type="tns:esbType" />
- </choice>
- </group>
-
- <complexType name="emailType">
- <sequence>
- <element name="property">
- <annotation><documentation>Template property value</documentation></annotation>
- <complexType>
- <attribute name="name" type="string" />
- <attribute name="value" type="string" />
- </complexType>
- </element>
- </sequence>
- <attribute name="to" type="string" />
- <attribute name="type" type="string">
- <annotation><documentation>Reference to the email template</documentation></annotation>
- </attribute>
- </complexType>
-
- <complexType name="taskType" >
- <!--
- <sequence>
- <element name="reminder">
- <complexType>
- <attribute name="duedate" type="string" use="required" />
- <attribute name="repeat" type="string" />
- </complexType>
- </element>
- </sequence>
- -->
- <attributeGroup ref="tns:assignmentAttributes" />
- <attribute name="form" type="string">
- </attribute>
- <attribute name="swimlane" type="string">
- </attribute>
- <attribute name="description" type="string" />
- <attribute name="duedate" type="string" />
- <attribute name="notify" type="boolean" default="false"/>
- <!--
- <attribute name="subtasksync">
- <simpleType>
- <union>
- <simpleType>
- <restriction base="string">
- <enumeration value="last">
- <annotation><documentation>When the last subtask completes,
- this task is completed.</documentation></annotation>
- </enumeration>
- <enumeration value="first">
- <annotation><documentation>When the first subtask completes,
- this task is completed.</documentation></annotation>
- </enumeration>
- </restriction>
- </simpleType>
- <simpleType>
- <restriction base="int">
- <annotation><documentation>The number of subtasks that
- have to complete before this task is considered
- completed.</documentation></annotation>
- </restriction>
- </simpleType>
- </union>
- </simpleType>
- </attribute>
- -->
- </complexType>
-
- <!--
- <element name="timer">
- <annotation><documentation>A timer that will be bound to the most inner enclosing scope.
- Timers can give a signal to an activity instance. The signal will correspond to a transition
- or to an event being fired.
- </documentation></annotation>
- <complexType>
- <choice minOccurs="0" maxOccurs="unbounded">
- <group ref="tns:eventListenerGroup">
- <annotation><documentation>An inline list of event listeners
- on a timer is a short cut for defining the event separately.
- </documentation></annotation>
- </group>
- </choice>
- <attribute name="duedate" type="string" use="required" />
- <attribute name="signal" type="string" use="required">
- <annotation><documentation>Refers to the signal that will be used.
- If inline event listeners are declared, the signal name can not be
- the same as an event that is declared in this scope.
- </documentation></annotation>
- </attribute>
- <attribute name="repeat" type="string" />
- </complexType>
- </element>
-
- <simpleType name="priorityType">
- <restriction base="string">
- <enumeration value="highest"/>
- <enumeration value="high"/>
- <enumeration value="normal"/>
- <enumeration value="low"/>
- <enumeration value="lowest"/>
- </restriction>
- </simpleType>
-
- -->
-
-</schema>
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-04-17 09:21:43 UTC (rev 4574)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-04-17 09:23:24 UTC (rev 4575)
@@ -82,7 +82,7 @@
parseBindings();
List<String> schemaResources = new ArrayList<String>();
- schemaResources.add("jpdl.xsd");
+ schemaResources.add("jpdl-4.0.xsd");
setSchemaResources(schemaResources);
}
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Installation.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Installation.xml 2009-04-17 09:21:43 UTC (rev 4574)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Installation.xml 2009-04-17 09:23:24 UTC (rev 4575)
@@ -161,7 +161,7 @@
<listitem>Click 'Add...'</listitem>
<listitem>The 'Add XML Catalog Entry' dialog opens</listitem>
<listitem>Click the button with the map-icon next to location and select 'File System...'</listitem>
- <listitem>In the dialog that opens, select file <literal>jpdl.xsd</literal>
+ <listitem>In the dialog that opens, select file <literal>jpdl-4.0.xsd</literal>
in the src directory of the jBPM installation root.</listitem>
<listitem>Click 'Open' and close all the dialogs</listitem>
</itemizedlist>
17 years