diff --git a/README.md b/README.md index 1b4f4d3f7..5e99138db 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ Camunda BPM examples is a collection of focused usage examples for the [camunda | Camunda Version | Link | Checkout command | | -----------------|----------------------------------------------------------------------|-----------------------| | Latest | [Master branch](https://github.com/camunda/camunda-bpm-examples) | `git checkout master` | +| 7.12 | [7.12 tag](https://github.com/camunda/camunda-bpm-examples/tree/7.12)| `git checkout 7.12` | | 7.11 | [7.11 tag](https://github.com/camunda/camunda-bpm-examples/tree/7.11)| `git checkout 7.11` | | 7.10 | [7.10 tag](https://github.com/camunda/camunda-bpm-examples/tree/7.10)| `git checkout 7.10` | | 7.9 | [7.9 tag](https://github.com/camunda/camunda-bpm-examples/tree/7.9) | `git checkout 7.9` | @@ -40,6 +41,7 @@ If you clone this repository, use the checkout commands to access the sources fo * [SDK-JS Examples](#sdk-js-examples) * [Authentication](#authentication) * [Spring Boot Starter examples](#spring-boot-starter-examples) +* [External Task Client examples](#external-task-client-examples) ### Getting Started with camunda BPM @@ -60,9 +62,10 @@ If you clone this repository, use the checkout commands to access the sources fo | [Service Invocation Asynchronous](/servicetask/service-invocation-asynchronous) | Unit Test | Signal, Async | | [User Task Assignment Email](/usertask/task-assignment-email) * | All | Email, Usertask | | [User Task Form Embedded](/usertask/task-form-embedded) * | All | Html, Form, Usertask | -| [User Task Form Embedded - Serialized Java Object](/usertask/task-form-embedded-serialized-java-object) * | All | Html, Form, Usertask | +| [User Task Form Embedded - Serialized Java Object](/usertask/task-form-embedded-serialized-java-object) * | All | Html, Form, Usertask | | [User Task Form Embedded - JSON](/usertask/task-form-embedded-json) * | All | Html, Form, Usertask | | [User Task Form Embedded - Bpmn Elements](/usertask/task-form-embedded-bpmn-events) * | All | Html, Form, Usertask | +| [User Task Form Embedded - React](/usertask/task-form-embedded-react) * | All | Html, Form, Usertask | | [User Task Form Generated](/usertask/task-form-generated) * | All | Html, Form, Usertask | | [User Task Form JSF](/usertask/task-form-external-jsf) * | JavaEE Containers | JSF, Form, Usertask | | [Script Task XSLT](/scripttask/xslt-scripttask) | Unit Test | XSLT Scripttask | @@ -78,15 +81,12 @@ If you clone this repository, use the checkout commands to access the sources fo | ----------------------------------------------------------------------------------------------|-----------------------|---------------------------| | [Process Application - Servlet](deployment/servlet-pa) | All | War, Servlet | | [Process Application - EJB](deployment/ejb-pa) | JavaEE Containers | Ejb, War | -| [Process Application - Spring Servlet - JBoss](deployment/spring-servlet-pa-jboss) | JBoss AS 7 | Spring, Servlet, War | +| [Process Application - Spring Servlet - WildFly](deployment/spring-servlet-pa-wildfly) | WildFly | Spring, Servlet, War | | [Process Application - Spring Servlet - Embedded Tomcat](deployment/spring-servlet-pa-tomcat) | Tomcat | Spring, Servlet, War | | [Embedded Spring with embedded REST](deployment/embedded-spring-rest) | vanilla Apache Tomcat | Spring, Rest, Embedded | -| [Plain Spring Webapplication JBoss AS 7](deployment/spring-jboss-non-pa) | JBoss AS 7 | Spring, Jndi, War | +| [Plain Spring Web application - WildFly](deployment/spring-wildfly-non-pa) | WildFly | Spring, Jndi, War | | [Process Application - Spring Boot](deployment/spring-boot) | Spring Boot | Spring | -Hint: Any example using the JBoss 7 Camunda BPM distribution **must** use JDK 7 to run/compile the project. Otherwise the JBoss 7 will not start, just hang. This is a JBoss 7.2 issue and does not affect WildFly. - - ### Process Engine Plugin Examples | Name | Container | Keywords | @@ -196,13 +196,29 @@ Hint: Any example using the JBoss 7 Camunda BPM distribution **must** use JDK 7 | [Twitter](spring-boot-starter/example-twitter) | Spring boot with embedded engine and Webapps | Spring Boot Starter, Webapps, Twitter | | [REST API DMN](spring-boot-starter/example-dmn-rest) | Spring boot with embedded engine and Webapps | Spring Boot Starter, REST API | +### External Task Client Examples + +| Name | Environment | Keywords | +|------------------------------------------------------------------------------------------------------------------------------|-------------------------------------|-----------------------------------| +| [Loan Granting - Java](https://github.com/camunda/camunda-external-task-client-java/tree/master/examples/loan-granting) | Java External Task Client | External Task Client, Servicetask | +| [Order Handling - Java](https://github.com/camunda/camunda-external-task-client-java/tree/master/examples/order-handling) | Java External Task Client | External Task Client, Servicetask | +| [Loan Granting - JavaScript](https://github.com/camunda/camunda-external-task-client-js/tree/master/examples/granting-loans) | JavaScript External Task Client | External Task Client, Servicetask | +| [Order Handling - JavaScript](https://github.com/camunda/camunda-external-task-client-js/tree/master/examples/order) | JavaScript External Task Client | External Task Client, Servicetask | + +### Container Specifics + +| Name | Container | Keywords | +| ----------------------------------------------------------------------------------------------|-----------------------|---------------------------| +| [Jackson Annotation Example for WildFly](wildfly/jackson-annotations) | Wildfly | War, Servlet | + + ### Contribute! - * Website: http://www.camunda.org/ + * Website: http://www.camunda.com/ * Getting Started: https://docs.camunda.org/get-started/ - * Issue Tracker: https://app.camunda.com/jira - * Contribution Guidelines: http://www.camunda.org/community/contribute.html + * Issue Tracker: https://jira.camunda.com/projects/CAM/issues + * Contribution Guidelines: https://camunda.com/learn/community/#contribute ### License The source files in this repository are made available under the [Apache License Version 2.0](./LICENSE). diff --git a/authentication/basic/pom.xml b/authentication/basic/pom.xml index 0d6f9a1c6..d06e9f2a0 100644 --- a/authentication/basic/pom.xml +++ b/authentication/basic/pom.xml @@ -16,7 +16,7 @@ 1.0.0 - 7.11.0 + 7.12.0 1.8 1.8 UTF-8 diff --git a/authentication/basic/src/main/java/org/camunda/bpm/example/authentication/CamundaSpringBootExampleApplication.java b/authentication/basic/src/main/java/org/camunda/bpm/example/authentication/CamundaSpringBootExampleApplication.java index 5afc37d9f..fe1bbaf8c 100644 --- a/authentication/basic/src/main/java/org/camunda/bpm/example/authentication/CamundaSpringBootExampleApplication.java +++ b/authentication/basic/src/main/java/org/camunda/bpm/example/authentication/CamundaSpringBootExampleApplication.java @@ -19,7 +19,6 @@ import org.camunda.bpm.engine.IdentityService; import org.camunda.bpm.engine.identity.User; -import org.camunda.bpm.engine.rest.filter.CacheControlFilter; import org.camunda.bpm.engine.rest.security.auth.ProcessEngineAuthenticationFilter; import org.jboss.resteasy.plugins.server.servlet.FilterDispatcher; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bpmn-model-api/generate-jsf-form/build.properties.example b/bpmn-model-api/generate-jsf-form/build.properties.example deleted file mode 100644 index 37765ed80..000000000 --- a/bpmn-model-api/generate-jsf-form/build.properties.example +++ /dev/null @@ -1,6 +0,0 @@ -# Copy this file to 'build.properties' and modify it to match your system -# Alternatively, you can also copy it to '${user.home}/.camunda/build.properties' -# to have a central configuration that works with all camunda BPM projects - -# Defines the deployment folder in a camunda BPM installation (backslashes need to be escaped or replaced by forward slashes). -deploy.jboss.dir=C:/camunda/camunda-bpm-jboss-7.4.0/server/jboss-as-7.2.0.Final/standalone/deployments diff --git a/bpmn-model-api/generate-jsf-form/build.xml b/bpmn-model-api/generate-jsf-form/build.xml deleted file mode 100644 index 32c49ac3e..000000000 --- a/bpmn-model-api/generate-jsf-form/build.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn-model-api/generate-jsf-form/pom.xml b/bpmn-model-api/generate-jsf-form/pom.xml index 1136e3eef..5ac3a0413 100644 --- a/bpmn-model-api/generate-jsf-form/pom.xml +++ b/bpmn-model-api/generate-jsf-form/pom.xml @@ -12,9 +12,9 @@ Process application that uses the camunda BPM Platform and has been generated by the Maven archetype 'camunda-archetype-ejb-war-7.0.3-SNAPSHOT' - 7.11.0 - 1.1.2.Final - 7.2.0.Final + 7.12.0 + 1.1.10.Final + 2.2.0.Final 1.7 1.7 UTF-8 @@ -70,11 +70,11 @@ 2.3.2 + - org.jboss.spec jboss-javaee-web-6.0 - 2.0.0.Final + 3.0.2.Final pom provided @@ -88,28 +88,32 @@ junit junit - 4.8.2 + 4.12 test + - org.jboss.arquillian.junit arquillian-junit-container test - org.jboss.arquillian.protocol arquillian-protocol-servlet test + + org.jboss.shrinkwrap.resolver + shrinkwrap-resolver-impl-maven + test + com.h2database h2 - 1.2.132 + 1.4.190 test @@ -117,7 +121,7 @@ org.slf4j slf4j-jdk14 - 1.7.12 + 1.7.26 test @@ -145,8 +149,8 @@ maven-compiler-plugin 2.3.1 - 1.6 - 1.6 + 1.7 + 1.7 @@ -169,12 +173,12 @@ - - org.jboss.as - jboss-as-arquillian-container-remote - ${jboss.version} + org.wildfly.arquillian + wildfly-arquillian-container-remote + ${wildfly.container.adapter.version} test @@ -197,15 +201,15 @@ - arq-jbossas-remote + arq-wildfly-remote - - org.jboss.as - jboss-as-arquillian-container-remote - ${jboss.version} + org.wildfly.arquillian + wildfly-arquillian-container-remote + ${wildfly.container.adapter.version} test diff --git a/bpmn-model-api/generate-jsf-form/src/test/java/org/camunda/bpm/ArquillianTest.java b/bpmn-model-api/generate-jsf-form/src/test/java/org/camunda/bpm/ArquillianTest.java index f612d10b0..cf4f6bdbe 100644 --- a/bpmn-model-api/generate-jsf-form/src/test/java/org/camunda/bpm/ArquillianTest.java +++ b/bpmn-model-api/generate-jsf-form/src/test/java/org/camunda/bpm/ArquillianTest.java @@ -42,7 +42,6 @@ public class ArquillianTest { public static WebArchive createDeployment() { // resolve given dependencies from Maven POM File[] libs = Maven.resolver() - .offline(true) .loadPomFromFile("pom.xml") .importRuntimeAndTestDependencies().resolve().withTransitivity().asFile(); diff --git a/bpmn-model-api/generate-process-fluent-api/pom.xml b/bpmn-model-api/generate-process-fluent-api/pom.xml index 9a253ff1a..28009beab 100644 --- a/bpmn-model-api/generate-process-fluent-api/pom.xml +++ b/bpmn-model-api/generate-process-fluent-api/pom.xml @@ -7,7 +7,7 @@ 1.0-SNAPSHOT - 7.11.0 + 7.12.0 1.7 1.7 UTF-8 @@ -50,14 +50,14 @@ junit junit - 4.11 + 4.12 test com.h2database h2 - 1.2.132 + 1.4.190 test @@ -65,7 +65,7 @@ org.slf4j slf4j-jdk14 - 1.7.12 + 1.7.26 diff --git a/bpmn-model-api/parse-bpmn/pom.xml b/bpmn-model-api/parse-bpmn/pom.xml index 838f4fe44..323dc884b 100644 --- a/bpmn-model-api/parse-bpmn/pom.xml +++ b/bpmn-model-api/parse-bpmn/pom.xml @@ -10,7 +10,7 @@ Parse BPMN by model API - 7.11.0 + 7.12.0 1.7 1.7 UTF-8 @@ -26,14 +26,14 @@ junit junit - 4.8.2 + 4.12 test org.assertj assertj-core - 1.5.0 + 2.9.1 diff --git a/cmmn-model-api/typed-custom-elements/README.md b/cmmn-model-api/typed-custom-elements/README.md index 883083042..79e1a8032 100644 --- a/cmmn-model-api/typed-custom-elements/README.md +++ b/cmmn-model-api/typed-custom-elements/README.md @@ -71,7 +71,7 @@ In [KPITransformListener][kpi-transform-listener], access to the custom model el [cmmn-model]: https://github.com/camunda/camunda-cmmn-model [test-case]: src/test/java/org/camunda/bpm/example/modelapi/TransformListenerCustomElementsTest.java [kpi-transform-listener]: src/main/java/org/camunda/bpm/example/modelapi/KPITransformListener.java -[cmmn-transform-listener]: http://docs.camunda.org/7.3/api-references/javadoc/org/camunda/bpm/engine/impl/cmmn/transformer/CmmnTransformListener.html +[cmmn-transform-listener]: https://docs.camunda.org/javadoc/camunda-bpm-platform/7.12/org/camunda/bpm/engine/impl/cmmn/transformer/CmmnTransformListener.html [process-engine-plugin]: src/main/java/org/camunda/bpm/example/modelapi/CustomElementsProcessEnginePlugin.java [camunda-cfg-xml]: src/test/resources/camunda.cfg.xml [kpi-element]: src/main/java/org/camunda/bpm/example/modelapi/KPIElement.java diff --git a/cmmn-model-api/typed-custom-elements/pom.xml b/cmmn-model-api/typed-custom-elements/pom.xml index 2488fb12d..ac65924eb 100644 --- a/cmmn-model-api/typed-custom-elements/pom.xml +++ b/cmmn-model-api/typed-custom-elements/pom.xml @@ -10,49 +10,58 @@ Strongly typed custom elements in the CMMN Model API - 7.11.0 + 7.12.0 1.7 1.7 UTF-8 + + + + + org.camunda.bpm + camunda-bom + ${version.camunda} + pom + import + + + org.camunda.bpm.model camunda-cmmn-model - ${version.camunda} org.camunda.bpm.model camunda-cmmn-model - ${version.camunda} org.camunda.bpm camunda-engine - ${version.camunda} junit junit - 4.11 + 4.12 test org.assertj assertj-core - 1.5.0 + 2.9.1 test com.h2database h2 - 1.3.171 + 1.4.190 test @@ -60,7 +69,7 @@ org.slf4j slf4j-jdk14 - 1.7.12 + 1.7.26 diff --git a/cockpit/cockpit-bpmn-js-module/README.md b/cockpit/cockpit-bpmn-js-module/README.md index 9a49a418d..5b0664eca 100644 --- a/cockpit/cockpit-bpmn-js-module/README.md +++ b/cockpit/cockpit-bpmn-js-module/README.md @@ -3,9 +3,9 @@ Cockpit bpmn.js module This example shows how to develop a Cockpit bpmn.js module. -For additional information, please also see the [documentation](https://docs.camunda.org/manual/7.11/webapps/cockpit/extend/configuration/#bpmn-diagram-viewer-bpmn-js). +For additional information, please also see the [documentation](https://docs.camunda.org/manual/7.12/webapps/cockpit/extend/configuration/#bpmn-diagram-viewer-bpmn-js). -Built and tested against Camunda BPM version `7.11.0`. +Built and tested against Camunda BPM version `7.12.0`. ![Screenshot](screenshot.png) @@ -13,7 +13,7 @@ Built and tested against Camunda BPM version `7.11.0`. Integrate into Camunda Webapp ----------------------------- -Copy the `bpmn-js-module.js` file into the `app/cockpit/scripts/` folder in your Camunda webapp distribution. +Copy the `bpmn-js-module.js` file into the `app/cockpit/scripts/` folder in your Camunda webapp distribution. For the Tomcat distribution, this would be `server/apache-tomcat-X.X.XX/webapps/camunda/app/cockpit/scripts/`. Add the following content to the `app/cockpit/scripts/config.js` file: diff --git a/cockpit/cockpit-failed-jobs-plugin/README.md b/cockpit/cockpit-failed-jobs-plugin/README.md index cbb20537b..6651ae588 100644 --- a/cockpit/cockpit-failed-jobs-plugin/README.md +++ b/cockpit/cockpit-failed-jobs-plugin/README.md @@ -48,9 +48,9 @@ Each Cockpit plugin has an Angular Controller, a unique pseudo-URL, such as: `pl Use under terms of the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) -[1]: https://docs.camunda.org/manual/7.11/webapps/cockpit/bpmn/failed-jobs/ -[2]: https://docs.camunda.org/manual/7.11/user-guide/process-engine/process-engine-concepts/#jobs-and-job-definitions -[3]: https://docs.camunda.org/manual/7.11/user-guide/process-engine/the-job-executor/ -[4]: https://docs.camunda.org/manual/7.11/user-guide/process-engine/incidents/ -[5]: https://docs.camunda.org/manual/7.11/user-guide/process-engine/transactions-in-processes/#transaction-boundaries +[1]: https://docs.camunda.org/manual/7.12/webapps/cockpit/bpmn/failed-jobs/ +[2]: https://docs.camunda.org/manual/7.12/user-guide/process-engine/process-engine-concepts/#jobs-and-job-definitions +[3]: https://docs.camunda.org/manual/7.12/user-guide/process-engine/the-job-executor/ +[4]: https://docs.camunda.org/manual/7.12/user-guide/process-engine/incidents/ +[5]: https://docs.camunda.org/manual/7.12/user-guide/process-engine/transactions-in-processes/#transaction-boundaries [6]: https://github.com/camunda/camunda-bpm-webapp diff --git a/cockpit/cockpit-failed-jobs-plugin/pom.xml b/cockpit/cockpit-failed-jobs-plugin/pom.xml index d0e95c013..04b88adf9 100644 --- a/cockpit/cockpit-failed-jobs-plugin/pom.xml +++ b/cockpit/cockpit-failed-jobs-plugin/pom.xml @@ -9,13 +9,13 @@ A Cockpit plugin which shows a grid list of Failed Jobs on the start page of Cockpit and has three columns: Job ID, Process instance ID and Exception. - 7.11.0 + 7.12.0 Monitoring screenshot.png - 7.11.0 + 7.12.0 EN 1.7 diff --git a/cockpit/cockpit-sample-plugin/README.md b/cockpit/cockpit-sample-plugin/README.md index 0670f4fbb..fc78ed154 100644 --- a/cockpit/cockpit-sample-plugin/README.md +++ b/cockpit/cockpit-sample-plugin/README.md @@ -3,7 +3,7 @@ Sample Plugin for Camunda Cockpit This is a simple plugin that showcases the plugin system of Cockpit, the process monitoring tool of [Camunda BPM](http://docs.camunda.org). -Built and tested against Camunda BPM version `7.11.0`. +Built and tested against Camunda BPM version `7.12.0`. ![Screenshot](screenshot.png) @@ -26,7 +26,7 @@ Built and tested against Camunda BPM version `7.11.0`. ![Cockpit Plugin](cockpit-plugin.png) -> Note: If you need please take a look at the [Cockpit Plug-ins](https://docs.camunda.org/manual/7.11/webapps/cockpit/extend/plugins/) for the basics first. +> Note: If you need please take a look at the [Cockpit Plug-ins](https://docs.camunda.org/manual/7.12/webapps/cockpit/extend/plugins/) for the basics first. 1. [Server Side](#server-side) 1. [Plug-in Archive](#plug-in-archive) diff --git a/cockpit/cockpit-sample-plugin/pom.xml b/cockpit/cockpit-sample-plugin/pom.xml index 99fcf79e9..e73016b02 100644 --- a/cockpit/cockpit-sample-plugin/pom.xml +++ b/cockpit/cockpit-sample-plugin/pom.xml @@ -12,14 +12,14 @@ http://docs.camunda.org/latest/real-life/how-to/#cockpit-how-to-develop-a-cockpit-plugin - 7.11.0 + 7.12.0 Sample screenshot.png - 7.11.0 + 7.12.0 EN diff --git a/cockpit/js-only-plugin/README.md b/cockpit/js-only-plugin/README.md index 9dca0e122..26329c2a9 100644 --- a/cockpit/js-only-plugin/README.md +++ b/cockpit/js-only-plugin/README.md @@ -3,7 +3,7 @@ Javascript Only Plugin for Camunda Cockpit This example shows how to develop a Cockpit plugin without the need to register it with the Camunda BPM server. It makes use of the `customScript` property of the webapp configurations. -Built and tested against Camunda BPM version `7.11.0`. +Built and tested against Camunda BPM version `7.12.0`. ![Screenshot](screenshot.png) diff --git a/cockpit/request-interceptor/README.md b/cockpit/request-interceptor/README.md index 3a37791e2..1ae329fd7 100644 --- a/cockpit/request-interceptor/README.md +++ b/cockpit/request-interceptor/README.md @@ -3,7 +3,7 @@ Request Interceptor for Camunda Cockpit This example shows how to intercept requests made by Camunda Cockpit. This might be useful if you need to set additional properties or request headers on all requests made by Cockpit against the rest API. -Built and tested against Camunda BPM version `7.11.0`. +Built and tested against Camunda BPM version `7.12.0`. Integrate into Camunda Webapp diff --git a/deployment/ejb-pa/README.md b/deployment/ejb-pa/README.md index 88d3d0aa2..ea25a3e0e 100644 --- a/deployment/ejb-pa/README.md +++ b/deployment/ejb-pa/README.md @@ -6,9 +6,9 @@ This example demonstrates how to deploy an EJB process application. How to use it ----------------------------- -1. Checkout the project with Git -2. Import the project into your IDE -3. Build it with maven -4. Deploy it to a camunda-bpm-platform distro of your own choice, that supports EJB's (Wildfly, Jboss) -5. Wait a minute -6. Check the console if you can find: 'This is a @Stateless Ejb component invoked from a BPMN 2.0 process' \ No newline at end of file +1. Checkout the project with Git; +2. Import the project into your IDE; +3. Build it with maven; +4. Deploy it to a camunda-bpm-platform distro of your own choice, that supports EJBs (Wildfly); +5. Wait a minute; +6. Check the console if you can find: "This is a @Stateless Ejb component invoked from a BPMN 2.0 process". \ No newline at end of file diff --git a/deployment/ejb-pa/pom.xml b/deployment/ejb-pa/pom.xml index 27a8556c7..160d42cbf 100644 --- a/deployment/ejb-pa/pom.xml +++ b/deployment/ejb-pa/pom.xml @@ -8,9 +8,8 @@ 1.0-SNAPSHOT - 7.11.0 - 1.0.4.Final - 7.2.0.Final + 7.12.0 + 3.0.1.Final 1.7 1.7 UTF-8 @@ -42,7 +41,7 @@ org.jboss.spec jboss-javaee-web-6.0 - 3.0.1.Final + ${version.java-ee-specs} pom provided diff --git a/deployment/embedded-spring-rest/README.md b/deployment/embedded-spring-rest/README.md index ffe30db68..522234a13 100644 --- a/deployment/embedded-spring-rest/README.md +++ b/deployment/embedded-spring-rest/README.md @@ -2,21 +2,21 @@ This example demonstrates how to set up a web application, which -* Bundles the camunda-engine JAR library +* Bundles the `camunda-engine` JAR library * Starts and configures a process engine in a Spring Application context -* Bundles the camunda-engine-REST library -* Exposes the process engine API via REST +* Bundles the `camunda-engine-REST` library +* Exposes the Process Engine API via REST > **Note:** This project must be deployed on a vanilla Apache Tomcat server, NOT the prepackaged distribution which can be downloaded from http://camunda.org. ## Why is this example interesting? -This example demonstrates how to perform a standalone embedded setup with a webapplication which bundles both the -camunda engine and camunda engine REST JARs. +This example demonstrates how to perform a standalone embedded setup with a Web application which +bundles both the Camunda Process Engine and Camunda Engine REST JARs. ## Show me the important parts! -The process engine is configured in the Spring application context: +The Process Engine is configured in the Spring application context: ```xml 1.0-SNAPSHOT - 7.11.0 - 4.3.24.RELEASE + 7.12.0 + 4.3.24.RELEASE + 3.0.8.Final + 1.3.171 1.7 1.7 UTF-8 @@ -21,7 +23,7 @@ org.camunda.bpm camunda-bom - ${camunda.version} + ${version.camunda} import pom @@ -49,49 +51,49 @@ org.jboss.resteasy resteasy-jaxrs - 3.0.8.Final + ${version.resteasy-jaxrs} org.springframework spring-web - ${spring.version} + ${version.spring} org.springframework spring-beans - ${spring.version} + ${version.spring} org.springframework spring-context - ${spring.version} + ${version.spring} org.springframework spring-jdbc - ${spring.version} + ${version.spring} org.springframework spring-tx - ${spring.version} + ${version.spring} org.springframework spring-orm - ${spring.version} + ${version.spring} com.h2database h2 - 1.3.171 + ${version.h2} diff --git a/deployment/servlet-pa/README.md b/deployment/servlet-pa/README.md index cb2052c2c..f340cf26d 100644 --- a/deployment/servlet-pa/README.md +++ b/deployment/servlet-pa/README.md @@ -6,9 +6,9 @@ This example demonstrates how to deploy a simple servlet process application. How to use it ----------------------------- -1. Checkout the project with Git -2. Import the project into your IDE -3. Build it with maven -4. Deploy it to a camunda-bpm-platform distro of your choice -6. Check the console if you can find: 'Service Task 'Example ServiceTask' is invoked!' +1. Checkout the project with Git; +2. Import the project into your IDE; +3. Build it with maven; +4. Deploy it to a camunda-bpm-platform distro of your choice; +6. Check the console if you can find: "Service Task 'Example ServiceTask' is invoked!". diff --git a/deployment/servlet-pa/pom.xml b/deployment/servlet-pa/pom.xml index 899eab42e..f8638f4a6 100644 --- a/deployment/servlet-pa/pom.xml +++ b/deployment/servlet-pa/pom.xml @@ -1,5 +1,6 @@ 4.0.0 + org.camunda.bpm.quickstart camunda-quickstart-servlet-pa war @@ -7,9 +8,8 @@ 1.0-SNAPSHOT - 7.11.0 - 1.0.4.Final - 7.2.0.Final + 7.12.0 + 3.0.1 1.7 1.7 UTF-8 @@ -26,7 +26,7 @@ javax.servlet javax.servlet-api - 3.0.1 + ${version.servlet-api.javax} provided diff --git a/deployment/spring-boot/README.md b/deployment/spring-boot/README.md index 1cca2588c..69020c391 100644 --- a/deployment/spring-boot/README.md +++ b/deployment/spring-boot/README.md @@ -12,7 +12,8 @@ The example process looks like: ### Run it as JUnit Test -The JUnit test [CamundaSpringBootExampleApplicationTest](src/test/java/org/camunda/bpm/example/CamundaSpringBootExampleApplicationTest.java) starts the application and verifies that a process instance is started. +The JUnit test [CamundaSpringBootExampleApplicationTest](src/test/java/org/camunda/bpm/example/CamundaSpringBootExampleApplicationTest.java) +starts the application and verifies that a process instance is started. ## How it works diff --git a/deployment/spring-boot/pom.xml b/deployment/spring-boot/pom.xml index 2712857ec..a17f751e0 100644 --- a/deployment/spring-boot/pom.xml +++ b/deployment/spring-boot/pom.xml @@ -1,29 +1,30 @@ - - 4.0.0 + + 4.0.0 - org.camunda.bpm - camunda-spring-boot-example - 1.0.0-SNAPSHOT - jar + org.camunda.bpm + camunda-spring-boot-example + 1.0.0-SNAPSHOT + jar - camunda-spring-boot-example - Example for bootstrapping the Camunda process engine with Spring Boot + camunda-spring-boot-example + Example for bootstrapping the Camunda Process Engine with Spring Boot - - org.springframework.boot - spring-boot-starter-parent - 2.1.5.RELEASE - - + + org.springframework.boot + spring-boot-starter-parent + 2.2.1.RELEASE + + + + + 7.12.0 + UTF-8 + 1.8 + - - 7.11.0 - UTF-8 - 1.8 - - @@ -36,9 +37,9 @@ - - - + + + org.springframework.boot spring-boot-starter-jdbc @@ -62,18 +63,18 @@ spring-boot-starter-test test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + camunda-bpm-nexus diff --git a/deployment/spring-servlet-pa-tomcat/pom.xml b/deployment/spring-servlet-pa-tomcat/pom.xml index 426d812d1..f7ebbf9cc 100644 --- a/deployment/spring-servlet-pa-tomcat/pom.xml +++ b/deployment/spring-servlet-pa-tomcat/pom.xml @@ -8,7 +8,7 @@ 1.0-SNAPSHOT - 7.11.0 + 7.12.0 4.3.24.RELEASE 1.7 1.7 diff --git a/deployment/spring-servlet-pa-jboss/.gitignore b/deployment/spring-servlet-pa-wildfly/.gitignore similarity index 100% rename from deployment/spring-servlet-pa-jboss/.gitignore rename to deployment/spring-servlet-pa-wildfly/.gitignore diff --git a/deployment/spring-servlet-pa-jboss/README.md b/deployment/spring-servlet-pa-wildfly/README.md similarity index 52% rename from deployment/spring-servlet-pa-jboss/README.md rename to deployment/spring-servlet-pa-wildfly/README.md index f08ba4c74..ac6064075 100644 --- a/deployment/spring-servlet-pa-jboss/README.md +++ b/deployment/spring-servlet-pa-wildfly/README.md @@ -1,20 +1,23 @@ -# Spring Servlet Process Application (using JBoss AS 7) +# Spring Servlet Process Application (using WildFly) -This example demonstrates how to deploy a spring powered web application which +This example demonstrates how to deploy a Spring-powered Web application which - * Includes a @ProcessApplication class and some BPMN 2.0 processes + * Includes a `@ProcessApplication` class and some BPMN 2.0 processes * Starts a Spring Web application context - * Uses a shared container managed process engine and Spring Beans as expression and delegate expression in the processes + * Uses a shared container managed Process Engine and Spring Beans as expression and delegate + expression in the processes ## Why is this example interesting? -This example shows how to combine a @ProcessApplication class, a `processes.xml` and a spring applicationContext into a fully-fledged process application with all its -advantages, including a managed container shared process engine paired with the power of spring beans inside your processes. +This example shows how to combine a `@ProcessApplication` class, a `processes.xml` and a Spring +`applicationContext` into a fully-fledged Process Application with all its advantages, including a +managed container shared Process Engine paired with the power of Spring Beans inside your processes. ## Show me the important parts! -We create a process application class which extends the `ServletProcessApplication` and annotate it with @ProcessApplication, so -the camunda BPM platform can pick it up and register the process application without any further action: +We create a Process Application class which extends the `ServletProcessApplication` and annotate +it with `@ProcessApplication`, so the Camunda BPM Platform can pick it up and register the Process +Application without any further action: ```java @ProcessApplication @@ -23,7 +26,8 @@ public class SpringServletProcessApplication extends ServletProcessApplication { } ``` -Through the `META-INF/processes.xml`, we can define process archives and additional options, like creating new engines when deploying the process application: +Through the `META-INF/processes.xml`, we can define Process Archives and additional options, like +creating new Process Engines when deploying the Process Application: ```xml @@ -42,7 +46,8 @@ Through the `META-INF/processes.xml`, we can define process archives and additio ``` -Additionally, you have to package the camunda-engine-spring module as a maven compile time dependency like: +Additionally, you have to package the `camunda-engine-spring` module as a maven compile time +dependency like: ```xml @@ -55,9 +60,11 @@ Additionally, you have to package the camunda-engine-spring module as a maven co ## How to use it? - 1. Make sure you use **JDK 7** otherwise the JBoss AS 7 won't start. - 2. Build it with maven, it will download the camunda BPM JBoss AS 7 distribution and execute the included Arquillian test. - 3. Watch out for this console log: + 1. Checkout the project with Git; + 2. Import the project into your IDE; + 3. Build it with maven, it will download the Camunda BPM WildFly distribution and execute + the included Arquillian test. + 4. Watch out for this console log: ```bash Invoking @PostDeploy annotation in org.camunda.bpm.example.spring.jboss.servlet.SpringServletProcessApplication diff --git a/deployment/spring-servlet-pa-jboss/pom.xml b/deployment/spring-servlet-pa-wildfly/pom.xml similarity index 62% rename from deployment/spring-servlet-pa-jboss/pom.xml rename to deployment/spring-servlet-pa-wildfly/pom.xml index 8328bae0c..1158932d0 100644 --- a/deployment/spring-servlet-pa-jboss/pom.xml +++ b/deployment/spring-servlet-pa-wildfly/pom.xml @@ -2,60 +2,100 @@ 4.0.0 org.camunda.bpm.quickstart - camunda-quickstart-spring-servlet-pa-jboss + camunda-quickstart-spring-servlet-pa-wildfly war - camunda BPM - Quickstarts - Spring Servlet Process Application For JBoss + camunda BPM - Quickstarts - Spring Servlet Process Application For WildFly 1.0-SNAPSHOT - 7.11.0 - 4.3.24.RELEASE - 1.0.4.Final - 7.2.0.Final + 7.12.0-alpha6 + 4.3.24.RELEASE + 18.0.0.Final + 3.0.1 + + 2.2.0.Final + 1.1.10.Final + 4.12 + 1.7 1.7 UTF-8 + + + + + org.jboss.arquillian + arquillian-bom + ${version.arquillian} + import + pom + + + + + org.camunda.bpm camunda-engine-spring - ${camunda.version} + ${version.camunda} + + + + camunda-engine + org.camunda.bpm + + + + + + org.camunda.bpm + camunda-engine + ${version.camunda} + provided javax.servlet javax.servlet-api - 3.0.1 + ${version.servlet-api.javax} provided org.springframework spring-web - ${spring.version} + ${version.spring} - - junit - junit - 4.11 + org.jboss.shrinkwrap.resolver + shrinkwrap-resolver-impl-maven + test + org.jboss.arquillian.junit arquillian-junit-container - ${version.arquillian} test + org.jboss.arquillian.protocol arquillian-protocol-servlet - ${version.arquillian} test + + + junit + junit + ${version.junit} + test + + @@ -68,15 +108,15 @@ - jboss-managed + wildfly-managed true - org.jboss.as - jboss-as-arquillian-container-managed - ${version.jboss-as} + org.wildfly.arquillian + wildfly-arquillian-container-managed + ${version.wildfly.container.adapter} test @@ -88,7 +128,7 @@ - + org.apache.maven.plugins maven-clean-plugin @@ -106,7 +146,7 @@ false - + org.apache.maven.plugins maven-dependency-plugin @@ -121,12 +161,12 @@ - org.camunda.bpm.jboss - camunda-bpm-jboss - ${camunda.version} + org.camunda.bpm.wildfly + camunda-bpm-wildfly + ${version.camunda} tar.gz true - ${project.build.directory}/jboss + ${project.build.directory}/wildfly diff --git a/deployment/spring-servlet-pa-jboss/src/main/java/org/camunda/bpm/example/spring/servlet/pa/ExampleBean.java b/deployment/spring-servlet-pa-wildfly/src/main/java/org/camunda/bpm/example/spring/servlet/pa/ExampleBean.java similarity index 100% rename from deployment/spring-servlet-pa-jboss/src/main/java/org/camunda/bpm/example/spring/servlet/pa/ExampleBean.java rename to deployment/spring-servlet-pa-wildfly/src/main/java/org/camunda/bpm/example/spring/servlet/pa/ExampleBean.java diff --git a/deployment/spring-servlet-pa-jboss/src/main/java/org/camunda/bpm/example/spring/servlet/pa/ExampleDelegateBean.java b/deployment/spring-servlet-pa-wildfly/src/main/java/org/camunda/bpm/example/spring/servlet/pa/ExampleDelegateBean.java similarity index 100% rename from deployment/spring-servlet-pa-jboss/src/main/java/org/camunda/bpm/example/spring/servlet/pa/ExampleDelegateBean.java rename to deployment/spring-servlet-pa-wildfly/src/main/java/org/camunda/bpm/example/spring/servlet/pa/ExampleDelegateBean.java diff --git a/deployment/spring-servlet-pa-jboss/src/main/java/org/camunda/bpm/example/spring/servlet/pa/SpringServletProcessApplication.java b/deployment/spring-servlet-pa-wildfly/src/main/java/org/camunda/bpm/example/spring/servlet/pa/SpringServletProcessApplication.java similarity index 100% rename from deployment/spring-servlet-pa-jboss/src/main/java/org/camunda/bpm/example/spring/servlet/pa/SpringServletProcessApplication.java rename to deployment/spring-servlet-pa-wildfly/src/main/java/org/camunda/bpm/example/spring/servlet/pa/SpringServletProcessApplication.java diff --git a/deployment/spring-servlet-pa-jboss/src/main/resources/META-INF/processes.xml b/deployment/spring-servlet-pa-wildfly/src/main/resources/META-INF/processes.xml similarity index 100% rename from deployment/spring-servlet-pa-jboss/src/main/resources/META-INF/processes.xml rename to deployment/spring-servlet-pa-wildfly/src/main/resources/META-INF/processes.xml diff --git a/deployment/spring-servlet-pa-jboss/src/main/resources/SpringExpressionResolvingTest.testResolveBean.bpmn20.xml b/deployment/spring-servlet-pa-wildfly/src/main/resources/SpringExpressionResolvingTest.testResolveBean.bpmn20.xml similarity index 100% rename from deployment/spring-servlet-pa-jboss/src/main/resources/SpringExpressionResolvingTest.testResolveBean.bpmn20.xml rename to deployment/spring-servlet-pa-wildfly/src/main/resources/SpringExpressionResolvingTest.testResolveBean.bpmn20.xml diff --git a/deployment/spring-servlet-pa-jboss/src/main/resources/SpringExpressionResolvingTest.testResolveBeanFromJobExecutor.bpmn20.xml b/deployment/spring-servlet-pa-wildfly/src/main/resources/SpringExpressionResolvingTest.testResolveBeanFromJobExecutor.bpmn20.xml similarity index 100% rename from deployment/spring-servlet-pa-jboss/src/main/resources/SpringExpressionResolvingTest.testResolveBeanFromJobExecutor.bpmn20.xml rename to deployment/spring-servlet-pa-wildfly/src/main/resources/SpringExpressionResolvingTest.testResolveBeanFromJobExecutor.bpmn20.xml diff --git a/deployment/spring-servlet-pa-jboss/src/main/webapp/WEB-INF/applicationContext.xml b/deployment/spring-servlet-pa-wildfly/src/main/webapp/WEB-INF/applicationContext.xml similarity index 100% rename from deployment/spring-servlet-pa-jboss/src/main/webapp/WEB-INF/applicationContext.xml rename to deployment/spring-servlet-pa-wildfly/src/main/webapp/WEB-INF/applicationContext.xml diff --git a/deployment/spring-servlet-pa-jboss/src/main/webapp/WEB-INF/web.xml b/deployment/spring-servlet-pa-wildfly/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from deployment/spring-servlet-pa-jboss/src/main/webapp/WEB-INF/web.xml rename to deployment/spring-servlet-pa-wildfly/src/main/webapp/WEB-INF/web.xml diff --git a/deployment/spring-servlet-pa-jboss/src/test/java/org/camunda/bpm/example/spring/servlet/pa/ArquillianTest.java b/deployment/spring-servlet-pa-wildfly/src/test/java/org/camunda/bpm/example/spring/servlet/pa/ArquillianTest.java similarity index 92% rename from deployment/spring-servlet-pa-jboss/src/test/java/org/camunda/bpm/example/spring/servlet/pa/ArquillianTest.java rename to deployment/spring-servlet-pa-wildfly/src/test/java/org/camunda/bpm/example/spring/servlet/pa/ArquillianTest.java index 8bd08e57e..bc4ddb61e 100644 --- a/deployment/spring-servlet-pa-jboss/src/test/java/org/camunda/bpm/example/spring/servlet/pa/ArquillianTest.java +++ b/deployment/spring-servlet-pa-wildfly/src/test/java/org/camunda/bpm/example/spring/servlet/pa/ArquillianTest.java @@ -38,10 +38,8 @@ import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.shrinkwrap.api.ShrinkWrap; -import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.jboss.shrinkwrap.api.spec.WebArchive; -import org.jboss.shrinkwrap.resolver.api.DependencyResolvers; -import org.jboss.shrinkwrap.resolver.api.maven.MavenDependencyResolver; +import org.jboss.shrinkwrap.resolver.api.maven.Maven; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -91,15 +89,14 @@ public static WebArchive processArchive() { // web xml that bootstraps spring .setWebXML(new File("src/main/webapp/WEB-INF/web.xml")) + // spring application context & libs .addAsWebInfResource(new File("src/main/webapp/WEB-INF/applicationContext.xml"), "applicationContext.xml") - .addAsLibraries(DependencyResolvers - .use(MavenDependencyResolver.class) - .goOffline() - .loadMetadataFromPom("pom.xml") - .artifacts("org.camunda.bpm:camunda-engine-spring", "org.springframework:spring-web") - .exclusion("org.camunda.bpm:camunda-engine") - .resolveAs(JavaArchive.class)); + .addAsLibraries(Maven.configureResolver() + .workOffline() + .loadPomFromFile("pom.xml") + .importCompileAndRuntimeDependencies() + .resolve().withTransitivity().asFile()); } @Test diff --git a/deployment/spring-servlet-pa-jboss/src/test/resources/arquillian.xml b/deployment/spring-servlet-pa-wildfly/src/test/resources/arquillian.xml similarity index 89% rename from deployment/spring-servlet-pa-jboss/src/test/resources/arquillian.xml rename to deployment/spring-servlet-pa-wildfly/src/test/resources/arquillian.xml index d3e13dded..b6142a9a7 100644 --- a/deployment/spring-servlet-pa-jboss/src/test/resources/arquillian.xml +++ b/deployment/spring-servlet-pa-wildfly/src/test/resources/arquillian.xml @@ -10,7 +10,7 @@ - target/jboss/server/jboss-as-${version.jboss-as} + target/wildfly/server/wildfly-${version.wildfly} -Xmx512m -XX:MaxPermSize=256m 300 diff --git a/deployment/spring-jboss-non-pa/README.md b/deployment/spring-wildfly-non-pa/README.md similarity index 58% rename from deployment/spring-jboss-non-pa/README.md rename to deployment/spring-wildfly-non-pa/README.md index 7b654ae9b..1ab3973cf 100644 --- a/deployment/spring-jboss-non-pa/README.md +++ b/deployment/spring-wildfly-non-pa/README.md @@ -1,25 +1,28 @@ -# Plain Spring Web application for JBoss AS 7 +# Plain Spring Web application for WildFly This example demonstrates how to deploy a plain web application which * Does not include a @ProcessApplication class and does not provide any BPMN 2.0 processes - * Starts a Spring Webapplication context - * Binds a shared, container managed process engine as Spring Bean + * Starts a Spring WebApplication context + * Binds a shared, container managed Process Engine as Spring Bean ## Why is this example interesting? -The JBoss AS 7 extensions from camunda allow you to manage Process Engines as JBoss Services. However, if your application does not -provide a @ProcessApplication class, JBoss AS 7 is not aware of the fact that your application uses the process engine. In that case, -the following scenarios can occur: +The WildFly extensions from Camunda allow you to manage Process Engines as JBoss Services. However, +if your application does not provide a `@ProcessApplication` class, WildFly is not aware of the +fact that your application uses the Process Engine. In that case, the following scenarios can occur: - * At deployment, your application is deployed *before* the process engine is started, causing the deployment of your application to fail. - * When the process engine is stopped, your application is not stopped but will likely fail at some point because the process engine is not available anymore. + * At deployment, your application is deployed *before* the Process Engine is started, causing the + deployment of your application to fail. + * When the Process Engine is stopped, your application is not stopped but will likely fail at some + point because the Process Engine is not available anymore. -This problem can be resolved by adding a declarative dependency between the process engine and a component in your application. +This problem can be resolved by adding a declarative dependency between the process engine and a +component in your application. ## Show me the important parts! -We reference the process engine resource in `web.xml`: +We reference the Process Engine resource in `web.xml`: ```xml @@ -29,10 +32,11 @@ We reference the process engine resource in `web.xml`: ``` -This creates a declarative dependency between the web application context and the process engine. Now JBoss AS 7 knows that we are using it. -We can look it up using the local name `java:comp/env/processEngine/default` from anywhere in our application. +This creates a declarative dependency between the web application context and the Process Engine. +Now WildFly knows that we are using it. We can look it up using the local name `java:comp/env/processEngine/default` +from anywhere in our application. -In our case, we want to reference it from a Spring application context: +In our case, we want to reference it from a Spring ApplicationContext: ```xml - + ``` -We also add an entry to the manifest so that the process engine classes are added to our classpath: +We also add an entry to the manifest, so that the Process Engine classes are added to our classpath: ```xml @@ -76,7 +80,7 @@ We also add an entry to the manifest so that the process engine classes are adde ## How to use it? 1. Build it with maven - 2. Deploy it to JBoss AS 7 (download it from [here][1]) + 2. Deploy it to WildFly (download it from [here][1]) 3. Watch out for this console log: ```bash @@ -86,4 +90,4 @@ The engine is named default. There are currently 0 processes deployed on this engine. ``` -[1]: https://camunda.org/release/camunda-bpm/jboss/ +[1]: https://camunda.org/release/camunda-bpm/wildfly/ diff --git a/deployment/spring-jboss-non-pa/pom.xml b/deployment/spring-wildfly-non-pa/pom.xml similarity index 90% rename from deployment/spring-jboss-non-pa/pom.xml rename to deployment/spring-wildfly-non-pa/pom.xml index 87e177d8f..f64044126 100644 --- a/deployment/spring-jboss-non-pa/pom.xml +++ b/deployment/spring-wildfly-non-pa/pom.xml @@ -3,13 +3,13 @@ 4.0.0 org.camunda.bpm.quickstart - camunda-quickstart-jboss-spring-nonpa + camunda-quickstart-wildfly-spring-nonpa war - camunda BPM - Quickstarts - JBOSS - Spring Non Process Application + camunda BPM - Quickstarts - WildFly - Spring Non Process Application 1.0-SNAPSHOT - 7.11.0 + 7.12.0 4.3.24.RELEASE 1.7 1.7 diff --git a/deployment/spring-jboss-non-pa/src/main/java/org/camunda/bpm/example/spring/jboss/ProcessEngineClient.java b/deployment/spring-wildfly-non-pa/src/main/java/org/camunda/bpm/example/spring/wildfly/ProcessEngineClient.java similarity index 91% rename from deployment/spring-jboss-non-pa/src/main/java/org/camunda/bpm/example/spring/jboss/ProcessEngineClient.java rename to deployment/spring-wildfly-non-pa/src/main/java/org/camunda/bpm/example/spring/wildfly/ProcessEngineClient.java index 6e46674a4..324d4d758 100644 --- a/deployment/spring-jboss-non-pa/src/main/java/org/camunda/bpm/example/spring/jboss/ProcessEngineClient.java +++ b/deployment/spring-wildfly-non-pa/src/main/java/org/camunda/bpm/example/spring/wildfly/ProcessEngineClient.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.camunda.bpm.example.spring.jboss; +package org.camunda.bpm.example.spring.wildfly; import java.util.logging.Level; import java.util.logging.Logger; @@ -28,7 +28,7 @@ */ public class ProcessEngineClient implements InitializingBean { - private final static Logger LOGG = Logger.getLogger(ProcessEngineClient.class.getName()); + private final static Logger LOG = Logger.getLogger(ProcessEngineClient.class.getName()); protected ProcessEngine processEngine; @@ -38,7 +38,7 @@ public void afterPropertiesSet() throws Exception { .createProcessDefinitionQuery() .count(); - LOGG.log(Level.INFO, "\n\n\n" + + LOG.log(Level.INFO, "\n\n\n" + "Hi there!" + "\n" + "I am a spring bean and I am using a container managed process engine provided as JBoss Service for all applications to share." + diff --git a/deployment/spring-jboss-non-pa/src/main/webapp/WEB-INF/applicationContext.xml b/deployment/spring-wildfly-non-pa/src/main/webapp/WEB-INF/applicationContext.xml similarity index 89% rename from deployment/spring-jboss-non-pa/src/main/webapp/WEB-INF/applicationContext.xml rename to deployment/spring-wildfly-non-pa/src/main/webapp/WEB-INF/applicationContext.xml index b4548b291..a15f0ca3e 100644 --- a/deployment/spring-jboss-non-pa/src/main/webapp/WEB-INF/applicationContext.xml +++ b/deployment/spring-wildfly-non-pa/src/main/webapp/WEB-INF/applicationContext.xml @@ -10,7 +10,7 @@ - + diff --git a/deployment/spring-jboss-non-pa/src/main/webapp/WEB-INF/web.xml b/deployment/spring-wildfly-non-pa/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from deployment/spring-jboss-non-pa/src/main/webapp/WEB-INF/web.xml rename to deployment/spring-wildfly-non-pa/src/main/webapp/WEB-INF/web.xml diff --git a/dmn-engine/dmn-engine-drg/README.md b/dmn-engine/dmn-engine-drg/README.md index b1031df73..2a315673b 100644 --- a/dmn-engine/dmn-engine-drg/README.md +++ b/dmn-engine/dmn-engine-drg/README.md @@ -115,9 +115,9 @@ Beverages: ``` -[Camunda DMN engine]: https://docs.camunda.org/manual/7.11/user-guide/dmn-engine/ -[Reference Guide]: http://docs.camunda.org/manual/reference/dmn11/drg/ -[User Guide]: https://docs.camunda.org/manual/7.11/user-guide/dmn-engine/testing/ +[Camunda DMN engine]: https://docs.camunda.org/manual/7.12/user-guide/dmn-engine/ +[Reference Guide]: http://docs.camunda.org/manual/7.12/reference/dmn11/drg/ +[User Guide]: https://docs.camunda.org/manual/7.12/user-guide/dmn-engine/testing/ [Dinner Decisions]: src/main/resources/org/camunda/bpm/example/drg/dinnerDecisions.png [Beverages Decision]: src/main/resources/org/camunda/bpm/example/drg/beverages.png [Dish Decision]: src/main/resources/org/camunda/bpm/example/drg/dish.png diff --git a/dmn-engine/dmn-engine-drg/pom.xml b/dmn-engine/dmn-engine-drg/pom.xml index 4cabcf436..d989af410 100644 --- a/dmn-engine/dmn-engine-drg/pom.xml +++ b/dmn-engine/dmn-engine-drg/pom.xml @@ -10,7 +10,7 @@ jar - 7.11.0 + 7.12.0 1.7 1.7 diff --git a/dmn-engine/dmn-engine-java-main-method/README.md b/dmn-engine/dmn-engine-java-main-method/README.md index 543ca2ca8..41bb38b81 100644 --- a/dmn-engine/dmn-engine-java-main-method/README.md +++ b/dmn-engine/dmn-engine-java-main-method/README.md @@ -196,11 +196,11 @@ Dish Decision: ``` -[Camunda DMN engine]: https://docs.camunda.org/manual/7.11/user-guide/dmn-engine/ +[Camunda DMN engine]: https://docs.camunda.org/manual/7.12/user-guide/dmn-engine/ [DMN tutorial]: https://camunda.org/dmn/tutorial/ [Dish Decision]: src/main/resources/org/camunda/bpm/example/dish-decision.png [dish-decision.dmn11.xml]: src/main/resources/org/camunda/bpm/example/dish-decision.dmn11.xml [Camunda Modeler]: https://camunda.org/dmn/tool/ [DishDecider.java]: src/main/java/org/camunda/bpm/example/DishDecider.java -[User Guide]: https://docs.camunda.org/manual/7.11/user-guide/dmn-engine/testing/ +[User Guide]: https://docs.camunda.org/manual/7.12/user-guide/dmn-engine/testing/ [DishDecisionTest.java]: src/test/java/org/camunda/bpm/example/DishDecisionTest.java diff --git a/dmn-engine/dmn-engine-java-main-method/pom.xml b/dmn-engine/dmn-engine-java-main-method/pom.xml index 3cf544bde..fb13c196b 100644 --- a/dmn-engine/dmn-engine-java-main-method/pom.xml +++ b/dmn-engine/dmn-engine-java-main-method/pom.xml @@ -10,7 +10,7 @@ jar - 7.11.0 + 7.12.0 1.7 1.7 diff --git a/migration/migrate-on-deployment/README.md b/migration/migrate-on-deployment/README.md index eb56b9826..e55572f18 100644 --- a/migration/migrate-on-deployment/README.md +++ b/migration/migrate-on-deployment/README.md @@ -1,7 +1,7 @@ Migration on Deployment of New Process Version ============================================== -This example demonstrates how to use the Java API for [process instance migration](http://docs.camunda.org/manual/7.11/user-guide/process-engine/process-instance-migration/) to migrate process instances whenever a new version of a process is deployed. +This example demonstrates how to use the Java API for [process instance migration](http://docs.camunda.org/manual/7.12/user-guide/process-engine/process-instance-migration/) to migrate process instances whenever a new version of a process is deployed. How to Use It? -------------- @@ -49,5 +49,5 @@ protected void migrateInstances(ProcessEngine processEngine, What Else is There to Know? --------------------------- -* The migration plan is generated by calling `#mapEqualActivities` on the migration plan builder. See the documentation on [migration plan generation](http://docs.camunda.org/manual/7.11/user-guide/process-engine/process-instance-migration/#generating-a-migration-plan) for which kind of instruction this method can generate. The example can be extended to explicitly provide instructions via `mapActivities` to support advanced use cases. Such instructions could be parsed from an accompanying deployment descriptor. +* The migration plan is generated by calling `#mapEqualActivities` on the migration plan builder. See the documentation on [migration plan generation](http://docs.camunda.org/manual/7.12/user-guide/process-engine/process-instance-migration/#generating-a-migration-plan) for which kind of instruction this method can generate. The example can be extended to explicitly provide instructions via `mapActivities` to support advanced use cases. Such instructions could be parsed from an accompanying deployment descriptor. * The implementation is not robust when the process instances to migrate are modified in parallel. Migration may fail with an `OptimisticLockingException` and roll back in such a case. diff --git a/migration/migrate-on-deployment/pom.xml b/migration/migrate-on-deployment/pom.xml index 84c4e5754..df29f9489 100644 --- a/migration/migrate-on-deployment/pom.xml +++ b/migration/migrate-on-deployment/pom.xml @@ -10,7 +10,7 @@ war - 7.11.0 + 7.12.0 1.7 1.7 false diff --git a/multi-tenancy/schema-isolation/README.md b/multi-tenancy/schema-isolation/README.md index 9be8d3452..a0d7cf428 100644 --- a/multi-tenancy/schema-isolation/README.md +++ b/multi-tenancy/schema-isolation/README.md @@ -10,31 +10,31 @@
  • Build a Simple JAX-RS Resource
  • Make CDI Injection Tenant-aware
  • -
  • Deploy the Application to JBoss
  • +
  • Deploy the Application to WildFly
  • Testing
  • -Sometimes it is desired to share one Camunda installation between multiple independent parties, also referred to as *tenants*. While sharing an installation means sharing computational resources, the tenants' data should be separated from each other. This tutorial shows how to work with the [one process engine per tenant approach](https://docs.camunda.org/manual/7.11/user-guide/process-engine/multi-tenancy/#one-process-engine-per-tenant). +Sometimes it is desired to share one Camunda installation between multiple independent parties, also referred to as *tenants*. While sharing an installation means sharing computational resources, the tenants' data should be separated from each other. This tutorial shows how to work with the [one process engine per tenant approach](https://docs.camunda.org/manual/7.12/user-guide/process-engine/multi-tenancy/#one-process-engine-per-tenant). In detail it explains how to: -* configure one process engine per tenant on a JBoss Application Server such that data is isolated by database schemas +* configure one process engine per tenant on a WildFly Application Server such that data is isolated by database schemas * develop a process application with tenant-specific deployments * access the correct process engine from a REST resource based on a tenant identifier -See the [user guide](https://docs.camunda.org/manual/7.11/user-guide/process-engine/multi-tenancy/) for a general introduction on multi-tenancy and the different options Camunda offers. +See the [user guide](https://docs.camunda.org/manual/7.12/user-guide/process-engine/multi-tenancy/) for a general introduction on multi-tenancy and the different options Camunda offers. # Before Starting -Before starting, make sure to download the [Camunda BPM JBoss distribution](http://camunda.org/release/camunda-bpm/jboss/) and extract it to a folder. We will call this folder `$CAMUNDA_HOME` in the following explanations. +Before starting, make sure to download the [Camunda BPM WildFly distribution](http://camunda.org/release/camunda-bpm/wildfly/) and extract it to a folder. We will call this folder `$CAMUNDA_HOME` in the following explanations. # Configuring the Database Before configuring process engines, we have to set up a database schema for every tenant. In this section we will explain how to do so. -Start up JBoss by running `$CAMUNDA_HOME/start-camunda.{bat/sh}`. After startup, open your browser and go to `http://localhost:8080/h2/h2`. Enter the following configuration before connecting: +Start up WildFly by running `$CAMUNDA_HOME/start-camunda.{bat/sh}`. After startup, open your browser and go to `http://localhost:8080/h2/h2`. Enter the following configuration before connecting: * **Driver Class**: org.h2.Driver * **JDBC URL**: jdbc:h2:./camunda-h2-dbs/process-engine @@ -49,21 +49,21 @@ create schema TENANT2; ``` Next, inside each schema, create the database tables. To achieve this, get the SQL create scripts -from the jboss distribution from the `sql/create/` folder inside your distribution. +from the WildFly distribution from the `sql/create/` folder inside your distribution. -Inside the h2 console, execute the create scripts (`h2_engine_7.11.0.sql` and -`h2_identity_7.11.0.sql`) scripts after selecting the appropriate schema for the current connection: +Inside the h2 console, execute the create scripts (`h2_engine_7.12.0.sql` and +`h2_identity_7.12.0.sql`) scripts after selecting the appropriate schema for the current connection: ```sql set schema TENANT1; -<> -<> +<> +<> set schema TENANT2; -<> -<> +<> +<> ``` The following screenshot illustrates how to create the tables inside the correct schema: @@ -79,14 +79,14 @@ table structure: ![Multi Tenancy Create Schema](img/create-schema2.png) -Now, stop JBoss. +Now, stop WildFly. # Configuring Process Engines In this step, we configure a process engine for each tenant. We ensure that these engines access the database schemas we have previously created. This way, process data of a tenant cannot interfere with that of another. -Open the file `$CAMUNDA_HOME/server/jboss-as-{version}/standalone/configuration/standalone.xml`. In that file, navigate to the configuration of the Camunda jboss subsystem, declared in an XML element ``. In this file, add two entries to the `` section (do *not* remove default engine configuration): +Open the file `$CAMUNDA_HOME/server/wildfly-{version}/standalone/configuration/standalone.xml`. In that file, navigate to the configuration of the Camunda jboss subsystem, declared in an XML element ``. In this file, add two entries to the `` section (do *not* remove default engine configuration): The configuration of the process engine for tenant 1: @@ -134,7 +134,7 @@ The configuration of the process engine for tenant 2: ``` -(find the complete `standalone.xml` [here](https://github.com/camunda/camunda-bpm-examples/blob/master/multi-tenancy/schema-isolation/standalone.xml)) +(find the complete `standalone.xml` [here](standalone.xml)) By having a look at the `datasource` configuration, you will notice that the data source is shared between all engines. The property `databaseTablePrefix` points the engines to different database schemas. This makes it possible to shares resources like a database connection pool between both engines. Also have a look at the entry `jobExecutorAcquisitionName`. The job acquisition is part of the job executor, a component responsible for executing asynchronous tasks in the process engine (cf. the `job-executor` element in the subsystem configuration). Again, the `jobExecutorAcquisitionName` configuration enables reuse of one acquisition thread for all engines. @@ -145,14 +145,14 @@ The approach of configuring multiple engines also allows you to differ engine co In this step, we describe a process application that deploys different processes for the two tenants. It also exposes a REST resource that returns a tenant's process definitions. To identify the tenant, we provide a user name in the REST request. In the implementation, we use CDI to transparently interact with the correct process engine based on the tenant identifier. -The following descriptions highlight the concepts related to implementing multi-tenancy but are not a step-by-step explanation to develop along. Instead, make sure to checkout the code on github. The code can be built and deployed to JBoss right away and contains all the snippets explained in the following sections. +The following descriptions highlight the concepts related to implementing multi-tenancy in a step-by-step explanation to develop along. ## Set Up the Process Application In the project, we have set up a plain Camunda EJB process application. -In [pom.xml](https://github.com/camunda/camunda-bpm-examples/blob/master/multi-tenancy/schema-isolation/pom.xml), the `camunda-engine-cdi` and `camunda-ejb-client` dependencies are added: +In [pom.xml](pom.xml), the `camunda-engine-cdi` and `camunda-ejb-client` dependencies are added: ```xml @@ -171,7 +171,7 @@ These are required to inject process engines via CDI. ## Configure a Tenant-specific Deployment -In the folder `src/main/resources`, we have added a folder `processes` and two subfolders `tenant1` and `tenant2`. These folders contain a [process for tenant 1](https://github.com/camunda/camunda-bpm-examples/tree/master/multi-tenancy/schema-isolation/src/main/resources/processes/tenant1) and a [process for tenant 2](https://github.com/camunda/camunda-bpm-examples/tree/master/multi-tenancy/schema-isolation/src/main/resources/processes/tenant2), respectively. +In the folder `src/main/resources`, we have added a folder `processes` and two subfolders `tenant1` and `tenant2`. These folders contain a [process for tenant 1](src/main/resources/processes/tenant1) and a [process for tenant 2](src/main/resources/processes/tenant2), respectively. In order to deploy the two definitions to the two different engines, we have added a file `src/main/resources/META-INF/processes.xml` with the following content: @@ -208,7 +208,7 @@ This file declares two *process archives*. By the `process-engine` element, we c ## Build a Simple JAX-RS Resource -To showcase the programming model for multi-tenancy with CDI, we have added a simple REST resource that returns all deployed process definitions for a process engine. The resource has the following [source code](https://github.com/camunda/camunda-bpm-examples/blob/master/multi-tenancy/schema-isolation/src/main/java/org/camunda/bpm/tutorial/multitenancy/ProcessDefinitionResource.java): +To showcase the programming model for multi-tenancy with CDI, we have added a simple REST resource that returns all deployed process definitions for a process engine. The resource has the following [source code](src/main/java/org/camunda/bpm/tutorial/multitenancy/ProcessDefinitionResource.java): ```java @Path("/process-definition") @@ -233,7 +233,7 @@ Note that the distinction between tenants is not made in this resource. ## Make CDI Injection Tenant-aware -We want the injected process engine to always be the one that matches the current tenant making a REST request. For this matter, we have added a request-scoped [tenant bean](https://github.com/camunda/camunda-bpm-examples/blob/master/multi-tenancy/schema-isolation/src/main/java/org/camunda/bpm/tutorial/multitenancy/Tenant.java): +We want the injected process engine to always be the one that matches the current tenant making a REST request. For this matter, we have added a request-scoped [tenant bean](src/main/java/org/camunda/bpm/tutorial/multitenancy/Tenant.java): ```java @RequestScoped @@ -251,14 +251,13 @@ public class Tenant { } ``` -To populate this bean with the tenant ID for the current user, we add a [RestEasy interceptor](https://github.com/camunda/camunda-bpm-examples/blob/master/multi-tenancy/schema-isolation/src/main/java/org/camunda/bpm/tutorial/multitenancy/TenantInterceptor.java). This interceptor is called before a REST request is dispatched to the `ProcessDefinitionResource`. It has the following content: +To populate this bean with the tenant ID for the current user, we add a [RestEasy interceptor](src/main/java/org/camunda/bpm/tutorial/multitenancy/TenantInterceptor.java). This interceptor is called before a REST request is dispatched to the `ProcessDefinitionResource`. It has the following content: ```java @Provider -@ServerInterceptor -public class TenantInterceptor implements PreProcessInterceptor { +public class TenantInterceptor implements ContainerRequestFilter { - protected static final Map USER_TENANT_MAPPING = new HashMap(); + protected static final Map USER_TENANT_MAPPING = new HashMap<>(); static { USER_TENANT_MAPPING.put("kermit", "tenant1"); @@ -268,8 +267,9 @@ public class TenantInterceptor implements PreProcessInterceptor { @Inject protected Tenant tenant; - public ServerResponse preProcess(HttpRequest request, ResourceMethod method) throws Failure, WebApplicationException { - List user = request.getUri().getQueryParameters().get("user"); + @Override + public void filter(ContainerRequestContext requestContext) throws IOException { + List user = requestContext.getUriInfo().getQueryParameters().get("user"); if (user.size() != 1) { throw new WebApplicationException(Status.BAD_REQUEST); @@ -277,15 +277,13 @@ public class TenantInterceptor implements PreProcessInterceptor { String tenantForUser = USER_TENANT_MAPPING.get(user.get(0)); tenant.setId(tenantForUser); - - return null; } } ``` Note that the tenant ID is determined based on a simple static map. Of course, in real-world applications one would implement a more sophisticated lookup procedure here. -To resolve the process engine based on the tenant, we have [specialized the process engine producer](https://github.com/camunda/camunda-bpm-examples/blob/master/multi-tenancy/schema-isolation/src/main/java/org/camunda/bpm/tutorial/multitenancy/TenantAwareProcessEngineServicesProducer.java) bean as follows: +To resolve the process engine based on the tenant, we have [specialized the process engine producer](src/main/java/org/camunda/bpm/tutorial/multitenancy/TenantAwareProcessEngineServicesProducer.java) bean as follows: ```java @Specializes @@ -338,9 +336,9 @@ public class TenantAwareProcessEngineServicesProducer extends ProcessEngineServi The producer determines the engine based on the current tenant. It encapsulates the logic of resolving the process engine for the current tenant entirely. Every bean can simply declare `@Inject ProcessEngine` without specifying which specific engine is addressed to work with the current tenant's engine. -# Deploy the Application to JBoss +# Deploy the Application to WildFly -Start up JBoss. Build the process application and deploy the resulting war file to JBoss. +Start up WildFly. Build the process application and deploy the resulting war file to WildFly. Make a GET request (e.g., by entering the URL in your browser) against the following URL to get all process definitions deployed to tenant 1's engine: http://localhost:8080/multi-tenancy-tutorial/process-definition?user=kermit @@ -365,10 +363,10 @@ The test class [ProcessIntegrationTest](src/test/java/org/camunda/bpm/tutorial/m Follow the steps to run the test: -* download the [Camunda BPM JBoss distribution](http://camunda.org/release/camunda-bpm/jboss/) -* replace the `camunda-bpm-jboss-{version}/server/jboss-as-{version}/standalone/configuration/standalone.xml` with +* download the [Camunda BPM WildFly distribution](http://camunda.org/release/camunda-bpm/wildfly/) +* replace the `camunda-bpm-wildfly-{version}/server/wildfly-{version}/standalone/configuration/standalone.xml` with * [standalone.xml](standalone.xml) (two schemas - requires manual schema creation) or * [standalone_test.xml](standalone_test.xml) (two databases - auto schema creation) -* start the server using the script `camunda-bpm-jboss-{version}/start-camunda.bat` +* start the server using the script `camunda-bpm-wildfly-{version}/start-camunda.bat` * go to project directory and run the test with the Maven command `mvn test` diff --git a/multi-tenancy/schema-isolation/pom.xml b/multi-tenancy/schema-isolation/pom.xml index f72992785..730647e49 100644 --- a/multi-tenancy/schema-isolation/pom.xml +++ b/multi-tenancy/schema-isolation/pom.xml @@ -8,9 +8,9 @@ 0.0.1-SNAPSHOT - 7.11.0 - 1.1.2.Final - 7.2.1.Final + 7.12.0 + 1.1.10.Final + 2.2.0.Final 1.7 1.7 UTF-8 @@ -62,16 +62,16 @@ org.jboss.spec jboss-javaee-web-6.0 - 3.0.1.Final + 3.0.2.Final pom provided - + org.jboss.resteasy resteasy-jaxrs - 2.3.5.Final + 3.9.0.Final provided @@ -81,7 +81,7 @@ junit junit test - 4.11 + 4.12 @@ -136,17 +136,17 @@ - jbossas-remote + wildfly-remote true - - org.jboss.as - jboss-as-arquillian-container-remote - 7.2.0.FINAL + + org.wildfly.arquillian + wildfly-arquillian-container-remote + ${wildfly.container.adapter.version} test diff --git a/multi-tenancy/schema-isolation/src/main/java/org/camunda/bpm/tutorial/multitenancy/ProcessDefinitionDto.java b/multi-tenancy/schema-isolation/src/main/java/org/camunda/bpm/tutorial/multitenancy/ProcessDefinitionDto.java index 6fb3650d6..72bde75b5 100644 --- a/multi-tenancy/schema-isolation/src/main/java/org/camunda/bpm/tutorial/multitenancy/ProcessDefinitionDto.java +++ b/multi-tenancy/schema-isolation/src/main/java/org/camunda/bpm/tutorial/multitenancy/ProcessDefinitionDto.java @@ -66,7 +66,7 @@ public static ProcessDefinitionDto fromProcessDefinition(ProcessDefinition defin } public static List fromProcessDefinitions(List definitions) { - List dtos = new ArrayList(); + List dtos = new ArrayList<>(); for (ProcessDefinition definition : definitions) { dtos.add(fromProcessDefinition(definition)); diff --git a/multi-tenancy/schema-isolation/src/main/java/org/camunda/bpm/tutorial/multitenancy/TenantInterceptor.java b/multi-tenancy/schema-isolation/src/main/java/org/camunda/bpm/tutorial/multitenancy/TenantInterceptor.java index 32f8a38f0..1e9286bc0 100644 --- a/multi-tenancy/schema-isolation/src/main/java/org/camunda/bpm/tutorial/multitenancy/TenantInterceptor.java +++ b/multi-tenancy/schema-isolation/src/main/java/org/camunda/bpm/tutorial/multitenancy/TenantInterceptor.java @@ -16,31 +16,26 @@ */ package org.camunda.bpm.tutorial.multitenancy; +import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.inject.Inject; import javax.ws.rs.WebApplicationException; +import javax.ws.rs.container.ContainerRequestContext; +import javax.ws.rs.container.ContainerRequestFilter; import javax.ws.rs.core.Response.Status; import javax.ws.rs.ext.Provider; -import org.jboss.resteasy.annotations.interception.ServerInterceptor; -import org.jboss.resteasy.core.ResourceMethod; -import org.jboss.resteasy.core.ServerResponse; -import org.jboss.resteasy.spi.Failure; -import org.jboss.resteasy.spi.HttpRequest; -import org.jboss.resteasy.spi.interception.PreProcessInterceptor; - /** * @author Thorben Lindhauer * */ @Provider -@ServerInterceptor -public class TenantInterceptor implements PreProcessInterceptor { +public class TenantInterceptor implements ContainerRequestFilter { - protected static final Map USER_TENANT_MAPPING = new HashMap(); + protected static final Map USER_TENANT_MAPPING = new HashMap<>(); static { USER_TENANT_MAPPING.put("kermit", "tenant1"); @@ -50,8 +45,9 @@ public class TenantInterceptor implements PreProcessInterceptor { @Inject protected Tenant tenant; - public ServerResponse preProcess(HttpRequest request, ResourceMethod method) throws Failure, WebApplicationException { - List user = request.getUri().getQueryParameters().get("user"); + @Override + public void filter(ContainerRequestContext requestContext) throws IOException { + List user = requestContext.getUriInfo().getQueryParameters().get("user"); if (user.size() != 1) { throw new WebApplicationException(Status.BAD_REQUEST); @@ -59,7 +55,6 @@ public ServerResponse preProcess(HttpRequest request, ResourceMethod method) thr String tenantForUser = USER_TENANT_MAPPING.get(user.get(0)); tenant.setId(tenantForUser); - - return null; } + } diff --git a/multi-tenancy/schema-isolation/src/test/java/org/camunda/bpm/tutorial/multitenancy/ProcessIntegrationTest.java b/multi-tenancy/schema-isolation/src/test/java/org/camunda/bpm/tutorial/multitenancy/ProcessIntegrationTest.java index 26da17ac8..e92166f53 100644 --- a/multi-tenancy/schema-isolation/src/test/java/org/camunda/bpm/tutorial/multitenancy/ProcessIntegrationTest.java +++ b/multi-tenancy/schema-isolation/src/test/java/org/camunda/bpm/tutorial/multitenancy/ProcessIntegrationTest.java @@ -59,7 +59,6 @@ public class ProcessIntegrationTest { public static WebArchive createDeployment() { // resolve given dependencies from Maven POM File[] libs = Maven.resolver() - .offline(false) .loadPomFromFile("pom.xml") .importCompileAndRuntimeDependencies().resolve().withoutTransitivity().asFile(); diff --git a/multi-tenancy/schema-isolation/standalone.xml b/multi-tenancy/schema-isolation/standalone.xml index cd6ac8d08..669a77b37 100644 --- a/multi-tenancy/schema-isolation/standalone.xml +++ b/multi-tenancy/schema-isolation/standalone.xml @@ -1,6 +1,6 @@ - + @@ -19,24 +19,45 @@ - - - + + + + + + + + + + + + + + + + - + + + + + + + + + - + @@ -44,26 +65,46 @@ + + + + + + + + + + + + + - - - + + + + + + + + + + - + - + - + @@ -72,7 +113,7 @@ - + @@ -81,12 +122,6 @@ - - - - - - @@ -94,20 +129,40 @@ + + + + + + - + + + + + + + + + + + + + + - - jdbc:h2:mem:test;DB_CLOSE_DELAY=-1 + + jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE h2 sa sa - + jdbc:h2:./camunda-h2-dbs/process-engine;DB_CLOSE_DELAY=-1;MVCC=TRUE;DB_CLOSE_ON_EXIT=FALSE h2 + TRANSACTION_READ_COMMITTED sa sa @@ -120,73 +175,231 @@ - - + + + + + + + + + + - + false - true + + + + + + + + + + + + + + + - + + - + - - + + - - + + - + - - + + + + - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + - - - - + + + + + - + @@ -206,7 +419,7 @@ - + @@ -214,22 +427,27 @@ - - - + + + - + + + + + - - + + - + + - + @@ -246,6 +464,14 @@ + + + + + + + + @@ -253,32 +479,42 @@ - - - - - - - + + + + + + - - + + - + + - - - - - - + + + + + + + + + + + + + + + + + - - true + ${jboss.bind.address:127.0.0.1} @@ -288,7 +524,7 @@ - + @@ -364,14 +600,12 @@ --> - java:jboss/datasources/ProcessEngine none TENANT1. default - false true true @@ -389,7 +623,6 @@ TENANT2. default - false true true @@ -403,10 +636,11 @@ - job-executor-tp + 3 + 5 + 10 - SEQUENTIAL 300000 5000 @@ -424,27 +658,17 @@ - - - - - - + + + - - - - - + - + \ No newline at end of file diff --git a/multi-tenancy/schema-isolation/standalone_test.xml b/multi-tenancy/schema-isolation/standalone_test.xml index 585d86701..a99761c3a 100644 --- a/multi-tenancy/schema-isolation/standalone_test.xml +++ b/multi-tenancy/schema-isolation/standalone_test.xml @@ -1,7 +1,6 @@ - - + @@ -20,26 +19,45 @@ - - - + + + + + + + + + + + + + + + + - - - + + + + + + + + + - + @@ -47,27 +65,46 @@ + + + + + + + + + + + + + - - - + + + + + + + + + + - - + - + - + @@ -76,7 +113,7 @@ - + @@ -85,12 +122,6 @@ - - - - - - @@ -98,36 +129,58 @@ + + + + + + + + + + + + + + + + + - + + + - - jdbc:h2:mem:test;DB_CLOSE_DELAY=-1 + + jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE h2 sa sa - + jdbc:h2:./camunda-h2-dbs/process-engine;DB_CLOSE_DELAY=-1;MVCC=TRUE;DB_CLOSE_ON_EXIT=FALSE h2 + TRANSACTION_READ_COMMITTED sa sa - + jdbc:h2:./camunda-h2-dbs/process-engine-tenant1;DB_CLOSE_DELAY=-1;MVCC=TRUE;DB_CLOSE_ON_EXIT=FALSE h2 + TRANSACTION_READ_COMMITTED sa sa - + jdbc:h2:./camunda-h2-dbs/process-engine-tenant2;DB_CLOSE_DELAY=-1;MVCC=TRUE;DB_CLOSE_ON_EXIT=FALSE h2 + TRANSACTION_READ_COMMITTED sa sa @@ -140,73 +193,231 @@ - - + + - + + + + + + + + + false - true + + + + + + + + + + + + + + + - + + - + - - + + - - + + - + - - + + + + - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + - - - - + + + + + - + @@ -226,7 +437,7 @@ - + @@ -234,22 +445,27 @@ - - - + + + - + + + + + - - + + - + + - + @@ -266,6 +482,14 @@ + + + + + + + + @@ -273,32 +497,42 @@ - - - - - - - + + + + + + - - + + - + + - - - - - - + + + + + + + + + + + + + + + + + - - true + ${jboss.bind.address:127.0.0.1} @@ -308,162 +542,89 @@ - + - - java:jboss/datasources/ProcessEngine - - - full - - - org.camunda.bpm.container.impl.jboss.config.ManagedJtaProcessEngineConfiguration - + java:jboss/datasources/ProcessEngine + full - - default - - - true - - - true - - - true - + default + true + true + true - - org.camunda.bpm.application.impl.event.ProcessApplicationEventListenerPlugin - + org.camunda.bpm.application.impl.event.ProcessApplicationEventListenerPlugin - - org.camunda.spin.plugin.impl.SpinProcessEnginePlugin - + org.camunda.spin.plugin.impl.SpinProcessEnginePlugin - - org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin - + org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin - - java:jboss/datasources/ProcessEngine-tenant1 - - - full - - - org.camunda.bpm.container.impl.jboss.config.ManagedJtaProcessEngineConfiguration - + java:jboss/datasources/ProcessEngine-tenant1 + full - - default - - - true - - - true - - - true - + default + true + true + true - - org.camunda.bpm.application.impl.event.ProcessApplicationEventListenerPlugin - + org.camunda.bpm.application.impl.event.ProcessApplicationEventListenerPlugin - - org.camunda.spin.plugin.impl.SpinProcessEnginePlugin - + org.camunda.spin.plugin.impl.SpinProcessEnginePlugin - - org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin - + org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin - - java:jboss/datasources/ProcessEngine-tenant2 - - - full - - - org.camunda.bpm.container.impl.jboss.config.ManagedJtaProcessEngineConfiguration - + java:jboss/datasources/ProcessEngine-tenant2 + full - - default - - - true - - - true - - - true - + default + true + true + true - - org.camunda.bpm.application.impl.event.ProcessApplicationEventListenerPlugin - + org.camunda.bpm.application.impl.event.ProcessApplicationEventListenerPlugin - - org.camunda.spin.plugin.impl.SpinProcessEnginePlugin - + org.camunda.spin.plugin.impl.SpinProcessEnginePlugin - - org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin - + org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin - - job-executor-tp - + 3 + 5 + 10 - - SEQUENTIAL - - - 300000 - - - 5000 - - - 3 - + 300000 + 5000 + 3 - @@ -471,24 +632,17 @@ - - - - - + + + - - - - - + - - + \ No newline at end of file diff --git a/multi-tenancy/tenant-identifier-embedded/README.md b/multi-tenancy/tenant-identifier-embedded/README.md index 19ec4704d..edf3b92e6 100644 --- a/multi-tenancy/tenant-identifier-embedded/README.md +++ b/multi-tenancy/tenant-identifier-embedded/README.md @@ -12,7 +12,7 @@ The example process for the tenants looks like: ## How it works -Please refer to the [User Guide](http://docs.camunda.org/manual/7.11/user-guide/process-engine/multi-tenancy/) for details about multi-tenancy. +Please refer to the [User Guide](http://docs.camunda.org/manual/7.12/user-guide/process-engine/multi-tenancy/) for details about multi-tenancy. ### Deploy a Process Definition with Tenant-Id diff --git a/multi-tenancy/tenant-identifier-embedded/pom.xml b/multi-tenancy/tenant-identifier-embedded/pom.xml index e095fb411..d9d81cee4 100644 --- a/multi-tenancy/tenant-identifier-embedded/pom.xml +++ b/multi-tenancy/tenant-identifier-embedded/pom.xml @@ -7,7 +7,7 @@ 0.0.1-SNAPSHOT - 7.11.0 + 7.12.0 1.7 1.7 UTF-8 diff --git a/multi-tenancy/tenant-identifier-shared-definitions/README.md b/multi-tenancy/tenant-identifier-shared-definitions/README.md index 2970bed83..7ccdc2100 100644 --- a/multi-tenancy/tenant-identifier-shared-definitions/README.md +++ b/multi-tenancy/tenant-identifier-shared-definitions/README.md @@ -15,7 +15,7 @@ The example contains two shared process definitions (main proces and sub-process ## How it works -Please refer to the [User Guide](http://docs.camunda.org/manual/7.11/user-guide/process-engine/multi-tenancy/) for details about multi-tenancy. +Please refer to the [User Guide](http://docs.camunda.org/manual/7.12/user-guide/process-engine/multi-tenancy/) for details about multi-tenancy. ### Provide Tenant Ids for Instances of Shared Process Definitions diff --git a/multi-tenancy/tenant-identifier-shared-definitions/pom.xml b/multi-tenancy/tenant-identifier-shared-definitions/pom.xml index 0d9fccbe1..af492369a 100644 --- a/multi-tenancy/tenant-identifier-shared-definitions/pom.xml +++ b/multi-tenancy/tenant-identifier-shared-definitions/pom.xml @@ -7,7 +7,7 @@ 0.0.1-SNAPSHOT - 7.11.0 + 7.12.0 1.7 1.7 UTF-8 diff --git a/multi-tenancy/tenant-identifier-shared/README.md b/multi-tenancy/tenant-identifier-shared/README.md index 54e8a0b9e..f6dd11f0e 100644 --- a/multi-tenancy/tenant-identifier-shared/README.md +++ b/multi-tenancy/tenant-identifier-shared/README.md @@ -13,7 +13,7 @@ The example process for the tenants looks like: ## How it works -Please refer to the [User Guide](http://docs.camunda.org/manual/7.11/user-guide/process-engine/multi-tenancy/) for details about multi-tenancy. +Please refer to the [User Guide](http://docs.camunda.org/manual/7.12/user-guide/process-engine/multi-tenancy/) for details about multi-tenancy. ### Deploy a Process Definition with Tenant-Id diff --git a/multi-tenancy/tenant-identifier-shared/pom.xml b/multi-tenancy/tenant-identifier-shared/pom.xml index d3ab24ba6..2eb568aa4 100644 --- a/multi-tenancy/tenant-identifier-shared/pom.xml +++ b/multi-tenancy/tenant-identifier-shared/pom.xml @@ -8,7 +8,7 @@ war - 7.11.0 + 7.12.0 1.7 1.7 UTF-8 diff --git a/process-engine-plugin/bpmn-parse-listener-on-user-task/README.md b/process-engine-plugin/bpmn-parse-listener-on-user-task/README.md index e11de0e27..d4572e85b 100644 --- a/process-engine-plugin/bpmn-parse-listener-on-user-task/README.md +++ b/process-engine-plugin/bpmn-parse-listener-on-user-task/README.md @@ -16,7 +16,7 @@ After having looked through the code, you will understand the behavior of a BPMN What is the idea/use case of this demo: * Assignees of the user tasks are often so busy that they do easily forget to check if they have a user task to complete. -* Therefore, as soon as a user task is reached, the assignee should be notified that he has work to do :-) +* Therefore, as soon as a user task is assigned, the assignee should be notified that he has work to do :-) ## Show me the important parts! @@ -60,7 +60,7 @@ public class InformAssigneeParseListener extends AbstractBpmnParseListener { UserTaskActivityBehavior userTaskActivityBehavior = (UserTaskActivityBehavior) activityBehavior; userTaskActivityBehavior .getTaskDefinition() - .addTaskListener("create", InformAssigneeTaskListener.getInstance()); + .addTaskListener("assignment", InformAssigneeTaskListener.getInstance()); } } } @@ -120,8 +120,8 @@ The Process Engine BPMN Parser parses the process definition. The BPMN Parse Lis to the BPMN Parser and adds the Task Listener to the given user task. After that, the process engine starts the process instance and as soon as user task is entered it invokes the `notify` -implementation of the Task Listener. We then complete the user task and the other the `notify` method from the Task Listener -is executed once again. +implementation of the Task Listener. We then complete the user task and the `notify` method from the Task Listener +is executed once again. Afterwards, we change the assignee manually and the Task Listener is called a third time. ## How to use it? diff --git a/process-engine-plugin/bpmn-parse-listener-on-user-task/pom.xml b/process-engine-plugin/bpmn-parse-listener-on-user-task/pom.xml index b4c097e84..93e967727 100644 --- a/process-engine-plugin/bpmn-parse-listener-on-user-task/pom.xml +++ b/process-engine-plugin/bpmn-parse-listener-on-user-task/pom.xml @@ -7,7 +7,7 @@ an example project that shows how to parse custom attributes with a bpmn parse listener plugin - 7.11.0 + 7.12.0 1.7 1.7 UTF-8 @@ -23,14 +23,14 @@ junit junit - 4.11 + 4.12 test com.h2database h2 - 1.3.171 + 1.4.190 test @@ -38,7 +38,7 @@ org.slf4j slf4j-jdk14 - 1.7.12 + 1.7.26 diff --git a/process-engine-plugin/bpmn-parse-listener-on-user-task/src/main/java/org/camunda/bpm/example/parselistener/InformAssigneeParseListener.java b/process-engine-plugin/bpmn-parse-listener-on-user-task/src/main/java/org/camunda/bpm/example/parselistener/InformAssigneeParseListener.java index 53cd993fe..80d41c732 100644 --- a/process-engine-plugin/bpmn-parse-listener-on-user-task/src/main/java/org/camunda/bpm/example/parselistener/InformAssigneeParseListener.java +++ b/process-engine-plugin/bpmn-parse-listener-on-user-task/src/main/java/org/camunda/bpm/example/parselistener/InformAssigneeParseListener.java @@ -37,7 +37,7 @@ public void parseUserTask(Element userTaskElement, ScopeImpl scope, ActivityImpl UserTaskActivityBehavior userTaskActivityBehavior = (UserTaskActivityBehavior) activityBehavior; userTaskActivityBehavior .getTaskDefinition() - .addTaskListener("create", InformAssigneeTaskListener.getInstance()); + .addTaskListener("assignment", InformAssigneeTaskListener.getInstance()); } } } diff --git a/process-engine-plugin/bpmn-parse-listener-on-user-task/src/test/java/org/camunda/bpm/example/test/BpmnParseListenerOnUserTaskTest.java b/process-engine-plugin/bpmn-parse-listener-on-user-task/src/test/java/org/camunda/bpm/example/test/BpmnParseListenerOnUserTaskTest.java index d2f17d173..3a241cc99 100644 --- a/process-engine-plugin/bpmn-parse-listener-on-user-task/src/test/java/org/camunda/bpm/example/test/BpmnParseListenerOnUserTaskTest.java +++ b/process-engine-plugin/bpmn-parse-listener-on-user-task/src/test/java/org/camunda/bpm/example/test/BpmnParseListenerOnUserTaskTest.java @@ -72,8 +72,13 @@ public void testBpmnParseListener() throws IOException { assertThat(assigneeList.size(), is(2)); assertThat(assigneeList.get(1), is("Fozzie")); - // complete second user task + // reset the assignee task = taskService.createTaskQuery().singleResult(); + taskService.setAssignee(task.getId(), "Kermit"); + assertThat(assigneeList.size(), is(3)); + assertThat(assigneeList.get(2), is("Kermit")); + + // complete second user task taskService.complete(task.getId()); // check if process instance ended diff --git a/process-engine-plugin/bpmn-parse-listener/pom.xml b/process-engine-plugin/bpmn-parse-listener/pom.xml index d02fe94e1..472843471 100644 --- a/process-engine-plugin/bpmn-parse-listener/pom.xml +++ b/process-engine-plugin/bpmn-parse-listener/pom.xml @@ -7,7 +7,7 @@ an example project that shows how to parse custom attributes with a bpmn parse listener plugin - 7.11.0 + 7.12.0 1.7 1.7 UTF-8 @@ -23,14 +23,14 @@ junit junit - 4.11 + 4.12 test com.h2database h2 - 1.3.171 + 1.4.190 test @@ -38,7 +38,7 @@ org.slf4j slf4j-jdk14 - 1.7.12 + 1.7.26 diff --git a/process-engine-plugin/command-interceptor-blocking/pom.xml b/process-engine-plugin/command-interceptor-blocking/pom.xml index fb9107b8f..f1924bb8f 100644 --- a/process-engine-plugin/command-interceptor-blocking/pom.xml +++ b/process-engine-plugin/command-interceptor-blocking/pom.xml @@ -6,7 +6,7 @@ Camunda Command Interceptor Example - 7.11.0 + 7.12.0 1.7 1.7 UTF-8 @@ -34,21 +34,21 @@ junit junit - 4.11 + 4.12 test com.h2database h2 - 1.4.178 + 1.4.190 org.slf4j slf4j-jdk14 - 1.7.12 + 1.7.26 diff --git a/process-engine-plugin/custom-history-level/pom.xml b/process-engine-plugin/custom-history-level/pom.xml index 8d72851d5..3a199a164 100644 --- a/process-engine-plugin/custom-history-level/pom.xml +++ b/process-engine-plugin/custom-history-level/pom.xml @@ -7,7 +7,7 @@ an example project that shows how to implement a custom history level for camunda BPM platform - 7.11.0 + 7.12.0 1.7 1.7 UTF-8 @@ -23,14 +23,14 @@ junit junit - 4.11 + 4.12 test com.h2database h2 - 1.3.171 + 1.4.190 test @@ -38,7 +38,7 @@ org.slf4j slf4j-jdk14 - 1.7.12 + 1.7.26 diff --git a/process-engine-plugin/failed-job-retry-profile/pom.xml b/process-engine-plugin/failed-job-retry-profile/pom.xml index fa71bd884..78cd3fd78 100644 --- a/process-engine-plugin/failed-job-retry-profile/pom.xml +++ b/process-engine-plugin/failed-job-retry-profile/pom.xml @@ -9,7 +9,7 @@ 0.1.0-SNAPSHOT - 7.11.0 + 7.12.0 1.7 1.7 UTF-8 @@ -43,21 +43,21 @@ com.h2database h2 - 1.3.171 + 1.4.190 test junit junit - 4.11 + 4.12 test - commons-lang - commons-lang - 2.6 + org.apache.commons + commons-lang3 + 3.8.1 test diff --git a/process-engine-plugin/failed-job-retry-profile/src/test/java/org/camunda/bpm/example/test/FailedJobRetryProfileTest.java b/process-engine-plugin/failed-job-retry-profile/src/test/java/org/camunda/bpm/example/test/FailedJobRetryProfileTest.java index 400fac7aa..e9825b527 100644 --- a/process-engine-plugin/failed-job-retry-profile/src/test/java/org/camunda/bpm/example/test/FailedJobRetryProfileTest.java +++ b/process-engine-plugin/failed-job-retry-profile/src/test/java/org/camunda/bpm/example/test/FailedJobRetryProfileTest.java @@ -24,7 +24,7 @@ import java.text.SimpleDateFormat; import java.util.Date; -import org.apache.commons.lang.time.DateUtils; +import org.apache.commons.lang3.time.DateUtils; import org.camunda.bpm.engine.ManagementService; import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.engine.impl.persistence.entity.JobEntity; diff --git a/scripttask/xquery-scripttask/pom.xml b/scripttask/xquery-scripttask/pom.xml index 663c4caaf..4b34e0a62 100755 --- a/scripttask/xquery-scripttask/pom.xml +++ b/scripttask/xquery-scripttask/pom.xml @@ -11,7 +11,7 @@ jar - 7.11.0 + 7.12.0 1.7 1.7 UTF-8 @@ -45,35 +45,35 @@ org.camunda.template-engines camunda-template-engines-xquery-saxon - 1.1.0-SNAPSHOT + 1.1.0 org.slf4j slf4j-jdk14 - 1.7.12 + 1.7.26 junit junit - 4.11 + 4.12 test org.assertj assertj-core - 1.6.0 + 2.9.1 test com.h2database h2 - 1.3.168 + 1.4.190 test diff --git a/scripttask/xslt-scripttask/pom.xml b/scripttask/xslt-scripttask/pom.xml index 46fba05ae..e8ac956b4 100644 --- a/scripttask/xslt-scripttask/pom.xml +++ b/scripttask/xslt-scripttask/pom.xml @@ -10,7 +10,7 @@ jar - 7.11.0 + 7.12.0 1.7 1.7 UTF-8 @@ -57,28 +57,28 @@ org.slf4j slf4j-jdk14 - 1.7.12 + 1.7.26 junit junit - 4.11 + 4.12 test org.assertj assertj-core - 1.6.0 + 2.9.1 test com.h2database h2 - 1.3.168 + 1.4.190 test diff --git a/sdk-js/browser-forms-angular/README.md b/sdk-js/browser-forms-angular/README.md index 7335b0b69..be2700cf6 100644 --- a/sdk-js/browser-forms-angular/README.md +++ b/sdk-js/browser-forms-angular/README.md @@ -7,7 +7,8 @@ This example attempts to illustrate the way to implement (or use) the [JS SDK](h Supported browsers are: - Firefox - Google Chrome -- Internet Explorer 9+ +- Edge +- Internet Explorer 11+ ## Setup @@ -68,13 +69,13 @@ and then ```js new CamSDK.Form({ client: camClient, - + // with the URL we build previously formUrl: url, - + // and the task ID taskId: taskId, - + // $formContainer can be a DOM element or a jQuery object containerElement: $formContainer, diff --git a/sdk-js/browser-forms-angular/camunda-bpm-sdk-angular.js b/sdk-js/browser-forms-angular/camunda-bpm-sdk-angular.js index 41adc5984..318d8592e 100644 --- a/sdk-js/browser-forms-angular/camunda-bpm-sdk-angular.js +++ b/sdk-js/browser-forms-angular/camunda-bpm-sdk-angular.js @@ -33,127 +33,122 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +'use strict'; // exposify: CamSDK.Form -'use strict'; - -// exposify: CamSDK.Form var CamundaForm = require('./../../forms/camunda-form'); -var angular = (typeof window !== "undefined" ? window['angular'] : typeof global !== "undefined" ? global['angular'] : null); +var angular = typeof window !== "undefined" ? window['angular'] : typeof global !== "undefined" ? global['angular'] : null; var $ = CamundaForm.$; -var constants = require('./../../forms/constants'); +var constants = require('./../../forms/constants'); -var CamundaFormAngular = CamundaForm.extend( - { +var CamundaFormAngular = CamundaForm.extend({ + renderForm: function renderForm() { + var self = this; + this.formElement = angular.element(this.formElement); // first add the form to the DOM: - renderForm: function() { - var self = this; + CamundaForm.prototype.renderForm.apply(this, arguments); // next perform auto-scope binding for all fields which do not have custom bindings - this.formElement = angular.element(this.formElement); + function autoBind(key, el) { + var element = $(el); - // first add the form to the DOM: - CamundaForm.prototype.renderForm.apply(this, arguments); + if (!element.attr('ng-model')) { + var camVarName = element.attr(constants.DIRECTIVE_CAM_VARIABLE_NAME); - // next perform auto-scope binding for all fields which do not have custom bindings - function autoBind(key, el) { - var element = $(el); - if(!element.attr('ng-model')) { - var camVarName = element.attr(constants.DIRECTIVE_CAM_VARIABLE_NAME); - if(camVarName) { - element.attr('ng-model', camVarName); - } + if (camVarName) { + element.attr('ng-model', camVarName); } } + } - for(var i = 0; i < this.formFieldHandlers.length; i++) { - var handler = this.formFieldHandlers[i]; - var selector = handler.selector; - $(selector, self.formElement).each(autoBind); - } - - this.formElement = angular.element(this.formElement); - // finally compile the form with angular and linked to the current scope - var injector = self.formElement.injector(); - if (!injector) { return; } - - var scope = self.formElement.scope(); - injector.invoke(['$compile', function($compile) { - $compile(self.formElement)(scope); - }]); - scope.camForm = this; - }, - - executeFormScript: function(script) { - - // overrides executeFormScript to make sure the following variables / functions are available to script implementations: - - // * $scope - // * inject + for (var i = 0; i < this.formFieldHandlers.length; i++) { + var handler = this.formFieldHandlers[i]; + var selector = handler.selector; + $(selector, self.formElement).each(autoBind); + } - this.formElement = angular.element(this.formElement); + this.formElement = angular.element(this.formElement); // finally compile the form with angular and linked to the current scope - var moment = require('moment'); - var injector = this.formElement.injector(); - var scope = this.formElement.scope(); + var injector = self.formElement.injector(); - /*eslint-disable */ - (function(camForm, $scope, moment) { - // hook to create the service with injection - var inject = function(extensions) { - // if result is an array or function we expect - // an injectable service - if (angular.isFunction(extensions) || angular.isArray(extensions)) { - injector.instantiate(extensions, { $scope: scope }); - } else { - throw new Error('Must call inject(array|fn)'); - } - }; + if (!injector) { + return; + } + var scope = self.formElement.scope(); + injector.invoke(['$compile', function ($compile) { + $compile(self.formElement)(scope); + }]); + scope.camForm = this; + }, + executeFormScript: function executeFormScript(script) { + // overrides executeFormScript to make sure the following variables / functions are available to script implementations: + // * $scope + // * inject + this.formElement = angular.element(this.formElement); + + var moment = require('moment'); + + var injector = this.formElement.injector(); + var scope = this.formElement.scope(); + /*eslint-disable */ + + (function (camForm, $scope, moment) { + // hook to create the service with injection + var inject = function inject(extensions) { + // if result is an array or function we expect + // an injectable service + if (angular.isFunction(extensions) || angular.isArray(extensions)) { + injector.instantiate(extensions, { + $scope: scope + }); + } else { + throw new Error('Must call inject(array|fn)'); + } + }; /* jshint evil: true */ - eval(script); - /* jshint evil: false */ - })(this, scope, moment); - /*eslint-enable */ - }, + eval(script); + /* jshint evil: false */ + })(this, scope, moment); + /*eslint-enable */ - fireEvent: function() { + }, + fireEvent: function fireEvent() { + // overrides fireEvent to make sure event listener is invoked in an apply phase + this.formElement = angular.element(this.formElement); + var self = this; + var args = arguments; + var scope = this.formElement.scope(); - // overrides fireEvent to make sure event listener is invoked in an apply phase - this.formElement = angular.element(this.formElement); + var doFireEvent = function doFireEvent() { + CamundaForm.prototype.fireEvent.apply(self, args); + }; - var self = this; - var args = arguments; - var scope = this.formElement.scope(); + var injector = self.formElement.injector(); - var doFireEvent = function() { - CamundaForm.prototype.fireEvent.apply(self, args); - }; + if (!injector) { + return; + } - var injector = self.formElement.injector(); - if (!injector) { return; } + injector.invoke(['$rootScope', function ($rootScope) { + var phase = $rootScope.$$phase; // only apply if not already in digest / apply - injector.invoke(['$rootScope', function($rootScope) { - var phase = $rootScope.$$phase; - // only apply if not already in digest / apply - if(phase !== '$apply' && phase !== '$digest') { - scope.$apply(function() { - doFireEvent(); - }); - } else { + if (phase !== '$apply' && phase !== '$digest') { + scope.$apply(function () { doFireEvent(); - } - - }]); - } - }); - + }); + } else { + doFireEvent(); + } + }]); + } +}); module.exports = CamundaFormAngular; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./../../forms/camunda-form":38,"./../../forms/constants":39,"moment":51}],2:[function(require,module,exports){ +},{"./../../forms/camunda-form":38,"./../../forms/constants":39,"moment":61}],2:[function(require,module,exports){ (function (global){ /* * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH @@ -171,57 +166,47 @@ module.exports = CamundaFormAngular; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; -var angular = (typeof window !== "undefined" ? window['angular'] : typeof global !== "undefined" ? global['angular'] : null), +var angular = typeof window !== "undefined" ? window['angular'] : typeof global !== "undefined" ? global['angular'] : null, CamundaFormAngular = require('./camunda-form-angular'), - isType = require('./../../forms/type-util').isType; + isType = require('./../../forms/type-util').isType; // define embedded forms angular module -// define embedded forms angular module -var ngModule = angular.module('cam.embedded.forms', []); +var ngModule = angular.module('cam.embedded.forms', []); /** * Exposes 'cam-variable-name' as angular directive making sure * that updates to a HTML Control made through the camunda form * infrastructure are propagated over ngModel bindings. */ -ngModule.directive('camVariableName', ['$rootScope', function($rootScope) { + +ngModule.directive('camVariableName', ['$rootScope', function ($rootScope) { return { require: 'ngModel', - link: function(scope, elm, attrs, ctrl) { + link: function link(scope, elm, attrs, ctrl) { + elm.on('camFormVariableApplied', function (evt, value) { + var phase = $rootScope.$$phase; // only apply if not already in digest / apply - elm.on('camFormVariableApplied', function(evt, value) { - var phase = $rootScope.$$phase; - // only apply if not already in digest / apply - if(phase !== '$apply' && phase !== '$digest') { - scope.$apply(function() { + if (phase !== '$apply' && phase !== '$digest') { + scope.$apply(function () { ctrl.$setViewValue(value); }); } else { ctrl.$setViewValue(value); } }); - } }; }]); - -ngModule.directive('camVariableType', [function() { - +ngModule.directive('camVariableType', [function () { return { - require: 'ngModel', - link: function($scope, $element, $attrs, ctrl) { - - var validate = function(viewValue) { - + link: function link($scope, $element, $attrs, ctrl) { + var validate = function validate(viewValue) { var type = $attrs.camVariableType; - - ctrl.$setValidity('camVariableType', true ); + ctrl.$setValidity('camVariableType', true); if (viewValue || viewValue === false || type === 'Bytes') { - if (ctrl.$pristine) { ctrl.$pristine = false; ctrl.$dirty = true; @@ -229,14 +214,13 @@ ngModule.directive('camVariableType', [function() { $element.removeClass('ng-pristine'); } - if(['Boolean', 'String', 'Bytes'].indexOf(type) === -1 && !isType(viewValue, type)) { - ctrl.$setValidity('camVariableType', false ); + if (['Boolean', 'String', 'Bytes'].indexOf(type) === -1 && !isType(viewValue, type)) { + ctrl.$setValidity('camVariableType', false); } - if($attrs.type==='file' && type === 'Bytes' && $element[0].files && $element[0].files[0] && $element[0].files[0].size > ($attrs.camMaxFilesize || 5000000)) { - ctrl.$setValidity('camVariableType', false ); + if ($attrs.type === 'file' && type === 'Bytes' && $element[0].files && $element[0].files[0] && $element[0].files[0].size > ($attrs.camMaxFilesize || 5000000)) { + ctrl.$setValidity('camVariableType', false); } - } return viewValue; @@ -244,24 +228,22 @@ ngModule.directive('camVariableType', [function() { ctrl.$parsers.unshift(validate); ctrl.$formatters.push(validate); - - $attrs.$observe('camVariableType', function() { + $attrs.$observe('camVariableType', function () { return validate(ctrl.$viewValue); }); - - $element.bind('change', function() { + $element.bind('change', function () { validate(ctrl.$viewValue); $scope.$apply(); }); - - }}; + } + }; }]); - module.exports = CamundaFormAngular; - }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"./../../forms/type-util":45,"./camunda-form-angular":1}],3:[function(require,module,exports){ +"use strict"; + /* * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH * under one or more contributor license agreements. See the NOTICE file @@ -280,14 +262,12 @@ module.exports = CamundaFormAngular; */ /** @namespace CamSDK */ - module.exports = { Client: require('./../api-client'), Form: require('./forms'), utils: require('./../utils') }; - },{"./../api-client":7,"./../utils":47,"./forms":2}],4:[function(require,module,exports){ /* * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH @@ -305,19 +285,19 @@ module.exports = { * See the License for the specific language governing permissions and * limitations under the License. */ +'use strict'; // var HttpClient = require('./http-client'); -'use strict'; - -// var HttpClient = require('./http-client'); var Q = require('q'); + var Events = require('./../events'); -var BaseClass = require('./../base-class'); +var BaseClass = require('./../base-class'); /** * No-Op callback */ -function noop() {} + +function noop() {} /** * Abstract class for resources * @@ -372,210 +352,202 @@ function noop() {} * * }); */ + + var AbstractClientResource = BaseClass.extend( - /** @lends AbstractClientResource.prototype */ - { - /** - * Initializes a AbstractClientResource instance - * - * This method is aimed to be overriden by other implementations - * of the AbstractClientResource. - * - * @method initialize - */ - initialize: function() { - // do something to initialize the instance - // like copying the Model http property to the "this" (instanciated) - this.http = this.constructor.http; +/** @lends AbstractClientResource.prototype */ +{ + /** + * Initializes a AbstractClientResource instance + * + * This method is aimed to be overriden by other implementations + * of the AbstractClientResource. + * + * @method initialize + */ + initialize: function initialize() { + // do something to initialize the instance + // like copying the Model http property to the "this" (instanciated) + this.http = this.constructor.http; + } +}, +/** @lends AbstractClientResource */ +{ + /** + * Path used by the resource to perform HTTP queries + * + * @abstract + * @memberOf CamSDK.client.AbstractClientResource + */ + path: '', + + /** + * Object hosting the methods for HTTP queries. + * + * @abstract + * @memberof CamSDK.client.AbstractClientResource + */ + http: {}, + + /** + * Create an instance on the backend + * + * @abstract + * @memberOf CamSDK.client.AbstractClientResource + * + * @param {!Object|Object[]} attributes + * @param {requestCallback} [done] + */ + create: function create() {}, + + /** + * Fetch a list of instances + * + * @memberof CamSDK.client.AbstractClientResource + * + * @fires CamSDK.AbstractClientResource#error + * @fires CamSDK.AbstractClientResource#loaded + * + * @param {?Object.} params + * @param {requestCallback} [done] + */ + list: function list(params, _done) { + // allows to pass only a callback + if (typeof params === 'function') { + _done = params; + params = {}; } - }, + params = params || {}; + _done = _done || noop; // var likeExp = /Like$/; - /** @lends AbstractClientResource */ - { - /** - * Path used by the resource to perform HTTP queries - * - * @abstract - * @memberOf CamSDK.client.AbstractClientResource - */ - path: '', - - /** - * Object hosting the methods for HTTP queries. - * - * @abstract - * @memberof CamSDK.client.AbstractClientResource - */ - http: {}, - - - - /** - * Create an instance on the backend - * - * @abstract - * @memberOf CamSDK.client.AbstractClientResource - * - * @param {!Object|Object[]} attributes - * @param {requestCallback} [done] - */ - create: function() {}, - - - /** - * Fetch a list of instances - * - * @memberof CamSDK.client.AbstractClientResource - * - * @fires CamSDK.AbstractClientResource#error - * @fires CamSDK.AbstractClientResource#loaded - * - * @param {?Object.} params - * @param {requestCallback} [done] - */ - list: function(params, done) { - // allows to pass only a callback - if (typeof params === 'function') { - done = params; - params = {}; - } - params = params || {}; - done = done || noop; - - // var likeExp = /Like$/; - var self = this; - var results = { - count: 0, - items: [] - }; + var self = this; + var results = { + count: 0, + items: [] + }; + var combinedPromise = Q.defer(); + var countFinished = false; + var listFinished = false; - var combinedPromise = Q.defer(); + var checkCompletion = function checkCompletion() { + if (listFinished && countFinished) { + self.trigger('loaded', results); + combinedPromise.resolve(results); - var countFinished = false; - var listFinished = false; + _done(null, results); + } + }; // until a new webservice is made available, + // we need to perform 2 requests. + // Since they are independent requests, make them asynchronously - var checkCompletion = function() { - if(listFinished && countFinished) { - self.trigger('loaded', results); - combinedPromise.resolve(results); - done(null, results); - } - }; - // until a new webservice is made available, - // we need to perform 2 requests. - // Since they are independent requests, make them asynchronously - self.count(params, function(err, count) { - if(err) { + self.count(params, function (err, count) { + if (err) { + self.trigger('error', err); + combinedPromise.reject(err); + + _done(err); + } else { + results.count = count; + countFinished = true; + checkCompletion(); + } + }); + self.http.get(self.path, { + data: params, + done: function done(err, itemsRes) { + if (err) { self.trigger('error', err); combinedPromise.reject(err); - done(err); + + _done(err); } else { - results.count = count; - countFinished = true; - checkCompletion(); - } - }); + results.items = itemsRes; // QUESTION: should we return that too? - self.http.get(self.path, { - data: params, - done: function(err, itemsRes) { - if (err) { - self.trigger('error', err); - combinedPromise.reject(err); - done(err); - } else { - results.items = itemsRes; - // QUESTION: should we return that too? - results.firstResult = parseInt(params.firstResult || 0, 10); - results.maxResults = results.firstResult + parseInt(params.maxResults || 10, 10); - listFinished = true; - checkCompletion(); - } + results.firstResult = parseInt(params.firstResult || 0, 10); + results.maxResults = results.firstResult + parseInt(params.maxResults || 10, 10); + listFinished = true; + checkCompletion(); } - }); - - return combinedPromise.promise; - }, - - /** - * Fetch a count of instances - * - * @memberof CamSDK.client.AbstractClientResource - * - * @fires CamSDK.AbstractClientResource#error - * @fires CamSDK.AbstractClientResource#loaded - * - * @param {?Object.} params - * @param {requestCallback} [done] - */ - count: function(params, done) { - // allows to pass only a callback - if (typeof params === 'function') { - done = params; - params = {}; } - params = params || {}; - done = done || noop; - var self = this; - var deferred = Q.defer(); - - this.http.get(this.path +'/count', { - data: params, - done: function(err, result) { - if (err) { - /** - * @event CamSDK.AbstractClientResource#error - * @type {Error} - */ - self.trigger('error', err); - - deferred.reject(err); - done(err); - } else { - deferred.resolve(result.count); - done(null, result.count); - } - } - }); + }); + return combinedPromise.promise; + }, - return deferred.promise; - }, + /** + * Fetch a count of instances + * + * @memberof CamSDK.client.AbstractClientResource + * + * @fires CamSDK.AbstractClientResource#error + * @fires CamSDK.AbstractClientResource#loaded + * + * @param {?Object.} params + * @param {requestCallback} [done] + */ + count: function count(params, _done2) { + // allows to pass only a callback + if (typeof params === 'function') { + _done2 = params; + params = {}; + } + params = params || {}; + _done2 = _done2 || noop; + var self = this; + var deferred = Q.defer(); + this.http.get(this.path + '/count', { + data: params, + done: function done(err, result) { + if (err) { + /** + * @event CamSDK.AbstractClientResource#error + * @type {Error} + */ + self.trigger('error', err); + deferred.reject(err); - /** - * Update one or more instances - * - * @abstract - * @memberof CamSDK.AbstractClientResource - * - * @param {!String|String[]} ids - * @param {Object.} attributes - * @param {requestCallback} [done] - */ - update: function() {}, - - - - /** - * Delete one or more instances - * - * @abstract - * @memberof CamSDK.AbstractClientResource - * - * @param {!String|String[]} ids - * @param {requestCallback} [done] - */ - delete: function() {} - }); + _done2(err); + } else { + deferred.resolve(result.count); + + _done2(null, result.count); + } + } + }); + return deferred.promise; + }, + /** + * Update one or more instances + * + * @abstract + * @memberof CamSDK.AbstractClientResource + * + * @param {!String|String[]} ids + * @param {Object.} attributes + * @param {requestCallback} [done] + */ + update: function update() {}, + /** + * Delete one or more instances + * + * @abstract + * @memberof CamSDK.AbstractClientResource + * + * @param {!String|String[]} ids + * @param {requestCallback} [done] + */ + "delete": function _delete() {} +}); Events.attach(AbstractClientResource); - module.exports = AbstractClientResource; -},{"./../base-class":36,"./../events":37,"q":53}],5:[function(require,module,exports){ +},{"./../base-class":36,"./../events":37,"q":63}],5:[function(require,module,exports){ +"use strict"; + /* * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH * under one or more contributor license agreements. See the NOTICE file @@ -592,9 +564,8 @@ module.exports = AbstractClientResource; * See the License for the specific language governing permissions and * limitations under the License. */ - -exports.createSimpleGetQueryFunction = function(urlSuffix) { - return function(params, done) { +exports.createSimpleGetQueryFunction = function (urlSuffix) { + return function (params, done) { var url = this.path + urlSuffix; if (typeof params === 'function') { @@ -627,19 +598,21 @@ exports.createSimpleGetQueryFunction = function(urlSuffix) { * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; -var request = require('./../../vendor/superagent').default; +var request = require('superagent'); + var Q = require('q'); + var Events = require('./../events'); -var utils = require('./../utils'); +var utils = require('./../utils'); /** * No-Op callback */ -function noop() {} + +function noop() {} /** * HttpClient * @@ -648,10 +621,12 @@ function noop() {} * @class * @memberof CamSDK.client */ -var HttpClient = function(config) { - config = config || {}; + +var HttpClient = function HttpClient(config) { + config = config || {}; config.headers = config.headers || {}; + if (!config.headers.Accept) { config.headers.Accept = 'application/hal+json, application/json; q=0.5'; } @@ -661,71 +636,77 @@ var HttpClient = function(config) { } Events.attach(this); - this.config = config; }; function end(self, done, deferred) { done = done || noop; - return function(err, response) { + return function (err, response) { // TODO: investigate the possible problems related to response without content - if (err || (!response.ok && !response.noContent)) { - err = err || response.error || new Error('The '+ response.req.method +' request on '+ response.req.url +' failed'); + if (err || !response.ok && !response.noContent) { + err = err || response.error || new Error('The ' + response.req.method + ' request on ' + response.req.url + ' failed'); + if (response && response.body) { if (response.body.message) { err.message = response.body.message; } } + self.trigger('error', err); - if(deferred) {deferred.reject(err);} - return done(err); - } - // superagent puts the parsed data into a property named "body" + if (deferred) { + deferred.reject(err); + } + + return done(err); + } // superagent puts the parsed data into a property named "body" // and the "raw" content in property named "text" // and.. it does not parse the response if it does not have // the "application/json" type. + + if (response.type === 'application/hal+json') { if (!response.body || Object.keys(response.body).length === 0) { response.body = JSON.parse(response.text); - } + } // and process embedded resources + - // and process embedded resources response.body = utils.solveHALEmbedded(response.body); } - if(deferred) {deferred.resolve(response.body ? response.body : (response.text ? response.text : ''));} - done(null, response.body ? response.body : (response.text ? response.text : '')); + if (deferred) { + deferred.resolve(response.body ? response.body : response.text ? response.text : ''); + } + + done(null, response.body ? response.body : response.text ? response.text : ''); }; } - /** * Performs a POST HTTP request */ -HttpClient.prototype.post = function(path, options) { + + +HttpClient.prototype.post = function (path, options) { options = options || {}; var done = options.done || noop; var self = this; var deferred = Q.defer(); - var url = this.config.baseUrl + (path ? '/'+ path : ''); + var url = this.config.baseUrl + (path ? '/' + path : ''); var req = request.post(url); - var headers = options.headers || this.config.headers; headers.Accept = headers.Accept || this.config.headers.Accept; + var isFieldOrAttach = false; // Buffer object is only available in node.js environement - var isFieldOrAttach = false; - // Buffer object is only available in node.js environement if (typeof Buffer !== 'undefined') { - Object.keys(options.fields || {}).forEach(function(field) { + Object.keys(options.fields || {}).forEach(function (field) { req.field(field, options.fields[field]); isFieldOrAttach = true; }); - (options.attachments || []).forEach(function(file, idx) { - req.attach('data_'+idx, new Buffer(file.content), file.name); + (options.attachments || []).forEach(function (file, idx) { + req.attach('data_' + idx, new Buffer(file.content), file.name); isFieldOrAttach = true; }); - } - else if (!!options.fields || !!options.attachments) { + } else if (!!options.fields || !!options.attachments) { var err = new Error('Multipart request is only supported in node.js environement.'); done(err); return deferred.reject(err); @@ -735,119 +716,91 @@ HttpClient.prototype.post = function(path, options) { req.send(options.data || {}); } - req - .set(headers) - .query(options.query || {}); - + req.set(headers).query(options.query || {}); req.end(end(self, done, deferred)); return deferred.promise; }; - - /** * Performs a GET HTTP request */ -HttpClient.prototype.get = function(path, options) { - var url = this.config.baseUrl + (path ? '/'+ path : ''); + + +HttpClient.prototype.get = function (path, options) { + var url = this.config.baseUrl + (path ? '/' + path : ''); return this.load(url, options); }; - /** * Loads a resource using http GET */ -HttpClient.prototype.load = function(url, options) { + + +HttpClient.prototype.load = function (url, options) { options = options || {}; var done = options.done || noop; var self = this; var deferred = Q.defer(); - var headers = options.headers || this.config.headers; var accept = options.accept || headers.Accept || this.config.headers.Accept; - - var req = request - .get(url) - .set(headers) - .set('Accept', accept) - .query(options.data || {}); - + var req = request.get(url).set(headers).set('Accept', accept).query(options.data || {}); req.end(end(self, done, deferred)); return deferred.promise; }; - - /** * Performs a PUT HTTP request */ -HttpClient.prototype.put = function(path, options) { + + +HttpClient.prototype.put = function (path, options) { options = options || {}; var done = options.done || noop; var self = this; var deferred = Q.defer(); - var url = this.config.baseUrl + (path ? '/'+ path : ''); - + var url = this.config.baseUrl + (path ? '/' + path : ''); var headers = options.headers || this.config.headers; headers.Accept = headers.Accept || this.config.headers.Accept; - - var req = request - .put(url) - .set(headers) - .send(options.data || {}); - - req.end(end(self, done,deferred)); + var req = request.put(url).set(headers).send(options.data || {}); + req.end(end(self, done, deferred)); return deferred.promise; }; - - - /** * Performs a DELETE HTTP request */ -HttpClient.prototype.del = function(path, options) { + + +HttpClient.prototype.del = function (path, options) { options = options || {}; var done = options.done || noop; var self = this; var deferred = Q.defer(); - var url = this.config.baseUrl + (path ? '/'+ path : ''); - + var url = this.config.baseUrl + (path ? '/' + path : ''); var headers = options.headers || this.config.headers; headers.Accept = headers.Accept || this.config.headers.Accept; - - var req = request - .del(url) - .set(headers) - .send(options.data || {}); - + var req = request.del(url).set(headers).send(options.data || {}); req.end(end(self, done, deferred)); return deferred.promise; }; - - - /** * Performs a OPTIONS HTTP request */ -HttpClient.prototype.options = function(path, options) { + + +HttpClient.prototype.options = function (path, options) { options = options || {}; var done = options.done || noop; var self = this; var deferred = Q.defer(); - var url = this.config.baseUrl + (path ? '/'+ path : ''); - + var url = this.config.baseUrl + (path ? '/' + path : ''); var headers = options.headers || this.config.headers; headers.Accept = headers.Accept || this.config.headers.Accept; - - var req = request('OPTIONS', url) - .set(headers); - + var req = request('OPTIONS', url).set(headers); req.end(end(self, done, deferred)); return deferred.promise; }; - module.exports = HttpClient; }).call(this,require("buffer").Buffer) -},{"./../../vendor/superagent":56,"./../events":37,"./../utils":47,"buffer":49,"q":53}],7:[function(require,module,exports){ +},{"./../events":37,"./../utils":47,"buffer":49,"q":63,"superagent":65}],7:[function(require,module,exports){ /* * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH * under one or more contributor license agreements. See the NOTICE file @@ -864,10 +817,9 @@ module.exports = HttpClient; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; -var Events = require('./../events'); +var Events = require('./../events'); /** * For all API client related * @namespace CamSDK.client @@ -889,6 +841,8 @@ var Events = require('./../events'); * @param {String} config.apiUri * @param {String} [config.headers] Headers that should be used for all Http requests. */ + + function CamundaClient(config) { if (!config) { throw new Error('Needs configuration'); @@ -898,41 +852,34 @@ function CamundaClient(config) { throw new Error('An apiUri is required'); } - Events.attach(this); - - // use 'default' engine - config.engine = typeof config.engine !== 'undefined' - ? config.engine - : 'default'; + Events.attach(this); // use 'default' engine - // mock by default.. for now - config.mock = typeof config.mock !== 'undefined' ? config.mock : true; + config.engine = typeof config.engine !== 'undefined' ? config.engine : 'default'; // mock by default.. for now + config.mock = typeof config.mock !== 'undefined' ? config.mock : true; config.resources = config.resources || {}; - this.HttpClient = config.HttpClient || CamundaClient.HttpClient; - this.baseUrl = config.apiUri; + if (config.engine) { - this.baseUrl += (this.baseUrl.slice(-1) !== '/' ? '/' : ''); - this.baseUrl += 'engine/'+ config.engine; + this.baseUrl += this.baseUrl.slice(-1) !== '/' ? '/' : ''; + this.baseUrl += 'engine/' + config.engine; } this.config = config; - this.initialize(); } - /** * [HttpClient description] * @memberof CamSDK.client.CamundaClient * @name HttpClient * @type {CamSDK.client.HttpClient} */ -CamundaClient.HttpClient = require('./http-client'); -// provide an isolated scope -(function(proto) { + +CamundaClient.HttpClient = require('./http-client'); // provide an isolated scope + +(function (proto) { /** * configuration storage * @memberof CamSDK.client.CamundaClient.prototype @@ -940,78 +887,78 @@ CamundaClient.HttpClient = require('./http-client'); * @type {Object} */ proto.config = {}; - var _resources = {}; - /** * @memberof CamSDK.client.CamundaClient.prototype * @name initialize */ - proto.initialize = function() { + + proto.initialize = function () { /* jshint sub: true */ - _resources['authorization'] = require('./resources/authorization'); - _resources['batch'] = require('./resources/batch'); - _resources['deployment'] = require('./resources/deployment'); - _resources['external-task'] = require('./resources/external-task'); - _resources['filter'] = require('./resources/filter'); - _resources['history'] = require('./resources/history'); - _resources['process-definition'] = require('./resources/process-definition'); - _resources['process-instance'] = require('./resources/process-instance'); - _resources['task'] = require('./resources/task'); - _resources['task-report'] = require('./resources/task-report'); - _resources['variable'] = require('./resources/variable'); - _resources['case-execution'] = require('./resources/case-execution'); - _resources['case-instance'] = require('./resources/case-instance'); - _resources['case-definition'] = require('./resources/case-definition'); - _resources['user'] = require('./resources/user'); - _resources['group'] = require('./resources/group'); - _resources['tenant'] = require('./resources/tenant'); - _resources['incident'] = require('./resources/incident'); - _resources['job-definition'] = require('./resources/job-definition'); - _resources['job'] = require('./resources/job'); - _resources['metrics'] = require('./resources/metrics'); + _resources['authorization'] = require('./resources/authorization'); + _resources['batch'] = require('./resources/batch'); + _resources['deployment'] = require('./resources/deployment'); + _resources['external-task'] = require('./resources/external-task'); + _resources['filter'] = require('./resources/filter'); + _resources['history'] = require('./resources/history'); + _resources['process-definition'] = require('./resources/process-definition'); + _resources['process-instance'] = require('./resources/process-instance'); + _resources['task'] = require('./resources/task'); + _resources['task-report'] = require('./resources/task-report'); + _resources['variable'] = require('./resources/variable'); + _resources['case-execution'] = require('./resources/case-execution'); + _resources['case-instance'] = require('./resources/case-instance'); + _resources['case-definition'] = require('./resources/case-definition'); + _resources['user'] = require('./resources/user'); + _resources['group'] = require('./resources/group'); + _resources['tenant'] = require('./resources/tenant'); + _resources['incident'] = require('./resources/incident'); + _resources['job-definition'] = require('./resources/job-definition'); + _resources['job'] = require('./resources/job'); + _resources['metrics'] = require('./resources/metrics'); _resources['decision-definition'] = require('./resources/decision-definition'); - _resources['execution'] = require('./resources/execution'); - _resources['migration'] = require('./resources/migration'); - _resources['drd'] = require('./resources/drd'); - _resources['modification'] = require('./resources/modification'); - _resources['message'] = require('./resources/message'); - _resources['password-policy'] = require('./resources/password-policy'); + _resources['execution'] = require('./resources/execution'); + _resources['migration'] = require('./resources/migration'); + _resources['drd'] = require('./resources/drd'); + _resources['modification'] = require('./resources/modification'); + _resources['message'] = require('./resources/message'); + _resources['password-policy'] = require('./resources/password-policy'); /* jshint sub: false */ + var self = this; function forwardError(err) { self.trigger('error', err); - } + } // create global HttpClient instance + - // create global HttpClient instance - this.http = new this.HttpClient({baseUrl: this.baseUrl, headers: this.config.headers}); + this.http = new this.HttpClient({ + baseUrl: this.baseUrl, + headers: this.config.headers + }); // configure the client for each resources separately, - // configure the client for each resources separately, var name, conf, resConf, c; - for (name in _resources) { + for (name in _resources) { conf = { - name: name, + name: name, // use the SDK config for some default values - mock: this.config.mock, - baseUrl: this.baseUrl, - headers: this.config.headers + mock: this.config.mock, + baseUrl: this.baseUrl, + headers: this.config.headers }; resConf = this.config.resources[name] || {}; for (c in resConf) { conf[c] = resConf[c]; - } + } // instanciate a HTTP client for the resource - // instanciate a HTTP client for the resource - _resources[name].http = new this.HttpClient(conf); - // forward request errors + _resources[name].http = new this.HttpClient(conf); // forward request errors + _resources[name].http.on('error', forwardError); } }; - /** * Allows to get a resource from SDK by its name * @memberof CamSDK.client.CamundaClient.prototype @@ -1020,21 +967,19 @@ CamundaClient.HttpClient = require('./http-client'); * @param {String} name * @return {CamSDK.client.AbstractClientResource} */ - proto.resource = function(name) { + + + proto.resource = function (name) { return _resources[name]; }; -}(CamundaClient.prototype)); - +})(CamundaClient.prototype); module.exports = CamundaClient; - - /** * A [universally unique identifier]{@link en.wikipedia.org/wiki/Universally_unique_identifier} * @typedef {String} uuid */ - /** * This callback is displayed as part of the Requester class. * @callback requestCallback @@ -1042,7 +987,6 @@ module.exports = CamundaClient; * @param {CamSDK.AbstractClientResource|CamSDK.AbstractClientResource[]} [results] */ - /** * Function who does not perform anything * @callback noopCallback @@ -1065,30 +1009,24 @@ module.exports = CamundaClient; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var AbstractClientResource = require('./../abstract-client-resource'); - - - /** * Authorization Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var Authorization = AbstractClientResource.extend(); + +var Authorization = AbstractClientResource.extend(); /** * API path for the process definition resource * @type {String} */ -Authorization.path = 'authorization'; - - - +Authorization.path = 'authorization'; /** * Fetch a list of authorizations * @@ -1111,57 +1049,54 @@ Authorization.path = 'authorization'; * Specifies the maximum number of results to return. * @param {Function} done */ -Authorization.list = function(params, done) { + +Authorization.list = function (params, done) { return this.http.get(this.path, { data: params, done: done }); }; - - - /** * Retrieve a single authorization * * @param {uuid} authorizationId of the authorization to be requested * @param {Function} done */ -Authorization.get = function(authorizationId, done) { - return this.http.get(this.path +'/'+ authorizationId, { + + +Authorization.get = function (authorizationId, done) { + return this.http.get(this.path + '/' + authorizationId, { done: done }); }; - - /** * Creates an authorization * * @param {Object} authorization is an object representation of an authorization * @param {Function} done */ -Authorization.create = function(authorization, done) { - return this.http.post(this.path +'/create', { + + +Authorization.create = function (authorization, done) { + return this.http.post(this.path + '/create', { data: authorization, done: done }); }; - - /** * Update an authorization * * @param {Object} authorization is an object representation of an authorization * @param {Function} done */ -Authorization.update = function(authorization, done) { - return this.http.put(this.path +'/'+ authorization.id, { + + +Authorization.update = function (authorization, done) { + return this.http.put(this.path + '/' + authorization.id, { data: authorization, done: done }); }; - - - /** * Save an authorization * @@ -1173,36 +1108,34 @@ Authorization.update = function(authorization, done) { * otherwise created * @param {Function} done */ -Authorization.save = function(authorization, done) { - return Authorization[authorization.id ? 'update' : 'create'](authorization, done); -}; - +Authorization.save = function (authorization, done) { + return Authorization[authorization.id ? 'update' : 'create'](authorization, done); +}; /** * Delete an authorization * * @param {uuid} id of the authorization to delete * @param {Function} done */ -Authorization.delete = function(id, done) { - return this.http.del(this.path +'/'+ id, { + + +Authorization["delete"] = function (id, done) { + return this.http.del(this.path + '/' + id, { done: done }); }; -Authorization.check = function(authorization, done) { +Authorization.check = function (authorization, done) { return this.http.get(this.path + '/check', { data: authorization, done: done }); }; - - module.exports = Authorization; - },{"./../abstract-client-resource":4}],9:[function(require,module,exports){ /* * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH @@ -1220,37 +1153,35 @@ module.exports = Authorization; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var AbstractClientResource = require('./../abstract-client-resource'); - - - /** * Batch Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var Batch = AbstractClientResource.extend(); + +var Batch = AbstractClientResource.extend(); /** * Path used by the resource to perform HTTP queries * @type {String} */ -Batch.path = 'batch'; +Batch.path = 'batch'; /** * Retrieves a single batch according to the Batch interface in the engine. */ -Batch.get = function(id, done) { + +Batch.get = function (id, done) { return this.http.get(this.path + '/' + id, { done: done }); }; -Batch.suspended = function(params, done) { +Batch.suspended = function (params, done) { return this.http.put(this.path + '/' + params.id + '/suspended', { data: { suspended: !!params.suspended @@ -1259,24 +1190,24 @@ Batch.suspended = function(params, done) { }); }; -Batch.statistics = function(params, done) { +Batch.statistics = function (params, done) { return this.http.get(this.path + '/statistics/', { data: params, done: done }); }; -Batch.statisticsCount = function(params, done) { +Batch.statisticsCount = function (params, done) { return this.http.get(this.path + '/statistics/count', { data: params, done: done }); }; -Batch.delete = function(params, done) { +Batch["delete"] = function (params, done) { var path = this.path + '/' + params.id; - if(params.cascade) { + if (params.cascade) { path += '?cascade=true'; } @@ -1304,64 +1235,62 @@ module.exports = Batch; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var AbstractClientResource = require('./../abstract-client-resource'); - /** * No-Op callback */ -function noop() {} + +function noop() {} /** * CaseDefinition Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var CaseDefinition = AbstractClientResource.extend(); + +var CaseDefinition = AbstractClientResource.extend(); /** * Path used by the resource to perform HTTP queries * @type {String} */ -CaseDefinition.path = 'case-definition'; - - +CaseDefinition.path = 'case-definition'; /** * Retrieve a single case definition * * @param {uuid} id of the case definition to be requested * @param {Function} done */ -CaseDefinition.get = function(id, done) { - return this.http.get(this.path +'/'+ id, { + +CaseDefinition.get = function (id, done) { + return this.http.get(this.path + '/' + id, { done: done }); }; - - /** * Retrieve a single cace definition * * @param {String} key of the case definition to be requested * @param {Function} done */ -CaseDefinition.getByKey = function(key, done) { - return this.http.get(this.path +'/key/'+ key, { + + +CaseDefinition.getByKey = function (key, done) { + return this.http.get(this.path + '/key/' + key, { done: done }); }; -CaseDefinition.list = function(params, done) { +CaseDefinition.list = function (params, done) { return this.http.get(this.path, { data: params, done: done }); }; - /** * Instantiates a given case definition. * @@ -1371,7 +1300,9 @@ CaseDefinition.list = function(params, done) { * @param {String} [params.variables] A JSON object containing the variables the case is to be initialized with. Each key corresponds to a variable name and each value to a variable value. * @param {String} [params.businessKey] The business key the case instance is to be initialized with. The business key identifies the case instance in the context of the given case definition. */ -CaseDefinition.create = function(params, done) { + + +CaseDefinition.create = function (params, done) { var url = this.path + '/'; if (params.id) { @@ -1389,31 +1320,30 @@ CaseDefinition.create = function(params, done) { done: done }); }; - - /** * Retrieves the CMMN XML of this case definition. * @param {uuid} id The id of the case definition. * @param {Function} done */ -CaseDefinition.xml = function(data, done) { - var path = this.path +'/'+ (data.id ? data.id : 'key/'+ data.key) +'/xml'; + + +CaseDefinition.xml = function (data, done) { + var path = this.path + '/' + (data.id ? data.id : 'key/' + data.key) + '/xml'; return this.http.get(path, { done: done || noop }); }; +/** + * Instantiates a given process definition. + * + * @param {String} [id] The id of the process definition to activate or suspend. + * @param {Object} [params] + * @param {Number} [params.historyTimeToLive] New value for historyTimeToLive field of process definition. Can be null. + */ -/** -* Instantiates a given process definition. -* -* @param {String} [id] The id of the process definition to activate or suspend. -* @param {Object} [params] -* @param {Number} [params.historyTimeToLive] New value for historyTimeToLive field of process definition. Can be null. -*/ -CaseDefinition.updateHistoryTimeToLive = function(id, params, done) { +CaseDefinition.updateHistoryTimeToLive = function (id, params, done) { var url = this.path + '/' + id + '/history-time-to-live'; - return this.http.put(url, { data: params, done: done @@ -1439,32 +1369,34 @@ module.exports = CaseDefinition; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var AbstractClientResource = require('./../abstract-client-resource'); -var utils = require('../../utils'); +var utils = require('../../utils'); /** * No-Op callback */ -function noop() {} + +function noop() {} /** * CaseExecution Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var CaseExecution = AbstractClientResource.extend(); + +var CaseExecution = AbstractClientResource.extend(); /** * Path used by the resource to perform HTTP queries * @type {String} */ + CaseExecution.path = 'case-execution'; -CaseExecution.list = function(params, done) { +CaseExecution.list = function (params, done) { done = done || noop; return this.http.get(this.path, { data: params, @@ -1472,51 +1404,52 @@ CaseExecution.list = function(params, done) { }); }; -CaseExecution.disable = function(executionId, params, done) { +CaseExecution.disable = function (executionId, params, done) { return this.http.post(this.path + '/' + executionId + '/disable', { data: params, done: done }); }; -CaseExecution.reenable = function(executionId, params, done) { +CaseExecution.reenable = function (executionId, params, done) { return this.http.post(this.path + '/' + executionId + '/reenable', { data: params, done: done }); }; -CaseExecution.manualStart = function(executionId, params, done) { +CaseExecution.manualStart = function (executionId, params, done) { return this.http.post(this.path + '/' + executionId + '/manual-start', { data: params, done: done }); }; -CaseExecution.complete = function(executionId, params, done) { +CaseExecution.complete = function (executionId, params, done) { return this.http.post(this.path + '/' + executionId + '/complete', { data: params, done: done }); }; - /** * Deletes a variable in the context of a given case execution. Deletion does not propagate upwards in the case execution hierarchy. */ -CaseExecution.deleteVariable = function(data, done) { + + +CaseExecution.deleteVariable = function (data, done) { return this.http.del(this.path + '/' + data.id + '/localVariables/' + utils.escapeUrl(data.varId), { done: done }); }; - - /** * Updates or deletes the variables in the context of an execution. * The updates do not propagate upwards in the execution hierarchy. * Deletion precede updates. * So, if a variable is updated AND deleted, the updates overrides the deletion. */ -CaseExecution.modifyVariables = function(data, done) { + + +CaseExecution.modifyVariables = function (data, done) { return this.http.post(this.path + '/' + data.id + '/localVariables', { data: data, done: done @@ -1542,55 +1475,53 @@ module.exports = CaseExecution; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var AbstractClientResource = require('./../abstract-client-resource'); -var utils = require('../../utils'); +var utils = require('../../utils'); /** * CaseInstance Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var CaseInstance = AbstractClientResource.extend(); + +var CaseInstance = AbstractClientResource.extend(); /** * Path used by the resource to perform HTTP queries * @type {String} */ -CaseInstance.path = 'case-instance'; - +CaseInstance.path = 'case-instance'; -CaseInstance.get = function(instanceId, done) { - return this.http.get(this.path +'/'+ instanceId, { +CaseInstance.get = function (instanceId, done) { + return this.http.get(this.path + '/' + instanceId, { done: done }); }; -CaseInstance.list = function(params, done) { +CaseInstance.list = function (params, done) { return this.http.get(this.path, { data: params, done: done }); }; -CaseInstance.close = function(instanceId, params, done) { +CaseInstance.close = function (instanceId, params, done) { return this.http.post(this.path + '/' + instanceId + '/close', { data: params, done: done }); }; -CaseInstance.terminate = function(instanceId, params, done) { +CaseInstance.terminate = function (instanceId, params, done) { return this.http.post(this.path + '/' + instanceId + '/terminate', { data: params, done: done }); }; - /** * Sets a variable of a given case instance by id. * @@ -1600,7 +1531,9 @@ CaseInstance.terminate = function(instanceId, params, done) { * @param {Object} params * @param {requestCallback} done */ -CaseInstance.setVariable = function(id, params, done) { + + +CaseInstance.setVariable = function (id, params, done) { var url = this.path + '/' + id + '/variables/' + utils.escapeUrl(params.name); return this.http.put(url, { data: params, @@ -1627,28 +1560,24 @@ module.exports = CaseInstance; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var AbstractClientResource = require('./../abstract-client-resource'); - - - /** * DecisionDefinition Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var DecisionDefinition = AbstractClientResource.extend(); + +var DecisionDefinition = AbstractClientResource.extend(); /** * Path used by the resource to perform HTTP queries * @type {String} */ -DecisionDefinition.path = 'decision-definition'; - +DecisionDefinition.path = 'decision-definition'; /** * Fetch a list of decision definitions * @param {Object} params Query parameters as follow @@ -1680,35 +1609,37 @@ DecisionDefinition.path = 'decision-definition'; * Will return less results, if there are no more results left. * @param {Function} done */ -DecisionDefinition.list = function(params, done) { + +DecisionDefinition.list = function (params, done) { return this.http.get(this.path, { data: params, done: done }); }; - /** * Retrieves a single decision definition according to the DecisionDefinition interface in the engine. * @param {uuid} id The id of the decision definition to be retrieved. * @param {Function} done */ -DecisionDefinition.get = function(id, done) { - return this.http.get(this.path +'/'+ id, { + + +DecisionDefinition.get = function (id, done) { + return this.http.get(this.path + '/' + id, { done: done }); }; - /** * Retrieves the DMN 1.0 XML of this decision definition. * @param {uuid} id The id of the decision definition. * @param {Function} done */ -DecisionDefinition.getXml = function(id, done) { - return this.http.get(this.path +'/'+ id + '/xml', { + + +DecisionDefinition.getXml = function (id, done) { + return this.http.get(this.path + '/' + id + '/xml', { done: done }); }; - /** * Evaluates a given decision. * @@ -1717,23 +1648,25 @@ DecisionDefinition.getXml = function(id, done) { * @param {String} [params.key] The key of the decision definition (the latest version thereof) to be evaluated. Must be omitted if id is provided. * @param {String} [params.variables] A JSON object containing the input variables of the decision. Each key corresponds to a variable name and each value to a variable value. */ -DecisionDefinition.evaluate = function(params, done) { - return this.http.post(this.path +'/'+ (params.id ? params.id : 'key/'+params.key ) + '/evaluate', { + + +DecisionDefinition.evaluate = function (params, done) { + return this.http.post(this.path + '/' + (params.id ? params.id : 'key/' + params.key) + '/evaluate', { data: params, done: done }); }; - /** -* Instantiates a given process definition. -* -* @param {String} [id] The id of the process definition to activate or suspend. -* @param {Object} [params] -* @param {Number} [params.historyTimeToLive] New value for historyTimeToLive field of process definition. Can be null. -*/ -DecisionDefinition.updateHistoryTimeToLive = function(id, params, done) { - var url = this.path + '/' + id + '/history-time-to-live'; + * Instantiates a given process definition. + * + * @param {String} [id] The id of the process definition to activate or suspend. + * @param {Object} [params] + * @param {Number} [params.historyTimeToLive] New value for historyTimeToLive field of process definition. Can be null. + */ + +DecisionDefinition.updateHistoryTimeToLive = function (id, params, done) { + var url = this.path + '/' + id + '/history-time-to-live'; return this.http.put(url, { data: params, done: done @@ -1759,28 +1692,24 @@ module.exports = DecisionDefinition; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var AbstractClientResource = require('./../abstract-client-resource'); - - - /** * Deployment Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var Deployment = AbstractClientResource.extend(); + +var Deployment = AbstractClientResource.extend(); /** * Path used by the resource to perform HTTP queries * @type {String} */ -Deployment.path = 'deployment'; - +Deployment.path = 'deployment'; /** * Create a deployment * @param {Object} options @@ -1794,14 +1723,12 @@ Deployment.path = 'deployment'; * @param {String} [options.tenantId] * @param {Function} done */ -Deployment.create = function(options, done) { + +Deployment.create = function (options, done) { var fields = { 'deployment-name': options.deploymentName }; - - var files = Array.isArray(options.files) ? - options.files : - [options.files]; + var files = Array.isArray(options.files) ? options.files : [options.files]; if (options.deploymentSource) { fields['deployment-source'] = options.deploymentSource; @@ -1819,14 +1746,13 @@ Deployment.create = function(options, done) { fields['tenant-id'] = options.tenantId; } - return this.http.post(this.path +'/create', { - data: {}, - fields: fields, - attachments: files, - done: done + return this.http.post(this.path + '/create', { + data: {}, + fields: fields, + attachments: files, + done: done }); }; - /** * Deletes a deployment * @@ -1839,13 +1765,15 @@ Deployment.create = function(options, done) { * * @param {Function} done */ -Deployment.delete = function(id, options, done) { + + +Deployment["delete"] = function (id, options, done) { var path = this.path + '/' + id; if (options) { - var queryParams = []; - for(var key in options) { + + for (var key in options) { var value = options[key]; queryParams.push(key + '=' + value); } @@ -1859,7 +1787,6 @@ Deployment.delete = function(id, options, done) { done: done }); }; - /** * Lists the deployments * @param {Object} params An object containing listing options. @@ -1888,47 +1815,52 @@ Deployment.delete = function(id, options, done) { * no more results left. * @param {Function} done */ -Deployment.list = function() { + + +Deployment.list = function () { return AbstractClientResource.list.apply(this, arguments); }; - /** * Returns information about a deployment resources for the given deployment. */ -Deployment.get = function(id, done) { + + +Deployment.get = function (id, done) { return this.http.get(this.path + '/' + id, { done: done }); }; - /** * Returns a list of deployment resources for the given deployment. */ -Deployment.getResources = function(id, done) { + + +Deployment.getResources = function (id, done) { return this.http.get(this.path + '/' + id + '/resources', { done: done }); }; - /** * Returns a deployment resource for the given deployment and resource id. */ -Deployment.getResource = function(deploymentId, resourceId, done) { + + +Deployment.getResource = function (deploymentId, resourceId, done) { return this.http.get(this.path + '/' + deploymentId + '/resources/' + resourceId, { done: done }); }; - /** * Returns the binary content of a single deployment resource for the given deployment. */ -Deployment.getResourceData = function(deploymentId, resourceId, done) { + + +Deployment.getResourceData = function (deploymentId, resourceId, done) { return this.http.get(this.path + '/' + deploymentId + '/resources/' + resourceId + '/data', { accept: '*/*', done: done }); }; - /** * Redeploy a deployment @@ -1938,13 +1870,14 @@ Deployment.getResourceData = function(deploymentId, resourceId, done) { * @param {Array} [options.resourceNames] * @param {Function} done */ -Deployment.redeploy = function(options, done) { + + +Deployment.redeploy = function (options, done) { var id = options.id; delete options.id; - return this.http.post(this.path + '/' + id + '/redeploy', { data: options, - done: done || function() {} + done: done || function () {} }); }; @@ -1967,26 +1900,26 @@ module.exports = Deployment; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var AbstractClientResource = require('../abstract-client-resource'); -var utils = require('../../utils'); +var utils = require('../../utils'); /** * DRD (Decision Requirements Definition) Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var DRD = AbstractClientResource.extend(); + +var DRD = AbstractClientResource.extend(); /** * Path used by the resource to perform HTTP queries * @type {String} */ -DRD.path = 'decision-requirements-definition'; +DRD.path = 'decision-requirements-definition'; /** * Fetch a count of DRD's * @param {Object} params Query parameters as follow @@ -2015,7 +1948,8 @@ DRD.path = 'decision-requirements-definition'; * Can be used in combination with tenantIdIn. Value may only be true, as false is the default behavior. * @param {Function} done */ -DRD.count = function(params, done) { + +DRD.count = function (params, done) { if (typeof params === 'function') { done = params; params = {}; @@ -2026,7 +1960,6 @@ DRD.count = function(params, done) { done: done }); }; - /** * Fetch a list of decision definitions * @param {Object} params Query parameters as follow @@ -2067,7 +2000,9 @@ DRD.count = function(params, done) { * Will return less results, if there are no more results left. * @param {Function} done */ -DRD.list = function(params, done) { + + +DRD.list = function (params, done) { if (typeof params === 'function') { done = params; params = {}; @@ -2082,13 +2017,14 @@ DRD.list = function(params, done) { function createIdUrl(path, id) { return path + '/' + utils.escapeUrl(id); } - /** * Retrieves a single decision requirements definition. * @param {uuid} id The id of the decision definition to be retrieved. * @param {Function} done */ -DRD.get = function(id, done) { + + +DRD.get = function (id, done) { return this.http.get(createIdUrl(this.path, id), { done: done }); @@ -2103,14 +2039,15 @@ function createKeyTenantUrl(path, key, tenantId) { return url; } - /** * Retrieves a single decision requirements definition. * @param {string} key The key of the decision requirements definition (the latest version thereof) to be retrieved. * @param {uuid} [tenantId] The id of the tenant to which the decision requirements definition belongs to. * @param {Function} done */ -DRD.getByKey = function(key, tenantId, done) { + + +DRD.getByKey = function (key, tenantId, done) { var url = createKeyTenantUrl(this.path, key, tenantId); if (typeof tenantId === 'function') { @@ -2121,26 +2058,27 @@ DRD.getByKey = function(key, tenantId, done) { done: done }); }; - - /** * Retrieves the DMN XML of this decision requirements definition. * @param {uuid} id The id of the decision definition to be retrieved. * @param {Function} done */ -DRD.getXML = function(id, done) { + + +DRD.getXML = function (id, done) { return this.http.get(createIdUrl(this.path, id) + '/xml', { done: done }); }; - /** * Retrieves the DMN XML of this decision requirements definition. * @param {string} key The key of the decision requirements definition (the latest version thereof) to be retrieved. * @param {uuid} [tenantId] The id of the tenant to which the decision requirements definition belongs to. * @param {Function} done */ -DRD.getXMLByKey = function(key, tenantId, done) { + + +DRD.getXMLByKey = function (key, tenantId, done) { var url = createKeyTenantUrl(this.path, key, tenantId) + '/xml'; if (typeof tenantId === 'function') { @@ -2152,7 +2090,6 @@ DRD.getXMLByKey = function(key, tenantId, done) { }); }; - module.exports = DRD; },{"../../utils":47,"../abstract-client-resource":4}],16:[function(require,module,exports){ @@ -2172,44 +2109,44 @@ module.exports = DRD; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var AbstractClientResource = require('./../abstract-client-resource'); -var utils = require('../../utils'); - - +var utils = require('../../utils'); /** * Execution Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var Execution = AbstractClientResource.extend(); + +var Execution = AbstractClientResource.extend(); /** * Path used by the resource to perform HTTP queries * @type {String} */ -Execution.path = 'execution'; +Execution.path = 'execution'; /** * Deletes a variable in the context of a given execution. Deletion does not propagate upwards in the execution hierarchy. */ -Execution.deleteVariable = function(data, done) { + +Execution.deleteVariable = function (data, done) { return this.http.del(this.path + '/' + data.id + '/localVariables/' + utils.escapeUrl(data.varId), { done: done }); }; - /** * Updates or deletes the variables in the context of an execution. * The updates do not propagate upwards in the execution hierarchy. * Updates precede deletions. * So, if a variable is updated AND deleted, the deletion overrides the update. */ -Execution.modifyVariables = function(data, done) { + + +Execution.modifyVariables = function (data, done) { return this.http.post(this.path + '/' + data.id + '/localVariables', { data: data, done: done @@ -2218,7 +2155,6 @@ Execution.modifyVariables = function(data, done) { module.exports = Execution; - },{"../../utils":47,"./../abstract-client-resource":4}],17:[function(require,module,exports){ /* * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH @@ -2236,38 +2172,37 @@ module.exports = Execution; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var AbstractClientResource = require('./../abstract-client-resource'); - /** * ExternalTask Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var ExternalTask = AbstractClientResource.extend(); + +var ExternalTask = AbstractClientResource.extend(); /** * Path used by the resource to perform HTTP queries * @type {String} */ -ExternalTask.path = 'external-task'; +ExternalTask.path = 'external-task'; /** * Retrieves a single external task corresponding to the ExternalTask interface in the engine. * * @param {Object} [params] * @param {String} [params.id] The id of the external task to be retrieved. */ -ExternalTask.get = function(params, done) { - return this.http.get(this.path+ '/' + params.id, { + +ExternalTask.get = function (params, done) { + return this.http.get(this.path + '/' + params.id, { data: params, done: done }); }; - /** * Query for external tasks that fulfill given parameters in the form of a json object. This method is slightly more * powerful than the GET query because it allows to specify a hierarchical result sorting. @@ -2294,19 +2229,18 @@ ExternalTask.get = function(params, done) { * @param {String} [params.firstResult] Pagination of results. Specifies the index of the first result to return. * @param {String} [params.maxResults] Pagination of results. Specifies the maximum number of results to return. Will return less results if there are no more results left. */ -ExternalTask.list = function(params, done) { - var path = this.path +'/'; - // those parameters have to be passed in the query and not body - path += '?firstResult='+ (params.firstResult || 0); - path += '&maxResults='+ (params.maxResults || 15); +ExternalTask.list = function (params, done) { + var path = this.path + '/'; // those parameters have to be passed in the query and not body + + path += '?firstResult=' + (params.firstResult || 0); + path += '&maxResults=' + (params.maxResults || 15); return this.http.post(path, { data: params, done: done }); }; - /** * Query for the number of external tasks that fulfill given parameters. Takes the same parameters as the get external tasks method. * @@ -2327,13 +2261,14 @@ ExternalTask.list = function(params, done) { * @param {String} [params.active] Only include active tasks. Value may only be true, as false matches any external task. * @param {String} [params.suspended] Only include suspended tasks. Value may only be true, as false matches any external task. */ -ExternalTask.count = function(params, done) { + + +ExternalTask.count = function (params, done) { return this.http.post(this.path + '/count', { data: params, done: done }); }; - /** * Query for the number of external tasks that fulfill given parameters. Takes the same parameters as the get external tasks method. * @@ -2348,13 +2283,14 @@ ExternalTask.count = function(params, done) { * lockDuration Mandatory. The duration to lock the external tasks for in milliseconds. * variables A JSON array of String values that represent variable names. For each result task belonging to this topic, the given variables are returned as well if they are accessible from the external task's execution. */ -ExternalTask.fetchAndLock = function(params, done) { + + +ExternalTask.fetchAndLock = function (params, done) { return this.http.post(this.path + '/fetchAndLock', { data: params, done: done }); }; - /** * Complete an external task and update process variables. * @@ -2377,13 +2313,14 @@ ExternalTask.fetchAndLock = function(params, done) { * - mimetype: The mime type of the file that is being uploaded. * - encoding: The encoding of the file that is being uploaded. */ -ExternalTask.complete = function(params, done) { + + +ExternalTask.complete = function (params, done) { return this.http.post(this.path + '/' + params.id + '/complete', { data: params, done: done }); }; - /** * Report a failure to execute an external task. A number of retries and a timeout until * the task can be retried can be specified. If retries are set to 0, an incident for this @@ -2396,26 +2333,28 @@ ExternalTask.complete = function(params, done) { * @param {String} [params.retries] A number of how often the task should be retried. Must be >= 0. If this is 0, an incident is created and the task cannot be fetched anymore unless the retries are increased again. The incident's message is set to the errorMessage parameter. * @param {String} [params.retryTimeout] A timeout in milliseconds before the external task becomes available again for fetching. Must be >= 0. */ -ExternalTask.failure = function(params, done) { + + +ExternalTask.failure = function (params, done) { return this.http.post(this.path + '/' + params.id + '/failure', { data: params, done: done }); }; - /** * Unlock an external task. Clears the task’s lock expiration time and worker id. * * @param {Object} [params] * @param {String} [params.id] The id of the external task to unlock. */ -ExternalTask.unlock = function(params, done) { + + +ExternalTask.unlock = function (params, done) { return this.http.post(this.path + '/' + params.id + '/unlock', { data: params, done: done }); }; - /** * Set the number of retries left to execute an external task. If retries are set to 0, an incident is created. * @@ -2423,13 +2362,14 @@ ExternalTask.unlock = function(params, done) { * @param {String} [params.id] The id of the external task to unlock. * @param {String} [params.retries] The number of retries to set for the external task. Must be >= 0. If this is 0, an incident is created and the task cannot be fetched anymore unless the retries are increased again. */ -ExternalTask.retries = function(params, done) { + + +ExternalTask.retries = function (params, done) { return this.http.put(this.path + '/' + params.id + '/retries', { data: params, done: done }); }; - /** * Set the number of retries left to execute an external task asynchronously. If retries are set to 0, an incident is created. * @@ -2438,7 +2378,9 @@ ExternalTask.retries = function(params, done) { * @param {Object} params * @param {requestCallback} done */ -ExternalTask.retriesAsync = function(params, done) { + + +ExternalTask.retriesAsync = function (params, done) { return this.http.post(this.path + '/retries-async', { data: params, done: done @@ -2464,41 +2406,36 @@ module.exports = ExternalTask; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var AbstractClientResource = require('./../abstract-client-resource'); - - - /** * Filter Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var Filter = AbstractClientResource.extend(); + +var Filter = AbstractClientResource.extend(); /** * API path for the filter resource * @type {String} */ -Filter.path = 'filter'; - +Filter.path = 'filter'; /** * Retrieve a single filter * * @param {uuid} filterId of the filter to be requested * @param {Function} done */ -Filter.get = function(filterId, done) { - return this.http.get(this.path +'/'+ filterId, { + +Filter.get = function (filterId, done) { + return this.http.get(this.path + '/' + filterId, { done: done }); }; - - /** * Retrieve some filters * @@ -2510,14 +2447,14 @@ Filter.get = function(filterId, done) { * @param {Bool} [data.itemCount] * @param {Function} done */ -Filter.list = function(data, done) { + + +Filter.list = function (data, done) { return this.http.get(this.path, { data: data, done: done }); }; - - /** * Get the tasks result of filter * @@ -2529,58 +2466,55 @@ Filter.list = function(data, done) { * @param {String} [data.sortOrder] * @param {Function} done */ -Filter.getTasks = function(data, done) { - var path = this.path +'/'; + + +Filter.getTasks = function (data, done) { + var path = this.path + '/'; if (typeof data === 'string') { - path = path + data +'/list'; + path = path + data + '/list'; data = {}; - } - else { - path = path + data.id +'/list'; + } else { + path = path + data.id + '/list'; delete data.id; - } + } // those parameters have to be passed in the query and not body - // those parameters have to be passed in the query and not body - path += '?firstResult='+ (data.firstResult || 0); - path += '&maxResults='+ (data.maxResults || 15); + path += '?firstResult=' + (data.firstResult || 0); + path += '&maxResults=' + (data.maxResults || 15); return this.http.post(path, { data: data, done: done }); }; - - /** * Creates a filter * * @param {Object} filter is an object representation of a filter * @param {Function} done */ -Filter.create = function(filter, done) { - return this.http.post(this.path +'/create', { + + +Filter.create = function (filter, done) { + return this.http.post(this.path + '/create', { data: filter, done: done }); }; - - /** * Update a filter * * @param {Object} filter is an object representation of a filter * @param {Function} done */ -Filter.update = function(filter, done) { - return this.http.put(this.path +'/'+ filter.id, { + + +Filter.update = function (filter, done) { + return this.http.put(this.path + '/' + filter.id, { data: filter, done: done }); }; - - - /** * Save a filter * @@ -2591,31 +2525,33 @@ Filter.update = function(filter, done) { * an id property, the filter will be updated, otherwise created * @param {Function} done */ -Filter.save = function(filter, done) { - return Filter[filter.id ? 'update' : 'create'](filter, done); -}; +Filter.save = function (filter, done) { + return Filter[filter.id ? 'update' : 'create'](filter, done); +}; /** * Delete a filter * * @param {uuid} id of the filter to delete * @param {Function} done */ -Filter.delete = function(id, done) { - return this.http.del(this.path +'/'+ id, { + + +Filter["delete"] = function (id, done) { + return this.http.del(this.path + '/' + id, { done: done }); }; - - /** * Performs an authorizations lookup on the resource or entity * * @param {uuid} [id] of the filter to get authorizations for * @param {Function} done */ -Filter.authorizations = function(id, done) { + + +Filter.authorizations = function (id, done) { if (arguments.length === 1) { return this.http.options(this.path, { done: id, @@ -2625,7 +2561,7 @@ Filter.authorizations = function(id, done) { }); } - return this.http.options(this.path +'/'+ id, { + return this.http.options(this.path + '/' + id, { done: done, headers: { Accept: 'application/json' @@ -2633,10 +2569,8 @@ Filter.authorizations = function(id, done) { }); }; - module.exports = Filter; - },{"./../abstract-client-resource":4}],19:[function(require,module,exports){ /* * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH @@ -2654,48 +2588,49 @@ module.exports = Filter; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var AbstractClientResource = require('./../abstract-client-resource'); -var utils = require('../../utils'); +var utils = require('../../utils'); /** * No-Op callback */ -function noop() {} + +function noop() {} /** * Group Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var Group = AbstractClientResource.extend(); + +var Group = AbstractClientResource.extend(); /** * Path used by the resource to perform HTTP queries * @type {String} */ -Group.path = 'group'; - +Group.path = 'group'; /** * Check resource access * @param {Object} options * @param {String} options.id * @param {Function} done */ -Group.options = function(options, done) { + +Group.options = function (options, done) { var id; if (arguments.length === 1) { done = options; id = ''; - } else { id = typeof options === 'string' ? options : options.id; - if( id === undefined ) { + + if (id === undefined) { id = ''; } } @@ -2707,7 +2642,6 @@ Group.options = function(options, done) { } }); }; - /** * Creates a group * @@ -2717,14 +2651,14 @@ Group.options = function(options, done) { * @param {String} group.type * @param {Function} done */ -Group.create = function(options, done) { - return this.http.post(this.path +'/create', { + + +Group.create = function (options, done) { + return this.http.post(this.path + '/create', { data: options, done: done || noop }); }; - - /** * Query for groups using a list of parameters and retrieves the count * @@ -2735,12 +2669,13 @@ Group.create = function(options, done) { * @param {String} [options.member] Only retrieve groups where the given user id is a member of. * @param {Function} done */ -Group.count = function(options, done) { + + +Group.count = function (options, done) { if (arguments.length === 1) { done = options; options = {}; - } - else { + } else { options = options || {}; } @@ -2749,24 +2684,21 @@ Group.count = function(options, done) { done: done || noop }); }; - - /** * Retrieves a single group * * @param {String} [options.id] The id of the group, can be a property (id) of an object * @param {Function} done */ -Group.get = function(options, done) { - var id = typeof options === 'string' ? options : options.id; + +Group.get = function (options, done) { + var id = typeof options === 'string' ? options : options.id; return this.http.get(this.path + '/' + utils.escapeUrl(id), { data: options, done: done || noop }); }; - - /** * Query for a list of groups using a list of parameters. * The size of the result set can be retrieved by using the get groups count method @@ -2790,12 +2722,13 @@ Group.get = function(options, done) { * * @param {Function} done */ -Group.list = function(options, done) { + + +Group.list = function (options, done) { if (arguments.length === 1) { done = options; options = {}; - } - else { + } else { options = options || {}; } @@ -2804,8 +2737,6 @@ Group.list = function(options, done) { done: done || noop }); }; - - /** * Add a memeber to a Group * @@ -2813,14 +2744,14 @@ Group.list = function(options, done) { * @param {String} [options.userId] The id of user to add to the group * @param {Function} done */ -Group.createMember = function(options, done) { - return this.http.put(this.path +'/' + utils.escapeUrl(options.id) + '/members/' + utils.escapeUrl(options.userId), { + + +Group.createMember = function (options, done) { + return this.http.put(this.path + '/' + utils.escapeUrl(options.id) + '/members/' + utils.escapeUrl(options.userId), { data: options, done: done || noop }); }; - - /** * Removes a memeber of a Group * @@ -2828,36 +2759,38 @@ Group.createMember = function(options, done) { * @param {String} [options.userId] The id of user to add to the group * @param {Function} done */ -Group.deleteMember = function(options, done) { - return this.http.del(this.path +'/' + utils.escapeUrl(options.id) + '/members/' + utils.escapeUrl(options.userId), { + + +Group.deleteMember = function (options, done) { + return this.http.del(this.path + '/' + utils.escapeUrl(options.id) + '/members/' + utils.escapeUrl(options.userId), { data: options, done: done || noop }); }; - - /** * Update a group * * @param {Object} group is an object representation of a group * @param {Function} done */ -Group.update = function(options, done) { - return this.http.put(this.path +'/' + utils.escapeUrl(options.id), { + + +Group.update = function (options, done) { + return this.http.put(this.path + '/' + utils.escapeUrl(options.id), { data: options, done: done || noop }); }; - - /** * Delete a group * * @param {Object} group is an object representation of a group * @param {Function} done */ -Group.delete = function(options, done) { - return this.http.del(this.path +'/' + utils.escapeUrl(options.id), { + + +Group["delete"] = function (options, done) { + return this.http.del(this.path + '/' + utils.escapeUrl(options.id), { data: options, done: done || noop }); @@ -2882,29 +2815,26 @@ module.exports = Group; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var AbstractClientResource = require('../abstract-client-resource'); -var helpers = require('../helpers'); - - +var helpers = require('../helpers'); /** * History Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var History = AbstractClientResource.extend(); + +var History = AbstractClientResource.extend(); /** * Path used by the resource to perform HTTP queries * @type {String} */ -History.path = 'history'; - +History.path = 'history'; /** * Queries for the number of user operation log entries that fulfill the given parameters * @@ -2930,7 +2860,8 @@ History.path = 'history'; * @param {Number} [params.maxResults] Pagination of results. Specifies the maximum number of results to return. Will return less results if there are no more results left. * @param {Function} done */ -History.userOperationCount = function(params, done) { + +History.userOperationCount = function (params, done) { if (typeof params === 'function') { done = arguments[0]; params = {}; @@ -2941,12 +2872,13 @@ History.userOperationCount = function(params, done) { done: done }); }; - /** * Queries for user operation log entries that fulfill the given parameters * This method takes the same parameters as `History.userOperationCount`. */ -History.userOperation = function(params, done) { + + +History.userOperation = function (params, done) { if (typeof params === 'function') { done = arguments[0]; params = {}; @@ -2957,9 +2889,6 @@ History.userOperation = function(params, done) { done: done }); }; - - - /** * Query for historic process instances that fulfill the given parameters. * @@ -3015,7 +2944,9 @@ History.userOperation = function(params, done) { * @param {Function} done */ -History.processInstance = function(params, done) { + + +History.processInstance = function (params, done) { if (typeof params === 'function') { done = arguments[0]; params = {}; @@ -3028,8 +2959,7 @@ History.processInstance = function(params, done) { for (var p in params) { if (queryParams.indexOf(p) > -1) { query[p] = params[p]; - } - else { + } else { body[p] = params[p]; } } @@ -3040,13 +2970,13 @@ History.processInstance = function(params, done) { done: done }); }; - - /** * Query for the number of historic process instances that fulfill the given parameters. * This method takes the same message body as `History.processInstance`. */ -History.processInstanceCount = function(params, done) { + + +History.processInstanceCount = function (params, done) { if (typeof params === 'function') { done = arguments[0]; params = {}; @@ -3057,7 +2987,6 @@ History.processInstanceCount = function(params, done) { done: done }); }; - /** * Delete finished process instances asynchronously. With creation of a batch operation. * @@ -3066,7 +2995,9 @@ History.processInstanceCount = function(params, done) { * @param done - a callback function * @returns {*} */ -History.deleteProcessInstancesAsync = function(params, done) { + + +History.deleteProcessInstancesAsync = function (params, done) { if (typeof params === 'function') { done = arguments[0]; params = {}; @@ -3077,7 +3008,6 @@ History.deleteProcessInstancesAsync = function(params, done) { done: done }); }; - /** * Set removal time to historic process instances asynchronously. With creation of a batch operation. * @@ -3086,7 +3016,9 @@ History.deleteProcessInstancesAsync = function(params, done) { * @param done - a callback function * @returns {*} */ -History.setRemovalTimeToHistoricProcessInstancesAsync = function(params, done) { + + +History.setRemovalTimeToHistoricProcessInstancesAsync = function (params, done) { if (typeof params === 'function') { done = arguments[0]; params = {}; @@ -3097,7 +3029,6 @@ History.setRemovalTimeToHistoricProcessInstancesAsync = function(params, done) { done: done }); }; - /** * Set removal time to historic decision instances asynchronously. With creation of a batch operation. * @@ -3106,7 +3037,9 @@ History.setRemovalTimeToHistoricProcessInstancesAsync = function(params, done) { * @param done - a callback function * @returns {*} */ -History.setRemovalTimeToHistoricDecisionInstancesAsync = function(params, done) { + + +History.setRemovalTimeToHistoricDecisionInstancesAsync = function (params, done) { if (typeof params === 'function') { done = arguments[0]; params = {}; @@ -3117,7 +3050,6 @@ History.setRemovalTimeToHistoricDecisionInstancesAsync = function(params, done) done: done }); }; - /** * Set removal time to historic batches asynchronously. With creation of a batch operation. * @@ -3126,7 +3058,9 @@ History.setRemovalTimeToHistoricDecisionInstancesAsync = function(params, done) * @param done - a callback function * @returns {*} */ -History.setRemovalTimeToHistoricBatchesAsync = function(params, done) { + + +History.setRemovalTimeToHistoricBatchesAsync = function (params, done) { if (typeof params === 'function') { done = arguments[0]; params = {}; @@ -3137,7 +3071,6 @@ History.setRemovalTimeToHistoricBatchesAsync = function(params, done) { done: done }); }; - /** * Query for historic decision instances that fulfill the given parameters. * @@ -3166,7 +3099,9 @@ History.setRemovalTimeToHistoricBatchesAsync = function(params, done) { * @param {Number} [params.maxResults] Pagination of results. Specifies the maximum number of results to return. Will return less results if there are no more results left. * @param {Function} done */ -History.decisionInstance = function(params, done) { + + +History.decisionInstance = function (params, done) { if (typeof params === 'function') { done = arguments[0]; params = {}; @@ -3177,13 +3112,13 @@ History.decisionInstance = function(params, done) { done: done }); }; - - /** * Query for the number of historic decision instances that fulfill the given parameters. * This method takes the same parameters as `History.decisionInstance`. */ -History.decisionInstanceCount = function(params, done) { + + +History.decisionInstanceCount = function (params, done) { if (typeof params === 'function') { done = arguments[0]; params = {}; @@ -3194,7 +3129,6 @@ History.decisionInstanceCount = function(params, done) { done: done }); }; - /** * Delete historic decision instances asynchronously. With creation of a batch operation. * @@ -3203,7 +3137,9 @@ History.decisionInstanceCount = function(params, done) { * @param done - a callback function * @returns {*} */ -History.deleteDecisionInstancesAsync = function(params, done) { + + +History.deleteDecisionInstancesAsync = function (params, done) { if (typeof params === 'function') { done = arguments[0]; params = {}; @@ -3214,13 +3150,13 @@ History.deleteDecisionInstancesAsync = function(params, done) { done: done }); }; - - /** * Query for historic batches that fulfill given parameters. Parameters may be the properties of batches, such as the id or type. * The size of the result set can be retrieved by using the GET query count. */ -History.batch = function(params, done) { + + +History.batch = function (params, done) { if (typeof params === 'function') { done = arguments[0]; params = {}; @@ -3231,21 +3167,23 @@ History.batch = function(params, done) { done: done }); }; - /** * Retrieves a single historic batch according to the HistoricBatch interface in the engine. */ -History.singleBatch = function(id, done) { + + +History.singleBatch = function (id, done) { return this.http.get(this.path + '/batch/' + id, { done: done }); }; - /** * Request the number of historic batches that fulfill the query criteria. * Takes the same filtering parameters as the GET query. */ -History.batchCount = function(params, done) { + + +History.batchCount = function (params, done) { if (typeof params === 'function') { done = arguments[0]; params = {}; @@ -3257,15 +3195,12 @@ History.batchCount = function(params, done) { }); }; -History.batchDelete = function(id, done) { +History.batchDelete = function (id, done) { var path = this.path + '/batch/' + id; - return this.http.del(path, { done: done }); }; - - /** * Query for process instance durations report. * @param {Object} [params] @@ -3276,7 +3211,9 @@ History.batchDelete = function(id, done) { * @param {Object} [params.startedBefore] Date before which the process instance were started * @param {Function} done */ -History.report = function(params, done) { + + +History.report = function (params, done) { if (typeof params === 'function') { done = arguments[0]; params = {}; @@ -3284,13 +3221,11 @@ History.report = function(params, done) { params.reportType = params.reportType || 'duration'; params.periodUnit = params.periodUnit || 'month'; - return this.http.get(this.path + '/process-instance/report', { data: params, done: done }); }; - /** * Query for process instance durations report. * @param {Object} [params] @@ -3301,7 +3236,9 @@ History.report = function(params, done) { * @param {Object} [params.startedBefore] Date before which the process instance were started * @param {Function} done */ -History.reportAsCsv = function(params, done) { + + +History.reportAsCsv = function (params, done) { if (typeof params === 'function') { done = arguments[0]; params = {}; @@ -3309,14 +3246,12 @@ History.reportAsCsv = function(params, done) { params.reportType = params.reportType || 'duration'; params.periodUnit = params.periodUnit || 'month'; - return this.http.get(this.path + '/process-instance/report', { data: params, accept: 'text/csv', done: done }); }; - /** * Query for historic task instances that fulfill the given parameters. * @@ -3408,7 +3343,9 @@ History.reportAsCsv = function(params, done) { * @param {Function} done */ -History.task = function(params, done) { + + +History.task = function (params, done) { if (typeof params === 'function') { done = arguments[0]; params = {}; @@ -3421,8 +3358,7 @@ History.task = function(params, done) { for (var p in params) { if (queryParams.indexOf(p) > -1) { query[p] = params[p]; - } - else { + } else { body[p] = params[p]; } } @@ -3433,12 +3369,13 @@ History.task = function(params, done) { done: done }); }; - /** * Query for the number of historic task instances that fulfill the given parameters. * This method takes the same parameters as `History.task`. */ -History.taskCount = function(params, done) { + + +History.taskCount = function (params, done) { if (typeof params === 'function') { done = arguments[0]; params = {}; @@ -3449,7 +3386,6 @@ History.taskCount = function(params, done) { done: done }); }; - /** * Query for a historic task instance duration report. * @@ -3463,7 +3399,9 @@ History.taskCount = function(params, done) { * @param {String} [params.periodUnit] Can be one of `month` or `quarter`, defaults to `month` * @param {Function} done */ -History.taskDurationReport = function(params, done) { + + +History.taskDurationReport = function (params, done) { if (typeof params === 'function') { done = arguments[0]; params = {}; @@ -3471,13 +3409,11 @@ History.taskDurationReport = function(params, done) { params.reportType = params.reportType || 'duration'; params.periodUnit = params.periodUnit || 'month'; - return this.http.get(this.path + '/task/report', { data: params, done: done }); }; - /** * Query for a completed task instance report * @@ -3494,20 +3430,20 @@ History.taskDurationReport = function(params, done) { * @param done * @returns {*} */ -History.taskReport = function(params, done) { + + +History.taskReport = function (params, done) { if (typeof params === 'function') { done = arguments[0]; params = {}; } params.reportType = params.reportType || 'count'; - return this.http.get(this.path + '/task/report', { data: params, done: done }); }; - /** * Query for historic case instances that fulfill the given parameters. * @@ -3581,7 +3517,9 @@ History.taskReport = function(params, done) { * @param {Function} done */ -History.caseInstance = function(params, done) { + + +History.caseInstance = function (params, done) { if (typeof params === 'function') { done = arguments[0]; params = {}; @@ -3594,8 +3532,7 @@ History.caseInstance = function(params, done) { for (var p in params) { if (queryParams.indexOf(p) > -1) { query[p] = params[p]; - } - else { + } else { body[p] = params[p]; } } @@ -3606,13 +3543,13 @@ History.caseInstance = function(params, done) { done: done }); }; - - /** * Query for the number of historic case instances that fulfill the given parameters. * This method takes the same parameters as `History.caseInstance`. */ -History.caseInstanceCount = function(params, done) { + + +History.caseInstanceCount = function (params, done) { if (typeof params === 'function') { done = arguments[0]; params = {}; @@ -3623,8 +3560,6 @@ History.caseInstanceCount = function(params, done) { done: done }); }; - - /** * Query for historic case activty instances that fulfill the given parameters. * @@ -3683,7 +3618,9 @@ History.caseInstanceCount = function(params, done) { * @param {Function} done */ -History.caseActivityInstance = function(params, done) { + + +History.caseActivityInstance = function (params, done) { if (typeof params === 'function') { done = arguments[0]; params = {}; @@ -3694,13 +3631,13 @@ History.caseActivityInstance = function(params, done) { done: done }); }; - - /** * Query for the number of historic case activity instances that fulfill the given parameters. * This method takes the same parameters as `History.caseActivityInstance`. */ -History.caseActivityInstanceCount = function(params, done) { + + +History.caseActivityInstanceCount = function (params, done) { if (typeof params === 'function') { done = arguments[0]; params = {}; @@ -3711,8 +3648,6 @@ History.caseActivityInstanceCount = function(params, done) { done: done }); }; - - /** * Query for historic variable instances that fulfill the given parameters. * @@ -3739,7 +3674,9 @@ History.caseActivityInstanceCount = function(params, done) { * @param {Function} done */ -History.variableInstance = function(params, done) { + + +History.variableInstance = function (params, done) { if (typeof params === 'function') { done = arguments[0]; params = {}; @@ -3752,8 +3689,7 @@ History.variableInstance = function(params, done) { for (var p in params) { if (queryParams.indexOf(p) > -1) { query[p] = params[p]; - } - else { + } else { body[p] = params[p]; } } @@ -3764,12 +3700,13 @@ History.variableInstance = function(params, done) { done: done }); }; - /** * Query for the number of historic variable instances that fulfill the given parameters. * This method takes the same parameters as `History.variableInstance`. */ -History.variableInstanceCount = function(params, done) { + + +History.variableInstanceCount = function (params, done) { if (typeof params === 'function') { done = arguments[0]; params = {}; @@ -3781,17 +3718,14 @@ History.variableInstanceCount = function(params, done) { }); }; - -History.caseActivityStatistics = function(params, done) { - +History.caseActivityStatistics = function (params, done) { var id = params.id || params; - return this.http.get(this.path + '/case-definition/' + id + '/statistics', { done: done }); }; -History.drdStatistics = function(id, params, done) { +History.drdStatistics = function (id, params, done) { var url = this.path + '/decision-requirements-definition/' + id + '/statistics'; if (typeof params === 'function') { @@ -3804,11 +3738,12 @@ History.drdStatistics = function(id, params, done) { done: done }); }; - /** * Query for the history cleanup configuration */ -History.cleanupConfiguration = function(params,done) { + + +History.cleanupConfiguration = function (params, done) { var url = this.path + '/cleanup/configuration'; if (typeof params === 'function') { @@ -3821,35 +3756,34 @@ History.cleanupConfiguration = function(params,done) { done: done }); }; - /** * Delete the history of a single variable */ -History.deleteVariable = function(id, done) { + +History.deleteVariable = function (id, done) { var url = this.path + '/variable-instance/' + id; - return this.http.del(url, { done: done }); }; - /** * Delete the history of a single variable */ -History.deleteAllVariables = function(id, done) { - var url = this.path + '/process-instance/' + id + '/variable-instances'; +History.deleteAllVariables = function (id, done) { + var url = this.path + '/process-instance/' + id + '/variable-instances'; return this.http.del(url, { done: done }); }; - /** * Query for the history cleanup job */ -History.cleanupJobs = function(params,done) { + + +History.cleanupJobs = function (params, done) { var url = this.path + '/cleanup/jobs'; if (typeof params === 'function') { @@ -3862,16 +3796,16 @@ History.cleanupJobs = function(params,done) { done: done }); }; - /** * Query to start a history cleanup job * @param {Object} [params] * @param {Boolean} [params.executeAtOnce] Execute job in nearest future */ -History.cleanup = function(params,done) { - var url = this.path + '/cleanup'; +History.cleanup = function (params, done) { + var url = this.path + '/cleanup'; + if (typeof params === 'function') { done = params; params = {}; @@ -3882,8 +3816,6 @@ History.cleanup = function(params,done) { done: done }); }; - - /** * Query for the count of the finished historic process instances, cleanable process instances and basic process definition data - id, key, name and version * @param {Object} [params] @@ -3892,7 +3824,9 @@ History.cleanup = function(params,done) { * @param {Number} [params.firstResult] Pagination of results. Specifies the index of the first result to return. * @param {Number} [params.maxResults] Pagination of results. Specifies the maximum number of results to return. Will return less results if there are no more results left. */ -History.cleanableProcessCount = function(params, done) { + + +History.cleanableProcessCount = function (params, done) { var url = this.path + '/process-definition/cleanable-process-instance-report/count'; if (typeof params === 'function') { @@ -3905,12 +3839,13 @@ History.cleanableProcessCount = function(params, done) { done: done }); }; - /** * Query for the report results about a process definition and finished process instances relevant to history cleanup * This method takes the same parameterers as 'History.cleanableProcessInstanceCount' */ -History.cleanableProcess = function(params, done) { + + +History.cleanableProcess = function (params, done) { var url = this.path + '/process-definition/cleanable-process-instance-report'; if (typeof params === 'function') { @@ -3923,7 +3858,6 @@ History.cleanableProcess = function(params, done) { done: done }); }; - /** * Query for the count of the finished historic case instances, cleanable case instances and basic case definition data - id, key, name and version. * @param {uuid[]} [params.caseDefinitionIdIn] Array of caseDefinition ids @@ -3931,7 +3865,9 @@ History.cleanableProcess = function(params, done) { * @param {Number} [params.firstResult] Pagination of results. Specifies the index of the first result to return. * @param {Number} [params.maxResults] Pagination of results. Specifies the maximum number of results to return. Will return less results if there are no more results left. */ -History.cleanableCaseCount = function(params, done) { + + +History.cleanableCaseCount = function (params, done) { var url = this.path + '/case-definition/cleanable-case-instance-report/count'; if (typeof params === 'function') { @@ -3944,12 +3880,13 @@ History.cleanableCaseCount = function(params, done) { done: done }); }; - /** * Query for the report results about a case definition and finished case instances relevant to history cleanup * This method takes the same parameterers as 'History.cleanableCaseInstanceCount ' */ -History.cleanableCase = function(params, done) { + + +History.cleanableCase = function (params, done) { var url = this.path + '/case-definition/cleanable-case-instance-report'; if (typeof params === 'function') { @@ -3962,7 +3899,6 @@ History.cleanableCase = function(params, done) { done: done }); }; - /** * Query for the count of the finished historic decision instances, cleanable decision instances and basic decision definition data - id, key, name and version * @param {Object} [params] @@ -3971,7 +3907,9 @@ History.cleanableCase = function(params, done) { * @param {Number} [params.firstResult] Pagination of results. Specifies the index of the first result to return. * @param {Number} [params.maxResults] Pagination of results. Specifies the maximum number of results to return. Will return less results if there are no more results left. */ -History.cleanableDecisionCount = function(params, done) { + + +History.cleanableDecisionCount = function (params, done) { var url = this.path + '/decision-definition/cleanable-decision-instance-report/count'; if (typeof params === 'function') { @@ -3984,12 +3922,13 @@ History.cleanableDecisionCount = function(params, done) { done: done }); }; - /** * Query for the report results about a decision definition and finished decision instances relevant to history cleanup * This method takes the same parameterers as 'History.cleanableDecisionInstanceCount ' */ -History.cleanableDecision = function(params, done) { + + +History.cleanableDecision = function (params, done) { var url = this.path + '/decision-definition/cleanable-decision-instance-report'; if (typeof params === 'function') { @@ -4002,14 +3941,15 @@ History.cleanableDecision = function(params, done) { done: done }); }; - /** * Query for the count of report results about historic batch operations relevant to history cleanup * @param {Object} [params] * @param {Number} [params.firstResult] Pagination of results. Specifies the index of the first result to return. * @param {Number} [params.maxResults] Pagination of results. Specifies the maximum number of results to return. Will return less results if there are no more results left. */ -History.cleanableBatchCount = function(params, done) { + + +History.cleanableBatchCount = function (params, done) { var url = this.path + '/batch/cleanable-batch-report/count'; if (typeof params === 'function') { @@ -4022,12 +3962,13 @@ History.cleanableBatchCount = function(params, done) { done: done }); }; - /** * Query for the report about historic batch operations relevant to history cleanup * This method takes the same parameterers as 'History.cleanableBatchCount' */ -History.cleanableBatch = function(params, done) { + + +History.cleanableBatch = function (params, done) { var url = this.path + '/batch/cleanable-batch-report'; if (typeof params === 'function') { @@ -4041,10 +3982,8 @@ History.cleanableBatch = function(params, done) { }); }; - History.externalTaskLogList = helpers.createSimpleGetQueryFunction('/external-task-log'); History.externalTaskLogCount = helpers.createSimpleGetQueryFunction('/external-task-log/count'); - module.exports = History; },{"../abstract-client-resource":4,"../helpers":5}],21:[function(require,module,exports){ @@ -4064,28 +4003,24 @@ module.exports = History; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var AbstractClientResource = require('./../abstract-client-resource'); - - - /** * Incident Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var Incident = AbstractClientResource.extend(); + +var Incident = AbstractClientResource.extend(); /** * Path used by the resource to perform HTTP queries * @type {String} */ -Incident.path = 'incident'; - +Incident.path = 'incident'; /** * Query for incidents that fulfill given parameters. The size of the result set can be retrieved by using the get incidents count method. * @@ -4129,13 +4064,13 @@ Incident.path = 'incident'; * * @param {RequestCallback} done */ -Incident.get = function(params, done) { + +Incident.get = function (params, done) { return this.http.get(this.path, { data: params, done: done }); }; - /** * Query for the number of incidents that fulfill given parameters. Takes the same parameters as the get incidents method. * @@ -4163,8 +4098,10 @@ Incident.get = function(params, done) { * * @param {RequestCallback} done */ -Incident.count = function(params, done) { - return this.http.get(this.path+'/count', { + + +Incident.count = function (params, done) { + return this.http.get(this.path + '/count', { data: params, done: done }); @@ -4172,7 +4109,6 @@ Incident.count = function(params, done) { module.exports = Incident; - },{"./../abstract-client-resource":4}],22:[function(require,module,exports){ /* * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH @@ -4190,32 +4126,28 @@ module.exports = Incident; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var AbstractClientResource = require('./../abstract-client-resource'); - - var JobDefinition = AbstractClientResource.extend(); - JobDefinition.path = 'job-definition'; -JobDefinition.setRetries = function(params, done) { +JobDefinition.setRetries = function (params, done) { return this.http.put(this.path + '/' + params.id + '/retries', { data: params, done: done }); }; -JobDefinition.list = function(params, done) { +JobDefinition.list = function (params, done) { return this.http.get(this.path, { data: params, done: done }); }; -JobDefinition.get = function(id, done) { +JobDefinition.get = function (id, done) { return this.http.get(this.path + '/' + id, { done: done }); @@ -4240,34 +4172,30 @@ module.exports = JobDefinition; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var AbstractClientResource = require('./../abstract-client-resource'); - - - /** * Job Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var Job = AbstractClientResource.extend(); + +var Job = AbstractClientResource.extend(); /** * Path used by the resource to perform HTTP queries * @type {String} */ -Job.path = 'job'; +Job.path = 'job'; -Job.get = function(id, done) { +Job.get = function (id, done) { return this.http.get(this.path + '/' + id, { done: done }); }; - /** * Query for jobs that fulfill given parameters. * @param {Object} params @@ -4297,23 +4225,22 @@ Job.get = function(id, done) { * @param {String} [params.maxResults] Pagination of results. Specifies the maximum number of results to return. Will return less results if there are no more results left. * @param {Function} done */ -Job.list = function(params, done) { - var path = this.path; - // those parameters have to be passed in the query and not body - path += '?firstResult='+ (params.firstResult || 0); - if(params.maxResults) { - path += '&maxResults='+ (params.maxResults); - } +Job.list = function (params, done) { + var path = this.path; // those parameters have to be passed in the query and not body + + path += '?firstResult=' + (params.firstResult || 0); + if (params.maxResults) { + path += '&maxResults=' + params.maxResults; + } return this.http.post(path, { data: params, done: done }); }; - /** * Sets the retries of the job to the given number of retries. * @param {Object} params @@ -4321,27 +4248,28 @@ Job.list = function(params, done) { * @param {String} params.retries The number of retries to set that a job has left. * @param {Function} done */ -Job.setRetries = function(params, done) { + + +Job.setRetries = function (params, done) { return this.http.put(this.path + '/' + params.id + '/retries', { data: params, done: done }); }; -Job.delete = function(id, done) { +Job["delete"] = function (id, done) { return this.http.del(this.path + '/' + id, { done: done }); }; -Job.stacktrace = function(id, done) { +Job.stacktrace = function (id, done) { var url = this.path + '/' + id + '/stacktrace'; return this.http.get(url, { accept: 'text/plain', done: done }); }; - /** * Recalculates the duedate for a given job. * @param {Object} params @@ -4349,17 +4277,19 @@ Job.stacktrace = function(id, done) { * @param {Bool} params.creationDateBased Base recalculation on Job creation date. Default: true * @param {Function} done */ -Job.recalculateDuedate = function(params, done) { + + +Job.recalculateDuedate = function (params, done) { var url = this.path + '/' + params.id + '/duedate/recalculate'; - if(params.creationDateBased == false) { + if (params.creationDateBased == false) { url += '?creationDateBased=' + params.creationDateBased; } + return this.http.post(url, { done: done }); }; - /** * Sets the duedate of the job to the given date. * @param {Object} params @@ -4368,7 +4298,8 @@ Job.recalculateDuedate = function(params, done) { * @param {Function} done */ -Job.setDuedate = function(params, done) { + +Job.setDuedate = function (params, done) { var url = this.path + '/' + params.id + '/duedate'; return this.http.put(url, { data: params, @@ -4376,7 +4307,7 @@ Job.setDuedate = function(params, done) { }); }; -Job.suspended = function(params, done) { +Job.suspended = function (params, done) { return this.http.put(this.path + '/' + params.id + '/suspended', { data: { suspended: !!params.suspended @@ -4404,26 +4335,24 @@ module.exports = Job; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var AbstractClientResource = require('./../abstract-client-resource'); - /** * Message Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var Message = AbstractClientResource.extend(); + +var Message = AbstractClientResource.extend(); /** * Path used by the resource to perform HTTP queries * @type {String} */ -Message.path = 'message'; - +Message.path = 'message'; /** * correlates a message * @@ -4433,9 +4362,9 @@ Message.path = 'message'; * @param {String} [params.correlationKeys] A JSON object containing the keys the recieve task is to be corrolated with. Each key corresponds to a variable name and each value to a variable value. * @param {String} [params.processVariables] A JSON object containing the variables the recieve task is to be corrolated with. Each key corresponds to a variable name and each value to a variable value. */ -Message.correlate = function(params, done) { - var url = this.path + '/'; +Message.correlate = function (params, done) { + var url = this.path + '/'; return this.http.post(url, { data: params, done: done @@ -4461,27 +4390,24 @@ module.exports = Message; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var AbstractClientResource = require('./../abstract-client-resource'); - - - /** * Job Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var Metrics = AbstractClientResource.extend(); + +var Metrics = AbstractClientResource.extend(); /** * Path used by the resource to perform HTTP queries * @type {String} */ -Metrics.path = 'metrics'; +Metrics.path = 'metrics'; /** * Query for jobs that fulfill given parameters. * @param {Object} params @@ -4490,14 +4416,15 @@ Metrics.path = 'metrics'; * @param {String} [params.endDate] * @param {Function} done */ -Metrics.sum = function(params, done) { +Metrics.sum = function (params, done) { var path = this.path + '/' + params.name + '/sum'; delete params.name; - - return this.http.get(path, { data: params, done: done }); + return this.http.get(path, { + data: params, + done: done + }); }; - /** * Retrieves a list of metrics, aggregated for a given interval. * @param {Object} params @@ -4510,8 +4437,13 @@ Metrics.sum = function(params, done) { * @param {Integer} [params.interval] The interval for which the metrics should be aggregated. Time unit is seconds. Default: The interval is set to 15 minutes (900 seconds). * @param {Function} done */ -Metrics.byInterval = function(params, done) { - return this.http.get(this.path, { data: params, done: done }); + + +Metrics.byInterval = function (params, done) { + return this.http.get(this.path, { + data: params, + done: done + }); }; module.exports = Metrics; @@ -4533,25 +4465,24 @@ module.exports = Metrics; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var AbstractClientResource = require('./../abstract-client-resource'); - /** * Migration Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var Migration = AbstractClientResource.extend(); + +var Migration = AbstractClientResource.extend(); /** * Path used by the resource to perform HTTP queries * @type {String} */ -Migration.path = 'migration'; +Migration.path = 'migration'; /** * Generate a migration plan for a given source and target process definition * @param {Object} params @@ -4559,15 +4490,14 @@ Migration.path = 'migration'; * @param {String} [params.targetProcessDefinitionId] * @param {Function} done */ -Migration.generate = function(params, done) { - var path = this.path + '/generate'; +Migration.generate = function (params, done) { + var path = this.path + '/generate'; return this.http.post(path, { data: params, done: done }); }; - /** * Execute a migration plan * @param {Object} params @@ -4575,15 +4505,15 @@ Migration.generate = function(params, done) { * @param {String} [params.processInstanceIds] * @param {Function} done */ -Migration.execute = function(params, done) { - var path = this.path + '/execute'; + +Migration.execute = function (params, done) { + var path = this.path + '/execute'; return this.http.post(path, { data: params, done: done }); }; - /** * Execute a migration plan asynchronously * @param {Object} params @@ -4591,18 +4521,18 @@ Migration.execute = function(params, done) { * @param {String} [params.processInstanceIds] * @param {Function} done */ -Migration.executeAsync = function(params, done) { - var path = this.path + '/executeAsync'; + +Migration.executeAsync = function (params, done) { + var path = this.path + '/executeAsync'; return this.http.post(path, { data: params, done: done }); }; -Migration.validate = function(params, done) { +Migration.validate = function (params, done) { var path = this.path + '/validate'; - return this.http.post(path, { data: params, done: done @@ -4628,25 +4558,24 @@ module.exports = Migration; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var AbstractClientResource = require('./../abstract-client-resource'); - /** * Modification Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var Modification = AbstractClientResource.extend(); + +var Modification = AbstractClientResource.extend(); /** * Path used by the resource to perform HTTP queries * @type {String} */ -Modification.path = 'modification'; +Modification.path = 'modification'; /** * Execute a modification * @param {Object} params @@ -4658,15 +4587,14 @@ Modification.path = 'modification'; * @param {String} [params.instructions] * @param {Function} done */ -Modification.execute = function(params, done) { - var path = this.path + '/execute'; +Modification.execute = function (params, done) { + var path = this.path + '/execute'; return this.http.post(path, { data: params, done: done }); }; - /** * Execute a modification asynchronously * @param {Object} params @@ -4678,9 +4606,10 @@ Modification.execute = function(params, done) { * @param {String} [params.instructions] * @param {Function} done */ -Modification.executeAsync = function(params, done) { - var path = this.path + '/executeAsync'; + +Modification.executeAsync = function (params, done) { + var path = this.path + '/executeAsync'; return this.http.post(path, { data: params, done: done @@ -4706,37 +4635,35 @@ module.exports = Modification; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var AbstractClientResource = require('./../abstract-client-resource'); - - /** * Password Policy Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var PasswordPolicy = AbstractClientResource.extend(); + +var PasswordPolicy = AbstractClientResource.extend(); /** * Path used by the resource to perform HTTP queries * @type {String} */ -PasswordPolicy.path = 'identity/password-policy'; +PasswordPolicy.path = 'identity/password-policy'; /** * Fetch the active password policy. * * @param {Function} done */ -PasswordPolicy.get = function(done) { + +PasswordPolicy.get = function (done) { return this.http.get(this.path, { done: done }); }; - /** * Validate a password against the password policy * @@ -4744,10 +4671,15 @@ PasswordPolicy.get = function(done) { * @param {String} [params.password] Password to be validated * @param {Function} done */ -PasswordPolicy.validate = function(params, done) { - if(typeof params === 'string') { - params = {'password': params}; + + +PasswordPolicy.validate = function (params, done) { + if (typeof params === 'string') { + params = { + password: params + }; } + return this.http.post(this.path, { data: params, done: done @@ -4773,482 +4705,462 @@ module.exports = PasswordPolicy; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var Q = require('q'); -var AbstractClientResource = require('./../abstract-client-resource'); +var AbstractClientResource = require('./../abstract-client-resource'); /** * No-Op callback */ -function noop() {} + +function noop() {} /** * Process Definition Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var ProcessDefinition = AbstractClientResource.extend( - /** @lends CamSDK.client.resource.ProcessDefinition.prototype */ - { - /** - * Suspends the process definition instance - * - * @param {Object.} [params] - * @param {requestCallback} [done] - */ - suspend: function(params, done) { - // allows to pass only a callback - if (typeof params === 'function') { - done = params; - params = {}; - } - params = params || {}; - done = done || noop; - - return this.http.post(this.path, { - done: done - }); - }, - /** - * Retrieves the statistics of a process definition. - * - * @param {Function} [done] - */ - stats: function(done) { - return this.http.post(this.path, { - done: done || noop - }); - }, +var ProcessDefinition = AbstractClientResource.extend( +/** @lends CamSDK.client.resource.ProcessDefinition.prototype */ +{ + /** + * Suspends the process definition instance + * + * @param {Object.} [params] + * @param {requestCallback} [done] + */ + suspend: function suspend(params, done) { + // allows to pass only a callback + if (typeof params === 'function') { + done = params; + params = {}; + } + params = params || {}; + done = done || noop; + return this.http.post(this.path, { + done: done + }); + }, - /** - * Retrieves the BPMN 2.0 XML document of a process definition. - * - * @param {Function} [done] - */ - // xml: function(id, done) { - // return this.http.post(this.path + +'/xml', { - // done: done || noop - // }); - // }, - - - /** - * Starts a process instance from a process definition. - * - * @param {Object} [varname] - * @param {Function} [done] - */ - start: function(done) { - return this.http.post(this.path, { - data: {}, - done: done - }); - } + /** + * Retrieves the statistics of a process definition. + * + * @param {Function} [done] + */ + stats: function stats(done) { + return this.http.post(this.path, { + done: done || noop + }); }, - /** @lends CamSDK.client.resource.ProcessDefinition */ - { - /** - * API path for the process instance resource - */ - path: 'process-definition', + /** + * Retrieves the BPMN 2.0 XML document of a process definition. + * + * @param {Function} [done] + */ + // xml: function(id, done) { + // return this.http.post(this.path + +'/xml', { + // done: done || noop + // }); + // }, + /** + * Starts a process instance from a process definition. + * + * @param {Object} [varname] + * @param {Function} [done] + */ + start: function start(done) { + return this.http.post(this.path, { + data: {}, + done: done + }); + } +}, +/** @lends CamSDK.client.resource.ProcessDefinition */ +{ + /** + * API path for the process instance resource + */ + path: 'process-definition', + /** + * Retrieve a single process definition + * + * @param {uuid} id of the process definition to be requested + * @param {Function} done + */ + get: function get(id, done) { + // var pointer = ''; + // if (data.key) { + // pointer = 'key/'+ data.key; + // } + // else if (data.id) { + // pointer = data.id; + // } + return this.http.get(this.path + '/' + id, { + done: done + }); + }, - /** - * Retrieve a single process definition - * - * @param {uuid} id of the process definition to be requested - * @param {Function} done - */ - get: function(id, done) { + /** + * Retrieve a single process definition + * + * @param {String} key of the process definition to be requested + * @param {Function} done + */ + getByKey: function getByKey(key, done) { + return this.http.get(this.path + '/key/' + key, { + done: done + }); + }, - // var pointer = ''; - // if (data.key) { - // pointer = 'key/'+ data.key; - // } - // else if (data.id) { - // pointer = data.id; - // } + /** + * Get a list of process definitions + * @param {Object} params Query parameters as follow + * @param {String} [params.name] Filter by name. + * @param {String} [params.nameLike] Filter by names that the parameter is a substring of. + * @param {String} [params.deploymentId] Filter by the deployment the id belongs to. + * @param {String} [params.key] Filter by key, i.e. the id in the BPMN 2.0 XML. Exact match. + * @param {String} [params.keyLike] Filter by keys that the parameter is a substring of. + * @param {String} [params.category] Filter by category. Exact match. + * @param {String} [params.categoryLike] Filter by categories that the parameter is a substring of. + * @param {String} [params.ver] Filter by version. + * @param {String} [params.latest] Only include those process definitions that are latest versions. + * Values may be "true" or "false". + * @param {String} [params.resourceName] Filter by the name of the process definition resource. Exact match. + * @param {String} [params.resourceNameLike] Filter by names of those process definition resources that the parameter is a substring of. + * @param {String} [params.startableBy] Filter by a user name who is allowed to start the process. + * @param {String} [params.active] Only include active process definitions. + * Values may be "true" or "false". + * @param {String} [params.suspended] Only include suspended process definitions. + * Values may be "true" or "false". + * @param {String} [params.incidentId] Filter by the incident id. + * @param {String} [params.incidentType] Filter by the incident type. + * @param {String} [params.incidentMessage] Filter by the incident message. Exact match. + * @param {String} [params.incidentMessageLike] Filter by the incident message that the parameter is a substring of. + * + * @param {String} [params.sortBy] Sort the results lexicographically by a given criterion. + * Valid values are category, "key", "id", "name", "version" and "deploymentId". + * Must be used in conjunction with the "sortOrder" parameter. + * + * @param {String} [params.sortOrder] Sort the results in a given order. + * Values may be asc for ascending "order" or "desc" for descending order. + * Must be used in conjunction with the sortBy parameter. + * + * @param {Integer} [params.firstResult] Pagination of results. Specifies the index of the first result to return. + * @param {Integer} [params.maxResults] Pagination of results. Specifies the maximum number of results to return. + * Will return less results, if there are no more results left. + * @param {requestCallback} [done] + * + * @example + * CamSDK.resource('process-definition').list({ + * nameLike: 'Process' + * }, function(err, results) { + * // + * }); + */ + list: function list() { + return AbstractClientResource.list.apply(this, arguments); + }, - return this.http.get(this.path +'/'+ id, { - done: done - }); - }, + /** + * Get a count of process definitions + * Same parameters as list + */ + count: function count() { + return AbstractClientResource.count.apply(this, arguments); + }, + /** + * Fetch the variables of a process definition + * @param {Object.} data + * @param {String} [data.id] of the process + * @param {String} [data.key] of the process + * @param {Array} [data.names] of variables to be fetched + * @param {Function} [done] + */ + formVariables: function formVariables(data, done) { + var pointer = ''; + done = done || noop; + + if (data.key) { + pointer = 'key/' + data.key; + } else if (data.id) { + pointer = data.id; + } else { + var err = new Error('Process definition task variables needs either a key or an id.'); + done(err); + return Q.reject(err); + } - /** - * Retrieve a single process definition - * - * @param {String} key of the process definition to be requested - * @param {Function} done - */ - getByKey: function(key, done) { - return this.http.get(this.path +'/key/'+ key, { - done: done - }); - }, + var queryData = { + deserializeValues: data.deserializeValues + }; + if (data.names) { + queryData.variableNames = (data.names || []).join(','); + } - /** - * Get a list of process definitions - * @param {Object} params Query parameters as follow - * @param {String} [params.name] Filter by name. - * @param {String} [params.nameLike] Filter by names that the parameter is a substring of. - * @param {String} [params.deploymentId] Filter by the deployment the id belongs to. - * @param {String} [params.key] Filter by key, i.e. the id in the BPMN 2.0 XML. Exact match. - * @param {String} [params.keyLike] Filter by keys that the parameter is a substring of. - * @param {String} [params.category] Filter by category. Exact match. - * @param {String} [params.categoryLike] Filter by categories that the parameter is a substring of. - * @param {String} [params.ver] Filter by version. - * @param {String} [params.latest] Only include those process definitions that are latest versions. - * Values may be "true" or "false". - * @param {String} [params.resourceName] Filter by the name of the process definition resource. Exact match. - * @param {String} [params.resourceNameLike] Filter by names of those process definition resources that the parameter is a substring of. - * @param {String} [params.startableBy] Filter by a user name who is allowed to start the process. - * @param {String} [params.active] Only include active process definitions. - * Values may be "true" or "false". - * @param {String} [params.suspended] Only include suspended process definitions. - * Values may be "true" or "false". - * @param {String} [params.incidentId] Filter by the incident id. - * @param {String} [params.incidentType] Filter by the incident type. - * @param {String} [params.incidentMessage] Filter by the incident message. Exact match. - * @param {String} [params.incidentMessageLike] Filter by the incident message that the parameter is a substring of. - * - * @param {String} [params.sortBy] Sort the results lexicographically by a given criterion. - * Valid values are category, "key", "id", "name", "version" and "deploymentId". - * Must be used in conjunction with the "sortOrder" parameter. - * - * @param {String} [params.sortOrder] Sort the results in a given order. - * Values may be asc for ascending "order" or "desc" for descending order. - * Must be used in conjunction with the sortBy parameter. - * - * @param {Integer} [params.firstResult] Pagination of results. Specifies the index of the first result to return. - * @param {Integer} [params.maxResults] Pagination of results. Specifies the maximum number of results to return. - * Will return less results, if there are no more results left. - - * @param {requestCallback} [done] - * - * @example - * CamSDK.resource('process-definition').list({ - * nameLike: 'Process' - * }, function(err, results) { - * // - * }); - */ - list: function() { - return AbstractClientResource.list.apply(this, arguments); - }, + return this.http.get(this.path + '/' + pointer + '/form-variables', { + data: queryData, + done: done + }); + }, - /** - * Get a count of process definitions - * Same parameters as list - */ - count: function() { - return AbstractClientResource.count.apply(this, arguments); - }, + /** + * Submit a form to start a process definition + * + * @param {Object.} data + * @param {String} [data.key] start the process-definition with this key + * @param {String} [data.tenantId] and the this tenant-id + * @param {String} [data.id] or: start the process-definition with this id + * @param {String} [data.businessKey] of the process to be set + * @param {Array} [data.variables] variables to be set + * @param {Function} [done] + */ + submitForm: function submitForm(data, done) { + var pointer = ''; + done = done || noop; + if (data.key) { + pointer = 'key/' + data.key; - /** - * Fetch the variables of a process definition - * @param {Object.} data - * @param {String} [data.id] of the process - * @param {String} [data.key] of the process - * @param {Array} [data.names] of variables to be fetched - * @param {Function} [done] - */ - formVariables: function(data, done) { - var pointer = ''; - done = done || noop; - if (data.key) { - pointer = 'key/'+ data.key; - } - else if (data.id) { - pointer = data.id; + if (data.tenantId) { + pointer += '/tenant-id/' + data.tenantId; } - else { - var err = new Error('Process definition task variables needs either a key or an id.'); - done(err); - return Q.reject(err); - } - - var queryData = { - deserializeValues: data.deserializeValues - }; + } else if (data.id) { + pointer = data.id; + } else { + return done(new Error('Process definition task variables needs either a key or an id.')); + } - if(data.names) { - queryData.variableNames = (data.names || []).join(','); - } + return this.http.post(this.path + '/' + pointer + '/submit-form', { + data: { + businessKey: data.businessKey, + variables: data.variables + }, + done: done + }); + }, - return this.http.get(this.path +'/'+ pointer +'/form-variables', { - data: queryData, - done: done - }); - }, + /** + * Delete multiple process definitions by key or a single process definition by id + * + * @param {Object.} data + * @param {String} [data.key] delete the process-definition with this key + * @param {String} [data.tenantId] and the this tenant-id + * @param {String} [data.id] or: delete the process-definition with this id + * @param {Boolean} [data.cascade] All instances, including historic instances, + * will also be deleted + * @param {Boolean} [data.skipCustomListeners] Skip execution listener invocation for + * activities that are started or ended + * as part of this request. + * @param {Function} [done] + */ + "delete": function _delete(data, done) { + done = done || noop; + var pointer = ''; + if (data.key) { + pointer = 'key/' + data.key; - /** - * Submit a form to start a process definition - * - * @param {Object.} data - * @param {String} [data.key] start the process-definition with this key - * @param {String} [data.tenantId] and the this tenant-id - * @param {String} [data.id] or: start the process-definition with this id - * @param {String} [data.businessKey] of the process to be set - * @param {Array} [data.variables] variables to be set - * @param {Function} [done] - */ - submitForm: function(data, done) { - var pointer = ''; - done = done || noop; - if (data.key) { - pointer = 'key/'+ data.key; - if (data.tenantId) { - pointer += '/tenant-id/' + data.tenantId; - } + if (data.tenantId) { + pointer += '/tenant-id/' + data.tenantId; } - else if (data.id) { - pointer = data.id; - } - else { - return done(new Error('Process definition task variables needs either a key or an id.')); - } - - return this.http.post(this.path +'/'+ pointer +'/submit-form', { - data: { - businessKey : data.businessKey, - variables: data.variables - }, - done: done - }); - }, + pointer += '/delete'; + } else if (data.id) { + pointer = data.id; + } else { + return done(new Error('Process definition deletion needs either a key or an id.')); + } - /** - * Delete multiple process definitions by key or a single process definition by id - * - * @param {Object.} data - * @param {String} [data.key] delete the process-definition with this key - * @param {String} [data.tenantId] and the this tenant-id - * @param {String} [data.id] or: delete the process-definition with this id - * @param {Boolean} [data.cascade] All instances, including historic instances, - * will also be deleted - * @param {Boolean} [data.skipCustomListeners] Skip execution listener invocation for - * activities that are started or ended - * as part of this request. - * @param {Function} [done] - */ - delete: function(data, done) { - done = done || noop; - - var pointer = ''; - if (data.key) { - pointer = 'key/'+ data.key; - if (data.tenantId) { - pointer += '/tenant-id/' + data.tenantId; - } - pointer += '/delete'; - } else if (data.id) { - pointer = data.id; - } else { - return done(new Error('Process definition deletion needs either a key or an id.')); - } + var queryParams = '?'; + var param = 'cascade'; - var queryParams = '?'; - var param = 'cascade'; - if (typeof data[param] === 'boolean') { - queryParams += param + '=' + data[param]; - } + if (typeof data[param] === 'boolean') { + queryParams += param + '=' + data[param]; + } - param = 'skipCustomListeners'; - if (typeof data[param] === 'boolean') { - if (queryParams.length > 1) { - queryParams += '&'; - } + param = 'skipCustomListeners'; - queryParams += param + '=' + data[param]; + if (typeof data[param] === 'boolean') { + if (queryParams.length > 1) { + queryParams += '&'; } - param = 'skipIoMappings'; - if (typeof data[param] === 'boolean') { - if (queryParams.length > 1) { - queryParams += '&'; - } + queryParams += param + '=' + data[param]; + } + + param = 'skipIoMappings'; - queryParams += param + '=' + data[param]; + if (typeof data[param] === 'boolean') { + if (queryParams.length > 1) { + queryParams += '&'; } - return this.http.del(this.path +'/'+ pointer + queryParams, { - done: done - }); - }, + queryParams += param + '=' + data[param]; + } - /** - * Retrieves the form of a process definition. - * @param {Function} [done] - */ - startForm: function(data, done) { - var path = this.path +'/'+ (data.key ? 'key/'+ data.key : data.id) +'/startForm'; - return this.http.get(path, { - done: done || noop - }); - }, + return this.http.del(this.path + '/' + pointer + queryParams, { + done: done + }); + }, + /** + * Retrieves the form of a process definition. + * @param {Function} [done] + */ + startForm: function startForm(data, done) { + var path = this.path + '/' + (data.key ? 'key/' + data.key : data.id) + '/startForm'; + return this.http.get(path, { + done: done || noop + }); + }, - /** - * Retrieves the form of a process definition. - * @param {Function} [done] - */ - xml: function(data, done) { - var path = this.path +'/'+ (data.id ? data.id : 'key/'+ data.key) +'/xml'; - return this.http.get(path, { - done: done || noop - }); - }, - - /** - * Retrieves runtime statistics of a given process definition grouped by activities - * @param {Function} [done] - */ - statistics: function(data, done) { - var path = this.path; - - if(data.id) { - path += '/' + data.id; - } else if (data.key) { - path += '/key/'+ data.key; - } - - path += '/statistics'; - - return this.http.get(path, { - data: data, - done: done || noop - }); - }, - - - /** - * Submits the form of a process definition. - * - * @param {Object} [data] - * @param {Function} [done] - */ - submit: function(data, done) { - var path = this.path; - if (data.key) { - path += '/key/'+ data.key; - } - else { - path += '/'+ data.id; - } - path += '/submit-form'; - - return this.http.post(path, { - data: data, - done: done - }); - }, - + /** + * Retrieves the form of a process definition. + * @param {Function} [done] + */ + xml: function xml(data, done) { + var path = this.path + '/' + (data.id ? data.id : 'key/' + data.key) + '/xml'; + return this.http.get(path, { + done: done || noop + }); + }, - /** - * Suspends one or more process definitions - * - * @param {String|String[]} ids - * @param {Object.} [params] - * @param {requestCallback} [done] - */ - suspend: function(ids, params, done) { - // allows to pass only a callback - if (typeof params === 'function') { - done = params; - params = {}; - } - params = params || {}; - done = done || noop; - // allows to pass a single ID - ids = Array.isArray(ids) ? ids : [ids]; + /** + * Retrieves runtime statistics of a given process definition grouped by activities + * @param {Function} [done] + */ + statistics: function statistics(data, done) { + var path = this.path; - return this.http.post(this.path, { - done: done - }); - }, + if (data.id) { + path += '/' + data.id; + } else if (data.key) { + path += '/key/' + data.key; + } - /** - * Instantiates a given process definition. - * - * @param {Object} [params] - * @param {String} [params.id] The id of the process definition to be instantiated. Must be omitted if key is provided. - * @param {String} [params.key] The key of the process definition (the latest version thereof) to be instantiated. Must be omitted if id is provided. - * @param {String} [params.tenantId] The id of the tenant the process definition belongs to. Must be omitted if id is provided. - * @param {String} [params.variables] A JSON object containing the variables the process is to be initialized with. Each key corresponds to a variable name and each value to a variable value. - * @param {String} [params.businessKey] The business key the process instance is to be initialized with. The business key uniquely identifies the process instance in the context of the given process definition. - * @param {String} [params.caseInstanceId] The case instance id the process instance is to be initialized with. - */ - start: function(params, done) { - var url = this.path + '/'; - - if (params.id) { - url = url + params.id; - } else { - url = url + 'key/' + params.key; + path += '/statistics'; + return this.http.get(path, { + data: data, + done: done || noop + }); + }, - if (params.tenantId) { - url = url + '/tenant-id/' + params.tenantId; - } - } + /** + * Submits the form of a process definition. + * + * @param {Object} [data] + * @param {Function} [done] + */ + submit: function submit(data, done) { + var path = this.path; - return this.http.post(url + '/start', { - data: params, - done: done - }); - }, + if (data.key) { + path += '/key/' + data.key; + } else { + path += '/' + data.id; + } - /** - * Instantiates a given process definition. + path += '/submit-form'; + return this.http.post(path, { + data: data, + done: done + }); + }, - * @param {String} [id] The id of the process definition to activate or suspend. - * @param {Object} [params] - * @param {Number} [params.historyTimeToLive] New value for historyTimeToLive field of process definition. Can be null. - */ - updateHistoryTimeToLive: function(id, params, done) { - var url = this.path + '/' + id + '/history-time-to-live'; + /** + * Suspends one or more process definitions + * + * @param {String|String[]} ids + * @param {Object.} [params] + * @param {requestCallback} [done] + */ + suspend: function suspend(ids, params, done) { + // allows to pass only a callback + if (typeof params === 'function') { + done = params; + params = {}; + } - return this.http.put(url, { - data: params, - done: done - }); - }, + params = params || {}; + done = done || noop; // allows to pass a single ID - restart: function(id, params, done) { - var url = this.path + '/' + id + '/restart'; + ids = Array.isArray(ids) ? ids : [ids]; + return this.http.post(this.path, { + done: done + }); + }, - return this.http.post(url, { - data: params, - done: done - }); - }, + /** + * Instantiates a given process definition. + * + * @param {Object} [params] + * @param {String} [params.id] The id of the process definition to be instantiated. Must be omitted if key is provided. + * @param {String} [params.key] The key of the process definition (the latest version thereof) to be instantiated. Must be omitted if id is provided. + * @param {String} [params.tenantId] The id of the tenant the process definition belongs to. Must be omitted if id is provided. + * @param {String} [params.variables] A JSON object containing the variables the process is to be initialized with. Each key corresponds to a variable name and each value to a variable value. + * @param {String} [params.businessKey] The business key the process instance is to be initialized with. The business key uniquely identifies the process instance in the context of the given process definition. + * @param {String} [params.caseInstanceId] The case instance id the process instance is to be initialized with. + */ + start: function start(params, done) { + var url = this.path + '/'; - restartAsync: function(id, params, done) { - var url = this.path + '/' + id + '/restart-async'; + if (params.id) { + url = url + params.id; + } else { + url = url + 'key/' + params.key; - return this.http.post(url, { - data: params, - done: done - }); + if (params.tenantId) { + url = url + '/tenant-id/' + params.tenantId; + } } - }); + return this.http.post(url + '/start', { + data: params, + done: done + }); + }, + /** + * Instantiates a given process definition. + * @param {String} [id] The id of the process definition to activate or suspend. + * @param {Object} [params] + * @param {Number} [params.historyTimeToLive] New value for historyTimeToLive field of process definition. Can be null. + */ + updateHistoryTimeToLive: function updateHistoryTimeToLive(id, params, done) { + var url = this.path + '/' + id + '/history-time-to-live'; + return this.http.put(url, { + data: params, + done: done + }); + }, + restart: function restart(id, params, done) { + var url = this.path + '/' + id + '/restart'; + return this.http.post(url, { + data: params, + done: done + }); + }, + restartAsync: function restartAsync(id, params, done) { + var url = this.path + '/' + id + '/restart-async'; + return this.http.post(url, { + data: params, + done: done + }); + } +}); module.exports = ProcessDefinition; -},{"./../abstract-client-resource":4,"q":53}],30:[function(require,module,exports){ +},{"./../abstract-client-resource":4,"q":63}],30:[function(require,module,exports){ /* * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH * under one or more contributor license agreements. See the NOTICE file @@ -5265,12 +5177,11 @@ module.exports = ProcessDefinition; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var AbstractClientResource = require('./../abstract-client-resource'); -var utils = require('../../utils'); +var utils = require('../../utils'); /** * Process Instance Resource * @@ -5278,208 +5189,197 @@ var utils = require('../../utils'); * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var ProcessInstance = AbstractClientResource.extend( - /** @lends CamSDK.client.resource.ProcessInstance.prototype */ - { - - }, - - /** @lends CamSDK.client.resource.ProcessInstance */ - { - /** - * API path for the process instance resource - */ - path: 'process-instance', - - /** - * Retrieve a single process instance - * - * @param {uuid} id of the process instance to be requested - * @param {Function} done - */ - get: function(id, done) { - return this.http.get(this.path +'/'+ id, { - done: done - }); - }, - - - /** - * Creates a process instance from a process definition - * - * @param {Object} params - * @param {String} [params.id] - * @param {String} [params.key] - * @param {Object.} [params.variables] - * @param {requestCallback} [done] - */ - create: function(params, done) { - return this.http.post(params, done); - }, - - list: function(params, done) { - var path = this.path; - // those parameters have to be passed in the query and not body - path += '?firstResult='+ (params.firstResult || 0); - path += '&maxResults='+ (params.maxResults || 15); - return this.http.post(path, { - data: params, - done: done - }); - }, - - count: function(params, done) { - var path = this.path + '/count'; - - return this.http.post(path, { - data: params, - done: done - }); - }, - - /** - * Post process instance modifications - * @see http://docs.camunda.org/api-references/rest/#process-instance-modify-process-instance-execution-state-method - * - * @param {Object} params - * @param {UUID} params.id process instance UUID - * - * @param {Array} params.instructions Array of instructions - * - * @param {Boolean} [params.skipCustomListeners] Skip execution listener invocation for - * activities that are started or ended - * as part of this request. - * - * @param {Boolean} [params.skipIoMappings] Skip execution of input/output - * variable mappings for activities that - * are started or ended as part of - * this request. - * - * @param {requestCallback} done - */ - modify: function(params, done) { - return this.http.post(this.path + '/' + params.id + '/modification', { - data: { - instructions: params.instructions, - skipCustomListeners: params.skipCustomListeners, - skipIoMappings: params.skipIoMappings - }, - done: done - }); - }, +var ProcessInstance = AbstractClientResource.extend( +/** @lends CamSDK.client.resource.ProcessInstance.prototype */ +{}, +/** @lends CamSDK.client.resource.ProcessInstance */ +{ + /** + * API path for the process instance resource + */ + path: 'process-instance', - modifyAsync: function(params, done) { - return this.http.post(this.path + '/' + params.id + '/modification-async', { - data: { - instructions: params.instructions, - skipCustomListeners: params.skipCustomListeners, - skipIoMappings: params.skipIoMappings - }, - done: done - }); - }, + /** + * Retrieve a single process instance + * + * @param {uuid} id of the process instance to be requested + * @param {Function} done + */ + get: function get(id, done) { + return this.http.get(this.path + '/' + id, { + done: done + }); + }, - /** - * Delete multiple process instances asynchronously (batch). - * - * @see https://docs.camunda.org/manual/latest/reference/rest/process-instance/post-delete/ - * - * @param {Object} payload - * @param {requestCallback} done - * - */ - deleteAsync: function(payload, done) { - return this.http.post(this.path + '/delete', { - data: payload, - done: done - }); - }, + /** + * Creates a process instance from a process definition + * + * @param {Object} params + * @param {String} [params.id] + * @param {String} [params.key] + * @param {Object.} [params.variables] + * @param {requestCallback} [done] + */ + create: function create(params, done) { + return this.http.post(params, done); + }, + list: function list(params, done) { + var path = this.path; // those parameters have to be passed in the query and not body - /** - * Delete a set of process instances asynchronously (batch) based on a historic process instance query. - * - * @see https://docs.camunda.org/manual/latest/reference/rest/process-instance/post-delete-historic-query-based/ - * - * @param {Object} payload - * @param {requestCallback} done - * - */ - deleteAsyncHistoricQueryBased: function(payload, done) { - return this.http.post(this.path + '/delete-historic-query-based', { - data: payload, - done: done - }); - }, + path += '?firstResult=' + (params.firstResult || 0); + path += '&maxResults=' + (params.maxResults || 15); + return this.http.post(path, { + data: params, + done: done + }); + }, + count: function count(params, done) { + var path = this.path + '/count'; + return this.http.post(path, { + data: params, + done: done + }); + }, - /** - * Set retries of jobs belonging to process instances asynchronously (batch). - * - * @see https://docs.camunda.org/manual/latest/reference/rest/process-instance/post-set-job-retries - * - * @param {Object} payload - * @param {requestCallback} done - * - */ - setJobsRetriesAsync: function(payload, done) { - return this.http.post(this.path + '/job-retries', { - data: payload, - done: done - }); - }, + /** + * Post process instance modifications + * @see http://docs.camunda.org/api-references/rest/#process-instance-modify-process-instance-execution-state-method + * + * @param {Object} params + * @param {UUID} params.id process instance UUID + * + * @param {Array} params.instructions Array of instructions + * + * @param {Boolean} [params.skipCustomListeners] Skip execution listener invocation for + * activities that are started or ended + * as part of this request. + * + * @param {Boolean} [params.skipIoMappings] Skip execution of input/output + * variable mappings for activities that + * are started or ended as part of + * this request. + * + * @param {requestCallback} done + */ + modify: function modify(params, done) { + return this.http.post(this.path + '/' + params.id + '/modification', { + data: { + instructions: params.instructions, + skipCustomListeners: params.skipCustomListeners, + skipIoMappings: params.skipIoMappings + }, + done: done + }); + }, + modifyAsync: function modifyAsync(params, done) { + return this.http.post(this.path + '/' + params.id + '/modification-async', { + data: { + instructions: params.instructions, + skipCustomListeners: params.skipCustomListeners, + skipIoMappings: params.skipIoMappings + }, + done: done + }); + }, - /** - * Create a batch to set retries of jobs asynchronously based on a historic process instance query. - * - * @see https://docs.camunda.org/manual/latest/reference/rest/process-instance/post-set-job-retries-historic-query-based - * - * @param {Object} payload - * @param {requestCallback} done - * - */ - setJobsRetriesAsyncHistoricQueryBased: function(payload, done) { - return this.http.post(this.path + '/job-retries-historic-query-based', { - data: payload, - done: done - }); - }, + /** + * Delete multiple process instances asynchronously (batch). + * + * @see https://docs.camunda.org/manual/latest/reference/rest/process-instance/post-delete/ + * + * @param {Object} payload + * @param {requestCallback} done + * + */ + deleteAsync: function deleteAsync(payload, done) { + return this.http.post(this.path + '/delete', { + data: payload, + done: done + }); + }, - /** - * Activates or suspends process instances asynchronously with a list of process instance ids, a process instance query, and/or a historical process instance query - * - * @see https://docs.camunda.org/manual/latest/reference/rest/process-instance/post-activate-suspend-in-batch/ - * - * @param {Object} payload - * @param {requestCallback} done - */ - suspendAsync: function(payload, done) { - return this.http.post(this.path + '/suspended-async', { - data: payload, - done: done - }); - }, + /** + * Delete a set of process instances asynchronously (batch) based on a historic process instance query. + * + * @see https://docs.camunda.org/manual/latest/reference/rest/process-instance/post-delete-historic-query-based/ + * + * @param {Object} payload + * @param {requestCallback} done + * + */ + deleteAsyncHistoricQueryBased: function deleteAsyncHistoricQueryBased(payload, done) { + return this.http.post(this.path + '/delete-historic-query-based', { + data: payload, + done: done + }); + }, - /** - * Sets a variable of a given process instance by id. - * - * @see http://docs.camunda.org/manual/develop/reference/rest/process-instance/variables/put-variable/ - * - * @param {uuid} id - * @param {Object} params - * @param {requestCallback} done - */ - setVariable: function(id, params, done) { - var url = this.path + '/' + id + '/variables/' + utils.escapeUrl(params.name); - return this.http.put(url, { - data: params, - done: done - }); - } + /** + * Set retries of jobs belonging to process instances asynchronously (batch). + * + * @see https://docs.camunda.org/manual/latest/reference/rest/process-instance/post-set-job-retries + * + * @param {Object} payload + * @param {requestCallback} done + * + */ + setJobsRetriesAsync: function setJobsRetriesAsync(payload, done) { + return this.http.post(this.path + '/job-retries', { + data: payload, + done: done + }); + }, - }); + /** + * Create a batch to set retries of jobs asynchronously based on a historic process instance query. + * + * @see https://docs.camunda.org/manual/latest/reference/rest/process-instance/post-set-job-retries-historic-query-based + * + * @param {Object} payload + * @param {requestCallback} done + * + */ + setJobsRetriesAsyncHistoricQueryBased: function setJobsRetriesAsyncHistoricQueryBased(payload, done) { + return this.http.post(this.path + '/job-retries-historic-query-based', { + data: payload, + done: done + }); + }, + /** + * Activates or suspends process instances asynchronously with a list of process instance ids, a process instance query, and/or a historical process instance query + * + * @see https://docs.camunda.org/manual/latest/reference/rest/process-instance/post-activate-suspend-in-batch/ + * + * @param {Object} payload + * @param {requestCallback} done + */ + suspendAsync: function suspendAsync(payload, done) { + return this.http.post(this.path + '/suspended-async', { + data: payload, + done: done + }); + }, + /** + * Sets a variable of a given process instance by id. + * + * @see http://docs.camunda.org/manual/develop/reference/rest/process-instance/variables/put-variable/ + * + * @param {uuid} id + * @param {Object} params + * @param {requestCallback} done + */ + setVariable: function setVariable(id, params, done) { + var url = this.path + '/' + id + '/variables/' + utils.escapeUrl(params.name); + return this.http.put(url, { + data: params, + done: done + }); + } +}); module.exports = ProcessInstance; },{"../../utils":47,"./../abstract-client-resource":4}],31:[function(require,module,exports){ @@ -5499,37 +5399,35 @@ module.exports = ProcessInstance; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var AbstractClientResource = require('./../abstract-client-resource'); - /** * Task Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var TaskReport = AbstractClientResource.extend(); + +var TaskReport = AbstractClientResource.extend(); /** * Path used by the resource to perform HTTP queries * @type {String} */ -TaskReport.path = 'task/report'; - +TaskReport.path = 'task/report'; /** * Fetch the count of tasks grouped by candidate group. * * @param {Function} done */ -TaskReport.countByCandidateGroup = function(done) { + +TaskReport.countByCandidateGroup = function (done) { return this.http.get(this.path + '/candidate-group-count', { done: done }); }; - /** * Query for process instance durations report. * @param {Object} [params] @@ -5540,7 +5438,9 @@ TaskReport.countByCandidateGroup = function(done) { * @param {Object} [params.startedBefore] Date before which the process instance were started * @param {Function} done */ -TaskReport.countByCandidateGroupAsCsv = function(done) { + + +TaskReport.countByCandidateGroupAsCsv = function (done) { return this.http.get(this.path + '/candidate-group-count', { accept: 'text/csv', done: done @@ -5549,7 +5449,6 @@ TaskReport.countByCandidateGroupAsCsv = function(done) { module.exports = TaskReport; - },{"./../abstract-client-resource":4}],32:[function(require,module,exports){ /* * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH @@ -5567,34 +5466,34 @@ module.exports = TaskReport; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var Q = require('q'); + var AbstractClientResource = require('./../abstract-client-resource'); -var utils = require('../../utils'); +var utils = require('../../utils'); /** * No-Op callback */ -function noop() {} +function noop() {} /** * Task Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var Task = AbstractClientResource.extend(); + +var Task = AbstractClientResource.extend(); /** * Path used by the resource to perform HTTP queries * @type {String} */ -Task.path = 'task'; - +Task.path = 'task'; /** * Fetch a list of tasks * @param {Object} [params] @@ -5667,15 +5566,16 @@ Task.path = 'task'; * Will return less results, if there are no more results left. * @param {Function} done */ -Task.list = function(params, done) { - done = done || noop; - var deferred = Q.defer(); +Task.list = function (params, _done) { + _done = _done || noop; + var deferred = Q.defer(); this.http.get(this.path, { data: params, - done: function(err, data) { + done: function done(err, data) { if (err) { - done(err); + _done(err); + return deferred.reject(err); } @@ -5687,6 +5587,7 @@ Task.list = function(params, done) { for (var t in tasks) { var task = tasks[t]; task._embedded = task._embedded || {}; + for (var p in procDefs) { if (procDefs[p].id === task.processDefinitionId) { task._embedded.processDefinition = [procDefs[p]]; @@ -5696,48 +5597,49 @@ Task.list = function(params, done) { } } - done(null, data); + _done(null, data); + deferred.resolve(data); } }); - return deferred.promise; }; - - /** * Retrieve a single task * @param {uuid} taskId of the task to be requested * @param {Function} done */ -Task.get = function(taskId, done) { - return this.http.get(this.path +'/'+ taskId, { + + +Task.get = function (taskId, done) { + return this.http.get(this.path + '/' + taskId, { done: done }); }; - /** * Retrieve the comments for a single task * @param {uuid} taskId of the task for which the comments are requested * @param {Function} done */ -Task.comments = function(taskId, done) { - return this.http.get(this.path +'/'+ taskId + '/comment', { + + +Task.comments = function (taskId, done) { + return this.http.get(this.path + '/' + taskId + '/comment', { done: done }); }; - /** * Retrieve the identity links for a single task * @param {uuid} taskId of the task for which the identity links are requested * @param {Function} done */ -Task.identityLinks = function(taskId, done) { - return this.http.get(this.path +'/'+ taskId + '/identity-links', { + + +Task.identityLinks = function (taskId, done) { + return this.http.get(this.path + '/' + taskId + '/identity-links', { done: done }); }; - /** * Add an identity link to a task * @param {uuid} taskId of the task for which the identity link is created @@ -5747,18 +5649,20 @@ Task.identityLinks = function(taskId, done) { * @param {String} [params.type] Sets the type of the link. Must be provided * @param {Function} done */ -Task.identityLinksAdd = function(taskId, params, done) { + + +Task.identityLinksAdd = function (taskId, params, done) { if (arguments.length === 2) { done = arguments[1]; params = arguments[0]; taskId = params.id; } - return this.http.post(this.path +'/'+ taskId + '/identity-links', { + + return this.http.post(this.path + '/' + taskId + '/identity-links', { data: params, done: done }); }; - /** * Removes an identity link from a task. * @param {uuid} taskId The id of the task to remove a link from @@ -5768,19 +5672,20 @@ Task.identityLinksAdd = function(taskId, params, done) { * @param {String} [params.type] Specifies the type of the link. Must be provided. * @param {Function} done */ -Task.identityLinksDelete = function(taskId, params, done) { + + +Task.identityLinksDelete = function (taskId, params, done) { if (arguments.length === 2) { done = arguments[1]; params = arguments[0]; taskId = params.id; } - return this.http.post(this.path +'/'+ taskId + '/identity-links/delete', { + return this.http.post(this.path + '/' + taskId + '/identity-links/delete', { data: params, done: done }); }; - /** * Create a comment for a task. * @@ -5788,45 +5693,44 @@ Task.identityLinksDelete = function(taskId, params, done) { * @param {String} message The message of the task comment to create. * @param {Function} done */ -Task.createComment = function(taskId, message, done) { - return this.http.post(this.path +'/'+ taskId +'/comment/create', { + + +Task.createComment = function (taskId, message, done) { + return this.http.post(this.path + '/' + taskId + '/comment/create', { data: { message: message }, done: done }); }; - /** * Creates a task * * @param {Object} task is an object representation of a task * @param {Function} done */ -Task.create = function(task, done) { - return this.http.post(this.path +'/create', { + + +Task.create = function (task, done) { + return this.http.post(this.path + '/create', { data: task, done: done }); }; - - /** * Update a task * * @param {Object} task is an object representation of a task * @param {Function} done */ -Task.update = function(task, done) { - return this.http.put(this.path +'/'+ task.id, { + + +Task.update = function (task, done) { + return this.http.put(this.path + '/' + task.id, { data: task, done: done }); -}; - - - -// /** +}; // /** // * Save a task // * // * @see Task.create @@ -5852,7 +5756,9 @@ Task.update = function(task, done) { * @param {String} userId * @param {Function} done */ -Task.assignee = function(taskId, userId, done) { + + +Task.assignee = function (taskId, userId, done) { var data = { userId: userId }; @@ -5863,14 +5769,11 @@ Task.assignee = function(taskId, userId, done) { done = arguments[1]; } - return this.http.post(this.path +'/'+ taskId +'/assignee', { + return this.http.post(this.path + '/' + taskId + '/assignee', { data: data, done: done }); }; - - - /** * Delegate a task to another user. * @@ -5880,7 +5783,9 @@ Task.assignee = function(taskId, userId, done) { * @param {String} userId * @param {Function} done */ -Task.delegate = function(taskId, userId, done) { + + +Task.delegate = function (taskId, userId, done) { var data = { userId: userId }; @@ -5891,13 +5796,11 @@ Task.delegate = function(taskId, userId, done) { done = arguments[1]; } - return this.http.post(this.path +'/'+ taskId +'/delegate', { + return this.http.post(this.path + '/' + taskId + '/delegate', { data: data, done: done }); }; - - /** * Claim a task for a specific user. * @@ -5910,7 +5813,9 @@ Task.delegate = function(taskId, userId, done) { * @param {String} userId * @param {Function} done */ -Task.claim = function(taskId, userId, done) { + + +Task.claim = function (taskId, userId, done) { var data = { userId: userId }; @@ -5921,13 +5826,11 @@ Task.claim = function(taskId, userId, done) { done = arguments[1]; } - return this.http.post(this.path +'/'+ taskId +'/claim', { + return this.http.post(this.path + '/' + taskId + '/claim', { data: data, done: done }); }; - - /** * Resets a task's assignee. If successful, the task is not assigned to a user. * @@ -5936,17 +5839,17 @@ Task.claim = function(taskId, userId, done) { * @param {String} taskId * @param {Function} done */ -Task.unclaim = function(taskId, done) { + + +Task.unclaim = function (taskId, done) { if (typeof taskId !== 'string') { taskId = taskId.taskId; } - return this.http.post(this.path +'/'+ taskId +'/unclaim', { + return this.http.post(this.path + '/' + taskId + '/unclaim', { done: done }); }; - - /** * Complete a task and update process variables using a form submit. * There are two difference between this method and the complete method: @@ -5961,22 +5864,24 @@ Task.unclaim = function(taskId, done) { * @param {Object} data * @param {Function} done */ -Task.submitForm = function(data, done) { + + +Task.submitForm = function (data, done) { done = done || noop; + if (!data.id) { var err = new Error('Task submitForm needs a task id.'); done(err); return Q.reject(err); } - return this.http.post(this.path +'/'+ data.id +'/submit-form', { + return this.http.post(this.path + '/' + data.id + '/submit-form', { data: { variables: data.variables }, done: done }); }; - /** * Complete a task and update process variables. * @@ -5985,7 +5890,9 @@ Task.submitForm = function(data, done) { * @param {Object.} [params.variables] Process variables which need to be updated. * @param {Function} done */ -Task.complete = function(params, done) { + + +Task.complete = function (params, done) { done = done || noop; if (!params.id) { @@ -6002,16 +5909,15 @@ Task.complete = function(params, done) { }); }; -Task.formVariables = function(data, done) { +Task.formVariables = function (data, done) { done = done || noop; var pointer = ''; + if (data.key) { - pointer = 'key/'+ data.key; - } - else if (data.id) { + pointer = 'key/' + data.key; + } else if (data.id) { pointer = data.id; - } - else { + } else { var err = new Error('Task variables needs either a key or an id.'); done(err); return Q.reject(err); @@ -6021,27 +5927,27 @@ Task.formVariables = function(data, done) { deserializeValues: data.deserializeValues }; - if(data.names) { + if (data.names) { queryData.variableNames = data.names.join(','); } - return this.http.get(this.path +'/'+ pointer +'/form-variables', { + return this.http.get(this.path + '/' + pointer + '/form-variables', { data: queryData, done: done }); }; - /** * Retrieve the form for a single task * @param {uuid} taskId of the task for which the form is requested * @param {Function} done */ -Task.form = function(taskId, done) { - return this.http.get(this.path +'/'+ taskId + '/form', { + + +Task.form = function (taskId, done) { + return this.http.get(this.path + '/' + taskId + '/form', { done: done }); }; - /** * Sets a variable in the context of a given task. * @param {Object} [params] @@ -6052,50 +5958,53 @@ Task.form = function(taskId, done) { * @param {String} [params.valueInfo] A JSON object containing additional, value-type-dependent properties. * @param {Function} done */ -Task.localVariable = function(params, done) { - return this.http.put(this.path +'/'+ params.id + '/localVariables/' + params.varId, { + + +Task.localVariable = function (params, done) { + return this.http.put(this.path + '/' + params.id + '/localVariables/' + params.varId, { data: params, done: done }); }; - /** * Retrieve the local variables for a single task * @param {uuid} taskId of the task for which the variables are requested * @param {Function} done */ -Task.localVariables = function(taskId, done) { + + +Task.localVariables = function (taskId, done) { return this.http.get(this.path + '/' + taskId + '/localVariables', { done: done }); }; - /** * Updates or deletes the variables in the context of a task. * Updates precede deletions. * So, if a variable is updated AND deleted, the deletion overrides the update. */ -Task.modifyVariables = function(data, done) { + + +Task.modifyVariables = function (data, done) { return this.http.post(this.path + '/' + data.id + '/localVariables', { data: data, done: done }); }; - /** * Removes a local variable from a task. */ -Task.deleteVariable = function(data, done) { + + +Task.deleteVariable = function (data, done) { return this.http.del(this.path + '/' + data.id + '/localVariables/' + utils.escapeUrl(data.varId), { done: done }); }; - module.exports = Task; - -},{"../../utils":47,"./../abstract-client-resource":4,"q":53}],33:[function(require,module,exports){ +},{"../../utils":47,"./../abstract-client-resource":4,"q":63}],33:[function(require,module,exports){ /* * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH * under one or more contributor license agreements. See the NOTICE file @@ -6112,31 +6021,32 @@ module.exports = Task; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var AbstractClientResource = require('./../abstract-client-resource'); -var utils = require('../../utils'); +var utils = require('../../utils'); /** * No-Op callback */ -function noop() {} + +function noop() {} /** * Group Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var Tenant = AbstractClientResource.extend(); + +var Tenant = AbstractClientResource.extend(); /** * Path used by the resource to perform HTTP queries * @type {String} */ -Tenant.path = 'tenant'; +Tenant.path = 'tenant'; /** * Creates a tenant * @@ -6145,14 +6055,13 @@ Tenant.path = 'tenant'; * @param {String} tenant.name * @param {Function} done */ -Tenant.create = function(options, done) { - return this.http.post(this.path +'/create', { + +Tenant.create = function (options, done) { + return this.http.post(this.path + '/create', { data: options, done: done || noop }); }; - - /** * Query for tenants using a list of parameters and retrieves the count * @@ -6163,12 +6072,13 @@ Tenant.create = function(options, done) { * @param {String} [options.groupMember] Only retrieve tenants where the given group id is a member of. * @param {Function} done */ -Tenant.count = function(options, done) { + + +Tenant.count = function (options, done) { if (arguments.length === 1) { done = options; options = {}; - } - else { + } else { options = options || {}; } @@ -6177,15 +6087,15 @@ Tenant.count = function(options, done) { done: done || noop }); }; - - /** * Retrieves a single tenant * * @param {String} [options.id] The id of the tenant, can be a property (id) of an object * @param {Function} done */ -Tenant.get = function(options, done) { + + +Tenant.get = function (options, done) { var id; if (typeof options === 'string') { @@ -6201,8 +6111,6 @@ Tenant.get = function(options, done) { done: done || noop }); }; - - /** * Query for a list of tenants using a list of parameters. * The size of the result set can be retrieved by using the get tenants count method @@ -6226,7 +6134,9 @@ Tenant.get = function(options, done) { * * @param {Function} done */ -Tenant.list = function(options, done) { + + +Tenant.list = function (options, done) { if (arguments.length === 1) { done = options; options = {}; @@ -6239,8 +6149,6 @@ Tenant.list = function(options, done) { done: done || noop }); }; - - /** * Add a user member to a tenant * @@ -6248,13 +6156,14 @@ Tenant.list = function(options, done) { * @param {String} [options.userId] The id of user to add to the tenant * @param {Function} done */ -Tenant.createUserMember = function(options, done) { - return this.http.put(this.path +'/' + utils.escapeUrl(options.id) + '/user-members/' + utils.escapeUrl(options.userId), { + + +Tenant.createUserMember = function (options, done) { + return this.http.put(this.path + '/' + utils.escapeUrl(options.id) + '/user-members/' + utils.escapeUrl(options.userId), { data: options, done: done || noop }); }; - /** * Add a group member to a tenant * @@ -6262,13 +6171,14 @@ Tenant.createUserMember = function(options, done) { * @param {String} [options.groupId] The id of group to add to the tenant * @param {Function} done */ -Tenant.createGroupMember = function(options, done) { - return this.http.put(this.path +'/' + utils.escapeUrl(options.id) + '/group-members/' + utils.escapeUrl(options.groupId), { + + +Tenant.createGroupMember = function (options, done) { + return this.http.put(this.path + '/' + utils.escapeUrl(options.id) + '/group-members/' + utils.escapeUrl(options.groupId), { data: options, done: done || noop }); }; - /** * Removes a user member of a tenant * @@ -6276,13 +6186,14 @@ Tenant.createGroupMember = function(options, done) { * @param {String} [options.userId] The id of user to add to the tenant * @param {Function} done */ -Tenant.deleteUserMember = function(options, done) { - return this.http.del(this.path +'/' + utils.escapeUrl(options.id) + '/user-members/' + utils.escapeUrl(options.userId), { + + +Tenant.deleteUserMember = function (options, done) { + return this.http.del(this.path + '/' + utils.escapeUrl(options.id) + '/user-members/' + utils.escapeUrl(options.userId), { data: options, done: done || noop }); }; - /** * Removes a group member of a Tenant * @@ -6290,50 +6201,53 @@ Tenant.deleteUserMember = function(options, done) { * @param {String} [options.groupId] The id of group to add to the tenant * @param {Function} done */ -Tenant.deleteGroupMember = function(options, done) { - return this.http.del(this.path +'/' + utils.escapeUrl(options.id) + '/group-members/' + utils.escapeUrl(options.groupId), { + + +Tenant.deleteGroupMember = function (options, done) { + return this.http.del(this.path + '/' + utils.escapeUrl(options.id) + '/group-members/' + utils.escapeUrl(options.groupId), { data: options, done: done || noop }); }; - /** * Update a tenant * * @param {Object} tenant is an object representation of a tenant * @param {Function} done */ -Tenant.update = function(options, done) { - return this.http.put(this.path +'/' + utils.escapeUrl(options.id), { + + +Tenant.update = function (options, done) { + return this.http.put(this.path + '/' + utils.escapeUrl(options.id), { data: options, done: done || noop }); }; - - /** * Delete a tenant * * @param {Object} tenant is an object representation of a tenant * @param {Function} done */ -Tenant.delete = function(options, done) { - return this.http.del(this.path +'/' + utils.escapeUrl(options.id), { + + +Tenant["delete"] = function (options, done) { + return this.http.del(this.path + '/' + utils.escapeUrl(options.id), { data: options, done: done || noop }); }; -Tenant.options = function(options, done) { +Tenant.options = function (options, done) { var id; if (arguments.length === 1) { done = options; id = ''; - } else { id = typeof options === 'string' ? options : options.id; - if( id === undefined ) { + + if (id === undefined) { id = ''; } } @@ -6345,6 +6259,7 @@ Tenant.options = function(options, done) { } }); }; + module.exports = Tenant; },{"../../utils":47,"./../abstract-client-resource":4}],34:[function(require,module,exports){ @@ -6364,48 +6279,51 @@ module.exports = Tenant; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var Q = require('q'); + var AbstractClientResource = require('./../abstract-client-resource'); -var utils = require('../../utils'); +var utils = require('../../utils'); /** * No-Op callback */ -function noop() {} + +function noop() {} /** * User Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var User = AbstractClientResource.extend(); + +var User = AbstractClientResource.extend(); /** * Path used by the resource to perform HTTP queries * @type {String} */ -User.path = 'user'; +User.path = 'user'; /** * Check resource access * @param {Object} options * @param {String} options.id * @param {Function} done */ -User.options = function(options, done) { + +User.options = function (options, done) { var id; if (arguments.length === 1) { done = options; id = ''; - } else { id = typeof options === 'string' ? options : options.id; - if( id === undefined ) { + + if (id === undefined) { id = ''; } } @@ -6417,7 +6335,6 @@ User.options = function(options, done) { } }); }; - /** * Creates a user * @param {Object} options @@ -6428,18 +6345,16 @@ User.options = function(options, done) { * @param {String} [options.email] * @param {Function} done */ -User.create = function(options, done) { + + +User.create = function (options, done) { options = options || {}; done = done || noop; + var required = ['id', 'firstName', 'lastName', 'password']; - var required = [ - 'id', - 'firstName', - 'lastName', - 'password' - ]; for (var r in required) { var name = required[r]; + if (!options[name]) { var err = new Error('Missing ' + name + ' option to create user'); done(err); @@ -6462,13 +6377,11 @@ User.create = function(options, done) { data.profile.email = options.email; } - return this.http.post(this.path +'/create', { + return this.http.post(this.path + '/create', { data: data, done: done }); }; - - /** * List users * @param {Object} [options] @@ -6486,21 +6399,21 @@ User.create = function(options, done) { * @param {String} [options.maxResults] Pagination of results. Specifies the maximum number of results to return. Will return less results if there are no more results left. * @param {Function} done */ -User.list = function(options, done) { + + +User.list = function (options, done) { if (typeof options === 'function') { done = options; options = {}; - } - else { + } else { options = options || {}; } + return this.http.get(this.path, { data: options, done: done || noop }); }; - - /** * Count the amount of users * @param {String} [options.id] id of the user. @@ -6513,12 +6426,13 @@ User.list = function(options, done) { * @param {String} [options.memberOfGroup] users which are members of a group. * @param {Function} done */ -User.count = function(options, done) { + + +User.count = function (options, done) { if (arguments.length === 1) { done = options; options = {}; - } - else { + } else { options = options || {}; } @@ -6527,23 +6441,20 @@ User.count = function(options, done) { done: done || noop }); }; - - /** * Get the profile of a user * @param {Object|uuid} options * @param {uuid} options.id * @param {Function} done */ -User.profile = function(options, done) { - var id = typeof options === 'string' ? options : options.id; + +User.profile = function (options, done) { + var id = typeof options === 'string' ? options : options.id; return this.http.get(this.path + '/' + utils.escapeUrl(id) + '/profile', { done: done || noop }); }; - - /** * Updates the profile of a user * @param {Object} options @@ -6553,7 +6464,9 @@ User.profile = function(options, done) { * @param {String} [options.email] * @param {Function} done */ -User.updateProfile = function(options, done) { + + +User.updateProfile = function (options, done) { options = options || {}; done = done || noop; @@ -6568,9 +6481,6 @@ User.updateProfile = function(options, done) { done: done }); }; - - - /** * Update the credentials of a user * @param {Object} options @@ -6579,7 +6489,9 @@ User.updateProfile = function(options, done) { * @param {String} [options.authenticatedUserPassword] The password of the authenticated user who changes the password of the user (ie. the user with passed id as path parameter). * @param {Function} done */ -User.updateCredentials = function(options, done) { + + +User.updateCredentials = function (options, done) { options = options || {}; done = done || noop; var err; @@ -6609,32 +6521,30 @@ User.updateCredentials = function(options, done) { done: done }); }; - - /** * Delete a user * @param {Object|uuid} options You can either pass an object (with at least a id property) or the id of the user to be deleted * @param {uuid} options.id * @param {Function} done */ -User.delete = function(options, done) { - var id = typeof options === 'string' ? options : options.id; + +User["delete"] = function (options, done) { + var id = typeof options === 'string' ? options : options.id; return this.http.del(this.path + '/' + utils.escapeUrl(id), { done: done || noop }); }; - - /** * Unlock a user * @param {Object|uuid} options You can either pass an object (with at least a id property) or the id of the user to be unlocked * @param {uuid} options.id * @param {Function} done */ -User.unlock = function(options, done) { - var id = typeof options === 'string' ? options : options.id; + +User.unlock = function (options, done) { + var id = typeof options === 'string' ? options : options.id; return this.http.post(this.path + '/' + utils.escapeUrl(id) + '/unlock', { done: done || noop }); @@ -6642,7 +6552,7 @@ User.unlock = function(options, done) { module.exports = User; -},{"../../utils":47,"./../abstract-client-resource":4,"q":53}],35:[function(require,module,exports){ +},{"../../utils":47,"./../abstract-client-resource":4,"q":63}],35:[function(require,module,exports){ /* * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH * under one or more contributor license agreements. See the NOTICE file @@ -6659,28 +6569,24 @@ module.exports = User; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var AbstractClientResource = require('./../abstract-client-resource'); - - - /** * Variable Resource * @class * @memberof CamSDK.client.resource * @augments CamSDK.client.AbstractClientResource */ -var Variable = AbstractClientResource.extend(); + +var Variable = AbstractClientResource.extend(); /** * Path used by the resource to perform HTTP queries * @type {String} */ -Variable.path = 'variable-instance'; - +Variable.path = 'variable-instance'; /** * Get variable instances * @@ -6789,8 +6695,8 @@ Variable.path = 'variable-instance'; * * @param {RequestCallback} done */ -Variable.instances = function(params, done) { +Variable.instances = function (params, done) { var body = {}; var query = {}; var queryParams = ['firstResult', 'maxResults', 'deserializeValues']; @@ -6798,8 +6704,7 @@ Variable.instances = function(params, done) { for (var p in params) { if (queryParams.indexOf(p) > -1) { query[p] = params[p]; - } - else { + } else { body[p] = params[p]; } } @@ -6810,27 +6715,22 @@ Variable.instances = function(params, done) { done: done }); }; - /** * Get a count of variables * Same parameters as instances */ -Variable.count = function(params, done) { - var path = this.path + '/count'; +Variable.count = function (params, done) { + var path = this.path + '/count'; return this.http.post(path, { data: params, done: done }); }; - - - module.exports = Variable; - },{"./../abstract-client-resource":4}],36:[function(require,module,exports){ /* * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH @@ -6848,13 +6748,11 @@ module.exports = Variable; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var Events = require('./events'); function noop() {} - /** * Abstract class for classes * @@ -6871,13 +6769,11 @@ function noop() {} * @borrows CamSDK.Events.off as prototype.off * @borrows CamSDK.Events.trigger as prototype.trigger */ + + function BaseClass() { this.initialize(); } - - - - /** * Creates a new Resource Class, very much inspired from Backbone.Model.extend. * [Backbone helpers]{@link http://backbonejs.org/docs/backbone.html} @@ -6887,28 +6783,34 @@ function BaseClass() { * @param {Object.} [staticProps] * @return {CamSDK.BaseClass} */ -BaseClass.extend = function(protoProps, staticProps) { + + +BaseClass.extend = function (protoProps, staticProps) { protoProps = protoProps || {}; staticProps = staticProps || {}; - var parent = this; var child, Surrogate, s, i; if (protoProps && Object.hasOwnProperty.call(parent, 'constructor')) { child = protoProps.constructor; - } - else { - child = function() { return parent.apply(this, arguments); }; + } else { + child = function child() { + return parent.apply(this, arguments); + }; } for (s in parent) { child[s] = parent[s]; } + for (s in staticProps) { child[s] = staticProps[s]; } - Surrogate = function() { this.constructor = child; }; + Surrogate = function Surrogate() { + this.constructor = child; + }; + Surrogate.prototype = parent.prototype; child.prototype = new Surrogate(); @@ -6918,21 +6820,16 @@ BaseClass.extend = function(protoProps, staticProps) { return child; }; - - /** * Aimed to be overriden in order to initialize an instance. * * @memberof CamSDK.BaseClass.prototype * @method initialize */ -BaseClass.prototype.initialize = noop; +BaseClass.prototype.initialize = noop; Events.attach(BaseClass); - - - module.exports = BaseClass; },{"./events":37}],37:[function(require,module,exports){ @@ -6952,9 +6849,7 @@ module.exports = BaseClass; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; - /** * Events handling utility which can be used on * any kind of object to provide `on`, `once`, `off` @@ -6973,30 +6868,34 @@ module.exports = BaseClass; */ var Events = {}; - - /** * Converts an object into array * @param {*} obj * @return {Array} */ + function toArray(obj) { - var a, arr = []; + var a, + arr = []; + for (a in obj) { arr.push(obj[a]); } + return arr; } - /** * Returns a function that will be executed * at most one time, no matter how often you call it. * @param {Function} func * @return {Function} */ + + function once(func) { - var ran = false, memo; - return function() { + var ran = false, + memo; + return function () { if (ran) return memo; ran = true; memo = func.apply(this, arguments); @@ -7004,68 +6903,68 @@ function once(func) { return memo; }; } - - /** * Ensure an object to have the needed _events property * @param {*} obj * @param {String} name */ + + function ensureEvents(obj, name) { obj._events = obj._events || {}; obj._events[name] = obj._events[name] || []; } - - /** * Add the relevant Events methods to an object * @param {*} obj */ -Events.attach = function(obj) { - obj.on = this.on; - obj.once = this.once; - obj.off = this.off; + + +Events.attach = function (obj) { + obj.on = this.on; + obj.once = this.once; + obj.off = this.off; obj.trigger = this.trigger; obj._events = {}; }; - - /** * Bind a callback to `eventName` * @param {String} eventName * @param {Function} callback */ -Events.on = function(eventName, callback) { + + +Events.on = function (eventName, callback) { ensureEvents(this, eventName); this._events[eventName].push(callback); return this; }; - - /** * Bind a callback who will only be called once to `eventName` * @param {String} eventName * @param {Function} callback */ -Events.once = function(eventName, callback) { + + +Events.once = function (eventName, callback) { var self = this; - var cb = once(function() { + var cb = once(function () { self.off(eventName, once); callback.apply(this, arguments); }); cb._callback = callback; return this.on(eventName, cb); }; - - /** * Unbind one or all callbacks originally bound to `eventName` * @param {String} eventName * @param {Function} [callback] */ -Events.off = function(eventName, callback) { + + +Events.off = function (eventName, callback) { ensureEvents(this, eventName); if (!callback) { @@ -7073,29 +6972,31 @@ Events.off = function(eventName, callback) { return this; } - var e, arr = []; + var e, + arr = []; + for (e in this._events[eventName]) { if (this._events[eventName][e] !== callback) { arr.push(this._events[eventName][e]); } } - this._events[eventName] = arr; + this._events[eventName] = arr; return this; }; - - /** * Call the functions bound to `eventName` * @param {String} eventName * @param {...*} [params] */ -Events.trigger = function() { + + +Events.trigger = function () { var args = toArray(arguments); var eventName = args.shift(); ensureEvents(this, eventName); - var e; + for (e in this._events[eventName]) { this._events[eventName][e](this, args); } @@ -7103,7 +7004,6 @@ Events.trigger = function() { return this; }; - module.exports = Events; },{}],38:[function(require,module,exports){ @@ -7123,7 +7023,6 @@ module.exports = Events; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; /* global CamSDK, require, localStorage: false */ @@ -7150,15 +7049,13 @@ var constants = require('./constants'); var Events = require('./../events'); - function extend(dest, add) { for (var key in add) { dest[key] = add[key]; } + return dest; } - - /** * A class to help handling embedded forms * @@ -7175,239 +7072,216 @@ function extend(dest, add) { * @param {Object} [options.urlParams] * @param {String} [options.formUrl] */ + + function CamundaForm(options) { - if(!options) { + if (!options) { throw new Error('CamundaForm need to be initialized with options.'); } - var done = options.done = options.done || function(err) { if(err) throw err; }; + var done = options.done = options.done || function (err) { + if (err) throw err; + }; if (options.client) { this.client = options.client; - } - else { + } else { this.client = new CamSDK.Client(options.clientConfig || {}); } if (!options.taskId && !options.processDefinitionId && !options.processDefinitionKey) { - return done(new Error('Cannot initialize Taskform: either \'taskId\' or \'processDefinitionId\' or \'processDefinitionKey\' must be provided')); + return done(new Error("Cannot initialize Taskform: either 'taskId' or 'processDefinitionId' or 'processDefinitionKey' must be provided")); } this.taskId = options.taskId; - if(this.taskId) { + + if (this.taskId) { this.taskBasePath = this.client.baseUrl + '/task/' + this.taskId; } + this.processDefinitionId = options.processDefinitionId; this.processDefinitionKey = options.processDefinitionKey; - this.formElement = options.formElement; this.containerElement = options.containerElement; this.formUrl = options.formUrl; - if(!this.formElement && !this.containerElement) { - return done(new Error('CamundaForm needs to be initilized with either \'formElement\' or \'containerElement\'')); + if (!this.formElement && !this.containerElement) { + return done(new Error("CamundaForm needs to be initilized with either 'formElement' or 'containerElement'")); } - if(!this.formElement && !this.formUrl) { - return done(new Error('Camunda form needs to be intialized with either \'formElement\' or \'formUrl\'')); + if (!this.formElement && !this.formUrl) { + return done(new Error("Camunda form needs to be intialized with either 'formElement' or 'formUrl'")); } - /** * A VariableManager instance * @type {VariableManager} */ + + this.variableManager = new VariableManager({ client: this.client }); - /** * An array of FormFieldHandlers * @type {FormFieldHandlers[]} */ - this.formFieldHandlers = options.formFieldHandlers || [ - InputFieldHandler, - ChoicesFieldHandler, - FileDownloadHandler - ]; + this.formFieldHandlers = options.formFieldHandlers || [InputFieldHandler, ChoicesFieldHandler, FileDownloadHandler]; this.businessKey = null; - this.fields = []; - this.scripts = []; + this.options = options; // init event support - this.options = options; - - // init event support Events.attach(this); - this.initialize(done); } - /** * @memberof CamSDK.form.CamundaForm.prototype */ -CamundaForm.prototype.initializeHandler = function(FieldHandler) { + + +CamundaForm.prototype.initializeHandler = function (FieldHandler) { var self = this; var selector = FieldHandler.selector; - - $(selector, self.formElement).each(function() { + $(selector, self.formElement).each(function () { self.fields.push(new FieldHandler(this, self.variableManager)); }); }; - - - /** * @memberof CamSDK.form.CamundaForm.prototype */ -CamundaForm.prototype.initialize = function(done) { - done = done || function(err) { if(err) throw err; }; - var self = this; - // check whether form needs to be loaded first - if(this.formUrl) { +CamundaForm.prototype.initialize = function (_done) { + _done = _done || function (err) { + if (err) throw err; + }; + + var self = this; // check whether form needs to be loaded first + + if (this.formUrl) { this.client.http.load(this.formUrl, { accept: '*/*', - done: function(err, result) { - if(err) { - return done(err); + done: function done(err, result) { + if (err) { + return _done(err); } try { self.renderForm(result); - self.initializeForm(done); - + self.initializeForm(_done); } catch (error) { - done(error); + _done(error); } }, - data: extend({ noCache: Date.now() }, this.options.urlParams || {}) + data: extend({ + noCache: Date.now() + }, this.options.urlParams || {}) }); } else { - - try { - this.initializeForm(done); - + try { + this.initializeForm(_done); } catch (error) { - done(error); + _done(error); } } }; - - - /** * @memberof CamSDK.form.CamundaForm.prototype */ -CamundaForm.prototype.renderForm = function(formHtmlSource) { + +CamundaForm.prototype.renderForm = function (formHtmlSource) { // apppend the form html to the container element, // we also wrap the formHtmlSource to limit the risks of breaking // the structure of the document - $(this.containerElement) - .html('') - .append('
    '+formHtmlSource+'
    '); + $(this.containerElement).html('').append('
    ' + formHtmlSource + '
    '); // extract and validate form element - // extract and validate form element var formElement = this.formElement = $('form', this.containerElement); - if(formElement.length !== 1) { + + if (formElement.length !== 1) { throw new Error('Form must provide exaclty one element
    '); } - if(!formElement.attr('name')) { + + if (!formElement.attr('name')) { formElement.attr('name', '$$camForm'); } }; - - - /** * @memberof CamSDK.form.CamundaForm.prototype */ -CamundaForm.prototype.initializeForm = function(done) { - var self = this; - // handle form scripts - this.initializeFormScripts(); - // initialize field handlers - this.initializeFieldHandlers(); +CamundaForm.prototype.initializeForm = function (done) { + var self = this; // handle form scripts - // execute the scripts - this.executeFormScripts(); + this.initializeFormScripts(); // initialize field handlers - // fire form loaded - this.fireEvent('form-loaded'); + this.initializeFieldHandlers(); // execute the scripts + + this.executeFormScripts(); // fire form loaded - this.fetchVariables(function(err, result) { + this.fireEvent('form-loaded'); + this.fetchVariables(function (err, result) { if (err) { throw err; - } + } // merge the variables - // merge the variables - self.mergeVariables(result); - // retain original server values for dirty checking - self.storeOriginalValues(result); + self.mergeVariables(result); // retain original server values for dirty checking - // fire variables fetched - self.fireEvent('variables-fetched'); + self.storeOriginalValues(result); // fire variables fetched - // restore variables from local storage - self.restore(); + self.fireEvent('variables-fetched'); // restore variables from local storage - // fire variables-restored - self.fireEvent('variables-restored'); + self.restore(); // fire variables-restored - // apply the variables to the form fields - self.applyVariables(); + self.fireEvent('variables-restored'); // apply the variables to the form fields - // fire variables applied - self.fireEvent('variables-applied'); + self.applyVariables(); // fire variables applied + + self.fireEvent('variables-applied'); // invoke callback - // invoke callback done(null, self); }); }; -CamundaForm.prototype.initializeFieldHandlers = function() { - for(var FieldHandler in this.formFieldHandlers) { +CamundaForm.prototype.initializeFieldHandlers = function () { + for (var FieldHandler in this.formFieldHandlers) { this.initializeHandler(this.formFieldHandlers[FieldHandler]); } }; - /** * @memberof CamSDK.form.CamundaForm.prototype */ -CamundaForm.prototype.initializeFormScripts = function() { - var formScriptElements = $( 'script['+constants.DIRECTIVE_CAM_SCRIPT+']', this.formElement); - for(var i = 0; i 0) { - if(element.files[0].size > (parseInt(element.getAttribute('cam-max-filesize'),10) || 5000000)) { - throw new Error('Maximum file size of ' + bytesToSize(parseInt(element.getAttribute('cam-max-filesize'),10) || 5000000) + ' exceeded.'); + if (typeof FileReader === 'function' && element.files.length > 0) { + if (element.files[0].size > (parseInt(element.getAttribute('cam-max-filesize'), 10) || 5000000)) { + throw new Error('Maximum file size of ' + bytesToSize(parseInt(element.getAttribute('cam-max-filesize'), 10) || 5000000) + ' exceeded.'); } + var reader = new FileReader(); /* jshint ignore:start */ - reader.onloadend = (function(i, element, fileVar) { - return function(e) { + + reader.onloadend = function (i, element, fileVar) { + return function (e) { var binary = ''; - var bytes = new Uint8Array( e.target.result ); + var bytes = new Uint8Array(e.target.result); var len = bytes.byteLength; + for (var j = 0; j < len; j++) { - binary += String.fromCharCode( bytes[ j ] ); + binary += String.fromCharCode(bytes[j]); } - fileVar.value = btoa(binary); + fileVar.value = btoa(binary); // set file metadata as value info - // set file metadata as value info - if(fileVar.type.toLowerCase() === 'file') { + if (fileVar.type.toLowerCase() === 'file') { fileVar.valueInfo = { filename: element.files[0].name, mimeType: element.files[0].type @@ -7653,8 +7531,10 @@ CamundaForm.prototype.transformFiles = function(callback) { callCallback(); }; - })(i, element, fileVar); + }(i, element, fileVar); /* jshint ignore:end */ + + reader.readAsArrayBuffer(element.files[0]); counter++; } else { @@ -7667,63 +7547,59 @@ CamundaForm.prototype.transformFiles = function(callback) { } callCallback(); - }; - /** * @memberof CamSDK.form.CamundaForm.prototype */ -CamundaForm.prototype.fetchVariables = function(done) { - done = done || function() {}; + + +CamundaForm.prototype.fetchVariables = function (done) { + done = done || function () {}; + var names = this.variableManager.variableNames(); - if (names.length) { + if (names.length) { var data = { names: names, deserializeValues: false - }; + }; // pass either the taskId, processDefinitionId or processDefinitionKey - // pass either the taskId, processDefinitionId or processDefinitionKey if (this.taskId) { data.id = this.taskId; this.client.resource('task').formVariables(data, done); - } - else { + } else { data.id = this.processDefinitionId; data.key = this.processDefinitionKey; this.client.resource('process-definition').formVariables(data, done); } - } - else { + } else { done(); } }; - - - /** * @memberof CamSDK.form.CamundaForm.prototype */ -CamundaForm.prototype.submitVariables = function(done) { - done = done || function() {}; + + +CamundaForm.prototype.submitVariables = function (done) { + done = done || function () {}; var varManager = this.variableManager; var vars = varManager.variables; - var variableData = {}; - for(var v in vars) { + + for (var v in vars) { // only submit dirty variables // LIMITATION: dirty checking is not performed for complex object variables - if(varManager.isDirty(v)) { - var val = vars[v].value; - // if variable is JSON, serialize + if (varManager.isDirty(v)) { + var val = vars[v].value; // if variable is JSON, serialize - if(varManager.isJsonVariable(v)) { + if (varManager.isJsonVariable(v)) { val = JSON.stringify(val); - } + } // if variable is Date, add timezone info - // if variable is Date, add timezone info - if(val && varManager.isDateVariable(v)) { + + if (val && varManager.isDateVariable(v)) { val = moment(val, moment.ISO_8601).format('YYYY-MM-DDTHH:mm:ss.SSSZZ'); } @@ -7735,38 +7611,41 @@ CamundaForm.prototype.submitVariables = function(done) { } } - var data = { variables: variableData }; + var data = { + variables: variableData + }; // pass either the taskId, processDefinitionId or processDefinitionKey - // pass either the taskId, processDefinitionId or processDefinitionKey if (this.taskId) { data.id = this.taskId; this.client.resource('task').submitForm(data, done); - } - else { + } else { var businessKey = this.businessKey || this.formElement.find('input[type="text"][cam-business-key]').val(); + if (businessKey) { data.businessKey = businessKey; } + data.id = this.processDefinitionId; data.key = this.processDefinitionKey; this.client.resource('process-definition').submitForm(data, done); } }; - /** * @memberof CamSDK.form.CamundaForm.prototype */ -CamundaForm.prototype.storeOriginalValues = function(variables) { - for(var v in variables) { + + +CamundaForm.prototype.storeOriginalValues = function (variables) { + for (var v in variables) { this.variableManager.setOriginalValue(v, variables[v].value); } }; - /** * @memberof CamSDK.form.CamundaForm.prototype */ -CamundaForm.prototype.mergeVariables = function(variables) { + +CamundaForm.prototype.mergeVariables = function (variables) { var vars = this.variableManager.variables; for (var v in variables) { @@ -7774,94 +7653,93 @@ CamundaForm.prototype.mergeVariables = function(variables) { for (var p in variables[v]) { vars[v][p] = vars[v][p] || variables[v][p]; } - } - else { + } else { vars[v] = variables[v]; - } - // check whether the variable provides JSON payload. If true, deserialize - if(this.variableManager.isJsonVariable(v)) { + } // check whether the variable provides JSON payload. If true, deserialize + + + if (this.variableManager.isJsonVariable(v)) { vars[v].value = JSON.parse(variables[v].value); - } + } // generate content url for file and bytes variables + - // generate content url for file and bytes variables var type = vars[v].type; - if(!!this.taskBasePath && (type === 'Bytes' || type === 'File')) { - vars[v].contentUrl = this.taskBasePath + '/variables/'+ vars[v].name + '/data'; + + if (!!this.taskBasePath && (type === 'Bytes' || type === 'File')) { + vars[v].contentUrl = this.taskBasePath + '/variables/' + vars[v].name + '/data'; } this.variableManager.isVariablesFetched = true; } }; - - - /** * @memberof CamSDK.form.CamundaForm.prototype */ -CamundaForm.prototype.applyVariables = function() { + +CamundaForm.prototype.applyVariables = function () { for (var i in this.fields) { this.fields[i].applyValue(); } - }; - - - /** * @memberof CamSDK.form.CamundaForm.prototype */ -CamundaForm.prototype.retrieveVariables = function() { + + +CamundaForm.prototype.retrieveVariables = function () { for (var i in this.fields) { this.fields[i].getValue(); } }; - /** * @memberof CamSDK.form.CamundaForm.prototype */ -CamundaForm.prototype.fireEvent = function(eventName, obj) { + + +CamundaForm.prototype.fireEvent = function (eventName, obj) { this.trigger(eventName, obj); }; - /** * @memberof CamSDK.form.CamundaForm */ -CamundaForm.$ = $; + +CamundaForm.$ = $; CamundaForm.VariableManager = VariableManager; CamundaForm.fields = {}; CamundaForm.fields.InputFieldHandler = InputFieldHandler; CamundaForm.fields.ChoicesFieldHandler = ChoicesFieldHandler; - /** * @memberof CamSDK.form.CamundaForm */ -CamundaForm.cleanLocalStorage = function(timestamp) { + +CamundaForm.cleanLocalStorage = function (timestamp) { for (var i = 0; i < localStorage.length; i++) { var key = localStorage.key(i); - if(key.indexOf('camForm:') === 0) { + + if (key.indexOf('camForm:') === 0) { var item = JSON.parse(localStorage.getItem(key)); - if(item.date < timestamp) { + + if (item.date < timestamp) { localStorage.removeItem(key); i--; } } } }; - - /** * @memberof CamSDK.form.CamundaForm * @borrows CamSDK.BaseClass.extend as extend * @name extend * @type {Function} */ -CamundaForm.extend = BaseClass.extend; + +CamundaForm.extend = BaseClass.extend; module.exports = CamundaForm; -},{"./../base-class":36,"./../events":37,"./constants":39,"./controls/choices-field-handler":41,"./controls/file-download-handler":42,"./controls/input-field-handler":43,"./dom-lib":44,"./variable-manager":46,"moment":51}],39:[function(require,module,exports){ +},{"./../base-class":36,"./../events":37,"./constants":39,"./controls/choices-field-handler":41,"./controls/file-download-handler":42,"./controls/input-field-handler":43,"./dom-lib":44,"./variable-manager":46,"moment":61}],39:[function(require,module,exports){ /* * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH * under one or more contributor license agreements. See the NOTICE file @@ -7878,16 +7756,15 @@ module.exports = CamundaForm; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; module.exports = { - DIRECTIVE_CAM_FORM : 'cam-form', - DIRECTIVE_CAM_VARIABLE_NAME : 'cam-variable-name', - DIRECTIVE_CAM_VARIABLE_TYPE : 'cam-variable-type', - DIRECTIVE_CAM_FILE_DOWNLOAD : 'cam-file-download', - DIRECTIVE_CAM_CHOICES : 'cam-choices', - DIRECTIVE_CAM_SCRIPT : 'cam-script' + DIRECTIVE_CAM_FORM: 'cam-form', + DIRECTIVE_CAM_VARIABLE_NAME: 'cam-variable-name', + DIRECTIVE_CAM_VARIABLE_TYPE: 'cam-variable-type', + DIRECTIVE_CAM_FILE_DOWNLOAD: 'cam-file-download', + DIRECTIVE_CAM_CHOICES: 'cam-choices', + DIRECTIVE_CAM_SCRIPT: 'cam-script' }; },{}],40:[function(require,module,exports){ @@ -7907,14 +7784,13 @@ module.exports = { * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var BaseClass = require('../../base-class'); + var $ = require('./../dom-lib'); function noop() {} - /** * An abstract class for the form field controls * @@ -7923,41 +7799,38 @@ function noop() {} * @memberof CamSDK.form * */ + + function AbstractFormField(element, variableManager) { - this.element = $( element ); + this.element = $(element); this.variableManager = variableManager; - this.variableName = null; - this.initialize(); } - /** * @memberof CamSDK.form.AbstractFormField * @abstract * @name selector * @type {String} */ -AbstractFormField.selector = null; +AbstractFormField.selector = null; /** * @memberof CamSDK.form.AbstractFormField * @borrows CamSDK.BaseClass.extend as extend * @name extend * @type {Function} */ -AbstractFormField.extend = BaseClass.extend; - +AbstractFormField.extend = BaseClass.extend; /** * @memberof CamSDK.form.AbstractFormField.prototype * @abstract * @method initialize */ -AbstractFormField.prototype.initialize = noop; - +AbstractFormField.prototype.initialize = noop; /** * Applies the stored value to a field element. * @@ -7967,19 +7840,17 @@ AbstractFormField.prototype.initialize = noop; * * @return {CamSDK.form.AbstractFormField} Chainable method */ -AbstractFormField.prototype.applyValue = noop; - +AbstractFormField.prototype.applyValue = noop; /** * @memberof CamSDK.form.AbstractFormField.prototype * @abstract * @method getValue */ -AbstractFormField.prototype.getValue = noop; +AbstractFormField.prototype.getValue = noop; module.exports = AbstractFormField; - },{"../../base-class":36,"./../dom-lib":44}],41:[function(require,module,exports){ /* * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH @@ -7997,140 +7868,130 @@ module.exports = AbstractFormField; * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; var constants = require('./../constants'), AbstractFormField = require('./abstract-form-field'), $ = require('./../dom-lib'); - - /** * A field control handler for choices * @class * @memberof CamSDK.form * @augments {CamSDK.form.AbstractFormField} */ + + var ChoicesFieldHandler = AbstractFormField.extend( - /** @lends CamSDK.form.ChoicesFieldHandler.prototype */ - { - /** - * Prepares an instance - */ - initialize: function() { - // read variable definitions from markup - var variableName = this.variableName = this.element.attr(constants.DIRECTIVE_CAM_VARIABLE_NAME); - var variableType = this.variableType = this.element.attr(constants.DIRECTIVE_CAM_VARIABLE_TYPE); - var choicesVariableName = this.choicesVariableName = this.element.attr(constants.DIRECTIVE_CAM_CHOICES); - - // crate variable - this.variableManager.createVariable({ - name: variableName, - type: variableType, - value: this.element.val() || null - }); +/** @lends CamSDK.form.ChoicesFieldHandler.prototype */ +{ + /** + * Prepares an instance + */ + initialize: function initialize() { + // read variable definitions from markup + var variableName = this.variableName = this.element.attr(constants.DIRECTIVE_CAM_VARIABLE_NAME); + var variableType = this.variableType = this.element.attr(constants.DIRECTIVE_CAM_VARIABLE_TYPE); + var choicesVariableName = this.choicesVariableName = this.element.attr(constants.DIRECTIVE_CAM_CHOICES); // crate variable - // fetch choices variable - if(choicesVariableName) { - this.variableManager.fetchVariable(choicesVariableName); - } + this.variableManager.createVariable({ + name: variableName, + type: variableType, + value: this.element.val() || null + }); // fetch choices variable - // remember the original value found in the element for later checks - this.originalValue = this.element.val() || null; + if (choicesVariableName) { + this.variableManager.fetchVariable(choicesVariableName); + } // remember the original value found in the element for later checks - this.previousValue = this.originalValue; - // remember variable name - this.variableName = variableName; - }, + this.originalValue = this.element.val() || null; + this.previousValue = this.originalValue; // remember variable name - /** - * Applies the stored value to a field element. - * - * @return {CamSDK.form.ChoicesFieldHandler} Chainable method. - */ - applyValue: function() { - - var selectedIndex = this.element[0].selectedIndex; - // if cam-choices variable is defined, apply options - if(this.choicesVariableName) { - var choicesVariableValue = this.variableManager.variableValue(this.choicesVariableName); - if(choicesVariableValue) { - // array - if (choicesVariableValue instanceof Array) { - for(var i = 0; i < choicesVariableValue.length; i++) { - var val = choicesVariableValue[i]; - if(!this.element.find('option[text="'+val+'"]').length) { - this.element.append($('