powered by ASAP

This chapter describes how to develop Human Tasks in PAK.

1. Introduction

Human Tasks are commands, which can be developed using a special HTML-based notation. They generally describe tasks that can’t be automated and require the
creative work from a human. Most Human Tasks are used in order to get specific inputs or confirmations by the user. They can be put in two categories,
generic tasks which can be executed in most environments and domain specific tasks which are for example limited to the Workflow Executor.

2. Requirements

The HTML Interpreter is provided for Human Task development using HTML, JavaScript and CSS. Therefore, basic skills
in HTML, JavaScript and CSS are required in order to develop Human Tasks.

Several dependencies and tasks are required as well, which will be described in the following. Additionally, an example implementation
of a build.gradle and settings.gradle for Gradle and a pom.xml for Apache Maven are given.

2.1. Gradle

If you want to use Gradle for your Human Task Development you can use the following build.gradle and settings.gradle as orientation for needed dependencies.

Listing 1. build.gradle
plugins {
    id 'java'
    // only required if eclipse is used as the IDE
    id 'eclipse'
    // dependencies for html-processor, which it makes it possible
    // to process html-files into commandmetas
    id 'de.asap.pak.html.processor' version '1.6.15'
}


// the version of your human task
version = '1.7.5432-SNAPSHOT'
project.description = 'TestHumanTask'
project.group = 'html.org.example.pak.humantasks'

repositories {

    maven {
        name = 'pak-explorer-maven'
        url 'https://pak.asap.de/nexus/repository/pak-explorer-maven/'
    }
    mavenCentral()
}


task metaJar(type: Jar) {
    archiveClassifier = 'pakmeta'
    from sourceSets.main.output
    include 'meta/**'
    include 'entities/**'
    from sourceSets.main.java
    include 'icon/**'
}


eclipse {
    // automatically generate meta files on eclipse refresh
    synchronizationTasks analyseHtml
}
jar.dependsOn(analyseHtml)
// Creates the meta files always with each gradle build call
build.finalizedBy(analyseHtml)
Listing 2. build.gradle
pluginManagement {
    repositories {
        maven {
            name = 'asap-maven-public'
            credentials {
                username nexusUser
                password nexusPass
            }
            url 'https://in13sv-mc04.group.asap.de/nexus/repository/maven-public/'
        }
        gradlePluginPortal() // needs to be specified, since these settings overwrite all default repositories
    }
}

rootProject.name = 'humantasks'

2.2. Apache Maven

If you want to use Apache Maven for your Human Task Development you can use the following pom.xml as orientation for needed dependencies.

Listing 3. pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>html.org.example.pak.humantasks</groupId>
<artifactId>'TestHumanTask'</artifactId>
<version>1.7.5432-SNAPSHOT</version>

<properties>
    <pakVersion>1.6.15</pakVersion>
</properties>

<repositories>
    <repository>
        <id>pak-explorer-maven</id>
        <url>https://pak.asap.de/nexus/repository/pak-explorer-maven/</url>
    </repository>
</repositories>

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
            </plugin>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.0.2</version>
            </plugin>
            <plugin>
                <groupId>de.asap.pak.html</groupId>
                <artifactId>processor</artifactId>
                <version>${pakVersion}</version>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

</project>

Several dependencies and tasks are required, which will be described in the following chapter.

2.3. Dependencies

The required dependencies (in an Apache Maven or Gradle based project setup) are described below.

html-processor

Processes HTML-files and automatically generates the corresponding command meta information based on the given
datastore information.

html-interpreter

Similar to the Java interpreter, there is an HTML interpreter for the Human Tasks. The idea is that all kind of controls can be used and commands can be written that are suitable
for display in a Web-UI as well as in a local client application (e.g. via JavaFx browser engine). Interprets the processed CommandMeta into a Java Command.

2.4. Project Structure

In order to achieve the generation of working CommandMetas it’s important to have the correct base project-structure. The following image will show one such
example:

ProjectStructureHumanTask
Figure 1. Sample Project Structure for the development of Human Tasks in Gradle
  • Create a new module where the Human Tasks are stored.

  • The sub-modules main and test (sub-module test is not required as Human Tasks can not be unit tested yet) are created automatically in a Gradle based project. Therefore, a build.gradle and settings.gradle file must be added to the module.
    In order to add the required dependencies to the module (The content of these files is specified here).

  • It makes sense to distribute the logic of the Human Tasks in different packages within the resources directory of the main sub-module. Scripts (js-files) can for example be saved within html.org.example.pak.humantasks.script and
    css-files in html.org.example.pak.humantasks.css. The general Human Tasks (html-files) can e.g. be stored in the html.org.example.pak.humantasks package.

3. Example Implementation

Listing 4. Development of example Human Task: HumanTaskExample.html
<div class="meta"><!-- Meta info for human task interpreter -->
    <#command major="1" minor="0" increment="0" group="HumanTasks.Generic"
    workflowDocu="My Sample Human Task Command" />  (1)
    <#datastore documentation="docu of specific read-variable" key="readVariable" scope="READ" mandatory="false" type="STRING"/> (2)
    <#datastore documentation="docu of specific write-variable" key="writeVariable" scope="WRITE" mandatory="true" type="INTEGER" deprecated="This variable is deprecated"/>
</div>

<html lang="en"> (3)
<head>
    <link rel="stylesheet" [...]>
    <title>SampleHumanTask</title>
</head>
<body>
[...]
<form method="POST" class="formBox"> (4)
    <div>Human Task</div>
    <!-- Hidden variable to write into DS -->
    <input type="hidden" id="writeVariable" name="writeVariable">
    <!-- The Button-Row -->
    <div class="right">
        <!-- Button action -->
        <input class="btn" type="submit" onclick="someJavaScriptMethod(this.value)" value="Button to press"/>
    </div>

</form>
</body>


<script> (5)
    // Internal logic of command, can be defined by using JavaScript

</script>
</html>
1 Defines the general information for the command. In this listing the workflowDocu, the version and the CommandGroup of the command are getting set.
Furthermore, it’s possible to deprecate a command and enter a deprecated-docu, this can be achieved by using the deprecated flag and setting it to a concrete
string-value.
2 Defines the information for the variables within the command (CommandMappings). Here it is possible to
define the scope, the documentation and the mandatory-level of the mapping. Mappings can also be made deprecated, and a deprecation docu can be added,
this can be achieved by using the deprecated flag.
3 It’s possible to introduce own designs by defining and referencing css files.
4 In here, the user can configure how the WRITE mapping is getting processed and what action should be taken if the button is pressed.
5 In the script-part of the html the business logic of the command can be defined. The business logic must be defined using JavaScript.

Here you can check out Human Tasks, which can already be used in the Workflow Executor.

3.1. Visualisation of Human Tasks in the Executor

The following image shows how the command defined in the example above gets displayed in the Workflow Executor.

HumanTaskExampleExecutor
Figure 2. Visualisation of a Human Task in the Workflow Executor

A Human Task does look quite similar in the Executor, compared to the normal Java Commands.
The main difference is that on the right side of the screen a window is opened (after the user executes the command), where the user can
„interact“ with the specific Human Task.

If you’re curious on how to test your human task, more information can be found here.
Please keep in mind that the design of your Human Task can differ from the one shown in this example. The design depends on the referenced css-files.

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.