diff --git a/doc/EmbedExistingConnector/EmbedExistingConnector.md b/doc/EmbedExistingConnector/EmbedExistingConnector.md index 5522939..d4e7524 100644 --- a/doc/EmbedExistingConnector/EmbedExistingConnector.md +++ b/doc/EmbedExistingConnector/EmbedExistingConnector.md @@ -1,12 +1,53 @@ #Introduction This document explains how to embed an existing connector. It gives some tips for creating a connector. -# Use an existing connector + +# Build a connector + +## Main rules An existing connector does not reference any external framework. The Cherry Framework must not be referenced. +A connector can reference filestorage library, to manipulate files. + +``` + + + io.camunda.filestorage + filestorage + ${filestorage.version} + +``` + + +A connector must define a license: copy the LICENSE file directly at the root level + +In the READ ME, the structure must be, per connector: + +### Level 1: Type Of Connector + +### Level 1: Build + +#### Level 2: API + +##### Level 3: Input +The JSON structure must be added, with all needed explanation + +##### Level 3: Output +The JSON structure must be added, with all needed explanation + +##### Level 3: Errors +Different BPMN errors that the connector can produce sould be referenced + +#### Level 2: Element templates +Give the path where the element template is + + Visit https://github.com/camunda-community-hub/camunda-8-connector-officetopdf to have an example. + +## Include dependencies + The two dependencies to include is ````` @@ -315,6 +356,18 @@ In the meantime, execute a mvn install on your repository. The JAR file is saved The procedure is visible here https://github.com/camunda-community-hub/community-action-maven-release +## Add the correct parent in the pom.xml + +To deploy the library, the parent in pom.xml must be + + +``` + + org.camunda.community + community-hub-release-parent + 1.3.1 + +``` ## Define a GitHub workflow Under the root of your project, create a directory `.github`, and then a directory, `workflows`. diff --git a/element-templates/File Storage_ Load file.json b/element-templates/File Storage_ Load file.json new file mode 100644 index 0000000..2f39495 --- /dev/null +++ b/element-templates/File Storage_ Load file.json @@ -0,0 +1,369 @@ +[ + { + "$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json", + "name": "Load file from disk", + "icon": { + "contents": "data:image/svg+xml,%3C?xml version\u003d\u00271.0\u0027 encoding\u003d\u0027UTF-8\u0027 standalone\u003d\u0027no\u0027?%3E%3Csvg xmlns:dc\u003d\u0027http://purl.org/dc/elements/1.1/\u0027 xmlns:cc\u003d\u0027http://creativecommons.org/ns%23\u0027 xmlns:rdf\u003d\u0027http://www.w3.org/1999/02/22-rdf-syntax-ns%23\u0027 xmlns:svg\u003d\u0027http://www.w3.org/2000/svg\u0027 xmlns\u003d\u0027http://www.w3.org/2000/svg\u0027 version\u003d\u00271.1\u0027 id\u003d\u0027Capa_1\u0027 x\u003d\u00270px\u0027 y\u003d\u00270px\u0027 viewBox\u003d\u00270 0 18 18\u0027 xml:space\u003d\u0027preserve\u0027 width\u003d\u002718\u0027 height\u003d\u002718\u0027%3E%3Cmetadata id\u003d\u0027metadata55\u0027%3E%3Crdf:RDF%3E%3Ccc:Work rdf:about\u003d\u0027\u0027%3E%3Cdc:format%3Eimage/svg+xml%3C/dc:format%3E%3Cdc:type rdf:resource\u003d\u0027http://purl.org/dc/dcmitype/StillImage\u0027 /%3E%3Cdc:title%3E%3C/dc:title%3E%3C/cc:Work%3E%3C/rdf:RDF%3E%3C/metadata%3E%3Cdefs id\u003d\u0027defs53\u0027 /%3E%3Cg id\u003d\u0027g18\u0027 transform\u003d\u0027scale(0.3)\u0027%3E %3Cpath d\u003d\u0027M 30,0 C 13.458,0 0,13.458 0,30 0,46.542 13.458,60 30,60 46.542,60 60,46.542 60,30 60,13.458 46.542,0 30,0 Z m 0,58 C 14.561,58 2,45.439 2,30 2,14.561 14.561,2 30,2 45.439,2 58,14.561 58,30 58,45.439 45.439,58 30,58 Z\u0027 id\u003d\u0027path2\u0027 /%3E %3Cpath d\u003d\u0027M 23.165,8.459 C 23.702,8.329 24.033,7.789 23.904,7.253 23.775,6.716 23.234,6.387 22.698,6.514 18.763,7.46 15.176,9.469 12.322,12.323 9.468,15.177 7.46,18.764 6.514,22.698 c -0.129,0.536 0.202,1.076 0.739,1.206 0.078,0.019 0.157,0.027 0.234,0.027 0.451,0 0.861,-0.308 0.972,-0.767 0.859,-3.575 2.685,-6.836 5.277,-9.429 2.592,-2.593 5.854,-4.417 9.429,-5.276 z\u0027 id\u003d\u0027path4\u0027 /%3E %3Cpath d\u003d\u0027m 52.747,36.096 c -0.538,-0.129 -1.077,0.201 -1.206,0.739 -0.859,3.575 -2.685,6.836 -5.277,9.429 -2.592,2.593 -5.854,4.418 -9.43,5.277 -0.537,0.13 -0.868,0.67 -0.739,1.206 0.11,0.459 0.521,0.767 0.972,0.767 0.077,0 0.156,-0.009 0.234,-0.027 3.936,-0.946 7.523,-2.955 10.377,-5.809 2.854,-2.854 4.862,-6.441 5.809,-10.376 0.128,-0.536 -0.203,-1.076 -0.74,-1.206 z\u0027 id\u003d\u0027path6\u0027 /%3E %3Cpath d\u003d\u0027m 24.452,13.286 c 0.538,-0.125 0.873,-0.663 0.747,-1.2 -0.125,-0.538 -0.665,-0.878 -1.2,-0.747 -3.09,0.72 -5.904,2.282 -8.141,4.52 -2.237,2.236 -3.8,5.051 -4.52,8.141 -0.126,0.537 0.209,1.075 0.747,1.2 0.076,0.019 0.152,0.026 0.228,0.026 0.454,0 0.865,-0.312 0.973,-0.773 0.635,-2.725 2.014,-5.207 3.986,-7.18 1.972,-1.973 4.456,-3.352 7.18,-3.987 z\u0027 id\u003d\u0027path8\u0027 /%3E %3Cpath d\u003d\u0027m 48.661,36.001 c 0.126,-0.537 -0.209,-1.075 -0.747,-1.2 -0.538,-0.133 -1.075,0.209 -1.2,0.747 -0.635,2.725 -2.014,5.207 -3.986,7.18 -1.972,1.973 -4.455,3.352 -7.18,3.986 -0.538,0.125 -0.873,0.663 -0.747,1.2 0.107,0.462 0.519,0.773 0.973,0.773 0.075,0 0.151,-0.008 0.228,-0.026 3.09,-0.72 5.904,-2.282 8.141,-4.52 2.236,-2.236 3.798,-5.05 4.518,-8.14 z\u0027 id\u003d\u0027path10\u0027 /%3E %3Cpath d\u003d\u0027m 26.495,16.925 c -0.119,-0.541 -0.653,-0.879 -1.19,-0.763 -4.557,0.997 -8.146,4.586 -9.143,9.143 -0.118,0.539 0.224,1.072 0.763,1.19 0.072,0.016 0.144,0.023 0.215,0.023 0.46,0 0.873,-0.318 0.976,-0.786 0.831,-3.796 3.821,-6.786 7.617,-7.617 0.538,-0.118 0.88,-0.651 0.762,-1.19 z\u0027 id\u003d\u0027path12\u0027 /%3E %3Cpath d\u003d\u0027m 43.838,34.695 c 0.118,-0.539 -0.224,-1.072 -0.763,-1.19 -0.54,-0.118 -1.072,0.222 -1.19,0.763 -0.831,3.796 -3.821,6.786 -7.617,7.617 -0.539,0.118 -0.881,0.651 -0.763,1.19 0.103,0.468 0.516,0.786 0.976,0.786 0.071,0 0.143,-0.008 0.215,-0.023 4.556,-0.997 8.145,-4.586 9.142,-9.143 z\u0027 id\u003d\u0027path14\u0027 /%3E %3Cpath d\u003d\u0027m 38.08,30 c 0,-4.455 -3.625,-8.08 -8.08,-8.08 -4.455,0 -8.08,3.625 -8.08,8.08 0,4.455 3.625,8.08 8.08,8.08 4.455,0 8.08,-3.625 8.08,-8.08 z M 30,36.08 c -3.353,0 -6.08,-2.728 -6.08,-6.08 0,-3.352 2.728,-6.08 6.08,-6.08 3.352,0 6.08,2.728 6.08,6.08 0,3.352 -2.727,6.08 -6.08,6.08 z\u0027 id\u003d\u0027path16\u0027 /%3E%3C/g%3E%3Cg id\u003d\u0027g20\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g22\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g24\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g26\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g28\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g30\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g32\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g34\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g36\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g38\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g40\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g42\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g44\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g46\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g48\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g85\u0027 transform\u003d\u0027matrix(1.1259408,0,0,1.1259408,33.760593,8.6647721)\u0027%3E%3Cpath d\u003d\u0027m -15.969199,-1.3973349 c -0.04428,0.56592004 -0.49572,0.83754004 -0.58752,0.88722004 -0.4887,0.26676 -1.31112,0.17388 -1.70856,-0.38556 -0.21924,-0.30780004 -0.3294,-0.79758004 -0.1161,-1.13670004 l 0.0027,-0.0054 c 0.07668,-0.12474 0.25434,-0.33534 0.58212,-0.34236 h 0.01188 c 0.11718,0 0.25218,0.03564 0.37152,0.06696 0.0837,0.02214 0.15606,0.04104 0.21006,0.04482 0.03402,0.00216 0.08262,-0.00648 0.14418,-0.01728 0.18414,-0.0324 0.4914,-0.0864 0.76032,0.10368 0.36612,0.2597403 0.33156,0.76356 0.3294,0.78462 z\u0027 id\u003d\u0027path57\u0027 style\u003d\u0027fill:%23aa0000;fill-opacity:1;stroke-width:0.3\u0027 /%3E%3Cpath d\u003d\u0027m -18.207499,-2.3007546 c -0.1053,0.07452 -0.17496,0.16686 -0.21708,0.2349 l -0.0027,0.00432 c -0.10908,0.17388 -0.13932,0.37584 -0.1188,0.57348 -0.0022,0.00108 -0.0043,0.00216 -0.0059,0.00378 -0.40014,0.3267 -0.85212,0.24246 -1.02762,0.19116 l -0.01026,-0.0027 c -0.5589,-0.13932 -1.11078,-0.74304 -1.00926,-1.38618 0.05616,-0.35424 0.324,-0.7614 0.72792,-0.85428 0.06966,-0.0162 0.43362,-0.0837 0.7263,0.16146 0.08964,0.0756 0.15606,0.1857601 0.21438,0.28296 0.04158,0.0702 0.07776,0.13014 0.11718,0.16956 0.02538,0.02538 0.06966,0.05022 0.12582,0.08208 0.1647,0.09234 0.4131,0.2322001 0.4779,0.53352 5.4e-4,0.00216 0.0011,0.00432 0.0022,0.00594 z\u0027 id\u003d\u0027path59\u0027 style\u003d\u0027fill:%23aa0000;fill-opacity:1;stroke-width:0.3\u0027 /%3E%3Cpath d\u003d\u0027m -17.110219,-2.3309949 c -0.03186,0.0054 -0.05994,0.00918 -0.07992,0.00918 -0.0032,0 -0.0065,-5.4e-4 -0.0092,-5.4e-4 -0.01512,-0.00108 -0.03294,-0.00324 -0.05184,-0.00702 0.16578,-0.42336 0.23436,-1.10052 -0.34182,-1.95804 -0.0011,-0.00216 -0.0027,-0.00378 -0.0049,-0.0054 0.03348,-0.13284 0.04482,-0.22572 0.04752,-0.2484 0.0016,-0.01512 -0.0092,-0.02808 -0.02376,-0.0297 -0.01512,-0.00216 -0.02808,0.00918 -0.0297,0.02376 -0.0065,0.05778 -0.07128,0.5788801 -0.4347,1.0416602 -0.22734,0.28944 -0.58536,0.5049 -0.70902,0.56646 -0.01134,-0.00756 -0.02106,-0.01512 -0.02754,-0.0216 -0.01782,-0.01782 -0.0351,-0.04104 -0.05292,-0.06858 0.01026,-0.0054 0.02106,-0.01134 0.0324,-0.01728 0.12906,-0.06912 0.34506,-0.1841401 0.60858,-0.4600801 0.31158,-0.32616 0.37098,-0.82566 0.2835,-0.96174 -0.04212,-0.06588 -0.10962,-0.07236 -0.16362,-0.07722 -0.07074,-0.00594 -0.1134,-0.01026 -0.12096,-0.10638 -0.007,-0.0837 0.0324,-0.15768 0.1107,-0.20736 0.1053,-0.0675 0.29376,-0.0891 0.47628,0.01458 0.11394,0.06426 0.11286,0.17388 0.11232,0.27972 -5.4e-4,0.07074 -0.0011,0.1377 0.03402,0.18576 l 0.01512,0.02052 c 0.0864,0.1171801 0.28836,0.3904201 0.40932,0.86724 0.12906,0.5102999 0.007,0.9752399 -0.07992,1.1604599 z\u0027 id\u003d\u0027path61\u0027 style\u003d\u0027fill:%23502d16;fill-opacity:1;stroke-width:0.3\u0027 /%3E%3Cpath d\u003d\u0027m -18.698899,-4.5455348 c -0.0043,0.00216 -0.0086,0.00324 -0.01296,0.00324 -0.0097,0 -0.0189,-0.0054 -0.02376,-0.01404 -5.4e-4,-5.4e-4 -0.03834,-0.06804 -0.10638,-0.13014 -0.01134,-0.00972 -0.01188,-0.027 -0.0022,-0.0378 0.01026,-0.01134 0.027,-0.01188 0.03834,-0.00216 0.07506,0.06804 0.11556,0.14094 0.11718,0.14418 0.0076,0.01296 0.0027,0.02916 -0.01026,0.03672 z\u0027 id\u003d\u0027path63\u0027 style\u003d\u0027stroke-width:0.3\u0027 /%3E%3Cpath d\u003d\u0027m -18.644359,-4.0309149 c -0.05616,0.06642 -0.08532,0.0783 -0.1296,0.09612 l -0.01404,0.00594 c -0.0032,0.00162 -0.007,0.00216 -0.01026,0.00216 -0.0108,0 -0.02052,-0.00648 -0.02484,-0.01674 -0.0059,-0.0135 5.4e-4,-0.0297 0.01458,-0.0351 l 0.01404,-0.00594 c 0.0405,-0.01674 0.06102,-0.02538 0.10908,-0.081 0.0097,-0.01188 0.027,-0.01296 0.03834,-0.00324 0.01134,0.00972 0.01242,0.02646 0.0027,0.0378 z\u0027 id\u003d\u0027path65\u0027 style\u003d\u0027stroke-width:0.3\u0027 /%3E%3Cpath d\u003d\u0027m -17.948839,-4.4391548 c -0.01404,-0.02214 -0.0324,-0.03402 -0.05292,-0.0405 -0.07182,0.09666 -0.32454,0.243 -0.57834,0.243 -0.0675,0 -0.13554,-0.01026 -0.1998,-0.03456 -0.1728,-0.06588 -0.29106,-0.15768 -0.40554,-0.24624 -0.09072,-0.07074 -0.17658,-0.13716 -0.28134,-0.18252 -0.01404,-0.00648 -0.01998,-0.02214 -0.01404,-0.03564 0.0059,-0.01404 0.0216,-0.01998 0.03564,-0.01404 0.1107,0.0486 0.19926,0.11664 0.29268,0.18954 0.11124,0.0864 0.2268,0.1755 0.3915,0.23814 0.16794,0.06372 0.3564,0.02214 0.4995,-0.04212 -0.06156,-0.19008 -0.45954,-0.76842 -1.11564,-0.6210001 -0.10152,0.02268 -0.19008,0.04374 -0.26784,0.0621 -0.3294,0.07722 -0.47034,0.11016 -0.61668,0.07128 0.0135,0.06804 0.04914,0.12582 0.10584,0.17226 0.1134,0.09126 0.2781,0.11394 0.3564,0.11502 -0.03996,-0.04536 -0.08262,-0.07452 -0.135,-0.09288 -0.01404,-0.00486 -0.0216,-0.01998 -0.01674,-0.03402 0.0049,-0.01458 0.02052,-0.0216 0.03456,-0.01674 0.1701,0.05994 0.2484,0.21222 0.37476,0.5227201 0.1323,0.32508 0.59508,0.62802 0.97038,0.5157 0.38232,-0.11448 0.37584,-0.51732 0.3753,-0.52164 0,-0.0108 0.0065,-0.02106 0.0162,-0.02538 0.02538,-0.01134 0.15552,-0.07074 0.24732,-0.15714 0.0016,-0.00162 0.0032,-0.0027 0.0049,-0.0027 v -5.4e-4 c -0.0043,-0.02646 -0.01188,-0.04752 -0.02106,-0.0621 m -0.89532,-0.2851201 c 0.01026,-0.01134 0.027,-0.01188 0.03834,-0.00216 0.07506,0.06804 0.11556,0.14094 0.11718,0.14418 0.0076,0.01296 0.0027,0.02916 -0.01026,0.03672 -0.0043,0.00216 -0.0086,0.00324 -0.01296,0.00324 -0.0097,0 -0.0189,-0.0054 -0.02376,-0.01404 -5.4e-4,-5.4e-4 -0.03834,-0.06804 -0.10638,-0.13014 -0.01134,-0.00972 -0.01188,-0.027 -0.0022,-0.0378 m -0.45468,0.36774 c -0.0011,0 -0.01674,0.0027 -0.04752,0.0027 -0.0243,0 -0.05724,-0.00162 -0.09936,-0.00702 -0.01512,-0.00162 -0.02538,-0.01512 -0.02322,-0.03024 0.0016,-0.01458 0.01512,-0.02484 0.03024,-0.02322 0.08748,0.01134 0.13014,0.00486 0.13068,0.00486 0.01458,-0.0027 0.02862,0.00702 0.03078,0.02214 0.0027,0.01458 -0.007,0.02808 -0.0216,0.03078 m 0.65448,0.32562 c -0.05616,0.06642 -0.08532,0.0783 -0.1296,0.09612 l -0.01404,0.00594 c -0.0032,0.00162 -0.007,0.00216 -0.01026,0.00216 -0.0108,0 -0.02052,-0.00648 -0.02484,-0.01674 -0.0059,-0.0135 5.4e-4,-0.0297 0.01458,-0.0351 l 0.01404,-0.00594 c 0.0405,-0.01674 0.06102,-0.02538 0.10908,-0.081 0.0097,-0.01188 0.027,-0.01296 0.03834,-0.00324 0.01134,0.00972 0.01242,0.02646 0.0027,0.0378 z\u0027 id\u003d\u0027path67\u0027 style\u003d\u0027fill:%23008000;fill-opacity:1;stroke-width:0.3\u0027 /%3E%3Cpath d\u003d\u0027m -19.277239,-4.3873149 c 0.0027,0.01458 -0.007,0.02808 -0.0216,0.03078 -0.0011,0 -0.01674,0.0027 -0.04752,0.0027 -0.0243,0 -0.05724,-0.00162 -0.09936,-0.00702 -0.01512,-0.00162 -0.02538,-0.01512 -0.02322,-0.03024 0.0016,-0.01458 0.01512,-0.02484 0.03024,-0.02322 0.08748,0.01134 0.13014,0.00486 0.13068,0.00486 0.01458,-0.0027 0.02862,0.00702 0.03078,0.02214 z\u0027 id\u003d\u0027path69\u0027 style\u003d\u0027stroke-width:0.3\u0027 /%3E%3C/g%3E%3C/svg%3E" + }, + "description": "Load a file from the disk, and save it in a storage definition", + "appliesTo": [ + "bpmn:Task" + ], + "groups": [ + { + "label": "Source", + "id": "source" + }, + { + "label": "Process file", + "id": "process_file" + }, + { + "label": "Storage definition", + "id": "storage_definition" + }, + { + "label": "Input", + "id": "Input" + }, + { + "label": "Output", + "id": "Output" + } + ], + "id": "io.camunda.cherry.files.LoadFileFromDiskWorker", + "category": { + "name": "connectors", + "id": "connectors" + }, + "documentationRef": "https://docs.camunda.io/docs/components/modeler/web-modeler/connectors/available-connectors/template/", + "elementType": { + "value": "bpmn:ServiceTask" + }, + "properties": [ + { + "value": "c-files-load-from-disk", + "type": "Hidden", + "binding": { + "type": "zeebe:taskDefinition:type" + } + }, + { + "description": "Specify the folder where the file will be loaded. Must be visible from the server.", + "binding": { + "name": "folder", + "type": "zeebe:input" + }, + "id": "folder", + "label": "Folder", + "type": "String", + "constraints": { + "notEmpty": true + }, + "group": "source" + }, + { + "description": "Specify a file name, else the first file in the folder will be loaded", + "binding": { + "name": "fileName_optional", + "type": "zeebe:input" + }, + "id": "fileName_optional", + "label": "Provide File name?", + "type": "Dropdown", + "choices": [ + { + "name": "Yes", + "value": "true" + }, + { + "name": "No", + "value": "false" + } + ], + "value": "false", + "group": "Input" + }, + { + "condition": { + "equals": "true", + "property": "fileName_optional" + }, + "description": "Specify a file name, else the first file in the folder will be loaded", + "binding": { + "name": "fileName", + "type": "zeebe:input" + }, + "id": "fileName", + "label": "File name", + "type": "String", + "group": "source" + }, + { + "description": "If you didn\u0027t specify a fileName, a filter to select only part of files present in the folder", + "binding": { + "name": "filterFile_optional", + "type": "zeebe:input" + }, + "id": "filterFile_optional", + "label": "Provide Filter file?", + "type": "Dropdown", + "choices": [ + { + "name": "Yes", + "value": "true" + }, + { + "name": "No", + "value": "false" + } + ], + "value": "false", + "group": "Input" + }, + { + "condition": { + "equals": "true", + "property": "filterFile_optional" + }, + "description": "If you didn\u0027t specify a fileName, a filter to select only part of files present in the folder", + "binding": { + "name": "filterFile", + "type": "zeebe:input" + }, + "id": "filterFile", + "label": "Filter file", + "type": "String", + "value": "*.*", + "group": "source" + }, + { + "description": "Policy to manipulate the file after loading. With ARCHIVE, the folder archive must be specify", + "binding": { + "name": "policy", + "type": "zeebe:input" + }, + "id": "policy", + "label": "Policy", + "choices": [ + { + "name": "DELETE", + "value": "DELETE" + }, + { + "name": "ARCHIVE", + "value": "ARCHIVE" + }, + { + "name": "UNCHANGE", + "value": "UNCHANGE" + } + ], + "type": "Dropdown", + "value": "UNCHANGE", + "group": "process_file" + }, + { + "condition": { + "oneOf": [ + "ARCHIVE" + ], + "property": "policy" + }, + "description": "With the policy ARCHIVE. File is moved in this folder.", + "binding": { + "name": "archiveFolder", + "type": "zeebe:input" + }, + "id": "archiveFolder", + "label": "Archive folder", + "type": "String", + "group": "process_file" + }, + { + "description": "How to saved the FileVariable. JSON to save in the engine (size is linited), TEMPFOLDER to use the temporary folder of THIS machineFOLDER to specify a folder to save it (to be accessible by multiple machine if you ruin it in a clusterCMIS to specify a CMIS connection", + "binding": { + "name": "storageDefinition", + "type": "zeebe:input" + }, + "id": "storageDefinition", + "label": "Storage definition", + "choices": [ + { + "name": "JSON", + "value": "JSON" + }, + { + "name": "TEMPFOLDER", + "value": "TEMPFOLDER" + }, + { + "name": "FOLDER", + "value": "FOLDER" + }, + { + "name": "CMIS", + "value": "CMIS" + } + ], + "type": "Dropdown", + "value": "JSON", + "group": "storage_definition" + }, + { + "condition": { + "oneOf": [ + "FOLDER" + ], + "property": "storageDefinition" + }, + "description": "Complement to the Storage definition, if needed. FOLDER: please provide the folder to save the file", + "binding": { + "name": "storageDefinitionComplement", + "type": "zeebe:input" + }, + "id": "storageDefinitionComplement", + "label": "Folder Storage definition Complement", + "type": "String", + "group": "storage_definition" + }, + { + "condition": { + "oneOf": [ + "CMIS" + ], + "property": "storageDefinition" + }, + "description": "Complement to the Storage definition, if needed. FOLDER: please provide the folder to save the file", + "binding": { + "name": "storageDefinitionCmisComplement", + "type": "zeebe:input" + }, + "id": "storageDefinitionCmisComplement", + "label": "CMIS Storage definition Complement", + "type": "String", + "group": "storage_definition" + }, + { + "description": "Name of the variable to save the file loaded.Content depend of the storage definition", + "binding": { + "name": "fileLoaded_optional", + "type": "zeebe:input" + }, + "id": "fileLoaded_optional", + "label": "Saved File loaded?", + "type": "Dropdown", + "choices": [ + { + "name": "Yes", + "value": "true" + }, + { + "name": "No", + "value": "false" + } + ], + "value": "false", + "group": "Output" + }, + { + "condition": { + "equals": "true", + "property": "fileLoaded_optional" + }, + "description": "Name of the variable to save the file loaded.Content depend of the storage definition", + "binding": { + "source": "\u003d fileLoaded", + "type": "zeebe:output" + }, + "id": "fileLoaded", + "label": "File loaded", + "type": "String", + "constraints": { + "notEmpty": true + }, + "group": "Output" + }, + { + "description": "Name of the file", + "binding": { + "name": "fileNameLoaded_optional", + "type": "zeebe:input" + }, + "id": "fileNameLoaded_optional", + "label": "Saved File name?", + "type": "Dropdown", + "choices": [ + { + "name": "Yes", + "value": "true" + }, + { + "name": "No", + "value": "false" + } + ], + "value": "false", + "group": "Output" + }, + { + "condition": { + "equals": "true", + "property": "fileNameLoaded_optional" + }, + "description": "Name of the file", + "binding": { + "source": "\u003d fileNameLoaded", + "type": "zeebe:output" + }, + "id": "fileNameLoaded", + "label": "File name", + "type": "String", + "constraints": { + "notEmpty": true + }, + "group": "Output" + }, + { + "description": "MimeType of the loaded file", + "binding": { + "name": "fileMimeType_optional", + "type": "zeebe:input" + }, + "id": "fileMimeType_optional", + "label": "Saved File Mime type?", + "type": "Dropdown", + "choices": [ + { + "name": "Yes", + "value": "true" + }, + { + "name": "No", + "value": "false" + } + ], + "value": "false", + "group": "Output" + }, + { + "condition": { + "equals": "true", + "property": "fileMimeType_optional" + }, + "description": "MimeType of the loaded file", + "binding": { + "source": "\u003d fileMimeType", + "type": "zeebe:output" + }, + "id": "fileMimeType", + "label": "File Mime type", + "type": "String", + "constraints": { + "notEmpty": true + }, + "group": "Output" + } + ] + } +] \ No newline at end of file diff --git a/element-templates/File Storage_ Purge File.json b/element-templates/File Storage_ Purge File.json new file mode 100644 index 0000000..8d605f8 --- /dev/null +++ b/element-templates/File Storage_ Purge File.json @@ -0,0 +1,95 @@ +[ + { + "$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json", + "name": "Purge file in the storage", + "icon": { + "contents": "data:image/svg+xml,%3C?xml version\u003d\u00271.0\u0027 encoding\u003d\u0027UTF-8\u0027 standalone\u003d\u0027no\u0027?%3E%3Csvg xmlns:dc\u003d\u0027http://purl.org/dc/elements/1.1/\u0027 xmlns:cc\u003d\u0027http://creativecommons.org/ns%23\u0027 xmlns:rdf\u003d\u0027http://www.w3.org/1999/02/22-rdf-syntax-ns%23\u0027 xmlns:svg\u003d\u0027http://www.w3.org/2000/svg\u0027 xmlns\u003d\u0027http://www.w3.org/2000/svg\u0027 version\u003d\u00271.1\u0027 id\u003d\u0027Capa_1\u0027 x\u003d\u00270px\u0027 y\u003d\u00270px\u0027 viewBox\u003d\u00270 0 18 18\u0027 xml:space\u003d\u0027preserve\u0027 width\u003d\u002718\u0027 height\u003d\u002718\u0027%3E%3Cmetadata id\u003d\u0027metadata55\u0027%3E%3Crdf:RDF%3E%3Ccc:Work rdf:about\u003d\u0027\u0027%3E%3Cdc:format%3Eimage/svg+xml%3C/dc:format%3E%3Cdc:type rdf:resource\u003d\u0027http://purl.org/dc/dcmitype/StillImage\u0027 /%3E%3Cdc:title%3E%3C/dc:title%3E%3C/cc:Work%3E%3C/rdf:RDF%3E%3C/metadata%3E%3Cdefs id\u003d\u0027defs53\u0027 /%3E%3Cg id\u003d\u0027g18\u0027 transform\u003d\u0027scale(0.3)\u0027%3E %3Cpath d\u003d\u0027M 30,0 C 13.458,0 0,13.458 0,30 0,46.542 13.458,60 30,60 46.542,60 60,46.542 60,30 60,13.458 46.542,0 30,0 Z m 0,58 C 14.561,58 2,45.439 2,30 2,14.561 14.561,2 30,2 45.439,2 58,14.561 58,30 58,45.439 45.439,58 30,58 Z\u0027 id\u003d\u0027path2\u0027 /%3E %3Cpath d\u003d\u0027M 23.165,8.459 C 23.702,8.329 24.033,7.789 23.904,7.253 23.775,6.716 23.234,6.387 22.698,6.514 18.763,7.46 15.176,9.469 12.322,12.323 9.468,15.177 7.46,18.764 6.514,22.698 c -0.129,0.536 0.202,1.076 0.739,1.206 0.078,0.019 0.157,0.027 0.234,0.027 0.451,0 0.861,-0.308 0.972,-0.767 0.859,-3.575 2.685,-6.836 5.277,-9.429 2.592,-2.593 5.854,-4.417 9.429,-5.276 z\u0027 id\u003d\u0027path4\u0027 /%3E %3Cpath d\u003d\u0027m 52.747,36.096 c -0.538,-0.129 -1.077,0.201 -1.206,0.739 -0.859,3.575 -2.685,6.836 -5.277,9.429 -2.592,2.593 -5.854,4.418 -9.43,5.277 -0.537,0.13 -0.868,0.67 -0.739,1.206 0.11,0.459 0.521,0.767 0.972,0.767 0.077,0 0.156,-0.009 0.234,-0.027 3.936,-0.946 7.523,-2.955 10.377,-5.809 2.854,-2.854 4.862,-6.441 5.809,-10.376 0.128,-0.536 -0.203,-1.076 -0.74,-1.206 z\u0027 id\u003d\u0027path6\u0027 /%3E %3Cpath d\u003d\u0027m 24.452,13.286 c 0.538,-0.125 0.873,-0.663 0.747,-1.2 -0.125,-0.538 -0.665,-0.878 -1.2,-0.747 -3.09,0.72 -5.904,2.282 -8.141,4.52 -2.237,2.236 -3.8,5.051 -4.52,8.141 -0.126,0.537 0.209,1.075 0.747,1.2 0.076,0.019 0.152,0.026 0.228,0.026 0.454,0 0.865,-0.312 0.973,-0.773 0.635,-2.725 2.014,-5.207 3.986,-7.18 1.972,-1.973 4.456,-3.352 7.18,-3.987 z\u0027 id\u003d\u0027path8\u0027 /%3E %3Cpath d\u003d\u0027m 48.661,36.001 c 0.126,-0.537 -0.209,-1.075 -0.747,-1.2 -0.538,-0.133 -1.075,0.209 -1.2,0.747 -0.635,2.725 -2.014,5.207 -3.986,7.18 -1.972,1.973 -4.455,3.352 -7.18,3.986 -0.538,0.125 -0.873,0.663 -0.747,1.2 0.107,0.462 0.519,0.773 0.973,0.773 0.075,0 0.151,-0.008 0.228,-0.026 3.09,-0.72 5.904,-2.282 8.141,-4.52 2.236,-2.236 3.798,-5.05 4.518,-8.14 z\u0027 id\u003d\u0027path10\u0027 /%3E %3Cpath d\u003d\u0027m 26.495,16.925 c -0.119,-0.541 -0.653,-0.879 -1.19,-0.763 -4.557,0.997 -8.146,4.586 -9.143,9.143 -0.118,0.539 0.224,1.072 0.763,1.19 0.072,0.016 0.144,0.023 0.215,0.023 0.46,0 0.873,-0.318 0.976,-0.786 0.831,-3.796 3.821,-6.786 7.617,-7.617 0.538,-0.118 0.88,-0.651 0.762,-1.19 z\u0027 id\u003d\u0027path12\u0027 /%3E %3Cpath d\u003d\u0027m 43.838,34.695 c 0.118,-0.539 -0.224,-1.072 -0.763,-1.19 -0.54,-0.118 -1.072,0.222 -1.19,0.763 -0.831,3.796 -3.821,6.786 -7.617,7.617 -0.539,0.118 -0.881,0.651 -0.763,1.19 0.103,0.468 0.516,0.786 0.976,0.786 0.071,0 0.143,-0.008 0.215,-0.023 4.556,-0.997 8.145,-4.586 9.142,-9.143 z\u0027 id\u003d\u0027path14\u0027 /%3E %3Cpath d\u003d\u0027m 38.08,30 c 0,-4.455 -3.625,-8.08 -8.08,-8.08 -4.455,0 -8.08,3.625 -8.08,8.08 0,4.455 3.625,8.08 8.08,8.08 4.455,0 8.08,-3.625 8.08,-8.08 z M 30,36.08 c -3.353,0 -6.08,-2.728 -6.08,-6.08 0,-3.352 2.728,-6.08 6.08,-6.08 3.352,0 6.08,2.728 6.08,6.08 0,3.352 -2.727,6.08 -6.08,6.08 z\u0027 id\u003d\u0027path16\u0027 /%3E%3C/g%3E%3Cg id\u003d\u0027g20\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g22\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g24\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g26\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g28\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g30\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g32\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g34\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g36\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g38\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g40\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g42\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g44\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g46\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g48\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g85\u0027 transform\u003d\u0027matrix(1.1259408,0,0,1.1259408,33.760593,8.6647721)\u0027%3E%3Cpath d\u003d\u0027m -15.969199,-1.3973349 c -0.04428,0.56592004 -0.49572,0.83754004 -0.58752,0.88722004 -0.4887,0.26676 -1.31112,0.17388 -1.70856,-0.38556 -0.21924,-0.30780004 -0.3294,-0.79758004 -0.1161,-1.13670004 l 0.0027,-0.0054 c 0.07668,-0.12474 0.25434,-0.33534 0.58212,-0.34236 h 0.01188 c 0.11718,0 0.25218,0.03564 0.37152,0.06696 0.0837,0.02214 0.15606,0.04104 0.21006,0.04482 0.03402,0.00216 0.08262,-0.00648 0.14418,-0.01728 0.18414,-0.0324 0.4914,-0.0864 0.76032,0.10368 0.36612,0.2597403 0.33156,0.76356 0.3294,0.78462 z\u0027 id\u003d\u0027path57\u0027 style\u003d\u0027fill:%23aa0000;fill-opacity:1;stroke-width:0.3\u0027 /%3E%3Cpath d\u003d\u0027m -18.207499,-2.3007546 c -0.1053,0.07452 -0.17496,0.16686 -0.21708,0.2349 l -0.0027,0.00432 c -0.10908,0.17388 -0.13932,0.37584 -0.1188,0.57348 -0.0022,0.00108 -0.0043,0.00216 -0.0059,0.00378 -0.40014,0.3267 -0.85212,0.24246 -1.02762,0.19116 l -0.01026,-0.0027 c -0.5589,-0.13932 -1.11078,-0.74304 -1.00926,-1.38618 0.05616,-0.35424 0.324,-0.7614 0.72792,-0.85428 0.06966,-0.0162 0.43362,-0.0837 0.7263,0.16146 0.08964,0.0756 0.15606,0.1857601 0.21438,0.28296 0.04158,0.0702 0.07776,0.13014 0.11718,0.16956 0.02538,0.02538 0.06966,0.05022 0.12582,0.08208 0.1647,0.09234 0.4131,0.2322001 0.4779,0.53352 5.4e-4,0.00216 0.0011,0.00432 0.0022,0.00594 z\u0027 id\u003d\u0027path59\u0027 style\u003d\u0027fill:%23aa0000;fill-opacity:1;stroke-width:0.3\u0027 /%3E%3Cpath d\u003d\u0027m -17.110219,-2.3309949 c -0.03186,0.0054 -0.05994,0.00918 -0.07992,0.00918 -0.0032,0 -0.0065,-5.4e-4 -0.0092,-5.4e-4 -0.01512,-0.00108 -0.03294,-0.00324 -0.05184,-0.00702 0.16578,-0.42336 0.23436,-1.10052 -0.34182,-1.95804 -0.0011,-0.00216 -0.0027,-0.00378 -0.0049,-0.0054 0.03348,-0.13284 0.04482,-0.22572 0.04752,-0.2484 0.0016,-0.01512 -0.0092,-0.02808 -0.02376,-0.0297 -0.01512,-0.00216 -0.02808,0.00918 -0.0297,0.02376 -0.0065,0.05778 -0.07128,0.5788801 -0.4347,1.0416602 -0.22734,0.28944 -0.58536,0.5049 -0.70902,0.56646 -0.01134,-0.00756 -0.02106,-0.01512 -0.02754,-0.0216 -0.01782,-0.01782 -0.0351,-0.04104 -0.05292,-0.06858 0.01026,-0.0054 0.02106,-0.01134 0.0324,-0.01728 0.12906,-0.06912 0.34506,-0.1841401 0.60858,-0.4600801 0.31158,-0.32616 0.37098,-0.82566 0.2835,-0.96174 -0.04212,-0.06588 -0.10962,-0.07236 -0.16362,-0.07722 -0.07074,-0.00594 -0.1134,-0.01026 -0.12096,-0.10638 -0.007,-0.0837 0.0324,-0.15768 0.1107,-0.20736 0.1053,-0.0675 0.29376,-0.0891 0.47628,0.01458 0.11394,0.06426 0.11286,0.17388 0.11232,0.27972 -5.4e-4,0.07074 -0.0011,0.1377 0.03402,0.18576 l 0.01512,0.02052 c 0.0864,0.1171801 0.28836,0.3904201 0.40932,0.86724 0.12906,0.5102999 0.007,0.9752399 -0.07992,1.1604599 z\u0027 id\u003d\u0027path61\u0027 style\u003d\u0027fill:%23502d16;fill-opacity:1;stroke-width:0.3\u0027 /%3E%3Cpath d\u003d\u0027m -18.698899,-4.5455348 c -0.0043,0.00216 -0.0086,0.00324 -0.01296,0.00324 -0.0097,0 -0.0189,-0.0054 -0.02376,-0.01404 -5.4e-4,-5.4e-4 -0.03834,-0.06804 -0.10638,-0.13014 -0.01134,-0.00972 -0.01188,-0.027 -0.0022,-0.0378 0.01026,-0.01134 0.027,-0.01188 0.03834,-0.00216 0.07506,0.06804 0.11556,0.14094 0.11718,0.14418 0.0076,0.01296 0.0027,0.02916 -0.01026,0.03672 z\u0027 id\u003d\u0027path63\u0027 style\u003d\u0027stroke-width:0.3\u0027 /%3E%3Cpath d\u003d\u0027m -18.644359,-4.0309149 c -0.05616,0.06642 -0.08532,0.0783 -0.1296,0.09612 l -0.01404,0.00594 c -0.0032,0.00162 -0.007,0.00216 -0.01026,0.00216 -0.0108,0 -0.02052,-0.00648 -0.02484,-0.01674 -0.0059,-0.0135 5.4e-4,-0.0297 0.01458,-0.0351 l 0.01404,-0.00594 c 0.0405,-0.01674 0.06102,-0.02538 0.10908,-0.081 0.0097,-0.01188 0.027,-0.01296 0.03834,-0.00324 0.01134,0.00972 0.01242,0.02646 0.0027,0.0378 z\u0027 id\u003d\u0027path65\u0027 style\u003d\u0027stroke-width:0.3\u0027 /%3E%3Cpath d\u003d\u0027m -17.948839,-4.4391548 c -0.01404,-0.02214 -0.0324,-0.03402 -0.05292,-0.0405 -0.07182,0.09666 -0.32454,0.243 -0.57834,0.243 -0.0675,0 -0.13554,-0.01026 -0.1998,-0.03456 -0.1728,-0.06588 -0.29106,-0.15768 -0.40554,-0.24624 -0.09072,-0.07074 -0.17658,-0.13716 -0.28134,-0.18252 -0.01404,-0.00648 -0.01998,-0.02214 -0.01404,-0.03564 0.0059,-0.01404 0.0216,-0.01998 0.03564,-0.01404 0.1107,0.0486 0.19926,0.11664 0.29268,0.18954 0.11124,0.0864 0.2268,0.1755 0.3915,0.23814 0.16794,0.06372 0.3564,0.02214 0.4995,-0.04212 -0.06156,-0.19008 -0.45954,-0.76842 -1.11564,-0.6210001 -0.10152,0.02268 -0.19008,0.04374 -0.26784,0.0621 -0.3294,0.07722 -0.47034,0.11016 -0.61668,0.07128 0.0135,0.06804 0.04914,0.12582 0.10584,0.17226 0.1134,0.09126 0.2781,0.11394 0.3564,0.11502 -0.03996,-0.04536 -0.08262,-0.07452 -0.135,-0.09288 -0.01404,-0.00486 -0.0216,-0.01998 -0.01674,-0.03402 0.0049,-0.01458 0.02052,-0.0216 0.03456,-0.01674 0.1701,0.05994 0.2484,0.21222 0.37476,0.5227201 0.1323,0.32508 0.59508,0.62802 0.97038,0.5157 0.38232,-0.11448 0.37584,-0.51732 0.3753,-0.52164 0,-0.0108 0.0065,-0.02106 0.0162,-0.02538 0.02538,-0.01134 0.15552,-0.07074 0.24732,-0.15714 0.0016,-0.00162 0.0032,-0.0027 0.0049,-0.0027 v -5.4e-4 c -0.0043,-0.02646 -0.01188,-0.04752 -0.02106,-0.0621 m -0.89532,-0.2851201 c 0.01026,-0.01134 0.027,-0.01188 0.03834,-0.00216 0.07506,0.06804 0.11556,0.14094 0.11718,0.14418 0.0076,0.01296 0.0027,0.02916 -0.01026,0.03672 -0.0043,0.00216 -0.0086,0.00324 -0.01296,0.00324 -0.0097,0 -0.0189,-0.0054 -0.02376,-0.01404 -5.4e-4,-5.4e-4 -0.03834,-0.06804 -0.10638,-0.13014 -0.01134,-0.00972 -0.01188,-0.027 -0.0022,-0.0378 m -0.45468,0.36774 c -0.0011,0 -0.01674,0.0027 -0.04752,0.0027 -0.0243,0 -0.05724,-0.00162 -0.09936,-0.00702 -0.01512,-0.00162 -0.02538,-0.01512 -0.02322,-0.03024 0.0016,-0.01458 0.01512,-0.02484 0.03024,-0.02322 0.08748,0.01134 0.13014,0.00486 0.13068,0.00486 0.01458,-0.0027 0.02862,0.00702 0.03078,0.02214 0.0027,0.01458 -0.007,0.02808 -0.0216,0.03078 m 0.65448,0.32562 c -0.05616,0.06642 -0.08532,0.0783 -0.1296,0.09612 l -0.01404,0.00594 c -0.0032,0.00162 -0.007,0.00216 -0.01026,0.00216 -0.0108,0 -0.02052,-0.00648 -0.02484,-0.01674 -0.0059,-0.0135 5.4e-4,-0.0297 0.01458,-0.0351 l 0.01404,-0.00594 c 0.0405,-0.01674 0.06102,-0.02538 0.10908,-0.081 0.0097,-0.01188 0.027,-0.01296 0.03834,-0.00324 0.01134,0.00972 0.01242,0.02646 0.0027,0.0378 z\u0027 id\u003d\u0027path67\u0027 style\u003d\u0027fill:%23008000;fill-opacity:1;stroke-width:0.3\u0027 /%3E%3Cpath d\u003d\u0027m -19.277239,-4.3873149 c 0.0027,0.01458 -0.007,0.02808 -0.0216,0.03078 -0.0011,0 -0.01674,0.0027 -0.04752,0.0027 -0.0243,0 -0.05724,-0.00162 -0.09936,-0.00702 -0.01512,-0.00162 -0.02538,-0.01512 -0.02322,-0.03024 0.0016,-0.01458 0.01512,-0.02484 0.03024,-0.02322 0.08748,0.01134 0.13014,0.00486 0.13068,0.00486 0.01458,-0.0027 0.02862,0.00702 0.03078,0.02214 z\u0027 id\u003d\u0027path69\u0027 style\u003d\u0027stroke-width:0.3\u0027 /%3E%3C/g%3E%3C/svg%3E" + }, + "description": "According the storage definition, file may need to be purged", + "appliesTo": [ + "bpmn:Task" + ], + "groups": [ + { + "label": "Input", + "id": "Input" + }, + { + "label": "Output", + "id": "Output" + } + ], + "id": "io.camunda.cherry.files.PurgeFileWorker", + "category": { + "name": "connectors", + "id": "connectors" + }, + "documentationRef": "https://docs.camunda.io/docs/components/modeler/web-modeler/connectors/available-connectors/template/", + "elementType": { + "value": "bpmn:ServiceTask" + }, + "properties": [ + { + "value": "c-files-purge", + "type": "Hidden", + "binding": { + "type": "zeebe:taskDefinition:type" + } + }, + { + "description": "FileVariable used to save", + "binding": { + "name": "sourceFile", + "type": "zeebe:input" + }, + "id": "sourceFile", + "label": "Source file", + "type": "String", + "constraints": { + "notEmpty": true + }, + "group": "Input" + }, + { + "description": "True if the file is purged correctly", + "binding": { + "name": "filePurged_optional", + "type": "zeebe:input" + }, + "id": "filePurged_optional", + "label": "Saved File is purged?", + "type": "Dropdown", + "choices": [ + { + "name": "Yes", + "value": "true" + }, + { + "name": "No", + "value": "false" + } + ], + "value": "false", + "group": "Output" + }, + { + "condition": { + "equals": "true", + "property": "filePurged_optional" + }, + "description": "True if the file is purged correctly", + "binding": { + "source": "\u003d filePurged", + "type": "zeebe:output" + }, + "id": "filePurged", + "label": "File is purged", + "type": "String", + "constraints": { + "notEmpty": true + }, + "group": "Output" + } + ] + } +] \ No newline at end of file diff --git a/element-templates/File Storage_ Save File.json b/element-templates/File Storage_ Save File.json new file mode 100644 index 0000000..5611191 --- /dev/null +++ b/element-templates/File Storage_ Save File.json @@ -0,0 +1,102 @@ +[ + { + "$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json", + "name": "Save a file to disk", + "icon": { + "contents": "data:image/svg+xml,%3C?xml version\u003d\u00271.0\u0027 encoding\u003d\u0027UTF-8\u0027 standalone\u003d\u0027no\u0027?%3E%3Csvg xmlns:dc\u003d\u0027http://purl.org/dc/elements/1.1/\u0027 xmlns:cc\u003d\u0027http://creativecommons.org/ns%23\u0027 xmlns:rdf\u003d\u0027http://www.w3.org/1999/02/22-rdf-syntax-ns%23\u0027 xmlns:svg\u003d\u0027http://www.w3.org/2000/svg\u0027 xmlns\u003d\u0027http://www.w3.org/2000/svg\u0027 version\u003d\u00271.1\u0027 id\u003d\u0027Capa_1\u0027 x\u003d\u00270px\u0027 y\u003d\u00270px\u0027 viewBox\u003d\u00270 0 18 18\u0027 xml:space\u003d\u0027preserve\u0027 width\u003d\u002718\u0027 height\u003d\u002718\u0027%3E%3Cmetadata id\u003d\u0027metadata55\u0027%3E%3Crdf:RDF%3E%3Ccc:Work rdf:about\u003d\u0027\u0027%3E%3Cdc:format%3Eimage/svg+xml%3C/dc:format%3E%3Cdc:type rdf:resource\u003d\u0027http://purl.org/dc/dcmitype/StillImage\u0027 /%3E%3Cdc:title%3E%3C/dc:title%3E%3C/cc:Work%3E%3C/rdf:RDF%3E%3C/metadata%3E%3Cdefs id\u003d\u0027defs53\u0027 /%3E%3Cg id\u003d\u0027g18\u0027 transform\u003d\u0027scale(0.3)\u0027%3E %3Cpath d\u003d\u0027M 30,0 C 13.458,0 0,13.458 0,30 0,46.542 13.458,60 30,60 46.542,60 60,46.542 60,30 60,13.458 46.542,0 30,0 Z m 0,58 C 14.561,58 2,45.439 2,30 2,14.561 14.561,2 30,2 45.439,2 58,14.561 58,30 58,45.439 45.439,58 30,58 Z\u0027 id\u003d\u0027path2\u0027 /%3E %3Cpath d\u003d\u0027M 23.165,8.459 C 23.702,8.329 24.033,7.789 23.904,7.253 23.775,6.716 23.234,6.387 22.698,6.514 18.763,7.46 15.176,9.469 12.322,12.323 9.468,15.177 7.46,18.764 6.514,22.698 c -0.129,0.536 0.202,1.076 0.739,1.206 0.078,0.019 0.157,0.027 0.234,0.027 0.451,0 0.861,-0.308 0.972,-0.767 0.859,-3.575 2.685,-6.836 5.277,-9.429 2.592,-2.593 5.854,-4.417 9.429,-5.276 z\u0027 id\u003d\u0027path4\u0027 /%3E %3Cpath d\u003d\u0027m 52.747,36.096 c -0.538,-0.129 -1.077,0.201 -1.206,0.739 -0.859,3.575 -2.685,6.836 -5.277,9.429 -2.592,2.593 -5.854,4.418 -9.43,5.277 -0.537,0.13 -0.868,0.67 -0.739,1.206 0.11,0.459 0.521,0.767 0.972,0.767 0.077,0 0.156,-0.009 0.234,-0.027 3.936,-0.946 7.523,-2.955 10.377,-5.809 2.854,-2.854 4.862,-6.441 5.809,-10.376 0.128,-0.536 -0.203,-1.076 -0.74,-1.206 z\u0027 id\u003d\u0027path6\u0027 /%3E %3Cpath d\u003d\u0027m 24.452,13.286 c 0.538,-0.125 0.873,-0.663 0.747,-1.2 -0.125,-0.538 -0.665,-0.878 -1.2,-0.747 -3.09,0.72 -5.904,2.282 -8.141,4.52 -2.237,2.236 -3.8,5.051 -4.52,8.141 -0.126,0.537 0.209,1.075 0.747,1.2 0.076,0.019 0.152,0.026 0.228,0.026 0.454,0 0.865,-0.312 0.973,-0.773 0.635,-2.725 2.014,-5.207 3.986,-7.18 1.972,-1.973 4.456,-3.352 7.18,-3.987 z\u0027 id\u003d\u0027path8\u0027 /%3E %3Cpath d\u003d\u0027m 48.661,36.001 c 0.126,-0.537 -0.209,-1.075 -0.747,-1.2 -0.538,-0.133 -1.075,0.209 -1.2,0.747 -0.635,2.725 -2.014,5.207 -3.986,7.18 -1.972,1.973 -4.455,3.352 -7.18,3.986 -0.538,0.125 -0.873,0.663 -0.747,1.2 0.107,0.462 0.519,0.773 0.973,0.773 0.075,0 0.151,-0.008 0.228,-0.026 3.09,-0.72 5.904,-2.282 8.141,-4.52 2.236,-2.236 3.798,-5.05 4.518,-8.14 z\u0027 id\u003d\u0027path10\u0027 /%3E %3Cpath d\u003d\u0027m 26.495,16.925 c -0.119,-0.541 -0.653,-0.879 -1.19,-0.763 -4.557,0.997 -8.146,4.586 -9.143,9.143 -0.118,0.539 0.224,1.072 0.763,1.19 0.072,0.016 0.144,0.023 0.215,0.023 0.46,0 0.873,-0.318 0.976,-0.786 0.831,-3.796 3.821,-6.786 7.617,-7.617 0.538,-0.118 0.88,-0.651 0.762,-1.19 z\u0027 id\u003d\u0027path12\u0027 /%3E %3Cpath d\u003d\u0027m 43.838,34.695 c 0.118,-0.539 -0.224,-1.072 -0.763,-1.19 -0.54,-0.118 -1.072,0.222 -1.19,0.763 -0.831,3.796 -3.821,6.786 -7.617,7.617 -0.539,0.118 -0.881,0.651 -0.763,1.19 0.103,0.468 0.516,0.786 0.976,0.786 0.071,0 0.143,-0.008 0.215,-0.023 4.556,-0.997 8.145,-4.586 9.142,-9.143 z\u0027 id\u003d\u0027path14\u0027 /%3E %3Cpath d\u003d\u0027m 38.08,30 c 0,-4.455 -3.625,-8.08 -8.08,-8.08 -4.455,0 -8.08,3.625 -8.08,8.08 0,4.455 3.625,8.08 8.08,8.08 4.455,0 8.08,-3.625 8.08,-8.08 z M 30,36.08 c -3.353,0 -6.08,-2.728 -6.08,-6.08 0,-3.352 2.728,-6.08 6.08,-6.08 3.352,0 6.08,2.728 6.08,6.08 0,3.352 -2.727,6.08 -6.08,6.08 z\u0027 id\u003d\u0027path16\u0027 /%3E%3C/g%3E%3Cg id\u003d\u0027g20\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g22\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g24\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g26\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g28\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g30\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g32\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g34\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g36\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g38\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g40\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g42\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g44\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g46\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g48\u0027%3E%3C/g%3E%3Cg id\u003d\u0027g85\u0027 transform\u003d\u0027matrix(1.1259408,0,0,1.1259408,33.760593,8.6647721)\u0027%3E%3Cpath d\u003d\u0027m -15.969199,-1.3973349 c -0.04428,0.56592004 -0.49572,0.83754004 -0.58752,0.88722004 -0.4887,0.26676 -1.31112,0.17388 -1.70856,-0.38556 -0.21924,-0.30780004 -0.3294,-0.79758004 -0.1161,-1.13670004 l 0.0027,-0.0054 c 0.07668,-0.12474 0.25434,-0.33534 0.58212,-0.34236 h 0.01188 c 0.11718,0 0.25218,0.03564 0.37152,0.06696 0.0837,0.02214 0.15606,0.04104 0.21006,0.04482 0.03402,0.00216 0.08262,-0.00648 0.14418,-0.01728 0.18414,-0.0324 0.4914,-0.0864 0.76032,0.10368 0.36612,0.2597403 0.33156,0.76356 0.3294,0.78462 z\u0027 id\u003d\u0027path57\u0027 style\u003d\u0027fill:%23aa0000;fill-opacity:1;stroke-width:0.3\u0027 /%3E%3Cpath d\u003d\u0027m -18.207499,-2.3007546 c -0.1053,0.07452 -0.17496,0.16686 -0.21708,0.2349 l -0.0027,0.00432 c -0.10908,0.17388 -0.13932,0.37584 -0.1188,0.57348 -0.0022,0.00108 -0.0043,0.00216 -0.0059,0.00378 -0.40014,0.3267 -0.85212,0.24246 -1.02762,0.19116 l -0.01026,-0.0027 c -0.5589,-0.13932 -1.11078,-0.74304 -1.00926,-1.38618 0.05616,-0.35424 0.324,-0.7614 0.72792,-0.85428 0.06966,-0.0162 0.43362,-0.0837 0.7263,0.16146 0.08964,0.0756 0.15606,0.1857601 0.21438,0.28296 0.04158,0.0702 0.07776,0.13014 0.11718,0.16956 0.02538,0.02538 0.06966,0.05022 0.12582,0.08208 0.1647,0.09234 0.4131,0.2322001 0.4779,0.53352 5.4e-4,0.00216 0.0011,0.00432 0.0022,0.00594 z\u0027 id\u003d\u0027path59\u0027 style\u003d\u0027fill:%23aa0000;fill-opacity:1;stroke-width:0.3\u0027 /%3E%3Cpath d\u003d\u0027m -17.110219,-2.3309949 c -0.03186,0.0054 -0.05994,0.00918 -0.07992,0.00918 -0.0032,0 -0.0065,-5.4e-4 -0.0092,-5.4e-4 -0.01512,-0.00108 -0.03294,-0.00324 -0.05184,-0.00702 0.16578,-0.42336 0.23436,-1.10052 -0.34182,-1.95804 -0.0011,-0.00216 -0.0027,-0.00378 -0.0049,-0.0054 0.03348,-0.13284 0.04482,-0.22572 0.04752,-0.2484 0.0016,-0.01512 -0.0092,-0.02808 -0.02376,-0.0297 -0.01512,-0.00216 -0.02808,0.00918 -0.0297,0.02376 -0.0065,0.05778 -0.07128,0.5788801 -0.4347,1.0416602 -0.22734,0.28944 -0.58536,0.5049 -0.70902,0.56646 -0.01134,-0.00756 -0.02106,-0.01512 -0.02754,-0.0216 -0.01782,-0.01782 -0.0351,-0.04104 -0.05292,-0.06858 0.01026,-0.0054 0.02106,-0.01134 0.0324,-0.01728 0.12906,-0.06912 0.34506,-0.1841401 0.60858,-0.4600801 0.31158,-0.32616 0.37098,-0.82566 0.2835,-0.96174 -0.04212,-0.06588 -0.10962,-0.07236 -0.16362,-0.07722 -0.07074,-0.00594 -0.1134,-0.01026 -0.12096,-0.10638 -0.007,-0.0837 0.0324,-0.15768 0.1107,-0.20736 0.1053,-0.0675 0.29376,-0.0891 0.47628,0.01458 0.11394,0.06426 0.11286,0.17388 0.11232,0.27972 -5.4e-4,0.07074 -0.0011,0.1377 0.03402,0.18576 l 0.01512,0.02052 c 0.0864,0.1171801 0.28836,0.3904201 0.40932,0.86724 0.12906,0.5102999 0.007,0.9752399 -0.07992,1.1604599 z\u0027 id\u003d\u0027path61\u0027 style\u003d\u0027fill:%23502d16;fill-opacity:1;stroke-width:0.3\u0027 /%3E%3Cpath d\u003d\u0027m -18.698899,-4.5455348 c -0.0043,0.00216 -0.0086,0.00324 -0.01296,0.00324 -0.0097,0 -0.0189,-0.0054 -0.02376,-0.01404 -5.4e-4,-5.4e-4 -0.03834,-0.06804 -0.10638,-0.13014 -0.01134,-0.00972 -0.01188,-0.027 -0.0022,-0.0378 0.01026,-0.01134 0.027,-0.01188 0.03834,-0.00216 0.07506,0.06804 0.11556,0.14094 0.11718,0.14418 0.0076,0.01296 0.0027,0.02916 -0.01026,0.03672 z\u0027 id\u003d\u0027path63\u0027 style\u003d\u0027stroke-width:0.3\u0027 /%3E%3Cpath d\u003d\u0027m -18.644359,-4.0309149 c -0.05616,0.06642 -0.08532,0.0783 -0.1296,0.09612 l -0.01404,0.00594 c -0.0032,0.00162 -0.007,0.00216 -0.01026,0.00216 -0.0108,0 -0.02052,-0.00648 -0.02484,-0.01674 -0.0059,-0.0135 5.4e-4,-0.0297 0.01458,-0.0351 l 0.01404,-0.00594 c 0.0405,-0.01674 0.06102,-0.02538 0.10908,-0.081 0.0097,-0.01188 0.027,-0.01296 0.03834,-0.00324 0.01134,0.00972 0.01242,0.02646 0.0027,0.0378 z\u0027 id\u003d\u0027path65\u0027 style\u003d\u0027stroke-width:0.3\u0027 /%3E%3Cpath d\u003d\u0027m -17.948839,-4.4391548 c -0.01404,-0.02214 -0.0324,-0.03402 -0.05292,-0.0405 -0.07182,0.09666 -0.32454,0.243 -0.57834,0.243 -0.0675,0 -0.13554,-0.01026 -0.1998,-0.03456 -0.1728,-0.06588 -0.29106,-0.15768 -0.40554,-0.24624 -0.09072,-0.07074 -0.17658,-0.13716 -0.28134,-0.18252 -0.01404,-0.00648 -0.01998,-0.02214 -0.01404,-0.03564 0.0059,-0.01404 0.0216,-0.01998 0.03564,-0.01404 0.1107,0.0486 0.19926,0.11664 0.29268,0.18954 0.11124,0.0864 0.2268,0.1755 0.3915,0.23814 0.16794,0.06372 0.3564,0.02214 0.4995,-0.04212 -0.06156,-0.19008 -0.45954,-0.76842 -1.11564,-0.6210001 -0.10152,0.02268 -0.19008,0.04374 -0.26784,0.0621 -0.3294,0.07722 -0.47034,0.11016 -0.61668,0.07128 0.0135,0.06804 0.04914,0.12582 0.10584,0.17226 0.1134,0.09126 0.2781,0.11394 0.3564,0.11502 -0.03996,-0.04536 -0.08262,-0.07452 -0.135,-0.09288 -0.01404,-0.00486 -0.0216,-0.01998 -0.01674,-0.03402 0.0049,-0.01458 0.02052,-0.0216 0.03456,-0.01674 0.1701,0.05994 0.2484,0.21222 0.37476,0.5227201 0.1323,0.32508 0.59508,0.62802 0.97038,0.5157 0.38232,-0.11448 0.37584,-0.51732 0.3753,-0.52164 0,-0.0108 0.0065,-0.02106 0.0162,-0.02538 0.02538,-0.01134 0.15552,-0.07074 0.24732,-0.15714 0.0016,-0.00162 0.0032,-0.0027 0.0049,-0.0027 v -5.4e-4 c -0.0043,-0.02646 -0.01188,-0.04752 -0.02106,-0.0621 m -0.89532,-0.2851201 c 0.01026,-0.01134 0.027,-0.01188 0.03834,-0.00216 0.07506,0.06804 0.11556,0.14094 0.11718,0.14418 0.0076,0.01296 0.0027,0.02916 -0.01026,0.03672 -0.0043,0.00216 -0.0086,0.00324 -0.01296,0.00324 -0.0097,0 -0.0189,-0.0054 -0.02376,-0.01404 -5.4e-4,-5.4e-4 -0.03834,-0.06804 -0.10638,-0.13014 -0.01134,-0.00972 -0.01188,-0.027 -0.0022,-0.0378 m -0.45468,0.36774 c -0.0011,0 -0.01674,0.0027 -0.04752,0.0027 -0.0243,0 -0.05724,-0.00162 -0.09936,-0.00702 -0.01512,-0.00162 -0.02538,-0.01512 -0.02322,-0.03024 0.0016,-0.01458 0.01512,-0.02484 0.03024,-0.02322 0.08748,0.01134 0.13014,0.00486 0.13068,0.00486 0.01458,-0.0027 0.02862,0.00702 0.03078,0.02214 0.0027,0.01458 -0.007,0.02808 -0.0216,0.03078 m 0.65448,0.32562 c -0.05616,0.06642 -0.08532,0.0783 -0.1296,0.09612 l -0.01404,0.00594 c -0.0032,0.00162 -0.007,0.00216 -0.01026,0.00216 -0.0108,0 -0.02052,-0.00648 -0.02484,-0.01674 -0.0059,-0.0135 5.4e-4,-0.0297 0.01458,-0.0351 l 0.01404,-0.00594 c 0.0405,-0.01674 0.06102,-0.02538 0.10908,-0.081 0.0097,-0.01188 0.027,-0.01296 0.03834,-0.00324 0.01134,0.00972 0.01242,0.02646 0.0027,0.0378 z\u0027 id\u003d\u0027path67\u0027 style\u003d\u0027fill:%23008000;fill-opacity:1;stroke-width:0.3\u0027 /%3E%3Cpath d\u003d\u0027m -19.277239,-4.3873149 c 0.0027,0.01458 -0.007,0.02808 -0.0216,0.03078 -0.0011,0 -0.01674,0.0027 -0.04752,0.0027 -0.0243,0 -0.05724,-0.00162 -0.09936,-0.00702 -0.01512,-0.00162 -0.02538,-0.01512 -0.02322,-0.03024 0.0016,-0.01458 0.01512,-0.02484 0.03024,-0.02322 0.08748,0.01134 0.13014,0.00486 0.13068,0.00486 0.01458,-0.0027 0.02862,0.00702 0.03078,0.02214 z\u0027 id\u003d\u0027path69\u0027 style\u003d\u0027stroke-width:0.3\u0027 /%3E%3C/g%3E%3C/svg%3E" + }, + "description": "Save a file from a storage definition to a disk", + "appliesTo": [ + "bpmn:Task" + ], + "groups": [ + { + "label": "Input", + "id": "Input" + } + ], + "id": "io.camunda.cherry.files.SaveFileToDiskWorker", + "category": { + "name": "connectors", + "id": "connectors" + }, + "documentationRef": "https://docs.camunda.io/docs/components/modeler/web-modeler/connectors/available-connectors/template/", + "elementType": { + "value": "bpmn:ServiceTask" + }, + "properties": [ + { + "value": "c-files-save-to-disk", + "type": "Hidden", + "binding": { + "type": "zeebe:taskDefinition:type" + } + }, + { + "description": "Folder where the file will be save", + "binding": { + "name": "folder", + "type": "zeebe:input" + }, + "id": "folder", + "label": "Folder to save", + "type": "String", + "constraints": { + "notEmpty": true + }, + "group": "Input" + }, + { + "description": "File name used to save the file. If not provided, fileVariable name is used", + "binding": { + "name": "fileName_optional", + "type": "zeebe:input" + }, + "id": "fileName_optional", + "label": "Provide File name?", + "type": "Dropdown", + "choices": [ + { + "name": "Yes", + "value": "true" + }, + { + "name": "No", + "value": "false" + } + ], + "value": "false", + "group": "Input" + }, + { + "condition": { + "equals": "true", + "property": "fileName_optional" + }, + "description": "File name used to save the file. If not provided, fileVariable name is used", + "binding": { + "name": "fileName", + "type": "zeebe:input" + }, + "id": "fileName", + "label": "File name", + "type": "String", + "group": "Input" + }, + { + "description": "FileVariable used to save", + "binding": { + "name": "sourceFile", + "type": "zeebe:input" + }, + "id": "sourceFile", + "label": "Source file", + "type": "String", + "constraints": { + "notEmpty": true + }, + "group": "Input" + } + ] + } +] \ No newline at end of file diff --git a/element-templates/Ping Object connector.json b/element-templates/Ping Object connector.json new file mode 100644 index 0000000..9637802 --- /dev/null +++ b/element-templates/Ping Object connector.json @@ -0,0 +1,172 @@ +[ + { + "$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json", + "name": "Ping (Object ConnectorSDK)", + "icon": { + "contents": "data:image/svg+xml,%3C?xml version\u003d\u00271.0\u0027 encoding\u003d\u0027UTF-8\u0027 standalone\u003d\u0027no\u0027?%3E%3Csvg xmlns:dc\u003d\u0027http://purl.org/dc/elements/1.1/\u0027 xmlns:cc\u003d\u0027http://creativecommons.org/ns%23\u0027 xmlns:rdf\u003d\u0027http://www.w3.org/1999/02/22-rdf-syntax-ns%23\u0027 xmlns:svg\u003d\u0027http://www.w3.org/2000/svg\u0027 xmlns\u003d\u0027http://www.w3.org/2000/svg\u0027 width\u003d\u002718\u0027 height\u003d\u002718\u0027 viewBox\u003d\u00270 0 16.875 16.875\u0027 id\u003d\u0027svg15795\u0027 version\u003d\u00271.1\u0027%3E %3Cdefs id\u003d\u0027defs15797\u0027%3E %3CradialGradient r\u003d\u0027255.59\u0027 gradientTransform\u003d\u0027matrix(-0.12272793,0,0,0.12272793,-1807.3634,-1063.9497)\u0027 cx\u003d\u0027-464.92001\u0027 cy\u003d\u0027873.19\u0027 gradientUnits\u003d\u0027userSpaceOnUse\u0027 id\u003d\u0027radialGradient3026-9-1\u0027%3E %3Cstop offset\u003d\u0027.5\u0027 style\u003d\u0027stop-color:%23ffd046;stop-opacity:1\u0027 id\u003d\u0027stop48-0-2\u0027 /%3E %3Cstop offset\u003d\u00271\u0027 style\u003d\u0027stop-color:%23f0a957;stop-opacity:1\u0027 id\u003d\u0027stop50-8-9\u0027 /%3E %3C/radialGradient%3E %3C/defs%3E %3Cmetadata id\u003d\u0027metadata15800\u0027%3E %3Crdf:RDF%3E %3Ccc:Work rdf:about\u003d\u0027\u0027%3E %3Cdc:format%3Eimage/svg+xml%3C/dc:format%3E %3Cdc:type rdf:resource\u003d\u0027http://purl.org/dc/dcmitype/StillImage\u0027 /%3E %3Cdc:title%3E%3C/dc:title%3E %3C/cc:Work%3E %3C/rdf:RDF%3E %3C/metadata%3E %3Cg id\u003d\u0027layer1\u0027 transform\u003d\u0027translate(-333.12983,-288.31523)\u0027%3E %3Cg transform\u003d\u0027matrix(0.36709704,0,0,0.36709704,986.33222,642.92532)\u0027 style\u003d\u0027display:inline\u0027 id\u003d\u0027g15745\u0027%3E %3Cpath d\u003d\u0027m -1764.6075,-935.9985 c 0,0 3.8003,2.04759 9.6285,4.07616 3.5202,1.22728 9.7726,-0.84277 13.0276,-1.70481 3.26,-0.86511 8.8927,-2.65449 7.3298,-4.21743 -1.5631,-1.56257 -6.0571,-4.89537 -6.0571,-4.89537 0,0 4.2789,7.06582 -23.9295,6.74145 z\u0027 style\u003d\u0027fill:%23ffffff;stroke:%23000000;stroke-width:1.89946;stroke-linejoin:round;stroke-opacity:1\u0027 id\u003d\u0027path9-1-4\u0027 /%3E %3Cpath id\u003d\u0027path13-3-8\u0027 style\u003d\u0027fill:%23ffffff;stroke:%23000000;stroke-width:1.89946;stroke-linejoin:round;stroke-opacity:1\u0027 d\u003d\u0027m -1738.5952,-941.13712 c 0,2.98008 -8.9157,5.39684 -19.915,5.39684 -10.9985,0 -19.9126,-2.41639 -19.9126,-5.39684 2.2937,-1.66297 1.9624,-3.06329 1.9624,-3.06329 h 35.9961 c 0,0 -0.3197,1.39983 1.8691,3.06255 z\u0027 /%3E %3Cpath d\u003d\u0027m -1774.2711,-954.86792 c 0.4453,-1.01594 2.1705,-4.52486 5.6775,-6.995 6.3577,-4.4835 14.2414,-3.62821 18.8768,-0.93691 3.1324,1.82227 5.2903,4.17054 7.0001,7.61821 0.4172,0.84216 1.1951,2.63915 1.7282,5.20993 0.4613,2.22972 0.5058,3.63581 0.58,5.97108 0,1.95125 -3.7069,3.71117 -10.0877,4.56818 -8.93,1.19586 -19.7224,0.15709 -24.1026,-2.3198 -1.2534,-0.70839 -1.8451,-1.46218 -1.8426,-2.19634 0.092,-3.01727 0.204,-6.43549 2.1707,-10.91935 z\u0027 style\u003d\u0027fill:%23ffffff;stroke-linejoin:round\u0027 id\u003d\u0027path19-3-0\u0027 /%3E %3Cpath d\u003d\u0027m -1774.2711,-954.86792 c 0.4453,-1.01594 2.1705,-4.52486 5.6775,-6.995 6.3577,-4.4835 14.2414,-3.62821 18.8768,-0.93691 3.1324,1.82227 5.2903,4.17054 7.0001,7.61821 0.4172,0.84216 1.1951,2.63915 1.7282,5.20993 0.4613,2.22972 0.5058,3.63581 0.58,5.97108 0,1.95125 -3.7069,3.71117 -10.0877,4.56818 -8.93,1.19586 -19.7224,0.15709 -24.1026,-2.3198 -1.2534,-0.70839 -1.8451,-1.46218 -1.8426,-2.19634 0.092,-3.01727 0.204,-6.43549 2.1707,-10.91935 z\u0027 style\u003d\u0027fill:%2374fc00;fill-opacity:1;stroke:%23000000;stroke-width:1.89946;stroke-linejoin:round;stroke-opacity:1\u0027 id\u003d\u0027path23-1-6\u0027 /%3E %3Cpath d\u003d\u0027m -1764.7572,-936.08809 c 0,0 3.8014,2.04415 9.6284,4.07591 3.5189,1.22483 9.7706,-0.84277 13.0263,-1.70788 3.2599,-0.86192 8.8934,-2.65141 7.3303,-4.21754 -1.5629,-1.56233 -6.0547,-4.89329 -6.0547,-4.89329 0,0 4.277,7.06618 -23.9307,6.7428 z\u0027 style\u003d\u0027fill:%23ffbd34;fill-opacity:1;stroke:%23ffbd34;stroke-width:0.633166;stroke-linejoin:round;stroke-opacity:1\u0027 id\u003d\u0027path27-6-0\u0027 /%3E %3Cpath id\u003d\u0027path31-3-3\u0027 style\u003d\u0027fill:%23ffbd34;fill-opacity:1;stroke:%23ffbd34;stroke-width:0.633166;stroke-linejoin:round;stroke-opacity:1\u0027 d\u003d\u0027m -1738.7453,-941.22671 c 0,2.98032 -8.913,5.39499 -19.9138,5.39499 -10.998,0 -19.9138,-2.41405 -19.9138,-5.39499 2.2952,-1.66272 1.961,-3.06243 1.961,-3.06243 h 35.9986 c 0,0 -0.214,1.63369 1.9731,3.29629 z\u0027 /%3E %3Cpath d\u003d\u0027m -1774.422,-954.95874 c 0.4452,-1.01521 2.1713,-4.52265 5.6774,-6.99513 6.357,-4.48337 14.2401,-3.6271 18.8767,-0.93616 3.1344,1.82238 5.2911,4.17041 6.9995,7.61526 0.418,0.84216 1.1977,2.63915 1.7282,5.21128 0.46,2.22825 0.505,3.63557 0.5804,5.96789 0,1.95137 -3.7087,3.71424 -10.0905,4.5683 -8.9296,1.19893 -19.7211,0.15697 -24.1,-2.31993 -1.2535,-0.70838 -1.8464,-1.45948 -1.8437,-2.19633 0.096,-3.01248 0.2077,-6.43119 2.1721,-10.91518 z\u0027 style\u003d\u0027fill:%23ffd520;stroke-linejoin:round\u0027 id\u003d\u0027path37-0-6\u0027 /%3E %3Cpath d\u003d\u0027m -1774.422,-954.95874 c 0.4452,-1.01521 2.1713,-4.52265 5.6774,-6.99513 6.357,-4.48337 14.2401,-3.6271 18.8767,-0.93616 3.1344,1.82238 5.2911,4.17041 6.9995,7.61526 0.418,0.84216 1.1977,2.63915 1.7282,5.21128 0.46,2.22825 0.505,3.63557 0.5804,5.96789 0,1.95137 -3.7087,3.71424 -10.0905,4.5683 -8.9296,1.19893 -19.7211,0.15697 -24.1,-2.31993 -1.2535,-0.70838 -1.8464,-1.45948 -1.8437,-2.19633 0.096,-3.01248 0.2077,-6.43119 2.1721,-10.91518 z\u0027 style\u003d\u0027fill:none;stroke:%23000000;stroke-width:0.633166;stroke-linejoin:round\u0027 id\u003d\u0027path41-6-5\u0027 /%3E %3Cpath d\u003d\u0027m -1774.422,-954.95874 c 0.4452,-1.01521 2.1713,-4.52265 5.6774,-6.99513 6.357,-4.48337 14.2401,-3.6271 18.8767,-0.93616 3.1344,1.82238 5.2911,4.17041 6.9995,7.61526 0.418,0.84216 1.1977,2.63915 1.7282,5.21128 0.46,2.22825 0.505,3.63557 0.5804,5.96789 0,1.95137 -3.7087,3.71424 -10.0905,4.5683 -8.9296,1.19893 -19.7211,0.15697 -24.1,-2.31993 -1.2535,-0.70838 -1.8464,-1.45948 -1.8437,-2.19633 0.096,-3.01248 0.2077,-6.43119 2.1721,-10.91518 z\u0027 style\u003d\u0027fill:url(%23radialGradient3026-9-1);stroke:%23fac44b;stroke-linejoin:round;stroke-opacity:1\u0027 id\u003d\u0027path52-0-7\u0027 /%3E %3Cpath d\u003d\u0027m -1767.915,-962.62629 c 13.3737,-8.528 26.9474,8.98687 26.5227,20.23415 l 1.2441,0.50196 c -7e-4,-12.25929 -13.2853,-30.32975 -27.7672,-20.73611\u0027 style\u003d\u0027fill:%23cccccc;stroke-linejoin:round\u0027 id\u003d\u0027path60-2-9\u0027 /%3E %3Cpolygon transform\u003d\u0027matrix(-0.12272793,0,0,0.12272793,-1731.9594,-974.55471)\u0027 id\u003d\u0027polygon62-6-3\u0027 style\u003d\u0027fill:%23cccccc;stroke-linejoin:round\u0027 points\u003d\u002776.865,262.06 61.197,281.15 66.729,266.15 \u0027 /%3E %3Cpath d\u003d\u0027m -1745.3502,-940.13566 c 0,-11.09583 -6.6212,-28.38329 -18.6117,-24.45845 12.8582,-4.35218 23.8104,11.56833 23.8104,22.70098 l 0.6789,1.84129 -5.2013,1.75427 -0.6765,-1.83772 z\u0027 style\u003d\u0027fill:%23ffd467;fill-opacity:1;stroke:none;stroke-width:0.633166;stroke-linecap:round;stroke-linejoin:round\u0027 id\u003d\u0027path64-7-7\u0027 /%3E %3Cpath d\u003d\u0027m -1745.349,-940.13566 0.6782,1.84141 -3.0497,-2.13755 c 0.4259,-11.24802 -6.82,-30.72126 -20.1949,-22.19658 14.4819,-9.59106 22.566,10.23183 22.566,22.49358 z\u0027 style\u003d\u0027fill:%23cccccc;stroke-linejoin:round\u0027 id\u003d\u0027path70-9-2\u0027 /%3E %3Cpath d\u003d\u0027m -1745.349,-940.13566 0.6782,1.84141 -3.0497,-2.13755 c 0.4259,-11.24802 -6.82,-30.72126 -20.1949,-22.19658 14.4819,-9.59106 22.566,10.23183 22.566,22.49358 z\u0027 style\u003d\u0027fill:%23ffbd34;fill-opacity:1;stroke:none;stroke-width:0.633166;stroke-linecap:round;stroke-linejoin:round\u0027 id\u003d\u0027path74-7-4\u0027 /%3E %3Cpolygon transform\u003d\u0027matrix(-0.12272793,0,0,0.12272793,-1731.9594,-974.55471)\u0027 id\u003d\u0027polygon78-8-4\u0027 style\u003d\u0027fill:%23ffbd34;fill-opacity:1;stroke:%23ffbd34;stroke-width:5.1591;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1\u0027 points\u003d\u0027267.24,277.31 253.03,251.64 254.68,222.57 265.49,233.41 \u0027 /%3E %3Cpolygon style\u003d\u0027stroke-linejoin:round\u0027 transform\u003d\u0027matrix(-0.12272793,0,0,0.12272793,-1731.9594,-974.55471)\u0027 id\u003d\u0027polygon80-2-4\u0027 points\u003d\u0027329.73,266.98 320.7,241.3 322.32,217.4 327.99,223.07 \u0027 /%3E %3Cpath id\u003d\u0027path82-9-3\u0027 style\u003d\u0027fill:%23ffd467;fill-opacity:1;stroke:%23ffd467;stroke-width:0.633166;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1\u0027 d\u003d\u0027m -1764.7572,-940.52103 c 0,0 -7.3005,-0.90536 -7.6667,-1.27121 -0.3672,-0.36291 0.2126,-5.38788 0.2126,-5.38788 l 7.6696,1.26802 z\u0027 /%3E %3Cpolygon transform\u003d\u0027matrix(-0.12272793,0,0,0.12272793,-1731.9594,-974.55471)\u0027 id\u003d\u0027polygon84-9-0\u0027 style\u003d\u0027fill:%23f4b253;fill-opacity:1;stroke:%23f4b253;stroke-width:5.1591;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1\u0027 points\u003d\u0027254.68,222.57 265.49,233.41 327.99,223.07 317.16,212.24 \u0027 /%3E %3C/g%3E %3Cg id\u003d\u0027g48\u0027 transform\u003d\u0027matrix(0.29730774,0,0,0.29730774,336.52636,289.85483)\u0027%3E %3Cpath d\u003d\u0027m 16.7328,13.29858 c -0.1476,1.8864 -1.6524,2.7918 -1.9584,2.9574 -1.629,0.8892 -4.3704,0.5796 -5.6952001,-1.2852 -0.7308,-1.026 -1.098,-2.6586 -0.387,-3.789 l 0.009,-0.018 c 0.2556,-0.4158 0.8478,-1.1178 1.9404001,-1.1412 h 0.0396 c 0.3906,0 0.8406,0.1188 1.2384,0.2232 0.279,0.0738 0.5202,0.1368 0.7002,0.1494 0.1134,0.0072 0.2754,-0.0216 0.4806,-0.0576 0.6138,-0.108 1.638,-0.288 2.5344,0.3456 1.2204,0.865801 1.1052,2.5452 1.098,2.6154 z\u0027 id\u003d\u0027path2\u0027 style\u003d\u0027fill:%23aa0000;fill-opacity:1\u0027 /%3E %3Cpath d\u003d\u0027m 9.2718,10.287181 c -0.351,0.2484 -0.5832,0.5562 -0.7236,0.783 l -0.009,0.0144 c -0.3636001,0.5796 -0.4644,1.2528 -0.3960001,1.9116 -0.0072,0.0036 -0.0144,0.0072 -0.0198,0.0126 -1.3338001,1.089 -2.8404,0.8082 -3.4254003,0.6372 l -0.0342,-0.009 c -1.8630002,-0.4644 -3.70259996,-2.4768 -3.3642,-4.6206 0.1872,-1.1808001 1.08,-2.538 2.4264,-2.8476 0.2322,-0.054 1.4454,-0.279 2.421,0.5382 0.2988,0.252 0.5202,0.6192001 0.7146,0.9432 0.1386,0.234 0.2592,0.4338 0.3906001,0.5652 0.0846,0.0846 0.2322,0.1674 0.4194,0.2736 0.549,0.3078001 1.3770001,0.7740001 1.5930002,1.7784 0.0018,0.0072 0.0036,0.0144 0.0072,0.0198 z\u0027 id\u003d\u0027path4\u0027 style\u003d\u0027fill:%23aa0000;fill-opacity:1\u0027 /%3E %3Cpath d\u003d\u0027m 12.9294,10.18638 c -0.1062,0.018 -0.1998,0.0306 -0.2664,0.0306 -0.0108,0 -0.0216,-0.0018 -0.0306,-0.0018 -0.0504,-0.0036 -0.1098,-0.0108 -0.1728,-0.0234 0.5526,-1.4112 0.7812,-3.6684 -1.1394,-6.5268 -0.0036,-0.0072 -0.009,-0.0126 -0.0162,-0.018 0.1116,-0.4428 0.1494,-0.7524 0.1584,-0.828 0.0054,-0.0504 -0.0306,-0.0936 -0.0792,-0.099 -0.0504,-0.0072 -0.0936,0.0306 -0.099,0.0792 -0.0216,0.1926 -0.2376,1.9296001 -1.4490001,3.4722004 -0.7578001,0.9648001 -1.9512001,1.6830001 -2.3634002,1.8882 -0.0378,-0.0252 -0.0702,-0.0504 -0.0918,-0.072 -0.0594,-0.0594 -0.117,-0.1368 -0.1764,-0.2286 0.0342,-0.018 0.0702,-0.0378 0.108,-0.0576 0.4302,-0.2304 1.1502,-0.6138001 2.0286002,-1.5336001 1.0386001,-1.0872 1.2366001,-2.7522001 0.9450001,-3.2058 -0.1404,-0.2196 -0.3654001,-0.2412 -0.5454001,-0.2574 -0.2358,-0.0198 -0.378,-0.0342 -0.4032,-0.3546 -0.0234,-0.279 0.108,-0.5256 0.369,-0.6912 0.3510001,-0.225 0.9792001,-0.297 1.5876001,0.0486 0.3798,0.2142 0.3762,0.5796 0.3744,0.9324 -0.0018,0.2358 -0.0036,0.459 0.1134,0.6192 l 0.0504,0.0684 c 0.288,0.3906001 0.9612,1.3014001 1.3644,2.8908 C 13.626,8.01918 13.2192,9.56898 12.9294,10.18638 Z\u0027 id\u003d\u0027path6\u0027 style\u003d\u0027fill:%23502d16;fill-opacity:1\u0027 /%3E %3Cpath d\u003d\u0027m 7.6338,2.8045802 c -0.0144,0.0072 -0.0288,0.0108 -0.0432,0.0108 -0.0324,0 -0.063,-0.018 -0.0792,-0.0468 -0.0018,-0.0018 -0.1278,-0.2268 -0.3546,-0.4338 -0.0378,-0.0324 -0.0396,-0.09 -0.0072,-0.126 0.0342,-0.0378 0.09,-0.0396 0.1278,-0.0072 0.2502,0.2268 0.3852,0.4698 0.3906,0.4806 0.025201,0.0432 0.009,0.0972 -0.0342,0.1224 z\u0027 id\u003d\u0027path8\u0027 /%3E %3Cpath d\u003d\u0027m 7.8156,4.51998 c -0.1872,0.2214 -0.2844,0.261 -0.432,0.3204 l -0.0468,0.0198 c -0.0108,0.0054 -0.0234,0.0072 -0.0342,0.0072 -0.036,0 -0.0684,-0.0216 -0.0828,-0.0558 -0.0198,-0.045 0.0018,-0.099 0.0486,-0.117 l 0.0468,-0.0198 c 0.135,-0.0558 0.2034,-0.0846 0.3636,-0.27 0.0324,-0.0396 0.09,-0.0432 0.1278,-0.0108 0.0378,0.0324 0.0414,0.0882 0.009,0.126 z\u0027 id\u003d\u0027path10\u0027 /%3E %3Cpath d\u003d\u0027m 10.134,3.1591802 c -0.0468,-0.0738 -0.108,-0.1134 -0.1764,-0.135 -0.2394,0.3222 -1.0818001,0.81 -1.9278,0.81 -0.225,0 -0.4518,-0.0342 -0.666,-0.1152 -0.576,-0.2196 -0.9702,-0.5256 -1.3518001,-0.8208 -0.3024,-0.2358 -0.5886,-0.4572 -0.9378,-0.6084001 -0.0468,-0.0216 -0.0666,-0.0738 -0.0468,-0.1188 0.0198,-0.0468 0.072,-0.0666 0.1188,-0.0468 0.369,0.162 0.6642,0.3888001 0.9756,0.6318 0.3708,0.2880001 0.756,0.5850001 1.3050001,0.7938 0.5598,0.2124 1.1880001,0.0738 1.6650001,-0.1404 -0.2052,-0.6336 -1.5318002,-2.56139997 -3.7188,-2.0700002 -0.3384,0.0756 -0.6336,0.1458 -0.8928,0.207 -1.098,0.2574 -1.5678,0.3672001 -2.0556002,0.2376 0.045,0.2268001 0.1638,0.4194 0.3528,0.5742001 0.378,0.3042 0.927,0.3798 1.1880001,0.3834 C 3.8322,2.59038 3.69,2.49318 3.5154,2.43198 3.4686,2.41578 3.4434,2.36538 3.4596,2.31858 c 0.0162,-0.0486 0.0684,-0.072 0.1152,-0.0558 0.567,0.1998 0.828,0.7074 1.2492001,1.7424002 0.441,1.0836 1.9836001,2.0934 3.2346,1.7190001 1.2744,-0.3816 1.2528001,-1.7244 1.251,-1.7388 0,-0.036 0.0216,-0.0702 0.054,-0.0846 0.0846,-0.0378 0.5184,-0.2358 0.8243999,-0.5238 0.0054,-0.0054 0.0108,-0.009 0.0162,-0.009 v -0.0018 C 10.1898,3.27798 10.1646,3.20778 10.134,3.1591802 M 7.1496005,2.20878 c 0.0342,-0.0378 0.09,-0.0396 0.1278,-0.0072 0.2502,0.2268 0.3852,0.4698 0.3906,0.4806 0.0252,0.0432 0.009,0.0972 -0.0342,0.1224 -0.0144,0.0072 -0.0288,0.0108 -0.0432,0.0108 -0.0324,0 -0.063,-0.018 -0.0792,-0.0468 -0.0018,-0.0018 -0.1278,-0.2268 -0.3546,-0.4338 -0.037801,-0.0324 -0.0396,-0.09 -0.0072,-0.126 m -1.5156002,1.2258 c -0.0036,0 -0.0558,0.009 -0.1584,0.009 -0.081,0 -0.1908,-0.0054 -0.3312,-0.0234 -0.0504,-0.0054 -0.0846,-0.0504 -0.0774,-0.1008 0.0054,-0.0486 0.0504,-0.0828 0.1008,-0.0774 0.2916,0.0378 0.4338,0.0162 0.4356,0.0162 0.0486,-0.009 0.0954,0.0234 0.1026,0.0738 0.009,0.0486 -0.0234,0.0936 -0.072,0.1026 M 7.8156,4.51998 c -0.1872,0.2214 -0.2844,0.261 -0.432,0.3204 l -0.0468,0.0198 c -0.0108,0.0054 -0.0234,0.0072 -0.0342,0.0072 -0.036,0 -0.0684,-0.0216 -0.0828,-0.0558 -0.0198,-0.045 0.0018,-0.099 0.0486,-0.117 l 0.0468,-0.0198 c 0.135,-0.0558 0.2034,-0.0846 0.3636,-0.27 0.0324,-0.0396 0.09,-0.0432 0.1278,-0.0108 0.0378,0.0324 0.0414,0.0882 0.009,0.126 z\u0027 id\u003d\u0027path12\u0027 style\u003d\u0027fill:%23008000;fill-opacity:1\u0027 /%3E %3Cpath d\u003d\u0027m 5.7060003,3.33198 c 0.009,0.0486 -0.0234,0.0936 -0.072,0.1026 -0.0036,0 -0.0558,0.009 -0.1584,0.009 -0.081,0 -0.1908,-0.0054 -0.3312,-0.0234 -0.0504,-0.0054 -0.0846,-0.0504 -0.0774,-0.1008 0.0054,-0.0486 0.0504,-0.0828 0.1008,-0.0774 0.2916,0.0378 0.4338,0.0162 0.4356,0.0162 0.0486,-0.009 0.0954,0.0234 0.1026,0.0738 z\u0027 id\u003d\u0027path14\u0027 /%3E %3C/g%3E %3C/g%3E%3C/svg%3E" + }, + "description": "Do a simple ping as a connector, and return object containing timestamp, ipAddress. A Delay can be set as parameter", + "appliesTo": [ + "bpmn:Task" + ], + "groups": [ + { + "label": "Input", + "id": "Input" + }, + { + "label": "Output", + "id": "Output" + } + ], + "id": "io.camunda.cherry.ping.PingObjectConnector", + "category": { + "name": "connectors", + "id": "connectors" + }, + "documentationRef": "https://docs.camunda.io/docs/components/modeler/web-modeler/connectors/available-connectors/template/", + "elementType": { + "value": "bpmn:ServiceTask" + }, + "properties": [ + { + "value": "c-pingobjectconnector", + "type": "Hidden", + "binding": { + "type": "zeebe:taskDefinition:type" + } + }, + { + "label": "Result Variable", + "value": "result", + "type": "String", + "group": "output", + "binding": { + "key": "resultVariable", + "type": "zeebe:taskHeader" + } + }, + { + "description": "Message to log", + "binding": { + "name": "message_optional", + "type": "zeebe:input" + }, + "id": "message_optional", + "label": "Provide Message?", + "type": "Dropdown", + "choices": [ + { + "name": "Yes", + "value": "true" + }, + { + "name": "No", + "value": "false" + } + ], + "value": "false", + "group": "Input" + }, + { + "condition": { + "equals": "true", + "property": "message_optional" + }, + "description": "Message to log", + "binding": { + "name": "message", + "type": "zeebe:input" + }, + "id": "message", + "label": "Message", + "type": "String", + "group": "Input" + }, + { + "description": "Delay to sleep", + "binding": { + "name": "delay_optional", + "type": "zeebe:input" + }, + "id": "delay_optional", + "label": "Provide Delay?", + "type": "Dropdown", + "choices": [ + { + "name": "Yes", + "value": "true" + }, + { + "name": "No", + "value": "false" + } + ], + "value": "false", + "group": "Input" + }, + { + "condition": { + "equals": "true", + "property": "delay_optional" + }, + "description": "Delay to sleep", + "binding": { + "name": "delay", + "type": "zeebe:input" + }, + "id": "delay", + "label": "Delay", + "type": "String", + "group": "Input" + }, + { + "description": "If true, then the connector throw an error", + "binding": { + "name": "throwErrorPlease_optional", + "type": "zeebe:input" + }, + "id": "throwErrorPlease_optional", + "label": "Provide Throw Error Please?", + "type": "Dropdown", + "choices": [ + { + "name": "Yes", + "value": "true" + }, + { + "name": "No", + "value": "false" + } + ], + "value": "false", + "group": "Input" + }, + { + "condition": { + "equals": "true", + "property": "throwErrorPlease_optional" + }, + "description": "If true, then the connector throw an error", + "binding": { + "name": "throwErrorPlease", + "type": "zeebe:input" + }, + "id": "throwErrorPlease", + "label": "Throw Error Please", + "choices": [ + { + "name": "Yes", + "value": "true" + }, + { + "name": "No", + "value": "false" + } + ], + "type": "Dropdown", + "group": "Input" + } + ] + } +] \ No newline at end of file diff --git a/element-templates/Ping connector.json b/element-templates/Ping connector.json new file mode 100644 index 0000000..510be69 --- /dev/null +++ b/element-templates/Ping connector.json @@ -0,0 +1,274 @@ +[ + { + "$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json", + "name": "Ping (ConnectorSDK)", + "icon": { + "contents": "data:image/svg+xml,%3C?xml version\u003d\u00271.0\u0027 encoding\u003d\u0027UTF-8\u0027 standalone\u003d\u0027no\u0027?%3E%3Csvg xmlns:dc\u003d\u0027http://purl.org/dc/elements/1.1/\u0027 xmlns:cc\u003d\u0027http://creativecommons.org/ns%23\u0027 xmlns:rdf\u003d\u0027http://www.w3.org/1999/02/22-rdf-syntax-ns%23\u0027 xmlns:svg\u003d\u0027http://www.w3.org/2000/svg\u0027 xmlns\u003d\u0027http://www.w3.org/2000/svg\u0027 width\u003d\u002718\u0027 height\u003d\u002718\u0027 viewBox\u003d\u00270 0 16.875 16.875\u0027 id\u003d\u0027svg15795\u0027 version\u003d\u00271.1\u0027%3E %3Cdefs id\u003d\u0027defs15797\u0027%3E %3CradialGradient r\u003d\u0027255.59\u0027 gradientTransform\u003d\u0027matrix(-0.12272793,0,0,0.12272793,-1807.3634,-1063.9497)\u0027 cx\u003d\u0027-464.92001\u0027 cy\u003d\u0027873.19\u0027 gradientUnits\u003d\u0027userSpaceOnUse\u0027 id\u003d\u0027radialGradient3026-9-1\u0027%3E %3Cstop offset\u003d\u0027.5\u0027 style\u003d\u0027stop-color:%23ffd046;stop-opacity:1\u0027 id\u003d\u0027stop48-0-2\u0027 /%3E %3Cstop offset\u003d\u00271\u0027 style\u003d\u0027stop-color:%23f0a957;stop-opacity:1\u0027 id\u003d\u0027stop50-8-9\u0027 /%3E %3C/radialGradient%3E %3C/defs%3E %3Cmetadata id\u003d\u0027metadata15800\u0027%3E %3Crdf:RDF%3E %3Ccc:Work rdf:about\u003d\u0027\u0027%3E %3Cdc:format%3Eimage/svg+xml%3C/dc:format%3E %3Cdc:type rdf:resource\u003d\u0027http://purl.org/dc/dcmitype/StillImage\u0027 /%3E %3Cdc:title%3E%3C/dc:title%3E %3C/cc:Work%3E %3C/rdf:RDF%3E %3C/metadata%3E %3Cg id\u003d\u0027layer1\u0027 transform\u003d\u0027translate(-333.12983,-288.31523)\u0027%3E %3Cg transform\u003d\u0027matrix(0.36709704,0,0,0.36709704,986.33222,642.92532)\u0027 style\u003d\u0027display:inline\u0027 id\u003d\u0027g15745\u0027%3E %3Cpath d\u003d\u0027m -1764.6075,-935.9985 c 0,0 3.8003,2.04759 9.6285,4.07616 3.5202,1.22728 9.7726,-0.84277 13.0276,-1.70481 3.26,-0.86511 8.8927,-2.65449 7.3298,-4.21743 -1.5631,-1.56257 -6.0571,-4.89537 -6.0571,-4.89537 0,0 4.2789,7.06582 -23.9295,6.74145 z\u0027 style\u003d\u0027fill:%23ffffff;stroke:%23000000;stroke-width:1.89946;stroke-linejoin:round;stroke-opacity:1\u0027 id\u003d\u0027path9-1-4\u0027 /%3E %3Cpath id\u003d\u0027path13-3-8\u0027 style\u003d\u0027fill:%23ffffff;stroke:%23000000;stroke-width:1.89946;stroke-linejoin:round;stroke-opacity:1\u0027 d\u003d\u0027m -1738.5952,-941.13712 c 0,2.98008 -8.9157,5.39684 -19.915,5.39684 -10.9985,0 -19.9126,-2.41639 -19.9126,-5.39684 2.2937,-1.66297 1.9624,-3.06329 1.9624,-3.06329 h 35.9961 c 0,0 -0.3197,1.39983 1.8691,3.06255 z\u0027 /%3E %3Cpath d\u003d\u0027m -1774.2711,-954.86792 c 0.4453,-1.01594 2.1705,-4.52486 5.6775,-6.995 6.3577,-4.4835 14.2414,-3.62821 18.8768,-0.93691 3.1324,1.82227 5.2903,4.17054 7.0001,7.61821 0.4172,0.84216 1.1951,2.63915 1.7282,5.20993 0.4613,2.22972 0.5058,3.63581 0.58,5.97108 0,1.95125 -3.7069,3.71117 -10.0877,4.56818 -8.93,1.19586 -19.7224,0.15709 -24.1026,-2.3198 -1.2534,-0.70839 -1.8451,-1.46218 -1.8426,-2.19634 0.092,-3.01727 0.204,-6.43549 2.1707,-10.91935 z\u0027 style\u003d\u0027fill:%23ffffff;stroke-linejoin:round\u0027 id\u003d\u0027path19-3-0\u0027 /%3E %3Cpath d\u003d\u0027m -1774.2711,-954.86792 c 0.4453,-1.01594 2.1705,-4.52486 5.6775,-6.995 6.3577,-4.4835 14.2414,-3.62821 18.8768,-0.93691 3.1324,1.82227 5.2903,4.17054 7.0001,7.61821 0.4172,0.84216 1.1951,2.63915 1.7282,5.20993 0.4613,2.22972 0.5058,3.63581 0.58,5.97108 0,1.95125 -3.7069,3.71117 -10.0877,4.56818 -8.93,1.19586 -19.7224,0.15709 -24.1026,-2.3198 -1.2534,-0.70839 -1.8451,-1.46218 -1.8426,-2.19634 0.092,-3.01727 0.204,-6.43549 2.1707,-10.91935 z\u0027 style\u003d\u0027fill:%2374fc00;fill-opacity:1;stroke:%23000000;stroke-width:1.89946;stroke-linejoin:round;stroke-opacity:1\u0027 id\u003d\u0027path23-1-6\u0027 /%3E %3Cpath d\u003d\u0027m -1764.7572,-936.08809 c 0,0 3.8014,2.04415 9.6284,4.07591 3.5189,1.22483 9.7706,-0.84277 13.0263,-1.70788 3.2599,-0.86192 8.8934,-2.65141 7.3303,-4.21754 -1.5629,-1.56233 -6.0547,-4.89329 -6.0547,-4.89329 0,0 4.277,7.06618 -23.9307,6.7428 z\u0027 style\u003d\u0027fill:%23ffbd34;fill-opacity:1;stroke:%23ffbd34;stroke-width:0.633166;stroke-linejoin:round;stroke-opacity:1\u0027 id\u003d\u0027path27-6-0\u0027 /%3E %3Cpath id\u003d\u0027path31-3-3\u0027 style\u003d\u0027fill:%23ffbd34;fill-opacity:1;stroke:%23ffbd34;stroke-width:0.633166;stroke-linejoin:round;stroke-opacity:1\u0027 d\u003d\u0027m -1738.7453,-941.22671 c 0,2.98032 -8.913,5.39499 -19.9138,5.39499 -10.998,0 -19.9138,-2.41405 -19.9138,-5.39499 2.2952,-1.66272 1.961,-3.06243 1.961,-3.06243 h 35.9986 c 0,0 -0.214,1.63369 1.9731,3.29629 z\u0027 /%3E %3Cpath d\u003d\u0027m -1774.422,-954.95874 c 0.4452,-1.01521 2.1713,-4.52265 5.6774,-6.99513 6.357,-4.48337 14.2401,-3.6271 18.8767,-0.93616 3.1344,1.82238 5.2911,4.17041 6.9995,7.61526 0.418,0.84216 1.1977,2.63915 1.7282,5.21128 0.46,2.22825 0.505,3.63557 0.5804,5.96789 0,1.95137 -3.7087,3.71424 -10.0905,4.5683 -8.9296,1.19893 -19.7211,0.15697 -24.1,-2.31993 -1.2535,-0.70838 -1.8464,-1.45948 -1.8437,-2.19633 0.096,-3.01248 0.2077,-6.43119 2.1721,-10.91518 z\u0027 style\u003d\u0027fill:%23ffd520;stroke-linejoin:round\u0027 id\u003d\u0027path37-0-6\u0027 /%3E %3Cpath d\u003d\u0027m -1774.422,-954.95874 c 0.4452,-1.01521 2.1713,-4.52265 5.6774,-6.99513 6.357,-4.48337 14.2401,-3.6271 18.8767,-0.93616 3.1344,1.82238 5.2911,4.17041 6.9995,7.61526 0.418,0.84216 1.1977,2.63915 1.7282,5.21128 0.46,2.22825 0.505,3.63557 0.5804,5.96789 0,1.95137 -3.7087,3.71424 -10.0905,4.5683 -8.9296,1.19893 -19.7211,0.15697 -24.1,-2.31993 -1.2535,-0.70838 -1.8464,-1.45948 -1.8437,-2.19633 0.096,-3.01248 0.2077,-6.43119 2.1721,-10.91518 z\u0027 style\u003d\u0027fill:none;stroke:%23000000;stroke-width:0.633166;stroke-linejoin:round\u0027 id\u003d\u0027path41-6-5\u0027 /%3E %3Cpath d\u003d\u0027m -1774.422,-954.95874 c 0.4452,-1.01521 2.1713,-4.52265 5.6774,-6.99513 6.357,-4.48337 14.2401,-3.6271 18.8767,-0.93616 3.1344,1.82238 5.2911,4.17041 6.9995,7.61526 0.418,0.84216 1.1977,2.63915 1.7282,5.21128 0.46,2.22825 0.505,3.63557 0.5804,5.96789 0,1.95137 -3.7087,3.71424 -10.0905,4.5683 -8.9296,1.19893 -19.7211,0.15697 -24.1,-2.31993 -1.2535,-0.70838 -1.8464,-1.45948 -1.8437,-2.19633 0.096,-3.01248 0.2077,-6.43119 2.1721,-10.91518 z\u0027 style\u003d\u0027fill:url(%23radialGradient3026-9-1);stroke:%23fac44b;stroke-linejoin:round;stroke-opacity:1\u0027 id\u003d\u0027path52-0-7\u0027 /%3E %3Cpath d\u003d\u0027m -1767.915,-962.62629 c 13.3737,-8.528 26.9474,8.98687 26.5227,20.23415 l 1.2441,0.50196 c -7e-4,-12.25929 -13.2853,-30.32975 -27.7672,-20.73611\u0027 style\u003d\u0027fill:%23cccccc;stroke-linejoin:round\u0027 id\u003d\u0027path60-2-9\u0027 /%3E %3Cpolygon transform\u003d\u0027matrix(-0.12272793,0,0,0.12272793,-1731.9594,-974.55471)\u0027 id\u003d\u0027polygon62-6-3\u0027 style\u003d\u0027fill:%23cccccc;stroke-linejoin:round\u0027 points\u003d\u002776.865,262.06 61.197,281.15 66.729,266.15 \u0027 /%3E %3Cpath d\u003d\u0027m -1745.3502,-940.13566 c 0,-11.09583 -6.6212,-28.38329 -18.6117,-24.45845 12.8582,-4.35218 23.8104,11.56833 23.8104,22.70098 l 0.6789,1.84129 -5.2013,1.75427 -0.6765,-1.83772 z\u0027 style\u003d\u0027fill:%23ffd467;fill-opacity:1;stroke:none;stroke-width:0.633166;stroke-linecap:round;stroke-linejoin:round\u0027 id\u003d\u0027path64-7-7\u0027 /%3E %3Cpath d\u003d\u0027m -1745.349,-940.13566 0.6782,1.84141 -3.0497,-2.13755 c 0.4259,-11.24802 -6.82,-30.72126 -20.1949,-22.19658 14.4819,-9.59106 22.566,10.23183 22.566,22.49358 z\u0027 style\u003d\u0027fill:%23cccccc;stroke-linejoin:round\u0027 id\u003d\u0027path70-9-2\u0027 /%3E %3Cpath d\u003d\u0027m -1745.349,-940.13566 0.6782,1.84141 -3.0497,-2.13755 c 0.4259,-11.24802 -6.82,-30.72126 -20.1949,-22.19658 14.4819,-9.59106 22.566,10.23183 22.566,22.49358 z\u0027 style\u003d\u0027fill:%23ffbd34;fill-opacity:1;stroke:none;stroke-width:0.633166;stroke-linecap:round;stroke-linejoin:round\u0027 id\u003d\u0027path74-7-4\u0027 /%3E %3Cpolygon transform\u003d\u0027matrix(-0.12272793,0,0,0.12272793,-1731.9594,-974.55471)\u0027 id\u003d\u0027polygon78-8-4\u0027 style\u003d\u0027fill:%23ffbd34;fill-opacity:1;stroke:%23ffbd34;stroke-width:5.1591;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1\u0027 points\u003d\u0027267.24,277.31 253.03,251.64 254.68,222.57 265.49,233.41 \u0027 /%3E %3Cpolygon style\u003d\u0027stroke-linejoin:round\u0027 transform\u003d\u0027matrix(-0.12272793,0,0,0.12272793,-1731.9594,-974.55471)\u0027 id\u003d\u0027polygon80-2-4\u0027 points\u003d\u0027329.73,266.98 320.7,241.3 322.32,217.4 327.99,223.07 \u0027 /%3E %3Cpath id\u003d\u0027path82-9-3\u0027 style\u003d\u0027fill:%23ffd467;fill-opacity:1;stroke:%23ffd467;stroke-width:0.633166;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1\u0027 d\u003d\u0027m -1764.7572,-940.52103 c 0,0 -7.3005,-0.90536 -7.6667,-1.27121 -0.3672,-0.36291 0.2126,-5.38788 0.2126,-5.38788 l 7.6696,1.26802 z\u0027 /%3E %3Cpolygon transform\u003d\u0027matrix(-0.12272793,0,0,0.12272793,-1731.9594,-974.55471)\u0027 id\u003d\u0027polygon84-9-0\u0027 style\u003d\u0027fill:%23f4b253;fill-opacity:1;stroke:%23f4b253;stroke-width:5.1591;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1\u0027 points\u003d\u0027254.68,222.57 265.49,233.41 327.99,223.07 317.16,212.24 \u0027 /%3E %3C/g%3E %3Cg id\u003d\u0027g48\u0027 transform\u003d\u0027matrix(0.29730774,0,0,0.29730774,336.52636,289.85483)\u0027%3E %3Cpath d\u003d\u0027m 16.7328,13.29858 c -0.1476,1.8864 -1.6524,2.7918 -1.9584,2.9574 -1.629,0.8892 -4.3704,0.5796 -5.6952001,-1.2852 -0.7308,-1.026 -1.098,-2.6586 -0.387,-3.789 l 0.009,-0.018 c 0.2556,-0.4158 0.8478,-1.1178 1.9404001,-1.1412 h 0.0396 c 0.3906,0 0.8406,0.1188 1.2384,0.2232 0.279,0.0738 0.5202,0.1368 0.7002,0.1494 0.1134,0.0072 0.2754,-0.0216 0.4806,-0.0576 0.6138,-0.108 1.638,-0.288 2.5344,0.3456 1.2204,0.865801 1.1052,2.5452 1.098,2.6154 z\u0027 id\u003d\u0027path2\u0027 style\u003d\u0027fill:%23aa0000;fill-opacity:1\u0027 /%3E %3Cpath d\u003d\u0027m 9.2718,10.287181 c -0.351,0.2484 -0.5832,0.5562 -0.7236,0.783 l -0.009,0.0144 c -0.3636001,0.5796 -0.4644,1.2528 -0.3960001,1.9116 -0.0072,0.0036 -0.0144,0.0072 -0.0198,0.0126 -1.3338001,1.089 -2.8404,0.8082 -3.4254003,0.6372 l -0.0342,-0.009 c -1.8630002,-0.4644 -3.70259996,-2.4768 -3.3642,-4.6206 0.1872,-1.1808001 1.08,-2.538 2.4264,-2.8476 0.2322,-0.054 1.4454,-0.279 2.421,0.5382 0.2988,0.252 0.5202,0.6192001 0.7146,0.9432 0.1386,0.234 0.2592,0.4338 0.3906001,0.5652 0.0846,0.0846 0.2322,0.1674 0.4194,0.2736 0.549,0.3078001 1.3770001,0.7740001 1.5930002,1.7784 0.0018,0.0072 0.0036,0.0144 0.0072,0.0198 z\u0027 id\u003d\u0027path4\u0027 style\u003d\u0027fill:%23aa0000;fill-opacity:1\u0027 /%3E %3Cpath d\u003d\u0027m 12.9294,10.18638 c -0.1062,0.018 -0.1998,0.0306 -0.2664,0.0306 -0.0108,0 -0.0216,-0.0018 -0.0306,-0.0018 -0.0504,-0.0036 -0.1098,-0.0108 -0.1728,-0.0234 0.5526,-1.4112 0.7812,-3.6684 -1.1394,-6.5268 -0.0036,-0.0072 -0.009,-0.0126 -0.0162,-0.018 0.1116,-0.4428 0.1494,-0.7524 0.1584,-0.828 0.0054,-0.0504 -0.0306,-0.0936 -0.0792,-0.099 -0.0504,-0.0072 -0.0936,0.0306 -0.099,0.0792 -0.0216,0.1926 -0.2376,1.9296001 -1.4490001,3.4722004 -0.7578001,0.9648001 -1.9512001,1.6830001 -2.3634002,1.8882 -0.0378,-0.0252 -0.0702,-0.0504 -0.0918,-0.072 -0.0594,-0.0594 -0.117,-0.1368 -0.1764,-0.2286 0.0342,-0.018 0.0702,-0.0378 0.108,-0.0576 0.4302,-0.2304 1.1502,-0.6138001 2.0286002,-1.5336001 1.0386001,-1.0872 1.2366001,-2.7522001 0.9450001,-3.2058 -0.1404,-0.2196 -0.3654001,-0.2412 -0.5454001,-0.2574 -0.2358,-0.0198 -0.378,-0.0342 -0.4032,-0.3546 -0.0234,-0.279 0.108,-0.5256 0.369,-0.6912 0.3510001,-0.225 0.9792001,-0.297 1.5876001,0.0486 0.3798,0.2142 0.3762,0.5796 0.3744,0.9324 -0.0018,0.2358 -0.0036,0.459 0.1134,0.6192 l 0.0504,0.0684 c 0.288,0.3906001 0.9612,1.3014001 1.3644,2.8908 C 13.626,8.01918 13.2192,9.56898 12.9294,10.18638 Z\u0027 id\u003d\u0027path6\u0027 style\u003d\u0027fill:%23502d16;fill-opacity:1\u0027 /%3E %3Cpath d\u003d\u0027m 7.6338,2.8045802 c -0.0144,0.0072 -0.0288,0.0108 -0.0432,0.0108 -0.0324,0 -0.063,-0.018 -0.0792,-0.0468 -0.0018,-0.0018 -0.1278,-0.2268 -0.3546,-0.4338 -0.0378,-0.0324 -0.0396,-0.09 -0.0072,-0.126 0.0342,-0.0378 0.09,-0.0396 0.1278,-0.0072 0.2502,0.2268 0.3852,0.4698 0.3906,0.4806 0.025201,0.0432 0.009,0.0972 -0.0342,0.1224 z\u0027 id\u003d\u0027path8\u0027 /%3E %3Cpath d\u003d\u0027m 7.8156,4.51998 c -0.1872,0.2214 -0.2844,0.261 -0.432,0.3204 l -0.0468,0.0198 c -0.0108,0.0054 -0.0234,0.0072 -0.0342,0.0072 -0.036,0 -0.0684,-0.0216 -0.0828,-0.0558 -0.0198,-0.045 0.0018,-0.099 0.0486,-0.117 l 0.0468,-0.0198 c 0.135,-0.0558 0.2034,-0.0846 0.3636,-0.27 0.0324,-0.0396 0.09,-0.0432 0.1278,-0.0108 0.0378,0.0324 0.0414,0.0882 0.009,0.126 z\u0027 id\u003d\u0027path10\u0027 /%3E %3Cpath d\u003d\u0027m 10.134,3.1591802 c -0.0468,-0.0738 -0.108,-0.1134 -0.1764,-0.135 -0.2394,0.3222 -1.0818001,0.81 -1.9278,0.81 -0.225,0 -0.4518,-0.0342 -0.666,-0.1152 -0.576,-0.2196 -0.9702,-0.5256 -1.3518001,-0.8208 -0.3024,-0.2358 -0.5886,-0.4572 -0.9378,-0.6084001 -0.0468,-0.0216 -0.0666,-0.0738 -0.0468,-0.1188 0.0198,-0.0468 0.072,-0.0666 0.1188,-0.0468 0.369,0.162 0.6642,0.3888001 0.9756,0.6318 0.3708,0.2880001 0.756,0.5850001 1.3050001,0.7938 0.5598,0.2124 1.1880001,0.0738 1.6650001,-0.1404 -0.2052,-0.6336 -1.5318002,-2.56139997 -3.7188,-2.0700002 -0.3384,0.0756 -0.6336,0.1458 -0.8928,0.207 -1.098,0.2574 -1.5678,0.3672001 -2.0556002,0.2376 0.045,0.2268001 0.1638,0.4194 0.3528,0.5742001 0.378,0.3042 0.927,0.3798 1.1880001,0.3834 C 3.8322,2.59038 3.69,2.49318 3.5154,2.43198 3.4686,2.41578 3.4434,2.36538 3.4596,2.31858 c 0.0162,-0.0486 0.0684,-0.072 0.1152,-0.0558 0.567,0.1998 0.828,0.7074 1.2492001,1.7424002 0.441,1.0836 1.9836001,2.0934 3.2346,1.7190001 1.2744,-0.3816 1.2528001,-1.7244 1.251,-1.7388 0,-0.036 0.0216,-0.0702 0.054,-0.0846 0.0846,-0.0378 0.5184,-0.2358 0.8243999,-0.5238 0.0054,-0.0054 0.0108,-0.009 0.0162,-0.009 v -0.0018 C 10.1898,3.27798 10.1646,3.20778 10.134,3.1591802 M 7.1496005,2.20878 c 0.0342,-0.0378 0.09,-0.0396 0.1278,-0.0072 0.2502,0.2268 0.3852,0.4698 0.3906,0.4806 0.0252,0.0432 0.009,0.0972 -0.0342,0.1224 -0.0144,0.0072 -0.0288,0.0108 -0.0432,0.0108 -0.0324,0 -0.063,-0.018 -0.0792,-0.0468 -0.0018,-0.0018 -0.1278,-0.2268 -0.3546,-0.4338 -0.037801,-0.0324 -0.0396,-0.09 -0.0072,-0.126 m -1.5156002,1.2258 c -0.0036,0 -0.0558,0.009 -0.1584,0.009 -0.081,0 -0.1908,-0.0054 -0.3312,-0.0234 -0.0504,-0.0054 -0.0846,-0.0504 -0.0774,-0.1008 0.0054,-0.0486 0.0504,-0.0828 0.1008,-0.0774 0.2916,0.0378 0.4338,0.0162 0.4356,0.0162 0.0486,-0.009 0.0954,0.0234 0.1026,0.0738 0.009,0.0486 -0.0234,0.0936 -0.072,0.1026 M 7.8156,4.51998 c -0.1872,0.2214 -0.2844,0.261 -0.432,0.3204 l -0.0468,0.0198 c -0.0108,0.0054 -0.0234,0.0072 -0.0342,0.0072 -0.036,0 -0.0684,-0.0216 -0.0828,-0.0558 -0.0198,-0.045 0.0018,-0.099 0.0486,-0.117 l 0.0468,-0.0198 c 0.135,-0.0558 0.2034,-0.0846 0.3636,-0.27 0.0324,-0.0396 0.09,-0.0432 0.1278,-0.0108 0.0378,0.0324 0.0414,0.0882 0.009,0.126 z\u0027 id\u003d\u0027path12\u0027 style\u003d\u0027fill:%23008000;fill-opacity:1\u0027 /%3E %3Cpath d\u003d\u0027m 5.7060003,3.33198 c 0.009,0.0486 -0.0234,0.0936 -0.072,0.1026 -0.0036,0 -0.0558,0.009 -0.1584,0.009 -0.081,0 -0.1908,-0.0054 -0.3312,-0.0234 -0.0504,-0.0054 -0.0846,-0.0504 -0.0774,-0.1008 0.0054,-0.0486 0.0504,-0.0828 0.1008,-0.0774 0.2916,0.0378 0.4338,0.0162 0.4356,0.0162 0.0486,-0.009 0.0954,0.0234 0.1026,0.0738 z\u0027 id\u003d\u0027path14\u0027 /%3E %3C/g%3E %3C/g%3E%3C/svg%3E" + }, + "description": "Do a simple ping as a connector, and return timestamp, ipAdress. A Delay can be set as parameter", + "appliesTo": [ + "bpmn:Task" + ], + "groups": [ + { + "label": "Input", + "id": "Input" + }, + { + "label": "Output", + "id": "Output" + } + ], + "id": "io.camunda.cherry.ping.connector.PingConnector", + "category": { + "name": "connectors", + "id": "connectors" + }, + "documentationRef": "https://docs.camunda.io/docs/components/modeler/web-modeler/connectors/available-connectors/template/", + "elementType": { + "value": "bpmn:ServiceTask" + }, + "properties": [ + { + "value": "c-pingconnector", + "type": "Hidden", + "binding": { + "type": "zeebe:taskDefinition:type" + } + }, + { + "value": "result", + "type": "Hidden", + "binding": { + "type": "zeebe:taskHeader", + "key": "resultVariable" + } + }, + { + "description": "Message to log", + "binding": { + "type": "zeebe:input", + "name": "message_optional" + }, + "id": "message_optional", + "label": "Provide Message?", + "type": "Dropdown", + "choices": [ + { + "value": "true", + "name": "Yes" + }, + { + "value": "false", + "name": "No" + } + ], + "value": "false", + "group": "Input" + }, + { + "condition": { + "property": "message_optional", + "equals": "true" + }, + "description": "Message to log", + "binding": { + "type": "zeebe:input", + "name": "message" + }, + "id": "message", + "label": "Message", + "type": "String", + "group": "Input" + }, + { + "description": "Delay to sleep", + "binding": { + "type": "zeebe:input", + "name": "delay_optional" + }, + "id": "delay_optional", + "label": "Provide Delay?", + "type": "Dropdown", + "choices": [ + { + "value": "true", + "name": "Yes" + }, + { + "value": "false", + "name": "No" + } + ], + "value": "false", + "group": "Input" + }, + { + "condition": { + "property": "delay_optional", + "equals": "true" + }, + "description": "Delay to sleep", + "binding": { + "type": "zeebe:input", + "name": "delay" + }, + "id": "delay", + "label": "Delay", + "type": "String", + "group": "Input" + }, + { + "description": "If true, then the connector throw an error", + "binding": { + "type": "zeebe:input", + "name": "throwErrorPlease" + }, + "id": "throwErrorPlease", + "label": "Throw Error Please", + "choices": [ + { + "value": "true", + "name": "Yes" + }, + { + "value": "false", + "name": "No" + } + ], + "type": "Dropdown", + "group": "Input" + }, + { + "description": "Produce a timestamp", + "binding": { + "type": "zeebe:input", + "name": "timeStampMS_optional" + }, + "id": "timeStampMS_optional", + "label": "Saved Time stamp?", + "type": "Dropdown", + "choices": [ + { + "value": "true", + "name": "Yes" + }, + { + "value": "false", + "name": "No" + } + ], + "value": "false", + "group": "Output" + }, + { + "condition": { + "property": "timeStampMS_optional", + "equals": "true" + }, + "description": "Produce a timestamp", + "binding": { + "type": "zeebe:output", + "source": "\u003d result.timeStampMS" + }, + "id": "timeStampMS", + "label": "Time stamp", + "type": "String", + "constraints": { + "notEmpty": true + }, + "group": "Output" + }, + { + "description": "Returm the IpAddress", + "binding": { + "type": "zeebe:input", + "name": "ipAddress_optional" + }, + "id": "ipAddress_optional", + "label": "Saved Ip Address?", + "type": "Dropdown", + "choices": [ + { + "value": "true", + "name": "Yes" + }, + { + "value": "false", + "name": "No" + } + ], + "value": "false", + "group": "Output" + }, + { + "condition": { + "property": "ipAddress_optional", + "equals": "true" + }, + "description": "Returm the IpAddress", + "binding": { + "type": "zeebe:output", + "source": "\u003d result.ipAddress" + }, + "id": "ipAddress", + "label": "Ip Address", + "type": "String", + "constraints": { + "notEmpty": true + }, + "group": "Output" + }, + { + "description": "Returm parameters", + "binding": { + "type": "zeebe:input", + "name": "parameters_optional" + }, + "id": "parameters_optional", + "label": "Saved Parameters?", + "type": "Dropdown", + "choices": [ + { + "value": "true", + "name": "Yes" + }, + { + "value": "false", + "name": "No" + } + ], + "value": "false", + "group": "Output" + }, + { + "condition": { + "property": "parameters_optional", + "equals": "true" + }, + "description": "Returm parameters", + "binding": { + "type": "zeebe:output", + "source": "\u003d result.parameters" + }, + "id": "parameters", + "label": "Parameters", + "type": "String", + "constraints": { + "notEmpty": true + }, + "group": "Output" + }, + { + "description": "Expression to define BPMN Errors to throw", + "binding": { + "type": "zeebe:taskHeader", + "key": "errorExpression" + }, + "label": "Error Expression", + "type": "Hidden", + "value": "bpmnError(error.code, error.message)" + } + ] + } +] \ No newline at end of file diff --git a/element-templates/Ping worker.json b/element-templates/Ping worker.json new file mode 100644 index 0000000..e3fcec4 --- /dev/null +++ b/element-templates/Ping worker.json @@ -0,0 +1,155 @@ +[ + { + "$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json", + "name": "Ping (Worker)", + "icon": { + "contents": "data:image/svg+xml,%3C?xml version\u003d\u00271.0\u0027 encoding\u003d\u0027UTF-8\u0027 standalone\u003d\u0027no\u0027?%3E%3Csvg xmlns:dc\u003d\u0027http://purl.org/dc/elements/1.1/\u0027 xmlns:cc\u003d\u0027http://creativecommons.org/ns%23\u0027 xmlns:rdf\u003d\u0027http://www.w3.org/1999/02/22-rdf-syntax-ns%23\u0027 xmlns:svg\u003d\u0027http://www.w3.org/2000/svg\u0027 xmlns\u003d\u0027http://www.w3.org/2000/svg\u0027 width\u003d\u002718\u0027 height\u003d\u002718\u0027 viewBox\u003d\u00270 0 16.875 16.875\u0027 id\u003d\u0027svg15795\u0027 version\u003d\u00271.1\u0027%3E %3Cdefs id\u003d\u0027defs15797\u0027%3E %3CradialGradient r\u003d\u0027255.59\u0027 gradientTransform\u003d\u0027matrix(-0.12272793,0,0,0.12272793,-1807.3634,-1063.9497)\u0027 cx\u003d\u0027-464.92001\u0027 cy\u003d\u0027873.19\u0027 gradientUnits\u003d\u0027userSpaceOnUse\u0027 id\u003d\u0027radialGradient3026-9-1\u0027%3E %3Cstop offset\u003d\u0027.5\u0027 style\u003d\u0027stop-color:%23ffd046;stop-opacity:1\u0027 id\u003d\u0027stop48-0-2\u0027 /%3E %3Cstop offset\u003d\u00271\u0027 style\u003d\u0027stop-color:%23f0a957;stop-opacity:1\u0027 id\u003d\u0027stop50-8-9\u0027 /%3E %3C/radialGradient%3E %3C/defs%3E %3Cmetadata id\u003d\u0027metadata15800\u0027%3E %3Crdf:RDF%3E %3Ccc:Work rdf:about\u003d\u0027\u0027%3E %3Cdc:format%3Eimage/svg+xml%3C/dc:format%3E %3Cdc:type rdf:resource\u003d\u0027http://purl.org/dc/dcmitype/StillImage\u0027 /%3E %3Cdc:title%3E%3C/dc:title%3E %3C/cc:Work%3E %3C/rdf:RDF%3E %3C/metadata%3E %3Cg id\u003d\u0027layer1\u0027 transform\u003d\u0027translate(-333.12983,-288.31523)\u0027%3E %3Cg transform\u003d\u0027matrix(0.36709704,0,0,0.36709704,986.33222,642.92532)\u0027 style\u003d\u0027display:inline\u0027 id\u003d\u0027g15745\u0027%3E %3Cpath d\u003d\u0027m -1764.6075,-935.9985 c 0,0 3.8003,2.04759 9.6285,4.07616 3.5202,1.22728 9.7726,-0.84277 13.0276,-1.70481 3.26,-0.86511 8.8927,-2.65449 7.3298,-4.21743 -1.5631,-1.56257 -6.0571,-4.89537 -6.0571,-4.89537 0,0 4.2789,7.06582 -23.9295,6.74145 z\u0027 style\u003d\u0027fill:%23ffffff;stroke:%23000000;stroke-width:1.89946;stroke-linejoin:round;stroke-opacity:1\u0027 id\u003d\u0027path9-1-4\u0027 /%3E %3Cpath id\u003d\u0027path13-3-8\u0027 style\u003d\u0027fill:%23ffffff;stroke:%23000000;stroke-width:1.89946;stroke-linejoin:round;stroke-opacity:1\u0027 d\u003d\u0027m -1738.5952,-941.13712 c 0,2.98008 -8.9157,5.39684 -19.915,5.39684 -10.9985,0 -19.9126,-2.41639 -19.9126,-5.39684 2.2937,-1.66297 1.9624,-3.06329 1.9624,-3.06329 h 35.9961 c 0,0 -0.3197,1.39983 1.8691,3.06255 z\u0027 /%3E %3Cpath d\u003d\u0027m -1774.2711,-954.86792 c 0.4453,-1.01594 2.1705,-4.52486 5.6775,-6.995 6.3577,-4.4835 14.2414,-3.62821 18.8768,-0.93691 3.1324,1.82227 5.2903,4.17054 7.0001,7.61821 0.4172,0.84216 1.1951,2.63915 1.7282,5.20993 0.4613,2.22972 0.5058,3.63581 0.58,5.97108 0,1.95125 -3.7069,3.71117 -10.0877,4.56818 -8.93,1.19586 -19.7224,0.15709 -24.1026,-2.3198 -1.2534,-0.70839 -1.8451,-1.46218 -1.8426,-2.19634 0.092,-3.01727 0.204,-6.43549 2.1707,-10.91935 z\u0027 style\u003d\u0027fill:%23ffffff;stroke-linejoin:round\u0027 id\u003d\u0027path19-3-0\u0027 /%3E %3Cpath d\u003d\u0027m -1774.2711,-954.86792 c 0.4453,-1.01594 2.1705,-4.52486 5.6775,-6.995 6.3577,-4.4835 14.2414,-3.62821 18.8768,-0.93691 3.1324,1.82227 5.2903,4.17054 7.0001,7.61821 0.4172,0.84216 1.1951,2.63915 1.7282,5.20993 0.4613,2.22972 0.5058,3.63581 0.58,5.97108 0,1.95125 -3.7069,3.71117 -10.0877,4.56818 -8.93,1.19586 -19.7224,0.15709 -24.1026,-2.3198 -1.2534,-0.70839 -1.8451,-1.46218 -1.8426,-2.19634 0.092,-3.01727 0.204,-6.43549 2.1707,-10.91935 z\u0027 style\u003d\u0027fill:%2374fc00;fill-opacity:1;stroke:%23000000;stroke-width:1.89946;stroke-linejoin:round;stroke-opacity:1\u0027 id\u003d\u0027path23-1-6\u0027 /%3E %3Cpath d\u003d\u0027m -1764.7572,-936.08809 c 0,0 3.8014,2.04415 9.6284,4.07591 3.5189,1.22483 9.7706,-0.84277 13.0263,-1.70788 3.2599,-0.86192 8.8934,-2.65141 7.3303,-4.21754 -1.5629,-1.56233 -6.0547,-4.89329 -6.0547,-4.89329 0,0 4.277,7.06618 -23.9307,6.7428 z\u0027 style\u003d\u0027fill:%23ffbd34;fill-opacity:1;stroke:%23ffbd34;stroke-width:0.633166;stroke-linejoin:round;stroke-opacity:1\u0027 id\u003d\u0027path27-6-0\u0027 /%3E %3Cpath id\u003d\u0027path31-3-3\u0027 style\u003d\u0027fill:%23ffbd34;fill-opacity:1;stroke:%23ffbd34;stroke-width:0.633166;stroke-linejoin:round;stroke-opacity:1\u0027 d\u003d\u0027m -1738.7453,-941.22671 c 0,2.98032 -8.913,5.39499 -19.9138,5.39499 -10.998,0 -19.9138,-2.41405 -19.9138,-5.39499 2.2952,-1.66272 1.961,-3.06243 1.961,-3.06243 h 35.9986 c 0,0 -0.214,1.63369 1.9731,3.29629 z\u0027 /%3E %3Cpath d\u003d\u0027m -1774.422,-954.95874 c 0.4452,-1.01521 2.1713,-4.52265 5.6774,-6.99513 6.357,-4.48337 14.2401,-3.6271 18.8767,-0.93616 3.1344,1.82238 5.2911,4.17041 6.9995,7.61526 0.418,0.84216 1.1977,2.63915 1.7282,5.21128 0.46,2.22825 0.505,3.63557 0.5804,5.96789 0,1.95137 -3.7087,3.71424 -10.0905,4.5683 -8.9296,1.19893 -19.7211,0.15697 -24.1,-2.31993 -1.2535,-0.70838 -1.8464,-1.45948 -1.8437,-2.19633 0.096,-3.01248 0.2077,-6.43119 2.1721,-10.91518 z\u0027 style\u003d\u0027fill:%23ffd520;stroke-linejoin:round\u0027 id\u003d\u0027path37-0-6\u0027 /%3E %3Cpath d\u003d\u0027m -1774.422,-954.95874 c 0.4452,-1.01521 2.1713,-4.52265 5.6774,-6.99513 6.357,-4.48337 14.2401,-3.6271 18.8767,-0.93616 3.1344,1.82238 5.2911,4.17041 6.9995,7.61526 0.418,0.84216 1.1977,2.63915 1.7282,5.21128 0.46,2.22825 0.505,3.63557 0.5804,5.96789 0,1.95137 -3.7087,3.71424 -10.0905,4.5683 -8.9296,1.19893 -19.7211,0.15697 -24.1,-2.31993 -1.2535,-0.70838 -1.8464,-1.45948 -1.8437,-2.19633 0.096,-3.01248 0.2077,-6.43119 2.1721,-10.91518 z\u0027 style\u003d\u0027fill:none;stroke:%23000000;stroke-width:0.633166;stroke-linejoin:round\u0027 id\u003d\u0027path41-6-5\u0027 /%3E %3Cpath d\u003d\u0027m -1774.422,-954.95874 c 0.4452,-1.01521 2.1713,-4.52265 5.6774,-6.99513 6.357,-4.48337 14.2401,-3.6271 18.8767,-0.93616 3.1344,1.82238 5.2911,4.17041 6.9995,7.61526 0.418,0.84216 1.1977,2.63915 1.7282,5.21128 0.46,2.22825 0.505,3.63557 0.5804,5.96789 0,1.95137 -3.7087,3.71424 -10.0905,4.5683 -8.9296,1.19893 -19.7211,0.15697 -24.1,-2.31993 -1.2535,-0.70838 -1.8464,-1.45948 -1.8437,-2.19633 0.096,-3.01248 0.2077,-6.43119 2.1721,-10.91518 z\u0027 style\u003d\u0027fill:url(%23radialGradient3026-9-1);stroke:%23fac44b;stroke-linejoin:round;stroke-opacity:1\u0027 id\u003d\u0027path52-0-7\u0027 /%3E %3Cpath d\u003d\u0027m -1767.915,-962.62629 c 13.3737,-8.528 26.9474,8.98687 26.5227,20.23415 l 1.2441,0.50196 c -7e-4,-12.25929 -13.2853,-30.32975 -27.7672,-20.73611\u0027 style\u003d\u0027fill:%23cccccc;stroke-linejoin:round\u0027 id\u003d\u0027path60-2-9\u0027 /%3E %3Cpolygon transform\u003d\u0027matrix(-0.12272793,0,0,0.12272793,-1731.9594,-974.55471)\u0027 id\u003d\u0027polygon62-6-3\u0027 style\u003d\u0027fill:%23cccccc;stroke-linejoin:round\u0027 points\u003d\u002776.865,262.06 61.197,281.15 66.729,266.15 \u0027 /%3E %3Cpath d\u003d\u0027m -1745.3502,-940.13566 c 0,-11.09583 -6.6212,-28.38329 -18.6117,-24.45845 12.8582,-4.35218 23.8104,11.56833 23.8104,22.70098 l 0.6789,1.84129 -5.2013,1.75427 -0.6765,-1.83772 z\u0027 style\u003d\u0027fill:%23ffd467;fill-opacity:1;stroke:none;stroke-width:0.633166;stroke-linecap:round;stroke-linejoin:round\u0027 id\u003d\u0027path64-7-7\u0027 /%3E %3Cpath d\u003d\u0027m -1745.349,-940.13566 0.6782,1.84141 -3.0497,-2.13755 c 0.4259,-11.24802 -6.82,-30.72126 -20.1949,-22.19658 14.4819,-9.59106 22.566,10.23183 22.566,22.49358 z\u0027 style\u003d\u0027fill:%23cccccc;stroke-linejoin:round\u0027 id\u003d\u0027path70-9-2\u0027 /%3E %3Cpath d\u003d\u0027m -1745.349,-940.13566 0.6782,1.84141 -3.0497,-2.13755 c 0.4259,-11.24802 -6.82,-30.72126 -20.1949,-22.19658 14.4819,-9.59106 22.566,10.23183 22.566,22.49358 z\u0027 style\u003d\u0027fill:%23ffbd34;fill-opacity:1;stroke:none;stroke-width:0.633166;stroke-linecap:round;stroke-linejoin:round\u0027 id\u003d\u0027path74-7-4\u0027 /%3E %3Cpolygon transform\u003d\u0027matrix(-0.12272793,0,0,0.12272793,-1731.9594,-974.55471)\u0027 id\u003d\u0027polygon78-8-4\u0027 style\u003d\u0027fill:%23ffbd34;fill-opacity:1;stroke:%23ffbd34;stroke-width:5.1591;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1\u0027 points\u003d\u0027267.24,277.31 253.03,251.64 254.68,222.57 265.49,233.41 \u0027 /%3E %3Cpolygon style\u003d\u0027stroke-linejoin:round\u0027 transform\u003d\u0027matrix(-0.12272793,0,0,0.12272793,-1731.9594,-974.55471)\u0027 id\u003d\u0027polygon80-2-4\u0027 points\u003d\u0027329.73,266.98 320.7,241.3 322.32,217.4 327.99,223.07 \u0027 /%3E %3Cpath id\u003d\u0027path82-9-3\u0027 style\u003d\u0027fill:%23ffd467;fill-opacity:1;stroke:%23ffd467;stroke-width:0.633166;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1\u0027 d\u003d\u0027m -1764.7572,-940.52103 c 0,0 -7.3005,-0.90536 -7.6667,-1.27121 -0.3672,-0.36291 0.2126,-5.38788 0.2126,-5.38788 l 7.6696,1.26802 z\u0027 /%3E %3Cpolygon transform\u003d\u0027matrix(-0.12272793,0,0,0.12272793,-1731.9594,-974.55471)\u0027 id\u003d\u0027polygon84-9-0\u0027 style\u003d\u0027fill:%23f4b253;fill-opacity:1;stroke:%23f4b253;stroke-width:5.1591;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1\u0027 points\u003d\u0027254.68,222.57 265.49,233.41 327.99,223.07 317.16,212.24 \u0027 /%3E %3C/g%3E %3Cg id\u003d\u0027g48\u0027 transform\u003d\u0027matrix(0.29730774,0,0,0.29730774,336.52636,289.85483)\u0027%3E %3Cpath d\u003d\u0027m 16.7328,13.29858 c -0.1476,1.8864 -1.6524,2.7918 -1.9584,2.9574 -1.629,0.8892 -4.3704,0.5796 -5.6952001,-1.2852 -0.7308,-1.026 -1.098,-2.6586 -0.387,-3.789 l 0.009,-0.018 c 0.2556,-0.4158 0.8478,-1.1178 1.9404001,-1.1412 h 0.0396 c 0.3906,0 0.8406,0.1188 1.2384,0.2232 0.279,0.0738 0.5202,0.1368 0.7002,0.1494 0.1134,0.0072 0.2754,-0.0216 0.4806,-0.0576 0.6138,-0.108 1.638,-0.288 2.5344,0.3456 1.2204,0.865801 1.1052,2.5452 1.098,2.6154 z\u0027 id\u003d\u0027path2\u0027 style\u003d\u0027fill:%23aa0000;fill-opacity:1\u0027 /%3E %3Cpath d\u003d\u0027m 9.2718,10.287181 c -0.351,0.2484 -0.5832,0.5562 -0.7236,0.783 l -0.009,0.0144 c -0.3636001,0.5796 -0.4644,1.2528 -0.3960001,1.9116 -0.0072,0.0036 -0.0144,0.0072 -0.0198,0.0126 -1.3338001,1.089 -2.8404,0.8082 -3.4254003,0.6372 l -0.0342,-0.009 c -1.8630002,-0.4644 -3.70259996,-2.4768 -3.3642,-4.6206 0.1872,-1.1808001 1.08,-2.538 2.4264,-2.8476 0.2322,-0.054 1.4454,-0.279 2.421,0.5382 0.2988,0.252 0.5202,0.6192001 0.7146,0.9432 0.1386,0.234 0.2592,0.4338 0.3906001,0.5652 0.0846,0.0846 0.2322,0.1674 0.4194,0.2736 0.549,0.3078001 1.3770001,0.7740001 1.5930002,1.7784 0.0018,0.0072 0.0036,0.0144 0.0072,0.0198 z\u0027 id\u003d\u0027path4\u0027 style\u003d\u0027fill:%23aa0000;fill-opacity:1\u0027 /%3E %3Cpath d\u003d\u0027m 12.9294,10.18638 c -0.1062,0.018 -0.1998,0.0306 -0.2664,0.0306 -0.0108,0 -0.0216,-0.0018 -0.0306,-0.0018 -0.0504,-0.0036 -0.1098,-0.0108 -0.1728,-0.0234 0.5526,-1.4112 0.7812,-3.6684 -1.1394,-6.5268 -0.0036,-0.0072 -0.009,-0.0126 -0.0162,-0.018 0.1116,-0.4428 0.1494,-0.7524 0.1584,-0.828 0.0054,-0.0504 -0.0306,-0.0936 -0.0792,-0.099 -0.0504,-0.0072 -0.0936,0.0306 -0.099,0.0792 -0.0216,0.1926 -0.2376,1.9296001 -1.4490001,3.4722004 -0.7578001,0.9648001 -1.9512001,1.6830001 -2.3634002,1.8882 -0.0378,-0.0252 -0.0702,-0.0504 -0.0918,-0.072 -0.0594,-0.0594 -0.117,-0.1368 -0.1764,-0.2286 0.0342,-0.018 0.0702,-0.0378 0.108,-0.0576 0.4302,-0.2304 1.1502,-0.6138001 2.0286002,-1.5336001 1.0386001,-1.0872 1.2366001,-2.7522001 0.9450001,-3.2058 -0.1404,-0.2196 -0.3654001,-0.2412 -0.5454001,-0.2574 -0.2358,-0.0198 -0.378,-0.0342 -0.4032,-0.3546 -0.0234,-0.279 0.108,-0.5256 0.369,-0.6912 0.3510001,-0.225 0.9792001,-0.297 1.5876001,0.0486 0.3798,0.2142 0.3762,0.5796 0.3744,0.9324 -0.0018,0.2358 -0.0036,0.459 0.1134,0.6192 l 0.0504,0.0684 c 0.288,0.3906001 0.9612,1.3014001 1.3644,2.8908 C 13.626,8.01918 13.2192,9.56898 12.9294,10.18638 Z\u0027 id\u003d\u0027path6\u0027 style\u003d\u0027fill:%23502d16;fill-opacity:1\u0027 /%3E %3Cpath d\u003d\u0027m 7.6338,2.8045802 c -0.0144,0.0072 -0.0288,0.0108 -0.0432,0.0108 -0.0324,0 -0.063,-0.018 -0.0792,-0.0468 -0.0018,-0.0018 -0.1278,-0.2268 -0.3546,-0.4338 -0.0378,-0.0324 -0.0396,-0.09 -0.0072,-0.126 0.0342,-0.0378 0.09,-0.0396 0.1278,-0.0072 0.2502,0.2268 0.3852,0.4698 0.3906,0.4806 0.025201,0.0432 0.009,0.0972 -0.0342,0.1224 z\u0027 id\u003d\u0027path8\u0027 /%3E %3Cpath d\u003d\u0027m 7.8156,4.51998 c -0.1872,0.2214 -0.2844,0.261 -0.432,0.3204 l -0.0468,0.0198 c -0.0108,0.0054 -0.0234,0.0072 -0.0342,0.0072 -0.036,0 -0.0684,-0.0216 -0.0828,-0.0558 -0.0198,-0.045 0.0018,-0.099 0.0486,-0.117 l 0.0468,-0.0198 c 0.135,-0.0558 0.2034,-0.0846 0.3636,-0.27 0.0324,-0.0396 0.09,-0.0432 0.1278,-0.0108 0.0378,0.0324 0.0414,0.0882 0.009,0.126 z\u0027 id\u003d\u0027path10\u0027 /%3E %3Cpath d\u003d\u0027m 10.134,3.1591802 c -0.0468,-0.0738 -0.108,-0.1134 -0.1764,-0.135 -0.2394,0.3222 -1.0818001,0.81 -1.9278,0.81 -0.225,0 -0.4518,-0.0342 -0.666,-0.1152 -0.576,-0.2196 -0.9702,-0.5256 -1.3518001,-0.8208 -0.3024,-0.2358 -0.5886,-0.4572 -0.9378,-0.6084001 -0.0468,-0.0216 -0.0666,-0.0738 -0.0468,-0.1188 0.0198,-0.0468 0.072,-0.0666 0.1188,-0.0468 0.369,0.162 0.6642,0.3888001 0.9756,0.6318 0.3708,0.2880001 0.756,0.5850001 1.3050001,0.7938 0.5598,0.2124 1.1880001,0.0738 1.6650001,-0.1404 -0.2052,-0.6336 -1.5318002,-2.56139997 -3.7188,-2.0700002 -0.3384,0.0756 -0.6336,0.1458 -0.8928,0.207 -1.098,0.2574 -1.5678,0.3672001 -2.0556002,0.2376 0.045,0.2268001 0.1638,0.4194 0.3528,0.5742001 0.378,0.3042 0.927,0.3798 1.1880001,0.3834 C 3.8322,2.59038 3.69,2.49318 3.5154,2.43198 3.4686,2.41578 3.4434,2.36538 3.4596,2.31858 c 0.0162,-0.0486 0.0684,-0.072 0.1152,-0.0558 0.567,0.1998 0.828,0.7074 1.2492001,1.7424002 0.441,1.0836 1.9836001,2.0934 3.2346,1.7190001 1.2744,-0.3816 1.2528001,-1.7244 1.251,-1.7388 0,-0.036 0.0216,-0.0702 0.054,-0.0846 0.0846,-0.0378 0.5184,-0.2358 0.8243999,-0.5238 0.0054,-0.0054 0.0108,-0.009 0.0162,-0.009 v -0.0018 C 10.1898,3.27798 10.1646,3.20778 10.134,3.1591802 M 7.1496005,2.20878 c 0.0342,-0.0378 0.09,-0.0396 0.1278,-0.0072 0.2502,0.2268 0.3852,0.4698 0.3906,0.4806 0.0252,0.0432 0.009,0.0972 -0.0342,0.1224 -0.0144,0.0072 -0.0288,0.0108 -0.0432,0.0108 -0.0324,0 -0.063,-0.018 -0.0792,-0.0468 -0.0018,-0.0018 -0.1278,-0.2268 -0.3546,-0.4338 -0.037801,-0.0324 -0.0396,-0.09 -0.0072,-0.126 m -1.5156002,1.2258 c -0.0036,0 -0.0558,0.009 -0.1584,0.009 -0.081,0 -0.1908,-0.0054 -0.3312,-0.0234 -0.0504,-0.0054 -0.0846,-0.0504 -0.0774,-0.1008 0.0054,-0.0486 0.0504,-0.0828 0.1008,-0.0774 0.2916,0.0378 0.4338,0.0162 0.4356,0.0162 0.0486,-0.009 0.0954,0.0234 0.1026,0.0738 0.009,0.0486 -0.0234,0.0936 -0.072,0.1026 M 7.8156,4.51998 c -0.1872,0.2214 -0.2844,0.261 -0.432,0.3204 l -0.0468,0.0198 c -0.0108,0.0054 -0.0234,0.0072 -0.0342,0.0072 -0.036,0 -0.0684,-0.0216 -0.0828,-0.0558 -0.0198,-0.045 0.0018,-0.099 0.0486,-0.117 l 0.0468,-0.0198 c 0.135,-0.0558 0.2034,-0.0846 0.3636,-0.27 0.0324,-0.0396 0.09,-0.0432 0.1278,-0.0108 0.0378,0.0324 0.0414,0.0882 0.009,0.126 z\u0027 id\u003d\u0027path12\u0027 style\u003d\u0027fill:%23008000;fill-opacity:1\u0027 /%3E %3Cpath d\u003d\u0027m 5.7060003,3.33198 c 0.009,0.0486 -0.0234,0.0936 -0.072,0.1026 -0.0036,0 -0.0558,0.009 -0.1584,0.009 -0.081,0 -0.1908,-0.0054 -0.3312,-0.0234 -0.0504,-0.0054 -0.0846,-0.0504 -0.0774,-0.1008 0.0054,-0.0486 0.0504,-0.0828 0.1008,-0.0774 0.2916,0.0378 0.4338,0.0162 0.4356,0.0162 0.0486,-0.009 0.0954,0.0234 0.1026,0.0738 z\u0027 id\u003d\u0027path14\u0027 /%3E %3C/g%3E %3C/g%3E%3C/svg%3E" + }, + "description": "Do a simple ping as a Worker, and return a timestamp. A Delay can be set as parameter.", + "appliesTo": [ + "bpmn:Task" + ], + "groups": [ + { + "label": "Input", + "id": "Input" + }, + { + "label": "Output", + "id": "Output" + } + ], + "id": "io.camunda.cherry.ping.PingWorker", + "category": { + "name": "connectors", + "id": "connectors" + }, + "documentationRef": "https://docs.camunda.io/docs/components/modeler/web-modeler/connectors/available-connectors/template/", + "elementType": { + "value": "bpmn:ServiceTask" + }, + "properties": [ + { + "value": "c-ping", + "type": "Hidden", + "binding": { + "type": "zeebe:taskDefinition:type" + } + }, + { + "description": "Message to log", + "binding": { + "name": "message_optional", + "type": "zeebe:input" + }, + "id": "message_optional", + "label": "Provide Message?", + "type": "Dropdown", + "choices": [ + { + "name": "Yes", + "value": "true" + }, + { + "name": "No", + "value": "false" + } + ], + "value": "false", + "group": "Input" + }, + { + "condition": { + "equals": "true", + "property": "message_optional" + }, + "description": "Message to log", + "binding": { + "name": "message", + "type": "zeebe:input" + }, + "id": "message", + "label": "Message", + "type": "String", + "group": "Input" + }, + { + "description": "Delay to sleep", + "binding": { + "name": "delay_optional", + "type": "zeebe:input" + }, + "id": "delay_optional", + "label": "Provide Delay?", + "type": "Dropdown", + "choices": [ + { + "name": "Yes", + "value": "true" + }, + { + "name": "No", + "value": "false" + } + ], + "value": "false", + "group": "Input" + }, + { + "condition": { + "equals": "true", + "property": "delay_optional" + }, + "description": "Delay to sleep", + "binding": { + "name": "delay", + "type": "zeebe:input" + }, + "id": "delay", + "label": "Delay", + "type": "String", + "group": "Input" + }, + { + "description": "Produce a timestamp", + "binding": { + "name": "timestamp_optional", + "type": "zeebe:input" + }, + "id": "timestamp_optional", + "label": "Saved Time stamp?", + "type": "Dropdown", + "choices": [ + { + "name": "Yes", + "value": "true" + }, + { + "name": "No", + "value": "false" + } + ], + "value": "false", + "group": "Output" + }, + { + "condition": { + "equals": "true", + "property": "timestamp_optional" + }, + "description": "Produce a timestamp", + "binding": { + "source": "\u003d timestamp", + "type": "zeebe:output" + }, + "id": "timestamp", + "label": "Time stamp", + "type": "String", + "constraints": { + "notEmpty": true + }, + "group": "Output" + } + ] + } +] \ No newline at end of file diff --git a/pom.xml b/pom.xml index 9511cc6..71075aa 100644 --- a/pom.xml +++ b/pom.xml @@ -2,213 +2,264 @@ - 4.0.0 + 4.0.0 + org.camunda.community + zeebe-cherry-framework + 2.3.0 + + + 17 + ${java.version} + ${java.version} + + 8.1.4 + 0.3.0 + 0.3.0 + + + 1.1.0 + + 5.9.1 + 2.0.3 + 2.7.4 + + + + + + org.camunda.community - zeebe-cherry-framework - 2.2.0 + community-hub-release-parent + 1.3.1 + + + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring.boot.version} + pom + import + + + + + + + io.camunda + spring-zeebe-starter + ${zeebe.version} + + + io.camunda + zeebe-client-java + ${zeebe.version} + + - - 17 - ${java.version} - ${java.version} + + + io.camunda.connector + connector-core + ${connector-core.version} + + + io.camunda.connector + connector-validation + ${connector-validation.version} + - 8.1.4 - 0.3.0 - 0.3.0 + + + io.camunda.filestorage + filestorage + ${filestorage.version} + - - 1.0.0 - 5.9.1 - 2.0.3 - 2.7.4 - + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + 2.13.4 + + + com.google.code.gson + gson + 2.10 + + + + org.springframework.boot + spring-boot-starter-web + ${spring.boot.version} + + + org.springframework.boot + spring-boot-starter-mustache + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + + org.springframework.boot + spring-boot-configuration-processor + true + - - - - org.camunda.community - community-hub-release-parent - 1.3.1 - + + + com.h2database + h2 + 2.1.214 + + + org.postgresql + postgresql + - + + + + org.webjars + jquery + 3.6.0 + + + org.webjars.npm + bulma + 0.9.4 + + + org.webjars + font-awesome + 6.2.0 + + + org.webjars + datatables + 1.12.1 + + + org.webjars.npm + mustache + 4.2.0 + + + + org.apache.chemistry.opencmis + chemistry-opencmis-client-impl + 1.1.0 + + + + + + io.zeebe + zeebe-worker-java-testutils + 8.1.3 + test + + + org.junit.jupiter + junit-jupiter-engine + ${junit.jupiter.version} + test + + + org.junit.jupiter + junit-jupiter-api + ${junit.jupiter.version} + test + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 - - - org.springframework.boot - spring-boot-dependencies - ${spring.boot.version} - pom - import - + + org.junit.platform + junit-platform-surefire-provider + 1.3.2 + - + + + org.apache.maven.plugins + maven-compiler-plugin + 3.10.1 + + 17 + 17 + + - - - io.camunda - spring-zeebe-starter - ${zeebe.version} - - - io.camunda - zeebe-client-java - ${zeebe.version} - - - - - - - io.camunda.connector - connector-core - ${connector-core.version} - - - io.camunda.connector - connector-validation - ${connector-validation.version} - - - - - - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - 2.13.4 - - - com.google.code.gson - gson - 2.10 - - - - - org.springframework.boot - spring-boot-starter-web - ${spring.boot.version} - - - org.springframework.boot - spring-boot-starter-mustache - - - - - - org.springframework.boot - spring-boot-configuration-processor - true - - - - - org.webjars - jquery - 3.6.0 - - - org.webjars.npm - bulma - 0.9.4 - - - org.webjars - font-awesome - 6.2.0 - - - org.webjars - datatables - 1.12.1 - - - org.webjars.npm - mustache - 4.2.0 - - - - org.apache.chemistry.opencmis - chemistry-opencmis-client-impl - 1.1.0 - - - - io.zeebe - zeebe-worker-java-testutils - 8.1.3 - test - - - org.junit.jupiter - junit-jupiter-engine - ${junit.jupiter.version} - test - - - org.junit.jupiter - junit-jupiter-api - ${junit.jupiter.version} - test - + + + org.springframework.boot + spring-boot-maven-plugin + 2.7.5 + + io.camunda.CherryApplication + + + + + + + - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.22.2 - - - org.junit.platform - junit-platform-surefire-provider - 1.3.2 - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.10.1 - - 17 - 17 - - - - - - org.springframework.boot - spring-boot-maven-plugin - 2.7.5 - - io.camunda.CherryApplication - - - - - - - + + + + true + + + false + + connectors + Connectors Repository + https://artifacts.camunda.com/artifactory/connectors/ + + + + false + + + true + + connectors-snapshots + Connectors Snapshot Repository + https://artifacts.camunda.com/artifactory/connectors-snapshots/ + + + + true + + + false + + camunda-community + Camunda Community + https://artifacts.camunda.com/artifactory/camunda-bpm-community-extensions/ + + diff --git a/src/main/java/io/camunda/cherry/admin/AdminRestController.java b/src/main/java/io/camunda/cherry/admin/AdminRestController.java index 2132b4c..277db62 100644 --- a/src/main/java/io/camunda/cherry/admin/AdminRestController.java +++ b/src/main/java/io/camunda/cherry/admin/AdminRestController.java @@ -38,6 +38,13 @@ public class AdminRestController { @Autowired private List listRunner; + @GetMapping(value = "/api/runtime/parameters", produces = "application/json") + public Map getParameters() { + Map parameters = new HashMap<>(); + parameters.put("NumberOfThreads", cherryJobRunnerFactory.getNumberOfThreads()); + return parameters; + + } @GetMapping(value = "/api/runtime/threads", produces = "application/json") public Integer getNumberOfThreads() { return cherryJobRunnerFactory.getNumberOfThreads(); @@ -50,11 +57,5 @@ public void setNumberOfThread(@RequestParam(name = "threads") Integer numberOfTh } - @GetMapping(value = "/api/runtime/info", produces = "application/json") - public Map getInfo( @RequestParam(name = "delaystatsinhours", required = false) Integer delayStatsInHours) { - Map info = new HashMap<>(); - info.put("performance", cherryHistoricFactory.getEnginePerformance(delayStatsInHours==null? 24 : delayStatsInHours)); - info.put("statistic", cherryHistoricFactory.getEngineStatistic(delayStatsInHours==null? 24 : delayStatsInHours)); - return info; - } + } diff --git a/src/main/java/io/camunda/cherry/admin/RunnerRestController.java b/src/main/java/io/camunda/cherry/admin/RunnerRestController.java index 1ae4075..897416c 100644 --- a/src/main/java/io/camunda/cherry/admin/RunnerRestController.java +++ b/src/main/java/io/camunda/cherry/admin/RunnerRestController.java @@ -30,6 +30,7 @@ import org.springframework.web.server.ResponseStatusException; import java.io.IOException; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -47,7 +48,7 @@ public class RunnerRestController { CherryHistoricFactory cherryHistoricFactory; /** - * Spring populate the list of all workers + * Spring populate the list of all runners */ @Autowired private List listRunners; @@ -78,6 +79,37 @@ public List getWorkersList(@RequestParam(name = "logo", requi }).toList(); } + @GetMapping(value = "/api/runner/dashboard", produces = "application/json") + public Map getDashboard(@RequestParam(name = "delaystatsinhours", required = false) Integer delayStatsInHours) { + Map info=new HashMap<>(); + int delayStatsInHoursInt = delayStatsInHours==null? 24: delayStatsInHours; + + long totalSucceeded=0; + long totalFailed=0; + List> listDetails = new ArrayList<>(); + for (AbstractRunner runner: listRunners ) { + Map infoRunner = new HashMap<>(); + CherryHistoricFactory.Statistic statisticRunner = cherryHistoricFactory.getStatistic(runner.getType(), delayStatsInHoursInt); + infoRunner.put("name", runner.getName()); + infoRunner.put("logo", runner.getLogo() ); + try { + infoRunner.put("active", cherryJobRunnerFactory.isRunnerActive(runner.getName())); + } catch (CherryJobRunnerFactory.OperationException e) { + infoRunner.put("active", false); + } + infoRunner.put("statistic", statisticRunner); + infoRunner.put("performance", cherryHistoricFactory.getPerformance(runner.getType(), delayStatsInHoursInt)); + listDetails.add( infoRunner); + totalSucceeded += statisticRunner.succeeded; + totalFailed += statisticRunner.failed; + } + info.put("details", listDetails); + info.put("totalsucceeded",totalSucceeded); + info.put("totalfailed",totalFailed); + info.put("totalexecutions",totalSucceeded+totalFailed); + info.put("nbRunners",listRunners.size()); + return info; + } @GetMapping(value = "/api/runner/detail", produces = "application/json") public Optional getWorker(@RequestParam(name = "name") String runnerName, @RequestParam(name = "logo", required = false) Boolean logo, @@ -86,8 +118,9 @@ public Optional getWorker(@RequestParam(name = "name") String return listRunners.stream() .filter(worker -> worker.getIdentification().equals(runnerName)) .map(RunnerInformation::getRunnerInformation) - .map(w -> this.completeRunnerInformation(w, logo == null || logo, stats == null ? false : stats, - delayStatsInHours)) + .map(w -> this.completeRunnerInformation(w, logo == null || logo, + stats == null ? false : stats, // false if not asked + delayStatsInHours == null ? Integer.valueOf(24) : delayStatsInHours)) // 23 hours is not set .findFirst(); } @@ -178,6 +211,9 @@ ResponseEntity downloadTemplate(@RequestParam(name = "name", required = false) S @RequestParam(name = "separatetemplate", required = false) Boolean separateTemplate) throws IOException { boolean withFrameworkRunnersIncluded = (withFrameworkRunners != null && withFrameworkRunners); + // Zip file required? Add all templates in the ZIP. + if (separateTemplate==null && withFrameworkRunners==null) + withFrameworkRunnersIncluded=true; logger.info( "Download template requested for " + (runnerName == null ? "Complete collection" : "[" + runnerName + "]") + " FrameworkIncluded[" + withFrameworkRunnersIncluded + "]"); diff --git a/src/main/java/io/camunda/cherry/db/entity/RunnerExecutionEntity.java b/src/main/java/io/camunda/cherry/db/entity/RunnerExecutionEntity.java new file mode 100644 index 0000000..ed39552 --- /dev/null +++ b/src/main/java/io/camunda/cherry/db/entity/RunnerExecutionEntity.java @@ -0,0 +1,40 @@ +package io.camunda.cherry.db.entity; + + +import io.camunda.cherry.definition.AbstractRunner; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import java.time.Instant; + +@Entity +@Table(name = "RUNNEREXECUTION") +public class RunnerExecutionEntity { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + + @Column(name = "runner_type", length = 100) + public String runnerType; + + @Column(name = "execution_time") + public Instant executionTime; + + + @Column(name = "execution_ms") + public Long executionMs; + + @Column(name = "status", length = 100) + @Enumerated(EnumType.STRING) + public AbstractRunner.ExecutionStatusEnum status; + + // Save Log information: https://github.com/janzyka/blobs-jpa/ + +} diff --git a/src/main/java/io/camunda/cherry/db/repository/RunnerExecutionRepository.java b/src/main/java/io/camunda/cherry/db/repository/RunnerExecutionRepository.java new file mode 100644 index 0000000..357a94c --- /dev/null +++ b/src/main/java/io/camunda/cherry/db/repository/RunnerExecutionRepository.java @@ -0,0 +1,30 @@ +package io.camunda.cherry.db.repository; + +import io.camunda.cherry.db.entity.RunnerExecutionEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.time.Instant; +import java.util.List; +import java.util.Map; + +public interface RunnerExecutionRepository extends JpaRepository { + + @Query("select runnerexecution from RunnerExecutionEntity runnerexecution" + + " where runnerexecution.executionTime >= :dateToSearch ") + RunnerExecutionEntity findLastRecord(@Param("dateToSearch") Instant dateToSearch); + + @Query( + "select runnerexecution.status as status, count(runnerexecution) as number from RunnerExecutionEntity runnerexecution" + + " where runnerexecution.executionTime >= :dateToSearch " + " and runnerexecution.runnerType = :runnerType" + + " group by runnerexecution.status") + List> selectStatusStats(@Param("runnerType") String runnerType, + @Param("dateToSearch") Instant dateToSearch); + + @Query("select runnerexecution from RunnerExecutionEntity runnerexecution" + + " where runnerexecution.executionTime >= :dateToSearch " + " and runnerexecution.runnerType = :runnerType") + List selectRunnerRecords(@Param("runnerType") String runnerType, + @Param("dateToSearch") Instant dateToSearch); + +} diff --git a/src/main/java/io/camunda/cherry/definition/AbstractRunner.java b/src/main/java/io/camunda/cherry/definition/AbstractRunner.java index cfb7ce2..d060836 100644 --- a/src/main/java/io/camunda/cherry/definition/AbstractRunner.java +++ b/src/main/java/io/camunda/cherry/definition/AbstractRunner.java @@ -13,10 +13,10 @@ package io.camunda.cherry.definition; import com.google.gson.Gson; -import io.camunda.file.storage.FileRepoFactory; -import io.camunda.file.storage.FileVariable; -import io.camunda.file.storage.FileVariableReference; -import io.camunda.file.storage.StorageDefinition; +import io.camunda.filestorage.FileRepoFactory; +import io.camunda.filestorage.FileVariable; +import io.camunda.filestorage.FileVariableReference; +import io.camunda.filestorage.StorageDefinition; import io.camunda.zeebe.client.api.response.ActivatedJob; import io.camunda.zeebe.spring.client.exception.ZeebeBpmnError; import io.camunda.cherry.runtime.ZeebeContainer; @@ -44,6 +44,12 @@ public abstract class AbstractRunner { // This idea was inspired by: https://stackoverflow.com/questions/40402756/check-if-a-string-is-parsable-as-another-java-type static Map, Predicate> canParsePredicates = new HashMap<>(); + /** + * Execution can be SUCCESS, FAIL (then runner ask to retry) or BPMNERROR + */ + public enum ExecutionStatusEnum {SUCCESS, FAIL, BPMNERROR} + + @Autowired ZeebeContainer zeebeContainer; diff --git a/src/main/java/io/camunda/cherry/definition/AbstractWorker.java b/src/main/java/io/camunda/cherry/definition/AbstractWorker.java index 6d7284a..05b219b 100644 --- a/src/main/java/io/camunda/cherry/definition/AbstractWorker.java +++ b/src/main/java/io/camunda/cherry/definition/AbstractWorker.java @@ -7,17 +7,25 @@ /* ******************************************************************** */ package io.camunda.cherry.definition; +import io.camunda.cherry.runtime.CherryHistoricFactory; import io.camunda.zeebe.client.api.response.ActivatedJob; import io.camunda.zeebe.client.api.worker.JobClient; import io.camunda.zeebe.client.api.worker.JobHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import java.time.Instant; import java.util.List; import java.util.stream.Collectors; public abstract class AbstractWorker extends AbstractRunner implements JobHandler { Logger loggerAbstractWorker = LoggerFactory.getLogger(AbstractWorker.class.getName()); + + @Autowired + CherryHistoricFactory cherryHistoricFactory; + + /* -------------------------------------------------------- */ /* */ /* Administration */ @@ -49,6 +57,7 @@ protected AbstractWorker(String type, * @param activatedJob information on job to execute */ public void handle(final JobClient jobClient, final ActivatedJob activatedJob) { + Instant executionInstant = Instant.now(); ContextExecution contextExecution = new ContextExecution(); contextExecution.beginExecution = System.currentTimeMillis(); @@ -70,13 +79,19 @@ public void handle(final JobClient jobClient, final ActivatedJob activatedJob) { validateInput(); // ok, this is correct, execute it now - execute(jobClient, activatedJob, contextExecution); + ExecutionStatusEnum status; + try { + execute(jobClient, activatedJob, contextExecution); - validateOutput(); - - // let's verify the execution respect the output contract - checkOutput(contextExecution); + validateOutput(); + // let's verify the execution respect the output contract + checkOutput(contextExecution); + status = ExecutionStatusEnum.SUCCESS; + } catch (Exception e) { + loggerAbstractWorker.error("Error during execution "+e.getMessage()+" " +e.getCause()); + status=ExecutionStatusEnum.FAIL; + } // save the output in the process instance jobClient.newCompleteCommand(activatedJob.getKey()).variables(contextExecution.outVariablesValue).send().join(); @@ -86,6 +101,13 @@ public void handle(final JobClient jobClient, final ActivatedJob activatedJob) { logInfo("End in " + (contextExecution.endExecution - contextExecution.beginExecution) + " ms"); else if (contextExecution.endExecution - contextExecution.beginExecution > 2000) logInfo("End in " + (contextExecution.endExecution - contextExecution.beginExecution) + " ms (long)"); + + + // save execution + cherryHistoricFactory.saveExecution( executionInstant, + getType(), + status, + contextExecution.endExecution - contextExecution.beginExecution); } @@ -110,6 +132,7 @@ else if (contextExecution.endExecution - contextExecution.beginExecution > 2000) * * @param message message to log */ + @Override public void logInfo(String message) { loggerAbstractWorker.info("CherryWorker[" + getIdentification() + "]:" + message); } diff --git a/src/main/java/io/camunda/cherry/definition/CherryConnectorJobHandler.java b/src/main/java/io/camunda/cherry/definition/CherryConnectorJobHandler.java new file mode 100644 index 0000000..5d7fbe7 --- /dev/null +++ b/src/main/java/io/camunda/cherry/definition/CherryConnectorJobHandler.java @@ -0,0 +1,51 @@ +package io.camunda.cherry.definition; + +import io.camunda.cherry.runtime.CherryHistoricFactory; +import io.camunda.connector.api.error.ConnectorException; +import io.camunda.connector.runtime.util.outbound.ConnectorJobHandler; +import io.camunda.zeebe.client.api.response.ActivatedJob; +import io.camunda.zeebe.client.api.worker.JobClient; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.time.Instant; + +/** + * This job handler intercept the execution to the result + */ +public class CherryConnectorJobHandler extends ConnectorJobHandler { + Logger logger = LoggerFactory.getLogger(CherryConnectorJobHandler.class.getName()); + + CherryHistoricFactory cherryHistoricFactory; + + private final AbstractConnector abstractConnector; + + public CherryConnectorJobHandler(AbstractConnector abstractConnector, CherryHistoricFactory cherryHistoricFactory) { + super(abstractConnector); + this.abstractConnector = abstractConnector; + this.cherryHistoricFactory = cherryHistoricFactory; + } + + @Override + public void handle(JobClient client, ActivatedJob job) { + Instant executionInstant = Instant.now(); + long beginExecution = System.currentTimeMillis(); + AbstractRunner.ExecutionStatusEnum status; + try { + super.handle(client, job); + status = AbstractRunner.ExecutionStatusEnum.SUCCESS; + } catch (ConnectorException e) { + status = AbstractRunner.ExecutionStatusEnum.BPMNERROR; + } catch (Exception e) { + status = AbstractRunner.ExecutionStatusEnum.FAIL; + } + long endExecution = System.currentTimeMillis(); + logger.info( + "Connector[" + abstractConnector.getName() + "] executed in " + (endExecution - beginExecution) + " ms"); + + cherryHistoricFactory.saveExecution(executionInstant, abstractConnector.getType(), status, + endExecution - beginExecution); + + } + +} diff --git a/src/main/java/io/camunda/cherry/definition/RunnerDecorationTemplate.java b/src/main/java/io/camunda/cherry/definition/RunnerDecorationTemplate.java index 0434530..b23dc8f 100644 --- a/src/main/java/io/camunda/cherry/definition/RunnerDecorationTemplate.java +++ b/src/main/java/io/camunda/cherry/definition/RunnerDecorationTemplate.java @@ -7,254 +7,295 @@ package io.camunda.cherry.definition; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; -import java.lang.reflect.Method; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; public class RunnerDecorationTemplate { - /* We want to keep the Output parameter at the end. - * when a field has a group in the list, it is placed in top. - * When a field does not have a group, it is placed after in a group "custom properties" - * so, we assign a Input group or an Output group by default to each field. - * */ + /* We want to keep the Output parameter at the end. + * when a field has a group in the list, it is placed in top. + * When a field does not have a group, it is placed after in a group "custom properties" + * so, we assign a Input group or an Output group by default to each field. + * */ + + public static final String GROUP_OUTPUT = "Output"; + public static final String GROUP_INPUT = "Input"; + public static final String ATTR_LABEL = "label"; + public static final String ATTR_TYPE = "type"; + public static final String ZEEBE_TASK_HEADER = "zeebe:taskHeader"; + public static final String ATTR_GROUPS = "groups"; + public static final String ATTR_TYPE_HIDDEN = "Hidden"; + public static final String ATTR_KEY = "key"; + public static final String ATTR_VALUE = "value"; + public static final String ATTR_DESCRIPTION = "description"; + public static final String ATTR_BINDING = "binding"; + public static final String ATTR_KEY_RESULT_VARIABLE = "Result Variable"; + public static final String ZEEBE_TASK_DEFINITION_TYPE = "zeebe:taskDefinition:type"; + public static final String RESULT_VARIABLE = "result"; + public static final String ATTR_NAME = "name"; + public static final String ATTR_ID = "id"; + public static final String ATTR_DOCUMENTATION_REF = "documentationRef"; + public static final String ATTR_ICON = "icon"; + public static final String ATTR_CATEGORY = "category"; + public static final String ATTR_APPLIES_TO = "appliesTo"; + public static final String ATTR_ELEMENT_TYPE = "elementType"; + public static final String ATTR_PROPERTIES = "properties"; + public static final String ATTR_CHOICES = "choices"; + public static final String ATTR_CONDITION = "condition"; + public static final String ATTR_GROUP = "group"; + public static final String TYPE_FIELD_STRING = "String"; + public static final String TYPE_FIELD_DROPDOWN = "Dropdown"; + public static final String ATTR_CONSTRAINTS_NOT_EMPTY = "notEmpty"; + public static final String ATTR_CONSTRAINTS = "constraints"; + + private final AbstractRunner runner; + + public RunnerDecorationTemplate(AbstractRunner runner) { + this.runner = runner; + } + + public static String getJsonFromList(List> listTemplates) { + // transform the result in JSON + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + return gson.toJson(listTemplates); + } + + /** + * produce a JSON string containing the definition for the template + * https://docs.camunda.io/docs/components/modeler/desktop-modeler/element-templates/defining-templates/ + * + * @return the template + */ + + public Map getTemplate() { + + Map templateContent = new HashMap<>(); + if (!runner.checkValidDefinition().listOfErrors().isEmpty()) + return templateContent; + + templateContent.put("$schema", + "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json"); + templateContent.put(ATTR_NAME, runner.getDisplayLabel()); + templateContent.put(ATTR_ID, runner.getClass().getName()); + templateContent.put(ATTR_DESCRIPTION, runner.getDescription()); + templateContent.put(ATTR_DOCUMENTATION_REF, + "https://docs.camunda.io/docs/components/modeler/web-modeler/connectors/available-connectors/template/"); + if (runner.getLogo() != null) + templateContent.put(ATTR_ICON, Map.of("contents", runner.getLogo())); + templateContent.put(ATTR_CATEGORY, Map.of(ATTR_ID, "connectors", ATTR_NAME, "connectors")); + templateContent.put(ATTR_APPLIES_TO, List.of("bpmn:Task")); + templateContent.put(ATTR_ELEMENT_TYPE, Map.of(ATTR_VALUE, "bpmn:ServiceTask")); + // no groups at this moment + List> listProperties = new ArrayList<>(); + templateContent.put(ATTR_PROPERTIES, listProperties); + listProperties.add(Map.of(ATTR_TYPE, ATTR_TYPE_HIDDEN, // Hidden + ATTR_VALUE, runner.getType(), // Default value + ATTR_BINDING, Map.of(ATTR_TYPE, ZEEBE_TASK_DEFINITION_TYPE))); + boolean pleaseAddOutputGroup = false; + if (runner instanceof AbstractConnector) { + pleaseAddOutputGroup = true; + + // there is here two options: + // connector return and object or a list of output + if (runner.getListOutput().isEmpty()) { + // connector returns an object + listProperties.add(Map.of( // list of properties + ATTR_LABEL, "Result Variable Label", // Label + ATTR_TYPE, TYPE_FIELD_STRING, ATTR_VALUE, RESULT_VARIABLE, // Variable Value Name + ATTR_GROUPS, "output", // set in the output group + ATTR_BINDING, Map.of(ATTR_TYPE, ZEEBE_TASK_HEADER, ATTR_KEY, ATTR_KEY_RESULT_VARIABLE))); + } else { + listProperties.add(Map.of( // list of properties + ATTR_TYPE, ATTR_TYPE_HIDDEN, // Hidden, because one field is created per output + ATTR_VALUE, RESULT_VARIABLE, // save the result in the result variable + ATTR_BINDING, Map.of(ATTR_TYPE, ZEEBE_TASK_HEADER, ATTR_KEY, ATTR_KEY_RESULT_VARIABLE))); + } + } + // Identify all groups + List listGroups = new ArrayList<>(); + listGroups.addAll(runner.getListInput().stream().filter(w -> w.group != null).map(w -> w.group).toList()); - public static final String GROUP_OUTPUT = "Output"; - public static final String GROUP_INPUT = "Input"; + // We group all result in a Group Input + if (!runner.getListInput().isEmpty()) + listGroups.add(new RunnerParameter.Group(GROUP_INPUT, "Input")); - private final AbstractRunner runner; + // We group all result in a Group Output + if (!runner.getListOutput().isEmpty() || pleaseAddOutputGroup) + listGroups.add(new RunnerParameter.Group(GROUP_OUTPUT, "Output")); + if (listGroups != null) { + templateContent.put(ATTR_GROUPS, + listGroups.stream().distinct().map(w -> Map.of(ATTR_ID, w.id(), ATTR_LABEL, w.label())).toList()); + } - public RunnerDecorationTemplate(AbstractRunner runner) { - this.runner = runner; + for (RunnerParameter runnerParameter : runner.getListInput()) { + // do not generate a propertie for a accessAllVariables + if (runnerParameter.isAccessAllVariables()) + continue; + listProperties.addAll(getParameterProperties(runnerParameter, true, "")); + } + for (RunnerParameter runnerParameter : runner.getListOutput()) { + // do not generate a property for accessAllVariables + if (runnerParameter.isAccessAllVariables()) + continue; + listProperties.addAll(getParameterProperties(runnerParameter, false, + runner instanceof AbstractConnector ? RESULT_VARIABLE + "." : "")); } - public static String getJsonFromList(List> listTemplates) { - // transform the result in JSON - Gson gson = new Gson(); - return gson.toJson(listTemplates); + // check if the runner generates error + if (!runner.getListBpmnErrors().isEmpty()) { + // { + // "label": "Error Expression", + // "description": "Expression to define BPMN Errors to throw", + // "group": "errors", + // "type": "Hidden", + // "value": "bpmnError(error.code, error.message)", + // "binding": { + // "type": "zeebe:taskHeader", + // "key": "errorExpression" + // } + HashMap errorParameters = new HashMap<>(); + errorParameters.put(ATTR_LABEL, "Error Expression"); + errorParameters.put(ATTR_DESCRIPTION, "Expression to define BPMN Errors to throw"); + errorParameters.put(ATTR_TYPE, ATTR_TYPE_HIDDEN); + errorParameters.put(ATTR_VALUE, "bpmnError(error.code, error.message)"); + errorParameters.put(ATTR_BINDING, Map.of(ATTR_TYPE, ZEEBE_TASK_HEADER, ATTR_KEY, "errorExpression")); + + listProperties.add(errorParameters); } + return templateContent; + } + + /** + * Get the template from a runnerParameter + * + * @param runnerParameter runner parameter to get the description + * @param isInput true if this is an input parameter + * @param prefixName add a prefixName to the source in the binding (mandatory for connectors) + * @return a template description + */ + private List> getParameterProperties(RunnerParameter runnerParameter, + boolean isInput, + String prefixName) { + List> listProperties = new ArrayList<>(); + + // Calculate the condition + HashMap condition = null; + if (runnerParameter.conditionProperty != null) { + condition = new HashMap<>(); + condition.put("property", runnerParameter.conditionProperty); + condition.put("oneOf", runnerParameter.conditionOneOf); + } /** - * produce a JSON string containing the definition for the template - * https://docs.camunda.io/docs/components/modeler/desktop-modeler/element-templates/defining-templates/ - * - * @return the template + * To have a checkbox, the parameter must be optionnal AND does not have already a condition */ + boolean addConditionCheckbox = + (runnerParameter.conditionProperty == null) && (RunnerParameter.Level.OPTIONAL.equals( + runnerParameter.getLevel())); + + if (runnerParameter.visibleInTemplate) + addConditionCheckbox = false; + // Add the condition for all output + if (!isInput) + addConditionCheckbox = true; + + // is the parameter is optional? Add a checkbox first + if (addConditionCheckbox) { + Map propertyCheckbox = new HashMap<>(); + listProperties.add(propertyCheckbox); + // the ID property is the value to link with the conditional + propertyCheckbox.put(ATTR_ID, runnerParameter.name + "_optional"); + if (isInput) + propertyCheckbox.put(ATTR_LABEL, "Provide " + runnerParameter.label + "?"); + else + propertyCheckbox.put(ATTR_LABEL, "Saved " + runnerParameter.label + "?"); + // don't have the group at this moment + propertyCheckbox.put(ATTR_DESCRIPTION, runnerParameter.explanation); + propertyCheckbox.put(ATTR_VALUE, "false"); + propertyCheckbox.put(ATTR_BINDING, Map.of(ATTR_TYPE, "zeebe:input", ATTR_NAME, runnerParameter.name + "_optional")); + + propertyCheckbox.put(ATTR_TYPE, TYPE_FIELD_DROPDOWN); + List> listYesNoChoices = new ArrayList<>(); + listYesNoChoices.add(Map.of(ATTR_NAME, "Yes", ATTR_VALUE, "true")); + listYesNoChoices.add(Map.of(ATTR_NAME, "No", ATTR_VALUE, "false")); + propertyCheckbox.put(ATTR_CHOICES, listYesNoChoices); + + // if the parameters has a condition, add it here + if (condition != null) + propertyCheckbox.put(ATTR_CONDITION, condition); + if (runnerParameter.group != null) + propertyCheckbox.put(ATTR_GROUP, runnerParameter.group.id()); + else + propertyCheckbox.put(ATTR_GROUP, isInput ? GROUP_INPUT : GROUP_OUTPUT); + } - public Map getTemplate() { - - Map templateContent = new HashMap<>(); - if (! runner.checkValidDefinition().listOfErrors().isEmpty()) - return templateContent; - - templateContent.put("$schema", "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json"); - templateContent.put("name", runner.getDisplayLabel()); - templateContent.put("id", runner.getClass().getName()); - templateContent.put("description", runner.getDescription()); - templateContent.put("documentationRef", "https://docs.camunda.io/docs/components/modeler/web-modeler/connectors/available-connectors/template/"); - if (runner.getLogo() != null) - templateContent.put("icon", Map.of("contents", runner.getLogo())); - templateContent.put("category", Map.of("id", "connectors", "name", "connectors")); - templateContent.put("appliesTo", List.of("bpmn:Task")); - templateContent.put("elementType", Map.of("value", "bpmn:ServiceTask")); - // no groups at this moment - List> listProperties = new ArrayList<>(); - templateContent.put("properties", listProperties); - listProperties.add( - Map.of("type", "Hidden", - "value", runner.getType(), - "binding", Map.of("type", "zeebe:taskDefinition:type"))); - boolean pleaseAddOutputGroup=false; - if (runner instanceof AbstractConnector connector) { - pleaseAddOutputGroup=true; - - // there is here two options: - // connector return and object or a list of output - if (runner.getListOutput().isEmpty()) { - // connector returns an object - listProperties.add(Map.of( - "label", "Result Variable", - "type", "String", - "value", "result", - "group", "output", - "binding", Map.of("type", "zeebe:taskHeader", "key", "resultVariable"))); - } - else { - listProperties.add(Map.of( - "type", "Hidden", - "value", "result", - "binding", Map.of("type", "zeebe:taskHeader", "key", "resultVariable") - )); - } - } - // Identify all groups - List listGroups = new ArrayList<>(); - listGroups.addAll(runner.getListInput().stream() - .filter(w -> w.group != null) - .map(w -> w.group) - .toList()); - - // We group all result in a Group Input - if (!runner.getListInput().isEmpty()) - listGroups.add(new RunnerParameter.Group(GROUP_INPUT, "Input")); - - // We group all result in a Group Output - if (!runner.getListOutput().isEmpty() || pleaseAddOutputGroup) - listGroups.add(new RunnerParameter.Group(GROUP_OUTPUT, "Output")); - - - if (listGroups != null) { - templateContent.put("groups", - listGroups.stream() - .distinct() - .map(w -> Map.of("id", w.id(), "label", w.label())) - .toList()); - } - - for (RunnerParameter runnerParameter : runner.getListInput()) { - // do not generate a propertie for a accessAllVariables - if (runnerParameter.isAccessAllVariables()) - continue; - listProperties.addAll(getParameterProperties(runnerParameter, true,"")); - } - for (RunnerParameter runnerParameter : runner.getListOutput()) { - // do not generate a property for accessAllVariables - if (runnerParameter.isAccessAllVariables()) - continue; - listProperties.addAll(getParameterProperties(runnerParameter, false, runner instanceof AbstractConnector? "result.":"")); - } - return templateContent; + Map propertyParameter = new HashMap<>(); + listProperties.add(propertyParameter); + propertyParameter.put(ATTR_ID, runnerParameter.name); + propertyParameter.put(ATTR_LABEL, runnerParameter.label); + // don't have the group at this moment + propertyParameter.put(ATTR_DESCRIPTION, runnerParameter.explanation); + if (runnerParameter.defaultValue != null) { + propertyParameter.put(ATTR_VALUE, runnerParameter.defaultValue); + } + String typeParameter = TYPE_FIELD_STRING; + // String, Text, Boolean, Dropdown or Hidden) + if (Boolean.class.equals(runnerParameter.clazz)) { + typeParameter = TYPE_FIELD_DROPDOWN; + List> listYesNoChoices = new ArrayList<>(); + listYesNoChoices.add(Map.of(ATTR_NAME, "Yes", ATTR_VALUE, "true")); + listYesNoChoices.add(Map.of(ATTR_NAME, "No", ATTR_VALUE, "false")); + propertyParameter.put(ATTR_CHOICES, listYesNoChoices); + } else if (runnerParameter.hasChoice()) { + typeParameter = TYPE_FIELD_DROPDOWN; + // add choices + List> listChoices = new ArrayList<>(); + for (RunnerParameter.WorkerParameterChoice oneChoice : runnerParameter.workerParameterChoiceList) { + listChoices.add(Map.of(ATTR_NAME, oneChoice.displayName, ATTR_VALUE, oneChoice.code)); + } + propertyParameter.put(ATTR_CHOICES, listChoices); } + propertyParameter.put(ATTR_TYPE, typeParameter); + if (isInput) { + propertyParameter.put(ATTR_BINDING, Map.of(ATTR_TYPE, "zeebe:input", ATTR_NAME, runnerParameter.name)); + } else { + propertyParameter.put(ATTR_BINDING, + Map.of(ATTR_TYPE, "zeebe:output", "source", "= " + prefixName + runnerParameter.name)); - /** - * Get the template from a runnerParameter - * - * @param runnerParameter runner parameter to get the description - * @param isInput true if this is an input parameter - * @param prefixName add a prefixName to the source in the binding (mandatory for connectors) - * @return a template description - */ - private List> getParameterProperties(RunnerParameter runnerParameter, boolean isInput, String prefixName) { - List> listProperties = new ArrayList<>(); - - // Calculate the condition - HashMap condition = null; - if (runnerParameter.conditionProperty != null) { - condition = new HashMap<>(); - condition.put("property", runnerParameter.conditionProperty); - condition.put("oneOf", runnerParameter.conditionOneOf); - } - /** - * To have a checkbox, the parameter must be optionnal AND does not have already a condition - */ - boolean addConditionCheckbox = (runnerParameter.conditionProperty == null) && - (RunnerParameter.Level.OPTIONAL.equals(runnerParameter.getLevel())); - - if (runnerParameter.visibleInTemplate) - addConditionCheckbox = false; - // Add the condition for all output - if (!isInput) - addConditionCheckbox = true; - - // is the parameter is optional? Add a checkbox first - if (addConditionCheckbox) { - Map propertyCheckbox = new HashMap<>(); - listProperties.add(propertyCheckbox); - // the ID property is the value to link with the conditional - propertyCheckbox.put("id", runnerParameter.name + "_optional"); - if (isInput) - propertyCheckbox.put("label", "Provide " + runnerParameter.label + "?"); - else - propertyCheckbox.put("label", "Saved " + runnerParameter.label + "?"); - // don't have the group at this moment - propertyCheckbox.put("description", runnerParameter.explanation); - propertyCheckbox.put("value", "false"); - propertyCheckbox.put("binding", Map.of("type", "zeebe:input", - "name", runnerParameter.name + "_optional")); - - propertyCheckbox.put("type", "Dropdown"); - List> listYesNoChoices = new ArrayList<>(); - listYesNoChoices.add(Map.of("name", "Yes", "value", "true")); - listYesNoChoices.add(Map.of("name", "No", "value", "false")); - propertyCheckbox.put("choices", listYesNoChoices); - - // if the parameters has a condition, add it here - if (condition != null) - propertyCheckbox.put("condition", condition); - if (runnerParameter.group != null) - propertyCheckbox.put("group", runnerParameter.group.id()); - propertyCheckbox.put("group", isInput? GROUP_INPUT:GROUP_OUTPUT); - } - - Map propertyParameter = new HashMap<>(); - listProperties.add(propertyParameter); - propertyParameter.put("id", runnerParameter.name); - propertyParameter.put("label", runnerParameter.label); - // don't have the group at this moment - propertyParameter.put("description", runnerParameter.explanation); - if (runnerParameter.defaultValue != null) { - propertyParameter.put("value", runnerParameter.defaultValue); - } - String typeParameter = "String"; - // String, Text, Boolean, Dropdown or Hidden) - if (Boolean.class.equals(runnerParameter.clazz)) { - typeParameter = "Dropdown"; - List> listYesNoChoices = new ArrayList<>(); - listYesNoChoices.add(Map.of("name", "Yes", "value", "true")); - listYesNoChoices.add(Map.of("name", "No", "value", "false")); - propertyParameter.put("choices", listYesNoChoices); - } else if (runnerParameter.hasChoice()) { - typeParameter = "Dropdown"; - // add choices - List> listChoices = new ArrayList<>(); - for (RunnerParameter.WorkerParameterChoice oneChoice : runnerParameter.workerParameterChoiceList) { - listChoices.add(Map.of("name", oneChoice.displayName, - "value", oneChoice.code)); - } - propertyParameter.put("choices", listChoices); - } - propertyParameter.put("type", typeParameter); - if (isInput) { - propertyParameter.put("binding", - Map.of("type", "zeebe:input", - "name", runnerParameter.name)); - } else { - propertyParameter.put("binding", - Map.of("type", "zeebe:output", - "source", "= " + prefixName+ runnerParameter.name)); - - } - if (runnerParameter.group != null) - propertyParameter.put("group", runnerParameter.group.id()); - else - propertyParameter.put("group", isInput? GROUP_INPUT : GROUP_OUTPUT); - - Map constraints = new HashMap<>(); - // if the designer decide to show this property, then it is mandatory - if (!isInput) - constraints.put("notEmpty", Boolean.TRUE); - - if (RunnerParameter.Level.REQUIRED.equals(runnerParameter.level)) - constraints.put("notEmpty", Boolean.TRUE); - - if (!constraints.isEmpty()) - propertyParameter.put("constraints", constraints); - - // if this is a OPTIONAL, then the display depends on the check box. - // if there is a condition on the OPTIONAL, then the condition is part of the checkbox, else will be on the parameters - if (addConditionCheckbox) { - propertyParameter.put("condition", Map.of("property", runnerParameter.name + "_optional", - "equals", "true")); - - } else { - if (condition != null) - propertyParameter.put("condition", condition); - - } - - - return listProperties; } + if (runnerParameter.group != null) + propertyParameter.put(ATTR_GROUP, runnerParameter.group.id()); + else + propertyParameter.put(ATTR_GROUP, isInput ? GROUP_INPUT : GROUP_OUTPUT); + + Map constraints = new HashMap<>(); + // if the designer decide to show this property, then it is mandatory + if (!isInput) + constraints.put(ATTR_CONSTRAINTS_NOT_EMPTY, Boolean.TRUE); + + if (RunnerParameter.Level.REQUIRED.equals(runnerParameter.level)) + constraints.put(ATTR_CONSTRAINTS_NOT_EMPTY, Boolean.TRUE); + + if (!constraints.isEmpty()) + propertyParameter.put(ATTR_CONSTRAINTS, constraints); + + // if this is a OPTIONAL, then the display depends on the check box. + // if there is a condition on the OPTIONAL, then the condition is part of the checkbox, else will be on the parameters + if (addConditionCheckbox) { + propertyParameter.put(ATTR_CONDITION, Map.of("property", runnerParameter.name + "_optional", "equals", "true")); + + } else { + if (condition != null) + propertyParameter.put(ATTR_CONDITION, condition); + + } + + return listProperties; + } } diff --git a/src/main/java/io/camunda/cherry/files/LoadFileFromDiskWorker.java b/src/main/java/io/camunda/cherry/files/LoadFileFromDiskWorker.java index 8df5b8d..103071a 100644 --- a/src/main/java/io/camunda/cherry/files/LoadFileFromDiskWorker.java +++ b/src/main/java/io/camunda/cherry/files/LoadFileFromDiskWorker.java @@ -12,9 +12,9 @@ import io.camunda.cherry.definition.BpmnError; import io.camunda.cherry.definition.IntFrameworkRunner; import io.camunda.cherry.definition.RunnerParameter; -import io.camunda.file.storage.FileVariable; -import io.camunda.file.storage.StorageDefinition; -import io.camunda.file.storage.cmis.CmisParameters; +import io.camunda.filestorage.FileVariable; +import io.camunda.filestorage.StorageDefinition; +import io.camunda.filestorage.cmis.CmisParameters; import io.camunda.zeebe.client.api.response.ActivatedJob; import io.camunda.zeebe.client.api.worker.JobClient; import io.camunda.zeebe.spring.client.exception.ZeebeBpmnError; @@ -144,9 +144,15 @@ public boolean isFrameworkRunner() { @Override public String getName() { - return "FileStorageLoadFileFromDisk"; + return "File Storage: Load file"; } + @Override + public String getCollectionName() { + return "File Storage"; + } + + @Override public String getLabel() { return "Load file from disk"; @@ -162,6 +168,7 @@ public String getLogo() { return WORKERLOGO; } + @Override public void execute(final JobClient client, final ActivatedJob activatedJob, ContextExecution contextExecution) { diff --git a/src/main/java/io/camunda/cherry/files/PurgeFileWorker.java b/src/main/java/io/camunda/cherry/files/PurgeFileWorker.java index bd35126..9261e36 100644 --- a/src/main/java/io/camunda/cherry/files/PurgeFileWorker.java +++ b/src/main/java/io/camunda/cherry/files/PurgeFileWorker.java @@ -10,15 +10,14 @@ import io.camunda.cherry.definition.BpmnError; import io.camunda.cherry.definition.IntFrameworkRunner; import io.camunda.cherry.definition.RunnerParameter; -import io.camunda.file.storage.FileRepoFactory; -import io.camunda.file.storage.FileVariableReference; -import io.camunda.file.storage.StorageDefinition; +import io.camunda.filestorage.FileRepoFactory; +import io.camunda.filestorage.FileVariableReference; +import io.camunda.filestorage.StorageDefinition; import io.camunda.zeebe.client.api.response.ActivatedJob; import io.camunda.zeebe.client.api.worker.JobClient; import io.camunda.zeebe.spring.client.exception.ZeebeBpmnError; import org.springframework.stereotype.Component; -import java.util.Arrays; import java.util.Collections; @Component @@ -53,7 +52,12 @@ public boolean isFrameworkRunner() { @Override public String getName() { - return "FileStoragePurgeFile"; + return "File Storage: Purge File"; + } + + @Override + public String getCollectionName() { + return "File Storage"; } @Override diff --git a/src/main/java/io/camunda/cherry/files/SaveFileToDiskWorker.java b/src/main/java/io/camunda/cherry/files/SaveFileToDiskWorker.java index d9e00ba..43d2e3d 100644 --- a/src/main/java/io/camunda/cherry/files/SaveFileToDiskWorker.java +++ b/src/main/java/io/camunda/cherry/files/SaveFileToDiskWorker.java @@ -9,8 +9,8 @@ package io.camunda.cherry.files; import io.camunda.cherry.definition.RunnerParameter; -import io.camunda.file.storage.FileVariable; -import io.camunda.file.storage.StorageDefinition; +import io.camunda.filestorage.FileVariable; +import io.camunda.filestorage.StorageDefinition; import io.camunda.zeebe.client.api.response.ActivatedJob; import io.camunda.zeebe.client.api.worker.JobClient; import io.camunda.zeebe.spring.client.exception.ZeebeBpmnError; @@ -72,7 +72,12 @@ public boolean isFrameworkRunner() { @Override public String getName() { - return "FileStorageSaveFileToDisk"; + return "File Storage: Save File"; + } + + @Override + public String getCollectionName() { + return "File Storage"; } @Override diff --git a/src/main/java/io/camunda/cherry/ping/PingConnector.java b/src/main/java/io/camunda/cherry/ping/connector/PingConnector.java similarity index 76% rename from src/main/java/io/camunda/cherry/ping/PingConnector.java rename to src/main/java/io/camunda/cherry/ping/connector/PingConnector.java index f0b26de..b285dda 100644 --- a/src/main/java/io/camunda/cherry/ping/PingConnector.java +++ b/src/main/java/io/camunda/cherry/ping/connector/PingConnector.java @@ -5,11 +5,13 @@ /* but the result is different. */ /* See PingConnectorOutput versus PingObjectConnectorOutput */ /* -------------------------------------------------------------------- */ -package io.camunda.cherry.ping; +package io.camunda.cherry.ping.connector; import io.camunda.cherry.definition.AbstractConnector; +import io.camunda.cherry.definition.BpmnError; import io.camunda.cherry.definition.IntFrameworkRunner; +import io.camunda.connector.api.error.ConnectorException; import io.camunda.connector.api.outbound.OutboundConnectorContext; import io.camunda.connector.api.outbound.OutboundConnectorFunction; import org.springframework.stereotype.Component; @@ -17,17 +19,22 @@ import java.net.InetAddress; import java.util.Collections; import java.util.Map; +import java.util.Random; /* ------------------------------------------------------------------- */ @Component public class PingConnector extends AbstractConnector implements IntFrameworkRunner, OutboundConnectorFunction { + public static final String ERROR_BAD_WEATHER = "BAD_WEATHER"; + + private Random random = new Random(); + protected PingConnector() { super("c-pingconnector", PingConnectorInput.class, PingConnectorOutput.class, - Collections.emptyList()); + Collections.singletonList(new BpmnError(ERROR_BAD_WEATHER, "Why this is a bad weather?"))); } /** @@ -60,8 +67,16 @@ public Object execute(OutboundConnectorContext context) throws Exception { PingConnectorInput pingConnectorInput = context.getVariablesAsType(PingConnectorInput.class); + if (pingConnectorInput.isThrowErrorPlease()) { + throw new ConnectorException(ERROR_BAD_WEATHER, "Raining too much"); + } // context.validate(pingConnectorInput); - Thread.sleep( pingConnectorInput.getDelay()); + int delay=pingConnectorInput.getDelay(); + if (delay<0) { + delay = random.nextInt(10000)+1500; + } + + Thread.sleep( delay ); InetAddress ipAddress=InetAddress.getLocalHost(); return new PingConnectorOutput(System.currentTimeMillis(), diff --git a/src/main/java/io/camunda/cherry/ping/PingConnectorInput.java b/src/main/java/io/camunda/cherry/ping/connector/PingConnectorInput.java similarity index 73% rename from src/main/java/io/camunda/cherry/ping/PingConnectorInput.java rename to src/main/java/io/camunda/cherry/ping/connector/PingConnectorInput.java index 7b976ad..908d86b 100644 --- a/src/main/java/io/camunda/cherry/ping/PingConnectorInput.java +++ b/src/main/java/io/camunda/cherry/ping/connector/PingConnectorInput.java @@ -1,4 +1,4 @@ -package io.camunda.cherry.ping; +package io.camunda.cherry.ping.connector; import io.camunda.cherry.definition.AbstractConnectorInput; import io.camunda.cherry.definition.RunnerParameter; @@ -16,6 +16,11 @@ public class PingConnectorInput extends AbstractConnectorInput { @NotEmpty private String message; private int delay; + public boolean isThrowErrorPlease() { + return throwErrorPlease; + } + + private boolean throwErrorPlease; /** * Return the parameters definition @@ -34,7 +39,13 @@ public List getInputParameters() { "Delay", Long.class, RunnerParameter.Level.OPTIONAL, - "Delay to sleep") + "Delay to sleep"), + RunnerParameter.getInstance("throwErrorPlease", + "Throw Error Please", + Boolean.class, + RunnerParameter.Level.OPTIONAL, + "If true, then the connector throw an error") + .setVisibleInTemplate() ); } diff --git a/src/main/java/io/camunda/cherry/ping/PingConnectorOutput.java b/src/main/java/io/camunda/cherry/ping/connector/PingConnectorOutput.java similarity index 98% rename from src/main/java/io/camunda/cherry/ping/PingConnectorOutput.java rename to src/main/java/io/camunda/cherry/ping/connector/PingConnectorOutput.java index e65e1cd..8f8a809 100644 --- a/src/main/java/io/camunda/cherry/ping/PingConnectorOutput.java +++ b/src/main/java/io/camunda/cherry/ping/connector/PingConnectorOutput.java @@ -9,7 +9,7 @@ /* gettimeStampMS(), getipAddress() */ /* if you don't do that, then the engine can't retrieve the value */ /* -------------------------------------------------------------------- */ -package io.camunda.cherry.ping; +package io.camunda.cherry.ping.connector; import io.camunda.cherry.definition.AbstractConnectorOutput; import io.camunda.cherry.definition.RunnerParameter; diff --git a/src/main/java/io/camunda/cherry/ping/PingObjectConnector.java b/src/main/java/io/camunda/cherry/ping/objectconnector/PingObjectConnector.java similarity index 74% rename from src/main/java/io/camunda/cherry/ping/PingObjectConnector.java rename to src/main/java/io/camunda/cherry/ping/objectconnector/PingObjectConnector.java index d16b3f7..7a8b13d 100644 --- a/src/main/java/io/camunda/cherry/ping/PingObjectConnector.java +++ b/src/main/java/io/camunda/cherry/ping/objectconnector/PingObjectConnector.java @@ -5,26 +5,33 @@ /* but the result is different. */ /* See PingConnectorOutput versus PingObjectConnectorOutput */ /* -------------------------------------------------------------------- */ -package io.camunda.cherry.ping; +package io.camunda.cherry.ping.objectconnector; import io.camunda.cherry.definition.AbstractConnector; +import io.camunda.cherry.definition.BpmnError; import io.camunda.cherry.definition.IntFrameworkRunner; +import io.camunda.cherry.ping.connector.PingConnectorInput; +import io.camunda.connector.api.error.ConnectorException; import io.camunda.connector.api.outbound.OutboundConnectorContext; import io.camunda.connector.api.outbound.OutboundConnectorFunction; import org.springframework.stereotype.Component; import java.net.InetAddress; import java.util.Collections; +import java.util.Random; @Component public class PingObjectConnector extends AbstractConnector implements IntFrameworkRunner, OutboundConnectorFunction { + public static final String ERROR_BAD_WEATHER = "BAD_WEATHER"; + + private Random random = new Random(); protected PingObjectConnector() { super("c-pingobjectconnector", PingConnectorInput.class, PingObjectConnectorOutput.class, - Collections.emptyList()); + Collections.singletonList(new BpmnError(ERROR_BAD_WEATHER, "Why this is a bad weather?"))); } /** @@ -56,9 +63,15 @@ public String getDescription() { public Object execute(OutboundConnectorContext context) throws Exception { PingConnectorInput pingConnectorInput = context.getVariablesAsType(PingConnectorInput.class); + if (pingConnectorInput.isThrowErrorPlease()) + throw new ConnectorException(ERROR_BAD_WEATHER, "Raining too much"); // context.validate(pingConnectorInput); - Thread.sleep( pingConnectorInput.getDelay()); + int delay=pingConnectorInput.getDelay(); + if (delay<0) { + delay = random.nextInt(10000)+1500; + } + Thread.sleep( delay ); InetAddress IP=InetAddress.getLocalHost(); return new PingObjectConnectorOutput(System.currentTimeMillis(), IP.getHostAddress()); diff --git a/src/main/java/io/camunda/cherry/ping/PingObjectConnectorOutput.java b/src/main/java/io/camunda/cherry/ping/objectconnector/PingObjectConnectorOutput.java similarity index 92% rename from src/main/java/io/camunda/cherry/ping/PingObjectConnectorOutput.java rename to src/main/java/io/camunda/cherry/ping/objectconnector/PingObjectConnectorOutput.java index 3422dc2..2851e18 100644 --- a/src/main/java/io/camunda/cherry/ping/PingObjectConnectorOutput.java +++ b/src/main/java/io/camunda/cherry/ping/objectconnector/PingObjectConnectorOutput.java @@ -1,4 +1,4 @@ -package io.camunda.cherry.ping; +package io.camunda.cherry.ping.objectconnector; public class PingObjectConnectorOutput { diff --git a/src/main/java/io/camunda/cherry/ping/PingWorker.java b/src/main/java/io/camunda/cherry/ping/worker/PingWorker.java similarity index 93% rename from src/main/java/io/camunda/cherry/ping/PingWorker.java rename to src/main/java/io/camunda/cherry/ping/worker/PingWorker.java index ab07f88..f983713 100644 --- a/src/main/java/io/camunda/cherry/ping/PingWorker.java +++ b/src/main/java/io/camunda/cherry/ping/worker/PingWorker.java @@ -4,7 +4,7 @@ /* */ /* Realize a simple ping */ /* ******************************************************************** */ -package io.camunda.cherry.ping; +package io.camunda.cherry.ping.worker; import io.camunda.cherry.definition.AbstractWorker; import io.camunda.cherry.definition.IntFrameworkRunner; @@ -18,6 +18,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.Date; +import java.util.Random; @Component public class PingWorker extends AbstractWorker implements IntFrameworkRunner { @@ -27,6 +28,8 @@ public class PingWorker extends AbstractWorker implements IntFrameworkRunner { private static final String INPUT_DELAY = "delay"; private static final String OUTPUT_TIMESTAMP = "timestamp"; + private Random random = new Random(); + public PingWorker() { super("c-ping", Arrays.asList( @@ -73,6 +76,9 @@ public void execute(final JobClient jobClient, final ActivatedJob activatedJob, String message = getInputStringValue(INPUT_MESSAGE, null, activatedJob); Long delay = getInputLongValue(INPUT_DELAY, null, activatedJob); logInfo(message); + if (delay!=null && delay<0) { + delay = Long.valueOf(random.nextInt(10000)+1500); + } if (delay != null) { try { Thread.sleep(delay); diff --git a/src/main/java/io/camunda/cherry/runtime/CherryHistoricFactory.java b/src/main/java/io/camunda/cherry/runtime/CherryHistoricFactory.java index ea9c8ce..98b2c99 100644 --- a/src/main/java/io/camunda/cherry/runtime/CherryHistoricFactory.java +++ b/src/main/java/io/camunda/cherry/runtime/CherryHistoricFactory.java @@ -6,94 +6,218 @@ /* ******************************************************************** */ package io.camunda.cherry.runtime; - +import io.camunda.cherry.db.entity.RunnerExecutionEntity; +import io.camunda.cherry.db.repository.RunnerExecutionRepository; +import io.camunda.cherry.definition.AbstractRunner; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; import org.springframework.stereotype.Service; -import java.time.ZonedDateTime; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneOffset; import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; import java.util.Random; @Service public class CherryHistoricFactory { - public static class Statistic { - public long executions; - public long failed; + Logger logger = LoggerFactory.getLogger(CherryHistoricFactory.class.getName()); + + @Autowired + RunnerExecutionRepository runnerExecutionRepository; + + @Component + public static class Statistic { + public long executions; + public long failed; + public long succeeded; + } + + private final Random rand = new Random(System.currentTimeMillis()); + + public static class Interval { + /** + * Name is something like 16:00 / 16:15 + */ + public String slot; + public long executions = 0; + public long sumOfExecutionTime = 0; + public long executionsSuccess = 0; + public long executionsFaileds = 0; + public long executionsBpmnErrors = 0; + public long picTimeInMs = 0; + public long averageTimeInMs = 0; + + public Interval(String slot) { + this.slot= slot; } - private final Random rand = new Random(System.currentTimeMillis()); - - - - - public static class Interval { - /** - * Name is something like 16:00 / 16:15 - */ - public String slot; - public long executions; - public long picTimeInMs; - public long averageTimeInMs; - + } + + @Component + public static class Performance { + public long picTimeInMs; + public long executions; + public long averageTimeInMs; + public List listIntervals = new ArrayList<>(); + } + + + /* -------------------------------------------------------- */ + /* */ + /* get information */ + /* */ + /* -------------------------------------------------------- */ + + /** + * get main statistics for the runner type in the last period + * @param runnerType type of runner + * @param delayStatInHour delay in hour for the period (now-delayinhour < now) + * @return statistic object + */ + public Statistic getStatistic(String runnerType, int delayStatInHour) { + Statistic statistic = new Statistic(); + + Instant dateThreshold = getInstantByDelay(delayStatInHour); + List> listStats = runnerExecutionRepository.selectStatusStats(runnerType, dateThreshold); + for (Map record : listStats) { + Long recordNumber = Long.valueOf(record.get("number").toString()); + if (record.get("status")!=null && AbstractRunner.ExecutionStatusEnum.SUCCESS.toString().equalsIgnoreCase(record.get("status").toString())) + statistic.succeeded += recordNumber; + else + statistic.failed += recordNumber; } - - public static class Performance { - public long picTimeInMs; - public long executions; - public long averageTimeInMs; - public List listIntervals = new ArrayList<>(); + statistic.executions = statistic.failed + statistic.succeeded; + return statistic; + } + + /** + * Get performance for a runnerType. Return a record per 15 minutes. Do not ask 1 year ! + * @param runnerType type of runner + * @param delayStatInHour delay in hour for the period (now-delayinhour < now) + * @return performance object + */ + public Performance getPerformance(String runnerType, int delayStatInHour) { + Performance performance = new Performance(); + + Instant dateThreshold = getInstantByDelay(delayStatInHour); + + Map mapInterval = new LinkedHashMap<>(); + //--- populate all the map + LocalDateTime indexTime = LocalDateTime.ofInstant(dateThreshold, ZoneOffset.UTC); + indexTime = indexTime.minusNanos(indexTime.getNano()); + indexTime = indexTime.minusSeconds(indexTime.getSecond()); + indexTime = indexTime.minusMinutes(indexTime.getMinute() % 15); + indexTime = indexTime.plusMinutes(15); + dateThreshold = indexTime.toInstant(ZoneOffset.UTC); + + for (int index = 0; index <= 24 * 4; index++) { + String slotString = String.format("%3dD%02d:%02d", indexTime.getDayOfYear(), indexTime.getHour(), + indexTime.getMinute()); + mapInterval.put(slotString, new Interval(slotString)); + indexTime=indexTime.plusMinutes(15); } - - public Statistic getStatistic(String runnerName, int delayStatInHour) { - Statistic statistic = new Statistic(); - statistic.executions = rand.nextLong(1000 * delayStatInHour); - statistic.failed = rand.nextLong(10 * delayStatInHour); - return statistic; + //--- now we can fetch and explode data + List listExecutions = runnerExecutionRepository.selectRunnerRecords(runnerType, + dateThreshold); + for (RunnerExecutionEntity runnerExecutionEntity : listExecutions) { + Instant executionTime = runnerExecutionEntity.executionTime; + LocalDateTime slotTime = LocalDateTime.ofInstant(executionTime, ZoneOffset.UTC); + + // find the slot from the execution time + // back the the previous quater + slotTime = slotTime.minusNanos(slotTime.getNano()); + slotTime = slotTime.minusSeconds(slotTime.getSecond()); + slotTime = slotTime.minusMinutes(slotTime.getMinute()% 15); + String slotString = String.format("%3dD%02d:%02d", slotTime.getDayOfYear(), slotTime.getHour(), + slotTime.getMinute()); + Interval interval = mapInterval.get(slotString); + if (interval == null) { + // this must not arrive + logger.error("Interval is not populated [" + slotString + "]"); + continue; + } + interval.executions++; + interval.sumOfExecutionTime += runnerExecutionEntity.executionMs; + switch (runnerExecutionEntity.status) { + case SUCCESS -> interval.executionsSuccess++; + case FAIL -> interval.executionsFaileds++; + case BPMNERROR -> interval.executionsBpmnErrors++; + } + if (runnerExecutionEntity.executionMs > interval.picTimeInMs) + interval.picTimeInMs = runnerExecutionEntity.executionMs; } - - public Performance getPerformance(String runnerName, int delayStatInHour) { - Performance performance = new Performance(); - ZonedDateTime referenceTime = ZonedDateTime.now(); - // back the the previous quater - referenceTime = referenceTime.minusNanos(referenceTime.getNano()); - referenceTime = referenceTime.minusSeconds(referenceTime.getSecond()); - referenceTime = referenceTime.minusMinutes(referenceTime.getMinute() % 15); - - // back to the number of hour now - referenceTime.minusHours(delayStatInHour); - - - for (int i = 0; i < delayStatInHour * 4; i++) { - Interval interval = new Interval(); - performance.listIntervals.add( interval ); - // java.time.format.datetimeformatter can't be found by Java - syntax error - interval.slot = String.format("%2d:%2d", referenceTime.getHour(), referenceTime.getMinute()); - interval.averageTimeInMs = rand.nextLong(2000); - interval.executions = rand.nextLong(100); - interval.picTimeInMs = interval.averageTimeInMs + 10 + rand.nextLong(100); - - referenceTime = referenceTime.plusMinutes(15); - - // cumul - performance.picTimeInMs = Math.max(performance.picTimeInMs, interval.picTimeInMs); - performance.executions += interval.executions; - performance.averageTimeInMs += interval.averageTimeInMs; - } - performance.averageTimeInMs = performance.averageTimeInMs /(delayStatInHour * 4); - - return performance; + // build the list and calculate average + long sumTotalExecutionTimeInMs = 0; + long sumTotalExecutions = 0; + for (Interval interval : mapInterval.values()) { + if (interval.executions > 0) + interval.averageTimeInMs = interval.sumOfExecutionTime / interval.executions; + performance.listIntervals.add(interval); + + sumTotalExecutionTimeInMs += interval.sumOfExecutionTime; + sumTotalExecutions += interval.executions; + if (interval.picTimeInMs > performance.picTimeInMs) + performance.picTimeInMs = interval.picTimeInMs; } - - public Performance getEnginePerformance( int delayStatInHour) { - return getPerformance("", delayStatInHour); + // global values + if (sumTotalExecutions>0) + performance.averageTimeInMs = sumTotalExecutionTimeInMs / sumTotalExecutions; + + return performance; + } + + public Performance getEnginePerformance(int delayStatInHour) { + return getPerformance("", delayStatInHour); + } + + public Statistic getEngineStatistic(int delayStatInHour) { + return getStatistic("", delayStatInHour); + } + + + /* -------------------------------------------------------- */ + /* */ + /* Save */ + /* */ + /* -------------------------------------------------------- */ + + /** + * save the execution statistics + * @param executionTime instant of the execution + * @param runnerType name of runner + * @param status status of execution + * @param durationInMs duration of this execution + */ + public void saveExecution(Instant executionTime, String runnerType, AbstractRunner.ExecutionStatusEnum status, long durationInMs) { + try { + RunnerExecutionEntity runnerExecutionEntity = new RunnerExecutionEntity(); + runnerExecutionEntity.executionMs = durationInMs; + runnerExecutionEntity.executionTime = executionTime; + runnerExecutionEntity.runnerType = runnerType; + runnerExecutionEntity.status = status; + try { + runnerExecutionEntity.status = status; + }catch(Exception e) + {} + + runnerExecutionRepository.save(runnerExecutionEntity); + } catch (Exception e) { + logger.error("CherryHistoricFactory.saeExcution: failed " + e.getMessage() + " " + e.getCause()); } + } - public Statistic getEngineStatistic(int delayStatInHour) { - return getStatistic("", delayStatInHour); - } + private Instant getInstantByDelay(int delayStatInHour) { + return Instant.now().minusSeconds(delayStatInHour * 60 * 60); + } - } +} diff --git a/src/main/java/io/camunda/cherry/runtime/CherryJobRunnerFactory.java b/src/main/java/io/camunda/cherry/runtime/CherryJobRunnerFactory.java index 9beddc7..436b2ce 100644 --- a/src/main/java/io/camunda/cherry/runtime/CherryJobRunnerFactory.java +++ b/src/main/java/io/camunda/cherry/runtime/CherryJobRunnerFactory.java @@ -6,6 +6,7 @@ /* ******************************************************************** */ package io.camunda.cherry.runtime; +import io.camunda.cherry.definition.CherryConnectorJobHandler; import io.camunda.connector.runtime.util.outbound.ConnectorJobHandler; import io.camunda.zeebe.client.api.worker.JobWorker; import io.camunda.zeebe.client.api.worker.JobWorkerBuilderStep1; @@ -34,6 +35,9 @@ public class CherryJobRunnerFactory { Logger logger = LoggerFactory.getLogger(CherryJobRunnerFactory.class.getName()); + @Autowired + CherryHistoricFactory cherryHistoricFactory; + @Autowired List listAbstractConnector; @@ -188,7 +192,7 @@ private JobWorkerBuilderStep1.JobWorkerBuilderStep3 createJobWorker(AbstractRunn if (runner instanceof AbstractWorker abstractWorker) jobWorkerBuild3 = jobWorkerBuild2.handler(abstractWorker); else if (runner instanceof AbstractConnector abstractConnector) - jobWorkerBuild3 = jobWorkerBuild2.handler(new ConnectorJobHandler(abstractConnector)); + jobWorkerBuild3 = jobWorkerBuild2.handler(new CherryConnectorJobHandler(abstractConnector, cherryHistoricFactory)); else throw new OperationException(UNKNOWN_WORKER_CLASS, "Unknown AbstractRunner class"); jobWorkerBuild3.name(runner.getName() == null ? runner.getType() : runner.getName()); diff --git a/src/main/java/io/camunda/file/storage/FileRepoFactory.java b/src/main/java/io/camunda/file/storage/FileRepoFactory.java deleted file mode 100644 index 6d340a9..0000000 --- a/src/main/java/io/camunda/file/storage/FileRepoFactory.java +++ /dev/null @@ -1,127 +0,0 @@ -/* ******************************************************************** */ -/* */ -/* FileRepoFactory */ -/* */ -/* File can't be saved in C8. So, different implementation to store */ -/* files are possible, and the factory give access to the different */ -/* formats */ -/* */ -/* - FileVariable : the file (content included) */ -/* - FileVariableReference: reference to the file, to save as a */ -/* process variable */ -/* - StorageDefinition: information to access the storage. */ -/* - FileVariableFactory : This class is the main API */ -/* createFileVariable(StorageDefinition) : create an empty file */ -/* saveFileVariable( FileVariable ): save the file in the storage */ -/* the method return a FileVariableReference */ -/* loadFileVariable( FileVariableReference): load the file */ -/* ******************************************************************** */ -package io.camunda.file.storage; - -import java.util.Random; - -public class FileRepoFactory { - - private final Random rand = new Random(); - - public static FileRepoFactory getInstance() { - return new FileRepoFactory(); - } - - /** - * Create an empty File Variable. - * StorageDefinition is not given: the JSON storage definition is used by default then - * - * @return a fileVariable, JSON type is the default - */ - public FileVariable createFileVariable() { - try { - return new FileVariable(StorageDefinition.getFromString(StorageDefinition.StorageDefinitionType.JSON.toString())); - }catch (Exception e) { - // It should never have happened: JSON does not generate an exception - return null; - } - } - - public FileVariable createFileVariable(StorageDefinition storageDefinition) { - return new FileVariable(storageDefinition); - } - - /** - * get the FileVariable object from the different information - * StorageDefinition is a string like - * "JSON" : the value is a JSON information, to be unSerialize - * "FOLDER:", and the value is a file name in this directory. - * - * @param fileVariableReference information to access the file - * @return a fileVariable - * @throws Exception can't load the fileVariable - */ - public FileVariable loadFileVariable(FileVariableReference fileVariableReference) throws Exception { - if (fileVariableReference == null || fileVariableReference.content == null) - return null; - - StorageDefinition storageDefinition = StorageDefinition.getFromString(fileVariableReference.storageDefinition); - Storage storage = getStorage(storageDefinition); - return storage.fromStorage(fileVariableReference); - } - - /** - * SetFileVariable - * - * @param fileVariable file Variable to save - * @return the FileContainer (depends on the storageDefinition code) - * @throws Exception if an error arrive - */ - public FileVariableReference saveFileVariable(FileVariable fileVariable) throws Exception { - if (fileVariable == null) - return null; - - FileVariableReference fileVariableReference = new FileVariableReference(); - fileVariableReference.storageDefinition = fileVariable.getStorageDefinition().encodeToString(); - - Storage storage = getStorage(fileVariable.getStorageDefinition()); - fileVariableReference = storage.toStorage(fileVariable, null); - return fileVariableReference; - } - - /** - * Purge the fileVariable - * - * @param fileVariableReference reference to the file to purge - * @return true if the file is correctly purge - * @throws Exception if the purge failed - */ - public boolean purgeFileVariable(FileVariableReference fileVariableReference) throws Exception { - if (fileVariableReference == null) - return true; - - StorageDefinition storageDefinition = StorageDefinition.getFromString(fileVariableReference.storageDefinition); - Storage storage = getStorage(storageDefinition); - return storage.purgeStorage(fileVariableReference); - } - - /** - * Generate an uniq Identifier for class who search for one - * - * @return a uniq ID - */ - public String generateUniqId() { - // get an uniq identifier - return "_" + System.currentTimeMillis() + "_" + rand.nextInt(10000); - } - - protected String getLoggerHeaderMessage(Class> clazz) { - return "FileStorage." + clazz.getName() + ": "; - - } - - private Storage getStorage(StorageDefinition storageDefinition) throws Exception { - return switch (storageDefinition.type) { - case JSON -> new StorageJSON(storageDefinition, this); - case FOLDER -> new StorageFolder(storageDefinition, this); - case CMIS -> new StorageCMIS(storageDefinition, this); - case TEMPFOLDER -> new StorageTempFolder(storageDefinition, this); - }; - } -} diff --git a/src/main/java/io/camunda/file/storage/FileVariable.java b/src/main/java/io/camunda/file/storage/FileVariable.java deleted file mode 100644 index 608ba0f..0000000 --- a/src/main/java/io/camunda/file/storage/FileVariable.java +++ /dev/null @@ -1,93 +0,0 @@ -/* ******************************************************************** */ -/* */ -/* FileVariable */ -/* */ -/* File variable contains the file. Attention, file is in memory then */ -/* ******************************************************************** */ -package io.camunda.file.storage; - -import java.io.File; -import java.net.URLConnection; - -/* Definition of a FileVariable */ -public class FileVariable { - private String name; - private String mimeType; - private byte[] value; - - /** - * Keep the information from where this fileVariable come from. - * So, if the worker wants to save it at the same place, it has the information. - * This is only an information from the FileVariable, it may be null - */ - private StorageDefinition storageDefinition; - - /** - * The default connectors exist to let the Json deserializer create it - */ - public FileVariable() { - - } - /** - * To load / create a file Variable, go to the FileVariableFactory - */ - protected FileVariable(StorageDefinition storageDefinition) { - this.storageDefinition = storageDefinition; - } - - public String getName() { - return name; - } - - public String getMimeType() { - return mimeType; - } - - public byte[] getValue() { - return value; - } - - public void setName(String name) { - this.name = name; - } - - public void setMimeType(String mimeType) { - this.mimeType = mimeType; - } - - public void setValue(byte[] value) { - this.value = value; - } - - public void setStorageDefinition(StorageDefinition storageDefinition) { - this.storageDefinition = storageDefinition; - } - public StorageDefinition getStorageDefinition() { - return storageDefinition; - } - - /** - * Return the suffix of the file, based on the name or on the mimeType - * - * @return the suffix - */ - public static String getSuffix(String fileName) { - if (fileName != null) { - int lastDot = fileName.lastIndexOf("."); - if (lastDot != -1) - return fileName.substring(lastDot + 1); - } - return ""; - } - - /** - * return the Mimetype from the name. - * - * @return the mime type - */ - public static String getMimeTypeFromName(String fileName) { - File file = new File(fileName); - return URLConnection.guessContentTypeFromName(file.getName()); - - } -} diff --git a/src/main/java/io/camunda/file/storage/FileVariableReference.java b/src/main/java/io/camunda/file/storage/FileVariableReference.java deleted file mode 100644 index 3b15211..0000000 --- a/src/main/java/io/camunda/file/storage/FileVariableReference.java +++ /dev/null @@ -1,86 +0,0 @@ -/* ******************************************************************** */ -/* */ -/* FileVariableReference */ -/* */ -/* This object carry the reference to a file variable, not the file */ -/* itself. This is used as a process variable. */ -/* The content may be retrieved via the FileVariableFactory */ -/* */ -/* ******************************************************************** */ -package io.camunda.file.storage; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * A FileContainer must be self-description. So, it contains the way to find the file itself (JSON, FOLDER...) and the information to access the content - */ -public class FileVariableReference { - private static final Logger logger = LoggerFactory.getLogger(FileVariableReference.class.getName()); - - /** - * Storage definition where the file is. It is a String to simplify the encoding. - */ - public String storageDefinition; - /** - * content to retrieve the file in the storageDefinition (key to access it) - */ - public Object content; - - /** - * Transform the reference from JSON - * - * @param fileReferenceJson file Reference in JSON - * @return a FileVariableReference - * @throws Exception when an error arrive - */ - public static FileVariableReference fromJson(String fileReferenceJson) throws Exception { - try { - return new ObjectMapper().readValue(fileReferenceJson, FileVariableReference.class); - } catch (JsonProcessingException e) { - logger.error("FileStorage.FileVariableReference.fromJson: exception " + e + " During un serialize fileVariable"); - throw e; - } - } - - /** - * Transform the fileReference to JSON - * - * @return the Json - * @throws JsonProcessingException in any error - */ - public String toJson() throws JsonProcessingException { - try { - return new ObjectMapper().writeValueAsString(this); - } catch (JsonProcessingException e) { - logger.error("FileStorage.FileVariableReference.toJson: exception " + e + " During serialize fileVariable"); - throw e; - } - } - - public String getStorageDefinition() { - return storageDefinition; - } - - public Object getContent() { - return content; - } - - /** - * Must be static to not make any trouble in the serialization/deserialization - * @param fieldReference field reference to get the identification - * @return an indentification, to log it for example - */ - public static String getIdentification(FileVariableReference fieldReference) { - StringBuilder result = new StringBuilder(); - result.append(fieldReference.storageDefinition); - result.append( ": "); - if (fieldReference.content==null) - result.append("null"); - else - result.append((fieldReference.content.toString() + " ").substring(0, 50)); - return result.toString(); - } -} diff --git a/src/main/java/io/camunda/file/storage/Storage.java b/src/main/java/io/camunda/file/storage/Storage.java deleted file mode 100644 index 86e5688..0000000 --- a/src/main/java/io/camunda/file/storage/Storage.java +++ /dev/null @@ -1,57 +0,0 @@ -package io.camunda.file.storage; - -public abstract class Storage { - - private final StorageDefinition storageDefinition; - private final FileRepoFactory fileRepoFactory; - - protected Storage(StorageDefinition storageDefinition, FileRepoFactory fileRepoFactory) { - this.storageDefinition = storageDefinition; - this.fileRepoFactory = fileRepoFactory; - } - - - public StorageDefinition getStorageDefinition() { - return storageDefinition; - } - - public FileRepoFactory getFileRepoFactory() { - return fileRepoFactory; - } - - /** - * Return the name of the storage, for identification - * @return name of the storage - */ - public abstract String getName(); - - public StorageDefinition.StorageDefinitionType getType() { - return storageDefinition.type; - } - - - /** - * Save a FileVariable to the storageDefinition. - * @param fileVariable file to save - * @param fileVariableReference the reference to update. May be null to save the file for the first time - * @return a FileVariableReference - * @throws Exception if an error arrive - */ - public abstract FileVariableReference toStorage( FileVariable fileVariable, FileVariableReference fileVariableReference) throws Exception; - - /** - * Return a File variable from a FileVariableReference - * @param fileVariableReference file reference to get - * @return the FileVariable - * @throws Exception if an error arrive - */ - public abstract FileVariable fromStorage(FileVariableReference fileVariableReference) throws Exception; - - /** - * purge the reference in the storage - * @param fileVariableReference reference to purge - * @throws Exception if an error arrive - */ - public abstract boolean purgeStorage(FileVariableReference fileVariableReference) throws Exception; - -} diff --git a/src/main/java/io/camunda/file/storage/StorageCMIS.java b/src/main/java/io/camunda/file/storage/StorageCMIS.java deleted file mode 100644 index f23e1e1..0000000 --- a/src/main/java/io/camunda/file/storage/StorageCMIS.java +++ /dev/null @@ -1,142 +0,0 @@ -/* ******************************************************************** */ -/* */ -/* FileVariableCMIS */ -/* */ -/* Save a file variable in CMIS, */ -/* ******************************************************************** */ -package io.camunda.file.storage; - -import com.google.gson.Gson; -import io.camunda.file.storage.cmis.CmisConnection; -import io.camunda.file.storage.cmis.CmisFactoryConnection; -import io.camunda.file.storage.cmis.CmisParameters; -import org.apache.chemistry.opencmis.client.api.Folder; -import org.apache.chemistry.opencmis.commons.data.ContentStream; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.util.Map; - -public class StorageCMIS extends Storage { - Logger logger = LoggerFactory.getLogger(StorageCMIS.class.getName()); - - - protected StorageCMIS(StorageDefinition storageDefinition, FileRepoFactory fileRepoFactory) { - super(storageDefinition, fileRepoFactory); - } - - @Override - public String getName() { - return "CMIS"; - } - - /** - * - * @param url Url to connect the CMIS repository - * @param repositoryName name of the repository. If null, then use "default" - * @param userName user name to connect - * @param password password to connect - * @param storageDefinitionFolder folder in the CMIS to store the default repository. If null, default is "storagecmis" - * @return - */ - public static String getStorageDefinitionString( String url, String repositoryName, String userName, String password, String storageDefinitionFolder ) { - CmisParameters cmisParameters = new CmisParameters(); - cmisParameters.url = url; - cmisParameters.repositoryName = repositoryName; - if (cmisParameters.repositoryName == null) - cmisParameters.repositoryName = "default"; - cmisParameters.userName = userName; - cmisParameters.password = password; - cmisParameters.storageDefinitionFolder = storageDefinitionFolder; - if (cmisParameters.storageDefinitionFolder==null) - cmisParameters.storageDefinitionFolder="storagecmis"; - - Gson gson = new Gson(); - String complement = gson.toJson(cmisParameters); - return StorageDefinition.StorageDefinitionType.CMIS.toString() + StorageDefinition.STORAGE_DEFINITION_DELIMITATEUR + complement; - } - /** - * Save the file Variable structure in the CMIS repository - * - * @param fileVariable fileVariable to save it - * @param fileVariableReference file variable to update (may be null) - */ - public FileVariableReference toStorage( FileVariable fileVariable, FileVariableReference fileVariableReference) throws Exception { - CmisParameters cmisParameters = CmisParameters.getCodingConnection(getStorageDefinition().complementInObject); - CmisConnection cmisConnection = CmisFactoryConnection.getInstance().getCmisConnection(cmisParameters); - if (cmisConnection == null) - throw new Exception("Can't connect the the CMIS repository"); - ByteArrayInputStream documentValue = new ByteArrayInputStream(fileVariable.getValue()); - // Add a random timestamp on the document name - - String uniqId = getFileRepoFactory().generateUniqId(); - Folder folder = cmisConnection.getFolderByPath(cmisParameters.storageDefinitionFolder); - if (folder == null) - throw new Exception("Folder [" + cmisParameters.storageDefinitionFolder + "] does not exists"); - - cmisConnection.uploadNewDocument( - CmisConnection.DocumentProperties.getDocument(cmisParameters.storageDefinitionFolder,fileVariable.getName() + uniqId), - documentValue, - fileVariable.getValue().length, - fileVariable.getMimeType()); - - FileVariableReference fileVariableReferenceOutput = new FileVariableReference(); - fileVariableReferenceOutput.storageDefinition = getStorageDefinition().encodeToString(); - fileVariableReferenceOutput.content = fileVariable.getName() + uniqId; - return fileVariableReferenceOutput; - - } - - /** - * read the fileVariable - * - * @param fileVariableReference name of the file in the temporary directory - * @return the fileVariable object - * @throws Exception during the writing - */ - public FileVariable fromStorage( FileVariableReference fileVariableReference) throws Exception { - CmisParameters cmisParameters = CmisParameters.getCodingConnection(getStorageDefinition().complementInObject); - CmisConnection cmisConnection = CmisFactoryConnection.getInstance().getCmisConnection(cmisParameters); - if (cmisConnection == null) - throw new Exception("Can't connect the the CMIS repository"); - ContentStream documentStream = cmisConnection.getDocumentByPath(cmisParameters.storageDefinitionFolder, fileVariableReference.content.toString()); - FileVariable fileVariable = new FileVariable(getStorageDefinition()); - fileVariable.setName( fileVariableReference.content.toString() ); - fileVariable.setMimeType( documentStream.getMimeType()); - try { - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - - int nRead; - byte[] data = new byte[4000]; - - while ((nRead = documentStream.getStream().read(data, 0, data.length)) != -1) { - buffer.write(data, 0, nRead); - } - - buffer.flush(); - fileVariable.setValue( buffer.toByteArray()); - return fileVariable; - } catch (Exception e) { - logger.error(getFileRepoFactory().getLoggerHeaderMessage(StorageCMIS.class)+": exception " + e + " During read file[" + fileVariableReference.content.toString() + "]"); - throw e; - } - } - - - /** - * Remove a file in the directory - * Remove a file in the directory - * @param fileVariableReference name of the file in the temporary directory - * @return true if the operation was successful - */ - public boolean purgeStorage( FileVariableReference fileVariableReference) throws Exception { - CmisParameters cmisParameters = CmisParameters.getCodingConnection(getStorageDefinition().complementInObject); - CmisConnection cmisConnection = CmisFactoryConnection.getInstance().getCmisConnection(cmisParameters); - if (cmisConnection == null) - throw new Exception("Can't connect the the CMIS repository"); - return cmisConnection.removeDocumentByPath(cmisParameters.storageDefinitionFolder, fileVariableReference.content.toString()); - } - -} diff --git a/src/main/java/io/camunda/file/storage/StorageDefinition.java b/src/main/java/io/camunda/file/storage/StorageDefinition.java deleted file mode 100644 index 2a8921c..0000000 --- a/src/main/java/io/camunda/file/storage/StorageDefinition.java +++ /dev/null @@ -1,82 +0,0 @@ -/* ******************************************************************** */ -/* */ -/* StorageDefinition */ -/* */ -/* The storage definition contains only the description to access the */ -/* storage, and not what it is saved inside. */ -/* the Storage definition may bne simple (TEMPFOLDER) or complex */ -/* for CMIS, the complete informatin to connect to the CMIS is part of */ -/* This class just manipulate the information with the format */ -/* : -/* ******************************************************************** */ -package io.camunda.file.storage; - -import com.google.gson.Gson; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class StorageDefinition { - - public final static String ERROR_INCORRECT_STORAGEDEFINITION = "INCORRECT_STORAGEDEFINITION"; - public static final String STORAGE_DEFINITION_DELIMITATEUR = ":"; - static Logger logger = LoggerFactory.getLogger(StorageDefinition.class.getName()); - public StorageDefinitionType type; - public String complement = null; - public Object complementInObject = null; - - public static StorageDefinition getFromString(String completeStorageDefinition) throws Exception { - try { - int posDelimiter = completeStorageDefinition.indexOf(STORAGE_DEFINITION_DELIMITATEUR); - - String storageTypeSt = posDelimiter == -1 ? completeStorageDefinition : completeStorageDefinition.substring(0, posDelimiter); - StorageDefinition storageDefinition = new StorageDefinition(); - storageDefinition.type = StorageDefinitionType.valueOf(storageTypeSt); - - switch( storageDefinition.type) { - case FOLDER: - storageDefinition.complement = completeStorageDefinition.substring(posDelimiter + 1); - break; - case CMIS: - String complement = completeStorageDefinition.substring(posDelimiter + 1); - Gson gson = new Gson(); - storageDefinition.complementInObject= gson.fromJson(complement, Object.class); - break; - default: - break; - } - - return storageDefinition; - } catch (Exception e) { - String message = "Can't decode storageDefinition [" + completeStorageDefinition + "]. Format should be [" - + StorageDefinitionType.JSON - + "|" + StorageDefinitionType.CMIS - + "|" + StorageDefinitionType.TEMPFOLDER - + "|" + StorageDefinitionType.FOLDER + "]"; - logger.error("StorageDefinition: Can't decode [" + completeStorageDefinition + "] " + e); - throw new Exception(ERROR_INCORRECT_STORAGEDEFINITION+": "+message); - } - } - - /** - * Encode the current storage definition to a String, so it is easily movable to any information - * - * @return the string which encode the storage definition - */ - public String encodeToString() { - String result = type.toString(); - if (complement != null) { - result += STORAGE_DEFINITION_DELIMITATEUR + complement; - } else if (complementInObject != null) { - Gson gson = new Gson(); - result += STORAGE_DEFINITION_DELIMITATEUR + gson.toJson(complementInObject); - } - return result; - } - - /** - * Define how the file variable is stored. - * JSON: easy, but attention to large file - */ - public enum StorageDefinitionType {JSON, TEMPFOLDER, FOLDER, CMIS} - -} diff --git a/src/main/java/io/camunda/file/storage/StorageFolder.java b/src/main/java/io/camunda/file/storage/StorageFolder.java deleted file mode 100644 index 911c391..0000000 --- a/src/main/java/io/camunda/file/storage/StorageFolder.java +++ /dev/null @@ -1,116 +0,0 @@ -/* ******************************************************************** */ -/* */ -/* FileVariableFolder */ -/* */ -/* Save a file variable in a folder. Folder is part of the storageDef */ -/* syntax is FOLDER: */ -/* Attention, the folder must be accessible where the worker is running*/ -/* ******************************************************************** */ -package io.camunda.file.storage; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.nio.file.FileSystems; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; - -public class StorageFolder extends Storage{ - Logger logger = LoggerFactory.getLogger(StorageFolder.class.getName()); - - - protected StorageFolder(StorageDefinition storageDefinition, FileRepoFactory fileRepoFactory) { - super(storageDefinition, fileRepoFactory); - } - - @Override - public String getName() { - return "Folder"; - } - - /** - * - * @param folder folder to save the file - * @return the connection string - */ - public static String getStorageDefinitionString(String folder ) { - return StorageDefinition.StorageDefinitionType.FOLDER.toString()+StorageDefinition.STORAGE_DEFINITION_DELIMITATEUR+folder; - } - - /** - * Save the file Variable structure in the temporary folder - * - * @param fileVariable fileVariable to save it - * @param fileVariableReference file variable to update (may be null) - */ - public FileVariableReference toStorage( FileVariable fileVariable, FileVariableReference fileVariableReference) throws Exception { - Path tempPath = null; - try { - String uniqId = fileVariableReference==null? getFileRepoFactory().generateUniqId() : (String) fileVariableReference.content; - Path pathFolder = extractPath(getStorageDefinition()); - Path file = Paths.get(pathFolder + FileSystems.getDefault().getSeparator() + fileVariable.getName() + uniqId); - Files.write(file, fileVariable.getValue()); - FileVariableReference fileVariableReferenceOutput = new FileVariableReference(); - fileVariableReferenceOutput.storageDefinition = getStorageDefinition().encodeToString(); - fileVariableReferenceOutput.content = file.getFileName().toString(); - return fileVariableReferenceOutput; - - } catch (Exception e) { - logger.error(getFileRepoFactory().getLoggerHeaderMessage(StorageFolder.class)+"Exception " + e + " During write fileVariable on tempFolder[" + tempPath + "]"); - throw e; - } - } - - /** - * read the fileVariable - * - * @param fileVariableReference name of the file in the temporary directory - * @return the fileVariable object - * @throws Exception during the writing - */ - public FileVariable fromStorage( FileVariableReference fileVariableReference) throws Exception { - Path pathFolder = null; - String fileName = fileVariableReference.content.toString(); - try { - pathFolder = extractPath(getStorageDefinition()); - - FileVariable fileVariable = new FileVariable(getStorageDefinition()); - fileVariable.setName( fileName); - fileVariable.setMimeType( FileVariable.getMimeTypeFromName(fileName)); - fileVariable.setValue( Files.readAllBytes(Paths.get(pathFolder + FileSystems.getDefault().getSeparator() + fileName))); - return fileVariable; - - } catch (Exception e) { - logger.error(getFileRepoFactory().getLoggerHeaderMessage(StorageFolder.class)+"Exception " + e + " During read file[" + fileName + "] in temporaryPath[" + pathFolder + "]"); - throw e; - } - } - - /** - * Remove a file in the directory - * @param fileVariableReference name of the file in the temporary directory - * @return true if the operation was successful - */ - public boolean purgeStorage( FileVariableReference fileVariableReference) { - Path pathFolder = extractPath(getStorageDefinition()); - String fileName = fileVariableReference.content.toString(); - - File file = new File(pathFolder + FileSystems.getDefault().getSeparator()+fileName); - if (file.exists()) - return file.delete(); - return true; - } - /** - * Extract the path from the storage definition - * convention is FOLDER: - * - * @param storageDefinition the storage definition - * @return the folder path - */ - private Path extractPath(StorageDefinition storageDefinition) { - return Paths.get(storageDefinition.complement); - } - -} diff --git a/src/main/java/io/camunda/file/storage/StorageJSON.java b/src/main/java/io/camunda/file/storage/StorageJSON.java deleted file mode 100644 index d6a0cd6..0000000 --- a/src/main/java/io/camunda/file/storage/StorageJSON.java +++ /dev/null @@ -1,83 +0,0 @@ -/* ******************************************************************** */ -/* */ -/* FileVariableJSON */ -/* */ -/* Save a file variable in JSON, in the Camunda Engine */ -/* File are encoded in JSON */ -/* ******************************************************************** */ -package io.camunda.file.storage; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class StorageJSON extends Storage { - Logger logger = LoggerFactory.getLogger(StorageJSON.class.getName()); - - - public StorageJSON(StorageDefinition storageDefinition, FileRepoFactory fileRepoFactory) { - super(storageDefinition, fileRepoFactory); - - } - - @Override - public String getName() { - return "JSON"; - } - - - public static String getStorageDefinitionString( ) { - return StorageDefinition.StorageDefinitionType.JSON.name(); - } - - - /** - * Save the file Variable structure as JSON - * - * @param fileVariable fileVariable to generate the JSON value - * @param fileVariableReferenceUpdated fileVariableReference to update - */ - public FileVariableReference toStorage(FileVariable fileVariable, FileVariableReference fileVariableReferenceUpdated) - throws Exception { - try { - FileVariableReference fileVariableReference = new FileVariableReference(); - fileVariableReference.storageDefinition = getStorageDefinition().encodeToString(); - fileVariableReference.content = new ObjectMapper().writeValueAsString(fileVariable); - return fileVariableReference; - } catch (JsonProcessingException e) { - logger.error(getFileRepoFactory().getLoggerHeaderMessage(StorageJSON.class)+"exception " + e + " During serialize fileVariable"); - throw e; - } - } - - /** - * deserialize a fileVariable - * - * @param fileVariableReference FileVariable in JSON format - * @return the fileVariable object - * @throws JsonProcessingException error during parsing the JSON information - */ - public FileVariable fromStorage(FileVariableReference fileVariableReference) throws Exception { - try { - FileVariable fileVariable= new ObjectMapper().readValue( (String) fileVariableReference.content, FileVariable.class); - fileVariable.setStorageDefinition( getStorageDefinition()); - return fileVariable; - } catch (JsonProcessingException e) { - logger.error(getFileRepoFactory().getLoggerHeaderMessage(StorageJSON.class)+"Exception " + e + " During unserialize fileVariable"); - throw e; - } - } - - /** - * Nothing to do here - * @param fileVariableReference reference to purge - * @return true if everything is correct - * @throws Exception if any error arrive - */ - @Override - public boolean purgeStorage(FileVariableReference fileVariableReference) throws Exception { - return true; - } - -} diff --git a/src/main/java/io/camunda/file/storage/StorageTempFolder.java b/src/main/java/io/camunda/file/storage/StorageTempFolder.java deleted file mode 100644 index 51701da..0000000 --- a/src/main/java/io/camunda/file/storage/StorageTempFolder.java +++ /dev/null @@ -1,113 +0,0 @@ -/* ******************************************************************** */ -/* */ -/* FileVariableTempFolder */ -/* */ -/* Save a file variable in the temporary folder of the host */ -/* Attention, this is the temporary folder where the worker is running */ -/* ******************************************************************** */ -package io.camunda.file.storage; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.nio.file.FileSystems; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; - -public class StorageTempFolder extends Storage { - Logger logger = LoggerFactory.getLogger(StorageTempFolder.class.getName()); - - private FileRepoFactory fileRepoFactory; - - protected StorageTempFolder(StorageDefinition storageDefinition, FileRepoFactory fileRepoFactory) { - super(storageDefinition, fileRepoFactory); - } - - @Override - public String getName() { - return "TempFolder"; - } - - public static String getStorageDefinitionString( ) { - return StorageDefinition.StorageDefinitionType.TEMPFOLDER.toString(); - } - /** - * Save the file Variable structure in the temporary folder - * - * @param fileVariable fileVariable to save it - * @param fileVariableReference file variable to update (may be null) - */ - public FileVariableReference toStorage(FileVariable fileVariable, FileVariableReference fileVariableReference) - throws Exception { - Path tempPath = null; - try { - String fileName = fileVariable.getName(); - String suffix = ""; - int lastDot = fileVariable.getName().lastIndexOf("."); - if (lastDot != -1) { - fileName = fileVariable.getName().substring(0, lastDot) + "_"; - suffix = fileVariable.getName().substring(lastDot + 1); - } - - tempPath = Files.createTempFile(fileName, "." + suffix); - Files.write(tempPath, fileVariable.getValue()); - - FileVariableReference fileVariableReferenceOutput = new FileVariableReference(); - fileVariableReferenceOutput.storageDefinition = getStorageDefinition().encodeToString(); - fileVariableReferenceOutput.content = tempPath.getFileName().toString(); - return fileVariableReferenceOutput; - - } catch (Exception e) { - logger.error(fileRepoFactory.getLoggerHeaderMessage(StorageTempFolder.class) + "Exception " + e - + " During write fileVariable on tempFolder[" + tempPath + "]"); - throw e; - } - } - - /** - * read the fileVariable - * - * @param fileVariableReference name of the file in the temporary directory - * @return the fileVariable object - * @throws Exception during the writing - */ - public FileVariable fromStorage(FileVariableReference fileVariableReference) throws Exception { - String tempFilePath; - try { - // get the temporary path - Path tempPath = Files.createTempFile("", ""); - String separator = FileSystems.getDefault().getSeparator(); - tempFilePath = tempPath.toString().substring(0, tempPath.toString().lastIndexOf(separator)); - - FileVariable fileVariable = new FileVariable(getStorageDefinition()); - fileVariable.setName(fileVariableReference.content.toString()); - fileVariable.setMimeType(FileVariable.getMimeTypeFromName(fileVariableReference.content.toString())); - fileVariable.setValue(Files.readAllBytes(Paths.get(tempFilePath + separator + fileVariableReference.content.toString()))); - return fileVariable; - - } catch (Exception e) { - logger.error( - fileRepoFactory.getLoggerHeaderMessage(StorageTempFolder.class) + "Exception " + e + " During read file[" - + fileVariableReference.content.toString() + "] in temporaryPath[" + fileVariableReference.content.toString() + "]"); - throw e; - } - } - - /** - * Delete the file - * - * @param fileVariableReference name of the file in the temporary directory - * @return true if the operation was successful - */ - public boolean purgeStorage( FileVariableReference fileVariableReference) { - - String tmpDir = System.getProperty("java.io.tmpdir"); - File file = new File(tmpDir + FileSystems.getDefault().getSeparator() + fileVariableReference.getContent().toString()); - if (file.exists()) - return file.delete(); - return true; - } - -} diff --git a/src/main/java/io/camunda/file/storage/cmis/CmisConnection.java b/src/main/java/io/camunda/file/storage/cmis/CmisConnection.java deleted file mode 100644 index b59634f..0000000 --- a/src/main/java/io/camunda/file/storage/cmis/CmisConnection.java +++ /dev/null @@ -1,256 +0,0 @@ -/* ******************************************************************** */ -/* */ -/* CmisConnection */ -/* */ -/* Manage the connection to one CMIS repository */ -/* ******************************************************************** */ -package io.camunda.file.storage.cmis; - -import org.apache.chemistry.opencmis.client.api.*; -import org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl; -import org.apache.chemistry.opencmis.commons.PropertyIds; -import org.apache.chemistry.opencmis.commons.SessionParameter; -import org.apache.chemistry.opencmis.commons.data.ContentStream; -import org.apache.chemistry.opencmis.commons.enums.BindingType; -import org.apache.chemistry.opencmis.commons.enums.VersioningState; -import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException; -import org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl; - -import java.io.InputStream; -import java.math.BigInteger; -import java.util.HashMap; -import java.util.Map; - -public class CmisConnection { - protected Session session; - private final CmisParameters cmisParameters; - private Repository repository; - - - public CmisConnection(CmisParameters cmisParameters) { - this.cmisParameters = cmisParameters; - } - - /** - * Connect to the repository according parameters - * https://chemistry.apache.org/java/examples/example-create-session.html - * - * @return true if the session is correct, false else - */ - public boolean connect() { - if (session != null) { - session.clear(); - session = null; - } - Map parameter = new HashMap<>(); - - // user credentials - parameter.put(SessionParameter.USER, cmisParameters.userName); - parameter.put(SessionParameter.PASSWORD, cmisParameters.password); - - // connection settings - if (cmisParameters.typeConnection == CmisParameters.TypeConnection.BROWSER) { - parameter.put(SessionParameter.BROWSER_URL, cmisParameters.url); - parameter.put(SessionParameter.BINDING_TYPE, BindingType.BROWSER.value()); - } - if (cmisParameters.typeConnection == CmisParameters.TypeConnection.ATOMPUB) { - parameter.put(SessionParameter.ATOMPUB_URL, cmisParameters.url); - parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value()); - } - if (cmisParameters.repositoryName != null) - parameter.put(SessionParameter.REPOSITORY_ID, cmisParameters.repositoryName); - final SessionFactory sessionFactory = SessionFactoryImpl.newInstance(); - - session = sessionFactory.createSession(parameter); - return session != null; - } - - /** - * Disconnect from the repository - */ - public void disconnect() { - if (session != null) { - session.clear(); - session = null; - } - } - - - /** - * Get a folder object from its path - * - * @param path path to the folder - * @return the folder object - */ - public Folder getFolderByPath(final String path) { - CmisObject cmisObject= session.getObjectByPath(path); - if (cmisObject instanceof Folder cmisFolder) - return cmisFolder; - return null; - } - - public CmisObject getObjectByPath(final String path) { - return session.getObjectByPath(path); - } - - /** - * Return an object by it's ID - * @param objectId Id of object - * @return a CMIS Object - */ - public CmisObject getObjectById(final String objectId) { - return session.getObject(objectId); - } - - /** - * Check if an object exists - * - * @param objectPath path to the object to check - * @return true if the object exists - */ - public Boolean checkIfObjectExists(final String objectPath) { - try { - session.getObjectByPath(objectPath); - return true; - } catch (final CmisObjectNotFoundException e) { - return false; - } - } - - - public static class DocumentProperties { - String parentFolder; - String documentName; - String objectType = "cmis:document"; - VersioningState versioningState = null; - - /** - * Ask to save a document. To not ask for a versioning policy - * - * @param parentFolder parent where the document is loaded - * @param documentName name of document - * @return a Document properties - */ - public static DocumentProperties getDocument(String parentFolder, String documentName) { - DocumentProperties documentProperties = new DocumentProperties(); - documentProperties.parentFolder = parentFolder; - documentProperties.documentName = documentName; - documentProperties.objectType = "cmis:document"; - documentProperties.versioningState = VersioningState.NONE; - return documentProperties; - } - - public static DocumentProperties getVersionnableDocument(String parentFolder, String documentName, String objectType) { - DocumentProperties documentProperties = new DocumentProperties(); - documentProperties.parentFolder = parentFolder; - documentProperties.documentName = documentName; - documentProperties.objectType = objectType; - documentProperties.versioningState = VersioningState.MAJOR; - return documentProperties; - } - } - - /** - * Upload a new document. If the document is new, it is created, else a new version of the document is uploaded - * - * @param documentProperties Properties to saved the document - * @param inputDocument Content of the document - * @param mimeType Mime type of the document - * @return a Document - */ - public Document uploadNewDocument(DocumentProperties documentProperties, InputStream inputDocument, long length, final String mimeType) throws Exception { - final Folder folder = getFolderByPath(documentProperties.parentFolder); - if (folder == null) { - throw new IllegalArgumentException("No folder [" + documentProperties.parentFolder + "] exists in [" + cmisParameters.repositoryName + "]"); - } - final ContentStream contentStream = new ContentStreamImpl(documentProperties.documentName, BigInteger.valueOf(length), mimeType, inputDocument); - Document existingDocument; - try { - existingDocument = (Document) session.getObjectByPath(documentProperties.parentFolder + "/" + documentProperties.documentName); - } catch (Exception e) { - // if the document does not exist, throw an exception - existingDocument = null; - } - if (existingDocument != null) { - existingDocument.setContentStream(contentStream, true); - return existingDocument; - } else { - final Map properties = new HashMap(); - properties.put(PropertyIds.OBJECT_TYPE_ID, documentProperties.objectType); - properties.put(PropertyIds.NAME, documentProperties.documentName); - // determine the versioning strategy - VersioningState version = determineVersionStrategy(documentProperties); - return folder.createDocument(properties, contentStream, version); - } - } - - /** - * Object may accept, or not, a version policy. According to the request in the documentProperties, return the best policy, else throw an exception - * - * @param documentProperties properties required - * @return the best policy - */ - private VersioningState determineVersionStrategy(DocumentProperties documentProperties) throws Exception { - if (VersioningState.NONE.equals(documentProperties.versioningState)) - return VersioningState.NONE; - // is the type support the versionning? - ObjectType type = session.getTypeDefinition(documentProperties.objectType); - if (type instanceof DocumentType documentType) { - if (documentType.isVersionable()) { - // everything is possible here. - return documentProperties.versioningState == null ? VersioningState.MAJOR : documentProperties.versioningState; - } - // a version state is required, but not supported: throw an exception - throw new Exception("Can't accept versioning state [" + documentProperties.versioningState + "]"); - } - if (documentProperties.versioningState == null) - return VersioningState.NONE; - throw new Exception("Can't accept versioning state [" + documentProperties.versioningState + "]"); - } - - /** - * Delete a document - * - * @param parentFolder folder where the document is - * @param documentName name of the document - */ - public void deleteDocumentByPath(String parentFolder, final String documentName) { - Document existingDocument = (Document) session.getObjectByPath(parentFolder + "/" + documentName); - if (existingDocument != null) - existingDocument.delete(); - } - - /** - * Return a document in a folder - * - * @param parentFolder folder where the document is - * @param documentName name of the document - * @return the content of the document. Caller is responsible to close the InputStream - */ - public ContentStream getDocumentByPath(String parentFolder, final String documentName) { - Document existingDocument = (Document) session.getObjectByPath(parentFolder + "/" + documentName); - return existingDocument.getContentStream(); - } - - /** - * Delete a document - * - * @param parentFolder folder where the parent is - * @param documentName name of the document - * @return true if the document is deteled, false else (document does not exist) - */ - public boolean removeDocumentByPath(String parentFolder, final String documentName) { - Document existingDocument = (Document) session.getObjectByPath(parentFolder + "/" + documentName); - if (existingDocument != null) - session.delete(existingDocument); - return false; - } - - /** - * Access the CMIS session for any advance usage - * @return the session Id - */ - public Session getSession() { - return session; - } -} diff --git a/src/main/java/io/camunda/file/storage/cmis/CmisFactoryConnection.java b/src/main/java/io/camunda/file/storage/cmis/CmisFactoryConnection.java deleted file mode 100644 index e4a8d29..0000000 --- a/src/main/java/io/camunda/file/storage/cmis/CmisFactoryConnection.java +++ /dev/null @@ -1,49 +0,0 @@ -/* ******************************************************************** */ -/* */ -/* CmisFactoryConnection */ -/* */ -/* Manage all connection for CMIS */ -/* ******************************************************************** */ -package io.camunda.file.storage.cmis; - - -import java.util.HashMap; -import java.util.Map; - -public class CmisFactoryConnection { - - public Map allConnections = new HashMap<>(); - - private static final CmisFactoryConnection singletonCmisFactory = new CmisFactoryConnection(); - - public static CmisFactoryConnection getInstance() { - return singletonCmisFactory; - } - - public CmisConnection getCmisConnection(CmisParameters cmisParameters) { - String signature = getSignature(cmisParameters); - if (allConnections.containsKey(signature)) { - return allConnections.get(signature); - } - synchronized (allConnections) { - // check again: two threads maybe waiting in the synchronized - if (allConnections.containsKey(signature)) - return allConnections.get(signature); - CmisConnection cmisConnection = new CmisConnection(cmisParameters); - cmisConnection.connect(); - allConnections.put(signature, cmisConnection); - return cmisConnection; - } - } - - - /** - * Calculate a uniq signature for a CMIS repository - * - * @param cmisParameters Parameter to access the repository - * @return a signature - */ - public String getSignature(CmisParameters cmisParameters) { - return cmisParameters.typeConnection.toString() + "#" + cmisParameters.url + "#" + cmisParameters.repositoryName + "#" + cmisParameters.userName; - } -} diff --git a/src/main/java/io/camunda/file/storage/cmis/CmisParameters.java b/src/main/java/io/camunda/file/storage/cmis/CmisParameters.java deleted file mode 100644 index b0cc1ab..0000000 --- a/src/main/java/io/camunda/file/storage/cmis/CmisParameters.java +++ /dev/null @@ -1,62 +0,0 @@ -/* ******************************************************************** */ -/* */ -/* CmisParameters */ -/* */ -/* Transport parameters to connect to a CMIS repository */ -/* ******************************************************************** */ -package io.camunda.file.storage.cmis; - -import java.util.Map; - -public class CmisParameters { - - public TypeConnection typeConnection; - public String url; - public String repositoryName; - public String userName; - public String password; - public String storageDefinitionFolder; - - public static CmisParameters getBrowserConnection(final String url, final String repositoryName, final String username, final String password) { - CmisParameters cmisParameters = new CmisParameters(); - cmisParameters.typeConnection = TypeConnection.BROWSER; - cmisParameters.url = url; - cmisParameters.repositoryName = repositoryName; - cmisParameters.userName = username; - cmisParameters.password = password; - return cmisParameters; - } - - /** - * Expected format is a JSON content - * - * @param cmisDefinition information to access the CMIS repository - * @return the CMIS Parameters - */ - public static CmisParameters getCodingConnection(final Object cmisDefinition) throws Exception { - - CmisParameters cmisParameters = new CmisParameters(); - cmisParameters.typeConnection = TypeConnection.BROWSER; - if (cmisDefinition == null) - throw new Exception("No CMIS connection are provided"); - - if (cmisDefinition instanceof Map cmisDefinitionMap) { - cmisParameters.url = (String) cmisDefinitionMap.get("url"); - cmisParameters.repositoryName = (String) cmisDefinitionMap.get("repository"); - if (cmisParameters.repositoryName==null) - cmisParameters.repositoryName="default"; - cmisParameters.userName = (String) cmisDefinitionMap.get("userName"); - cmisParameters.password = (String) cmisDefinitionMap.get("password"); - cmisParameters.storageDefinitionFolder = (String) cmisDefinitionMap.get("storageDefinitionFolder"); - return cmisParameters; - } else - throw new Exception("CMIS parameter must be a Map format ["+cmisDefinition.getClass().getName()+"]"); - } - - public static String getGsonTemplate() { - return "{\"repository\":\"String\"}"; - } - public enum TypeConnection {BROWSER, ATOMPUB} - - -} diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties index e0a273e..fff35ee 100644 --- a/src/main/resources/application-dev.properties +++ b/src/main/resources/application-dev.properties @@ -2,4 +2,13 @@ # Spring Boot Configuration spring.mustache.prefix=file:./src/main/resources/static/templates/ spring.web.resources.static-locations[0]=file:src/main/resources/static/ -spring.web.resources.static-locations[1]=classpath:/static/ \ No newline at end of file +spring.web.resources.static-locations[1]=classpath:/static/ + + + +# Save statistics and information +spring.datasource.url=jdbc:h2:file:~/cherry.db +spring.datasource.driver-class-name=org.h2.Driver +spring.datasource.username=sa +spring.datasource.password=password +spring.jpa.database-platform=org.hibernate.dialect.H2Dialect diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 2299e89..a77ce81 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -22,4 +22,20 @@ spring.mustache.prefix=classpath:static/templates/ # Spring Boot Actuator endpoints # Note: originally, we experimented with using this to get information about beans. But this is no longer needed #management.endpoints.jmx.exposure.include=health,beans -#management.endpoints.web.exposure.include=health,beans \ No newline at end of file +#management.endpoints.web.exposure.include=health,beans + + +# Save statistics and information +spring.datasource.url=jdbc:h2:file:./cherry.db +spring.datasource.driver-class-name=org.h2.Driver +spring.datasource.username=sa +spring.datasource.password=password +spring.jpa.database-platform=org.hibernate.dialect.H2Dialect +spring.jpa.generate-ddl=true +spring.jpa.hibernate.ddl-auto=update + + +# spring.datasource.url=jdbc:postgresql://localhost:5432/tottes +# spring.datasource.username=postgres +# spring.datasource.password=postgres +# spring.datasource.driver-class-name=org.postgresql.Driver diff --git a/src/main/resources/static/templates/_customJs.mustache b/src/main/resources/static/templates/_customJs.mustache index cc1d9dc..8ae9c8c 100644 --- a/src/main/resources/static/templates/_customJs.mustache +++ b/src/main/resources/static/templates/_customJs.mustache @@ -18,6 +18,13 @@ return getAjax(`/cherry/api/runner/detail?name=${workerName}`, {}, {}) } + function getDashboardInfo() { + return getAjax('/cherry/api/runner/dashboard', {}, {}) + } + + function getSystemParameters() { + return getAjax('/cherry/api/runtime/parameters', {}, {}) + } function getTemplate(templateName) { return getAjax(`/templates/${templateName}`, "", {contentType: 'text/plain', dataType: "html"}) } @@ -94,4 +101,88 @@ }); } + + function initDashboardTable() { + let listWorkersDashboard = []; + getDashboardInfo().then(function(result) { + if(result) { + for(var i in result.details) + { + let workerStats = result.details[ i ]; + workerStats.statistic.progressSucceeded = workerStats.statistic.succeeded; + workerStats.statistic.progressExecutions = workerStats.statistic.executions; + + // no execution? Do not display a red bar. Empty bar does not exist, so display a green bar + if (workerStats.statistic.progressExecutions==0) { + workerStats.statistic.progressSucceeded = 1; + workerStats.statistic.progressExecutions = 1; + } + } + + let templateDetails=' \ + \{\{#details\}\} \ + \ + \ + \ + \ + \ + \ + \ + \{\{name\}\} \, \{\{statistic.executions\}\} total, \{\{statistic.failed\}\} failed \ + \ + \ + \ + \{\{#active\}\} \ + Active\ + \{\{/active\}\} \ + \{\{^active\}\} \ + Stopped \ + \{\{/active\}\} \ + \ + \ + \ + \ + \ + \ + \ + Average \{\{performance.averageTimeInMs\}\} ms \ + Pic \{\{performance.picTimeInMs\}\} ms \ + \ + \ + \{\{/details\}\} \ + ' + + $("#dashboardDetails").html(Mustache.render(templateDetails,result)); + + result.progressTotalSucceeded= result.totalsucceeded; + result.progressTotalExecutions= result.totalexecutions; + if (result.progressTotalExecutions==0) { + result.progressTotalSucceeded=1; + result.progressTotalExecutions=1; + } + + let templateHeader=' \ + {\{totalsucceed\}\} total jobs in last 24 hours of {\{nbRunners\}\} Runners\ + \ + \ + \ + \{\{totalsucceeded\}\} Successful \ + \ + \ + \{\{totalfailed\}\} Failed \ + \ + \ + \ + ' + + $("#dashboardHeader").html(Mustache.render(templateHeader,result)); + + console.log("initDashboardTable : the end list="+listWorkersDashboard.length+" html="+dashboardHtml) + } + }); + } diff --git a/src/main/resources/static/templates/dashboard.mustache b/src/main/resources/static/templates/dashboard.mustache index b7fb920..c1c5d1e 100644 --- a/src/main/resources/static/templates/dashboard.mustache +++ b/src/main/resources/static/templates/dashboard.mustache @@ -12,56 +12,14 @@ - 124 total jobs in last 24 hours of 6 Worker/Connector Types - - - 90 Successful - - - 10 Failed - - - - 90% - - - - - c-files-load-from-disk, 10 total, 10 successful, 0 failed - 10 - - - - - c-files-save-to-disk, 20 total, 15 successful, 5 failed - 10 - - - - - c-ping, 24 total, 23 successful, 1 failed - 10 - - - - - c-pingconnector, 0 total, 0 successful, 0 failed - 0 - - - - - c-send-message, 36 total, 24 successful, 12 failed - 24 - - - - - c-set-variables, 19 total, 19 successful, 0 failed - 19 - - + + + + Details + + + @@ -72,6 +30,7 @@