Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve gateways in process #192

Closed
Tracked by #170 ...
tjololo opened this issue Feb 13, 2023 · 1 comment
Closed
Tracked by #170 ...

Improve gateways in process #192

tjololo opened this issue Feb 13, 2023 · 1 comment
Assignees
Labels
feature-complete kind/user-story Used for issues that describes functionality for our users.
Milestone

Comments

@tjololo
Copy link
Member

tjololo commented Feb 13, 2023

Description

How gateways decides what flows to follow is not solved in a consistent way.
We should have a new look at gateways in our process engine.

Additional Information

Related epic: Altinn/app-template-dotnet#170

Proposal based on proposal in #205

Improved gateways given new proposal for process definition

If we decide to implement the new process definition pattern we could make it possible for developers to define expressions on flows exiting gateways to make decisions as to what flow to follow.

This also requires frontend to pass the action chosen by the user to the backend on processNext

Example process definition

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
  xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
  xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
  xmlns:altinn="http://altinncdn.no/schemas/1.0/bpmn"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
  xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1exv6jf"
  targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.5.0"
  modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.18.0">
  <bpmn:process id="Process_1om6n79" isExecutable="true">
    <bpmn:startEvent id="Start">
      <bpmn:outgoing>SequenceFlow_1</bpmn:outgoing>
    </bpmn:startEvent>
    <bpmn:task id="Task1" name="Task1:Data">
      <bpmn:extensionElements>
        <altinn:properties>
          <altinn:actions>
            <altinn:action id="submit" name="Send inn" />
          </altinn:actions>
          <altinn:tasktype id="data" />
        </altinn:properties>
      </bpmn:extensionElements>
      <bpmn:incoming>SequenceFlow_1</bpmn:incoming>
      <bpmn:incoming>SequenceFlow_5</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_2</bpmn:outgoing>
    </bpmn:task>
    <bpmn:task id="Task2" name="Task2:Confirm">
      <bpmn:extensionElements>
        <altinn:properties>
          <altinn:actions>
            <altinn:action id="confirm" name="Bekreft" />
            <altinn:action id="reject" name="Avslå" />
          </altinn:actions>
          <altinn:tasktype id="confirm" />
        </altinn:properties>
      </bpmn:extensionElements>
      <bpmn:incoming>SequenceFlow_2</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_3</bpmn:outgoing>
    </bpmn:task>
    <bpmn:exclusiveGateway id="Gateway_1">
      <bpmn:incoming>SequenceFlow_3</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_4</bpmn:outgoing>
      <bpmn:outgoing>SequenceFlow_5</bpmn:outgoing>
    </bpmn:exclusiveGateway>
    <bpmn:endEvent id="End">
      <bpmn:incoming>SequenceFlow_4</bpmn:incoming>
    </bpmn:endEvent>
    <bpmn:sequenceFlow id="SequenceFlow_1" sourceRef="Start" targetRef="Task1" />
    <bpmn:sequenceFlow id="SequenceFlow_2" sourceRef="Task1" targetRef="Task2" />
    <bpmn:sequenceFlow id="SequenceFlow_3" sourceRef="Task2" targetRef="Gateway_1" />
    <bpmn:sequenceFlow id="SequenceFlow_4" sourceRef="Gateway_1" targetRef="End">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">Task2.action == confirm</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:sequenceFlow id="SequenceFlow_5" sourceRef="Gateway_1" targetRef="Task1">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">Task2.action == reject</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
  </bpmn:process>
</bpmn:definitions>

TL;DR; extracted the flows exiting the gateway from the bpmn abov:

<bpmn:sequenceFlow id="SequenceFlow_4" sourceRef="Gateway_1" targetRef="End">
    <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">Task2.action == confirm</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_5" sourceRef="Gateway_1" targetRef="Task1">
    <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">Task2.action == reject</bpmn:conditionExpression>
</bpmn:sequenceFlow>

Tasks

No response

Acceptance Criterias

No response

@tjololo tjololo added kind/user-story Used for issues that describes functionality for our users. status/draft Status: When you create an issue before you have enough info to properly describe the issue. labels Feb 13, 2023
@RonnyB71
Copy link
Member

RonnyB71 commented Apr 11, 2023

See requirements from: #271 and #137

@tjololo tjololo added this to the 8.0.0 milestone May 4, 2023
@tjololo tjololo moved this to 📈 Todo in Team Apps May 12, 2023
@tjololo tjololo removed the status in Team Apps May 12, 2023
@tjololo tjololo moved this to 📈 Todo in Team Apps May 12, 2023
@tjololo tjololo moved this from 📈 Todo to 👷 In Progress in Team Apps May 15, 2023
@tjololo tjololo self-assigned this May 15, 2023
@RonnyB71 RonnyB71 removed the status/draft Status: When you create an issue before you have enough info to properly describe the issue. label May 22, 2023
@tjololo tjololo moved this from 👷 In Progress to 🔎 Review in Team Apps May 30, 2023
tjololo added a commit that referenced this issue Jun 1, 2023
* Working gateway filter leveraging expressions to make decisions

* remove logger

* Add tests for expressions function gatewayAction

* move test out of shared tests as it is only supported backend (no process in frontend)

* Add tests and small refactoring

* Fix code smells

* Fixes after review
tjololo added a commit that referenced this issue Jun 1, 2023
* Working gateway filter leveraging expressions to make decisions

* remove logger

* Add tests for expressions function gatewayAction

* move test out of shared tests as it is only supported backend (no process in frontend)

* Add tests and small refactoring

* Fix code smells

* Fixes after review
@tjololo tjololo moved this from 🔎 Review to 🧪 Test in Team Apps Jun 5, 2023
@tjololo tjololo closed this as completed Jun 16, 2023
@tjololo tjololo reopened this Jun 16, 2023
@RonnyB71 RonnyB71 moved this from 🧪 Test to ✅ Done in Team Apps Jun 19, 2023
@tjololo tjololo closed this as completed Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-complete kind/user-story Used for issues that describes functionality for our users.
Projects
Archived in project
Development

No branches or pull requests

2 participants