diff --git a/.gitignore b/.gitignore
index ed80467..2eef251 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,42 +1,13 @@
-# Created by .ignore support plugin (hsz.mobi)
-### Maven template
+Thumbs.db
+.DS_Store
+.gradle
+build/
target/
-pom.xml.tag
-pom.xml.releaseBackup
-pom.xml.versionsBackup
-pom.xml.next
-release.properties
-dependency-reduced-pom.xml
-buildNumber.properties
-.mvn/timing.properties
-.mvn/wrapper/maven-wrapper.jar
-
-### Java template
-# Compiled class file
-*.class
-
-# Log file
-*.log
-
-# BlueJ files
-*.ctxt
-
-# Mobile Tools for Java (J2ME)
-.mtj.tmp/
-
-# Package Files #
-*.jar
-*.war
-*.nar
-*.ear
-*.zip
-*.tar.gz
-*.rar
-
-# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
-hs_err_pid*
-
-.idea/*
+out/
+.idea
*.iml
-
-tmp/*
\ No newline at end of file
+*.ipr
+*.iws
+.project
+.settings
+.classpath
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..a1b5c32
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,15 @@
+language: java
+
+jdk: openjdk8
+
+script:
+ - ./gradlew clean build
+
+sudo: false
+
+install: true
+
+cache:
+ directories:
+ - $HOME/.gradle/caches/
+ - $HOME/.gradle/wrapper/
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..2097541
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,4 @@
+FROM adoptopenjdk/openjdk11-openj9:jdk-11.0.1.13-alpine-slim
+COPY build/libs/quintessential-tasklist-zeebe-*-all.jar quintessential-tasklist-zeebe.jar
+EXPOSE 8080
+CMD java -Dcom.sun.management.jmxremote -noverify ${JAVA_OPTS} -jar quintessential-tasklist-zeebe.jar
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..820eae4
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018 https://github.com/StephenOTT
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
index e8a6fa0..7da5810 100644
--- a/README.md
+++ b/README.md
@@ -1,711 +1,169 @@
# quintessential-tasklist-zeebe
The quintessential Zeebe tasklist for BPMN Human tasks with Drag and Drop Form builder, client and server side validations, and drop in Form Rendering
-WIP
+KOTLIN
-Setup SLF4J logging: `-Dvertx.logger-delegate-factory-class-name=io.vertx.core.logging.SLF4JLogDelegateFactory`
-vertx run command: `run com.github.stephenott.MainVerticle -conf src/main/java/com/github/stephenott/conf/conf.json`
-Current Zeebe Version: `0.21.0-alpha1`
-Current Vertx Version: `3.8.0`
-Java: `1.8`
+## Workflow Linter
+The workflow linter provides a linting/validation engine for BPMN workflows that are parsed by the Zeebe Model API.
-# Cluster Architecture
+The linter acts as a warning and error system allowing you to validate workflows during the modeling process, and you can
+implement the linter at deployment time, so when deploying a workflow into the Zeebe Cluster, the deployment will be stopped if a model has warnings or errors defined in the linter rules.
-
+### Linter Rules
-- Clients, Workers, and Executors can be added at startup and during runtime.
-- Failed nodes in the Vertx Cluster (Clients, Workers, and Executors) will be re-instantiated through the vertx cluster manager's configuration.
-
-
-# Form Building UI
-
-The Form Builder UI uses Formio.js as the Builder and Render.
-The schema that was generated from the builder is persisted and used during the User Task Submission with Form flow.
-
-
-
-
-
-
-
-
-And then you can render and make a submission:
-
-
-
-
-Try out the builder on: https://formio.github.io/formio.js/app/builder
-
-
-## User Task Submission with Form Data flow
-
-
-
-
-# ZeebeClient/Worker/Executor Data Flow
-
-
-
-
-# Configuration
-
-Extensive configuration capabilities are provided to control the exact setup of your application:
-
-The Yaml location can be configured through the applications config.json. Default is `./zeebe.yml`.
-
-Example:
+1. Rules are additive. One rule cannot cancel out another rule.
+1. Rules require a description, elementTypes, and a rule implementation.
+1. Element Types: `ServiceTask`, `ReceiveTask`.... (more to come)
+1. Rules can apply to multiple element types, and have various targeting rules.
+1. the `Target` property defines "targeting rules" that applied to the rule. Targeting rules define when the rule should be applied for the specific Element Type.
+1. See the User Task example below for common usage: "Only target ServiceTasks with a task type of `user-task`. This means the rule will only apply when a Service Task defines a type of `user-task`
```yaml
-zeebe:
- clients:
- - name: MyCustomClient
- brokerContactPoint: "localhost:25600"
- requestTimeout: PT20S
- workers:
- - name: SimpleScriptWorker
- jobTypes:
- - type1
- timeout: PT10S
- - name: UT-Worker
- jobTypes:
- - ut.generic
- timeout: P1D
-
-executors:
- - name: Script-Executor
- address: "type1"
- execute: ./scripts/script1.js
- - name: CommonGenericExecutor
- address: commonExecutor
- execute: classpath:com.custom.executors.Executor1
- - name: IpBlocker
- address: block-ip
- execute: ./cyber/BlockIP.py
-
-userTaskExecutors:
- - name: GenericUserTask
- address: ut.generic
-
-managementServer:
- enabled: true
- apiRoot: server1
- corsRegex: ".*."
- port: 8080
- instances: 1
- zeebeClient:
- name: DeploymentClient
- brokerContactPoint: "localhost:25600"
- requestTimeout: PT10S
-
-formValidatorServer:
- enabled: true
- corsRegex: ".*."
- port: 8082
- instances: 1
- formValidatorService:
- host: localhost
- port: 8083
- validateUri: /validate
- requestTimeout: 5000
-
-userTaskServer:
- enabled: true
- corsRegex: ".*."
- port: 8080
- instances: 1
-```
-
-# Zeebe Clients
-
-A Zeebe Client is a gRPC channel to a specific Zeebe Cluster.
-
-A client maintains a set of "Job Workers", which are long polling the Zeebe Cluster for Zeebe Jobs that have a `type` listed in the `jobTypes` array.
-
-Zeebe Clients have the following configuration:
-
-```yaml
-zeebe:
- clients:
- - name: MyCustomClient
- brokerContactPoint: "localhost:25600"
- requestTimeout: PT20S
- workers:
- - name: SimpleScriptWorker
- jobTypes:
- - type1
- timeout: PT10S
- - name: UT-Worker
- jobTypes:
- - ut.generic
- timeout: P1D
-```
-
-Where `name` is the name of the client. The same name could be used by multiple clients in the same server or by other servers. The `name` is used as the `zeebeSource` in Executors and User Task Executors as the source system to send completed/failed Zeebe Jobs back to.
-
-Where `workers` is a array of Zeebe Worker definitions. A worker definition has a `name` and a list of `jobTypes`.
-
-`name` is the worker name that is provided to Zeebe as the worker that requested the job.
-
-`jobTypes` is the lsit of Zeebe job `types` that will be queried for using long polling.
-
-Jobs that are retrieved will be routed to the event bus using the address: `job.:jobType:`, where `:jobType:` is the specific Zeebe job's `type` property.
-Make sure you have executors (Polyglot, User Task or custom) on the network connected to the vertx cluster or else the job will not be consumed by a worker.
-
- Take note of the usage of the `timeout` which is the deadline that the job will be locked for.
- The usage has special applicability for Jobs that you want to use with User Task; where you will want to set the timeout as a much longer period than a typical executor.
-
-
-# Executors
-
-Executors provide a polyglot execution solution for completing Zeebe Jobs.
-
-Executors have the following configuration:
-Example of three different executors:
-
-```yaml
-executors:
- - name: Script-Executor
- address: "type1"
- execute: ./scripts/script1.js
- instances: 2
- - name: CommonGenericExecutor
- address: commonExecutor
- execute: classpath:com.custom.executors.Executor1
- - name: IpBlocker
- address: block-ip
- execute: ./cyber/BlockIP.py
-```
-
-Executors can execute scripts and classes as defined in the executor's polyglot capabilities.
+orchestrator:
+ workflow-linter:
+ rules:
+ global-rules:
+ enable: false
+ description: Global Restrictions for Service Task Types
+ elementTypes:
+ - ServiceTask
+ serviceTaskRule:
+ allowedTypes:
+ - some-type
+ - user-task
+
+ user-task-rule:
+ description: Specific rule for User Task Configuration of Service Tasks
+ elementTypes:
+ - ServiceTask
+ target:
+ serviceTasks:
+ types:
+ - user-task
+ headerRule:
+ requiredKeys:
+ - title
+ - candidateGroups
+ - formKey
+ allowedNonDefinedKeys: false
+ allowedDuplicateKeys: false
+ optionalKeys:
+ - priority
+ - assignee
+ - candidateUsers
+ - dueDate
+ - description
+```
+
+
+Responses can be of a WARNING or ERROR
+
+```
+Element ---> serviceTask ServiceTask_1luzsfd
+Type: ERROR
+Code: 0
+Element Type: serviceTask
+Element Id: ServiceTask_1luzsfd
+Message: Missing Required Headers: [title, candidateGroups, formKey]
+
+Type: ERROR
+Code: 0
+Element Type: serviceTask
+Element Id: ServiceTask_1luzsfd
+Message: Found headers that are not part of Optional Headers list: [priority, assignee, candidateUsers, dueDate, description]
+```
+
+### Global Rules
+
+If the `target` property configuration is **not** provided, then the rule will be applied globally to all Element Types defined in the rule.
+
+Global rules can be a good way to implement some restrictions on your modeling teams to ensure that internal types and correlation keys are not used.
+
+Global rules can be valuable naming conventions as well: "task types cannot start with a underscore `_`."
+
+### Element Type Rules (WIP)
+
+Working model is to have rule factories for each major Element Type (Service Task, Receive Task, Catch message, etc).
+
+Element Type Rules provide specific rule implementations that focus on the Element Type's configuration possibilities:
+
+1. Service Task:
+ 1. Allowed Types + regex limit
+ 1. Allowed Retry Regex
+ 1. Allowed IO Mappings
+ 1. Allowed Headers (Required, Optional, duplicates, Key Value Pairs, Non-Defined Keys, etc)
+1. Receive Task:
+ 1. Allowed Correlation Keys
+ 1. Correlation Key Restrictions (limit names allowed to be used + regex limit)
+ 1. Out-mapping restrictions.
+
+
+### Formatting Rules (WIP)
+
+The Linter is not just about execution implementation rules, you can also define formatting rules for the BPMN.
+
+Formatting rules enable you to prevent common errors in formatting of BPMN.
+
+1. Label all Gateways
+1. Pool Usage
+1. Prevent label patterns with Regex
+1. Gateways labels end in "?"
+1. No Expressions
+1. Double sequence flows
+1. Sub-Process Names
+1. Loop Characteristics naming
+1. Start Timer names
+1. Message Start Names
+1. End Event Names
+1. Intermediate Event Names
+1. .. More?
+
+
+### TODO
+
+1. Add support to define what will prevent a deployment (WARNING / ERRORS)
+1. Add optional parameter on deployment endpoint to validate using linter
+1. Provide JSON error support
+1. Provide Language Server implementation of linter.
+1. Add IO Mappings rules
+1. Add Receive Task Rule
+1. Add Message Rules
+1. Add Formatting rules
+1. Add Timer rules to prevent certain spectrum of timer durations / cycles
+1. Add targeting based on BPMN Process Key
+1. Add special negating rule for Task Types and Correlation Keys
+1. Add Allowed Call Activity Process IDs: Rule to ensure only specific Process IDs can be called through the Modeler.
-Where `address` is the Zeebe job `type` that would be configured in the task in the BPMN.
-Where `execute` is the class/script that will be executor when jobs are sent to this executor
+## Workflow Sanitizer
-Where `name` is the unique name of the Executor used for logging purposes.
+Workflow Sanitizer is the capability to remove aspects of a BPMN that are internal configuration that should not be shared when allowing users to download BPMN xml (such as when rendering a BPMN in the bpmn.js / bpmn.io modeler).
-You can deploy a Executor with multiple `instances` to provide more more parallel throughput capacity.
+Every element in a BPMN can be replaced with a sanitized version: a sanitized version is a new blank instance of the element that replaces the original element.
+Only configurations that are explicitly desired in a sanitized BPMN are transferred over into the new instance.
-Required properties: `name`, `address`, `execute`
+The Sanitizer provides flexible usage options depending on your sanitizing needs:
-Completion of Jobs sent to Executors is captured over the event bus with the JobResult object.
-Completed (successfully or a failure such as a business error) are sent as a JobResult to event bus address: `sourceClient.job-aciton.completion`.
+The core of Sanitizer provides a Workflow Linter that allows you to configure which types that inherit from `ModelElementInstance` will be targeted for cleaning.
+The default Sanitizer Linter configuration targets all elements and applies a error code of `5000` ("it's Audi 5000"...).
+The default Sanitizer that actions each of the found elements, will take a lean approach:
-Where `sourceClient` is the ZeebeClient `name` that is used in the `zeebe.clients[].name` property.
+1. element Id values are kept. This allows to continue targeting elements based on the IDs used in the BPMN's execution so you can do heatmaps, and BPMN status overlays (counts, what activities are currently failing, which ones have completed, loop counts, etc).
+1. All names are kept (these are usually the labels/names on each element/task/gateway/sequence-flow/pool, etc)
+1. All Annotations are kept.
+1. All markings and definition types are kept: but only the fact that they exist; their actual configuration is removed.
+1. Default Flow markings on sequence flows are kept.
+1. `Process` elements are not modified. But their children would be modified as their are independent instances of `ModelElementInstance`
-The `sourceClient` ensures that a completed job can be sent back to the same Zeebe Cluster, but not necessarily using the same instance of a ZeebeClient that consumed the job.
+What is explicitly not kept?
-JobResult's that have a `result=FAIL` will have their corresponding Zeebe Job actioned as a Failed Job.
-
-
-# User Task Executors
-
-User Task(UT) Executors are a special type of executor that are dedicated to the logic handling of BPMN User Tasks.
-
-UT Executors have the following configuration:
-
-```yaml
-userTaskExecutors:
- - name: GenericUserTask
- address: ut.generic
- instances: 1
-```
-
-Required properties: `name`, `address`
-
-Where `address` is the Zeebe job `type` that would be configured in the task in the BPMN.
-
-Internally executors have their addresses prefixed with a common job prefix to ensure proper message namespacing.
-
-Where `name` is the unique name of the UT Executor used for logging purposes.
-
-You can deploy a UT Executor with multiple `instances` to provide more more parallel throughput capacity.
-
-UT Executors primary function is to provide capture of UTs from Zeebe and convert the Zeebe jobs into a UserTaskEntity.
-A UserTaskEntity is then saved in the storage of choice (such as a DB).
-
-Completion of User Tasks is captured over the event bus with the JobResult object.
-
-Completed (successfully or a failure such as a business error) are sent as a JobResult to event bus address: `sourceClient.job-aciton.completion`.
-
-Where `sourceClient` is the ZeebeClient `name` that is used in the `zeebe.clients[].name` property.
-
-The `sourceClient` ensures that a completed job can be sent back to the same Zeebe Cluster, but not necessarily using the same instance of a ZeebeClient that consumed the job.
-
-JobResult's that have a `result=FAIL` will have their corresponding Zeebe Job actioned as a Failed Job.
-
-
-## User Tasks
-
-The default build of User Tasks seeks to provide a duplicate or similar User Task experience as Camunda's User Tasks implementation.
-
-See UserTaskEntity.class, UserTaskConfiguration.class for more details.
-
-A User Task can be configured in the Zeebe BPMN using custom headers. The supported headers are:
-
-|key|value|description|
-|------|------|----------|
-|title|`string`|The title of the task. Can be any string value that will be interpreted by the User Task storage system.|
-|description|`string` |The description of the task. Can be any string value that will be interpreted by the User Task storage system.|
-|priority|`int`|defaults to 0|
-|assignee|`string`|The default assignee of the task. A single value.|
-|candidateGroups|`string`|The list of groups that are candidates to claim this task. Comma separated list of strings. Example: `"cg1, cg2, cg3"`|
-|candidateUsers|`string`|The list of users that are candidates to claim this task. Comma separated list of strings. Example: `"cu1, cu2, cu3"`|
-|dueDate|`string`|The date on which the User Task is due. ISO8601 format|
-|formKey|`string`|A value that represents the specific form that should be used by the user when completing this task.|
-
-
-When generating a UserTaskEntity, some additional properties are stored for usage and indexing and convenience:
-
-In addition to the custom header values above, the following is stored in the UserTaskEntity:
-
-|key|value|description|
-|------|------|----------|
-|taskId|`string`|The unique ID of the task. Typically will be a business centric key defined during configuration. If not ID is provided then defaults to `user-task--:UUID:` where `:UUID:` is a random UUID.|
-|zeebeSource|`string`|The source ZeebeClient `name` that the ZeebeJob was retrieved from.
-|zeebeDeadline|`instant`|The Zeebe Job deadline property|
-|zeebeJobKey|`long`|The unique job ID of the Zeebe Job.|
-|bpmnProcessId|`string`|The BPMN Process Definition ID|
-|zeebeVariables|`Map of String:Object`|The variables from the Zeebe Job|
-|metadata|`Map of String:Object`|A generic data holder for additional User Task metadata|
-
-# Form Validation Server
-
-The Form Validation Server provides HTTP endpoints for validation a Form Submission based on a provided Form Schema.
-
-Configuration:
-
-```yaml
-formValidatorServer:
- enabled: true
- corsRegex: ".*."
- port: 8082
- instances: 1
- formValidatorService:
- host: localhost
- port: 8083
- validateUri: /validate
- requestTimeout: 5000
-```
-
-Where `formValidatorService` is the Form Validator service that performs the actual form validation.
-
-Example Validation Request:
-
-POST: `localhost:8083/validate`
-
-Body:
-
-```json
-{
- "schema":{
- "display": "form",
- "components": [
- {
- "label": "Text Field",
- "allowMultipleMasks": false,
- "showWordCount": false,
- "showCharCount": false,
- "tableView": true,
- "alwaysEnabled": false,
- "type": "textfield",
- "input": true,
- "key": "textField2",
- "defaultValue": "",
- "validate": {
- "customMessage": "",
- "json": "",
- "required": true
- },
- "conditional": {
- "show": "",
- "when": "",
- "json": ""
- },
- "inputFormat": "plain",
- "encrypted": false,
- "properties": {},
- "customConditional": "",
- "logic": [],
- "attributes": {},
- "widget": {
- "type": ""
- },
- "reorder": false
- },
- {
- "type": "button",
- "label": "Submit",
- "key": "submit",
- "disableOnInvalid": true,
- "theme": "primary",
- "input": true,
- "tableView": true
- }
- ],
- "settings": {
- }
- },
- "submission":{
- "data": {
- "textField2": 123,
- "dog": "cat"
- },
- "metadata": {}
-}
-}
-```
-
-Response if validation passes:
-
-```json
-{
- "processed_submission": {
- "textField2": "sog"
- }
-}
-```
-
-Notice that the extra `dog` property is removed because it is not a valid field in the form schema.
-
-Response if validation fails:
-
-```json
-{
- "isJoi": true,
- "name": "ValidationError",
- "details": [
- {
- "message": "\"textField2\" must be a string",
- "path": "textField2",
- "type": "string.base",
- "context": {
- "value": 123,
- "key": "textField2",
- "label": "textField2"
- }
- }
- ],
- "_object": {
- "textField2": 123,
- "dog": "cat"
- },
- "_validated": {
- "textField2": 123
- }
-}
-```
-
-The validation service is also available over the event bus at the `address` property defined in the Form Validation Server configuration.
-
-
-# Management Server
-
-The management server provides HTTP endpoints for working with Zeebe clusters
-
-Configuration:
-
-```yaml
-managementServer:
- enabled: true
- apiRoot: server1
- corsRegex: ".*."
- port: 8080
- zeebeClient:
- name: DeploymentClient
- brokerContactPoint: "localhost:25600"
- requestTimeout: PT10S
- instances: 1
- fileUploadPath: ./tmp/uploads
-```
-
-required fields: `apiRoot`, `zeebeClient`
-
-`apiRoot` must be unique.
-
-## Deploy Workflow
-
-`POST localhost:8080/server1/deploy`
-
-Headers:
-- `Content-Type: multipart/form-data`
-
-form-data:
-- file name (must be a .bpmn or .yaml file) : file upload (the binary file you are uploading such as a .bpmn file)
-
-Where `server1` is the `apiRoot` value defined in the YAML configuration.
-
-You can deploy many management servers as needed. Each server can be deployed for different zeebe clusters.
-
-You can deploy the same server with multiple `instances` to provide more throughput.
-
-## Create Workflow Instance / Start Workflow
-
-`POST localhost:8080/server1/create-instance`
-
-Headers:
-- `Content-Type: application/json`
-- `Accept: application/json`
-
-Json Body:
-
-```json
-{
- "workflowKey": 1234567890
-}
-```
-
-Where `workflowKey` is the unique workflow key that was generated for the BPMN process/pool during deployment.
-
-You may also use:
-
-```json
-{
- "bpmnProcessId": "myProcess",
- "bpmnProcessVersion": 2
-}
-```
-
-Where `bpmnProcessId` is the BPMN's process Id property (sometimes referred to as a process key).
-The `bpmnProcessVersion` is optional. You can set the version number or set as `-1` which means "latest version" / newest. If you do not provide the property it will default to latest version.
-
-`varaibles` can also be provided as a json object:
-
-```json
-{
- "workflowKey": 1234567890,
- "variables": {
- "myVar1": 123,
- "myVar2": "some value",
- "myVarABC": [1,2,5,10],
- "myVarXYZ": {
- "1": "A",
- "2": "B"
- }
- }
-}
-```
-
-The variables will be injected into the created workflow instance.
-
-
-# User Task Server
-
-A User Task HTTP server that provides User Task persistence, querying, completion, etc.
-
-The server also provides a Form Schema Entity persistence, querying, and validation of submissions against the schema.
-The Form Schema is what will be submitted to the Form Validator Service.
-
-## Server Configuration
-
-```yaml
-userTaskServer:
- enabled: true
- corsRegex: ".*."
- port: 8080
- instances: 1
-```
-
-## Actions:
-
-1. Save Form Schema
-1. Complete User Task
-1. Get User Tasks
-1. Submit Form to Complete a User Task
-1. Delete User Task (TODO)
-1. Claim User Task (TODO)
-1. UnClaim User Task (TODO)
-1. Assign User Task (TODO)
-1. Create Custom User Task (not linked to Zeebe Job)
-
-## Save Form Schema
-
-POST `/form/schema`
-
-```json
-{
- "owner": "Department-1",
- "key": "MySimpleForm1",
- "title": "My Simple Form 1",
- "schema": {
- "display": "form",
- "components": [
- {
- "label": "Text Field",
- "allowMultipleMasks": false,
- "showWordCount": false,
- "showCharCount": false,
- "tableView": true,
- "alwaysEnabled": false,
- "type": "textfield",
- "input": true,
- "key": "textField2",
- "defaultValue": "",
- "validate": {
- "customMessage": "",
- "json": "",
- "required": true
- },
- "conditional": {
- "show": "",
- "when": "",
- "json": ""
- },
- "inputFormat": "plain",
- "encrypted": false,
- "properties": {},
- "customConditional": "",
- "logic": [],
- "attributes": {},
- "widget": {
- "type": ""
- },
- "reorder": false
- },
- {
- "type": "button",
- "label": "Submit",
- "key": "submit",
- "disableOnInvalid": true,
- "theme": "primary",
- "input": true,
- "tableView": true
- }
- ],
- "settings": {
- }
- }
-}
-```
-
-The `key` property is the `formKey` value you setup in your zeebe task custom headers.
-
-Required fields: `owner`, `key`, `title`, `schema`
-
-
-## Complete User Task
-
-Mainly used as a administrative endpoint to complete a User Task without any Form
-
-POST `/task/complete`
-
-```json
-{
- "job": 2251799813685292,
- "source": "MyCustomClient",
- "completionVariables": {}
-}
-```
-
-`Source` is the zeebe client name configured in your configuration yaml.
-
-
-## Get Tasks
-
-GET `/task`
-
-JSON Body:
-
-Query is run as a `AND` query on each of the arguments
-
-```json
-{
- "taskId": "",
- "state": "",
- "title": "",
- "assignee": "",
- "dueDate": "",
- "zeebeJobKey": "",
- "zeebeSource": "",
- "bpmnProcessId": ""
-}
-```
-
-You can pass `{}` as the body if you want to return all User Tasks.
-
-
-## Submit Task with Form
-
-POST `/task/id/:taskId/submit`
-
-Example: `localhost:8088/task/id/user-task--080946c6-1355-4cd7-9fcf-86fc9c46d4c4/submit`
-
-Json Body:
-
-```json
-{
- "data": {
- "textField2": "sog",
- "dog": "cat"
- },
- "metadata": {}
-}
-```
-
-This endpoint acts the same as the Validation Server's `/validate` endpoint. The difference is the User Task's endpoint will complete the User Task entity in the DB if the form is valid, and the Form fields will be saved in the Zeebe workflow as variables when the Job is completed.
-
-Upon successful form validation, and assuming the User Task is not already completed, then the User Task will be made complete and the completion variables will be saved.
-Then a background worker is watching for completed user tasks and will attempt to report this back to the Zeebe Job.
-The behaviour is this way so you can complete User Tasks without having to have a active connection to the Zeebe Cluster.
-
-## Delete User Task
-
-TODO...
-
-
-## Claim User Task
-
-TODO...
-
-## UnClaim User Task
-
-TODO...
-
-## Assign User Task
-
-TODO...
-
-## Create Custom User Task (not backed by Zeebe Job)
-
-TODO...
-
-----
-
-# Raw Notes
-
-1. Implements clustering and scaling through Vertx instances.
-1. ZeebeClientVerticle can increase in number of instances: 1 instance == 1 ZeebeClient Channel connection.
-1. ExecutorVerticle is independent of ZeebeClient. You can scale executors across the cluster to any number of instances and have full cluster feature set.
-1. a JobResult is what holds the context of if a Zeebe Failure should occur in the context of the actual Work that a executor preformed.
-1. Management HTTP takes a apiRoot namespace which is the prefix for the api calls to deploy and start process instances
-1. TODO: Add a send message HTTP verticle
-1. UserTaskConfiguration is the data that is received from a Zeebe Custom Headers which is used to generate the Entity
-1. UserTaskVerticle is a example of a custom worker. I have made them individual so User Tasks can be managed as stand along systems
-1. The Client Name property of the Client config is used as the EB address namespace for sending job completions back over the wire
-1. TODO move executeBlocking code into their own worker verticles with their own thread pools
-1. sourceClient is passed over the wire as a header which represents the client Name. The client name is the client (or any instance of that name/id) that is used to send back into zeebe. This supports multiple clients to different brokers (representing tenants for data separation)
-1. Breakers needs to be added
-1. Polling for Jobs is a executeBlocking action. When polling is complete (found jobs or did not find jobs), it will call the poll jobs again. It assumes long polling is enabled.
-1. TODO review defaults and setup of entity build in the user task verticle as its very messy right now.
-1. Management Server uses the route namespacing because it is assumed that security will be added by a proxy in the network. If app level security needs to be added, then the ManagementHttpVerticle can be easily copied and replaced with security logic.
-1. TODO move EB addresses in a global static class for easy global management
-1. TODO fix up the logging to be DEBUG and cleanup the language as the standard is all over the place at the moment. Also inlcude more context info for when reading the log as its unclear.
-1. TODO ***** Add the defaults logic for the User Task assignments, where if the headers that are not provided in zeebe then the user tasks entity will default to those configured values.
-1. TODO add the overrides logic: where if a override is provided then only the logic from the override is used and the provided header does not matter
-1. TODO Refactor error handling on HTTP requests to provider better json errors
-
-```xml
-...
-
-
-
-
-
-
-
-
-...
-```
+1. Expressions
+1. Configurations on Events: message correlation keys, timer expressions, etc
+1. Receive Task Message Correlation configurations.
+1. Service Task Configurations: Headers, Type, Retries
+1. IO Mappings
+1. Loop Characteristic configurations (the "parallel" vs "sequential" marking is kept)
+1. Message Elements (even if a message is not tied to a element )
\ No newline at end of file
diff --git a/bpmn/bpmn1.bpmn b/bpmn/bpmn1.bpmn
deleted file mode 100644
index d04a9bf..0000000
--- a/bpmn/bpmn1.bpmn
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
-
-
- SequenceFlow_0mi3b9p
-
-
-
-
-
-
-
-
-
-
-
- SequenceFlow_0z6yvdy
- SequenceFlow_0zyd6q2
-
-
- SequenceFlow_0zyd6q2
-
-
-
-
-
-
- SequenceFlow_0mi3b9p
- SequenceFlow_1wzqads
-
-
-
-
-
-
-
- SequenceFlow_1wzqads
- SequenceFlow_0z6yvdy
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..1db9b0d
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,89 @@
+plugins {
+ id "org.jetbrains.kotlin.jvm" version "1.3.50"
+ id "org.jetbrains.kotlin.kapt" version "1.3.50"
+ id "org.jetbrains.kotlin.plugin.allopen" version "1.3.50"
+ id "com.github.johnrengelman.shadow" version "5.0.0"
+ id "application"
+ id "org.jetbrains.kotlin.plugin.jpa" version "1.3.60"
+}
+
+
+
+version "0.1"
+group "quintessential.tasklist.zeebe"
+
+repositories {
+ mavenCentral()
+ maven { url "https://jcenter.bintray.com" }
+}
+
+configurations {
+ // for dependencies that are needed for development only
+ developmentOnly
+}
+
+dependencies {
+ implementation platform("io.micronaut:micronaut-bom:$micronautVersion")
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}"
+ implementation "org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}"
+ implementation "io.micronaut:micronaut-runtime"
+ implementation "io.micronaut:micronaut-http-server-netty"
+ implementation "io.micronaut:micronaut-http-client"
+ implementation 'io.micronaut:micronaut-validation'
+ implementation("io.reactivex.rxjava2:rxkotlin:2.4.0")
+ kapt platform("io.micronaut:micronaut-bom:$micronautVersion")
+ kapt "io.micronaut:micronaut-inject-java"
+ kapt "io.micronaut:micronaut-validation"
+ kaptTest platform("io.micronaut:micronaut-bom:$micronautVersion")
+ kaptTest "io.micronaut:micronaut-inject-java"
+ implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.9.10"
+ runtimeOnly "ch.qos.logback:logback-classic:1.2.3"
+ testImplementation platform("io.micronaut:micronaut-bom:$micronautVersion")
+ testImplementation "io.micronaut.test:micronaut-test-kotlintest"
+ testImplementation "io.mockk:mockk:1.9.3"
+ testImplementation "io.kotlintest:kotlintest-runner-junit5:3.3.2"
+
+ kapt 'io.micronaut.data:micronaut-data-processor:1.0.0.M5'
+ implementation 'io.micronaut.data:micronaut-data-hibernate-jpa:1.0.0.M5'
+ runtime 'com.h2database:h2:1.4.200'
+ runtime 'io.micronaut.configuration:micronaut-jdbc-hikari'
+ implementation 'io.micronaut.configuration:micronaut-flyway'
+
+ implementation "io.zeebe:zeebe-client-java:$zeebeVersion"
+// testImplementation "io.zeebe:zeebe-test:$zeebeVersion"
+
+}
+
+test.classpath += configurations.developmentOnly
+
+mainClassName = "com.github.stephenott.qtz.Application"
+
+test {
+ useJUnitPlatform()
+}
+
+allOpen {
+ annotation("io.micronaut.aop.Around")
+}
+
+compileKotlin {
+ kotlinOptions {
+ jvmTarget = '1.8'
+ //Will retain parameter names for Java reflection
+ javaParameters = true
+ }
+}
+
+compileTestKotlin {
+ kotlinOptions {
+ jvmTarget = '1.8'
+ javaParameters = true
+ }
+}
+
+shadowJar {
+ mergeServiceFiles()
+}
+
+run.classpath += configurations.developmentOnly
+run.jvmArgs('-noverify', '-XX:TieredStopAtLevel=1', '-Dcom.sun.management.jmxremote')
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
index c5ff8fd..e69de29 100644
--- a/docker/docker-compose.yml
+++ b/docker/docker-compose.yml
@@ -1,12 +0,0 @@
-version: "2"
-
-services:
- zeebe:
- restart: always
- container_name: zeebe_broker
- image: camunda/zeebe:0.20.0
- environment:
- - ZEEBE_LOG_LEVEL=info
- ports:
- - "26500:26500"
- - "9600:9600"
\ No newline at end of file
diff --git a/docker/dockerfile-qtz b/docker/dockerfile-qtz
new file mode 100644
index 0000000..3602c08
--- /dev/null
+++ b/docker/dockerfile-qtz
@@ -0,0 +1,3 @@
+FROM adoptopenjdk/openjdk11-openj9:jdk-11.0.1.13-alpine-slim
+COPY build/libs/quintessential-tasklist-zeebe-*-all.jar QTZ.jar
+EXPOSE 8080
\ No newline at end of file
diff --git a/docs/design/cluster.png b/docs/design/cluster.png
deleted file mode 100644
index 250c9ff..0000000
Binary files a/docs/design/cluster.png and /dev/null differ
diff --git a/docs/design/dataflow.png b/docs/design/dataflow.png
deleted file mode 100644
index e4fbd35..0000000
Binary files a/docs/design/dataflow.png and /dev/null differ
diff --git a/docs/design/designs.graffle b/docs/design/designs.graffle
deleted file mode 100644
index 7035fba..0000000
Binary files a/docs/design/designs.graffle and /dev/null differ
diff --git a/docs/design/form/FormBuilder1-build.png b/docs/design/form/FormBuilder1-build.png
deleted file mode 100644
index 5c6c3ce..0000000
Binary files a/docs/design/form/FormBuilder1-build.png and /dev/null differ
diff --git a/docs/design/form/FormBuilder2-build.png b/docs/design/form/FormBuilder2-build.png
deleted file mode 100644
index 31e35b2..0000000
Binary files a/docs/design/form/FormBuilder2-build.png and /dev/null differ
diff --git a/docs/design/form/FormBuilder3-build.png b/docs/design/form/FormBuilder3-build.png
deleted file mode 100644
index 874a828..0000000
Binary files a/docs/design/form/FormBuilder3-build.png and /dev/null differ
diff --git a/docs/design/form/FormBuilder4-render.png b/docs/design/form/FormBuilder4-render.png
deleted file mode 100644
index b32510b..0000000
Binary files a/docs/design/form/FormBuilder4-render.png and /dev/null differ
diff --git a/docs/design/form/User-Task-Form-Completion-Flow.png b/docs/design/form/User-Task-Form-Completion-Flow.png
deleted file mode 100644
index 0c08f90..0000000
Binary files a/docs/design/form/User-Task-Form-Completion-Flow.png and /dev/null differ
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..f8e9e05
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,3 @@
+micronautVersion=1.2.6
+kotlinVersion=1.3.50
+zeebeVersion=0.21.1
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..91ca28c
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..774deab
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Fri Nov 22 16:34:48 EST 2019
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.3-all.zip
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStorePath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
diff --git a/gradlew b/gradlew
new file mode 100755
index 0000000..cccdd3d
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100755
index 0000000..e95643d
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/micronaut-cli.yml b/micronaut-cli.yml
new file mode 100644
index 0000000..33c936e
--- /dev/null
+++ b/micronaut-cli.yml
@@ -0,0 +1,5 @@
+profile: service
+defaultPackage: qtz
+---
+testFramework: kotlintest
+sourceLanguage: kotlin
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index 27d5d55..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,143 +0,0 @@
-
-
- 4.0.0
-
- com.github.stephenott
- Quintenssential-Tasklist-Zeebe
- 0.5
-
-
-
- UTF-8
- 1.8
- 1.8
- 3.8.1
- 0.21.0-alpha1
-
- com.github.stephenott.MainVerticle
-
-
-
-
-
- io.vertx
- vertx-stack-depchain
- ${vertx.version}
- pom
- import
-
-
-
- com.fasterxml.jackson
- jackson-bom
- 2.9.9
- pom
- import
-
-
-
-
-
-
-
- io.vertx
- vertx-core
-
-
- io.vertx
- vertx-config
-
-
- io.vertx
- vertx-config-yaml
-
-
- io.vertx
- vertx-circuit-breaker
-
-
- io.vertx
- vertx-web
-
-
- io.vertx
- vertx-web-client
-
-
-
- org.mongodb
- mongodb-driver-reactivestreams
- 1.12.0
-
-
-
- io.zeebe
- zeebe-client-java
- ${zeebe.version}
-
-
-
- com.fasterxml.jackson.module
- jackson-module-parameter-names
-
-
- com.fasterxml.jackson.datatype
- jackson-datatype-jdk8
-
-
- com.fasterxml.jackson.datatype
- jackson-datatype-jsr310
-
-
-
- org.slf4j
- slf4j-jdk14
- 1.7.28
-
-
-
-
- io.zeebe
- zeebe-test
- ${zeebe.version}
- test
-
-
-
- de.flapdoodle.embed
- de.flapdoodle.embed.mongo
- 2.2.0
- test
-
-
-
- io.vertx
- vertx-codegen
- processor
- provided
-
-
- io.vertx
- vertx-service-proxy
-
-
-
-
-
-
-
-
-
-
- maven-compiler-plugin
- 3.8.1
-
- 1.8
- 1.8
-
-
-
-
-
\ No newline at end of file
diff --git a/python-scripts/test1.py b/python-scripts/test1.py
new file mode 100644
index 0000000..3220e17
--- /dev/null
+++ b/python-scripts/test1.py
@@ -0,0 +1,22 @@
+import json
+import argparse
+
+parser = argparse.ArgumentParser()
+parser.add_argument('--inputs', dest='inputs')
+args = parser.parse_args()
+
+with open(args.inputs) as json_file:
+ data = json.load(json_file)
+
+# Do some work
+
+myResult = {
+ "commandResult": "success",
+ "detectedIp": True,
+ "ipList": [
+ "0.0.0.0", "0.2.3.4"
+ ],
+ "originalVarsFromZeebe": data
+}
+
+print(json.dumps(myResult))
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..9d0112c
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+rootProject.name="quintessential-tasklist-zeebe"
\ No newline at end of file
diff --git a/src/main/java/com/github/stephenott/MainVerticle.java b/src/main/java/com/github/stephenott/MainVerticle.java
deleted file mode 100644
index 5f7d3e0..0000000
--- a/src/main/java/com/github/stephenott/MainVerticle.java
+++ /dev/null
@@ -1,210 +0,0 @@
-package com.github.stephenott;
-
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
-import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
-import com.fasterxml.jackson.module.paramnames.ParameterNamesModule;
-import com.github.stephenott.common.EventBusableMessageCodec;
-import com.github.stephenott.conf.ApplicationConfiguration;
-import com.github.stephenott.executors.JobResult;
-import com.github.stephenott.executors.polyglot.ExecutorVerticle;
-import com.github.stephenott.executors.usertask.UserTaskExecutorVerticle;
-import com.github.stephenott.form.validator.FormValidationServerHttpVerticle;
-import com.github.stephenott.form.validator.ValidationRequest;
-import com.github.stephenott.form.validator.ValidationRequestResult;
-import com.github.stephenott.managementserver.ManagementHttpVerticle;
-import com.github.stephenott.usertask.*;
-import com.github.stephenott.usertask.mongo.MongoManager;
-import com.github.stephenott.zeebe.client.ZeebeClientVerticle;
-import com.mongodb.MongoClientSettings;
-import com.mongodb.reactivestreams.client.MongoClients;
-import io.vertx.config.ConfigRetriever;
-import io.vertx.config.ConfigRetrieverOptions;
-import io.vertx.config.ConfigStoreOptions;
-import io.vertx.core.*;
-import io.vertx.core.eventbus.EventBus;
-import io.vertx.core.json.Json;
-import io.vertx.core.json.JsonObject;
-import org.bson.codecs.configuration.CodecRegistry;
-import org.bson.codecs.pojo.PojoCodecProvider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.bson.codecs.configuration.CodecRegistries.*;
-
-public class MainVerticle extends AbstractVerticle {
-
- private Logger log = LoggerFactory.getLogger(MainVerticle.class);
-
- private EventBus eb;
-
- private ConfigRetriever appConfigRetriever;
- ApplicationConfiguration appConfig;
-
- @Override
- public void start() throws Exception {
- Json.mapper.registerModules(new ParameterNamesModule(), new Jdk8Module(), new JavaTimeModule());
- Json.prettyMapper.registerModules(new ParameterNamesModule(), new Jdk8Module(), new JavaTimeModule());
- Json.mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
- Json.prettyMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
-
-
- eb = vertx.eventBus();
-
- eb.registerDefaultCodec(FailedDbActionException.class, new EventBusableMessageCodec<>(FailedDbActionException.class));
- eb.registerDefaultCodec(JobResult.class, new EventBusableMessageCodec<>(JobResult.class));
- eb.registerDefaultCodec(DbActionResult.class, new EventBusableMessageCodec<>(DbActionResult.class));
- eb.registerDefaultCodec(CompletionRequest.class, new EventBusableMessageCodec<>(CompletionRequest.class));
- eb.registerDefaultCodec(GetRequest.class, new EventBusableMessageCodec<>(GetRequest.class));
- eb.registerDefaultCodec(ValidationRequest.class, new EventBusableMessageCodec<>(ValidationRequest.class));
- eb.registerDefaultCodec(ValidationRequestResult.class, new EventBusableMessageCodec<>(ValidationRequestResult.class));
-
- String configYmlPath = config().getString("configYmlPath");
-
- retrieveAppConfig(configYmlPath, result -> {
- if (result.succeeded()) {
- appConfig = result.result();
-
- //Setup Mongo:
- CodecRegistry registry = fromRegistries(
- MongoClients.getDefaultCodecRegistry(),
- fromProviders(PojoCodecProvider.builder()
- .automatic(true)
- .build())
- );
- MongoClientSettings mSettings = MongoClientSettings.builder()
- .codecRegistry(registry)
- .build();
- MongoManager.setClient(MongoClients.create(mSettings));
-
- //@TODO refactor this
- vertx.deployVerticle(UserTaskActionsVerticle.class, new DeploymentOptions());
- //@TODO refactor this
-
- deployUserTaskHttpServer(appConfig.getUserTaskServer());
-
-
- appConfig.getExecutors().forEach(this::deployExecutorVerticle);
-
- appConfig.getUserTaskExecutors().forEach(this::deployUserTaskExecutorVerticle);
-
- appConfig.getZeebe().getClients().forEach(this::deployZeebeClient);
-
- if (appConfig.getManagementServer().isEnabled()) {
- deployManagementClient(appConfig.getManagementServer());
- }
-
- if (appConfig.getFormValidatorServer().isEnabled()){
- deployFormValidationServer(appConfig.getFormValidatorServer());
- }
-
- } else {
- throw new IllegalStateException("Unable to read yml configuration", result.cause());
- }
- });
- }
-
- private void deployManagementClient(ApplicationConfiguration.ManagementHttpConfiguration config) {
- DeploymentOptions options = new DeploymentOptions()
- .setInstances(config.getInstances())
- .setConfig(JsonObject.mapFrom(config));
-
- vertx.deployVerticle(ManagementHttpVerticle::new, options, deployResult -> {
- if (deployResult.succeeded()) {
- log.info("Management Client has successfully deployed");
- } else {
- log.error("Management Client failed to deploy", deployResult.cause());
- }
- });
- }
-
- private void deployUserTaskHttpServer(ApplicationConfiguration.UserTaskHttpServerConfiguration config) {
- DeploymentOptions options = new DeploymentOptions()
- .setInstances(config.getInstances())
- .setConfig(JsonObject.mapFrom(config));
-
- vertx.deployVerticle(UserTaskHttpServerVerticle::new, options, deployResult -> {
- if (deployResult.succeeded()) {
- log.info("UserTask HTTP Server has successfully deployed");
- } else {
- log.error("UserTask HTTP Server failed to deploy", deployResult.cause());
- }
- });
- }
-
- private void deployFormValidationServer(ApplicationConfiguration.FormValidationServerConfiguration config) {
- DeploymentOptions options = new DeploymentOptions()
- .setInstances(config.getInstances())
- .setConfig(JsonObject.mapFrom(config));
-
- vertx.deployVerticle(FormValidationServerHttpVerticle::new, options, deployResult -> {
- if (deployResult.succeeded()) {
- log.info("Form Validation Server has successfully deployed");
- } else {
- log.error("Form Validation Server failed to deploy", deployResult.cause());
- }
- });
- }
-
-
- private void deployExecutorVerticle(ApplicationConfiguration.ExecutorConfiguration config) {
- DeploymentOptions options = new DeploymentOptions()
- .setInstances(config.getInstances())
- .setConfig(JsonObject.mapFrom(config));
-
- vertx.deployVerticle(ExecutorVerticle::new, options, vert -> {
- if (vert.succeeded()) {
- log.info("Executor Verticle " + config.getName() + " has successfully deployed (" + config.getInstances() + " instances)");
- } else {
- log.error("Executor Verticle " + config.getName() + " has failed to deploy!", vert.cause());
- }
- });
- }
-
- private void deployUserTaskExecutorVerticle(ApplicationConfiguration.UserTaskExecutorConfiguration config) {
- DeploymentOptions options = new DeploymentOptions();
- options.setConfig(JsonObject.mapFrom(config));
-
- vertx.deployVerticle(UserTaskExecutorVerticle::new, options, vert -> {
- if (vert.succeeded()) {
- log.info("UserTask Executor Verticle " + config.getName() + " has successfully deployed");
- } else {
- log.error("UserTask Executor Verticle " + config.getName() + " has failed to deploy!", vert.cause());
- }
- });
- }
-
- private void deployZeebeClient(ApplicationConfiguration.ZeebeClientConfiguration config) {
- DeploymentOptions options = new DeploymentOptions();
- options.setConfig(JsonObject.mapFrom(config));
-
- vertx.deployVerticle(ZeebeClientVerticle::new, options, vert -> {
- if (vert.succeeded()) {
- log.info("Zeebe Client Verticle " + config.getName() + " has successfully deployed");
- } else {
- log.error("Zeebe Client Verticle " + config.getName() + " has failed to deploy!", vert.cause());
- }
- });
- }
-
-
- private void retrieveAppConfig(String filePath, Handler> result) {
- ConfigStoreOptions store = new ConfigStoreOptions()
- .setType("file")
- .setFormat("yaml")
- .setConfig(new JsonObject()
- .put("path", filePath)
- );
-
- appConfigRetriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions().addStore(store));
-
- appConfigRetriever.getConfig(retrieverResult -> {
- if (retrieverResult.succeeded()) {
- result.handle(Future.succeededFuture(retrieverResult.result().mapTo(ApplicationConfiguration.class)));
-
- } else {
- result.handle(Future.failedFuture(retrieverResult.cause()));
- }
- });
- }
-}
diff --git a/src/main/java/com/github/stephenott/common/Common.java b/src/main/java/com/github/stephenott/common/Common.java
deleted file mode 100644
index 1cb3226..0000000
--- a/src/main/java/com/github/stephenott/common/Common.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.github.stephenott.common;
-
-public class Common {
-
- public static String JOB_ADDRESS_PREFIX = "job.";
-
-}
diff --git a/src/main/java/com/github/stephenott/common/EventBusable.java b/src/main/java/com/github/stephenott/common/EventBusable.java
deleted file mode 100644
index a37faf1..0000000
--- a/src/main/java/com/github/stephenott/common/EventBusable.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.github.stephenott.common;
-
-import io.vertx.core.json.JsonObject;
-
-public interface EventBusable {
-
- default JsonObject toJsonObject(){
- return JsonObject.mapFrom(this);
- }
-
-}
diff --git a/src/main/java/com/github/stephenott/common/EventBusableMessageCodec.java b/src/main/java/com/github/stephenott/common/EventBusableMessageCodec.java
deleted file mode 100644
index 7d7ab0e..0000000
--- a/src/main/java/com/github/stephenott/common/EventBusableMessageCodec.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.github.stephenott.common;
-
-import io.vertx.core.buffer.Buffer;
-import io.vertx.core.eventbus.MessageCodec;
-import io.vertx.core.json.Json;
-
-public class EventBusableMessageCodec implements MessageCodec {
-
- private Class tClass;
-
- public EventBusableMessageCodec(Class tClass) {
- this.tClass = tClass;
- }
-
- @Override
- public void encodeToWire(Buffer buffer, T t) {
- Buffer encoded = t.toJsonObject().toBuffer();
- buffer.appendInt(encoded.length());
- buffer.appendBuffer(encoded);
- }
-
- @Override
- public T decodeFromWire(int pos, Buffer buffer) {
- int length = buffer.getInt(pos);
- pos += 4;
- return Json.decodeValue(buffer.slice(pos, pos + length), tClass);
- }
-
- @Override
- public T transform(T t) {
- return t.toJsonObject().copy().mapTo(tClass);
- }
-
- @Override
- public String name() {
- return tClass.getCanonicalName();
- }
-
- @Override
- public byte systemCodecID() {
- return -1;
- }
-}
diff --git a/src/main/java/com/github/stephenott/common/EventBusableReplyException.java b/src/main/java/com/github/stephenott/common/EventBusableReplyException.java
deleted file mode 100644
index 755e519..0000000
--- a/src/main/java/com/github/stephenott/common/EventBusableReplyException.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.github.stephenott.common;
-
-import com.fasterxml.jackson.annotation.JsonAutoDetect;
-import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.github.stephenott.usertask.FailedDbActionException;
-import io.vertx.core.eventbus.ReplyException;
-import io.vertx.core.eventbus.ReplyFailure;
-
-@JsonAutoDetect(fieldVisibility = Visibility.NONE,
- getterVisibility = Visibility.NONE,
- setterVisibility = Visibility.NONE,
- isGetterVisibility = Visibility.NONE)
-public class EventBusableReplyException extends ReplyException implements EventBusable {
-
- @JsonProperty()
- private Enum> failureType;
-
- @JsonProperty()
- private String internalErrorMessage;
-
- @JsonProperty()
- private String userErrorMessage;
-//
-// public EventBusableReplyException(FailedDbActionException.FailureType failureType, Throwable internalError, String UserErrorMessage){
-// super(ReplyFailure.RECIPIENT_FAILURE, UserErrorMessage);
-// this.internalErrorMessage
-// }
-
- public EventBusableReplyException(Enum> failureType, String internalErrorMessage, String userErrorMessage) {
- super(ReplyFailure.RECIPIENT_FAILURE, userErrorMessage);
- this.internalErrorMessage = internalErrorMessage;
- this.userErrorMessage = userErrorMessage;
- this.failureType = failureType;
- }
-
- public String getInternalErrorMessage() {
- return internalErrorMessage;
- }
-
- public EventBusableReplyException setInternalErrorMessage(String internalErrorMessage) {
- this.internalErrorMessage = internalErrorMessage;
- return this;
- }
-
- public String getUserErrorMessage() {
- return userErrorMessage;
- }
-
- public EventBusableReplyException setUserErrorMessage(String userErrorMessage) {
- this.userErrorMessage = userErrorMessage;
- return this;
- }
-
- public Enum> getFailureType() {
- return failureType;
- }
-
- public EventBusableReplyException setFailureType(Enum> failureType) {
- this.failureType = failureType;
- return this;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/com/github/stephenott/conf/ApplicationConfiguration.java b/src/main/java/com/github/stephenott/conf/ApplicationConfiguration.java
deleted file mode 100644
index 3594b89..0000000
--- a/src/main/java/com/github/stephenott/conf/ApplicationConfiguration.java
+++ /dev/null
@@ -1,501 +0,0 @@
-package com.github.stephenott.conf;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.github.stephenott.executors.usertask.UserTaskConfiguration;
-
-import java.time.Duration;
-import java.util.List;
-import java.util.UUID;
-
-public class ApplicationConfiguration {
-
- private ZeebeConfiguration zeebe;
- private List executors;
- private List userTaskExecutors;
- private ManagementHttpConfiguration managementServer;
- private FormValidationServerConfiguration formValidatorServer;
- private UserTaskHttpServerConfiguration userTaskServer;
-
- public ApplicationConfiguration() {
- }
-
- public ZeebeConfiguration getZeebe() {
- return zeebe;
- }
-
- public void setZeebe(ZeebeConfiguration zeebe) {
- this.zeebe = zeebe;
- }
-
- public List getExecutors() {
- return executors;
- }
-
- public void setExecutors(List executors) {
- this.executors = executors;
- }
-
- public List getUserTaskExecutors() {
- return userTaskExecutors;
- }
-
- public void setUserTaskExecutors(List userTaskExecutors) {
- this.userTaskExecutors = userTaskExecutors;
- }
-
- public ManagementHttpConfiguration getManagementServer() {
- return managementServer;
- }
-
- public void setManagementServer(ManagementHttpConfiguration managementServer) {
- this.managementServer = managementServer;
- }
-
- public FormValidationServerConfiguration getFormValidatorServer() {
- return formValidatorServer;
- }
-
- public ApplicationConfiguration setFormValidatorServer(FormValidationServerConfiguration formValidatorServer) {
- this.formValidatorServer = formValidatorServer;
- return this;
- }
-
- public UserTaskHttpServerConfiguration getUserTaskServer() {
- return userTaskServer;
- }
-
- public ApplicationConfiguration setUserTaskServer(UserTaskHttpServerConfiguration userTaskServer) {
- this.userTaskServer = userTaskServer;
- return this;
- }
-
- public static class ZeebeConfiguration{
- private List clients;
-
- public ZeebeConfiguration() {
- }
-
- public List getClients() {
- return clients;
- }
-
- public void setClients(List clients) {
- this.clients = clients;
- }
- }
-
-
- public static class ZeebeClientConfiguration{
- private String name;
- private String brokerContactPoint = "localhost:25600";
-
- @JsonFormat(shape = JsonFormat.Shape.STRING)
- private Duration requestTimeout = Duration.ofSeconds(10);
-
- private List workers;
-
- public ZeebeClientConfiguration() {
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getBrokerContactPoint() {
- return brokerContactPoint;
- }
-
- public void setBrokerContactPoint(String brokerContactPoint) {
- this.brokerContactPoint = brokerContactPoint;
- }
-
- public Duration getRequestTimeout() {
- return requestTimeout;
- }
-
- public void setRequestTimeout(Duration requestTimeout) {
- this.requestTimeout = requestTimeout;
- }
-
- public List getWorkers() {
- return workers;
- }
-
- public void setWorkers(List workers) {
- this.workers = workers;
- }
- }
-
-
- public static class ZeebeWorkers {
- private String name;
- private List jobTypes;
-
- @JsonFormat(shape = JsonFormat.Shape.STRING)
- private Duration timeout = Duration.ofSeconds(10);
-
- public ZeebeWorkers() {
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public List getJobTypes() {
- return jobTypes;
- }
-
- public void setJobTypes(List jobTypes) {
- this.jobTypes = jobTypes;
- }
-
- /**
- * The Timeout of how long the Job is locked to the worker / subscription
- * @return
- */
- public Duration getTimeout() {
- return timeout;
- }
-
- public ZeebeWorkers setTimeout(Duration timeout) {
- this.timeout = timeout;
- return this;
- }
- }
-
-
- public static class ExecutorConfiguration {
- private String name;
- private String address;
- private String execute;
- private int instances = 1;
-
- public ExecutorConfiguration() {
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getAddress() {
- return address;
- }
-
- public void setAddress(String address) {
- this.address = address;
- }
-
- public String getExecute() {
- return execute;
- }
-
- public void setExecute(String execute) {
- this.execute = execute;
- }
-
- public int getInstances() {
- return instances;
- }
-
- public void setInstances(int instances) {
- this.instances = instances;
- }
- }
-
- public static class ManagementHttpConfiguration {
- private boolean enabled = true;
- private String apiRoot = UUID.randomUUID().toString();
- private ZeebeClientConfiguration zeebeClient;
- private String fileUploadPath = "./tmp/uploads";
- private int instances = 1;
- private int port = 8080;
- private String corsRegex;
-
- public ManagementHttpConfiguration() {
- }
-
- public boolean isEnabled() {
- return enabled;
- }
-
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-
- public String getApiRoot() {
- return apiRoot;
- }
-
- public void setApiRoot(String apiRoot) {
- this.apiRoot = apiRoot;
- }
-
- public ZeebeClientConfiguration getZeebeClient() {
- return zeebeClient;
- }
-
- public void setZeebeClient(ZeebeClientConfiguration zeebeClient) {
- this.zeebeClient = zeebeClient;
- }
-
- public String getFileUploadPath() {
- return fileUploadPath;
- }
-
- public void setFileUploadPath(String fileUploadPath) {
- this.fileUploadPath = fileUploadPath;
- }
-
- public int getInstances() {
- return instances;
- }
-
- public void setInstances(int instances) {
- this.instances = instances;
- }
-
- public int getPort() {
- return port;
- }
-
- public void setPort(int port) {
- this.port = port;
- }
-
- public String getCorsRegex() {
- return corsRegex;
- }
-
- public void setCorsRegex(String corsRegex) {
- this.corsRegex = corsRegex;
- }
- }
-
- public static class UserTaskExecutorConfiguration {
- private String name;
- private String address;
- private UserTaskConfiguration defaults;
- private UserTaskConfiguration overrides;
- private int instances;
-
- public UserTaskExecutorConfiguration() {
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getAddress() {
- return address;
- }
-
- public void setAddress(String address) {
- this.address = address;
- }
-
- public UserTaskConfiguration getDefaults() {
- return defaults;
- }
-
- public void setDefaults(UserTaskConfiguration defaults) {
- this.defaults = defaults;
- }
-
- public UserTaskConfiguration getOverrides() {
- return overrides;
- }
-
- public void setOverrides(UserTaskConfiguration overrides) {
- this.overrides = overrides;
- }
-
- public int getInstances() {
- return instances;
- }
-
- public void setInstances(int instances) {
- this.instances = instances;
- }
- }
-
- /**
- * The Form Validation Server (Verticle)
- */
- public static class FormValidationServerConfiguration {
- private boolean enabled = true;
- private int instances = 1;
- private int port = 8082;
- private String corsRegex;
- private String address = "form-validation";
- private FormValidatorServiceConfiguration formValidatorService;
-
- public FormValidationServerConfiguration() {
- }
-
- public boolean isEnabled() {
- return enabled;
- }
-
- public FormValidationServerConfiguration setEnabled(boolean enabled) {
- this.enabled = enabled;
- return this;
- }
-
- public int getInstances() {
- return instances;
- }
-
- public FormValidationServerConfiguration setInstances(int instances) {
- this.instances = instances;
- return this;
- }
-
- public int getPort() {
- return port;
- }
-
- public FormValidationServerConfiguration setPort(int port) {
- this.port = port;
- return this;
- }
-
- public String getCorsRegex() {
- return corsRegex;
- }
-
- public FormValidationServerConfiguration setCorsRegex(String corsRegex) {
- this.corsRegex = corsRegex;
- return this;
- }
-
- public String getAddress() {
- return address;
- }
-
- public FormValidationServerConfiguration setAddress(String address) {
- this.address = address;
- return this;
- }
-
- public FormValidatorServiceConfiguration getFormValidatorService() {
- return formValidatorService;
- }
-
- public FormValidationServerConfiguration setFormValidatorService(FormValidatorServiceConfiguration formValidatorService) {
- this.formValidatorService = formValidatorService;
- return this;
- }
- }
-
- /**
- * The Form Validator Service
- * (The external service that is communicated over HTTP that performs
- * the actual validation against the supplied schema)
- */
- public static class FormValidatorServiceConfiguration {
- private String host = "localhost";
- private int port = 8083;
- private String validateUri = "/validate";
- private long requestTimeout = 5000;
-
- public FormValidatorServiceConfiguration() {
- }
-
- public String getHost() {
- return host;
- }
-
- public FormValidatorServiceConfiguration setHost(String host) {
- this.host = host;
- return this;
- }
-
- public int getPort() {
- return port;
- }
-
- public FormValidatorServiceConfiguration setPort(int port) {
- this.port = port;
- return this;
- }
-
- public String getValidateUri() {
- return validateUri;
- }
-
- public FormValidatorServiceConfiguration setValidateUri(String validateUri) {
- this.validateUri = validateUri;
- return this;
- }
-
- //@TODO Refactor this to support the java8 Duration class
- public long getRequestTimeout() {
- return requestTimeout;
- }
-
- public FormValidatorServiceConfiguration setRequestTimeout(long requestTimeout) {
- this.requestTimeout = requestTimeout;
- return this;
- }
- }
-
- public static class UserTaskHttpServerConfiguration {
- private boolean enabled = true;
- private int instances = 1;
- private int port = 8080;
- private String corsRegex;
-
- public boolean isEnabled() {
- return enabled;
- }
-
- public UserTaskHttpServerConfiguration setEnabled(boolean enabled) {
- this.enabled = enabled;
- return this;
- }
-
- public int getInstances() {
- return instances;
- }
-
- public UserTaskHttpServerConfiguration setInstances(int instances) {
- this.instances = instances;
- return this;
- }
-
- public int getPort() {
- return port;
- }
-
- public UserTaskHttpServerConfiguration setPort(int port) {
- this.port = port;
- return this;
- }
-
- public String getCorsRegex() {
- return corsRegex;
- }
-
- public UserTaskHttpServerConfiguration setCorsRegex(String corsRegex) {
- this.corsRegex = corsRegex;
- return this;
- }
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/com/github/stephenott/conf/config.json b/src/main/java/com/github/stephenott/conf/config.json
deleted file mode 100644
index f1f6201..0000000
--- a/src/main/java/com/github/stephenott/conf/config.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "configYmlPath": "./zeebe.yml"
-}
\ No newline at end of file
diff --git a/src/main/java/com/github/stephenott/executors/JobResult.java b/src/main/java/com/github/stephenott/executors/JobResult.java
deleted file mode 100644
index 6b9c714..0000000
--- a/src/main/java/com/github/stephenott/executors/JobResult.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package com.github.stephenott.executors;
-
-import com.github.stephenott.common.EventBusable;
-import io.vertx.core.json.JsonObject;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-
-public class JobResult implements EventBusable {
-
- private Result result;
- private long jobKey;
- private Map variables = new HashMap<>();
- private int retries;
- private String errorMessage = "An error occurred";
-
- public enum Result {
- COMPLETE,
- FAIL
- }
-
- private JobResult() {
- }
-
- public JobResult(long jobKey, Result result, Map variables, int retries, String errorMessage) {
- Objects.requireNonNull(result);
-
- this.result = result;
- this.jobKey = jobKey;
- this.variables = variables;
- this.retries = retries;
- this.errorMessage = errorMessage;
- }
-
- public JobResult(long jobKey, Result result, int retries) {
- this(jobKey, result, null, retries, null);
- }
-
- /**
- * Will set retries to 0.
- * @param jobKey
- * @param result
- */
- public JobResult(long jobKey, Result result) {
- setJobKey(jobKey);
- setResult(result);
- }
-
- public Result getResult() {
- return result;
- }
-
- public JobResult setResult(Result result) {
- this.result = result;
- return this;
- }
-
- public long getJobKey() {
- return jobKey;
- }
-
- public JobResult setJobKey(long jobKey) {
- this.jobKey = jobKey;
- return this;
- }
-
- public Map getVariables() {
- return variables;
- }
-
- public JobResult setVariables(Map variables) {
- this.variables = variables;
- return this;
- }
-
- public int getRetries() {
- return retries;
- }
-
- public JobResult setRetries(int retries) {
- this.retries = retries;
- return this;
- }
-
- public String getErrorMessage() {
- return errorMessage;
- }
-
- public JobResult setErrorMessage(String errorMessage) {
- this.errorMessage = errorMessage;
- return this;
- }
-
- // public JsonObject toJsonObject(){
-// return JsonObject.mapFrom(this);
-// }
-//
-// public static JobResult fromJsonObject(JsonObject doneJob){
-// return doneJob.mapTo(JobResult.class);
-// }
-
-}
\ No newline at end of file
diff --git a/src/main/java/com/github/stephenott/executors/polyglot/ExecutorVerticle.java b/src/main/java/com/github/stephenott/executors/polyglot/ExecutorVerticle.java
deleted file mode 100644
index f8a63ba..0000000
--- a/src/main/java/com/github/stephenott/executors/polyglot/ExecutorVerticle.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.github.stephenott.executors.polyglot;
-
-import com.github.stephenott.common.Common;
-import com.github.stephenott.executors.JobResult;
-import com.github.stephenott.conf.ApplicationConfiguration;
-import io.vertx.core.AbstractVerticle;
-import io.vertx.core.eventbus.EventBus;
-import io.vertx.core.json.JsonObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ExecutorVerticle extends AbstractVerticle {
-
- private Logger log = LoggerFactory.getLogger(ExecutorVerticle.class);
-
- private EventBus eb;
- private ApplicationConfiguration.ExecutorConfiguration executorConfiguration;
-
- @Override
- public void start() throws Exception {
- try {
- executorConfiguration = config().mapTo(ApplicationConfiguration.ExecutorConfiguration.class);
- log.info("Executor Config: " + JsonObject.mapFrom(executorConfiguration).toString());
- } catch (Exception e){
- throw new IllegalStateException("Could not load executor configuration");
- }
-
- eb = vertx.eventBus();
-
- String address = Common.JOB_ADDRESS_PREFIX + executorConfiguration.getAddress();
-
- eb.consumer(address, handler -> {
- log.info("doing some work!!!");
-
- String sourceClient = handler.headers().get("sourceClient");
-
- JsonObject job = handler.body();
-
- //@TODO Add polyexecutor
-
- JobResult jobResult = new JobResult(
- job.getLong("key"),
- JobResult.Result.COMPLETE,
- (job.getInteger("retries") > 0) ? job.getInteger("retries") - 1 : 0);
-
- eb.send(sourceClient + ".job-action.completion", jobResult);
-
- });
- }
-}
diff --git a/src/main/java/com/github/stephenott/executors/usertask/UserTaskConfiguration.java b/src/main/java/com/github/stephenott/executors/usertask/UserTaskConfiguration.java
deleted file mode 100644
index 3ed0b11..0000000
--- a/src/main/java/com/github/stephenott/executors/usertask/UserTaskConfiguration.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package com.github.stephenott.executors.usertask;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class UserTaskConfiguration {
-
- private String title;
- private String description;
- private int priority = 0;
- private String assignee;
- private String candidateGroups;
- private String candidateUsers;
- private String dueDate;
- private String formKey;
-
- public UserTaskConfiguration() {
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public int getPriority() {
- return priority;
- }
-
- public void setPriority(int priority) {
- this.priority = priority;
- }
-
- public String getAssignee() {
- return assignee;
- }
-
- public void setAssignee(String assignee) {
- this.assignee = assignee;
- }
-
- public String getCandidateGroups() {
- return candidateGroups;
- }
-
- public void setCandidateGroups(String candidateGroups) {
- this.candidateGroups = candidateGroups;
- }
-
- public String getCandidateUsers() {
- return candidateUsers;
- }
-
- public void setCandidateUsers(String candidateUsers) {
- this.candidateUsers = candidateUsers;
- }
-
- public String getDueDate() {
- return dueDate;
- }
-
- public void setDueDate(String dueDate) {
- this.dueDate = dueDate;
- }
-
- public String getFormKey() {
- return formKey;
- }
-
- public void setFormKey(String formKey) {
- this.formKey = formKey;
- }
-}
-
diff --git a/src/main/java/com/github/stephenott/executors/usertask/UserTaskExecutorVerticle.java b/src/main/java/com/github/stephenott/executors/usertask/UserTaskExecutorVerticle.java
deleted file mode 100644
index 46e5e2a..0000000
--- a/src/main/java/com/github/stephenott/executors/usertask/UserTaskExecutorVerticle.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package com.github.stephenott.executors.usertask;
-
-import com.github.stephenott.common.Common;
-import com.github.stephenott.conf.ApplicationConfiguration;
-import com.github.stephenott.executors.JobResult;
-import com.github.stephenott.usertask.entity.UserTaskEntity;
-import com.github.stephenott.usertask.mongo.MongoManager;
-import com.github.stephenott.usertask.mongo.Subscribers;
-import com.github.stephenott.usertask.mongo.Subscribers.SimpleSubscriber;
-import com.mongodb.reactivestreams.client.MongoCollection;
-import com.mongodb.reactivestreams.client.Success;
-import io.vertx.core.AbstractVerticle;
-import io.vertx.core.Future;
-import io.vertx.core.Promise;
-import io.vertx.core.eventbus.EventBus;
-import io.vertx.core.json.Json;
-import io.vertx.core.json.JsonObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.time.Instant;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.UUID;
-
-public class UserTaskExecutorVerticle extends AbstractVerticle {
-
- private final Logger log = LoggerFactory.getLogger(UserTaskExecutorVerticle.class);
-
- private EventBus eb;
-
- private ApplicationConfiguration.UserTaskExecutorConfiguration utExecutorConfig;
-
- private MongoCollection tasksCollection = MongoManager.getDatabase().getCollection("tasks", UserTaskEntity.class);
-
- @Override
- public void start() throws Exception {
- try {
- utExecutorConfig = config().mapTo(ApplicationConfiguration.UserTaskExecutorConfiguration.class);
- } catch (Exception e) {
- log.error("Unable to parse Ut Executor Config", e);
- throw e;
- }
-
- eb = vertx.eventBus();
-
- String address = Common.JOB_ADDRESS_PREFIX + utExecutorConfig.getAddress();
-
- eb.consumer(address, handler -> {
-
- log.info("User Task({}) has captured some Work.", address);
-
- String sourceClient = handler.headers().get("sourceClient");
- //@TODO add handler if sourceClient is missing then reject job.
-
- UserTaskConfiguration utConfig = handler.body()
- .getJsonObject("customHeaders")
- .mapTo(UserTaskConfiguration.class);
-
- UserTaskEntity utEntity = new UserTaskEntity()
- .setZeebeSource(sourceClient)
- .setTaskId("user-task--" + UUID.randomUUID().toString())
- .setTitle(utConfig.getTitle())
- .setDescription(utConfig.getDescription())
- .setPriority(utConfig.getPriority())
- .setAssignee(utConfig.getAssignee())
- .setCandidateGroups((utConfig.getCandidateGroups() != null) ? new HashSet(Arrays.asList(utConfig.getCandidateGroups().split(","))) : null)
- .setCandidateUsers((utConfig.getCandidateUsers() != null) ? new HashSet(Arrays.asList(utConfig.getCandidateUsers().split(","))) : null)
- .setDueDate((utConfig.getDueDate() != null) ? Instant.parse(utConfig.getDueDate()) : null)
- .setFormKey(utConfig.getFormKey())
- .setZeebeDeadline(Instant.ofEpochMilli(handler.body().getLong("deadline")))
- .setZeebeJobKey(handler.body().getLong("key"))
- .setBpmnProcessId(handler.body().getString("bpmnProcessId"))
- .setBpmnProcessVersion(handler.body().getInteger("workflowDefinitionVersion"))
- .setZeebeVariables(((JsonObject) Json.decodeValue(handler.body().getString("variables"))).getMap())
- .setTaskOriginalCapture(Instant.now());
-
- log.info("User Task created: {}", JsonObject.mapFrom(utEntity).toString());
-
- saveToDb(utEntity).setHandler(res -> {
- if (res.succeeded()) {
- log.info("UserTaskEntity has been saved to DB...");
- } else {
- //@TODO update with better error
- throw new IllegalStateException("Unable to save to DB", res.cause());
- }
- });
-
- });
-
- log.info("User Task Executor Verticle consuming tasks at: {}", utExecutorConfig.getAddress());
- }
-
- public Future saveToDb(UserTaskEntity entity) {
- Promise promise = Promise.promise();
-
- tasksCollection.insertOne(entity)
- .subscribe(new SimpleSubscriber().singleResult(result -> {
- if (result.succeeded()) {
- promise.complete();
- } else {
- promise.fail(result.cause());
- }
- }));
-
- return promise.future();
- }
-}
diff --git a/src/main/java/com/github/stephenott/form/validator/FormValidationServerHttpVerticle.java b/src/main/java/com/github/stephenott/form/validator/FormValidationServerHttpVerticle.java
deleted file mode 100644
index a83e950..0000000
--- a/src/main/java/com/github/stephenott/form/validator/FormValidationServerHttpVerticle.java
+++ /dev/null
@@ -1,190 +0,0 @@
-package com.github.stephenott.form.validator;
-
-import com.github.stephenott.conf.ApplicationConfiguration;
-import com.github.stephenott.form.validator.exception.ValidationRequestResultException;
-import com.github.stephenott.form.validator.exception.ValidationRequestResultException.ErrorType;
-import io.vertx.core.*;
-import io.vertx.core.eventbus.EventBus;
-import io.vertx.core.http.HttpMethod;
-import io.vertx.core.http.HttpServer;
-import io.vertx.core.http.HttpServerResponse;
-import io.vertx.core.json.JsonObject;
-import io.vertx.ext.web.Route;
-import io.vertx.ext.web.Router;
-import io.vertx.ext.web.client.WebClient;
-import io.vertx.ext.web.client.WebClientOptions;
-import io.vertx.ext.web.handler.BodyHandler;
-import io.vertx.ext.web.handler.CorsHandler;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static com.github.stephenott.form.validator.ValidationRequestResult.*;
-import static com.github.stephenott.form.validator.ValidationRequestResult.InvalidResult;
-import static com.github.stephenott.form.validator.ValidationRequestResult.ValidResult;
-
-public class FormValidationServerHttpVerticle extends AbstractVerticle {
-
- private Logger log = LoggerFactory.getLogger(FormValidationServerHttpVerticle.class);
-
- private WebClient webClient;
-
- private EventBus eb;
-
- private ApplicationConfiguration.FormValidationServerConfiguration formValidationServerConfig;
-
- @Override
- public void start() throws Exception {
- formValidationServerConfig = config().mapTo(ApplicationConfiguration.FormValidationServerConfiguration.class);
-
- eb = vertx.eventBus();
-
- if (formValidationServerConfig.isEnabled()) {
-
- WebClientOptions webClientOptions = new WebClientOptions();
- webClient = WebClient.create(vertx, webClientOptions);
-
- Router mainRouter = Router.router(vertx);
- HttpServer server = vertx.createHttpServer();
-
- mainRouter.route().failureHandler(failure -> {
-
- int statusCode = failure.statusCode();
-
- HttpServerResponse response = failure.response();
- response.setStatusCode(statusCode)
- .end(new JsonObject().put("error", failure.failure().getLocalizedMessage()).toBuffer());
- });
-
- establishFormValidationRoute(mainRouter);
-
- server.requestHandler(mainRouter)
- .listen(formValidationServerConfig.getPort());
-
- }
-
- //@TODO Add a EB config toggle
- establishFormValidationEbConsumer();
-
- log.info("Form Validation Server deployed at: localhost:...., CORS is .... ");
- }
-
- @Override
- public void stop() throws Exception {
- super.stop();
- }
-
- private void establishFormValidationRoute(Router router) {
- Route route = router.route(HttpMethod.POST, "/validate")
- .consumes("application/json")
- .produces("application/json");
-
- if (formValidationServerConfig.getCorsRegex() != null) {
- route.handler(CorsHandler.create(formValidationServerConfig.getCorsRegex()));
- }
-
- route.handler(BodyHandler.create());
-
- route.handler(rc -> { //routing context
- //@TODO add a generic helper to parse and handler errors or look at using a "throws" in the method def
- // without this try the error is hidden from the logs
- ValidationRequest request;
- try {
- request = rc.getBodyAsJson().mapTo(ValidationRequest.class);
-
- } catch (Exception e) {
- throw new IllegalArgumentException("Unable to parse body", e);
- }
-
- validateFormSubmission(request, handler -> {
- if (handler.succeeded()) {
- if (handler.result().getResult().equals(Result.VALID)) {
- rc.response()
- .setStatusCode(202)
- .putHeader("content-type", "application/json; charset=utf-8")
- .end(JsonObject.mapFrom(handler.result().getValidResultObject()).toBuffer());
- } else {
- rc.response()
- .setStatusCode(400)
- .putHeader("content-type", "application/json; charset=utf-8")
- .end(JsonObject.mapFrom(handler.result().getInvalidResultObject()).toBuffer());
- }
-
- } else {
- log.error("Unable to execute validation request", handler.cause());
- rc.fail(500, handler.cause());
- }
- });
- });
- }
-
- private void establishFormValidationEbConsumer() {
-
- String address = "forms.action.validate";
-
- eb.consumer(address, ebHandler -> {
-
- validateFormSubmission(ebHandler.body(), valResult -> {
- if (valResult.succeeded()) {
- ebHandler.reply(valResult.result());
- } else {
- if (valResult.cause().getClass().equals(ValidationRequestResultException.class)){
- ValidationRequestResultException exception = (ValidationRequestResultException)valResult.cause();
- ebHandler.reply(GenerateErrorResult(new ErrorResult(exception.getErrorType(),exception.getMessage(), exception.getCause().getMessage())));
-
- } else {
- //@TODO refactor to rethrow a critial error for monitoring purposes.
- log.error("Unexpected result returned from validationFormSubmission, and thus unable to reply to " +
- "EB message for validation request... Something went wrong...", valResult.cause());
- }
- }
- });
- }).exceptionHandler(error -> log.error("Could not read Validation Request message from EB", error));
- }
-
- public void validateFormSubmission(ValidationRequest validationRequest, Handler> handler) {
- //@TODO Refactor this to reduce the wordiness...
- ApplicationConfiguration.FormValidatorServiceConfiguration validatorConfig = formValidationServerConfig.getFormValidatorService();
-
- String host = validatorConfig.getHost();
- int port = validatorConfig.getPort();
- long requestTimeout = validatorConfig.getRequestTimeout();
- String validateUri = validatorConfig.getValidateUri();
-
- log.info("BODY: " + JsonObject.mapFrom(new ValidationServiceRequest(validationRequest)).toString());
-
- //@TODO look at using the .expect predicate methods as part of .post() rather than using the if statusCode...
- webClient.post(port, host, validateUri)
- .timeout(requestTimeout)
- .sendJson(new ValidationServiceRequest(validationRequest), res -> {
- if (res.succeeded()) {
-
- int statusCode = res.result().statusCode();
-
- if (statusCode == 202) {
- log.info("FORMIO 202 RESULT: " + res.result().bodyAsString());
- handler.handle(Future.succeededFuture(GenerateValidResult(res.result().bodyAsJson(ValidResult.class))));
-
- } else if (statusCode == 400) {
- log.info("FORMIO 400 RESULT: " + res.result().bodyAsString());
- handler.handle(Future.succeededFuture(GenerateInvalidResult(res.result().bodyAsJson(InvalidResult.class))));
-
- } else {
- log.error("Unexpected response returned by form validator: code:" + res.result().statusCode() + ". Body: " + res.result().bodyAsString());
-
- handler.handle(Future.failedFuture(
- new ValidationRequestResultException(ErrorType.UNEXPECTED_STATUS_CODE,
- "Unexpected response returned by form validator: code:" + res.result().statusCode() + ". Body: " + res.result().bodyAsString(),
- "Something went wrong with validation server.")));
- }
-
- } else {
- log.error("Unable to complete HTTP request to validation server", res.cause());
-
- handler.handle(Future.failedFuture(
- new ValidationRequestResultException(ErrorType.HTTP_REQ_FAILURE,
- "Internal Message: Unable to complete HTTP request to validation server, cause: " + res.cause().getLocalizedMessage(),
- "Something went wrong while trying to contact validation server.")));
- }
- });
- }
-}
diff --git a/src/main/java/com/github/stephenott/form/validator/ValidationRequest.java b/src/main/java/com/github/stephenott/form/validator/ValidationRequest.java
deleted file mode 100644
index 01caf45..0000000
--- a/src/main/java/com/github/stephenott/form/validator/ValidationRequest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.github.stephenott.form.validator;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.github.stephenott.common.EventBusable;
-
-
-public class ValidationRequest implements EventBusable {
-
- @JsonProperty(required = true)
- private ValidationSchemaObject schema;
-
- @JsonProperty(required = true)
- private ValidationSubmissionObject submission;
-
- public ValidationRequest() {
- }
-
- public ValidationSchemaObject getSchema() {
- return schema;
- }
-
- public ValidationRequest setSchema(ValidationSchemaObject schema) {
- this.schema = schema;
- return this;
- }
-
- public ValidationSubmissionObject getSubmission() {
- return submission;
- }
-
- public ValidationRequest setSubmission(ValidationSubmissionObject submission) {
- this.submission = submission;
- return this;
- }
-}
diff --git a/src/main/java/com/github/stephenott/form/validator/ValidationRequestResult.java b/src/main/java/com/github/stephenott/form/validator/ValidationRequestResult.java
deleted file mode 100644
index 509b6d5..0000000
--- a/src/main/java/com/github/stephenott/form/validator/ValidationRequestResult.java
+++ /dev/null
@@ -1,208 +0,0 @@
-package com.github.stephenott.form.validator;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.github.stephenott.common.EventBusable;
-import com.github.stephenott.form.validator.exception.ValidationRequestResultException;
-import io.vertx.core.json.JsonObject;
-
-import java.util.List;
-import java.util.Map;
-
-public class ValidationRequestResult implements EventBusable {
-
- @JsonProperty(required = true)
- private Result result;
-
- private ValidResult validResultObject = null;
- private InvalidResult invalidResultObject = null;
- private ErrorResult errorResult = null;
-
- public enum Result {
- VALID,
- INVALID,
- ERROR
- }
-
- public ValidationRequestResult() {
- }
-
- public static ValidationRequestResult GenerateValidResult(ValidResult validResultObject){
- return new ValidationRequestResult()
- .setResult(Result.VALID)
- .setValidResultObject(validResultObject);
- }
-
- public static ValidationRequestResult GenerateInvalidResult(InvalidResult invalidResultObject){
- return new ValidationRequestResult()
- .setResult(Result.INVALID)
- .setInvalidResultObject(invalidResultObject);
- }
-
- public static ValidationRequestResult GenerateErrorResult(ErrorResult errorResult){
- return new ValidationRequestResult()
- .setResult(Result.ERROR)
- .setErrorResult(errorResult);
- }
-
- public Result getResult() {
- return result;
- }
-
- public ValidationRequestResult setResult(Result result) {
- this.result = result;
- return this;
- }
-
- public ValidResult getValidResultObject() {
- return validResultObject;
- }
-
- public ValidationRequestResult setValidResultObject(ValidResult validResultObject) {
- this.validResultObject = validResultObject;
- return this;
- }
-
- public InvalidResult getInvalidResultObject() {
- return invalidResultObject;
- }
-
- public ValidationRequestResult setInvalidResultObject(InvalidResult invalidResultObject) {
- this.invalidResultObject = invalidResultObject;
- return this;
- }
-
- public ErrorResult getErrorResult() {
- return errorResult;
- }
-
- public ValidationRequestResult setErrorResult(ErrorResult errorResult) {
- this.errorResult = errorResult;
- return this;
- }
-
- public static class ValidResult {
-
- @JsonProperty("processed_submission")
- private Map processedSubmission;
-
- public ValidResult() {
- }
-
- public Map getProcessedSubmission() {
- return processedSubmission;
- }
-
- public ValidResult setProcessedSubmission(Map processedSubmission) {
- this.processedSubmission = processedSubmission;
- return this;
- }
- }
-
-
- public static class InvalidResult{
-
- private boolean isJoi;
-
- private String name;
-
- private List