Olaf Sebelin
2013-03-14 15:13:01 UTC
Olaf Sebelin [https://community.jboss.org/people/osebelin] created the discussion
"BooleanDataType in work item definition causes ClassCastException in the BPMN2 process editor"
To view the discussion, visit: https://community.jboss.org/message/802702#802702
--------------------------------------------------------------
Hi,
I defined a work item definition that has a boolean parameter. Entering a value for that boolean parameter in the BPMN2 process editor plugin in Eclipse, causes a ClassCastException when selecting the work item for display in the Properties tab.
This happens when I close the editor and reopen it. afterwards the selection of work items doesn't work properly.
Stacktrace:
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
   at org.drools.process.core.datatype.impl.type.BooleanDataType.writeValue(BooleanDataType.java:52)
   at org.drools.eclipse.flow.ruleflow.core.WorkItemWrapper.getPropertyValue(WorkItemWrapper.java:145)
   at org.eclipse.ui.views.properties.PropertySheetEntry.refreshValues(PropertySheetEntry.java:611)
   at org.eclipse.ui.views.properties.PropertySheetEntry.refreshChildEntries(PropertySheetEntry.java:568)
   at org.eclipse.ui.views.properties.PropertySheetEntry.setValues(PropertySheetEntry.java:760)
   at org.eclipse.ui.views.properties.PropertySheetViewer.setInput(PropertySheetViewer.java:973)
   at org.eclipse.ui.views.properties.PropertySheetPage.selectionChanged(PropertySheetPage.java:510)
   at org.eclipse.ui.views.properties.PropertySheet.selectionChanged(PropertySheet.java:363)
   at org.eclipse.ui.internal.AbstractSelectionService.firePostSelection(AbstractSelectionService.java:179)
   at org.eclipse.ui.internal.AbstractSelectionService$2.selectionChanged(AbstractSelectionService.java:71)
   at org.eclipse.gef.ui.parts.AbstractEditPartViewer.fireSelectionChanged(AbstractEditPartViewer.java:247)
   at org.eclipse.gef.ui.parts.AbstractEditPartViewer$1.run(AbstractEditPartViewer.java:131)
   at org.eclipse.gef.SelectionManager.fireSelectionChanged(SelectionManager.java:144)
   at org.eclipse.gef.SelectionManager.appendSelection(SelectionManager.java:83)
   at org.eclipse.gef.ui.parts.AbstractEditPartViewer.appendSelection(AbstractEditPartViewer.java:190)
   at org.eclipse.gef.ui.parts.AbstractEditPartViewer.select(AbstractEditPartViewer.java:599)
   at org.eclipse.gef.tools.SelectEditPartTracker.performSelection(SelectEditPartTracker.java:221)
   at org.eclipse.gef.tools.SelectEditPartTracker.performConditionalSelection(SelectEditPartTracker.java:167)
   at org.eclipse.gef.tools.SelectEditPartTracker.handleButtonDown(SelectEditPartTracker.java:92)
   at org.eclipse.gef.tools.AbstractTool.mouseDown(AbstractTool.java:1091)
   at org.eclipse.gef.tools.SelectionTool.mouseDown(SelectionTool.java:514)
   at org.eclipse.gef.EditDomain.mouseDown(EditDomain.java:245)
   at org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMousePressed(DomainEventDispatcher.java:348)
   at org.eclipse.draw2d.LightweightSystem$EventHandler.mouseDown(LightweightSystem.java:523)
   at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:191)
   at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
   at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3588)
   at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3209)
   at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
   at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
   at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
   at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
   at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
   at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
   at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
   at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
   at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
   at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
   at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
   at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
   at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
The exception can be reproduced with the following simple example work item definition.
import org.drools.process.core.datatype.impl.type.BooleanDataType;
import org.drools.process.core.datatype.impl.type.StringDataType;
import org.drools.process.core.datatype.impl.type.ObjectDataType;
[
 [
   "name" : "MyTask",
   "displayName" : "My Task",
   "parameters" : [
     "MyStringParam" : new StringDataType(),
     "MyBoolParam" : new BooleanDataType()
   ],
   "results" : [
     "Result" : new ObjectDataType("java.util.Map")
   ],
   "displayName" : "My Task",
 ]
]
The editor field for the "MyBoolParam" is a text field. What do I have to do ta make this a boolean editor field (e.g. a drop down box like the Terminate parameter in the End Event)?
BTW, This occurs with IntegerDataTypes, too.
Thank you for your help
Olaf
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/802702#802702]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
"BooleanDataType in work item definition causes ClassCastException in the BPMN2 process editor"
To view the discussion, visit: https://community.jboss.org/message/802702#802702
--------------------------------------------------------------
Hi,
I defined a work item definition that has a boolean parameter. Entering a value for that boolean parameter in the BPMN2 process editor plugin in Eclipse, causes a ClassCastException when selecting the work item for display in the Properties tab.
This happens when I close the editor and reopen it. afterwards the selection of work items doesn't work properly.
Stacktrace:
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
   at org.drools.process.core.datatype.impl.type.BooleanDataType.writeValue(BooleanDataType.java:52)
   at org.drools.eclipse.flow.ruleflow.core.WorkItemWrapper.getPropertyValue(WorkItemWrapper.java:145)
   at org.eclipse.ui.views.properties.PropertySheetEntry.refreshValues(PropertySheetEntry.java:611)
   at org.eclipse.ui.views.properties.PropertySheetEntry.refreshChildEntries(PropertySheetEntry.java:568)
   at org.eclipse.ui.views.properties.PropertySheetEntry.setValues(PropertySheetEntry.java:760)
   at org.eclipse.ui.views.properties.PropertySheetViewer.setInput(PropertySheetViewer.java:973)
   at org.eclipse.ui.views.properties.PropertySheetPage.selectionChanged(PropertySheetPage.java:510)
   at org.eclipse.ui.views.properties.PropertySheet.selectionChanged(PropertySheet.java:363)
   at org.eclipse.ui.internal.AbstractSelectionService.firePostSelection(AbstractSelectionService.java:179)
   at org.eclipse.ui.internal.AbstractSelectionService$2.selectionChanged(AbstractSelectionService.java:71)
   at org.eclipse.gef.ui.parts.AbstractEditPartViewer.fireSelectionChanged(AbstractEditPartViewer.java:247)
   at org.eclipse.gef.ui.parts.AbstractEditPartViewer$1.run(AbstractEditPartViewer.java:131)
   at org.eclipse.gef.SelectionManager.fireSelectionChanged(SelectionManager.java:144)
   at org.eclipse.gef.SelectionManager.appendSelection(SelectionManager.java:83)
   at org.eclipse.gef.ui.parts.AbstractEditPartViewer.appendSelection(AbstractEditPartViewer.java:190)
   at org.eclipse.gef.ui.parts.AbstractEditPartViewer.select(AbstractEditPartViewer.java:599)
   at org.eclipse.gef.tools.SelectEditPartTracker.performSelection(SelectEditPartTracker.java:221)
   at org.eclipse.gef.tools.SelectEditPartTracker.performConditionalSelection(SelectEditPartTracker.java:167)
   at org.eclipse.gef.tools.SelectEditPartTracker.handleButtonDown(SelectEditPartTracker.java:92)
   at org.eclipse.gef.tools.AbstractTool.mouseDown(AbstractTool.java:1091)
   at org.eclipse.gef.tools.SelectionTool.mouseDown(SelectionTool.java:514)
   at org.eclipse.gef.EditDomain.mouseDown(EditDomain.java:245)
   at org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMousePressed(DomainEventDispatcher.java:348)
   at org.eclipse.draw2d.LightweightSystem$EventHandler.mouseDown(LightweightSystem.java:523)
   at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:191)
   at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
   at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3588)
   at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3209)
   at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
   at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
   at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
   at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
   at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
   at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
   at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
   at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
   at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
   at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
   at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
   at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
   at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
The exception can be reproduced with the following simple example work item definition.
import org.drools.process.core.datatype.impl.type.BooleanDataType;
import org.drools.process.core.datatype.impl.type.StringDataType;
import org.drools.process.core.datatype.impl.type.ObjectDataType;
[
 [
   "name" : "MyTask",
   "displayName" : "My Task",
   "parameters" : [
     "MyStringParam" : new StringDataType(),
     "MyBoolParam" : new BooleanDataType()
   ],
   "results" : [
     "Result" : new ObjectDataType("java.util.Map")
   ],
   "displayName" : "My Task",
 ]
]
The editor field for the "MyBoolParam" is a text field. What do I have to do ta make this a boolean editor field (e.g. a drop down box like the Terminate parameter in the End Event)?
BTW, This occurs with IntegerDataTypes, too.
Thank you for your help
Olaf
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/802702#802702]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]