1. What You Will Learn

After finishing this tutorial you will be able to write your own commands up to command groups, build them and integrate them into the PAK editor.

2. Prerequisites

To complete this guide you need:

  • Roughly 15 minutes (if you want to skip the guide click on the solution)

  • JDK 11+ installed with JAVA_HOME configured appropriately

  • An IDE

  • The PAK-Editor ( Download )

  • Gradle 7.4.2+

3. What is a Command?

A concrete implementation of a task. Commands are elements that are later displayed in the Construction Kit as part of the Palette in the editor.

4. Implementation

For the demonstration of the single steps in this tutorial the IDE IntelliJ is used.

First open your selected IDE and create a new Gradle project with the following configuration:

By adding a sample code you will automatically get the desired folder structure
ProjectConfiguration
Figure 1. Gradle-Project Configuration

Then replace the build.gradle file with the following code fragment:

Unresolved directive in PAK_Command_Build_Run_Guide.adoc – include::../../../../../src/PAKDeveloping/DevelopingThePAKConstructionKit/PAKCommandDeveloperGuide/Commands/JavaCommand/Code/buildAndRunGuideBuildGradle.adoc[]

You can verify the successful loading of build.gradle using the Gradle toolbar on the right side. This should look like this:

GradleToolbar
Figure 2. Gradle-Toolbar

Now we come to the coding of the HelloWorld command. For that you just have to replace the main class with the following class:

Unresolved directive in PAK_Command_Build_Run_Guide.adoc – include::../../../../../src/PAKDeveloping/DevelopingThePAKConstructionKit/PAKCommandDeveloperGuide/Commands/JavaCommand/Code/buildAndRunGuideHelloWorld.adoc[]

Explanations about the individual annotations that can be used for command development can be found in the comments and in the PAK Command Developer Guide

That’s all, our first command is implemented!

In order to use our new developed command we need to create jar out of it and publish it. (In our example we publish it to maven local)

4.1. Publishing the Command Jar-File

Run following cmd command in the root folder of your project

with gradle run gradlew publishToMavenLocal

5. Build a Bpmn Workflow

In order to use our new command in our workflow we need to setup the Commands Repositories for the PAK Editor app.

5.1. Setting Up the Commands

To do so open the menu PreferencesCommands

PAKEditorPreferences
Figure 3. preferences commands (PAK-Editor)

Select the Folder Button

BpmnEditorSelectFolder

Select the .m2 folder of your users home and press the Add Button

BpmnEditorSelectM2

Save the changes with the Save Changes Button

BpmnEditorSaveRepos
You can select any folder or directly the created jar-File. We are choosing this option just because we did so above.

After adding the jar file you should be able to refresh the commands at the bottom left and see the following:

PAKEditorCommands
Figure 4. HelloWorld-Command

5.2. Build the Workflow

Add the command and an End Node to the workflow

Workflow

After saving the workflow as “Hello_World.bpmn” we are basically ready to run this workflow. For this see the Next Steps.

6. Next Steps

This guide covered the building and using a command in the PAK-editor. Now we are ready to run this workflow in our Application