<?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:bioc="http://bpmn.io/schema/bpmn/biocolor/1.0" xmlns:color="http://www.omg.org/spec/BPMN/non-normative/color/1.0" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_06w1joe" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.10.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0">
  <bpmn:process id="demo_workflow" 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 pré-cadrage">
      <bpmn:extensionElements>
        <camunda:connector>
          <camunda:inputOutput>
            <camunda:inputParameter name="payload">{
"libelle":"Validation pré-cadrage",
"projet":{"id":#{execution.getVariable('projectId')}},
"message":"Veuillez valider le pré-cadrage en changeant le statut de la tâche vers WF - Validée ou WF - Refusée.",
"loginEmetteur":"Ludovic.cepe",
"etat":{"code":"STATUT_TACHE_EN_ATTENTE_VALIDATION"},
"type":{"code":"TYP_TACHE_WF"},
"priorite":{"code":"TACHE_PRIORITE_HAUTE"},
"roleAssigne": "444",
"envoyerMail" : true,
"idWorkflow":"selection_statut",
"idInstance":"#{execution.id}"
}</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"></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="selection_statut" />
    <bpmn:userTask id="selection_statut" name="Sélection du statut">
      <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="selection_statut" targetRef="Gateway_0f52taq" />
    <bpmn:sequenceFlow id="Flow_19vs1bq" name="Validé" 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_1jhxifc</bpmn:incoming>
      <bpmn:incoming>Flow_1f6b84m</bpmn:incoming>
    </bpmn:endEvent>
    <bpmn:serviceTask id="Activity_1mfb6p5" name="Projet validé">
      <bpmn:extensionElements>
        <camunda:connector>
          <camunda:inputOutput>
            <camunda:inputParameter name="payload">{"id": #{execution.getVariable('projectId')},"statut":{"code":"STATUT_PROJ_A_DEMARRER"}}</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"></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_0g9i9vw</bpmn:incoming>
      <bpmn:outgoing>Flow_1jhxifc</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:sequenceFlow id="Flow_1vxjydy" name="Rejeté" 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="Projet annulé">
      <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"></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="Activity_0cnlbol" />
    <bpmn:sequenceFlow id="Flow_1kousxa" name="Rejeté" 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="selection_statut2" targetRef="Gateway_088qcn6" />
    <bpmn:sequenceFlow id="Flow_0mtpfxa" name="Validé" sourceRef="Gateway_088qcn6" targetRef="Gateway_0pdm3rw">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{statusCode=='STATUT_TACHE_VALIDEE'}</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:serviceTask id="Activity_1t4fa39" name="Validation cadrage">
      <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"></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">{
"libelle":"Validation cadrage",
"projet":{"id":#{execution.getVariable('projectId')}},
"message":"Veuillez valider le cadrage en changeant le statut de la tâche vers WF - Validée ou WF - Refusée.",
"loginEmetteur":"Ludovic.cepe",
"etat":{"code":"STATUT_TACHE_EN_ATTENTE_VALIDATION"},
"type":{"code":"TYP_TACHE_WF"},
"priorite":{"code":"TACHE_PRIORITE_HAUTE"},
"roleAssigne": "48566",
"envoyerMail" : true,
"idWorkflow":"selection_statut2",
"idInstance":"#{execution.id}"
}</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="selection_statut2" name="Selection du statut">
      <bpmn:incoming>Flow_1hnesn0</bpmn:incoming>
      <bpmn:outgoing>Flow_1xllhgg</bpmn:outgoing>
    </bpmn:userTask>
    <bpmn:serviceTask id="Activity_0cnlbol" name="Changement de statut projet">
      <bpmn:extensionElements>
        <camunda:connector>
          <camunda:inputOutput>
            <camunda:inputParameter name="payload">{
"id": #{execution.getVariable('projectId')},
"statut":{"code":"STATUT_PROJET_A_ETUDIER"}
}</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"></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_1s7xquj</bpmn:incoming>
      <bpmn:outgoing>Flow_1hnesn0</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:sequenceFlow id="Flow_1hnesn0" sourceRef="Activity_0cnlbol" targetRef="selection_statut2" />
    <bpmn:serviceTask id="Activity_0z0sq6d" name="Application du gabarit">
      <bpmn:extensionElements>
        <camunda:connector>
          <camunda:inputOutput>
            <camunda:inputParameter name="headers">
              <camunda:map>
                <camunda:entry key="Accept">application/json</camunda:entry>
                <camunda:entry key="Content-type">application/json</camunda:entry>
                <camunda:entry key="X-PM-API-LOGIN">camunda</camunda:entry>
              </camunda:map>
            </camunda:inputParameter>
            <camunda:inputParameter name="method">POST</camunda:inputParameter>
            <camunda:inputParameter name="payload">{
"project": { "id": #{execution.getVariable('projectId')}},
"template": {"code": "GAB_PRJ_STANDARD"},
"insert": false
}</camunda:inputParameter>
            <camunda:inputParameter name="url">http://localhost:8080/monitorupgrade/projects/template/update</camunda:inputParameter>
          </camunda:inputOutput>
          <camunda:connectorId>http-connector</camunda:connectorId>
        </camunda:connector>
      </bpmn:extensionElements>
      <bpmn:incoming>Flow_00bam4g</bpmn:incoming>
      <bpmn:outgoing>Flow_1f6b84m</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:parallelGateway id="Gateway_0pdm3rw">
      <bpmn:incoming>Flow_0mtpfxa</bpmn:incoming>
      <bpmn:outgoing>Flow_0g9i9vw</bpmn:outgoing>
      <bpmn:outgoing>Flow_00bam4g</bpmn:outgoing>
    </bpmn:parallelGateway>
    <bpmn:sequenceFlow id="Flow_0g9i9vw" sourceRef="Gateway_0pdm3rw" targetRef="Activity_1mfb6p5" />
    <bpmn:sequenceFlow id="Flow_00bam4g" sourceRef="Gateway_0pdm3rw" targetRef="Activity_0z0sq6d" />
    <bpmn:sequenceFlow id="Flow_1jhxifc" sourceRef="Activity_1mfb6p5" targetRef="Event_1145c4q" />
    <bpmn:sequenceFlow id="Flow_1f6b84m" sourceRef="Activity_0z0sq6d" targetRef="Event_1145c4q" />
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="demo_workflow">
      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
        <dc:Bounds x="112" y="99" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_17cdr8l_di" bpmnElement="ValidationProjet" bioc:stroke="#0d4372" bioc:fill="#bbdefb" color:background-color="#bbdefb" color:border-color="#0d4372">
        <dc:Bounds x="210" y="77" width="100" height="80" />
        <bpmndi:BPMNLabel />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_1m954ls_di" bpmnElement="selection_statut" bioc:stroke="#0d4372" bioc:fill="#bbdefb" color:background-color="#bbdefb" color:border-color="#0d4372">
        <dc:Bounds x="370" y="77" width="100" height="80" />
        <bpmndi:BPMNLabel />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Gateway_0f52taq_di" bpmnElement="Gateway_0f52taq" isMarkerVisible="true">
        <dc:Bounds x="565" y="92" width="50" height="50" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_1145c4q_di" bpmnElement="Event_1145c4q" bioc:stroke="#43a047" bioc:fill="#c8e6c9" color:background-color="#c8e6c9" color:border-color="#43a047">
        <dc:Bounds x="1092" y="442" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_1ruz5ip_di" bpmnElement="Activity_1mfb6p5" bioc:stroke="#205022" bioc:fill="#c8e6c9" color:background-color="#c8e6c9" color:border-color="#205022">
        <dc:Bounds x="930" y="370" width="100" height="80" />
        <bpmndi:BPMNLabel />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_0q6z2ua_di" bpmnElement="Activity_1ow2xh0" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311">
        <dc:Bounds x="930" y="77" width="100" height="80" />
        <bpmndi:BPMNLabel />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_1ug5g6k_di" bpmnElement="Event_1ug5g6k" bioc:stroke="#e53935" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#e53935">
        <dc:Bounds x="1092" y="99" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Gateway_088qcn6_di" bpmnElement="Gateway_088qcn6" isMarkerVisible="true">
        <dc:Bounds x="705" y="435" width="50" height="50" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_1uxazjj_di" bpmnElement="Activity_1t4fa39" bioc:stroke="#0d4372" bioc:fill="#bbdefb" color:background-color="#bbdefb" color:border-color="#0d4372">
        <dc:Bounds x="540" y="220" width="100" height="80" />
        <bpmndi:BPMNLabel />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_0akmmpz_di" bpmnElement="selection_statut2" bioc:stroke="#0d4372" bioc:fill="#bbdefb" color:background-color="#bbdefb" color:border-color="#0d4372">
        <dc:Bounds x="540" y="420" width="100" height="80" />
        <bpmndi:BPMNLabel />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_0cnlbol_di" bpmnElement="Activity_0cnlbol" bioc:stroke="#0d4372" bioc:fill="#bbdefb" color:background-color="#bbdefb" color:border-color="#0d4372">
        <dc:Bounds x="540" y="320" width="100" height="80" />
        <bpmndi:BPMNLabel />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_0arcaba_di" bpmnElement="Activity_0z0sq6d" bioc:stroke="#205022" bioc:fill="#c8e6c9" color:background-color="#c8e6c9" color:border-color="#205022">
        <dc:Bounds x="930" y="470" width="100" height="80" />
        <bpmndi:BPMNLabel />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Gateway_0pdm3rw_di" bpmnElement="Gateway_0pdm3rw">
        <dc:Bounds x="825" y="435" width="50" height="50" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="Flow_1gsokl9_di" bpmnElement="Flow_1gsokl9">
        <di:waypoint x="148" y="117" />
        <di:waypoint x="210" y="117" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_011qgdo_di" bpmnElement="Flow_011qgdo">
        <di:waypoint x="310" y="117" />
        <di:waypoint x="370" y="117" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0xsznky_di" bpmnElement="Flow_0xsznky">
        <di:waypoint x="470" y="117" />
        <di:waypoint x="565" y="117" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_19vs1bq_di" bpmnElement="Flow_19vs1bq">
        <di:waypoint x="590" y="142" />
        <di:waypoint x="590" y="220" />
        <bpmndi:BPMNLabel color:color="#c8e6c9">
          <dc:Bounds x="605" y="176" width="30" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1vxjydy_di" bpmnElement="Flow_1vxjydy">
        <di:waypoint x="615" y="117" />
        <di:waypoint x="930" y="117" />
        <bpmndi:BPMNLabel color:color="#ffcdd2">
          <dc:Bounds x="742" y="100" width="33" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_13jgi5q_di" bpmnElement="Flow_13jgi5q">
        <di:waypoint x="1030" y="117" />
        <di:waypoint x="1092" y="117" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1s7xquj_di" bpmnElement="Flow_1s7xquj">
        <di:waypoint x="590" y="300" />
        <di:waypoint x="590" y="320" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1kousxa_di" bpmnElement="Flow_1kousxa">
        <di:waypoint x="730" y="435" />
        <di:waypoint x="730" y="117" />
        <di:waypoint x="930" y="117" />
        <bpmndi:BPMNLabel color:color="#ffcdd2">
          <dc:Bounds x="743" y="287" width="33" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1xllhgg_di" bpmnElement="Flow_1xllhgg">
        <di:waypoint x="640" y="460" />
        <di:waypoint x="705" y="460" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0mtpfxa_di" bpmnElement="Flow_0mtpfxa">
        <di:waypoint x="755" y="460" />
        <di:waypoint x="825" y="460" />
        <bpmndi:BPMNLabel color:color="#c8e6c9">
          <dc:Bounds x="768" y="424" width="30" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1hnesn0_di" bpmnElement="Flow_1hnesn0">
        <di:waypoint x="590" y="400" />
        <di:waypoint x="590" y="420" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0g9i9vw_di" bpmnElement="Flow_0g9i9vw">
        <di:waypoint x="850" y="435" />
        <di:waypoint x="850" y="410" />
        <di:waypoint x="930" y="410" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_00bam4g_di" bpmnElement="Flow_00bam4g">
        <di:waypoint x="850" y="485" />
        <di:waypoint x="850" y="510" />
        <di:waypoint x="930" y="510" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1jhxifc_di" bpmnElement="Flow_1jhxifc">
        <di:waypoint x="1030" y="410" />
        <di:waypoint x="1110" y="410" />
        <di:waypoint x="1110" y="442" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1f6b84m_di" bpmnElement="Flow_1f6b84m">
        <di:waypoint x="1030" y="510" />
        <di:waypoint x="1110" y="510" />
        <di:waypoint x="1110" y="478" />
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>
