Suche

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

1. Basics

The @AllowedValues annotation restricts the values that can be set to a command variable.
It only works together with the @Persistent annotation and is only applicable to variables of type String and enum.
This annotation is evaluated at runtime and raises an exception at the latest.

This annotation does only works in combination with the @Persistent annotation.

2. Properties

There are three properties defined for the @AllowedValues annotation: values, exclude and isSuggestion.
As there are some differences between the behaviour of the properties per type (String and enum) which will be defined in the following.

2.1. String Field

The values property for String variables define those values that are allowed to be set.
The list must not be empty as this would defeat the purpose of the property.
The usage for String variables is shown in Listing 1.

Please pay attention to upper and lower case of the values.
The property exclude is not allowed for variables with the type String.
Compilation errors will be thrown in case you use this property for a String variable.

Additionally, it’s possible to use the boolean field isSuggestion, which is set to false by default.
It gives the user the opportunity to allow suggestions. If set to true the @AllowedValues annotation is less restrictive and allows more values apart from the entries
in the values array.

Please consider, that this variable can only be set to true if values contains string variables, it’s not applicable for enums.

2.2. Enum Variable

On the one hand, the values properties for enum variables define the values that are allowed.
On the other hand, you can define enum values that should be excluded from the allowed values list.
The different use cases are described in the following.

For the values property of variable with type enum you have to enter the enum value name.
Thus, pay attention to upper and lower case of the enum value names.

By default, the values property is empty and the exclude variable is false.
This means that all enum values are allowed for the variable that is annotated with @AllowedValues.

2.2.1. Allow all enum values

If the default configuration is used, i.e. @AllowedValues, all enum values will be allowed, see Listing 2.

2.2.2. Allow only specific enum values

In case you want to allow only some available enum values you can define these in the values property.
To do this you must add the names of all enum values that should be allowed to the list of values.

For example, @AllowedValues(values = { "ENUM_TO_ALLOW" }) only allows ENUM_TO_ALLOW for the annotated variable.
Another concrete example can be seen in , see Listing 2.

2.2.3. Exclude values

To exclude values from the allowed values list, you must assign exclude = true and list all enum values to be excluded in the values property.

For example, @AllowedValues(values = { "EXCLUDE_ENUM" }, exclude = true) allows all enum values except the EXCLUDE_ENUM values to be set for the annotated variable.
Another concrete example can be seen in , see Listing 2.

3. Usage

In the following examples are given on how to use the @AllowedValues annotation for String and enum variables.

3.1. String Variable

Listing 1 shows how to use the @AllowedValues annotation for a String variable.

Listing 1. Use cases for allowed values for a variable of type String
/**
 * @workflowDocu This command gets an element by its id.
 */
@JavaCommand
@CommandGroup("Element")
public class GetElement {

	[...]

	/**
	 * @workflowDocu Type of the element with restricted allowed values
	 */
	@AllowedValues(values = { "issue", "bug" }) (1)
	@Persistent
	private String type;

	[...]
}
1 Allowed values: issue and bug

The single command executor in the Workflow Executor offers the allowed values in a drop-down menu, see Figure 1.
Additionally, further information is given in the user documentation, see Figure 2. If isSuggestion was set to true
in the Listing above, the user could enter any string he/ she desires. Therefore, „issue“ and „bug“ would only be regarded as suggestions.

AllowedValues String dropdown
Figure 1. Dropdown with allowed values
AllowedValues String
Figure 2. User documentation

3.2. Enum Variable

Listing 2 shows the different available use cases for the @AllowedValues annotation and an enum variable.

Listing 2. Use cases for allowed values for a variable of type enum
/**
 * Types available for an element.
*/
public enum ElementType {
	STORY, SUB_TASK, TASK, BUG
}

/**
 * @workflowDocu This command gets an element by its id.
 */
@JavaCommand
@CommandGroup("Element")
public class GetElement {

	/**
	 * @workflowDocu Example where any enum value is allowed
	 */
	@AllowedValues (1)
	@Persistent
	private ElementType everyType;

	/**
	 * @workflowDocu Example where some values are allowed
	 */
	@AllowedValues(values = { "STORY", "TASK" }) (2)
	@Persistent
	private ElementType someType;

	/**
	 * @workflowDocu Example where enum values are excluded
	 */
	@AllowedValues(values = { "BUG" }, exclude = true) (3)
	@Persistent
	private ElementType excludeType;

	[...]
}
1 Allowed values: STORY, SUB_TASK, TASK, BUG
2 Allowed values: STORY, TASK
3 Allowed values: STORY, SUB_TASK, TASK

Analogous to String variables, the single command executor in the Workflow Executor offers the allowed values in a drop-down menu for enum values as well, see Figure 3.
Additionally, further information is given in the user documentation, see Figure 4.

AllowedValues Enum dropdown
Figure 3. Dropdown with allowed values
AllowedValues Enum
Figure 4. User documentation

Sonatype Nexus

PAK features connectors and commands for Sonatype Nexus. This means the software can directly interact with Nexus repositories for storing and managing artifacts. Through these connectors, PAK can automate tasks like uploading binaries or retrieving dependencies, ensuring efficient artifact management within Nexus.

Jenkins

PAK has connectors and commands for Jenkins. This allows the software to directly communicate with Jenkins servers, enabling the automation of CI/CD (Continuous Integration/Continuous Deployment) tasks. Through these connectors, PAK can trigger builds, fetch build statuses, or manage job configurations, streamlining the CI/CD processes within Jenkins.

Git Hub

PAK possesses connectors and commands for GitHub. This means the software can interface directly with GitHub repositories, facilitating actions like code pushes, pull requests, or issue tracking. Through these connectors, PAK can automate various GitHub operations, enhancing code collaboration and repository management.

Atlassian Confluence

PAK is equipped with connectors and commands for Atlassian Confluence. This enables the software to directly interact with Confluence spaces and pages. Through these connectors, PAK can automate actions such as creating, updating, or retrieving documentation, ensuring efficient content management and collaboration within Confluence.

Codebeamer

PAK features connectors and commands for Codebeamer. This allows the software to seamlessly integrate with Codebeamer’s ALM (Application Lifecycle Management) platform. Through these connectors, PAK can automate tasks like issue tracking, test management, or requirements tracing, enhancing the coordination and management of software development processes.

JFrog Artifactory

PAK has connectors and commands for JFrog Artifactory. This means the software can directly interface with Artifactory repositories, enabling actions like artifact storage, retrieval, and management. Through these connectors, PAK can automate tasks such as deploying artifacts or managing repository configurations, streamlining the integration and management of binary artifacts within Artifactory.

Amazon Web Services (AWS)

PAK has connectors and commands for Amazon Web Services (AWS). This means the software possesses specialized interfaces to directly interact with AWS services and execute actions on the AWS platform. Through these connectors, PAK can automate AWS-specific commands, such as launching EC2 instances, managing S3 buckets, or configuring Lambda functions. This allows for efficient integration, management, and automation of AWS resources and services directly from PAK.

Atlassian Jira

PAK features integration tools and capabilities for Atlassian Jira. These tools allow for a direct connection to Jira and the execution of specific actions. Using these integration tools, PAK can automate Jira actions such as adding comments or changing ticket priorities, ensuring seamless handling and coordination of Jira processes.

Git

PAK has connectors and commands for Git. This means it has interfaces to directly communicate with Git and execute actions. Through these connectors, the software can automate Git commands such as retrieving changes or creating branches, enabling efficient integration and management of Git tasks.

Generic Human Tasks

PAK offers you a standard set of commands which require creative input from the user. Enables you to start with automating your workflows, that still need abit of human input.

Generic Commands

PAK offers a standard set of commands giving you the first steps to automate your workflows.

Nexus Maven Command Pool

Nexus is an artifact repository manager for storing binaries, libraries, and artifacts, supporting formats like Maven. Maven, a software project management tool, is based on the Project Object Model (POM) and allows developers to consistently define projects and dependencies. Our Command Pool offers commands for interactions between Maven and Nexus, such as artifact uploads or dependency retrieval.

Artifactory Maven Command Pool

Artifactory allows developers to store, retrieve, and manage binary files and artifacts, providing a
central source for all binaries used in a development process. Apache Maven is a software project
management and comprehension tool that enables developers to consistently describe a project and
its dependencies. Our Command Pool offers a collection of commands used to facilitate interactions
between Maven and Artifactory, such as uploading artifacts or retrieving dependencies.

Open API Command Interpreter

The OpenApi Command Interpreter allows you the automatic parsing of commands from an OpenApi defintion. No additional code needs to be written anymore, just add the address to the definition and our framework does the rest!

Kotlin Command Interpreter

The Kotlin Command Interpreter allows you the parsing and execution of commands within a Kotlin environment to automate various tasks or processes.

Bpmn Interpreter

Workflows come in many shapes and forms. The BPMN (Business Process Model and Notation) Interpreter enables the parsing of worklows defined in the BPMN format into the PAK intern model.

Human Task Interpreter

The Human Task Interpreter allows you the parsing and running of commands within a HTML and Javascript environment. Use this to build commands which need the creative input of a workflow user!

Java Command Interpreter

The Java Command Interpreter allows you the parsing and execution of commands within a Java
environment to automate various tasks or processes.

Core

The heart of the PAK-Framework. Contains the means to run workflows with the PAK engine, but also the possibility to enrich the frameworks interfaces with your own implementations and solutions.

RocksDB Persistence

Data that is generated by a workflow run needs to be saved for short or longer terms. Our solution to the Persistence Interface of the PAK-Framework is to use the high-performance, key-value based RocksDB developed by Facebook.

PAK online

PAK Online is a web based application and provides an Open API based REST API. It enables you to upload workflows and run them periodically or on REST demand.

Command Line App

Run tasks and workflows on the console or as part of a CI/CD Pipeline with our Command Line Interface.

Workflow Editor

With our specially developed editor, a wide variety of workflows can be easily modeled in the wide known BPMN process format.

Workflow Executor

The Workflow Executor is the application to run your workflows. It features a multilingual UI and easy managment of your favorite workflows.

Support

We offer a community website where you can exchange ideas and support each other. For our Pro packages we also offer full support via email.