Note: This page is currently under construction.

The Workbench

Getting Started

This tutorial shows you how to create your own light-weight process Workbench ideally suited for prototyping algorithms on process (and other) models. We assume that your are familiar with the Hello World tutorial.

A simple Workbench

Let's create a Java application that can host several ProcessEditor JPanels, provides a menu, icons, etc.:

import com.inubit.research.gui.Workbench;

public class workbench1 {

    public static void main(String args[]) {
        // Create a new Workbench
        Workbench wb = new Workbench();
        // And show the JFrame
        wb.setVisible(true);
    }
}

The lines of code required are even fewer than for Hello World, since the Workbench class is already a Java Application with a JFrame. The running program should look like this but just with an empty model. You can find the BPMN 2.0 Choreography auction model here.

Workbench 1 with a BPMN choreography model

The Preferences

The ProcessEditor as well as the corresponding Workbench use a preferences file for persisting properties. You can find a UI in the workbench at (tbd).

Change the Properties in the UI

Set the Properties via the API

Plugins: Implementing your own Algorithms

The workbench provides a number of Plugins, which can be easily extended. You can find the Plugins under the corresponding menu item. Just try them out with a few sample files (tbd).

Creating your own Plugin

A standard use-case of the Process Editor framework is writing a plugin for a certain model type. As you've seen above, a plugin can implement arbitrary algorithms on models, so it is suitable for prototyping an algorithm of a thesis. If you need your own model first, please check the corresponding tutorial. We will showcase a simple plugin that checks whether a given Petri net is a Workflow net.

To register a new plugin at the Workbench, just call the following method, in our case at the end of the main method (source workbench2.java):

		// Add custom Workflow net plugin
        wb.addPlugin(new workbench2plugin(wb));

The source code for the class workbench2plugin (source workbench2plugin.java):

public class workbench2plugin extends WorkbenchPlugin {
	import [...] // Your IDE will figure this out

    // Create a private variable for holding the Workbench instance
    private Workbench workbench;

    // Create new constructor to fetch workbench
    public workbench2plugin(Workbench workbench) {
        super(workbench);
        this.workbench=workbench;
    }

    @Override
    public Component getMenuEntry() {
        JMenuItem workflowNetsChecker = new JMenuItem("Check if Workflow net");
        // Add action
        workflowNetsChecker.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                // Get the current ProcessModel and check if it is of type PetriNet
                if (!(workbench.getSelectedModel() instanceof PetriNetModel)) {
                    JOptionPane.showMessageDialog(null, "The selected model is not a Petri net!");
                }

                // Get Petri net
                PetriNetModel model = (PetriNetModel)workbench.getSelectedModel();

                // A Petri Net is a Workflow net if it has exactly one start node...
                java.util.List startPlaces = new LinkedList();

                // Iterate over all nodes to count start nodes
                for (ProcessNode node: model.getNodes()) {
                    if (node instanceof Place && model.getIncomingEdges(Edge.class, node).size()==0)
                        startPlaces.add(node);
                }

                // I guess you've got the idea and can implement the remaining checks yourself
                JOptionPane.showMessageDialog(null, "Found "+startPlaces.size()+" Start Places!");
            }
        });
        return workflowNetsChecker;
    }
}

Fitting Model Types and Plugins: Making it your Application

If you would like to use the workbench as a foundation for your own application, you can restrict the model types and plugins to the ones you need. The following handy lines of code allow you to create a stand-alone prototype that focuses on your plugin/algorithm:

		[...]

        // Set the title
        wb.setWorkbenchTitle("My Workbench");

        // Set the version
        wb.setWorkbenchVersion("1.0");

		[...]

A more advanced implementation might sub-class the workbench (tbd).