+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
- <process id="procEnvoiLotTDT" name="Transmission d'actes par Lot à iXbus" isExecutable="true">
- <startEvent id="startiXbus" name="Démarrage workflow iXbus">
- <extensionElements>
- <activiti:formProperty id="refDossier" name="Référence dossier archivage Alfresco pour l'AR" type="string" required="true"></activiti:formProperty>
- <activiti:formProperty id="actID" name="ID de l'envoi pour le document XML d'accompagnement" type="string" required="true"></activiti:formProperty>
- <activiti:formProperty id="subject" name="Sujet de l'envoi pour le document XML d'accompagnement" type="string" required="true"></activiti:formProperty>
- </extensionElements>
- </startEvent>
- <scriptTask id="scriptEnvoyer" name="Envoi vers iXbus" scriptFormat="javascript" activiti:autoStoreVariables="false">
- <script>logger.info("Envoi fichiers");
-var lst = java.util.ArrayList();
-var xmlAttachment = utils.createXmlAttachment(actID, subject);
-xmlAttachment.setName(utils.replaceFileExtension(pjAttachment.getName(), ".xml"));
-lst.add(xmlAttachment);
-lst.add(pjAttachment);
-logger.info("-> fichier n° 1 : " + xmlAttachment.getName());
-logger.info("-> fichier n° 2 : " + pjAttachment.getName());
-//TODO enregistrement suivant à enlever
-utils.saveAttachment(xmlAttachment);
-//TODO enregistrement suivant à enlever
-utils.saveAttachment(pjAttachment);
-ixbus.envoyer(lst);
-execution.setVariable("xmlAttachment", xmlAttachment);
-var dateEnvoi = new java.util.GregorianCalendar();
-execution.setVariable("dateEnvoi", dateEnvoi);
-logger.info("Envoi fichiers OK");
- </script>
- </scriptTask>
- <endEvent id="endeventiXbus" name="Fin workflow iXbus"></endEvent>
- <scriptTask id="scriptRecevoirAck" name="Reception AR iXbus" scriptFormat="javascript" activiti:autoStoreVariables="false">
- <script>logger.info("Reception AR fichier " + xmlAttachment.getName());
-ixbus.setUp();
-var ack = ixbus.recevoirAck(xmlAttachment.getName());
-execution.setVariable("ack", ack);
-if (ack.isRecu()) {
- logger.info("Reception AR OK");
-} else {
- logger.info("AR ou anomalie non disponible");
-}</script>
- </scriptTask>
- <sequenceFlow id="flowEnd" name="AR disponible" sourceRef="scriptRecevoirAck" targetRef="scriptArchiveAR">
- <conditionExpression xsi:type="tFormalExpression"><![CDATA[${ack.isRecu()}]]></conditionExpression>
- </sequenceFlow>
- <scriptTask id="scriptTest" name="Test connexion iXbus" scriptFormat="javascript" activiti:autoStoreVariables="false">
- <script>logger.info("Test connexion");
-ixbus.setUp();
-ixbus.test();
-logger.info("Connexion OK");</script>
- </scriptTask>
- <sequenceFlow id="flow10" sourceRef="scriptTest" targetRef="scriptEnvoyer"></sequenceFlow>
- <scriptTask id="scriptGetCmisFolder" name="Chargement contenu dossier CMIS" scriptFormat="javascript" activiti:autoStoreVariables="false">
- <script>logger.info("scriptGetCmisFolder IN");
-serviceCMIS.createSession();
-var pjAttachment = serviceDelib.createPjFromFolderId(refDossier);
-execution.setVariable("pjAttachment", pjAttachment);
-logger.info("scriptGetCmisFolder OUT");</script>
- </scriptTask>
- <sequenceFlow id="flow12" sourceRef="scriptGetCmisFolder" targetRef="scriptTest"></sequenceFlow>
- <intermediateCatchEvent id="timerRecevoirAck" name="Timer d'interrogation iXbus">
- <timerEventDefinition>
- <timeDuration>PT30S</timeDuration>
- </timerEventDefinition>
- </intermediateCatchEvent>
- <sequenceFlow id="flow19" sourceRef="scriptEnvoyer" targetRef="timerRecevoirAck"></sequenceFlow>
- <sequenceFlow id="flowRecevoirAck" sourceRef="timerRecevoirAck" targetRef="scriptRecevoirAck"></sequenceFlow>
- <sequenceFlow id="flowTimerRecevoirAck" name="AR non disponible" sourceRef="scriptRecevoirAck" targetRef="timerRecevoirAck">
- <conditionExpression xsi:type="tFormalExpression"><![CDATA[${!ack.isRecu()}]]></conditionExpression>
- </sequenceFlow>
- <scriptTask id="scriptArchiveAR" name="Archivage AR iXbus" scriptFormat="javascript" activiti:autoStoreVariables="false">
- <script>logger.info("scriptArchiveAR IN");
-//TODO enregistrement suivant à enlever
-utils.saveAttachment(ack.getAttachment());
-var idRetour = utils.getIDActe(ack.getAttachment());
-serviceCMIS.createSession();
-var folder = serviceCMIS.getFolder(refDossier);
-var doc = serviceCMIS.getDocument(docId);
-var statut = ack.getStatut().value();
-if (statut == "ACK") {
- var name = "AR TdT " + xmlAttachment.getName();
- var statutTDT = "AccuseReceptionRecu";
-} else {
- var name = "Anomalie TdT " + xmlAttachment.getName();
- var statutTDT = "Anomalie";
-}
-var dateReception = new java.util.GregorianCalendar();
-var ackContent = utils.removeZeroBytes(ack.getAttachment().getContent());
-var prop = new java.util.HashMap();
-prop.put("cmis:objectTypeId", "cmis:document,P:mbdx:accuseReceptionTdT,P:mbdx:statutAspect,P:mbdx:ducGed");
-prop.put("cmis:name", name);
-var docAR = serviceCMIS.createDocument(folder, name, ackContent, "text/xml", prop);
-prop.clear();
-prop.put("mbdx:statutDocument", "A archiver");
-prop.put("mbdx:typeDocument", "Annexe");
-prop.put("mbdx:communicabilite", "Oui");
-prop.put("mbdx:idDocTransmis", actID);
-prop.put("mbdx:statutTDT", statutTDT);
-prop.put("mbdx:dateEnvoi", dateEnvoi);
-prop.put("mbdx:dateReception", dateReception);
-prop.put("mbdx:idRetour", idRetour);
-serviceCMIS.updateProperties(docAR, prop);
-logger.info("AR TdT enregistré");
-prop.clear();
-prop.put("mbdx:idDocTransmis", actID);
-prop.put("mbdx:statutTDT", statutTDT);
-prop.put("mbdx:dateEnvoi", dateEnvoi);
-prop.put("mbdx:dateReception", dateReception);
-prop.put("mbdx:idRetour", idRetour);
-prop.put("mbdx:executoire", "Retour Préfecture");
-serviceDelib.updateTdTProperties(refDossier, prop);
-logger.info("scriptArchiveAR OUT");</script>
- </scriptTask>
- <sequenceFlow id="flow20" sourceRef="scriptArchiveAR" targetRef="endeventiXbus"></sequenceFlow>
- <sequenceFlow id="flow21" sourceRef="startiXbus" targetRef="scriptGetCmisFolder"></sequenceFlow>
- </process>
- <bpmndi:BPMNDiagram id="BPMNDiagram_procEnvoiLotTDT">
- <bpmndi:BPMNPlane bpmnElement="procEnvoiLotTDT" id="BPMNPlane_procEnvoiLotTDT">
- <bpmndi:BPMNShape bpmnElement="startiXbus" id="BPMNShape_startiXbus">
- <omgdc:Bounds height="35.0" width="35.0" x="50.0" y="111.0"></omgdc:Bounds>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape bpmnElement="endeventiXbus" id="BPMNShape_endeventiXbus">
- <omgdc:Bounds height="35.0" width="35.0" x="324.0" y="270.0"></omgdc:Bounds>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape bpmnElement="scriptRecevoirAck" id="BPMNShape_scriptRecevoirAck">
- <omgdc:Bounds height="55.0" width="121.0" x="670.0" y="180.0"></omgdc:Bounds>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape bpmnElement="scriptEnvoyer" id="BPMNShape_scriptEnvoyer">
- <omgdc:Bounds height="55.0" width="122.0" x="440.0" y="101.0"></omgdc:Bounds>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape bpmnElement="scriptTest" id="BPMNShape_scriptTest">
- <omgdc:Bounds height="55.0" width="124.0" x="280.0" y="101.0"></omgdc:Bounds>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape bpmnElement="timerRecevoirAck" id="BPMNShape_timerRecevoirAck">
- <omgdc:Bounds height="35.0" width="35.0" x="603.0" y="112.0"></omgdc:Bounds>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape bpmnElement="scriptArchiveAR" id="BPMNShape_scriptArchiveAR">
- <omgdc:Bounds height="55.0" width="121.0" x="440.0" y="260.0"></omgdc:Bounds>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape bpmnElement="scriptGetCmisFolder" id="BPMNShape_scriptGetCmisFolder">
- <omgdc:Bounds height="55.0" width="121.0" x="120.0" y="101.0"></omgdc:Bounds>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge bpmnElement="flow10" id="BPMNEdge_flow10">
- <omgdi:waypoint x="404.0" y="128.0"></omgdi:waypoint>
- <omgdi:waypoint x="440.0" y="128.0"></omgdi:waypoint>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge bpmnElement="flow12" id="BPMNEdge_flow12">
- <omgdi:waypoint x="241.0" y="128.0"></omgdi:waypoint>
- <omgdi:waypoint x="280.0" y="128.0"></omgdi:waypoint>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge bpmnElement="flow19" id="BPMNEdge_flow19">
- <omgdi:waypoint x="562.0" y="128.0"></omgdi:waypoint>
- <omgdi:waypoint x="602.0" y="129.0"></omgdi:waypoint>
- <omgdi:waypoint x="603.0" y="129.0"></omgdi:waypoint>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge bpmnElement="flowRecevoirAck" id="BPMNEdge_flowRecevoirAck">
- <omgdi:waypoint x="638.0" y="129.0"></omgdi:waypoint>
- <omgdi:waypoint x="730.0" y="129.0"></omgdi:waypoint>
- <omgdi:waypoint x="730.0" y="180.0"></omgdi:waypoint>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge bpmnElement="flowTimerRecevoirAck" id="BPMNEdge_flowTimerRecevoirAck">
- <omgdi:waypoint x="670.0" y="207.0"></omgdi:waypoint>
- <omgdi:waypoint x="620.0" y="207.0"></omgdi:waypoint>
- <omgdi:waypoint x="620.0" y="147.0"></omgdi:waypoint>
- <bpmndi:BPMNLabel>
- <omgdc:Bounds height="14.0" width="87.0" x="-96.0" y="-28.0"></omgdc:Bounds>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge bpmnElement="flowEnd" id="BPMNEdge_flowEnd">
- <omgdi:waypoint x="730.0" y="235.0"></omgdi:waypoint>
- <omgdi:waypoint x="730.0" y="287.0"></omgdi:waypoint>
- <omgdi:waypoint x="561.0" y="287.0"></omgdi:waypoint>
- <bpmndi:BPMNLabel>
- <omgdc:Bounds height="14.0" width="66.0" x="-62.0" y="-17.0"></omgdc:Bounds>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge bpmnElement="flow20" id="BPMNEdge_flow20">
- <omgdi:waypoint x="440.0" y="287.0"></omgdi:waypoint>
- <omgdi:waypoint x="359.0" y="287.0"></omgdi:waypoint>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge bpmnElement="flow21" id="BPMNEdge_flow21">
- <omgdi:waypoint x="85.0" y="128.0"></omgdi:waypoint>
- <omgdi:waypoint x="120.0" y="128.0"></omgdi:waypoint>
- </bpmndi:BPMNEdge>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
-</definitions>
\ No newline at end of file