Suche

1. What you will learn

In this tutorial you will learn how to bring mappings to the next level by using PAKs Interpolation to manipulate variables from the datastore.

2. Prerequisites

  • Roughly 10 minutes

  • Basic understanding of Mappings

  • The PAK Bpmn Editor ( Download )

  • The PAK Workflow Executor ( Download )

3. Commands to Use

write value cmd
Figure 1. The Write Value command

Command that take an input value and simply writes it to the datastore.

simple ok cmd
Figure 2. The Simple Ok command

Command which simply shows an informational text together with an ok button.

4. Advanced Mappings

Interpolations are used to extend the functionality of constant mappings. An interpolation can be integrated in any string mapping using the syntax ${interpol} where interpol is of one of the types described below.

For a complete rundown of the syntax for interpolations, please refer to the syntax reference.

There is also a Quick Interpolation Tool available:

Quick Interpolation
Figure 3. The Quick Interpolation Tool
1 Select the constant mappings
2 Press the $ symbol to open a list of valid datastore keys
3 Select an available key from the tools list
4 The selected key has now a valid interpolation on that key.
The Tool can only interpolate regular datastore keys. Interpolations on environment variables or fields of that key must be done manually.

4.1. Json Interpolation

In PAK, all data that passes the datastore is transformed to the JSON format. This allows us to perform transformations on stored values via the JSON path syntax.

4.1.1. The Workflow

In order to demonstrate JSON path interpolation we will need a JSON in the datastore that we can perform actions on. So let’s set up a very simple workflow that merely writes a value into the datastore and prints the result.

json workflow
Figure 4. Simple Workflow to demonstrate JSON interpolation
{
    "name" : "Max",
    "age" : 33,
    "hobbies" : [
        {
            "name" : "Soccer",
            "id" : 0
        },
        {
            "name" : "Coding",
            "id" : 1
        },
        {
            "name" : "Automating Workflows",
            "id" : 2
        }
    ]
}

To use that JSON in our command we create a constant mapping for readValue as described in the previous tutorial.

4.1.2. Json Path Mapping

As you can see, our JSON model represents a person that has a name, age, and a list of hobbies attached. However, we might only be interested in the persons name. As the JSON will be written by the Write Value command, we can reference it with writtenValue. So in order to extract the name from the JSON data we use JSON pathing (Fig 5).

json mapping simple
Figure 5. Json Path Mapping
json mapping simple result
Figure 6. Json Path Mapping Result
1 Select the messageText key
2 Map its constant value to ${writtenValue.name}

After running the workflow in the PAK Workflow Executor (Download) we get the desired result as shown in Fig 6.

Of course, we have the freedom to interpolate how we desire. For example, we could also extract the age into the same string (Fig 7).

json mapping simple 2
Figure 7. Json Path Mapping 2
json mapping simple 2 result
Figure 8. Json Path Mapping 2 Result
1 Select the messageText key
2 Map its constant value to Name: ${writtenValue.name} | Age: ${writtenValue.age}

4.1.3. Json Array Mapping

The list of hobbies is not really looking appealing due to each element being a JSON itself. Using JSON array mapping we can extract only the name of the hobbies in our interpolation (Fig 9).

json array mapping
Figure 9. Json Array Mapping
json array mapping result
Figure 10. Json Array Mapping Result
1 Select the messageText key
2 Map its constant value to ${writtenValue.hobbies.name}

To select a specific item from the list we can specify an index like writtenValue.hobbies[1] which will result in:

json array mapping 2
Figure 11. Json Array Mapping Result 2
Make sure that the index you are using is withing the bounds of the JSON array

Alternatively we can specify to extract either the first, or the last value like writtenValue.hobbies[:], respectively writtenValue.hobbies[-:].

4.2. Environmental Interpolation

While you can fetch values from PAKs datastore, sometimes the need arises to acquire values that were not necessarily written, for example the location of the users home directory.

As environmental mappings are not dependent on the datastore, we can simply take the workflow from Fig 3 and omit the Write Value command leaving us with the following workflow.

env workflow
Figure 12. Simple Workflow to demonstrate environmental interpolation
java mapping
Figure 13. Java Variable Mapping

PAK executes in a Java runtime, enabling us to use variables defined by java. So for this instance we can define our command to use the Java variable user.home.

1 Select the key messageText
2 Map its constant value to ${java(user.home)}

After running the workflow we can see that our mapping was successfully replaced. (Fig 15)

env mapping
Figure 14. Environment Variable Mapping

Not only can we acquire values from the Java runtime, but also our operating systems environment variables. For example, on a Windows system we can check for the user home using the UserProfile environment variable.

1 Select the key messageText
2 Map its constant value to ${env(UserProfile)}.
java mapping result
Figure 15. Environmental Interpolation Result

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.