cancel
Showing results for 
Search instead for 
Did you mean: 

Own validator without own export marshaller

christianelmer
Champ in-the-making
Champ in-the-making
Hello,

can I write my own validating diagram class without using my own export marshaller? Because I want define rules for the diagrams, but I want use the standard BPMN export marshaller to export the diagrams.

Now my own validator extension only works if I write also an export marshaller with this code:


final boolean validDiagram = invokeValidator(IntellixProcessValidator.VALIDATOR_ID, diagram, monitor);
if (!validDiagram) {
        addProblemToDiagram(diagram, "Marshalling to " + getFormatName()
                + " format was skipped because validation of the diagram failed.", null);
} else {
        InputStream stream = getInputStreamForDiagram(diagram);
        saveResource(getRelativeURIForDiagram(diagram, FILENAME_PATTERN), stream, monitor);
}

The validateDiagram method of the validator has this code:


public boolean validateDiagram(Diagram diagram, IProgressMonitor monitor) {
        boolean valid = false;

        clearMarkers(getResource(diagram.eResource().getURI()));
       
        monitor.beginTask("Activiti Intellix Validation", 1);

        // Check correctness of the diagram

        return valid;
    }

Best regards,
Christian
22 REPLIES 22

tiesebarrell
Champ in-the-making
Champ in-the-making
Christian,

at the moment, you cannot. This is subject to implementation of http://jira.codehaus.org/browse/ACT-523, which to be honest, has not been high on my priority list. I've assigned the issue to myself and will look into it soon.

christianelmer
Champ in-the-making
Champ in-the-making
Ok, then I have to write my own export marshaller. But can I use the standard BPMN export class in my own export mashaller, that I have the same BPMN XML output?

Thanks,
Christian

tiesebarrell
Champ in-the-making
Champ in-the-making
Well, you could subclass org.activiti.designer.export.bpmn20.export.BPMN20ExportMarshaller I suppose, although that would not really help because you can't get directly to the validator it invokes. I could make that overridable by providing a default implementation of a new method, getValidatorId(), which would return the default validator's id in the org.activiti.designer.export.bpmn20.export.BPMN20ExportMarshaller class, but which you could override in a subclass. Would that help?

tiesebarrell
Champ in-the-making
Champ in-the-making
On second thoughts, you might run into the issue that you need to be dependent on the org.activiti.designer.export.bpmn20 to actually be able to subclass the default marshaller. If you could confirm this would work for you, I can see whether I can include the overridable method in the next release of designer.

christianelmer
Champ in-the-making
Champ in-the-making
That would be help, but I can't import the package org.activiti.designer.export.bpmn20.export in the plug-in dependencies. Well, I can add org.activiti.designer.export.bpmn20 to required plug-ins, but it doesn't export the package org.activiti.designer.export.bpmn20.export. Can you also add the export to this or another plug-in?

Thanks,
Christian

tiesebarrell
Champ in-the-making
Champ in-the-making
That's right. I'll do that as well. I've created an issue here http://jira.codehaus.org/browse/ACT-894. Not sure when the next release will be, but I expect to put it in SVN in the next couple of days if you want to run from source.

Since I have your attention Christian, could you take a look at this thread as well? I've placed some questions there for you. http://forums.activiti.org/en/viewtopic.php?f=8&t=2026 . Thanks

tiesebarrell
Champ in-the-making
Champ in-the-making
Christian,

I've committed the changes we discussed. There will be a 5.7.1 release sometime soon which will include this enhancement. If you can't wait for that, you can check out the trunk version to get to it now. Let me know how it works out for you.

christianelmer
Champ in-the-making
Champ in-the-making
Hello Tiese,

I can't use the new version 5.7.1. I have used these instructions: http://docs.codehaus.org/display/ACT/Activiti+Designer+Developer+Guide with the actual trunk from http://svn.codehaus.org/activiti/projects/designer (Revision 2952). But if I want create a new diagram, the editor field is empty and I see a NoSuchMethodError exception:


!ENTRY org.eclipse.ui 4 0 2011-08-09 14:38:10.569
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NoSuchMethodError: org.eclipse.graphiti.services.Graphiti.getMigrationService()Lorg/eclipse/graphiti/services/IMigrationService;
at org.activiti.designer.eclipse.editor.ActivitiDiagramEditor.setInput(ActivitiDiagramEditor.java:118)
at org.eclipse.gef.ui.parts.GraphicalEditor.init(GraphicalEditor.java:346)
at org.eclipse.graphiti.ui.internal.editor.DiagramEditorInternal.init(DiagramEditorInternal.java:1074)
at org.activiti.designer.eclipse.editor.ActivitiDiagramEditor.init(ActivitiDiagramEditor.java:51)
at org.eclipse.ui.internal.EditorManager.createSite(EditorManager.java:798)
at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:647)
at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:465)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:313)
at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)
at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1254)
at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1207)
at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1606)
at org.eclipse.ui.internal.PartStack.add(PartStack.java:497)
at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103)
at org.eclipse.ui.internal.PartStack.add(PartStack.java:483)
at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112)
at org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:63)
at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:225)
at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:213)
at org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:778)
at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:677)
at org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:638)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2860)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2768)
at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2760)
at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2711)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2707)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2691)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2674)
at org.activiti.designer.eclipse.ui.wizard.diagram.CreateDefaultActivitiDiagramWizard.performFinish(CreateDefaultActivitiDiagramWizard.java:225)
at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:811)
at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:430)
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
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:3540)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3161)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
at org.eclipse.jface.window.Window.open(Window.java:801)
at org.eclipse.ui.internal.handlers.WizardHandler$New.executeHandler(WizardHandler.java:254)
at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:274)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:157)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
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:3540)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3161)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
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:369)
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:620)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
at org.eclipse.equinox.launcher.Main.main(Main.java:1384)

Maybe something is wrong with the Graphiti version? In the pom.xml at the package org.activiti.designer.parent I see this repository entry:


<repository>
<id>Graphiti</id>
<layout>p2</layout>
<url>http://download.eclipse.org/graphiti/updates/0.8.0/</url>
</repository>

But Graphiti version 0.7.1 is installed at the started up eclipse platform…

Greetings,
Christian

trademak
Star Contributor
Star Contributor
Hi Christian,

You have to install Graphiti version 0.8.0. I'll change the docs rightaway.

Thanks,