Suche
Table of Contents

Java command annotations are used for the developing Java commands in PAK.
This chapter describes the functionality of the @CommandGroup annotation.
It also gives an example of how you can use this annotation in your implementation.

1. Basics

The @CommandGroup annotation allows clustering multiple commands into one group.
It has no influence on the functionality of the commands themselves as it is just used for showing commands inside a treeview.
So the command group represents a unique path where the command can be found.

The specified group should be a human-readable name as it will be displayed in the PAK BPMN Editor and Workflow Executor.
This annotation does only makes sense in combination with the @JavaCommand annotation.

2. Properties

There is a String property value defined for the @CommandGroup annotation, which has to be assigned to a short and concise human-readable group name the command will be placed at.

3. Usage

@CommandGroup has to annotate a class that should represent a command and defines the group it will be placed in the PAK Tools.
Listing 1 shows an example on how to use it.

Listing 1. Define a group for the command
/**
 * @workflowDocu This command gets an element by its id.
 */
@JavaCommand
@CommandGroup("Element") (1)
public class GetElement {

	[..]

}
1 Use of the @CommandGroup annotation

The PAK BPMN Editor and Workflow Executor display the „Get Element“ command like shown in Figure 1.

GetElement Menue
Figure 1. Command Group „Element“
To get nested groups separate the different group names by a dot.
For example, @CommandGroup("Group1.Group2.Group3") will be converted in the PAK BPMN Editor and Workflow Executor as shown in Figure 2.
GetElement Nested Menue
Figure 2. Nested Command Groups

As a group can be used for several commands it is useful to introduce a constant for each command group in order to avoid inconsistencies.
In Listing 2 the constant ELEMENT = "Element" is introduced in the helper class CommandGroup.

Listing 2. Use a constant as command group
/**
 * @workflowDocu This command gets an element by its issue id.
 */
@JavaCommand
@CommandGroup(CommandGroup.ELEMENT) (1)
public class GetElement {

	[..]

}

/**
* Helper class that stores all existing command groups.
*/
public final class CommandGroup {
	public static final String ELEMENT = "Element"; (2)
}
1 Use of the @CommandGroup annotation with constant
2 Definition of a group constant