JBoss JBPM SVN: r3194 - in projects/gwt-console/trunk/war/src: main/java/org/jboss/bpm/console/client/process and 3 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-12-04 05:06:02 -0500 (Thu, 04 Dec 2008)
New Revision: 3194
Modified:
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Editor.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionListEditor.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentFormPanel.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskDetailsFormPanel.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskList.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskListEditor.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/ModelListenerRegistry.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/RemoteListView.java
projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/GwtTestProcessManagement.java
Log:
Fire reset model events when remote list view changes
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Editor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Editor.java 2008-12-04 09:30:45 UTC (rev 3193)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Editor.java 2008-12-04 10:06:02 UTC (rev 3194)
@@ -30,11 +30,9 @@
*/
public abstract class Editor extends Panel
{
-
protected Editor()
{
- super();
-
+ super();
}
public abstract String getEditorId();
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java 2008-12-04 09:30:45 UTC (rev 3193)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java 2008-12-04 10:06:02 UTC (rev 3194)
@@ -32,6 +32,7 @@
import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.client.widgets.RemoteListView;
+import org.jboss.bpm.console.client.widgets.ModelModificationCallback;
import java.util.*;
@@ -42,9 +43,9 @@
{
private Map<Integer, ProcessDefinitionRef> row2ProcessMap = new HashMap<Integer, ProcessDefinitionRef>();
- public ProcessDefinitionList(String titleName, final MainView view)
+ public ProcessDefinitionList(ModelModificationCallback callback, String titleName, final MainView view)
{
- super(titleName, view, getResourceUrl(view));
+ super(callback, titleName, view, getResourceUrl(view));
enableAddBtn(false);
final RowSelectionModel sm = new RowSelectionModel(true);
setRowSelectionModel(sm);
@@ -125,7 +126,7 @@
public void onResponseReceived(Request request, Response response)
{
- reloadStore();
+ modelModificationCallback.onStaleModel();
}
public void onError(Request request, Throwable t)
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionListEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionListEditor.java 2008-12-04 09:30:45 UTC (rev 3193)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionListEditor.java 2008-12-04 10:06:02 UTC (rev 3194)
@@ -21,11 +21,12 @@
*/
package org.jboss.bpm.console.client.process;
-import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.core.client.GWT;
import com.gwtext.client.core.Connection;
import com.gwtext.client.core.EventObject;
-import com.gwtext.client.widgets.*;
+import com.gwtext.client.widgets.Button;
+import com.gwtext.client.widgets.MessageBox;
+import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
import com.gwtext.client.widgets.form.Form;
import com.gwtext.client.widgets.form.FormPanel;
@@ -33,19 +34,17 @@
import com.gwtext.client.widgets.form.event.FormListenerAdapter;
import com.gwtext.client.widgets.layout.ColumnLayout;
import com.gwtext.client.widgets.layout.ColumnLayoutData;
-import com.gwtext.client.widgets.layout.VerticalLayout;
-import org.jboss.bpm.console.client.util.ConsoleLog;
-import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.Editor;
+import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.UIConstants;
-import org.jboss.bpm.console.client.metric.MetricOverviewEditor;
import org.jboss.bpm.console.client.model.DAOFactory;
import org.jboss.bpm.console.client.model.HelpDAO;
-import org.jboss.bpm.console.client.widgets.*;
+import org.jboss.bpm.console.client.util.ConsoleLog;
+import org.jboss.bpm.console.client.widgets.HelpPanel;
+import org.jboss.bpm.console.client.widgets.ModelListenerRegistry;
+import org.jboss.bpm.console.client.widgets.ModelModificationCallback;
+import org.jboss.bpm.console.client.widgets.TeaserPanel;
-import java.util.HashMap;
-import java.util.Map;
-
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
@@ -54,10 +53,9 @@
public final static String ID = "org.jboss.bpm.process.ProcessDefinitionListEditor";
private ProcessDefinitionList processDefinitionList;
-
private MainView view;
-
private Panel teaserPanel;
+ private ModelListenerRegistry modelListeners = new ModelListenerRegistry();
public ProcessDefinitionListEditor(final MainView view)
{
@@ -74,12 +72,26 @@
final Panel leftHand = new Panel();
leftHand.setFrame(false);
leftHand.setHeader(false);
- leftHand.setBorder(false);
-
- processDefinitionList = new ProcessDefinitionList("Process Definitions", view);
+ leftHand.setBorder(false);
// ----------------------------------
+
+ final ModelModificationCallback modelModificationCallback = new ModelModificationCallback()
+ {
+ public void onStaleModel()
+ {
+ resetEditor();
+ }
+ };
+ // ----------------------------------
+
+ processDefinitionList = new ProcessDefinitionList(
+ modelModificationCallback, "Process Definitions", view
+ );
+
+ // ----------------------------------
+
Panel outerFormPanel = new Panel();
outerFormPanel.setBorder(false);
outerFormPanel.setPaddings(10);
@@ -107,6 +119,7 @@
}
});
formPanel.addButton(uploadButton);
+
formPanel.getForm().addListener(
new FormListenerAdapter()
{
@@ -147,59 +160,6 @@
// ----------------------------------
- // TODO: introduce abstractions and integrate with DAO
- Map chartValues = new HashMap();
- chartValues.put("1", new Double(0.65));
- chartValues.put("2", new Double(0.20));
- chartValues.put("3", new Double(0.10));
- chartValues.put("4", new Double(0.5));
-
- PieChart pieChart = new PieChart(180, 120, "", chartValues);
- Panel metricPanel = new Panel("Most active process", 200, 300);
- metricPanel.setLayout(new VerticalLayout());
- metricPanel.setIconCls("bpm-metric-icon");
-
- metricPanel.add(pieChart);
- HTML legend = new HTML(
- "<ol class='piechart-types'>" +
- "<li>1. Order Process" +
- "<li>2. Loan application" +
- "<li>3. Expense claim" +
- "<li>4. Credit approval" +
- "</ol>"
- );
- Panel legendPanel = new Panel();
- legendPanel.setBorder(false);
- legendPanel.setFrame(false);
- legendPanel.setHideBorders(true);
- legendPanel.setPaddings(5);
- legendPanel.add(legend);
- metricPanel.add(legendPanel);
-
- // toolbar
-
- Toolbar bottomToolbar = new Toolbar();
- bottomToolbar.addFill();
- bottomToolbar.addButton(
- new ToolbarButton("More metrics", new ButtonListenerAdapter() {
- public void onClick(Button button, EventObject e)
- {
- if(view.hasEditor(MetricOverviewEditor.ID))
- {
- view.showEditor(MetricOverviewEditor.ID);
- }
- else
- {
- view.addEditor( new MetricOverviewEditor(view) );
- }
- }
- })
- );
-
- metricPanel.setBottomToolbar(bottomToolbar);
-
- // ----------------------------------
-
HelpPanel help = new HelpPanel(UIConstants.TEASER_PANEL_WIDTH, 180, "About process definitions");
help.setContent( DAOFactory.createHelpDAO().getHelpByReference(HelpDAO.REF_PROCESS_DEFINITIONS));
@@ -207,19 +167,17 @@
teaserPanel = new TeaserPanel();
teaserPanel.add(help);
- teaserPanel.add(metricPanel);
// ----------------------------------
leftHand.add(processDefinitionList);
leftHand.add(outerFormPanel);
-
+
+ // ----------------------------------
+
this.add(leftHand, new ColumnLayoutData(0.7) );
this.add(teaserPanel , new ColumnLayoutData(0.3) );
- // init gchart
- pieChart.update();
-
}
@@ -242,4 +200,10 @@
{
return processDefinitionList;
}
+
+ public void resetEditor()
+ {
+ processDefinitionList.reloadStore();
+ modelListeners.fireResetEvent();
+ }
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java 2008-12-04 09:30:45 UTC (rev 3193)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java 2008-12-04 10:06:02 UTC (rev 3194)
@@ -37,6 +37,7 @@
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.client.model.DTOParser;
import org.jboss.bpm.console.client.widgets.RemoteListView;
+import org.jboss.bpm.console.client.widgets.ModelModificationCallback;
import java.util.HashMap;
import java.util.Map;
@@ -48,11 +49,11 @@
{
private Map<Integer, ProcessInstanceRef> row2InstanceMap = new HashMap<Integer, ProcessInstanceRef>();
- private ProcessDefinitionRef parent;
+ private ProcessDefinitionRef parent;
- public ProcessInstanceList(ProcessDefinitionRef procDef, String titleName, MainView view)
+ public ProcessInstanceList(ModelModificationCallback callback, ProcessDefinitionRef procDef, String titleName, MainView view)
{
- super(titleName, view, getResourceUrl(view, procDef.getProcessId()));
+ super(callback,titleName, view, getResourceUrl(view, procDef.getProcessId()));
this.parent = procDef;
}
@@ -95,7 +96,7 @@
public void onResponseReceived(Request request, Response response)
{
- reloadStore();
+ modelModificationCallback.onStaleModel();
}
public void onError(Request request, Throwable t)
@@ -145,7 +146,7 @@
}
else
{
- reloadStore();
+ modelModificationCallback.onStaleModel();
doLayout();
}
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java 2008-12-04 09:30:45 UTC (rev 3193)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java 2008-12-04 10:06:02 UTC (rev 3194)
@@ -57,7 +57,7 @@
private TabPanel tabPanel;
- private ModelListenerRegistry modelListeners;
+ private ModelListenerRegistry modelListeners = new ModelListenerRegistry();
private ModelModificationCallback modelModificationCallback;
public ProcessInstanceListEditor(ProcessDefinitionRef proc, final MainView view)
@@ -75,17 +75,21 @@
// ---------------
- this.modelListeners = new ModelListenerRegistry(this);
-
- // ---------------
-
Panel leftHand = new Panel();
leftHand.setFrame(false);
leftHand.setHeader(false);
leftHand.setBorder(false);
- instanceList = new ProcessInstanceList(proc, "Process Instances", view);
+ modelModificationCallback = new ModelModificationCallback()
+ {
+ public void onStaleModel()
+ {
+ resetEditor();
+ }
+ };
+ instanceList = new ProcessInstanceList(modelModificationCallback, proc, "Process Instances", view);
+
// ---------------
tabPanel = new TabPanel();
@@ -98,13 +102,7 @@
// ----------------------------------------
- modelModificationCallback = new ModelModificationCallback()
- {
- public void onStaleModel()
- {
- resetEditor();
- }
- };
+
detailsForm = new ProcessInstanceDetailForm(view, modelModificationCallback);
modelListeners.addListener( (ModelChangeListener) detailsForm);
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentFormPanel.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentFormPanel.java 2008-12-04 09:30:45 UTC (rev 3193)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentFormPanel.java 2008-12-04 10:06:02 UTC (rev 3194)
@@ -116,8 +116,7 @@
public void onModelChange(ModelListenerRegistry parent, Object changeEvent)
- {
- TaskListEditor editor = (TaskListEditor)parent.getUnderlying();
+ {
selectedInstance= (TaskRef)changeEvent;
availableActors = null;
@@ -231,6 +230,7 @@
public void onReset()
{
- formPanel.getForm().reset();
+ Form form = formPanel.getForm();
+ form.reset();
}
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskDetailsFormPanel.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskDetailsFormPanel.java 2008-12-04 09:30:45 UTC (rev 3193)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskDetailsFormPanel.java 2008-12-04 10:06:02 UTC (rev 3194)
@@ -229,8 +229,7 @@
public void onRecordChange(ModelListenerRegistry parent, Record changeEvent)
- {
- TaskListEditor editor = (TaskListEditor)parent.getUnderlying();
+ {
selectedInstance = TaskList.transform(changeEvent);
Form form = formPanel.getForm();
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskList.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskList.java 2008-12-04 09:30:45 UTC (rev 3193)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskList.java 2008-12-04 10:06:02 UTC (rev 3194)
@@ -35,6 +35,7 @@
import com.gwtext.client.widgets.grid.event.GridCellListener;
import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.UIConstants;
+import org.jboss.bpm.console.client.widgets.ModelModificationCallback;
import org.jboss.bpm.console.client.model.DTOParser;
import org.jboss.bpm.console.client.model.TaskRef;
@@ -55,10 +56,13 @@
public static final int PAGE_SIZE = 15;
private int selectedRowIndex = -1;
- public TaskList(String titleName, final MainView view)
+ private ModelModificationCallback modelModificationCallback;
+
+ public TaskList(ModelModificationCallback callback, String titleName, final MainView view)
{
this.mainView = view;
this.title = titleName;
+ this.modelModificationCallback = callback;
this.setPaddings(10);
this.setHeader(false);
@@ -86,7 +90,7 @@
{
public boolean doBeforeRender(Component component)
{
- reloadStore();
+ modelModificationCallback.onStaleModel();
return true;
}
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskListEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskListEditor.java 2008-12-04 09:30:45 UTC (rev 3193)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskListEditor.java 2008-12-04 10:06:02 UTC (rev 3194)
@@ -38,6 +38,7 @@
import org.jboss.bpm.console.client.widgets.ModelChangeListener;
import org.jboss.bpm.console.client.widgets.ModelListenerRegistry;
import org.jboss.bpm.console.client.widgets.TeaserPanel;
+import org.jboss.bpm.console.client.widgets.ModelModificationCallback;
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
@@ -52,7 +53,7 @@
private boolean initialized;
private TabPanel tabPanel;
- private ModelListenerRegistry modelListeners;
+ private ModelListenerRegistry modelListeners =new ModelListenerRegistry();
public TaskListEditor(MainView mainView)
{
@@ -60,8 +61,6 @@
this.setId(ID);
this.mainView = mainView;
- this.modelListeners = new ModelListenerRegistry(this);
-
this.setLayout( new ColumnLayout() );
this.setWidth(UIConstants.EDITOR_WIDTH);
@@ -117,7 +116,16 @@
// ----------------------------------
- taskList = new TaskList("Task overview", mainView);
+ ModelModificationCallback modelModificationCallback = new ModelModificationCallback()
+ {
+
+ public void onStaleModel()
+ {
+ resetEditor();
+ }
+ };
+
+ taskList = new TaskList(modelModificationCallback, "Task overview", mainView);
final RowSelectionModel sm = new RowSelectionModel(true);
sm.addListener(
new RowSelectionListenerAdapter()
@@ -165,13 +173,19 @@
return true;
}
- public void onAssignmentDone()
+ private void resetEditor()
{
taskList.reloadStore();
+ modelListeners.fireResetEvent();
}
+ public void onAssignmentDone()
+ {
+ resetEditor();
+ }
+
public void onTaskEnd()
{
- taskList.reloadStore();
+ resetEditor();
}
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/ModelListenerRegistry.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/ModelListenerRegistry.java 2008-12-04 09:30:45 UTC (rev 3193)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/ModelListenerRegistry.java 2008-12-04 10:06:02 UTC (rev 3194)
@@ -34,14 +34,7 @@
public class ModelListenerRegistry
{
private List<ModelChangeListener> listeners = new ArrayList<ModelChangeListener>();
-
- private Object underlying;
-
- public ModelListenerRegistry(Object underlying)
- {
- this.underlying = underlying;
- }
-
+
public void addListener(ModelChangeListener listener)
{
this.listeners.add(listener);
@@ -70,9 +63,4 @@
l.onReset();
}
}
-
- public Object getUnderlying()
- {
- return underlying;
- }
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/RemoteListView.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/RemoteListView.java 2008-12-04 09:30:45 UTC (rev 3193)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/RemoteListView.java 2008-12-04 10:06:02 UTC (rev 3194)
@@ -66,10 +66,13 @@
protected String resourceUrl;
- public RemoteListView(String titleName, MainView view, String resourceUrl)
+ protected ModelModificationCallback modelModificationCallback;
+
+ public RemoteListView(ModelModificationCallback callback, String titleName, MainView view, String resourceUrl)
{
super();
+ this.modelModificationCallback = callback;
this.title = titleName;
this.view = view;
this.resourceUrl = resourceUrl;
@@ -97,7 +100,7 @@
{
public boolean doBeforeRender(Component component)
{
- reloadStore();
+ modelModificationCallback.onStaleModel();
return true;
}
}
@@ -238,6 +241,7 @@
public void onLoad(Store store, Record[] records)
{
+
onRecordsLoaded(records);
grid = assembleGrid();
Modified: projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/GwtTestProcessManagement.java
===================================================================
--- projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/GwtTestProcessManagement.java 2008-12-04 09:30:45 UTC (rev 3193)
+++ projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/GwtTestProcessManagement.java 2008-12-04 10:06:02 UTC (rev 3194)
@@ -127,8 +127,8 @@
public void run()
{
ProcessDefinitionListEditor editor = (ProcessDefinitionListEditor) context.get("editor");
+ editor.resetEditor();
ProcessDefinitionList list = editor.getProcessDefinitionList();
- list.reloadStore(); // trigger async load operation
proceedOrFinish();
}
}
15 years, 5 months
JBoss JBPM SVN: r3193 - in jbpm4/trunk: modules/api/src/main/java/org/jbpm and 5 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-12-04 04:30:45 -0500 (Thu, 04 Dec 2008)
New Revision: 3193
Added:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionQuery.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessDefinitionQuery.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/HqlQueryCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionQueryImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessDefinitionQueryImpl.java
Modified:
jbpm4/trunk/eclipse/jbpm.code.templates.xml
jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessService.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessDefinitionCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/PvmDbSessionBinding.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/svc/ProcessServiceTest.java
jbpm4/trunk/modules/userguide/.settings/attachedFile.properties
Log:
query capabilities and completed process service testing
Modified: jbpm4/trunk/eclipse/jbpm.code.templates.xml
===================================================================
--- jbpm4/trunk/eclipse/jbpm.code.templates.xml 2008-12-04 09:21:44 UTC (rev 3192)
+++ jbpm4/trunk/eclipse/jbpm.code.templates.xml 2008-12-04 09:30:45 UTC (rev 3193)
@@ -28,10 +28,7 @@
</template><template autoinsert="true" context="interfacebody_context" deleted="false" description="Code in new interface type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name="interfacebody">
</template><template autoinsert="true" context="enumbody_context" deleted="false" description="Code in new enum type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.enumbody" name="enumbody">
</template><template autoinsert="true" context="annotationbody_context" deleted="false" description="Code in new annotation type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name="annotationbody">
-</template><template autoinsert="true" context="catchblock_context" deleted="false" description="Code in new catch blocks" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.catchblock" name="catchblock">// ${todo} Auto-generated catch block
-${exception_var}.printStackTrace();</template><template autoinsert="true" context="methodbody_context" deleted="false" description="Code in created method stubs" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodbody" name="methodbody">// ${todo} Auto-generated method stub
-${body_statement}</template><template autoinsert="true" context="constructorbody_context" deleted="false" description="Code in created constructor stubs" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name="constructorbody">${body_statement}
-// ${todo} Auto-generated constructor stub</template><template autoinsert="true" context="getterbody_context" deleted="false" description="Code in created getters" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.getterbody" name="getterbody">return ${field};</template><template autoinsert="true" context="setterbody_context" deleted="false" description="Code in created setters" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.setterbody" name="setterbody">${field} = ${param};</template><template autoinsert="true" context="gettercomment_context" deleted="false" description="Comment for getter function" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name="gettercomment">/**
+</template><template autoinsert="false" context="catchblock_context" deleted="false" description="Code in new catch blocks" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.catchblock" name="catchblock">${exception_var}.printStackTrace();</template><template autoinsert="false" context="methodbody_context" deleted="false" description="Code in created method stubs" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodbody" name="methodbody">${body_statement}</template><template autoinsert="false" context="constructorbody_context" deleted="false" description="Code in created constructor stubs" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name="constructorbody">${body_statement}</template><template autoinsert="true" context="getterbody_context" deleted="false" description="Code in created getters" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.getterbody" name="getterbody">return ${field};</template><template autoinsert="!
true" context="setterbody_context" deleted="false" description="Code in created setters" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.setterbody" name="setterbody">${field} = ${param};</template><template autoinsert="true" context="gettercomment_context" deleted="false" description="Comment for getter function" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name="gettercomment">/**
* @return the ${bare_field_name}
*/</template><template autoinsert="true" context="settercomment_context" deleted="false" description="Comment for setter function" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name="settercomment">/**
* @param ${param} the ${bare_field_name} to set
@@ -57,7 +54,4 @@
${typecomment}
${type_declaration}</template><template autoinsert="true" context="classbody_context" deleted="false" description="Code in new class type bodies" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name="classbody">
-</template><template autoinsert="true" context="catchblock_context" deleted="false" description="Code in new catch blocks" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name="catchblock">// ${todo} Auto-generated catch block
-${exception_var}.printStackTrace();</template><template autoinsert="true" context="methodbody_context" deleted="false" description="Code in created function stubs" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name="methodbody">// ${todo} Auto-generated function stub
-${body_statement}</template><template autoinsert="true" context="constructorbody_context" deleted="false" description="Code in created constructor stubs" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name="constructorbody">${body_statement}
-// ${todo} Auto-generated constructor stub</template><template autoinsert="true" context="getterbody_context" deleted="false" description="Code in created getters" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name="getterbody">return ${field};</template><template autoinsert="true" context="setterbody_context" deleted="false" description="Code in created setters" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name="setterbody">${field} = ${param};</template></templates>
\ No newline at end of file
+</template><template autoinsert="false" context="catchblock_context" deleted="false" description="Code in new catch blocks" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name="catchblock">${exception_var}.printStackTrace();</template><template autoinsert="false" context="methodbody_context" deleted="false" description="Code in created function stubs" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name="methodbody">${body_statement}</template><template autoinsert="false" context="constructorbody_context" deleted="false" description="Code in created constructor stubs" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name="constructorbody">${body_statement}</template><template autoinsert="true" context="getterbody_context" deleted="false" description="Code in created getters" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name="getterbody">return ${field};</template>!
<template autoinsert="true" context="setterbody_context" deleted="false" description="Code in created setters" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name="setterbody">${field} = ${param};</template></templates>
\ No newline at end of file
Added: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionQuery.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionQuery.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionQuery.java 2008-12-04 09:30:45 UTC (rev 3193)
@@ -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;
+
+import java.util.List;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface ExecutionQuery {
+
+ ExecutionQuery onlyProcessInstances();
+
+ ExecutionQuery processDefinitionNameLike(String processDefinitionName);
+ ExecutionQuery processDefinitionKeyLike(String processDefinitionKey);
+ ExecutionQuery processDefinitionId(String processDefinitionId);
+
+ ExecutionQuery orderByKeyAsc();
+ ExecutionQuery orderByKeyDesc();
+
+ List<Execution> list();
+ List<Execution> list(int firstResult, int maxResults);
+}
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionQuery.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java 2008-12-04 09:21:44 UTC (rev 3192)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java 2008-12-04 09:30:45 UTC (rev 3193)
@@ -112,7 +112,8 @@
/** provides a named external trigger to an execution with parameters. */
Execution signalExecutionByKey(String processDefinitionName, String executionKey, String signalName, Map<String, Object> parameters);
-
+ /** search for executions with criteria */
+ ExecutionQuery createExecutionQuery();
/** creates or overwrites a variable value on the referenced execution */
Execution setVariable(String executionId, String name, Object value);
Added: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessDefinitionQuery.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessDefinitionQuery.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessDefinitionQuery.java 2008-12-04 09:30:45 UTC (rev 3193)
@@ -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;
+
+import java.util.List;
+
+/**
+ * @author Tom Baeyens
+ */
+public interface ProcessDefinitionQuery {
+
+ ProcessDefinitionQuery nameLike(String name);
+ ProcessDefinitionQuery keyLike(String key);
+
+ ProcessDefinitionQuery orderByNameAsc();
+ ProcessDefinitionQuery orderByNameDesc();
+
+ ProcessDefinitionQuery orderByKeyAsc();
+ ProcessDefinitionQuery orderByKeyDesc();
+
+ List<ProcessDefinition> list();
+ List<ProcessDefinition> list(int firstResult, int maxResults);
+}
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessDefinitionQuery.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessService.java 2008-12-04 09:21:44 UTC (rev 3192)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessService.java 2008-12-04 09:30:45 UTC (rev 3193)
@@ -36,7 +36,9 @@
/** all deployed process definition keys. */
List<String> findProcessDefinitionKeys();
- /** all versions of the given process. */
+ /** all versions of the given process.
+ * @return the process definitions in descending version order. So you get the
+ * highest version number as the first. */
List<ProcessDefinition> findProcessDefinitionsByKey(String processDefinitionKey);
/** latest version of the processDefinition with the given key. */
@@ -44,6 +46,9 @@
/** specific version of a named processDefinition. */
ProcessDefinition findProcessDefinitionById(String processDefinitionId);
+
+ /** search for process definitions */
+ ProcessDefinitionQuery createProcessDefinitionQuery();
/** deletes process definition if there are no existing executions.
* @throws JbpmException if there are existing executions. */
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessDefinitionCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessDefinitionCmd.java 2008-12-04 09:21:44 UTC (rev 3192)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessDefinitionCmd.java 2008-12-04 09:30:45 UTC (rev 3193)
@@ -24,6 +24,7 @@
import org.jbpm.JbpmException;
import org.jbpm.cmd.Command;
import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.wire.binding.PvmDbSessionBinding;
import org.jbpm.session.PvmDbSession;
@@ -49,7 +50,7 @@
public Void execute(Environment environment) {
PvmDbSession pvmDbSession = Environment.getFromCurrent(PvmDbSession.class);
if (pvmDbSession==null) {
- throw new JbpmException("no PvmDbSession configured");
+ throw new JbpmException("no "+PvmDbSessionBinding.TAG+" configured");
}
pvmDbSession.deleteProcessDefinition(processDefinitionId, deleteProcessInstances);
return null;
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/HqlQueryCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/HqlQueryCmd.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/HqlQueryCmd.java 2008-12-04 09:30:45 UTC (rev 3193)
@@ -0,0 +1,74 @@
+/*
+ * 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 java.util.List;
+
+import org.hibernate.Query;
+import org.hibernate.Session;
+import org.jbpm.JbpmException;
+import org.jbpm.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.log.Log;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class HqlQueryCmd implements Command<List<Object>> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static Log log = Log.getLog(HqlQueryCmd.class.getName());
+
+ String hql;
+ Integer firstResult;
+ Integer maxResults;
+
+ public HqlQueryCmd(String hql, Integer firstResult, Integer maxResults) {
+ this.hql = hql;
+ this.firstResult = firstResult;
+ this.maxResults = maxResults;
+ }
+
+ public List<Object> execute(Environment environment) throws Exception {
+ Session session = environment.get(Session.class);
+ if (session==null) {
+ throw new JbpmException("no hibernate-session defined in configuration");
+ }
+
+ Query query = session.createQuery(hql);
+ if (firstResult!=null) {
+ query.setFirstResult(firstResult);
+ }
+ if (maxResults!=null) {
+ query.setMaxResults(maxResults);
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug("executing hql: ");
+ log.debug(hql);
+ }
+
+ return query.list();
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/HqlQueryCmd.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionQueryImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionQueryImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionQueryImpl.java 2008-12-04 09:30:45 UTC (rev 3193)
@@ -0,0 +1,142 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.svc;
+
+import java.util.List;
+
+import org.jbpm.Execution;
+import org.jbpm.ExecutionQuery;
+import org.jbpm.cmd.CommandService;
+import org.jbpm.pvm.internal.cmd.HqlQueryCmd;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExecutionQueryImpl implements ExecutionQuery {
+
+ private static final String NEWLINE = System.getProperty("line.separator");
+
+ protected boolean onlyProcessInstances;
+ protected String processDefinitionNameLike;
+ protected String processDefinitionKeyLike;
+ protected String processDefinitionId;
+ protected String order;
+ protected Integer firstResult;
+ protected Integer maxResults;
+
+ protected CommandService commandService;
+
+ public ExecutionQueryImpl(CommandService commandService) {
+ this.commandService = commandService;
+ }
+
+ protected String buildHql() {
+ StringBuffer hql = new StringBuffer();
+ hql.append("select e ");
+ hql.append(NEWLINE);
+ hql.append("from "+ExecutionImpl.class.getName()+" as e ");
+ hql.append(NEWLINE);
+
+ boolean where = false;
+
+ if (processDefinitionId!=null) {
+ where = true;
+ hql.append("where e.processDefinition.id = '"+processDefinitionId+"'");
+ hql.append(NEWLINE);
+ }
+
+ if (processDefinitionNameLike!=null) {
+ where = true;
+ addWhereOrAnd(hql, where);
+ hql.append("e.processDefinition.name like '"+processDefinitionNameLike+"'");
+ hql.append(NEWLINE);
+ }
+
+ if (processDefinitionKeyLike!=null) {
+ where = true;
+ addWhereOrAnd(hql, where);
+ hql.append("e.processDefinition.key like '"+processDefinitionKeyLike+"'");
+ hql.append(NEWLINE);
+ }
+
+ if (order!=null) {
+ hql.append("order by "+order);
+ }
+
+ return hql.toString();
+ }
+
+ private void addWhereOrAnd(StringBuffer hql, boolean where) {
+ if (where) {
+ hql.append(" and ");
+ } else {
+ hql.append("where ");
+ }
+ }
+
+ protected List<Execution> execute() {
+ String hql = buildHql();
+ return (List) commandService.execute(new HqlQueryCmd(hql, firstResult, maxResults));
+ }
+
+ public ExecutionQuery onlyProcessInstances() {
+ this.onlyProcessInstances = true;
+ return this;
+ }
+
+ public ExecutionQuery orderByKeyAsc() {
+ order = "e.key asc";
+ return this;
+ }
+
+ public ExecutionQuery orderByKeyDesc() {
+ order = "e.key desc";
+ return this;
+ }
+
+ public ExecutionQuery processDefinitionId(String processDefinitionId) {
+ this.processDefinitionId = processDefinitionId;
+ return this;
+ }
+
+ public ExecutionQuery processDefinitionKeyLike(String processDefinitionKey) {
+ this.processDefinitionKeyLike = processDefinitionKey;
+ return this;
+ }
+
+ public ExecutionQuery processDefinitionNameLike(String processDefinitionName) {
+ this.processDefinitionNameLike = processDefinitionName;
+ return this;
+ }
+
+ public List<Execution> list() {
+ return execute();
+ }
+
+ public List<Execution> list(int firstResult, int maxResults) {
+ this.firstResult = firstResult;
+ this.maxResults = maxResults;
+ return execute();
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionQueryImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java 2008-12-04 09:21:44 UTC (rev 3192)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java 2008-12-04 09:30:45 UTC (rev 3193)
@@ -26,6 +26,7 @@
import java.util.Set;
import org.jbpm.Execution;
+import org.jbpm.ExecutionQuery;
import org.jbpm.ExecutionService;
import org.jbpm.cmd.CommandService;
import org.jbpm.pvm.internal.cmd.DeleteProcessInstance;
@@ -135,6 +136,10 @@
public Execution findExecution(String executionId) {
return commandService.execute(new FindExecutionCmd(executionId));
}
+
+ public ExecutionQuery createExecutionQuery() {
+ return new ExecutionQueryImpl(commandService);
+ }
public void deleteProcessInstance(String processInstanceId) {
commandService.execute(new DeleteProcessInstance(processInstanceId));
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessDefinitionQueryImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessDefinitionQueryImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessDefinitionQueryImpl.java 2008-12-04 09:30:45 UTC (rev 3193)
@@ -0,0 +1,127 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.svc;
+
+import java.util.List;
+
+import org.jbpm.ProcessDefinition;
+import org.jbpm.ProcessDefinitionQuery;
+import org.jbpm.cmd.CommandService;
+import org.jbpm.pvm.internal.cmd.HqlQueryCmd;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ProcessDefinitionQueryImpl implements ProcessDefinitionQuery {
+
+ private static final String NEWLINE = System.getProperty("line.separator");
+
+ protected String nameLike;
+ protected String keyLike;
+ protected String order;
+ protected Integer firstResult;
+ protected Integer maxResults;
+
+ protected CommandService commandService;
+
+ public ProcessDefinitionQueryImpl(CommandService commandService) {
+ this.commandService = commandService;
+ }
+
+ protected String buildHql() {
+ StringBuffer hql = new StringBuffer();
+ hql.append("select pd ");
+ hql.append(NEWLINE);
+ hql.append("from "+ProcessDefinitionImpl.class.getName()+" as pd ");
+ hql.append(NEWLINE);
+
+ if (nameLike!=null) {
+ hql.append("where pd.name like '"+nameLike+"'");
+ hql.append(NEWLINE);
+ }
+
+ if (keyLike!=null) {
+ if (nameLike==null) {
+ hql.append("where ");
+ } else {
+ hql.append(" and ");
+ hql.append(NEWLINE);
+ }
+ hql.append("pd.key like '"+keyLike+"'");
+ hql.append(NEWLINE);
+ }
+
+ if (order!=null) {
+ hql.append("order by "+order);
+ }
+
+ return hql.toString();
+ }
+
+ protected List<ProcessDefinition> execute() {
+ String hql = buildHql();
+ return (List) commandService.execute(new HqlQueryCmd(hql, firstResult, maxResults));
+ }
+
+
+ public ProcessDefinitionQuery nameLike(String name) {
+ nameLike = name;
+ return this;
+ }
+
+ public ProcessDefinitionQuery keyLike(String key) {
+ keyLike = key;
+ return this;
+ }
+
+ public ProcessDefinitionQuery orderByKeyAsc() {
+ order = "pd.key asc";
+ return this;
+ }
+
+ public ProcessDefinitionQuery orderByKeyDesc() {
+ order = "pd.key desc";
+ return this;
+ }
+
+ public ProcessDefinitionQuery orderByNameAsc() {
+ order = "pd.name asc";
+ return this;
+ }
+
+ public ProcessDefinitionQuery orderByNameDesc() {
+ order = "pd.name desc";
+ return this;
+ }
+
+ public List<ProcessDefinition> list() {
+ return execute();
+ }
+
+ public List<ProcessDefinition> list(int firstResult, int maxResults) {
+ this.firstResult = firstResult;
+ this.maxResults = maxResults;
+ return execute();
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessDefinitionQueryImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java 2008-12-04 09:21:44 UTC (rev 3192)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java 2008-12-04 09:30:45 UTC (rev 3193)
@@ -25,6 +25,7 @@
import org.jbpm.Deployment;
import org.jbpm.ProcessDefinition;
+import org.jbpm.ProcessDefinitionQuery;
import org.jbpm.ProcessService;
import org.jbpm.cmd.CommandService;
import org.jbpm.model.OpenProcessDefinition;
@@ -72,7 +73,11 @@
commandService.execute(new DeleteProcessDefinitionCmd(processDefinitionId, true));
}
+ public ProcessDefinitionQuery createProcessDefinitionQuery() {
+ return new ProcessDefinitionQueryImpl(commandService);
+ }
+
public List<ProcessDefinition> deploy(Deployment deployment) {
return commandService.execute(new DeployCmd((DeploymentImpl)deployment));
@@ -82,7 +87,6 @@
DeploymentImpl deploymentImpl = new DeploymentImpl(processDefinition);
return commandService.execute(new DeployCmd(deploymentImpl));
}
-
public CommandService getCommandService() {
return commandService;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/PvmDbSessionBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/PvmDbSessionBinding.java 2008-12-04 09:21:44 UTC (rev 3192)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/PvmDbSessionBinding.java 2008-12-04 09:30:45 UTC (rev 3193)
@@ -34,9 +34,11 @@
* @author Tom Baeyens
*/
public class PvmDbSessionBinding extends WireDescriptorBinding {
+
+ public static final String TAG = "pvm-db-session";
public PvmDbSessionBinding() {
- super("pvm-db-session");
+ super(TAG);
}
public Object parse(Element element, Parse parse, Parser parser) {
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/svc/ProcessServiceTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/svc/ProcessServiceTest.java 2008-12-04 09:21:44 UTC (rev 3192)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/svc/ProcessServiceTest.java 2008-12-04 09:30:45 UTC (rev 3193)
@@ -35,40 +35,6 @@
*/
public class ProcessServiceTest extends DbTestCase {
- public void testMinimalProcess() {
- deployJpdlXmlString(
- "<process name='minimal'>" +
- " <start>" +
- " <flow to='end' />" +
- " </start>" +
- " <end name='end' />" +
- "</process>"
- );
-
- Execution execution = executionService.startExecutionByKey("minimal");
-
- assertEquals("end", execution.getNodeName());
- assertTrue(execution.isEnded());
- assertTrue(execution.isFinished());
- assertFalse(execution.isActive());
- }
-
- public void testMostMinimalProcess() {
- deployJpdlXmlString(
- "<process name='minimal'>" +
- " <start />" +
- "</process>"
- );
-
- Execution execution = executionService.startExecutionByKey("minimal");
-
- assertTrue(execution.isEnded());
- assertTrue(execution.isFinished());
- assertFalse(execution.isActive());
- }
-
- // user guide tests /////////////////////////////////////////////////////////
-
public void testProcessWithNameOnly() {
ProcessDefinition processDefinition = deployJpdlXmlString(
"<process name='Insurance claim'>" +
@@ -84,12 +50,14 @@
}
public void testProcessWithNameAndKey() {
- ProcessDefinition processDefinition = deployJpdlXmlString(
+ deployJpdlXmlString(
"<process name='Insurance claim' key='ICL'>" +
" <start />" +
"</process>"
);
+ ProcessDefinition processDefinition = processService.findLatestProcessDefinitionByKey("ICL");
+
assertNotNull(processDefinition);
assertEquals("Insurance claim", processDefinition.getName());
assertEquals("ICL", processDefinition.getKey());
@@ -97,7 +65,22 @@
assertEquals("ICL:1", processDefinition.getId());
}
+ // interface methods ////////////////////////////////////////////////////////
+ public void testFindProcessDefinitionKeys() {
+ deployMultipleVersionsOfProcesses();
+
+ List<String> processKeys = processService.findProcessDefinitionKeys();
+
+ List<String> expected = new ArrayList<String>();
+ expected.add("nuclear_fusion");
+ expected.add("publish_book");
+ expected.add("ultimate_seduction");
+
+ assertEquals(expected, processKeys);
+ }
+
+
public void testFindProcessByKey() {
deployJpdlXmlString(
"<process name='Name with spaces'>" +
@@ -113,23 +96,115 @@
assertEquals("Name_with_spaces:1", processDefinition.getId());
}
- public void testGivenKey() {
+ public void testFindProcessDefinitions() {
+ deployMultipleVersionsOfProcesses();
+
+ List<ProcessDefinition> processDefinitions = processService.findProcessDefinitionsByKey("nuclear_fusion");
+ assertNotNull(processDefinitions);
+
+ assertEquals("expected 3 but was " + processDefinitions.size() + ": " + processDefinitions, 3, processDefinitions.size());
+ assertEquals("nuclear fusion", processDefinitions.get(0).getName());
+ assertEquals(3, processDefinitions.get(0).getVersion());
+
+ assertEquals("nuclear fusion", processDefinitions.get(1).getName());
+ assertEquals(2, processDefinitions.get(1).getVersion());
+
+ assertEquals("nuclear fusion", processDefinitions.get(2).getName());
+ assertEquals(1, processDefinitions.get(2).getVersion());
+ }
+
+ public void testFindLatestProcessDefinition() {
+ deployMultipleVersionsOfProcesses();
+
+ ProcessDefinition retrieved = processService.findLatestProcessDefinitionByKey("nuclear_fusion");
+ assertNotNull(retrieved);
+
+ assertEquals(3, retrieved.getVersion());
+ assertEquals("nuclear fusion", retrieved.getName());
+ assertEquals("nuclear_fusion", retrieved.getKey());
+ }
+
+ public void testFindProcessDefinitionById() {
deployJpdlXmlString(
- "<process name='minimal' key='M'>" +
+ "<process name='given' version='33'>" +
" <start />" +
"</process>"
);
- ProcessDefinition processDefinition = processService.findLatestProcessDefinitionByKey("M");
+ // load it
+ ProcessDefinition processDefinition = processService.findProcessDefinitionById("given:33");
+ assertNotNull(processDefinition);
+ assertEquals("given", processDefinition.getName());
+ assertEquals(33, processDefinition.getVersion());
+ }
+
+ public void testDeleteProcessDefinition() {
+ processService.createDeployment()
+ .addString("xmlstring.jpdl.xml",
+ "<process name='deleteme' version='33'>" +
+ " <start />" +
+ "</process>")
+ .deploy();
+
+ // load it
+ processService.deleteProcessDefinition("deleteme:33");
+
+ // check if the db is empty
+ assertEquals(0, processService.createProcessDefinitionQuery().list().size());
+ }
+
+ public void testDeleteProcessDefinitionAndInstances() {
+ processService.createDeployment()
+ .addString("xmlstring.jpdl.xml",
+ "<process name='deleteme' version='33'>" +
+ " <start>" +
+ " <flow to='w' />" +
+ " </start>" +
+ " <state name='w' />" +
+ "</process>")
+ .deploy();
- assertEquals("M", processDefinition.getKey());
- assertEquals("M:1", processDefinition.getId());
- assertEquals(1, processDefinition.getVersion());
+ executionService.startExecutionByKey("deleteme");
+ executionService.startExecutionByKey("deleteme");
+ executionService.startExecutionByKey("deleteme");
+ executionService.startExecutionByKey("deleteme");
+
+ // delete it all
+ processService.deleteProcessDefinitionAndInstances("deleteme:33");
+
+ // check if the db is empty
+ assertEquals(0, processService.createProcessDefinitionQuery().list().size());
+ assertEquals(0, executionService.createExecutionQuery().list().size());
}
-
- public void testAutomaticVersioning()
- {
+
+ public void testDeleteProcessDefinitionButNotInstances() {
deployJpdlXmlString(
+ "<process name='deleteme' version='33'>" +
+ " <start>" +
+ " <flow to='w' />" +
+ " </start>" +
+ " <state name='w' />" +
+ "</process>"
+ );
+
+ executionService.startExecutionByKey("deleteme");
+ executionService.startExecutionByKey("deleteme");
+ executionService.startExecutionByKey("deleteme");
+ executionService.startExecutionByKey("deleteme");
+
+ // delete it all
+ try {
+ processService.deleteProcessDefinition("deleteme:33");
+ fail("expected exception");
+ } catch (JbpmException e) {
+ assertTextPresent("still 4 process instances for process definition deleteme:33", e.getMessage());
+ }
+ }
+
+ // various other aspects ////////////////////////////////////////////////////
+
+ public void testAutomaticVersioning() {
+ deployJpdlXmlString(
"<process name='versionme'>" +
" <start />" +
"</process>"
@@ -150,7 +225,7 @@
"</process>"
);
- // look it up again
+ // look them up again
processDefinitions = processService.findProcessDefinitionsByKey("versionme");
// verify that there is only one
assertEquals(processDefinitions.toString(), 2, processDefinitions.size());
@@ -195,48 +270,6 @@
}
}
- public void testFindProcessDefinitionNames() {
- deployMultipleVersionsOfProcesses();
-
- List<String> processKeys = processService.findProcessDefinitionKeys();
-
- List<String> expected = new ArrayList<String>();
- expected.add("nuclear_fusion");
- expected.add("publish_book");
- expected.add("ultimate_seduction");
-
- assertEquals(expected, processKeys);
- }
-
- public void testFindProcessDefinitions()
- {
- deployMultipleVersionsOfProcesses();
-
- List<ProcessDefinition> processDefinitions = processService.findProcessDefinitionsByKey("nuclear_fusion");
- assertNotNull(processDefinitions);
-
- assertEquals("expected 3 but was " + processDefinitions.size() + ": " + processDefinitions, 3, processDefinitions.size());
- assertEquals("nuclear fusion", processDefinitions.get(0).getName());
- assertEquals(3, processDefinitions.get(0).getVersion());
-
- assertEquals("nuclear fusion", processDefinitions.get(1).getName());
- assertEquals(2, processDefinitions.get(1).getVersion());
-
- assertEquals("nuclear fusion", processDefinitions.get(2).getName());
- assertEquals(1, processDefinitions.get(2).getVersion());
- }
-
- public void testFindLatestProcessDefinition() {
- deployMultipleVersionsOfProcesses();
-
- ProcessDefinition retrieved = processService.findLatestProcessDefinitionByKey("nuclear_fusion");
- assertNotNull(retrieved);
-
- assertEquals(3, retrieved.getVersion());
- assertEquals("nuclear fusion", retrieved.getName());
- assertEquals("nuclear_fusion", retrieved.getKey());
- }
-
/**
* deploys 3 versions of process with name 'nuclear fusion', 2 versions of the processes 'ultimate seduction' and
* 'publish book'
@@ -292,6 +325,35 @@
);
}
-
-
+ public void testMinimalProcess() {
+ deployJpdlXmlString(
+ "<process name='minimal'>" +
+ " <start>" +
+ " <flow to='end' />" +
+ " </start>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ Execution execution = executionService.startExecutionByKey("minimal");
+
+ assertEquals("end", execution.getNodeName());
+ assertTrue(execution.isEnded());
+ assertTrue(execution.isFinished());
+ assertFalse(execution.isActive());
+ }
+
+ public void testMostMinimalProcess() {
+ deployJpdlXmlString(
+ "<process name='minimal'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ Execution execution = executionService.startExecutionByKey("minimal");
+
+ assertTrue(execution.isEnded());
+ assertTrue(execution.isFinished());
+ assertFalse(execution.isActive());
+ }
}
Modified: jbpm4/trunk/modules/userguide/.settings/attachedFile.properties
===================================================================
--- jbpm4/trunk/modules/userguide/.settings/attachedFile.properties 2008-12-04 09:21:44 UTC (rev 3192)
+++ jbpm4/trunk/modules/userguide/.settings/attachedFile.properties 2008-12-04 09:30:45 UTC (rev 3193)
@@ -1,2 +1,2 @@
## index of importer -> set(imports)
-#Wed Dec 03 17:57:37 CET 2008
+#Thu Dec 04 08:28:47 CET 2008
15 years, 5 months
JBoss JBPM SVN: r3192 - in projects/gwt-console/trunk: server/src/main/java/org/jboss/bpm/console/server and 6 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-12-04 04:21:44 -0500 (Thu, 04 Dec 2008)
New Revision: 3192
Added:
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/BirtPanel.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/ProcessMetricEditor.java
Modified:
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/server/gson/GsonFactory.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/server/gson/SQLDateTypeAdapter.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverview.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverviewEditor.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceDetailForm.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentFormPanel.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskDetailsFormPanel.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/ModelChangeListener.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/ModelListenerRegistry.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/RemoteListView.java
projects/gwt-console/trunk/war/src/main/resources/org/jboss/bpm/console/public/console.css
Log:
More work on BIRT integration
Modified: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/server/gson/GsonFactory.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/server/gson/GsonFactory.java 2008-12-04 07:38:17 UTC (rev 3191)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/server/gson/GsonFactory.java 2008-12-04 09:21:44 UTC (rev 3192)
@@ -32,7 +32,7 @@
public static Gson createInstance()
{
Gson gson = new GsonBuilder()
- .setDateFormat("yyyy-M-d HH:mm:ss")
+ .setDateFormat("yyyy-MM-dd HH:mm:ss")
.registerTypeAdapter(java.sql.Timestamp.class, new SQLDateTypeAdapter())
.create();
return gson;
Modified: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/server/gson/SQLDateTypeAdapter.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/server/gson/SQLDateTypeAdapter.java 2008-12-04 07:38:17 UTC (rev 3191)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/server/gson/SQLDateTypeAdapter.java 2008-12-04 09:21:44 UTC (rev 3192)
@@ -41,7 +41,7 @@
*/
public class SQLDateTypeAdapter implements JsonSerializer<java.sql.Timestamp>, JsonDeserializer<Date>
{
- private final DateFormat format = new SimpleDateFormat("y-M-d HH:mm:ss");
+ private final DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public JsonElement serialize(java.sql.Timestamp src, Type typeOfSrc, JsonSerializationContext context)
{
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java 2008-12-04 07:38:17 UTC (rev 3191)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/JBPM3MgmtFacade.java 2008-12-04 09:21:44 UTC (rev 3192)
@@ -115,7 +115,7 @@
String fileName = item.getName();
String contentType = item.getContentType();
boolean isInMemory = item.isInMemory();
- long sizeInBytes = item.getSize();
+ long sizeInBytes = item.getSize();
// Process a file upload in memory
byte[] data = item.get();
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java 2008-12-04 07:38:17 UTC (rev 3191)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java 2008-12-04 09:21:44 UTC (rev 3192)
@@ -157,8 +157,15 @@
return getConsoleServerUrl()+ "/rs/test/undeploy/harness";
}
- public String getDefaultReportUrl()
+ // TODO: retrieve report name from configuration
+ public String getOverviewReportUrl()
{
return config.getReportServerUrl()+"/preview?__report=process_activity.rptdesign";
}
+
+ public String getDefinitionReportUrl(String name)
+ {
+ String encodedName = URL.encode(name);
+ return config.getReportServerUrl()+"/preview?__report=instance_report.rptdesign&name="+encodedName;
+ }
}
Added: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/BirtPanel.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/BirtPanel.java (rev 0)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/BirtPanel.java 2008-12-04 09:21:44 UTC (rev 3192)
@@ -0,0 +1,51 @@
+/*
+ * 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.metric;
+
+import com.google.gwt.user.client.ui.Frame;
+import com.gwtext.client.widgets.Panel;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class BirtPanel extends Panel
+{
+ private Frame frame;
+
+ public BirtPanel()
+ {
+ setHeader(false);
+ setWidth(660);
+ setHeight(450);
+
+ frame = new Frame();
+ frame.setWidth("660");
+ frame.setHeight("448");
+
+ add(frame);
+ }
+
+ public void setUrl(String url)
+ {
+ frame.setUrl(url);
+ }
+}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverview.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverview.java 2008-12-04 07:38:17 UTC (rev 3191)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverview.java 2008-12-04 09:21:44 UTC (rev 3192)
@@ -22,7 +22,6 @@
package org.jboss.bpm.console.client.metric;
import com.google.gwt.http.client.*;
-import com.google.gwt.user.client.ui.Frame;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.layout.ColumnLayout;
@@ -55,7 +54,7 @@
// ------------
RequestBuilder rb = new RequestBuilder(RequestBuilder.GET,
- view.getUrlBuilder().getDefaultReportUrl()
+ view.getUrlBuilder().getOverviewReportUrl()
);
try
{
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverviewEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverviewEditor.java 2008-12-04 07:38:17 UTC (rev 3191)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverviewEditor.java 2008-12-04 09:21:44 UTC (rev 3192)
@@ -21,18 +21,19 @@
*/
package org.jboss.bpm.console.client.metric;
-import com.google.gwt.user.client.ui.Frame;
import com.gwtext.client.core.EventObject;
import com.gwtext.client.data.*;
import com.gwtext.client.widgets.Button;
import com.gwtext.client.widgets.Component;
import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.MessageBox;
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
import com.gwtext.client.widgets.event.PanelListenerAdapter;
import com.gwtext.client.widgets.form.ComboBox;
-import com.gwtext.client.widgets.form.FormPanel;
+import com.gwtext.client.widgets.form.Label;
import com.gwtext.client.widgets.layout.HorizontalLayout;
import com.gwtext.client.widgets.layout.VerticalLayout;
+import com.gwtext.client.widgets.menu.Separator;
import org.jboss.bpm.console.client.Editor;
import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.util.ConsoleLog;
@@ -42,12 +43,9 @@
*/
public class MetricOverviewEditor extends Editor
{
-
+ public final static String ID = "org.jboss.bpm.metric.ProcessMetricOverview";
private MainView view;
- private Panel teaserPanel;
- public final static String ID = "org.jboss.bpm.metric.ProcessMetric";
-
public MetricOverviewEditor(final MainView view)
{
super();
@@ -65,54 +63,75 @@
public void onRender(Component component)
{
- final String reportUrl= view.getUrlBuilder().getDefaultReportUrl();
+ Panel panel = new Panel("Metric overview");
+ panel.setPaddings(10);
+
+ final String reportUrl= view.getUrlBuilder().getOverviewReportUrl();
ConsoleLog.debug("Report resource:" + reportUrl);
- final Frame frame = new Frame(reportUrl);
- frame.setWidth("600");
- frame.setHeight("448");
+ final ComboBox comboBox = buildProcessSelection();
+
+ final BirtPanel birtPanel = new BirtPanel();
+ birtPanel.setUrl(reportUrl);
+
+ // --
- Panel container = new Panel();
- container.setHeader(false);
- container.setWidth(600);
- container.setHeight(450);
+ Button refreshBtn = new Button("Refresh", new ButtonListenerAdapter()
+ {
- container.add(frame);
+ public void onClick(Button button, EventObject eventObject)
+ {
+ birtPanel.setUrl(reportUrl);
+ }
+ });
- // ---------
+ Button viewBtn = new Button("Examine", new ButtonListenerAdapter()
+ {
- Panel tools = new Panel();
- tools.setLayout(new HorizontalLayout(10));
+ public void onClick(Button button, EventObject eventObject)
+ {
+ String rawValue = comboBox.getRawValue();
+ if(rawValue==null || rawValue.equals(""))
+ MessageBox.alert("Please enter a process definition name!");
+ else
+ onExamine(rawValue);
+ }
+ });
// --
- tools.addButton(
- new Button("Refresh", new ButtonListenerAdapter(){
+ Panel toolsPanel = new Panel();
+ toolsPanel.setLayout( new HorizontalLayout(10) );
+ Label label = new Label("Process definition");
+ label.setStyleName("bpm-label");
+ toolsPanel.add(label);
+ toolsPanel.add(comboBox);
+ toolsPanel.add( viewBtn );
+ toolsPanel.add( new Separator() );
+ toolsPanel.add( refreshBtn );
- public void onClick(Button button, EventObject eventObject)
- {
- frame.setUrl(reportUrl);
- }
- })
- );
+ panel.add(toolsPanel);
+ panel.add(birtPanel);
- // --
-
- FormPanel form = new FormPanel();
- form.setBorder(false);
- form.add( createProcessSelection() );
-
- // --
-
- add(form);
- add(container);
+ add(panel);
}
}
);
}
- private ComboBox createProcessSelection()
+
+ private void onExamine(String definitionName)
{
+ String editorId = ProcessMetricEditor.createWidgetID(definitionName);
+
+ if(view.hasEditor(editorId))
+ view.showEditor(editorId);
+ else
+ view.addEditor( new ProcessMetricEditor(definitionName, view) );
+ }
+
+ private ComboBox buildProcessSelection()
+ {
final RecordDef recordDef = new RecordDef(
new FieldDef[]{
@@ -135,16 +154,16 @@
ComboBox cb = new ComboBox();
cb.setMinChars(1);
- cb.setFieldLabel("Process");
+ cb.setFieldLabel("Process definition");
cb.setStore(store);
cb.setDisplayField("name");
cb.setMode(ComboBox.LOCAL);
cb.setTriggerAction(ComboBox.ALL);
- cb.setEmptyText("Please enter a process name");
+ cb.setEmptyText("Please enter a name");
cb.setLoadingText("Searching...");
cb.setTypeAhead(true);
cb.setSelectOnFocus(true);
- cb.setWidth(100);
+ cb.setWidth(180);
return cb;
}
Added: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/ProcessMetricEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/ProcessMetricEditor.java (rev 0)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/ProcessMetricEditor.java 2008-12-04 09:21:44 UTC (rev 3192)
@@ -0,0 +1,180 @@
+/*
+ * 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.metric;
+
+import org.jboss.bpm.console.client.MainView;
+import org.jboss.bpm.console.client.Editor;
+import org.jboss.bpm.console.client.UIConstants;
+import org.jboss.bpm.console.client.util.ConsoleLog;
+import com.gwtext.client.widgets.layout.VerticalLayout;
+import com.gwtext.client.widgets.layout.HorizontalLayout;
+import com.gwtext.client.widgets.event.PanelListenerAdapter;
+import com.gwtext.client.widgets.event.ButtonListenerAdapter;
+import com.gwtext.client.widgets.Component;
+import com.gwtext.client.widgets.Button;
+import com.gwtext.client.widgets.MessageBox;
+import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.menu.Separator;
+import com.gwtext.client.widgets.form.ComboBox;
+import com.gwtext.client.widgets.form.Label;
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.data.*;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class ProcessMetricEditor extends Editor
+{
+ public final static String ID = "org.jboss.bpm.metric.ProcessMetric";
+ private String definitionName;
+ private MainView view;
+
+ public ProcessMetricEditor(final String definitionName, final MainView view)
+ {
+ this.definitionName = definitionName;
+ this.view = view;
+ this.setId( ProcessMetricEditor.createWidgetID(definitionName) );
+
+ this.setPaddings(10);
+
+ // -------------------------------------
+ this.setLayout(new VerticalLayout(10) );
+
+ this.addListener(
+ new PanelListenerAdapter()
+ {
+
+ public void onRender(Component component)
+ {
+
+ final String reportUrl= view.getUrlBuilder().getDefinitionReportUrl(definitionName);
+ ConsoleLog.debug("Report resource:" + reportUrl);
+
+ final ComboBox comboBox = buildInstanceSelection();
+
+ final BirtPanel birtPanel = new BirtPanel();
+ birtPanel.setUrl(reportUrl);
+
+ // --
+
+ Button refreshBtn = new Button("Refresh", new ButtonListenerAdapter()
+ {
+
+ public void onClick(Button button, EventObject eventObject)
+ {
+ birtPanel.setUrl(reportUrl);
+ }
+ });
+
+ Button viewBtn = new Button("Examine", new ButtonListenerAdapter()
+ {
+
+ public void onClick(Button button, EventObject eventObject)
+ {
+ String rawValue = comboBox.getRawValue();
+ if(rawValue==null || rawValue.equals(""))
+ MessageBox.alert("Please enter a process instance ID!");
+ else
+ MessageBox.alert("Not implemented");
+ }
+ });
+
+ // --
+
+ Panel p = new Panel();
+ p.setLayout( new HorizontalLayout(10) );
+ Label label = new Label("Instance ID");
+ label.setStyleName("bpm-label");
+ p.add(label);
+ p.add(comboBox);
+ p.add( viewBtn );
+ p.add( new Separator() );
+ p.add( refreshBtn );
+
+ add(p);
+ add(birtPanel);
+ }
+ }
+ );
+ }
+
+ private ComboBox buildInstanceSelection()
+ {
+
+ final RecordDef recordDef = new RecordDef(
+ new FieldDef[]{
+ new IntegerFieldDef("instanceId"),
+ new IntegerFieldDef("parentId"),
+ new StringFieldDef("key"),
+ new StringFieldDef("state"),
+ new DateFieldDef("startDate", UIConstants.DATE_FORMAT),
+ new DateFieldDef("endDate", UIConstants.DATE_FORMAT),
+ new BooleanFieldDef("suspended")
+ }
+ );
+
+ final JsonReader reader = new JsonReader(recordDef);
+ reader.setRoot("instances");
+ reader.setTotalProperty("totalCount");
+ reader.setId("instanceId");
+
+ DataProxy dataProxy = new ScriptTagProxy(
+ view.getUrlBuilder().getProcessDefinitionsURL(), 1000*10);
+
+ final Store store = new Store(dataProxy, reader, false);
+ store.load();
+
+ ComboBox cb = new ComboBox();
+ cb.setMinChars(1);
+ cb.setFieldLabel("Instance ID");
+ cb.setStore(store);
+ cb.setDisplayField("ID");
+ cb.setMode(ComboBox.LOCAL);
+ cb.setTriggerAction(ComboBox.ALL);
+ cb.setEmptyText("Please enter an ID");
+ cb.setLoadingText("Searching...");
+ cb.setTypeAhead(true);
+ cb.setSelectOnFocus(true);
+ cb.setWidth(180);
+
+ return cb;
+ }
+ public String getEditorId()
+ {
+ return createWidgetID(definitionName);
+ }
+
+ public String getTitle()
+ {
+ return definitionName +" Metrics";
+ }
+
+ public String getIconCSS()
+ {
+ return "bpm-metric-icon";
+ }
+
+ public static String createWidgetID(String definitionName)
+ {
+ return ID+"."+definitionName;
+ }
+}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceDetailForm.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceDetailForm.java 2008-12-04 07:38:17 UTC (rev 3191)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceDetailForm.java 2008-12-04 09:21:44 UTC (rev 3192)
@@ -41,7 +41,7 @@
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
-public class ProcessInstanceDetailForm extends Panel implements ModelChangeListener
+class ProcessInstanceDetailForm extends Panel implements ModelChangeListener
{
private FormPanel detailsForm;
@@ -59,7 +59,7 @@
{
super();
- this.mainView = mainView;
+ this.mainView = view;
this.callback = callback;
setTitle("Instance Details");
@@ -175,4 +175,10 @@
detailsForm.doLayout();
}
+
+ public void onReset()
+ {
+ selectedInstance = null;
+ detailsForm.getForm().reset();
+ }
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java 2008-12-04 07:38:17 UTC (rev 3191)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java 2008-12-04 09:21:44 UTC (rev 3192)
@@ -48,7 +48,7 @@
{
private Map<Integer, ProcessInstanceRef> row2InstanceMap = new HashMap<Integer, ProcessInstanceRef>();
- private ProcessDefinitionRef parent;
+ private ProcessDefinitionRef parent;
public ProcessInstanceList(ProcessDefinitionRef procDef, String titleName, MainView view)
{
@@ -241,5 +241,4 @@
{
return view.getUrlBuilder().getProcessInstanceURL(parentId);
}
-
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java 2008-12-04 07:38:17 UTC (rev 3191)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java 2008-12-04 09:21:44 UTC (rev 3192)
@@ -51,12 +51,13 @@
private Panel tokenEditorPanel;
private ProcessInstanceRef selectedInstance;
+
+ private ProcessInstanceDetailForm detailsForm;
private TokenEditor currentTokenEditor;
private TabPanel tabPanel;
private ModelListenerRegistry modelListeners;
-
private ModelModificationCallback modelModificationCallback;
public ProcessInstanceListEditor(ProcessDefinitionRef proc, final MainView view)
@@ -104,9 +105,7 @@
resetEditor();
}
};
- Panel detailsForm = new ProcessInstanceDetailForm(view,
- modelModificationCallback
- );
+ detailsForm = new ProcessInstanceDetailForm(view, modelModificationCallback);
modelListeners.addListener( (ModelChangeListener) detailsForm);
// ----------------
@@ -178,18 +177,18 @@
return "bpm-instance-icon";
}
- private void resetEditor()
+ void resetEditor()
{
instanceList.reloadStore();
selectedInstance = null;
+ modelListeners.fireResetEvent();
+
if(currentTokenEditor!=null)
currentTokenEditor.resetEditor();
tokenEditorPanel.clear();
- tokenEditorPanel.doLayout();
-
- //tabPanel.setActiveTab(0);
+ tokenEditorPanel.doLayout();
}
public static String createWidgetID(ProcessDefinitionRef proc)
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentFormPanel.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentFormPanel.java 2008-12-04 07:38:17 UTC (rev 3191)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentFormPanel.java 2008-12-04 09:21:44 UTC (rev 3192)
@@ -228,4 +228,9 @@
ConsoleLog.error("Request failed" ,e1);
}
}
+
+ public void onReset()
+ {
+ formPanel.getForm().reset();
+ }
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskDetailsFormPanel.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskDetailsFormPanel.java 2008-12-04 07:38:17 UTC (rev 3191)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskDetailsFormPanel.java 2008-12-04 09:21:44 UTC (rev 3192)
@@ -268,4 +268,9 @@
{
// ignore
}
+
+ public void onReset()
+ {
+ formPanel.getForm().reset();
+ }
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/ModelChangeListener.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/ModelChangeListener.java 2008-12-04 07:38:17 UTC (rev 3191)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/ModelChangeListener.java 2008-12-04 09:21:44 UTC (rev 3192)
@@ -31,4 +31,5 @@
{
void onModelChange(ModelListenerRegistry parent, Object changeEvent);
void onRecordChange(ModelListenerRegistry parent, Record record);
+ void onReset();
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/ModelListenerRegistry.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/ModelListenerRegistry.java 2008-12-04 07:38:17 UTC (rev 3191)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/ModelListenerRegistry.java 2008-12-04 09:21:44 UTC (rev 3192)
@@ -63,6 +63,14 @@
}
}
+ public void fireResetEvent()
+ {
+ for(ModelChangeListener l : listeners)
+ {
+ l.onReset();
+ }
+ }
+
public Object getUnderlying()
{
return underlying;
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/RemoteListView.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/RemoteListView.java 2008-12-04 07:38:17 UTC (rev 3191)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/RemoteListView.java 2008-12-04 09:21:44 UTC (rev 3192)
@@ -301,6 +301,7 @@
{
ConsoleLog.debug("Reload " + this.getId());
store.load(0,PAGE_SIZE);
+
}
public void setRowSelectionModel(RowSelectionModel rowSelectionModel)
Modified: projects/gwt-console/trunk/war/src/main/resources/org/jboss/bpm/console/public/console.css
===================================================================
--- projects/gwt-console/trunk/war/src/main/resources/org/jboss/bpm/console/public/console.css 2008-12-04 07:38:17 UTC (rev 3191)
+++ projects/gwt-console/trunk/war/src/main/resources/org/jboss/bpm/console/public/console.css 2008-12-04 09:21:44 UTC (rev 3192)
@@ -28,6 +28,11 @@
height:100%;
}
+.bpm-label {
+ font-family: sans-serif;
+ font-size: small;
+}
+
.bpm-ListHeaderRow {
font-weight: bold;
}
15 years, 5 months
JBoss JBPM SVN: r3191 - projects/spec/trunk.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-12-04 02:38:17 -0500 (Thu, 04 Dec 2008)
New Revision: 3191
Modified:
projects/spec/trunk/pom.xml
Log:
Use jbpm-parent-1.0.1.GA
Modified: projects/spec/trunk/pom.xml
===================================================================
--- projects/spec/trunk/pom.xml 2008-12-04 07:28:48 UTC (rev 3190)
+++ projects/spec/trunk/pom.xml 2008-12-04 07:38:17 UTC (rev 3191)
@@ -28,7 +28,7 @@
<parent>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-parent</artifactId>
- <version>1.0.1-SNAPSHOT</version>
+ <version>1.0.1.GA</version>
</parent>
<!-- Modules -->
15 years, 5 months
JBoss JBPM SVN: r3190 - in jbpm3/branches/tdiesler/modules: core/src/main/java/org/jbpm/db and 11 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-12-04 02:28:48 -0500 (Thu, 04 Dec 2008)
New Revision: 3190
Added:
jbpm3/branches/tdiesler/modules/integration/spec/src/test/java/org/jbpm/test/integration/spec/task/
jbpm3/branches/tdiesler/modules/integration/spec/src/test/java/org/jbpm/test/integration/spec/task/TaskTest.java
Modified:
jbpm3/branches/tdiesler/modules/core/pom.xml
jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/db/GraphSession.java
jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/def/Node.java
jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/exe/ProcessInstance.java
jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/Decision.java
jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/EndState.java
jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/Fork.java
jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/Join.java
jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/StartState.java
jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/State.java
jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/TaskNode.java
jbpm3/branches/tdiesler/modules/core/src/test/java/org/jbpm/taskmgmt/exe/EndTasksDbTest.java
jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/EndEventImpl.java
jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/ExclusiveGatewayImpl.java
jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/ParallelGatewayImpl.java
jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/ProcessDefinitionImpl.java
jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/ProcessImpl.java
jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/StartEventImpl.java
jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/UserTaskImpl.java
jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/WaitStateImpl.java
jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/builder/ProcessBuilderImpl.java
jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/runtime/TokenImpl.java
jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/service/ProcessDefinitionServiceImpl.java
jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/service/TaskServiceImpl.java
jbpm3/branches/tdiesler/modules/integration/spec/src/test/java/org/jbpm/test/integration/spec/deployment/DeploymentPARTest.java
Log:
WIP
Modified: jbpm3/branches/tdiesler/modules/core/pom.xml
===================================================================
--- jbpm3/branches/tdiesler/modules/core/pom.xml 2008-12-04 07:26:45 UTC (rev 3189)
+++ jbpm3/branches/tdiesler/modules/core/pom.xml 2008-12-04 07:28:48 UTC (rev 3190)
@@ -119,6 +119,11 @@
<artifactId>hsqldb</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<!-- Plugins -->
Modified: jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/db/GraphSession.java
===================================================================
--- jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/db/GraphSession.java 2008-12-04 07:26:45 UTC (rev 3189)
+++ jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/db/GraphSession.java 2008-12-04 07:28:48 UTC (rev 3190)
@@ -467,6 +467,7 @@
{
if (processInstance == null)
throw new JbpmException("processInstance is null in JbpmSession.deleteProcessInstance()");
+
log.debug("deleting process instance " + processInstance.getId());
try
Modified: jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/def/Node.java
===================================================================
--- jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/def/Node.java 2008-12-04 07:26:45 UTC (rev 3189)
+++ jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/def/Node.java 2008-12-04 07:28:48 UTC (rev 3190)
@@ -46,8 +46,9 @@
public class Node extends GraphElement implements Parsable
{
-
private static final long serialVersionUID = 1L;
+
+ public enum NodeType { Node, StartState, EndState, State, Task, Fork, Join, Decission };
protected List<Transition> leavingTransitions = null;
transient Map leavingTransitionMap = null;
@@ -57,10 +58,20 @@
protected boolean isAsync = false;
protected boolean isAsyncExclusive = false;
+
+ public NodeType getNodeType()
+ {
+ return NodeType.Node;
+ }
+
// event types //////////////////////////////////////////////////////////////
- public static final String[] supportedEventTypes = new String[] { Event.EVENTTYPE_NODE_ENTER, Event.EVENTTYPE_NODE_LEAVE, Event.EVENTTYPE_BEFORE_SIGNAL,
- Event.EVENTTYPE_AFTER_SIGNAL };
+ public static final String[] supportedEventTypes = new String[] {
+ Event.EVENTTYPE_NODE_ENTER,
+ Event.EVENTTYPE_NODE_LEAVE,
+ Event.EVENTTYPE_BEFORE_SIGNAL,
+ Event.EVENTTYPE_AFTER_SIGNAL
+ };
public String[] getSupportedEventTypes()
{
Modified: jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/exe/ProcessInstance.java
===================================================================
--- jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/exe/ProcessInstance.java 2008-12-04 07:26:45 UTC (rev 3189)
+++ jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/exe/ProcessInstance.java 2008-12-04 07:28:48 UTC (rev 3190)
@@ -163,7 +163,11 @@
}
Node initialNode = rootToken.getNode();
- // fire the process start event
+ fireStartEvent(initialNode);
+ }
+
+ public void fireStartEvent(Node initialNode)
+ {
if (initialNode != null)
{
ExecutionContext executionContext = new ExecutionContext(rootToken);
Modified: jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/Decision.java
===================================================================
--- jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/Decision.java 2008-12-04 07:26:45 UTC (rev 3189)
+++ jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/Decision.java 2008-12-04 07:28:48 UTC (rev 3190)
@@ -36,13 +36,13 @@
import org.jbpm.jpdl.el.impl.JbpmExpressionEvaluator;
import org.jbpm.jpdl.xml.JpdlXmlReader;
import org.jbpm.jpdl.xml.Parsable;
-import org.jbpm.util.ClassLoaderUtil;
/**
* decision node.
*/
-public class Decision extends Node implements Parsable {
-
+public class Decision extends Node implements Parsable
+{
+
static final String NEWLINE = System.getProperty("line.separator");
static final String DECISION_CONDITION_RESULT = "decision_condition_result";
static final long serialVersionUID = 1L;
@@ -51,82 +51,113 @@
Delegation decisionDelegation = null;
String decisionExpression = null;
- public Decision() {
+ public Decision()
+ {
}
- public Decision(String name) {
+ public Decision(String name)
+ {
super(name);
}
- public void read(Element decisionElement, JpdlXmlReader jpdlReader) {
+ @Override
+ public NodeType getNodeType()
+ {
+ return NodeType.Decission;
+ }
+ public void read(Element decisionElement, JpdlXmlReader jpdlReader)
+ {
+
String expression = decisionElement.attributeValue("expression");
Element decisionHandlerElement = decisionElement.element("handler");
- if (expression!=null) {
+ if (expression != null)
+ {
decisionExpression = expression;
- } else if (decisionHandlerElement!=null) {
+ }
+ else if (decisionHandlerElement != null)
+ {
decisionDelegation = new Delegation();
decisionDelegation.read(decisionHandlerElement, jpdlReader);
}
}
- public void execute(ExecutionContext executionContext) {
+ public void execute(ExecutionContext executionContext)
+ {
Transition transition = null;
ClassLoader surroundingClassLoader = Thread.currentThread().getContextClassLoader();
- try {
- // set context class loader correctly for delegation class (https://jira.jboss.org/jira/browse/JBPM-1448)
+ try
+ {
+ // set context class loader correctly for delegation class (https://jira.jboss.org/jira/browse/JBPM-1448)
Thread.currentThread().setContextClassLoader(JbpmConfiguration.getProcessClassLoader(executionContext.getProcessDefinition()));
- try {
- if (decisionDelegation != null) {
+ try
+ {
+ if (decisionDelegation != null)
+ {
DecisionHandler decisionHandler = (DecisionHandler)decisionDelegation.getInstance();
if (decisionHandler == null)
- decisionHandler = (DecisionHandler) decisionDelegation.instantiate();
-
+ decisionHandler = (DecisionHandler)decisionDelegation.instantiate();
+
String transitionName = decisionHandler.decide(executionContext);
transition = getLeavingTransition(transitionName);
- if (transition == null) {
+ if (transition == null)
+ {
throw new JbpmException("decision '" + name + "' selected non existing transition '" + transitionName + "'");
}
- } else if (decisionExpression != null) {
+ }
+ else if (decisionExpression != null)
+ {
Object result = JbpmExpressionEvaluator.evaluate(decisionExpression, executionContext);
- if (result == null) {
+ if (result == null)
+ {
throw new JbpmException("decision expression '" + decisionExpression + "' returned null");
}
String transitionName = result.toString();
transition = getLeavingTransition(transitionName);
- if (transition == null) {
+ if (transition == null)
+ {
throw new JbpmException("decision '" + name + "' selected non existing transition '" + transitionName + "'");
}
- } else if (decisionConditions != null && !decisionConditions.isEmpty()) {
+ }
+ else if (decisionConditions != null && !decisionConditions.isEmpty())
+ {
// backwards compatible mode based on separate DecisionCondition's
Iterator iter = decisionConditions.iterator();
- while (iter.hasNext() && (transition == null)) {
- DecisionCondition decisionCondition = (DecisionCondition) iter.next();
+ while (iter.hasNext() && (transition == null))
+ {
+ DecisionCondition decisionCondition = (DecisionCondition)iter.next();
Object result = JbpmExpressionEvaluator.evaluate(decisionCondition.getExpression(), executionContext);
- if (Boolean.TRUE.equals(result)) {
+ if (Boolean.TRUE.equals(result))
+ {
String transitionName = decisionCondition.getTransitionName();
transition = getLeavingTransition(transitionName);
- if (transition != null) {
+ if (transition != null)
+ {
transition.removeConditionEnforcement();
}
}
}
- } else {
+ }
+ else
+ {
// new mode based on conditions in the transition itself
Iterator iter = leavingTransitions.iterator();
- while (iter.hasNext() && (transition == null)) {
- Transition candidate = (Transition) iter.next();
+ while (iter.hasNext() && (transition == null))
+ {
+ Transition candidate = (Transition)iter.next();
String conditionExpression = candidate.getCondition();
- if (conditionExpression != null) {
+ if (conditionExpression != null)
+ {
Object result = JbpmExpressionEvaluator.evaluate(conditionExpression, executionContext);
- if (Boolean.TRUE.equals(result)) {
+ if (Boolean.TRUE.equals(result))
+ {
transition = candidate;
}
}
@@ -134,7 +165,8 @@
}
- if (transition == null) {
+ if (transition == null)
+ {
transition = getDefaultLeavingTransition();
log.debug("decision didn't select transition, taking default " + transition);
}
@@ -147,25 +179,30 @@
// node.
transition.removeConditionEnforcement();
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
raiseException(exception, executionContext);
}
}
- finally {
+ finally
+ {
Thread.currentThread().setContextClassLoader(surroundingClassLoader);
- }
- log.debug("decision "+name+" is taking '"+transition+"'");
+ }
+ log.debug("decision " + name + " is taking '" + transition + "'");
executionContext.leaveNode(transition);
}
- public List getDecisionConditions() {
+ public List getDecisionConditions()
+ {
return decisionConditions;
}
-
- public void setDecisionDelegation(Delegation decisionDelegation) {
+
+ public void setDecisionDelegation(Delegation decisionDelegation)
+ {
this.decisionDelegation = decisionDelegation;
}
-
+
private static Log log = LogFactory.getLog(Decision.class);
}
Modified: jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/EndState.java
===================================================================
--- jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/EndState.java 2008-12-04 07:26:45 UTC (rev 3189)
+++ jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/EndState.java 2008-12-04 07:28:48 UTC (rev 3190)
@@ -25,42 +25,56 @@
import org.jbpm.graph.def.Event;
import org.jbpm.graph.def.Node;
import org.jbpm.graph.def.Transition;
-import org.jbpm.graph.exe.*;
+import org.jbpm.graph.exe.ExecutionContext;
import org.jbpm.jpdl.xml.JpdlXmlReader;
-public class EndState extends Node {
+public class EndState extends Node
+{
+ public static final String[] supportedEventTypes = new String[] { Event.EVENTTYPE_NODE_ENTER };
private static final long serialVersionUID = 1L;
-
+
String endCompleteProcess = null;
- public EndState() {
+ public EndState()
+ {
}
+
+ public EndState(String name)
+ {
+ super(name);
+ }
- public static final String[] supportedEventTypes = new String[]{Event.EVENTTYPE_NODE_ENTER};
- public String[] getSupportedEventTypes() {
+ public String[] getSupportedEventTypes()
+ {
return supportedEventTypes;
}
- public EndState(String name) {
- super(name);
+ @Override
+ public NodeType getNodeType()
+ {
+ return NodeType.EndState;
}
-
- public void read(Element nodeElement, JpdlXmlReader jpdlXmlReader) {
+
+ public void read(Element nodeElement, JpdlXmlReader jpdlXmlReader)
+ {
endCompleteProcess = nodeElement.attributeValue("end-complete-process");
}
- public void execute(ExecutionContext executionContext) {
- if ( (endCompleteProcess!=null)
- && (endCompleteProcess.equalsIgnoreCase("true"))
- ) {
+ public void execute(ExecutionContext executionContext)
+ {
+ if ((endCompleteProcess != null) && (endCompleteProcess.equalsIgnoreCase("true")))
+ {
executionContext.getProcessInstance().end();
- } else {
+ }
+ else
+ {
executionContext.getToken().end();
}
}
-
- public Transition addLeavingTransition(Transition t) {
+
+ public Transition addLeavingTransition(Transition t)
+ {
throw new UnsupportedOperationException("can't add a leaving transition to an end-state");
}
}
Modified: jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/Fork.java
===================================================================
--- jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/Fork.java 2008-12-04 07:26:45 UTC (rev 3189)
+++ jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/Fork.java 2008-12-04 07:28:48 UTC (rev 3190)
@@ -33,6 +33,7 @@
import org.jbpm.JbpmException;
import org.jbpm.graph.action.Script;
import org.jbpm.graph.def.Node;
+import org.jbpm.graph.def.Node.NodeType;
import org.jbpm.graph.exe.ExecutionContext;
import org.jbpm.graph.exe.Token;
import org.jbpm.jpdl.xml.JpdlXmlReader;
@@ -41,26 +42,23 @@
/**
* specifies configurable fork behaviour.
*
- * <p>if this fork behaviour is not sufficient for your needs, consider
- * writing your own custom TokenHandler.
+ * <p>
+ * if this fork behaviour is not sufficient for your needs, consider writing your own custom TokenHandler.
* </p>
*
- * <p>this forkhandler can be configured in 3 ways :
+ * <p>
+ * this forkhandler can be configured in 3 ways :
* <ul>
- * <li>without configuration : in that case the fork will launch one
- * new sub-token over each of the leaving tranisions of the fork
- * node.
- * </li>
- * <li>a script : can be used to calculate a collection of transition
- * names at runtime. if a script is configured, the script must have
- * exactly one variable with 'write' access. that variable
- * should be assigned a java.util.Collection in the script
- * expression.
- * </li>
+ * <li>without configuration : in that case the fork will launch one new sub-token over each of the leaving tranisions
+ * of the fork node.</li>
+ * <li>a script : can be used to calculate a collection of transition names at runtime. if a script is configured, the
+ * script must have exactly one variable with 'write' access. that variable should be assigned a java.util.Collection in
+ * the script expression.</li>
* </ul>
* </p>
*/
-public class Fork extends Node implements Parsable {
+public class Fork extends Node implements Parsable
+{
private static final long serialVersionUID = 1L;
@@ -69,127 +67,169 @@
*/
Script script = null;
- public Fork() {
+ public Fork()
+ {
}
- public Fork(String name) {
+ public Fork(String name)
+ {
super(name);
}
- public void read(Element forkElement, JpdlXmlReader jpdlReader) {
+ @Override
+ public NodeType getNodeType()
+ {
+ return NodeType.Fork;
+ }
+
+ public void read(Element forkElement, JpdlXmlReader jpdlReader)
+ {
Element scriptElement = forkElement.element("script");
- if (scriptElement!=null) {
+ if (scriptElement != null)
+ {
log.warn("KNOWN LIMITATION: the script in a fork is not persisted. script in fork might be removed in later versions of jPDL");
script = new Script();
script.read(scriptElement, jpdlReader);
}
}
- public void execute(ExecutionContext executionContext) {
+ public void execute(ExecutionContext executionContext)
+ {
Token token = executionContext.getToken();
-
+
// phase one: collect all the transitionNames
- Collection transitionNames = null;
+ Collection transitionNames = null;
List forkedTokens = new ArrayList();
// by default, the fork spawns a token for each leaving transition
- if (script==null) {
+ if (script == null)
+ {
transitionNames = getLeavingTransitionsMap().keySet();
- } else { // a script is specified
- // if a script is specified, use that script to calculate the set
+ }
+ else
+ { // a script is specified
+ // if a script is specified, use that script to calculate the set
// of leaving transitions to be used for forking tokens.
Map outputMap = null;
- try {
+ try
+ {
outputMap = script.eval(token);
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
this.raiseException(e, executionContext);
}
- if (outputMap.size()==1) {
+ if (outputMap.size() == 1)
+ {
Object result = outputMap.values().iterator().next();
- if (result instanceof Collection) {
- transitionNames = (Collection) result;
+ if (result instanceof Collection)
+ {
+ transitionNames = (Collection)result;
}
}
- if (transitionNames==null) {
- throw new JbpmException("script for fork '"+name+"' should produce one collection (in one writable variable): "+transitionNames);
+ if (transitionNames == null)
+ {
+ throw new JbpmException("script for fork '" + name + "' should produce one collection (in one writable variable): " + transitionNames);
}
}
-
- // TODO add some way of blocking the current token here and disable that blocking when the join reactivates this token
+
+ // TODO add some way of blocking the current token here and disable that blocking when the join reactivates this
+ // token
// Then an exception can be thrown by in case someone tries to signal a token that is waiting in a fork.
- // Suspend and resume can NOT be used for this since that will also suspend any related timers, tasks and messages...
- // So a separate kind of blocking should be created for this.
+ // Suspend and resume can NOT be used for this since that will also suspend any related timers, tasks and
+ // messages...
+ // So a separate kind of blocking should be created for this.
// @see also http://jira.jboss.com/jira/browse/JBPM-642
// phase two: create forked tokens for the collected transition names
Iterator iter = transitionNames.iterator();
- while (iter.hasNext()) {
- String transitionName = (String) iter.next();
+ while (iter.hasNext())
+ {
+ String transitionName = (String)iter.next();
forkedTokens.add(createForkedToken(token, transitionName));
}
// phase three: launch child tokens from the fork over the given transitions
iter = forkedTokens.iterator();
- while( iter.hasNext() ) {
- ForkedToken forkedToken = (ForkedToken) iter.next();
+ while (iter.hasNext())
+ {
+ ForkedToken forkedToken = (ForkedToken)iter.next();
Token childToken = forkedToken.token;
String leavingTransitionName = forkedToken.leavingTransitionName;
ExecutionContext childExecutionContext = new ExecutionContext(childToken);
- if (leavingTransitionName!=null) {
+ if (leavingTransitionName != null)
+ {
leave(childExecutionContext, leavingTransitionName);
- } else {
+ }
+ else
+ {
leave(childExecutionContext);
}
}
}
- protected ForkedToken createForkedToken(Token parent, String transitionName) {
+ protected ForkedToken createForkedToken(Token parent, String transitionName)
+ {
// instantiate the new token
Token childToken = new Token(parent, getTokenName(parent, transitionName));
// create a forked token
ForkedToken forkedToken = null;
forkedToken = new ForkedToken(childToken, transitionName);
-
+
return forkedToken;
}
- protected String getTokenName(Token parent, String transitionName) {
+ protected String getTokenName(Token parent, String transitionName)
+ {
String tokenName = null;
- if ( transitionName != null ) {
- if ( ! parent.hasChild( transitionName ) ) {
+ if (transitionName != null)
+ {
+ if (!parent.hasChild(transitionName))
+ {
tokenName = transitionName;
- } else {
+ }
+ else
+ {
int i = 2;
- tokenName = transitionName + Integer.toString( i );
- while ( parent.hasChild( tokenName ) ) {
+ tokenName = transitionName + Integer.toString(i);
+ while (parent.hasChild(tokenName))
+ {
i++;
- tokenName = transitionName + Integer.toString( i );
+ tokenName = transitionName + Integer.toString(i);
}
}
- } else { // no transition name
- int size = ( parent.getChildren()!=null ? parent.getChildren().size()+1 : 1 );
+ }
+ else
+ { // no transition name
+ int size = (parent.getChildren() != null ? parent.getChildren().size() + 1 : 1);
tokenName = Integer.toString(size);
}
return tokenName;
}
- public Script getScript() {
+ public Script getScript()
+ {
return script;
}
- public void setScript(Script script) {
+
+ public void setScript(Script script)
+ {
this.script = script;
}
-
- static class ForkedToken {
+
+ static class ForkedToken
+ {
Token token = null;
String leavingTransitionName = null;
- public ForkedToken(Token token, String leavingTransitionName) {
+
+ public ForkedToken(Token token, String leavingTransitionName)
+ {
this.token = token;
this.leavingTransitionName = leavingTransitionName;
}
}
-
+
private static Log log = LogFactory.getLog(Fork.class);
}
Modified: jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/Join.java
===================================================================
--- jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/Join.java 2008-12-04 07:26:45 UTC (rev 3189)
+++ jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/Join.java 2008-12-04 07:28:48 UTC (rev 3190)
@@ -37,20 +37,19 @@
import org.jbpm.jpdl.xml.JpdlXmlReader;
import org.jbpm.jpdl.xml.Parsable;
-public class Join extends Node implements Parsable {
+public class Join extends Node implements Parsable
+{
private static final long serialVersionUID = 1L;
-
- /**
- * specifies wether what type of hibernate lock should be acquired.
- * null value defaults to LockMode.FORCE
- */
+
+ /**
+ * specifies wether what type of hibernate lock should be acquired. null value defaults to LockMode.FORCE
+ */
String parentLockMode;
/**
- * specifies if this joinhandler is a discriminator.
- * a descriminator reactivates the parent when the first
- * concurrent token enters the join.
+ * specifies if this joinhandler is a discriminator. a descriminator reactivates the parent when the first concurrent
+ * token enters the join.
*/
boolean isDiscriminator = false;
@@ -63,23 +62,32 @@
* a script that calculates concurrent tokens at runtime.
*/
Script script = null;
-
+
/**
* reactivate the parent if the n-th token arrives in the join.
*/
int nOutOfM = -1;
-
- public Join() {
+ public Join()
+ {
}
- public Join(String name) {
+ public Join(String name)
+ {
super(name);
}
- public void read(Element element, JpdlXmlReader jpdlReader) {
+ @Override
+ public NodeType getNodeType()
+ {
+ return NodeType.Join;
+ }
+
+ public void read(Element element, JpdlXmlReader jpdlReader)
+ {
String lock = element.attributeValue("lock");
- if (lock != null) {
+ if (lock != null)
+ {
LockMode lockMode = LockMode.parse(lock);
if (lockMode != null)
parentLockMode = lockMode.toString();
@@ -90,30 +98,35 @@
}
}
- public void execute(ExecutionContext executionContext) {
+ public void execute(ExecutionContext executionContext)
+ {
Token token = executionContext.getToken();
-
+
boolean isAbleToReactivateParent = token.isAbleToReactivateParent();
-
- if (!token.hasEnded()) {
+
+ if (!token.hasEnded())
+ {
token.end(false);
}
-
- // if this token is not able to reactivate the parent,
+
+ // if this token is not able to reactivate the parent,
// we don't need to check anything
- if ( isAbleToReactivateParent ) {
+ if (isAbleToReactivateParent)
+ {
- // the token arrived in the join and can only reactivate
+ // the token arrived in the join and can only reactivate
// the parent once
token.setAbleToReactivateParent(false);
Token parentToken = token.getParent();
-
- if ( parentToken != null ) {
-
+
+ if (parentToken != null)
+ {
+
JbpmContext jbpmContext = executionContext.getJbpmContext();
- Session session = (jbpmContext!=null ? jbpmContext.getSession() : null);
- if (session!=null) {
+ Session session = (jbpmContext != null ? jbpmContext.getSession() : null);
+ if (session != null)
+ {
// force version increment by default (LockMode.FORCE)
LockMode lockMode = parentLockMode != null ? LockMode.parse(parentLockMode) : LockMode.FORCE;
log.debug("acquiring " + lockMode + " lock on " + parentToken);
@@ -124,70 +137,89 @@
boolean reactivateParent = true;
// if this is a discriminator
- if ( isDiscriminator ) {
+ if (isDiscriminator)
+ {
// reactivate the parent when the first token arrives in the join.
// this must be the first token arriving, otherwise isAbleToReactivateParent()
// should have been false above.
reactivateParent = true;
- // if a fixed set of tokenNames is specified at design time...
- } else if ( tokenNames != null ) {
+ // if a fixed set of tokenNames is specified at design time...
+ }
+ else if (tokenNames != null)
+ {
// check reactivation on the basis of those tokenNames
- reactivateParent = mustParentBeReactivated(parentToken, tokenNames.iterator() );
+ reactivateParent = mustParentBeReactivated(parentToken, tokenNames.iterator());
- // if a script is specified
- } else if ( script != null ) {
+ // if a script is specified
+ }
+ else if (script != null)
+ {
// check if the script returns a collection or a boolean
Object result = null;
- try {
- result = script.eval( token );
- } catch (Exception e) {
+ try
+ {
+ result = script.eval(token);
+ }
+ catch (Exception e)
+ {
this.raiseException(e, executionContext);
}
- // if the result is a collection
- if ( result instanceof Collection ) {
- // it must be a collection of tokenNames
- Collection runtimeTokenNames = (Collection) result;
- reactivateParent = mustParentBeReactivated(parentToken, runtimeTokenNames.iterator() );
+ // if the result is a collection
+ if (result instanceof Collection)
+ {
+ // it must be a collection of tokenNames
+ Collection runtimeTokenNames = (Collection)result;
+ reactivateParent = mustParentBeReactivated(parentToken, runtimeTokenNames.iterator());
-
- // if it's a boolean...
- } else if ( result instanceof Boolean ) {
+ // if it's a boolean...
+ }
+ else if (result instanceof Boolean)
+ {
// the boolean specifies if the parent needs to be reactivated
reactivateParent = ((Boolean)result).booleanValue();
}
- // if a nOutOfM is specified
- } else if ( nOutOfM != -1 ) {
+ // if a nOutOfM is specified
+ }
+ else if (nOutOfM != -1)
+ {
int n = 0;
// wheck how many tokens already arrived in the join
Iterator iter = parentToken.getChildren().values().iterator();
- while ( iter.hasNext() ) {
+ while (iter.hasNext())
+ {
Token concurrentToken = (Token)iter.next();
- if (this.equals(concurrentToken.getNode())) {
+ if (this.equals(concurrentToken.getNode()))
+ {
n++;
}
}
- if ( n < nOutOfM ) {
+ if (n < nOutOfM)
+ {
reactivateParent = false;
}
-
- // if no configuration is specified..
- } else {
+
+ // if no configuration is specified..
+ }
+ else
+ {
// the default behaviour is to check all concurrent tokens and reactivate
// the parent if the last token arrives in the join
- reactivateParent = mustParentBeReactivated(parentToken, parentToken.getChildren().keySet().iterator() );
+ reactivateParent = mustParentBeReactivated(parentToken, parentToken.getChildren().keySet().iterator());
}
// if the parent token needs to be reactivated from this join node
- if (reactivateParent) {
+ if (reactivateParent)
+ {
// write to all child tokens that the parent is already reactivated
Iterator iter = parentToken.getChildren().values().iterator();
- while ( iter.hasNext() ) {
- ((Token)iter.next()).setAbleToReactivateParent( false );
+ while (iter.hasNext())
+ {
+ ((Token)iter.next()).setAbleToReactivateParent(false);
}
// write to all child tokens that the parent is already reactivated
@@ -198,50 +230,71 @@
}
}
- public boolean mustParentBeReactivated(Token parentToken, Iterator childTokenNameIterator) {
+ public boolean mustParentBeReactivated(Token parentToken, Iterator childTokenNameIterator)
+ {
boolean reactivateParent = true;
- while ( (childTokenNameIterator.hasNext())
- && (reactivateParent) ){
- String concurrentTokenName = (String) childTokenNameIterator.next();
-
- Token concurrentToken = parentToken.getChild( concurrentTokenName );
-
- if (concurrentToken.isAbleToReactivateParent()) {
- log.debug("join will not yet reactivate parent: found concurrent token '"+concurrentToken+"'");
+ while ((childTokenNameIterator.hasNext()) && (reactivateParent))
+ {
+ String concurrentTokenName = (String)childTokenNameIterator.next();
+
+ Token concurrentToken = parentToken.getChild(concurrentTokenName);
+
+ if (concurrentToken.isAbleToReactivateParent())
+ {
+ log.debug("join will not yet reactivate parent: found concurrent token '" + concurrentToken + "'");
reactivateParent = false;
}
}
return reactivateParent;
}
- public String getParentLockMode() {
+ public String getParentLockMode()
+ {
return parentLockMode;
}
- public void setParentLockMode(String parentLockMode) {
+
+ public void setParentLockMode(String parentLockMode)
+ {
this.parentLockMode = parentLockMode;
}
- public Script getScript() {
+
+ public Script getScript()
+ {
return script;
}
- public void setScript(Script script) {
+
+ public void setScript(Script script)
+ {
this.script = script;
}
- public Collection getTokenNames() {
+
+ public Collection getTokenNames()
+ {
return tokenNames;
}
- public void setTokenNames(Collection tokenNames) {
+
+ public void setTokenNames(Collection tokenNames)
+ {
this.tokenNames = tokenNames;
}
- public boolean isDiscriminator() {
+
+ public boolean isDiscriminator()
+ {
return isDiscriminator;
}
- public void setDiscriminator(boolean isDiscriminator) {
+
+ public void setDiscriminator(boolean isDiscriminator)
+ {
this.isDiscriminator = isDiscriminator;
}
- public int getNOutOfM() {
+
+ public int getNOutOfM()
+ {
return nOutOfM;
}
- public void setNOutOfM(int nOutOfM) {
+
+ public void setNOutOfM(int nOutOfM)
+ {
this.nOutOfM = nOutOfM;
}
Modified: jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/StartState.java
===================================================================
--- jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/StartState.java 2008-12-04 07:26:45 UTC (rev 3189)
+++ jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/StartState.java 2008-12-04 07:28:48 UTC (rev 3190)
@@ -41,6 +41,22 @@
super(name);
}
+ @Override
+ public String getName()
+ {
+ String name = super.getName();
+ if (name == null)
+ name = "StartState";
+
+ return name;
+ }
+
+ @Override
+ public NodeType getNodeType()
+ {
+ return NodeType.StartState;
+ }
+
// event types //////////////////////////////////////////////////////////////
public static final String[] supportedEventTypes = new String[]{
Modified: jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/State.java
===================================================================
--- jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/State.java 2008-12-04 07:26:45 UTC (rev 3189)
+++ jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/State.java 2008-12-04 07:28:48 UTC (rev 3190)
@@ -22,20 +22,31 @@
package org.jbpm.graph.node;
import org.jbpm.graph.def.*;
+import org.jbpm.graph.def.Node.NodeType;
import org.jbpm.graph.exe.*;
-public class State extends Node {
-
+public class State extends Node
+{
+
private static final long serialVersionUID = 1L;
- public State() {
+ public State()
+ {
this(null);
}
-
- public State(String name) {
- super( name );
+
+ public State(String name)
+ {
+ super(name);
}
- public void execute(ExecutionContext executionContext) {
+ @Override
+ public NodeType getNodeType()
+ {
+ return NodeType.State;
}
+
+ public void execute(ExecutionContext executionContext)
+ {
+ }
}
Modified: jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/TaskNode.java
===================================================================
--- jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/TaskNode.java 2008-12-04 07:26:45 UTC (rev 3189)
+++ jbpm3/branches/tdiesler/modules/core/src/main/java/org/jbpm/graph/node/TaskNode.java 2008-12-04 07:28:48 UTC (rev 3190)
@@ -21,22 +21,31 @@
*/
package org.jbpm.graph.node;
-import java.util.*;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
import org.dom4j.Element;
-import org.jbpm.graph.def.*;
-import org.jbpm.graph.exe.*;
+import org.jbpm.graph.def.Node;
+import org.jbpm.graph.def.Transition;
+import org.jbpm.graph.exe.ExecutionContext;
+import org.jbpm.graph.exe.Token;
import org.jbpm.jpdl.el.impl.JbpmExpressionEvaluator;
-import org.jbpm.jpdl.xml.*;
-import org.jbpm.taskmgmt.def.*;
-import org.jbpm.taskmgmt.exe.*;
+import org.jbpm.jpdl.xml.JpdlXmlReader;
+import org.jbpm.jpdl.xml.Parsable;
+import org.jbpm.taskmgmt.def.Task;
+import org.jbpm.taskmgmt.exe.TaskInstance;
+import org.jbpm.taskmgmt.exe.TaskMgmtInstance;
/**
- * is a node that relates to one or more tasks.
- * Property <code>signal</code> specifies how task completion
- * triggers continuation of execution.
+ * is a node that relates to one or more tasks. Property <code>signal</code> specifies how task completion triggers
+ * continuation of execution.
*/
-public class TaskNode extends Node implements Parsable {
+public class TaskNode extends Node implements Parsable
+{
private static final long serialVersionUID = 1L;
@@ -49,122 +58,165 @@
*/
public static final int SIGNAL_NEVER = 1;
/**
- * proceeds execution when the first task instance is completed.
- * when no tasks are created on entrance of this node, execution is continued.
+ * proceeds execution when the first task instance is completed. when no tasks are created on entrance of this node,
+ * execution is continued.
*/
public static final int SIGNAL_FIRST = 2;
/**
- * proceeds execution when the first task instance is completed.
- * when no tasks are created on entrance of this node, execution waits in the task node till tasks are created.
+ * proceeds execution when the first task instance is completed. when no tasks are created on entrance of this node,
+ * execution waits in the task node till tasks are created.
*/
public static final int SIGNAL_FIRST_WAIT = 3;
/**
- * proceeds execution when the last task instance is completed.
- * when no tasks are created on entrance of this node, execution is continued.
+ * proceeds execution when the last task instance is completed. when no tasks are created on entrance of this node,
+ * execution is continued.
*/
public static final int SIGNAL_LAST = 4;
/**
- * proceeds execution when the last task instance is completed.
- * when no tasks are created on entrance of this node, execution waits in the task node till tasks are created.
+ * proceeds execution when the last task instance is completed. when no tasks are created on entrance of this node,
+ * execution waits in the task node till tasks are created.
*/
public static final int SIGNAL_LAST_WAIT = 5;
-
- public static int parseSignal(String text) {
- if ("unsynchronized".equalsIgnoreCase(text)) {
+
+ public static int parseSignal(String text)
+ {
+ if ("unsynchronized".equalsIgnoreCase(text))
+ {
return SIGNAL_UNSYNCHRONIZED;
- } else if ("never".equalsIgnoreCase(text)) {
+ }
+ else if ("never".equalsIgnoreCase(text))
+ {
return SIGNAL_NEVER;
- } else if ("first".equalsIgnoreCase(text)) {
+ }
+ else if ("first".equalsIgnoreCase(text))
+ {
return SIGNAL_FIRST;
- } else if ("first-wait".equalsIgnoreCase(text)) {
+ }
+ else if ("first-wait".equalsIgnoreCase(text))
+ {
return SIGNAL_FIRST_WAIT;
- } else if ("last-wait".equalsIgnoreCase(text)) {
+ }
+ else if ("last-wait".equalsIgnoreCase(text))
+ {
return SIGNAL_LAST_WAIT;
- } else { // return default
+ }
+ else
+ { // return default
return SIGNAL_LAST;
}
}
-
- public static String signalToString(int signal) {
- if (signal==SIGNAL_UNSYNCHRONIZED) {
+
+ public static String signalToString(int signal)
+ {
+ if (signal == SIGNAL_UNSYNCHRONIZED)
+ {
return "unsynchronized";
- } else if (signal==SIGNAL_NEVER) {
+ }
+ else if (signal == SIGNAL_NEVER)
+ {
return "never";
- } else if (signal==SIGNAL_FIRST) {
+ }
+ else if (signal == SIGNAL_FIRST)
+ {
return "first";
- } else if (signal==SIGNAL_FIRST_WAIT) {
+ }
+ else if (signal == SIGNAL_FIRST_WAIT)
+ {
return "first-wait";
- } else if (signal==SIGNAL_LAST) {
+ }
+ else if (signal == SIGNAL_LAST)
+ {
return "last";
- } else if (signal==SIGNAL_LAST_WAIT) {
+ }
+ else if (signal == SIGNAL_LAST_WAIT)
+ {
return "last-wait";
- } else {
+ }
+ else
+ {
return null;
}
}
-
+
Set tasks = null;
int signal = SIGNAL_LAST;
boolean createTasks = true;
boolean endTasks = false;
-
- public TaskNode() {
+
+ public TaskNode()
+ {
}
- public TaskNode(String name) {
+ public TaskNode(String name)
+ {
super(name);
}
- public void read(Element element, JpdlXmlReader jpdlReader) {
+ @Override
+ public NodeType getNodeType()
+ {
+ return NodeType.Task;
+ }
+
+ public void read(Element element, JpdlXmlReader jpdlReader)
+ {
// get the signal
String signalText = element.attributeValue("signal");
- if (signalText!=null) {
+ if (signalText != null)
+ {
signal = parseSignal(signalText);
}
// create tasks
String createTasksText = element.attributeValue("create-tasks");
- if (createTasksText!=null) {
- if (("no".equalsIgnoreCase(createTasksText))
- || ("false".equalsIgnoreCase(createTasksText)) ) {
+ if (createTasksText != null)
+ {
+ if (("no".equalsIgnoreCase(createTasksText)) || ("false".equalsIgnoreCase(createTasksText)))
+ {
createTasks = false;
}
}
-
+
// create tasks
String removeTasksText = element.attributeValue("end-tasks");
- if (removeTasksText!=null) {
- if (("yes".equalsIgnoreCase(removeTasksText))
- || ("true".equalsIgnoreCase(removeTasksText)) ) {
+ if (removeTasksText != null)
+ {
+ if (("yes".equalsIgnoreCase(removeTasksText)) || ("true".equalsIgnoreCase(removeTasksText)))
+ {
endTasks = true;
}
}
-
+
// parse the tasks
jpdlReader.readTasks(element, this);
}
- public void addTask(Task task) {
- if (tasks==null) tasks = new HashSet();
+ public void addTask(Task task)
+ {
+ if (tasks == null)
+ tasks = new HashSet();
tasks.add(task);
task.setTaskNode(this);
}
// node behaviour methods
- /////////////////////////////////////////////////////////////////////////////
-
- public void execute(ExecutionContext executionContext) {
-
+ // ///////////////////////////////////////////////////////////////////////////
+
+ public void execute(ExecutionContext executionContext)
+ {
+
TaskMgmtInstance tmi = getTaskMgmtInstance(executionContext.getToken());
-
+
// if this tasknode should create instances
- if ( (createTasks)
- && (tasks!=null) ) {
+ if ((createTasks) && (tasks != null))
+ {
Iterator iter = tasks.iterator();
- while (iter.hasNext()) {
- Task task = (Task) iter.next();
+ while (iter.hasNext())
+ {
+ Task task = (Task)iter.next();
executionContext.setTask(task);
- if (evaluateTaskCondition(task.getCondition(), executionContext)) {
+ if (evaluateTaskCondition(task.getCondition(), executionContext))
+ {
tmi.createTaskInstance(task, executionContext);
}
}
@@ -172,7 +224,8 @@
// check if we should continue execution
boolean continueExecution;
- switch (signal) {
+ switch (signal)
+ {
case SIGNAL_UNSYNCHRONIZED:
continueExecution = true;
break;
@@ -184,93 +237,104 @@
continueExecution = false;
}
- if (continueExecution) {
+ if (continueExecution)
+ {
leave(executionContext);
}
}
-
- boolean evaluateTaskCondition(String condition, ExecutionContext executionContext) {
- if (condition==null) return true;
+
+ boolean evaluateTaskCondition(String condition, ExecutionContext executionContext)
+ {
+ if (condition == null)
+ return true;
Object result = JbpmExpressionEvaluator.evaluate(condition, executionContext);
- if (Boolean.TRUE.equals(result)) {
+ if (Boolean.TRUE.equals(result))
+ {
return true;
}
return false;
}
- public void leave(ExecutionContext executionContext, Transition transition) {
+ public void leave(ExecutionContext executionContext, Transition transition)
+ {
TaskMgmtInstance tmi = getTaskMgmtInstance(executionContext.getToken());
- if (tmi.hasBlockingTaskInstances(executionContext.getToken()) ) {
- throw new IllegalStateException("task-node '"+name+"' still has blocking tasks");
+ if (tmi.hasBlockingTaskInstances(executionContext.getToken()))
+ {
+ throw new IllegalStateException("task-node '" + name + "' still has blocking tasks");
}
removeTaskInstanceSynchronization(executionContext.getToken());
super.leave(executionContext, transition);
}
-
+
// task behaviour methods
- /////////////////////////////////////////////////////////////////////////////
+ // ///////////////////////////////////////////////////////////////////////////
- public boolean completionTriggersSignal(TaskInstance taskInstance) {
+ public boolean completionTriggersSignal(TaskInstance taskInstance)
+ {
boolean completionTriggersSignal;
- switch (signal) {
- case SIGNAL_FIRST:
- case SIGNAL_FIRST_WAIT:
- completionTriggersSignal = true;
- break;
- case SIGNAL_LAST:
- case SIGNAL_LAST_WAIT:
- completionTriggersSignal = isLastToComplete(taskInstance);
- break;
- default:
- completionTriggersSignal = false;
+ switch (signal)
+ {
+ case SIGNAL_FIRST:
+ case SIGNAL_FIRST_WAIT:
+ completionTriggersSignal = true;
+ break;
+ case SIGNAL_LAST:
+ case SIGNAL_LAST_WAIT:
+ completionTriggersSignal = isLastToComplete(taskInstance);
+ break;
+ default:
+ completionTriggersSignal = false;
}
return completionTriggersSignal;
}
- boolean isLastToComplete(TaskInstance taskInstance) {
+ boolean isLastToComplete(TaskInstance taskInstance)
+ {
Token token = taskInstance.getToken();
TaskMgmtInstance tmi = getTaskMgmtInstance(token);
-
+
boolean isLastToComplete = true;
Iterator iter = tmi.getTaskInstances().iterator();
- while ( iter.hasNext()
- && (isLastToComplete) ) {
- TaskInstance other = (TaskInstance) iter.next();
- if ( (token!=null)
- && (token.equals(other.getToken()))
- && (! other.equals(taskInstance))
- && (other.isSignalling())
- && (!other.hasEnded())
- ) {
+ while (iter.hasNext() && (isLastToComplete))
+ {
+ TaskInstance other = (TaskInstance)iter.next();
+ if ((token != null) && (token.equals(other.getToken())) && (!other.equals(taskInstance)) && (other.isSignalling()) && (!other.hasEnded()))
+ {
isLastToComplete = false;
}
}
-
+
return isLastToComplete;
}
- public void removeTaskInstanceSynchronization(Token token) {
+ public void removeTaskInstanceSynchronization(Token token)
+ {
TaskMgmtInstance tmi = getTaskMgmtInstance(token);
Collection taskInstances = tmi.getTaskInstances();
- if (taskInstances!=null) {
+ if (taskInstances != null)
+ {
Iterator iter = taskInstances.iterator();
- while (iter.hasNext()) {
- TaskInstance taskInstance = (TaskInstance) iter.next();
- if (token.equals(taskInstance.getToken())) {
+ while (iter.hasNext())
+ {
+ TaskInstance taskInstance = (TaskInstance)iter.next();
+ if (token.equals(taskInstance.getToken()))
+ {
// remove signalling
- if (taskInstance.isSignalling()) {
+ if (taskInstance.isSignalling())
+ {
taskInstance.setSignalling(false);
}
// remove blocking
- if (taskInstance.isBlocking()) {
+ if (taskInstance.isBlocking())
+ {
taskInstance.setBlocking(false);
}
// if this is a non-finished task and all those
// tasks should be finished
- if ( (! taskInstance.hasEnded())
- && (endTasks)
- ) {
- if (tasks.contains(taskInstance.getTask())) {
+ if ((!taskInstance.hasEnded()) && (endTasks))
+ {
+ if (tasks.contains(taskInstance.getTask()))
+ {
// end this task
taskInstance.end();
}
@@ -280,59 +344,77 @@
}
}
- TaskMgmtInstance getTaskMgmtInstance(Token token) {
- return (TaskMgmtInstance) token.getProcessInstance().getInstance(TaskMgmtInstance.class);
+ TaskMgmtInstance getTaskMgmtInstance(Token token)
+ {
+ return (TaskMgmtInstance)token.getProcessInstance().getInstance(TaskMgmtInstance.class);
}
// getters and setters
- /////////////////////////////////////////////////////////////////////////////
+ // ///////////////////////////////////////////////////////////////////////////
/**
- * is a Map with the tasks, keyed by task-name or an empty map in case
- * no tasks are present in this task-node.
+ * is a Map with the tasks, keyed by task-name or an empty map in case no tasks are present in this task-node.
*/
- public Map getTasksMap() {
+ public Map getTasksMap()
+ {
Map tasksMap = new HashMap();
- if (tasks!=null) {
+ if (tasks != null)
+ {
Iterator iter = tasks.iterator();
- while (iter.hasNext()) {
- Task task = (Task) iter.next();
+ while (iter.hasNext())
+ {
+ Task task = (Task)iter.next();
tasksMap.put(task.getName(), task);
}
}
return tasksMap;
}
-
+
/**
- * is the task in this task-node with the given name or null if the given task
- * does not exist in this node.
+ * is the task in this task-node with the given name or null if the given task does not exist in this node.
*/
- public Task getTask(String taskName) {
- return (Task) getTasksMap().get(taskName);
+ public Task getTask(String taskName)
+ {
+ return (Task)getTasksMap().get(taskName);
}
- public Set getTasks() {
+ public Set getTasks()
+ {
return tasks;
}
- public int getSignal() {
+
+ public int getSignal()
+ {
return signal;
}
- public boolean getCreateTasks() {
+
+ public boolean getCreateTasks()
+ {
return createTasks;
}
- public boolean isEndTasks() {
+
+ public boolean isEndTasks()
+ {
return endTasks;
}
- public void setCreateTasks(boolean createTasks) {
+
+ public void setCreateTasks(boolean createTasks)
+ {
this.createTasks = createTasks;
}
- public void setEndTasks(boolean endTasks) {
+
+ public void setEndTasks(boolean endTasks)
+ {
this.endTasks = endTasks;
}
- public void setSignal(int signal) {
+
+ public void setSignal(int signal)
+ {
this.signal = signal;
}
- public void setTasks(Set tasks) {
+
+ public void setTasks(Set tasks)
+ {
this.tasks = tasks;
}
}
Modified: jbpm3/branches/tdiesler/modules/core/src/test/java/org/jbpm/taskmgmt/exe/EndTasksDbTest.java
===================================================================
--- jbpm3/branches/tdiesler/modules/core/src/test/java/org/jbpm/taskmgmt/exe/EndTasksDbTest.java 2008-12-04 07:26:45 UTC (rev 3189)
+++ jbpm3/branches/tdiesler/modules/core/src/test/java/org/jbpm/taskmgmt/exe/EndTasksDbTest.java 2008-12-04 07:28:48 UTC (rev 3190)
@@ -179,7 +179,6 @@
processInstance.signal();
processInstance = saveAndReload(processInstance);
- processInstance = saveAndReload(processInstance);
processInstance.signal("cancel");
Collection taskInstances = processInstance.getTaskMgmtInstance().getTaskInstances();
Modified: jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/EndEventImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/EndEventImpl.java 2008-12-04 07:26:45 UTC (rev 3189)
+++ jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/EndEventImpl.java 2008-12-04 07:28:48 UTC (rev 3190)
@@ -39,7 +39,7 @@
{
private static final long serialVersionUID = 1L;
- public EndEventImpl(ProcessDefinition procDef, EndState oldEnd)
+ public EndEventImpl(ProcessDefinition procDef, org.jbpm.graph.def.Node oldEnd)
{
super(procDef, oldEnd);
}
Modified: jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/ExclusiveGatewayImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/ExclusiveGatewayImpl.java 2008-12-04 07:26:45 UTC (rev 3189)
+++ jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/ExclusiveGatewayImpl.java 2008-12-04 07:28:48 UTC (rev 3190)
@@ -23,6 +23,8 @@
// $Id$
+import org.hibernate.intercept.cglib.CGLIBHelper;
+import org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory;
import org.jboss.bpm.api.client.ProcessEngine;
import org.jboss.bpm.api.model.ExclusiveGateway;
import org.jboss.bpm.api.model.Expression;
@@ -36,6 +38,7 @@
import org.jbpm.instantiation.Delegation;
import org.jbpm.integration.spec.runtime.ExpressionEvaluator;
import org.jbpm.integration.spec.runtime.TokenImpl;
+import org.jbpm.mock.CglibEnhancer;
/**
* An integration wrapper
@@ -47,11 +50,11 @@
{
private static final long serialVersionUID = 1L;
- public ExclusiveGatewayImpl(ProcessDefinition procDef, Decision oldDecision)
+ public ExclusiveGatewayImpl(ProcessDefinition procDef, org.jbpm.graph.def.Node oldNode)
{
- super(procDef, oldDecision);
+ super(procDef, oldNode);
ExclusiveGatewayDecisionHandler decisionHandler = new ExclusiveGatewayDecisionHandler();
- oldDecision.setDecisionDelegation(new Delegation(decisionHandler));
+ //oldNode.setDecisionDelegation(new Delegation(decisionHandler));
}
//@Override
Modified: jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/ParallelGatewayImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/ParallelGatewayImpl.java 2008-12-04 07:26:45 UTC (rev 3189)
+++ jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/ParallelGatewayImpl.java 2008-12-04 07:28:48 UTC (rev 3190)
@@ -25,8 +25,6 @@
import org.jboss.bpm.api.model.ProcessDefinition;
import org.jboss.bpm.incubator.model.ParallelGateway;
-import org.jbpm.graph.node.Fork;
-import org.jbpm.graph.node.Join;
/**
* An integration wrapper
@@ -38,16 +36,11 @@
{
private static final long serialVersionUID = 1L;
- public ParallelGatewayImpl(ProcessDefinition procDef, Fork oldFork)
+ public ParallelGatewayImpl(ProcessDefinition procDef, org.jbpm.graph.def.Node oldNode)
{
- super(procDef, oldFork);
+ super(procDef, oldNode);
}
- public ParallelGatewayImpl(ProcessDefinition procDef, Join oldJoin)
- {
- super(procDef, oldJoin);
- }
-
// @Override
public GatewayType getGatewayType()
{
Modified: jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/ProcessDefinitionImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/ProcessDefinitionImpl.java 2008-12-04 07:26:45 UTC (rev 3189)
+++ jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/ProcessDefinitionImpl.java 2008-12-04 07:28:48 UTC (rev 3190)
@@ -37,14 +37,8 @@
import org.jboss.bpm.api.model.SequenceFlow.ConditionType;
import org.jboss.bpm.api.model.builder.ObjectNameFactory;
import org.jbpm.graph.def.Transition;
+import org.jbpm.graph.def.Node.NodeType;
import org.jbpm.graph.exe.ProcessInstance;
-import org.jbpm.graph.node.Decision;
-import org.jbpm.graph.node.EndState;
-import org.jbpm.graph.node.Fork;
-import org.jbpm.graph.node.Join;
-import org.jbpm.graph.node.StartState;
-import org.jbpm.graph.node.State;
-import org.jbpm.graph.node.TaskNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -119,7 +113,10 @@
public Process newInstance()
{
- ProcessImpl procImpl = new ProcessImpl(engine, new ProcessInstance(oldProcDef));
+ ProcessInstance oldProc = new ProcessInstance();
+ oldProc.setProcessDefinition(oldProcDef);
+
+ ProcessImpl procImpl = new ProcessImpl(engine, oldProc);
return procImpl;
}
@@ -154,39 +151,43 @@
for(org.jbpm.graph.def.Node oldNode : oldProcDef.getNodes())
{
NodeImpl nodeImpl;
- if (oldNode instanceof StartState)
+ NodeType nodeType = oldNode.getNodeType();
+ if (nodeType == NodeType.StartState)
{
- nodeImpl = new StartEventImpl(this, (StartState)oldNode);
+ nodeImpl = new StartEventImpl(this, oldNode);
}
- else if (oldNode instanceof State)
+ else if (nodeType == NodeType.State)
{
- nodeImpl = new WaitStateImpl(this, (State)oldNode);
+ nodeImpl = new WaitStateImpl(this, oldNode);
}
- else if (oldNode instanceof Fork)
+ else if (nodeType == NodeType.Fork)
{
- nodeImpl = new ParallelGatewayImpl(this, (Fork)oldNode);
+ nodeImpl = new ParallelGatewayImpl(this, oldNode);
}
- else if (oldNode instanceof Join)
+ else if (nodeType == NodeType.Join)
{
- nodeImpl = new ParallelGatewayImpl(this, (Join)oldNode);
+ nodeImpl = new ParallelGatewayImpl(this, oldNode);
}
- else if (oldNode instanceof Decision)
+ else if (nodeType == NodeType.Decission)
{
- nodeImpl = new ExclusiveGatewayImpl(this, (Decision)oldNode);
+ nodeImpl = new ExclusiveGatewayImpl(this, oldNode);
}
- else if (oldNode instanceof TaskNode)
+ else if (nodeType == NodeType.Task)
{
- nodeImpl = new UserTaskImpl(this, (TaskNode)oldNode);
+ nodeImpl = new UserTaskImpl(this, oldNode);
}
- else if (oldNode instanceof EndState)
+ else if (nodeType == NodeType.EndState)
{
- nodeImpl = new EndEventImpl(this, (EndState)oldNode);
+ nodeImpl = new EndEventImpl(this, oldNode);
}
- // Fallback to a general Task node
- else
+ else if (nodeType == NodeType.Node)
{
nodeImpl = new TaskImpl(this, oldNode);
}
+ else
+ {
+ throw new IllegalStateException("Unsupported node type: " + nodeType);
+ }
nodes.add(nodeImpl);
}
Modified: jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/ProcessImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/ProcessImpl.java 2008-12-04 07:26:45 UTC (rev 3189)
+++ jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/ProcessImpl.java 2008-12-04 07:28:48 UTC (rev 3190)
@@ -43,6 +43,7 @@
import org.jboss.bpm.api.service.ProcessService;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.integration.spec.runtime.TokenImpl;
+import org.jbpm.util.Clock;
/**
* An integration wrapper
@@ -168,15 +169,19 @@
// @Override
public Token startProcess(Attachments contextData)
{
-
ExecutionContextService ctxService = getProcessEngine().getService(ExecutionContextService.class);
ExecutionContext bpmContext = ctxService.getExecutionContext(true);
try
{
// Register the Process
ProcessService procService = getProcessEngine().getService(ProcessService.class);
- procService.registerProcess(this);
+ if (procService.getProcess(getKey()) == null)
+ procService.registerProcess(this);
+ // Initialize the members
+ oldProc.setRootToken(new org.jbpm.graph.exe.Token(oldProc));
+ oldProc.setStart(Clock.getCurrentTime());
+
// Create the root token
Token token = new TokenImpl(engine, oldProc.getRootToken());
@@ -191,8 +196,14 @@
}
}
+ // Set process to active
+ setProcessStatus(ProcessStatus.Active);
+
+ // Fire the jbpm3 start event
+ NodeImpl initialNode = (NodeImpl)token.getCurrentNode();
+ oldProc.fireStartEvent(initialNode.getOldNode());
+
// Signal the root token
- setProcessStatus(ProcessStatus.Active);
token.signal();
return token;
@@ -205,7 +216,8 @@
public Token getRootToken()
{
- return new TokenImpl(engine, oldProc.getRootToken());
+ org.jbpm.graph.exe.Token rootToken = oldProc.getRootToken();
+ return rootToken != null ? new TokenImpl(engine, rootToken) : null;
}
public Set<Token> getTokens()
Modified: jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/StartEventImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/StartEventImpl.java 2008-12-04 07:26:45 UTC (rev 3189)
+++ jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/StartEventImpl.java 2008-12-04 07:28:48 UTC (rev 3190)
@@ -23,12 +23,10 @@
import java.util.List;
-import org.jboss.bpm.api.InvalidProcessException;
import org.jboss.bpm.api.NotImplementedException;
import org.jboss.bpm.api.model.ProcessDefinition;
import org.jboss.bpm.api.model.SequenceFlow;
import org.jboss.bpm.api.model.StartEvent;
-import org.jbpm.graph.node.StartState;
/**
* An integration wrapper
@@ -40,15 +38,9 @@
{
private static final long serialVersionUID = 1L;
- private StartState oldStart;
-
- public StartEventImpl(ProcessDefinition procDef, StartState oldStart)
+ public StartEventImpl(ProcessDefinition procDef, org.jbpm.graph.def.Node oldStart)
{
super(procDef, oldStart);
- this.oldStart = oldStart;
-
- if (oldStart.getName() == null)
- throw new InvalidProcessException("StartEvent name cannot be null");
}
// @Override
Modified: jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/UserTaskImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/UserTaskImpl.java 2008-12-04 07:26:45 UTC (rev 3189)
+++ jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/UserTaskImpl.java 2008-12-04 07:28:48 UTC (rev 3190)
@@ -38,7 +38,7 @@
{
private static final long serialVersionUID = 1L;
- public UserTaskImpl(ProcessDefinition procDef, TaskNode oldTaskNode)
+ public UserTaskImpl(ProcessDefinition procDef, org.jbpm.graph.def.Node oldTaskNode)
{
super(procDef, oldTaskNode);
}
Modified: jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/WaitStateImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/WaitStateImpl.java 2008-12-04 07:26:45 UTC (rev 3189)
+++ jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/WaitStateImpl.java 2008-12-04 07:28:48 UTC (rev 3190)
@@ -23,7 +23,6 @@
import org.jboss.bpm.api.model.ProcessDefinition;
import org.jboss.bpm.api.model.WaitState;
-import org.jbpm.graph.node.State;
/**
* An integration wrapper
@@ -35,7 +34,7 @@
{
private static final long serialVersionUID = 1L;
- public WaitStateImpl(ProcessDefinition procDef, State oldState)
+ public WaitStateImpl(ProcessDefinition procDef, org.jbpm.graph.def.Node oldState)
{
super(procDef, oldState);
}
Modified: jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/builder/ProcessBuilderImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/builder/ProcessBuilderImpl.java 2008-12-04 07:26:45 UTC (rev 3189)
+++ jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/model/builder/ProcessBuilderImpl.java 2008-12-04 07:28:48 UTC (rev 3190)
@@ -41,6 +41,7 @@
import org.jboss.bpm.api.model.builder.GatewayBuilder;
import org.jboss.bpm.api.model.builder.ProcessBuilder;
import org.jbpm.graph.def.Transition;
+import org.jbpm.graph.def.Node.NodeType;
import org.jbpm.graph.node.Decision;
import org.jbpm.graph.node.EndState;
import org.jbpm.graph.node.StartState;
@@ -215,8 +216,9 @@
for (Node node : procDefImpl.getNodes())
{
NodeImpl nodeImpl = (NodeImpl)node;
+ NodeType nodeType = nodeImpl.getOldNode().getNodeType();
Set arriving = nodeImpl.getOldNode().getArrivingTransitions();
- if (!(node instanceof StartEvent) && arriving == null)
+ if (nodeType != NodeType.StartState && arriving == null)
throw new InvalidProcessException("Unreachable node: " + node);
}
@@ -224,8 +226,9 @@
for (Node node : procDefImpl.getNodes())
{
NodeImpl nodeImpl = (NodeImpl)node;
+ NodeType nodeType = nodeImpl.getOldNode().getNodeType();
List leaving = nodeImpl.getOldNode().getLeavingTransitions();
- if (!(node instanceof EndEvent) && leaving == null)
+ if (nodeType != NodeType.EndState && leaving == null)
throw new InvalidProcessException("Dead end node: " + node);
}
}
Modified: jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/runtime/TokenImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/runtime/TokenImpl.java 2008-12-04 07:26:45 UTC (rev 3189)
+++ jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/runtime/TokenImpl.java 2008-12-04 07:28:48 UTC (rev 3190)
@@ -21,6 +21,7 @@
*/
package org.jbpm.integration.spec.runtime;
+import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -38,10 +39,15 @@
import org.jboss.bpm.api.runtime.ExecutionContext;
import org.jboss.bpm.api.runtime.Token;
import org.jboss.bpm.api.service.ExecutionContextService;
+import org.jbpm.JbpmContext;
import org.jbpm.context.exe.ContextInstance;
import org.jbpm.graph.def.Transition;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.graph.node.StartState;
import org.jbpm.integration.spec.model.NodeImpl;
import org.jbpm.integration.spec.model.ProcessImpl;
+import org.jbpm.taskmgmt.exe.TaskInstance;
+import org.jbpm.taskmgmt.exe.TaskMgmtInstance;
/**
* An integration wrapper
@@ -202,6 +208,24 @@
lastFlow = currNode.getOutFlowByTransition(trans);
oldToken.signal();
}
+
+ JbpmContext jbpmContext = bpmContext.getAttachment(JbpmContext.class);
+ ProcessInstance oldProc = oldToken.getProcessInstance();
+
+ // Task instances are not saved automatically
+ TaskMgmtInstance taskMgmt = oldProc.getTaskMgmtInstance();
+ Collection<TaskInstance> taskInstances = taskMgmt.getTaskInstances();
+ if (taskInstances != null)
+ {
+ jbpmContext.getSession().save(taskMgmt);
+ oldProc.addInstance(taskMgmt);
+
+ for (TaskInstance oldTask : taskInstances)
+ jbpmContext.getSession().save(oldTask);
+ }
+
+ jbpmContext.save(oldToken);
+
}
catch (RuntimeException rte)
{
Modified: jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/service/ProcessDefinitionServiceImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/service/ProcessDefinitionServiceImpl.java 2008-12-04 07:26:45 UTC (rev 3189)
+++ jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/service/ProcessDefinitionServiceImpl.java 2008-12-04 07:28:48 UTC (rev 3190)
@@ -148,6 +148,7 @@
long oldID = procDefImpl.getOldProcessDefinition().getId();
JbpmContext jbpmContext = bpmContext.getAttachment(JbpmContext.class);
jbpmContext.getGraphSession().deleteProcessDefinition(oldID);
+ jbpmContext.getSession().flush();
removed = true;
}
}
Modified: jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/service/TaskServiceImpl.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/service/TaskServiceImpl.java 2008-12-04 07:26:45 UTC (rev 3189)
+++ jbpm3/branches/tdiesler/modules/integration/spec/src/main/java/org/jbpm/integration/spec/service/TaskServiceImpl.java 2008-12-04 07:28:48 UTC (rev 3190)
@@ -24,18 +24,24 @@
// $Id$
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
import java.util.List;
import javax.management.ObjectName;
import org.jboss.bpm.api.client.ProcessEngine;
+import org.jboss.bpm.api.model.Process;
import org.jboss.bpm.api.runtime.ExecutionContext;
import org.jboss.bpm.api.service.ExecutionContextService;
+import org.jboss.bpm.api.service.ProcessService;
import org.jboss.bpm.api.service.internal.AbstractTaskService;
import org.jboss.bpm.api.task.Task;
import org.jbpm.JbpmContext;
import org.jbpm.integration.spec.task.TaskImpl;
+import org.jbpm.integration.spec.model.ProcessImpl;
import org.jbpm.taskmgmt.exe.TaskInstance;
+import org.jbpm.taskmgmt.exe.TaskMgmtInstance;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -56,6 +62,41 @@
super.setProcessEngine(engine);
}
+ public List<Task> getTasksByProcess(ObjectName procID)
+ {
+ List<Task> tasks = new ArrayList<Task>();
+
+ ExecutionContextService ctxService = getProcessEngine().getService(ExecutionContextService.class);
+ ExecutionContext bpmContext = ctxService.getExecutionContext(true);
+ try
+ {
+ ProcessService procService = getProcessEngine().getService(ProcessService.class);
+ Process proc = procService.getProcess(procID);
+ if (proc == null)
+ throw new IllegalStateException("Cannot obtain process: " + procID);
+
+ ProcessImpl procImpl = (ProcessImpl)proc;
+ TaskMgmtInstance taskMgmtInstance = procImpl.getOldProcessInstance().getTaskMgmtInstance();
+ Collection<TaskInstance> taskInstances = taskMgmtInstance.getTaskInstances();
+ if (taskInstances != null)
+ {
+ Iterator<TaskInstance> itTaskInstance = taskInstances.iterator();
+ while(itTaskInstance.hasNext())
+ {
+ TaskInstance oldTask = itTaskInstance.next();
+ Task task = new TaskImpl(getProcessEngine(), oldTask);
+ tasks.add(task);
+ }
+ }
+ }
+ finally
+ {
+ bpmContext.close();
+ }
+
+ return tasks;
+ }
+
public Task getTask(ObjectName taskID)
{
Task task = null;
@@ -68,10 +109,6 @@
TaskInstance oldTask = jbpmContext.getTaskInstance(adaptKey(taskID));
task = new TaskImpl(getProcessEngine(), oldTask);
}
- catch (RuntimeException rte)
- {
- throw rte;
- }
finally
{
bpmContext.close();
@@ -94,10 +131,6 @@
tasks.add(new TaskImpl(getProcessEngine(), oldTask));
}
}
- catch (RuntimeException rte)
- {
- throw rte;
- }
finally
{
bpmContext.close();
Modified: jbpm3/branches/tdiesler/modules/integration/spec/src/test/java/org/jbpm/test/integration/spec/deployment/DeploymentPARTest.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/spec/src/test/java/org/jbpm/test/integration/spec/deployment/DeploymentPARTest.java 2008-12-04 07:26:45 UTC (rev 3189)
+++ jbpm3/branches/tdiesler/modules/integration/spec/src/test/java/org/jbpm/test/integration/spec/deployment/DeploymentPARTest.java 2008-12-04 07:28:48 UTC (rev 3190)
@@ -34,6 +34,7 @@
import org.jboss.bpm.api.model.ProcessDefinition;
import org.jboss.bpm.api.runtime.Token;
import org.jboss.bpm.api.service.DeploymentService;
+import org.jboss.bpm.api.service.ProcessService;
import org.jboss.bpm.api.service.TaskService;
import org.jboss.bpm.api.task.Task;
import org.jboss.bpm.api.test.APITestCase;
@@ -55,32 +56,42 @@
ProcessDefinition procDef = depService.deploy(dep);
assertNotNull("ProcDef not null", procDef);
-
+
Process proc = procDef.newInstance();
Token token = proc.startProcess();
+
+ assertEquals("start", token.getCurrentNode().getName());
+ assertEquals(0, token.getChildTokens().size());
+
+/*
+ token.signal();
assertEquals("fork1", token.getCurrentNode().getName());
assertEquals(2, token.getChildTokens().size());
// Get the child tokens
- Map<String,Token> childToks = new HashMap<String, Token>();
+ Token childOne = getChildToken(token, "Review Order");
+ assertNotNull("Review Order", childOne);
+
+ Token childTwo = getChildToken(token, "Prepare shipping");
+ assertNotNull("Review Order", childTwo);
+
+ TaskService taskService = getProcessEngine().getService(TaskService.class);
+ assertEquals(2, taskService.getTasksByProcess(proc.getKey()).size());
+*/
+ // Undeploy the process
+ assertTrue("Undeploy successful", depService.undeploy(dep));
+ }
+
+ private Token getChildToken(Token token, String nodeName)
+ {
+ Map<String, Token> childToks = new HashMap<String, Token>();
Iterator<Token> itTok = token.getChildTokens().iterator();
while (itTok.hasNext())
{
Token child = itTok.next();
childToks.put(child.getCurrentNode().getName(), child);
}
- Token childOne = childToks.get("Prepare shipping");
- Token childTwo = childToks.get("Review Order");
-
- assertNotNull("Prepare shipping", childOne);
- assertNotNull("Review Order", childTwo);
-
- TaskService taskService = getProcessEngine().getService(TaskService.class);
- List<Task> tasks = taskService.getTasksByActor("sales");
- System.out.println(tasks);
-
- // Undeploy the process
- assertTrue("Undeploy successful", depService.undeploy(dep));
+ return childToks.get(nodeName);
}
}
Added: jbpm3/branches/tdiesler/modules/integration/spec/src/test/java/org/jbpm/test/integration/spec/task/TaskTest.java
===================================================================
--- jbpm3/branches/tdiesler/modules/integration/spec/src/test/java/org/jbpm/test/integration/spec/task/TaskTest.java (rev 0)
+++ jbpm3/branches/tdiesler/modules/integration/spec/src/test/java/org/jbpm/test/integration/spec/task/TaskTest.java 2008-12-04 07:28:48 UTC (rev 3190)
@@ -0,0 +1,318 @@
+/*
+ * 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.integration.spec.task;
+
+// $Id$
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.jboss.bpm.api.deployment.Deployment;
+import org.jboss.bpm.api.deployment.SimpleDeployment;
+import org.jboss.bpm.api.model.Process;
+import org.jboss.bpm.api.model.ProcessDefinition;
+import org.jboss.bpm.api.service.DeploymentService;
+import org.jboss.bpm.api.test.APITestCase;
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.JbpmContext;
+import org.jbpm.db.GraphSession;
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.exe.ExecutionContext;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.taskmgmt.exe.TaskInstance;
+
+/**
+ * This uses the API to do the same as the EndTasksDbTest
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 03-Dec-2008
+ */
+public class TaskTest extends APITestCase
+{
+ private JbpmConfiguration jbpmConfiguration;
+ private JbpmContext jbpmContext;
+ private GraphSession graphSession;
+
+ public void testCancelOld()
+ {
+ org.jbpm.graph.def.ProcessDefinition processDefinition = org.jbpm.graph.def.ProcessDefinition.parseXmlString(
+ "<process-definition name='endtasksprocess'>" +
+ " <start-state>" +
+ " <transition to='approval' />" +
+ " </start-state>" +
+ " <task-node name='approval' end-tasks='true'>" +
+ " <task name='approve' description='Review order'>" +
+ " <assignment pooled-actors='reviewers' />" +
+ " </task>" +
+ " <transition name='approve' to='process'>" +
+ " <action class='"+Buzz.class.getName()+"' />" +
+ " </transition>" +
+ " <transition name='cancel' to='cancelled'/>" +
+ " </task-node>" +
+ " <state name='process' />" +
+ " <state name='cancelled' />" +
+ "</process-definition>"
+ );
+
+ jbpmContext = createJbpmContext();
+
+ jbpmContext.deployProcessDefinition(processDefinition);
+ ProcessInstance processInstance = jbpmContext.newProcessInstance("endtasksprocess");
+
+ processInstance = saveAndReload(processInstance);
+
+ processInstance.signal();
+ assertEquals("approval", processInstance.getRootToken().getNode().getName());
+
+ processInstance = saveAndReload(processInstance);
+
+ processInstance.signal("cancel");
+ assertEquals("cancelled", processInstance.getRootToken().getNode().getName());
+
+ jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
+ jbpmContext.close();
+ }
+
+ public void testCancel()
+ {
+ Deployment procDefDeployment = new SimpleDeployment(
+ "<process-definition name='endtasksprocess' xmlns='urn:jbpm.org:jpdl-3.2'>" +
+ " <start-state>" +
+ " <transition to='approval' />" +
+ " </start-state>" +
+ " <task-node name='approval' end-tasks='true'>" +
+ " <task name='approve' description='Review order'>" +
+ " <assignment pooled-actors='reviewers' />" +
+ " </task>" +
+ " <transition name='approve' to='process'>" +
+ " <action class='" + Buzz.class.getName() + "' />" +
+ " </transition>" +
+ " <transition name='cancel' to='cancelled'/>" +
+ " </task-node>" +
+ " <state name='process' />" +
+ " <state name='cancelled' />" +
+ "</process-definition>"
+ );
+
+ DeploymentService depService = getProcessEngine().getService(DeploymentService.class);
+ ProcessDefinition procDef = depService.deploy(procDefDeployment);
+
+ Process proc = procDef.newInstance();
+ proc.startProcess();
+
+ assertEquals("approval", proc.getRootToken().getCurrentNode().getName());
+ proc.getRootToken().signal("cancel");
+ assertEquals("cancelled", proc.getRootToken().getCurrentNode().getName());
+
+ depService.undeploy(procDefDeployment);
+ }
+
+ public void _testApprove()
+ {
+ jbpmContext = createJbpmContext();
+ graphSession = jbpmContext.getGraphSession();
+
+ org.jbpm.graph.def.ProcessDefinition processDefinition = org.jbpm.graph.def.ProcessDefinition.parseXmlString(
+ "<process-definition name='endtasksprocess'>" +
+ " <start-state>" +
+ " <transition to='approval' />" +
+ " </start-state>" +
+ " <task-node name='approval' end-tasks='true'>" +
+ " <task name='approve' description='Review order'>" +
+ " <assignment pooled-actors='reviewers' />" +
+ " </task>" +
+ " <transition name='approve' to='process'/>" +
+ " <transition name='reject' to='cancelled'/>" +
+ " <transition name='cancel' to='cancelled'/>" +
+ " </task-node>" +
+ " <state name='process' />" +
+ " <state name='cancelled' />" +
+ "</process-definition>"
+ );
+ jbpmContext.deployProcessDefinition(processDefinition);
+ try
+ {
+ newTransaction();
+
+ ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate("endtasksprocess");
+ processInstance.signal();
+
+ processInstance = saveAndReload(processInstance);
+
+ assertEquals("approval", processInstance.getRootToken().getNode().getName());
+ TaskInstance taskInstance = (TaskInstance) processInstance
+ .getTaskMgmtInstance()
+ .getTaskInstances()
+ .iterator()
+ .next();
+
+ taskInstance.end("approve");
+ assertEquals("process", processInstance.getRootToken().getNode().getName());
+ }
+ finally
+ {
+ jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
+ jbpmContext.close();
+ }
+ }
+
+ public void _testReject()
+ {
+ jbpmContext = createJbpmContext();
+ graphSession = jbpmContext.getGraphSession();
+
+ org.jbpm.graph.def.ProcessDefinition processDefinition = org.jbpm.graph.def.ProcessDefinition.parseXmlString(
+ "<process-definition name='endtasksprocess'>" +
+ " <start-state>" +
+ " <transition to='approval' />" +
+ " </start-state>" +
+ " <task-node name='approval' end-tasks='true'>" +
+ " <task name='approve' description='Review order'>" +
+ " <assignment pooled-actors='reviewers' />" +
+ " </task>" +
+ " <transition name='approve' to='process'/>" +
+ " <transition name='reject' to='cancelled'/>" +
+ " <transition name='cancel' to='cancelled'/>" +
+ " </task-node>" +
+ " <state name='process' />" +
+ " <state name='cancelled' />" +
+ "</process-definition>"
+ );
+ jbpmContext.deployProcessDefinition(processDefinition);
+ try
+ {
+ newTransaction();
+
+ ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate("endtasksprocess");
+ processInstance.signal();
+
+ processInstance = saveAndReload(processInstance);
+
+ assertEquals("approval", processInstance.getRootToken().getNode().getName());
+ TaskInstance taskInstance = (TaskInstance) processInstance
+ .getTaskMgmtInstance()
+ .getTaskInstances()
+ .iterator()
+ .next();
+
+ taskInstance.end("reject");
+ assertEquals("cancelled", processInstance.getRootToken().getNode().getName());
+ }
+ finally
+ {
+ jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
+ jbpmContext.close();
+ }
+ }
+
+ public void _testTaskInstancesAfterCancellation()
+ {
+ jbpmContext = createJbpmContext();
+ graphSession = jbpmContext.getGraphSession();
+
+ org.jbpm.graph.def.ProcessDefinition processDefinition = org.jbpm.graph.def.ProcessDefinition.parseXmlString(
+ "<process-definition name='endtasksprocess'>" +
+ " <start-state>" +
+ " <transition to='approval' />" +
+ " </start-state>" +
+ " <task-node name='approval' end-tasks='true'>" +
+ " <task name='approve' description='Review order'>" +
+ " <assignment pooled-actors='reviewers' />" +
+ " </task>" +
+ " <transition name='approve' to='process'/>" +
+ " <transition name='reject' to='cancelled'/>" +
+ " <transition name='cancel' to='cancelled'/>" +
+ " </task-node>" +
+ " <state name='process' />" +
+ " <state name='cancelled' />" +
+ "</process-definition>"
+ );
+ jbpmContext.deployProcessDefinition(processDefinition);
+ try
+ {
+ newTransaction();
+
+ ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate("endtasksprocess");
+ processInstance.signal();
+
+ processInstance = saveAndReload(processInstance);
+ processInstance.signal("cancel");
+
+ Collection taskInstances = processInstance.getTaskMgmtInstance().getTaskInstances();
+ Iterator iter = taskInstances.iterator();
+ while(iter.hasNext()) {
+ TaskInstance taskInstance = (TaskInstance) iter.next();
+ assertTrue(taskInstance.getName()+" ended", taskInstance.hasEnded());
+ assertFalse(taskInstance.getName()+" not cancelled", taskInstance.isCancelled());
+ assertFalse(taskInstance.getName()+" not blocking", taskInstance.isBlocking());
+ assertFalse(taskInstance.getName()+" not signalling", taskInstance.isSignalling());
+ }
+ }
+ finally
+ {
+ jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
+ jbpmContext.close();
+ }
+ }
+
+ public static class Buzz implements ActionHandler
+ {
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ExecutionContext executionContext) throws Exception
+ {
+ throw new RuntimeException("buzz");
+ }
+ }
+
+ private JbpmContext createJbpmContext()
+ {
+ return getJbpmConfiguration().createJbpmContext();
+ }
+
+ private ProcessInstance saveAndReload(ProcessInstance pi)
+ {
+ if (jbpmContext == null)
+ jbpmContext = createJbpmContext();
+
+ jbpmContext.save(pi);
+ newTransaction();
+ return graphSession.loadProcessInstance(pi.getId());
+ }
+
+ private void newTransaction()
+ {
+ if (jbpmContext != null)
+ jbpmContext.close();
+
+ jbpmContext = createJbpmContext();
+ graphSession = jbpmContext.getGraphSession();
+ }
+
+ private JbpmConfiguration getJbpmConfiguration()
+ {
+ if (jbpmConfiguration == null)
+ jbpmConfiguration = JbpmConfiguration.getInstance();
+
+ return jbpmConfiguration;
+ }
+}
Property changes on: jbpm3/branches/tdiesler/modules/integration/spec/src/test/java/org/jbpm/test/integration/spec/task/TaskTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
15 years, 5 months
JBoss JBPM SVN: r3189 - jbpm3/branches.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-12-04 02:26:45 -0500 (Thu, 04 Dec 2008)
New Revision: 3189
Added:
jbpm3/branches/tdiesler/
Log:
recreate userbranch
Copied: jbpm3/branches/tdiesler (from rev 3188, jbpm3/trunk)
15 years, 5 months
JBoss JBPM SVN: r3188 - jbpm3/branches.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-12-04 02:26:30 -0500 (Thu, 04 Dec 2008)
New Revision: 3188
Removed:
jbpm3/branches/tdiesler/
Log:
recreate userbranch
15 years, 5 months
JBoss JBPM SVN: r3187 - in projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api: service and 1 other directory.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-12-04 02:25:34 -0500 (Thu, 04 Dec 2008)
New Revision: 3187
Added:
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/deployment/SimpleDeployment.java
Modified:
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/TaskService.java
Log:
Add SimpleDeployment
Added: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/deployment/SimpleDeployment.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/deployment/SimpleDeployment.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/deployment/SimpleDeployment.java 2008-12-04 07:25:34 UTC (rev 3187)
@@ -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.jboss.bpm.api.deployment;
+
+//$Id$
+
+import java.io.IOException;
+
+import org.jboss.bpm.api.runtime.BasicAttachments;
+
+/**
+ * A simple deployment that takes a process definition XML
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 28-Nov-2008
+ */
+public class SimpleDeployment extends BasicAttachments implements Deployment
+{
+ private String procDefXML;
+
+ public SimpleDeployment(String procDefXML)
+ {
+ this.procDefXML = procDefXML;
+ }
+
+ /**
+ * Get the ProcessDefinition as XML string.
+ */
+ public String getProcessDefinitionXML() throws IOException
+ {
+ return procDefXML;
+ }
+}
\ No newline at end of file
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/deployment/SimpleDeployment.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/TaskService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/TaskService.java 2008-12-04 04:24:58 UTC (rev 3186)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/TaskService.java 2008-12-04 07:25:34 UTC (rev 3187)
@@ -37,7 +37,8 @@
*/
public interface TaskService
{
-
+ List<Task> getTasksByProcess(ObjectName procID);
+
Task getTask(ObjectName taskID);
List<Task> getTasksByActor(String actor);
15 years, 5 months
JBoss JBPM SVN: r3186 - in jbpm4/trunk/modules: task/src/main/java/org/jbpm/task/cmd and 2 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2008-12-03 23:24:58 -0500 (Wed, 03 Dec 2008)
New Revision: 3186
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/cmd/CreateTask.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskImpl.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskServiceImpl.java
jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/TaskTest.java
Log:
JBPM-1858: task service javadoc, task creation
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java 2008-12-03 20:28:52 UTC (rev 3185)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java 2008-12-04 04:24:58 UTC (rev 3186)
@@ -26,14 +26,32 @@
import org.jbpm.task.Role;
import org.jbpm.task.Task;
+/**
+ * Human task management facility.
+ * @author Alejandro Guizar
+ */
public interface TaskService {
+ /** Creates a task with the given identifier.
+ * The returned task will be transient.
+ * Use {@link #updateTask(Task)} to persist the task. */
Task newTask(String taskId);
+
+ /** Retrieves the task with the given identifier from persistent storage.
+ * If no task with the given identifier exists,
+ * the call returns <code>null</code>. */
Task getTask(String taskId);
+
+ /** Saves the given task to persistent storage. */
void updateTask(Task task);
+
+ /** Marks the task with the given identifier as completed.
+ * This operation may result in a process instance being resumed. */
void submitTask(String taskId);
+
+ /** Removes the task with the given identifier from persistent storage. */
void deleteTask(String taskId);
-
+
List<String> getCandidates(String taskId);
List<Role> getRoles(String taskId);
@@ -41,7 +59,7 @@
* then the current authenticated user. E.g. when a manager wants to
* look at a subordinate's task list. */
List<Task> getPersonalTaskList(String userId, int firstResult, int maxResults);
-
+
/** retrieves the group task of the given user.
* The user id will be resolved to a set of candidate identities
* by the identity spi. */
Modified: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/cmd/CreateTask.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/cmd/CreateTask.java 2008-12-03 20:28:52 UTC (rev 3185)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/cmd/CreateTask.java 2008-12-04 04:24:58 UTC (rev 3186)
@@ -36,18 +36,25 @@
public class CreateTask implements Command<Task> {
private static final long serialVersionUID = 1L;
-
+
+ protected String taskId;
protected Long taskDefinitionDbid;
protected Long executionDbid;
public CreateTask() {
}
- public CreateTask(long taskDefinitionDbid) {
+ public CreateTask(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public CreateTask(String taskId, long taskDefinitionDbid) {
+ this.taskId = taskId;
this.taskDefinitionDbid = taskDefinitionDbid;
}
- public CreateTask(long taskDefinitionDbid, long executionDbid) {
+ public CreateTask(String taskId, long taskDefinitionDbid, long executionDbid) {
+ this.taskId = taskId;
this.taskDefinitionDbid = taskDefinitionDbid;
this.executionDbid = executionDbid;
}
@@ -68,11 +75,11 @@
Task task = null;
if (taskDefinition==null) {
- task = TaskImpl.create();
+ task = TaskImpl.create(taskId);
} else if (execution==null) {
- task = TaskImpl.create(taskDefinition);
+ task = TaskImpl.create(taskId, taskDefinition);
} else {
- task = TaskImpl.create(taskDefinition, execution);
+ task = TaskImpl.create(taskId, taskDefinition, execution);
}
return task;
Modified: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskImpl.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskImpl.java 2008-12-03 20:28:52 UTC (rev 3185)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskImpl.java 2008-12-04 04:24:58 UTC (rev 3186)
@@ -96,15 +96,15 @@
// creating a task
- public static TaskImpl create() {
- return create(null, null);
+ public static TaskImpl create(String taskId) {
+ return create(taskId, null, null);
}
-
- public static TaskImpl create(TaskDefinitionImpl taskDefinition) {
- return create(taskDefinition, null);
+
+ public static TaskImpl create(String taskId, TaskDefinitionImpl taskDefinition) {
+ return create(taskId, taskDefinition, null);
}
- public static TaskImpl create(TaskDefinitionImpl taskDefinition, ExecutionImpl execution) {
+ public static TaskImpl create(String taskId, TaskDefinitionImpl taskDefinition, ExecutionImpl execution) {
TaskImpl task = null;
// if a task class name is configured
Environment environment = Environment.getCurrent();
@@ -122,6 +122,7 @@
task.create = Clock.getCurrentTime();
+ task.setId(taskId);
task.setTaskDefinition(taskDefinition);
task.setExecution(execution);
@@ -254,7 +255,7 @@
public Set<Task> getSubTasks() {
if (subTasks==null) {
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
return (Set) subTasks;
}
@@ -269,14 +270,14 @@
return subtask;
}
- public Task createSubTask(TaskDefinition subtaskDefinition) {
- if (subtaskDefinition==null) {
+ public Task createSubTask(String subTaskId, TaskDefinition subTaskDefinition) {
+ if (subTaskDefinition==null) {
throw new TaskException("subtaskDefinition is null");
}
if (subTasks==null) {
subTasks = new HashSet<TaskImpl>();
}
- TaskImpl subtask = create(taskDefinition);
+ TaskImpl subtask = create(subTaskId, taskDefinition);
addSubTask(subtask);
return subtask;
}
Modified: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskServiceImpl.java 2008-12-03 20:28:52 UTC (rev 3185)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskServiceImpl.java 2008-12-04 04:24:58 UTC (rev 3186)
@@ -28,11 +28,8 @@
import org.jbpm.task.Role;
import org.jbpm.task.Task;
import org.jbpm.task.cmd.CreateTask;
-import org.jbpm.task.cmd.DeleteTask;
-import org.jbpm.task.cmd.GetTask;
import org.jbpm.task.cmd.UpdateTask;
-
/**
* @author Tom Baeyens
*/
@@ -47,42 +44,10 @@
this.commandService = commandService;
}
- public Task createTask() {
- return (Task) commandService.execute(new CreateTask());
- }
-
- public Task createTask(long taskDefinitionDbid) {
- return (Task) commandService.execute(new CreateTask(taskDefinitionDbid));
- }
-
- public Task createTask(long taskDefinitionDbid, long executionDbid) {
- return (Task) commandService.execute(new CreateTask(taskDefinitionDbid, executionDbid));
- }
-
- public void deleteTask(long taskDbid) {
- commandService.execute(new DeleteTask(taskDbid));
- }
-
- public Task getTask(long taskDbid) {
- return (Task) commandService.execute(new GetTask(taskDbid));
- }
-
public void updateTask(Task task) {
commandService.execute(new UpdateTask(task));
}
- public List<Task> getGroupTaskListPage(List<String> identityIds, int firstResult, int maxResults) {
- throw new UnsupportedOperationException("TODO");
- }
-
- public List<Task> getPersonalTaskListPage(int firstResult, int maxResults) {
- throw new UnsupportedOperationException("TODO");
- }
-
- public List<Task> getPersonalTaskListPage(String userId, int firstResult, int maxResults) {
- throw new UnsupportedOperationException("TODO");
- }
-
public CommandService getCommandService() {
return commandService;
}
@@ -95,16 +60,6 @@
}
- public List<Task> getGroupTaskList(List<String> identityIds, int firstResult, int maxResults) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<Task> getPersonalTaskList(int firstResult, int maxResults) {
- // TODO Auto-generated method stub
- return null;
- }
-
public List<Task> getPersonalTaskList(String userId, int firstResult, int maxResults) {
// TODO Auto-generated method stub
return null;
@@ -116,8 +71,7 @@
}
public Task newTask(String taskId) {
- // TODO Auto-generated method stub
- return null;
+ return commandService.execute(new CreateTask(taskId));
}
public void submitTask(String taskId) {
Modified: jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/TaskTest.java
===================================================================
--- jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/TaskTest.java 2008-12-03 20:28:52 UTC (rev 3185)
+++ jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/TaskTest.java 2008-12-04 04:24:58 UTC (rev 3186)
@@ -23,19 +23,13 @@
import java.util.Date;
import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.jbpm.env.Environment;
-import org.jbpm.env.EnvironmentFactory;
-import org.jbpm.model.Comment;
import org.jbpm.pvm.internal.util.Clock;
import org.jbpm.pvm.internal.util.Priority;
import org.jbpm.task.impl.RoleImpl;
import org.jbpm.task.impl.SwimlaneImpl;
-import org.jbpm.task.impl.TaskDefinitionImpl;
import org.jbpm.task.impl.TaskImpl;
import org.jbpm.test.JbpmTestCase;
@@ -51,7 +45,7 @@
TaskImpl task;
try {
Clock.setCurrentTime(now);
- task = TaskImpl.create();
+ task = TaskImpl.create(getName());
} finally {
Clock.setCurrentTime(null);
}
@@ -68,13 +62,13 @@
}
public void testTaskAssignment() {
- TaskImpl task = TaskImpl.create();
+ TaskImpl task = TaskImpl.create(getName());
task.setAssignee("john doe");
assertEquals("john doe", task.getAssignee());
}
public void testTaskReassignmentAssignment() {
- TaskImpl task = TaskImpl.create();
+ TaskImpl task = TaskImpl.create(getName());
task.setAssignee("johndoe");
assertEquals("johndoe", task.getAssignee());
task.setAssignee("joesmoe");
@@ -82,7 +76,7 @@
}
public void testTaskRoles() {
- TaskImpl task = TaskImpl.create();
+ TaskImpl task = TaskImpl.create(getName());
assertNotNull(task.getRoles());
assertEquals(0, task.getRoles().size());
@@ -129,7 +123,7 @@
}
public void testTaskAllRoles() {
- TaskImpl task = TaskImpl.create();
+ TaskImpl task = TaskImpl.create(getName());
assertNotNull(task.getAllRoles());
assertEquals(0, task.getAllRoles().size());
15 years, 5 months
JBoss JBPM SVN: r3185 - in jbpm4/trunk/modules: db and 4 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-12-03 15:28:52 -0500 (Wed, 03 Dec 2008)
New Revision: 3185
Added:
jbpm4/trunk/modules/db/
jbpm4/trunk/modules/db/pom.xml
jbpm4/trunk/modules/db/src/
jbpm4/trunk/modules/db/src/main/
jbpm4/trunk/modules/db/src/main/ant/
jbpm4/trunk/modules/db/src/main/ant/build.schema.xml
jbpm4/trunk/modules/db/src/main/resources/
jbpm4/trunk/modules/db/src/main/resources/mysql.properties
jbpm4/trunk/modules/db/src/main/resources/sybase.properties
Log:
added db module
Added: jbpm4/trunk/modules/db/pom.xml
===================================================================
--- jbpm4/trunk/modules/db/pom.xml (rev 0)
+++ jbpm4/trunk/modules/db/pom.xml 2008-12-03 20:28:52 UTC (rev 3185)
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ====================================================================== -->
+<!-- -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- -->
+<!-- ====================================================================== -->
+
+<!-- $Id: pom.xml 3010 2008-11-20 08:30:16Z tom.baeyens(a)jboss.com $ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <name>jBPM 4 - DB</name>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-db</artifactId>
+ <packaging>jar</packaging>
+
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <!-- Dependencies -->
+ <dependencies>
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-api</artifactId>
+ <version>${version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-test-base</artifactId>
+ <version>${version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-jpdl</artifactId>
+ <version>${version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-pvm</artifactId>
+ <version>${version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>net.sourceforge.jtds</groupId>
+ <artifactId>jtds</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+ <!-- Plugins -->
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-db-scripts</id>
+ <phase>package</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
+ <ant antfile="src/main/scripts/build.schema.xml" target="create-schema" />
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
Added: jbpm4/trunk/modules/db/src/main/ant/build.schema.xml
===================================================================
--- jbpm4/trunk/modules/db/src/main/ant/build.schema.xml (rev 0)
+++ jbpm4/trunk/modules/db/src/main/ant/build.schema.xml 2008-12-03 20:28:52 UTC (rev 3185)
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ============================================================ -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- ============================================================ -->
+
+<!-- $Id: antrun-jbpmschema.xml 2999 2008-11-19 16:16:01Z thomas.diesler(a)jboss.com $ -->
+
+<project>
+
+ <!-- ================================================================== -->
+ <!-- jBPM Database schema -->
+ <!-- ================================================================== -->
+
+ <target name="setup-schema">
+
+ <!-- echo message="${maven.runtime.classpath}"/ -->
+
+ <taskdef name="jbpmschema" classname="org.jbpm.ant.JbpmSchemaTask">
+ <classpath path="${maven.runtime.classpath}"/>
+ </taskdef>
+
+ <property name="scriptsdir" value="${basedir}/target/classes"/>
+ <mkdir dir="${scriptsdir}"/>
+
+ </target>
+
+ <target name="create-schema" depends="setup-schema" description="Generate jBPM Database Schemas">
+
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.db2.sql" config="hibernate.cfg.db2.xml" action="create"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.derby.sql" config="hibernate.cfg.derby.xml" action="create"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.firebird.sql" config="hibernate.cfg.firebird.xml" action="create"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.hsqldb.sql" config="hibernate.cfg.hsqldb.xml" action="create"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.ingres.sql" config="hibernate.cfg.ingres.xml" action="create"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.interbase.sql" config="hibernate.cfg.interbase.xml" action="create"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.mckoi.sql" config="hibernate.cfg.mckoi.xml" action="create"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.mssql.sql" config="hibernate.cfg.mssql.xml" action="create"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.mysql.sql" config="hibernate.cfg.mysql.xml" action="create" delimiter=";"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.oracle.sql" config="hibernate.cfg.oracle.xml" action="create" delimiter=";"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.postgresql.sql" config="hibernate.cfg.postgresql.xml" action="create"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.sapdb.sql" config="hibernate.cfg.sapdb.xml" action="create"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.sybase.sql" config="hibernate.cfg.sybase.xml" action="create"/>
+
+ <!--[JBPM-1813] Fix create schema generation -->
+ <!--jbpmschema output="${scriptsdir}/jbpm.jpdl.informix.sql" config="hibernate.cfg.informix.xml" action="create"/-->
+ <!--jbpmschema output="${scriptsdir}/jbpm.jpdl.pointbase.sql" config="hibernate.cfg.pointbase.xml" action="create"/-->
+ <!--jbpmschema output="${scriptsdir}/jbpm.jpdl.progress.sql" config="hibernate.cfg.progress.xml" action="create"/-->
+
+ </target>
+
+ <target name="update-schema" depends="setup-schema" description="Generate jBPM Database Update Scripts">
+
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.mysql.update322.sql" config="hibernate.cfg.mysql.xml" properties="mysql.properties" action="update" delimiter=";"/>
+ <jbpmschema output="${scriptsdir}/jbpm.jpdl.sybase.update322.sql" config="hibernate.cfg.sybase.xml" properties="sybase.properties" action="update" delimiter=";"/>
+
+ </target>
+
+</project>
Added: jbpm4/trunk/modules/db/src/main/resources/mysql.properties
===================================================================
--- jbpm4/trunk/modules/db/src/main/resources/mysql.properties (rev 0)
+++ jbpm4/trunk/modules/db/src/main/resources/mysql.properties 2008-12-03 20:28:52 UTC (rev 3185)
@@ -0,0 +1,8 @@
+hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
+#
+# This uses the jbpm322 database schema as reference for the SchemaUpdate task
+#
+hibernate.connection.driver_class=com.mysql.jdbc.Driver
+hibernate.connection.url=jdbc:mysql://${jdbc.mysql.server}:${jdbc.mysql.port}/jbpm322
+hibernate.connection.username=${jdbc.mysql.username}
+hibernate.connection.password=${jdbc.mysql.password}
Added: jbpm4/trunk/modules/db/src/main/resources/sybase.properties
===================================================================
--- jbpm4/trunk/modules/db/src/main/resources/sybase.properties (rev 0)
+++ jbpm4/trunk/modules/db/src/main/resources/sybase.properties 2008-12-03 20:28:52 UTC (rev 3185)
@@ -0,0 +1,8 @@
+hibernate.dialect=org.hibernate.dialect.SybaseDialect
+#
+# This uses the jbpm322 database schema as reference for the SchemaUpdate task
+#
+hibernate.connection.driver_class=net.sourceforge.jtds.jdbc.Driver
+hibernate.connection.url=jdbc:jtds:sybase://${jdbc.sybase.server}:${jdbc.sybase.port}/jbpm322
+hibernate.connection.username=${jdbc.sybase.username}
+hibernate.connection.password=${jdbc.sybase.password}
15 years, 5 months