<?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:camunda="http://camunda.org/schema/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_06w1joe" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0">
  <bpmn:process id="demo" name="Démo Workflow" isExecutable="true">
    <bpmn:startEvent id="StartEvent_1">
      <bpmn:outgoing>Flow_1gsokl9</bpmn:outgoing>
    </bpmn:startEvent>
    <bpmn:sequenceFlow id="Flow_1gsokl9" sourceRef="StartEvent_1" targetRef="ValidationProjet" />
    <bpmn:serviceTask id="ValidationProjet" name="Validation Projet">
      <bpmn:extensionElements>
        <camunda:connector>
          <camunda:inputOutput>
            <camunda:inputParameter name="payload">{"projet": { "id": #{execution.getVariable('projectId')}},"libelle":"Validation Projet KPL","type":{"code":"TYP_TACHE_WF"}, "etat":{"code":"STATUT_TACHE_EN_ATTENTE_VALIDATION"}, "idWorkflow":"select-status","idInstance":"#{execution.getProcessInstanceId()}"}</camunda:inputParameter>
            <camunda:inputParameter name="url">http://localhost:8080/MonitorMakerWeb/api/tasks</camunda:inputParameter>
            <camunda:inputParameter name="method">POST</camunda:inputParameter>
            <camunda:inputParameter name="headers">
              <camunda:map>
                <camunda:entry key="X-PM-API-LOGIN">camunda</camunda:entry>
                <camunda:entry key="X-PM-API-PASSWORD">EnvH@virage17</camunda:entry>
                <camunda:entry key="Content-type">application/json</camunda:entry>
              </camunda:map>
            </camunda:inputParameter>
          </camunda:inputOutput>
          <camunda:connectorId>http-connector</camunda:connectorId>
        </camunda:connector>
      </bpmn:extensionElements>
      <bpmn:incoming>Flow_1gsokl9</bpmn:incoming>
      <bpmn:outgoing>Flow_011qgdo</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:sequenceFlow id="Flow_011qgdo" sourceRef="ValidationProjet" targetRef="select-status" />
    <bpmn:userTask id="select-status" name="Select status">
      <bpmn:incoming>Flow_011qgdo</bpmn:incoming>
      <bpmn:outgoing>Flow_0xsznky</bpmn:outgoing>
    </bpmn:userTask>
    <bpmn:exclusiveGateway id="Gateway_0f52taq">
      <bpmn:incoming>Flow_0xsznky</bpmn:incoming>
      <bpmn:outgoing>Flow_19vs1bq</bpmn:outgoing>
      <bpmn:outgoing>Flow_1vxjydy</bpmn:outgoing>
    </bpmn:exclusiveGateway>
    <bpmn:sequenceFlow id="Flow_0xsznky" sourceRef="select-status" targetRef="Gateway_0f52taq" />
    <bpmn:sequenceFlow id="Flow_19vs1bq" name="Approuve&#10;" sourceRef="Gateway_0f52taq" targetRef="Activity_1t4fa39">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{statusCode=='STATUT_TACHE_VALIDEE'}</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:endEvent id="Event_1145c4q">
      <bpmn:incoming>Flow_1at3pcu</bpmn:incoming>
    </bpmn:endEvent>
    <bpmn:sequenceFlow id="Flow_1at3pcu" sourceRef="Activity_1mfb6p5" targetRef="Event_1145c4q" />
    <bpmn:serviceTask id="Activity_1mfb6p5" name="Approuvé">
      <bpmn:extensionElements>
        <camunda:connector>
          <camunda:inputOutput>
            <camunda:inputParameter name="payload">{"id": #{execution.getVariable('projectId')},"statut":{"code":"STATUT_PROJET_EN_COURS"}}</camunda:inputParameter>
            <camunda:inputParameter name="headers">
              <camunda:map>
                <camunda:entry key="X-PM-API-LOGIN">camunda</camunda:entry>
                <camunda:entry key="X-PM-API-PASSWORD">EnvH@virage17</camunda:entry>
                <camunda:entry key="Content-type">application/json</camunda:entry>
              </camunda:map>
            </camunda:inputParameter>
            <camunda:inputParameter name="method">POST</camunda:inputParameter>
            <camunda:inputParameter name="url">http://localhost:8080/MonitorMakerWeb/api/projects</camunda:inputParameter>
          </camunda:inputOutput>
          <camunda:connectorId>http-connector</camunda:connectorId>
        </camunda:connector>
      </bpmn:extensionElements>
      <bpmn:incoming>Flow_0mtpfxa</bpmn:incoming>
      <bpmn:outgoing>Flow_1at3pcu</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:sequenceFlow id="Flow_1vxjydy" name="Reject" sourceRef="Gateway_0f52taq" targetRef="Activity_1ow2xh0">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{statusCode=='STATUT_TACHE_REFUSEE'}</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:serviceTask id="Activity_1ow2xh0" name="Rejeté">
      <bpmn:extensionElements>
        <camunda:connector>
          <camunda:inputOutput>
            <camunda:inputParameter name="payload">{"id": #{execution.getVariable('projectId')},"statut":{"code":"STATUT_PROJET_ANNULE"}}</camunda:inputParameter>
            <camunda:inputParameter name="headers">
              <camunda:map>
                <camunda:entry key="X-PM-API-LOGIN">camunda</camunda:entry>
                <camunda:entry key="X-PM-API-PASSWORD">EnvH@virage17</camunda:entry>
                <camunda:entry key="Content-type">application/json</camunda:entry>
              </camunda:map>
            </camunda:inputParameter>
            <camunda:inputParameter name="method">POST</camunda:inputParameter>
            <camunda:inputParameter name="url">http://localhost:8080/MonitorMakerWeb/api/projects</camunda:inputParameter>
          </camunda:inputOutput>
          <camunda:connectorId>http-connector</camunda:connectorId>
        </camunda:connector>
      </bpmn:extensionElements>
      <bpmn:incoming>Flow_1vxjydy</bpmn:incoming>
      <bpmn:incoming>Flow_1kousxa</bpmn:incoming>
      <bpmn:outgoing>Flow_13jgi5q</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:endEvent id="Event_1ug5g6k">
      <bpmn:incoming>Flow_13jgi5q</bpmn:incoming>
    </bpmn:endEvent>
    <bpmn:sequenceFlow id="Flow_13jgi5q" sourceRef="Activity_1ow2xh0" targetRef="Event_1ug5g6k" />
    <bpmn:exclusiveGateway id="Gateway_088qcn6">
      <bpmn:incoming>Flow_1xllhgg</bpmn:incoming>
      <bpmn:outgoing>Flow_1kousxa</bpmn:outgoing>
      <bpmn:outgoing>Flow_0mtpfxa</bpmn:outgoing>
    </bpmn:exclusiveGateway>
    <bpmn:sequenceFlow id="Flow_1s7xquj" sourceRef="Activity_1t4fa39" targetRef="select-status-2" />
    <bpmn:sequenceFlow id="Flow_1kousxa" name="Reject" sourceRef="Gateway_088qcn6" targetRef="Activity_1ow2xh0">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{statusCode=='STATUT_TACHE_REFUSEE'}</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:sequenceFlow id="Flow_1xllhgg" sourceRef="select-status-2" targetRef="Gateway_088qcn6" />
    <bpmn:sequenceFlow id="Flow_0mtpfxa" name="Approuve" sourceRef="Gateway_088qcn6" targetRef="Activity_1mfb6p5">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{statusCode=='STATUT_TACHE_VALIDEE'}</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:serviceTask id="Activity_1t4fa39" name="Validation 2">
      <bpmn:extensionElements>
        <camunda:connector>
          <camunda:inputOutput>
            <camunda:inputParameter name="headers">
              <camunda:map>
                <camunda:entry key="X-PM-API-LOGIN">camunda</camunda:entry>
                <camunda:entry key="X-PM-API-PASSWORD">EnvH@virage17</camunda:entry>
                <camunda:entry key="Content-type">application/json</camunda:entry>
              </camunda:map>
            </camunda:inputParameter>
            <camunda:inputParameter name="method">POST</camunda:inputParameter>
            <camunda:inputParameter name="url">http://localhost:8080/MonitorMakerWeb/api/tasks</camunda:inputParameter>
            <camunda:inputParameter name="payload">{"projet": { "id": #{execution.getVariable('projectId')}},"libelle":"Validation Projet 2","type":{"code":"TYP_TACHE_WF"}, "etat":{"code":"STATUT_TACHE_EN_ATTENTE_VALIDATION"}, "idWorkflow":"select-status-2","idInstance":"#{execution.getProcessInstanceId()}"}</camunda:inputParameter>
          </camunda:inputOutput>
          <camunda:connectorId>http-connector</camunda:connectorId>
        </camunda:connector>
      </bpmn:extensionElements>
      <bpmn:incoming>Flow_19vs1bq</bpmn:incoming>
      <bpmn:outgoing>Flow_1s7xquj</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:userTask id="select-status-2" name="Select status 2">
      <bpmn:incoming>Flow_1s7xquj</bpmn:incoming>
      <bpmn:outgoing>Flow_1xllhgg</bpmn:outgoing>
    </bpmn:userTask>
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="demo">
      <bpmndi:BPMNEdge id="Flow_0mtpfxa_di" bpmnElement="Flow_0mtpfxa">
        <di:waypoint x="820" y="435" />
        <di:waypoint x="820" y="530" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="826" y="463" width="47" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1xllhgg_di" bpmnElement="Flow_1xllhgg">
        <di:waypoint x="710" y="410" />
        <di:waypoint x="795" y="410" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1kousxa_di" bpmnElement="Flow_1kousxa">
        <di:waypoint x="820" y="385" />
        <di:waypoint x="820" y="157" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="833" y="253" width="33" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1s7xquj_di" bpmnElement="Flow_1s7xquj">
        <di:waypoint x="660" y="300" />
        <di:waypoint x="660" y="370" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_13jgi5q_di" bpmnElement="Flow_13jgi5q">
        <di:waypoint x="870" y="117" />
        <di:waypoint x="962" y="117" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1vxjydy_di" bpmnElement="Flow_1vxjydy">
        <di:waypoint x="685" y="117" />
        <di:waypoint x="770" y="117" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="707" y="100" width="33" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1at3pcu_di" bpmnElement="Flow_1at3pcu">
        <di:waypoint x="870" y="570" />
        <di:waypoint x="942" y="570" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_19vs1bq_di" bpmnElement="Flow_19vs1bq">
        <di:waypoint x="660" y="142" />
        <di:waypoint x="660" y="220" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="666" y="176" width="47" height="27" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0xsznky_di" bpmnElement="Flow_0xsznky">
        <di:waypoint x="550" y="117" />
        <di:waypoint x="635" y="117" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_011qgdo_di" bpmnElement="Flow_011qgdo">
        <di:waypoint x="370" y="117" />
        <di:waypoint x="450" y="117" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1gsokl9_di" bpmnElement="Flow_1gsokl9">
        <di:waypoint x="148" y="117" />
        <di:waypoint x="270" y="117" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="Activity_17cdr8l_di" bpmnElement="ValidationProjet">
        <dc:Bounds x="270" y="77" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_1m954ls_di" bpmnElement="select-status">
        <dc:Bounds x="450" y="77" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Gateway_0f52taq_di" bpmnElement="Gateway_0f52taq" isMarkerVisible="true">
        <dc:Bounds x="635" y="92" width="50" height="50" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_1145c4q_di" bpmnElement="Event_1145c4q">
        <dc:Bounds x="942" y="552" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_1ruz5ip_di" bpmnElement="Activity_1mfb6p5">
        <dc:Bounds x="770" y="530" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_0q6z2ua_di" bpmnElement="Activity_1ow2xh0">
        <dc:Bounds x="770" y="77" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_1ug5g6k_di" bpmnElement="Event_1ug5g6k">
        <dc:Bounds x="962" y="99" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Gateway_088qcn6_di" bpmnElement="Gateway_088qcn6" isMarkerVisible="true">
        <dc:Bounds x="795" y="385" width="50" height="50" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_1uxazjj_di" bpmnElement="Activity_1t4fa39">
        <dc:Bounds x="610" y="220" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_0akmmpz_di" bpmnElement="select-status-2">
        <dc:Bounds x="610" y="370" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
        <dc:Bounds x="112" y="99" width="36" height="36" />
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>
