# 1. Check for open model and modeltype # Only run if a model is open AND of type "Business process diagram (BPMN 2.0)" CC "Modeling" GET_ACT_MODEL IF (modelid = -1) { CC "AdoScript" INFOBOX "Please open a model of type Business process diagram (BPMN 2.0)" EXIT } SETL nCurrentBPMNModelID:(modelid) CC "Core" GET_MODEL_INFO modelid:(nCurrentBPMNModelID) #--> RESULT ecode: intValue modelname: strValue ver: strValue version: strValue threadid: id modeltype: strValue libid: id libname: strValue access: Access . IF (modeltype != "Business process diagram (BPMN 2.0)") { CC "AdoScript" INFOBOX "Currently opened model is not of type Business process diagram (BPMN 2.0)" EXIT } # 2. Get all instances of type "Task" CC "Core" GET_ALL_OBJS_OF_CLASSNAME modelid:(nCurrentBPMNModelID) classname:"Task" # --> RESULT ecode: intValue objids: list . SETL lTaskInstances:(objids) # 3. For each task, get all referenced law instances FOR sTaskInstanceID in:(lTaskInstances) { CC "Core" GET_CLASS_ID classname:"Task" #--> RESULT ecode: intValue classid: intValue . SETL nTaskClassID:(classid) CC "Core" GET_ATTR_ID classid:(nTaskClassID) attrname:"Related paragraphs" #--> RESULT ecode: intValue attrid: id . SETL nRelatedParagraphAttrID:(attrid) # FIXME: LOAD PRAGRAPH MODEL!! CC "Core" GET_INTERREF_COUNT objid:(VAL sTaskInstanceID) attrid:(nRelatedParagraphAttrID) #--> RESULT ecode: intValue count: intValue . SETL nCountInterref:(count) SETL sParagraphStatus:"Good" # 4. Update status # Case A: PDF link misses for at least one law -> Task status = UNAVAILABLE # Case B: PDF link has changed -> Task status = CHANGED # Case C: All the same and all PDFs available-> Task status = GOOD FOR nIndex from:0 to:(nCountInterref-1) { CC "Core" GET_INTERREF objid:(VAL sTaskInstanceID) attrid:(nRelatedParagraphAttrID) index:(nIndex) #--> RESULT ecode: intValue tmodeltype: strValue tmodelname: strValue tmodelver: strValue (( type:"modelreference" tmodelid: intValue ( type:"objectreference" tclassname: strValue tobjname: strValue tmodelid: intValue tclassid: intValue tobjid: intValue )) SETL nLawInstanceObjID:(tobjid) CC "Core" GET_ATTR_VAL objid:(nLawInstanceObjID) attrname:("Paragraph Status") IF (val = "Unavailable") { SETL sParagraphStatus:"Unavailable" BREAK } IF (val = "Changed") { SETL sParagraphStatus:"Changed" } } CC "Core" SET_ATTR_VAL objid:(VAL sTaskInstanceID) attrname:("Paragraph Status") val:(sParagraphStatus) }