├── plugin-module ├── modeler-plugin-code │ ├── .eslintignore │ ├── .npmignore │ ├── .babelrc │ ├── docs │ │ └── screencast.gif │ ├── test │ │ ├── .eslintrc │ │ ├── suite.js │ │ ├── all.js │ │ └── TestHelper.js │ ├── index.js │ ├── index.prod.js │ ├── .eslintrc │ ├── client │ │ ├── bpmn-js-extension │ │ │ ├── propertiesProvider │ │ │ │ ├── utils.js │ │ │ │ ├── descriptors │ │ │ │ │ └── data.json │ │ │ │ ├── props │ │ │ │ │ ├── ScriptProps.js │ │ │ │ │ └── ConditionalProps.js │ │ │ │ └── CodePropertiesProvider.js │ │ │ ├── index.js │ │ │ ├── executor │ │ │ │ └── EventBasedExecutor.js │ │ │ └── disableModeling │ │ │ │ └── DisableModeling.js │ │ ├── index.js │ │ ├── react │ │ │ ├── Code │ │ │ │ ├── RunPanel.js │ │ │ │ ├── CodeFragment.js │ │ │ │ ├── ContextTable.js │ │ │ │ ├── groovy-hint.js │ │ │ │ └── CodeEditor.js │ │ │ └── UI │ │ │ │ ├── EditorModal.js │ │ │ │ └── Input.js │ │ ├── assets │ │ │ └── NOTICE │ │ └── utils │ │ │ ├── editorConsole.js │ │ │ ├── EventHelper.js │ │ │ ├── executors │ │ │ ├── GroovyAPI.js │ │ │ └── JSExecutor.js │ │ │ └── fieldUtil.js │ ├── backend │ │ ├── NOTICE │ │ ├── groovy.js │ │ └── main.js │ ├── LICENSE │ ├── karma.conf.js │ ├── package.json │ ├── README.md │ ├── webpack.config.js │ ├── style │ │ └── style.css │ └── CodeMirror6.patch └── pom.xml ├── language-executor ├── src │ ├── main │ │ ├── resources │ │ │ ├── messages.properties │ │ │ ├── application.properties │ │ │ └── SandboxExtension.groovy │ │ └── java │ │ │ └── org │ │ │ └── shared │ │ │ └── code │ │ │ └── languageexecutor │ │ │ ├── exception │ │ │ ├── XmlParseException.java │ │ │ ├── JsonParseException.java │ │ │ └── VariableParserException.java │ │ │ ├── LanguageExecutorApplication.java │ │ │ ├── parser │ │ │ ├── PrimitiveParser.java │ │ │ ├── VariableParser.java │ │ │ ├── XmlParser.java │ │ │ └── JsonParser.java │ │ │ ├── dto │ │ │ ├── ContextType.java │ │ │ ├── Context.java │ │ │ ├── CodeInput.java │ │ │ └── ResultOutput.java │ │ │ ├── service │ │ │ ├── VariableParserService.java │ │ │ ├── ClassNodeParserService.java │ │ │ ├── ContextValueParserService.java │ │ │ └── GroovyExecutorService.java │ │ │ ├── rest │ │ │ ├── CodeControllerExceptionHandler.java │ │ │ └── CodeController.java │ │ │ └── configuration │ │ │ └── ApplicationConfiguration.java │ └── test │ │ ├── resources │ │ └── scripts │ │ │ ├── auctionData.json │ │ │ ├── simpleReturn.groovy │ │ │ ├── offersJson.json │ │ │ ├── MaxAcceptablePrice.groovy │ │ │ └── MaxAcceptablePriceTypes.groovy │ │ └── java │ │ └── org │ │ └── shared │ │ └── code │ │ └── languageexecutor │ │ ├── configuration │ │ └── TestConfiguration.java │ │ ├── service │ │ └── GroovyExecutorServiceTest.java │ │ └── rest │ │ └── CodeControllerTest.java ├── README.md ├── pom.xml ├── mvnw.cmd └── mvnw ├── .gitattributes ├── .gitignore ├── .github ├── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md └── workflows │ └── maven.yml ├── LICENSE ├── CHANGELOG.md ├── README.md └── pom.xml /plugin-module/modeler-plugin-code/.eslintignore: -------------------------------------------------------------------------------- 1 | dist -------------------------------------------------------------------------------- /plugin-module/modeler-plugin-code/.npmignore: -------------------------------------------------------------------------------- 1 | !dist 2 | client 3 | webpack.config.js -------------------------------------------------------------------------------- /language-executor/src/main/resources/messages.properties: -------------------------------------------------------------------------------- 1 | error.message.unexpected=Unexpected error while calling {0} -------------------------------------------------------------------------------- /plugin-module/modeler-plugin-code/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | "@babel/plugin-proposal-class-properties" 4 | ] 5 | } -------------------------------------------------------------------------------- /plugin-module/modeler-plugin-code/docs/screencast.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharedchains/camunda-code-editor/HEAD/plugin-module/modeler-plugin-code/docs/screencast.gif -------------------------------------------------------------------------------- /plugin-module/modeler-plugin-code/test/.eslintrc: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014-present Camunda Services GmbH 4 | * SPDX-License-Identifier: MIT 5 | */ 6 | { 7 | "extends": "plugin:bpmn-io/mocha" 8 | } -------------------------------------------------------------------------------- /plugin-module/modeler-plugin-code/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | name: 'Code Script Editor', 5 | script: './dist/client.js', 6 | style: './dist/assets/styles/style.css', 7 | menu: './dist/backend/main.js' 8 | }; 9 | -------------------------------------------------------------------------------- /plugin-module/modeler-plugin-code/index.prod.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | name: 'Code Script Editor', 5 | script: './client/client.js', 6 | style: './assets/styles/style.css', 7 | menu: './backend/main.js' 8 | }; 9 | -------------------------------------------------------------------------------- /plugin-module/modeler-plugin-code/test/suite.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014-present Camunda Services GmbH 4 | * SPDX-License-Identifier: MIT 5 | */ 6 | var allTests = require.context('.', true, /Spec\.js$/); 7 | 8 | allTests.keys().forEach(allTests); -------------------------------------------------------------------------------- /plugin-module/modeler-plugin-code/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "eslint:recommended", 4 | "plugin:react/recommended", 5 | "plugin:bpmn-io/es6", 6 | "plugin:bpmn-io/mocha" 7 | ], 8 | "rules": { 9 | "react/prop-types": 0 10 | }, 11 | "env": { 12 | "browser": true, 13 | "es6": true 14 | } 15 | } -------------------------------------------------------------------------------- /language-executor/src/test/resources/scripts/auctionData.json: -------------------------------------------------------------------------------- 1 | { 2 | "offeredBonds": 7000, 3 | "startString": "2019-10-29 18:21:00", 4 | "endString": "2019-10-29 18:21:10", 5 | "auctionType": "competitive", 6 | "bondsDuration": "360days", 7 | "discountMAP": 0.0025, 8 | "increaseExclusion": 0.0100, 9 | "discountAcceptedPrice": 0.001 10 | } -------------------------------------------------------------------------------- /language-executor/src/test/resources/scripts/simpleReturn.groovy: -------------------------------------------------------------------------------- 1 | //file:noinspection 2 | import org.camunda.spin.json.SpinJsonNode 3 | import static org.camunda.spin.Spin.JSON 4 | import static org.camunda.spin.Spin.* 5 | 6 | static void main (String[] args) { 7 | def offeredBonds = auctionData.prop("offeredBonds").numberValue() 8 | return offeredBonds 9 | } 10 | -------------------------------------------------------------------------------- /plugin-module/modeler-plugin-code/test/all.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright 2014-present Camunda Services GmbH 4 | * SPDX-License-Identifier: MIT 5 | */ 6 | var allTests = require.context('.', true, /Spec\.js$/); 7 | 8 | allTests.keys().forEach(allTests); 9 | 10 | var allSources = require.context('../lib', true, /.*\.js$/); 11 | 12 | allSources.keys().forEach(allSources); -------------------------------------------------------------------------------- /language-executor/src/main/java/org/shared/code/languageexecutor/exception/XmlParseException.java: -------------------------------------------------------------------------------- 1 | package org.shared.code.languageexecutor.exception; 2 | 3 | /** 4 | * The type Xml parse exception. 5 | */ 6 | public class XmlParseException extends RuntimeException { 7 | 8 | /** 9 | * Instantiates a new Xml parse exception. 10 | */ 11 | public XmlParseException() { 12 | super(); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /language-executor/src/main/java/org/shared/code/languageexecutor/exception/JsonParseException.java: -------------------------------------------------------------------------------- 1 | package org.shared.code.languageexecutor.exception; 2 | 3 | /** 4 | * The type Json parse exception. 5 | */ 6 | public class JsonParseException extends RuntimeException { 7 | 8 | /** 9 | * Instantiates a new Json parse exception. 10 | */ 11 | public JsonParseException() { 12 | super(); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /plugin-module/modeler-plugin-code/client/bpmn-js-extension/propertiesProvider/utils.js: -------------------------------------------------------------------------------- 1 | import { getBusinessObject, is } from 'bpmn-js/lib/util/ModelUtil'; 2 | 3 | export const getCorrectBusinessObject = function(element, isProcessDocumentation) { 4 | let businessObject = getBusinessObject(element); 5 | if (is(element, 'bpmn:Participant') && isProcessDocumentation) { 6 | businessObject = businessObject.processRef; 7 | } 8 | return businessObject; 9 | }; -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Default LF unix as eof 2 | * text eol=lf 3 | 4 | # Use LF Unix compliant as eof 5 | *.sh text eol=lf 6 | *.java text eol=lf 7 | 8 | # Use CRLF for windows file 9 | *.bat text eol=crlf 10 | *.cmd text eol=crlf 11 | 12 | # Binary files 13 | *.gif binary 14 | *.png binary 15 | *.jpg binary 16 | *.jpeg binary 17 | *.ico binary 18 | *.so binary 19 | *.dll binary 20 | *.eot binary 21 | *.ttf binary 22 | *.otf binary 23 | *.svg binary 24 | *.woff binary 25 | *.woff2 binary 26 | -------------------------------------------------------------------------------- /language-executor/src/main/java/org/shared/code/languageexecutor/LanguageExecutorApplication.java: -------------------------------------------------------------------------------- 1 | package org.shared.code.languageexecutor; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class LanguageExecutorApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(LanguageExecutorApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /plugin-module/modeler-plugin-code/client/index.js: -------------------------------------------------------------------------------- 1 | import { 2 | registerBpmnJSModdleExtension, 3 | registerBpmnJSPlugin, registerClientExtension 4 | } from 'camunda-modeler-plugin-helpers'; 5 | 6 | import BpmnExtensionModule from './bpmn-js-extension'; 7 | import CodeFragment from './react/Code/CodeFragment'; 8 | 9 | import dataModdle from './bpmn-js-extension/propertiesProvider/descriptors/data.json'; 10 | 11 | registerBpmnJSPlugin(BpmnExtensionModule); 12 | registerBpmnJSModdleExtension(dataModdle); 13 | 14 | registerClientExtension(CodeFragment); 15 | -------------------------------------------------------------------------------- /plugin-module/modeler-plugin-code/client/react/Code/RunPanel.js: -------------------------------------------------------------------------------- 1 | import React from 'camunda-modeler-plugin-helpers/react'; 2 | 3 | /** 4 | * Functional component for the run/stop buttons section 5 | * @param props 6 | * @returns {JSX.Element} 7 | * @constructor 8 | */ 9 | const RunPanel = props => { 10 | 11 | return (
' + escape(parsed) + '
'; 18 | if (empty) { 19 | container.innerHTML = ''; 20 | empty = false; 21 | } 22 | container.appendChild(node); 23 | }; 24 | 25 | return { 26 | clearConsole: function clearConsole(hintValue = '') { 27 | empty = true; 28 | container.innerHTML = hintValue; 29 | }, 30 | addToConsole: add 31 | }; 32 | } -------------------------------------------------------------------------------- /language-executor/src/main/java/org/shared/code/languageexecutor/parser/JsonParser.java: -------------------------------------------------------------------------------- 1 | package org.shared.code.languageexecutor.parser; 2 | 3 | import org.camunda.bpm.engine.variable.value.TypedValue; 4 | import org.camunda.spin.Spin; 5 | import org.camunda.spin.json.SpinJsonNode; 6 | import org.camunda.spin.plugin.variable.value.JsonValue; 7 | import org.springframework.stereotype.Component; 8 | 9 | /** 10 | * The type Json parser. 11 | */ 12 | @Component 13 | public class JsonParser implements VariableParser { 14 | 15 | @Override 16 | public boolean supportsTypedValue(TypedValue typedValue) { 17 | return (typedValue instanceof JsonValue) || typedValue instanceof org.camunda.bpm.client.variable.value.JsonValue; 18 | } 19 | 20 | @Override 21 | public SpinJsonNode parse(TypedValue variable) { 22 | return Spin.JSON(variable.getValue()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /language-executor/src/main/java/org/shared/code/languageexecutor/exception/VariableParserException.java: -------------------------------------------------------------------------------- 1 | package org.shared.code.languageexecutor.exception; 2 | 3 | import org.camunda.bpm.engine.variable.value.TypedValue; 4 | 5 | /** 6 | * The type Variable parser exception. 7 | */ 8 | public class VariableParserException extends RuntimeException { 9 | 10 | private final TypedValue variable; 11 | 12 | /** 13 | * Instantiates a new Variable parser exception. 14 | * 15 | * @param variable the variable that thrown an exception 16 | * @param message the message thrown 17 | */ 18 | public VariableParserException(TypedValue variable, String message) { 19 | super(message); 20 | this.variable = variable; 21 | } 22 | 23 | /** 24 | * Gets variable. 25 | * 26 | * @return the variable 27 | */ 28 | public TypedValue getVariable() { 29 | return variable; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /language-executor/src/main/java/org/shared/code/languageexecutor/dto/ContextType.java: -------------------------------------------------------------------------------- 1 | package org.shared.code.languageexecutor.dto; 2 | 3 | /** 4 | * The enum Context type. 5 | */ 6 | public enum ContextType { 7 | /** 8 | * Boolean context type. 9 | */ 10 | BOOLEAN, 11 | /** 12 | * Bytes context type. 13 | */ 14 | BYTES, 15 | /** 16 | * String context type. 17 | */ 18 | STRING, 19 | /** 20 | * Short context type. 21 | */ 22 | SHORT, 23 | /** 24 | * Double context type. 25 | */ 26 | DOUBLE, 27 | /** 28 | * Integer context type. 29 | */ 30 | INTEGER, 31 | /** 32 | * Long context type. 33 | */ 34 | LONG, 35 | /** 36 | * Date context type. 37 | */ 38 | DATE, 39 | /** 40 | * Datetime context type. 41 | */ 42 | DATETIME, 43 | /** 44 | * Json context type. 45 | */ 46 | JSON, 47 | /** 48 | * Xml context type. 49 | */ 50 | XML 51 | } 52 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /language-executor/src/test/resources/scripts/offersJson.json: -------------------------------------------------------------------------------- 1 | { 2 | "requestsArray": [ 3 | { "operator" : "A", "requestNum": 1, "bondsNum": 750, "price": 96.15 }, 4 | { "operator" : "B", "requestNum": 1, "bondsNum": 1500, "price": 95.90 }, 5 | { "operator" : "D", "requestNum": 1, "bondsNum": 1000, "price": 95.90 }, 6 | { "operator" : "B", "requestNum": 2, "bondsNum": 1100, "price": 95.88 }, 7 | { "operator" : "C", "requestNum": 1, "bondsNum": 1000, "price": 95.85 }, 8 | { "operator" : "D", "requestNum": 2, "bondsNum": 800, "price": 95.84 }, 9 | { "operator" : "A", "requestNum": 2, "bondsNum": 1000, "price": 95.82 }, 10 | { "operator" : "C", "requestNum": 2, "bondsNum": 700, "price": 95.82 }, 11 | { "operator" : "B", "requestNum": 3, "bondsNum": 950, "price": 95.70 }, 12 | { "operator" : "D", "requestNum": 3, "bondsNum": 800, "price": 95.65 }, 13 | { "operator" : "C", "requestNum": 3, "bondsNum": 1500, "price": 94.80 }, 14 | { "operator" : "A", "requestNum": 3, "bondsNum": 900, "price": 94.00 } 15 | ] 16 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Shared Technologies SRL 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /plugin-module/modeler-plugin-code/backend/NOTICE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 bpmn.io 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /plugin-module/modeler-plugin-code/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Shared Technologies SRL 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /plugin-module/modeler-plugin-code/client/react/UI/EditorModal.js: -------------------------------------------------------------------------------- 1 | import React from 'camunda-modeler-plugin-helpers/react'; 2 | import { Modal } from 'camunda-modeler-plugin-helpers/components'; 3 | 4 | import CodeEditor from '../Code/CodeEditor'; 5 | 6 | // polyfill upcoming structural components 7 | const Title = Modal.Title || (({ children }) =>{props.errorMessage}
; 16 | } 17 | 18 | switch (props.elementType) { 19 | case 'textarea': 20 | inputElement = ; 28 | break; 29 | case 'select': 30 | inputElement = ; 38 | break; 39 | case 'input': 40 | default: 41 | inputElement = ; 49 | } 50 | return ( 51 || {item} | ) 177 | } 178 |179 | 180 | | 181 |
|---|