Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
Fix issue with not unique conditions on gateways (#40)
Browse files Browse the repository at this point in the history
* Add config for script splitter endpoint

* Add menu entry for workflow generation

* Redirect request for workflow generation to BPMNEditor

* Search for required python and requirements files for workflow generation

* Small logging fixes

* Send request to script splitter

* Poll for result at task resource

* Iterate through script parts and invoke deployment model generation stub

* Initialize workflow

* Fix linting errors

* Move modeler creation into client

* Add layouting after generation

* Add generation logic for first types

* Change implementation type of ServiceTasks to deployment model

* Generate ArtifactTemplate based on received files

* Package script part artifacts to Zip and upload to Winery

* Start handling ifs

* Handle end_if during workflow generation

* Add conditions to branches of if statements

* Handle else_if during generation

* Remove start event initially contained in newly created modelers

* Handle interleaved for loops

* Add iterator scripts to script tasks of for loops

* Rename method to create new ServiceTemplate versions

* Remove unused variable

* Generate deployment models based on template within Winery

* Mark generated workflow as executable

* Add config property for script splitter threshold

* Include splitting threshold from config in splitting request

* Handle while loops

* Change wrong conditions for loops

* Fix issue with elif conditions
  • Loading branch information
wederbn authored May 11, 2022
1 parent 87354ff commit d2894cf
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions client/src/app/tabs/bpmn/BpmnEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,7 @@ export class BpmnEditor extends CachedComponent {
let lastIfsElement = null;
let lastLoopElement = null;
let entryGateway = null;
let condition = null;

switch (metaElement.type) {
case 'start':
Expand Down Expand Up @@ -885,7 +886,7 @@ export class BpmnEditor extends CachedComponent {
newElement = modeling.createShape({ type: 'bpmn:ExclusiveGateway' }, { x: 0, y: 0 }, rootElementBo, {});

// store if for later connections of else statements
lastIfs.push({ start_gateway: newElement, conditions: [metaElement.condition], branches: [] });
lastIfs.push({ start_gateway: newElement, conditions: [metaElement.condition], lastCondition: metaElement.condition, branches: [] });
break;

case 'else_if':
Expand All @@ -896,6 +897,9 @@ export class BpmnEditor extends CachedComponent {
lastIfsElement.branches.push(previousElement);

// add condition
condition = '!(' + lastIfsElement.conditions.join(' || ') + ') && ' + metaElement.condition;
console.log('Condition of else_if branch: ', condition);
lastIfsElement.lastCondition = condition;
lastIfsElement.conditions.push(metaElement.condition);
lastIfs.push(lastIfsElement);

Expand All @@ -911,10 +915,9 @@ export class BpmnEditor extends CachedComponent {
lastIfsElement.branches.push(previousElement);

// the condition of the else branch is concatenated from the conditions of the other branches
// eslint-disable-next-line no-case-declarations
let condition = '!(' + lastIfsElement.conditions.join(' || ') + ')';
condition = '!(' + lastIfsElement.conditions.join(' || ') + ')';
console.log('Condition of else branch: ', condition);
lastIfsElement.conditions.push(condition);
lastIfsElement.lastCondition = condition;
lastIfs.push(lastIfsElement);

// the next element in the meta-data file should be connected with the gateway representing the last if statement
Expand Down Expand Up @@ -1033,7 +1036,7 @@ export class BpmnEditor extends CachedComponent {
// handle ifs
if (lastIfs.length > 0 && lastIfs[lastIfs.length - 1].start_gateway === previousElement) {
let metaDataIf = lastIfs[lastIfs.length - 1];
let condition = metaDataIf.conditions[metaDataIf.conditions.length - 1];
let condition = metaDataIf.lastCondition;
console.log('Previous element is ExclusiveGateway starting an if statement, adding condition: ', condition);

// add condition
Expand Down

0 comments on commit d2894cf

Please sign in to comment.