Combination View Flat View Tree View
Threads [ Previous | Next ]
InterRef / Model Pointer
1/19/16 10:09 AM

I've got a problem during developing my own BPMN 2.0 Approach.

What I've got:

#(Small Part)
MODELTYPE "Well-formed BPMN 2.0"
plural:"Well-formed BPMN 2.0"
attrrep:"Well-formed AttrRep"
graphrep:"Well-formed GraphRep"
INCL "Sub-Process"

The problem is the sub-process. I want to make more "sexy" and look more like it should look like.

My (important) attributes for Sub-Process:
- The InterRef Attribute
     mt: "Well-formed BPMN 2.0"

- ModelPointer with default-value: "Well-formed BPMN 2.0"
- Enumeration (Yes/No) "Ad-hoc"

-> The "show submodel" functionality works good.

What I need / My idea:
I defined in __ModelTypeMetaData__ an enumeration attribute "Ad-hoc" - default "No". It should not be changed in AttrRep. In GraphRep I just display it for debugging in the background. Works!

But when pressing "show submodel" I want to SET the referenced model  __ModelTypeMetaData__ "Ad-hoc" attribute  with the attribute value from the referring class  (something like a function call?)

There are more Attributes to set for changing the border to dodded-line or show some markers (Ad-hoc, compression, loops).

Is there a way to do so?
Is this a good approach or is there a better way?


RE: InterRef / Model Pointer
1/19/16 11:11 AM as a reply to Swante.
1) Yes, there is a way to do:
In order to adjust attribute values of the Sub-process to the attribute values of the referring "Sub-Process"-instance you can work with event handler. E.g. the event handler "ActivateModel" is always triggered if one model is activated. Therefore if you follow the model pointer of the "Sub-process"-instance this event is triggered as you activate the referenced model. The following AdoScript code ,which is also integrated in the attached library, is an example that reads the value of the "AdHoc" attribute of the "Sub-Process"-instance and edits the value of the referenced process.

 1ON_EVENT "ActivateModelWindow" {
 2#save the pregiven parameters
 3  SET nModelId: (modelid)
 4#get ALL incoming references and assign the result to variables
 5  CC "Core" GET_INCOMING_INTERREFS modelid: (nModelId)
 6  SET nRefCount: (refcount)
 7  SET sRefText: (reftext)
 8#if there is no incoming references than exit the algorithm
 9  IF (nRefCount=0) {
10    EXIT
11  }
13# Parse the above outcome
14  LEO parse: (sRefText) get-int-value:nAttrId:"srcattrid"
15  LEO parse: (sRefText) get-int-value:nObjId:"srcobjid"
16  LEO parse: (sRefText) get-int-value:nRefModelId:"srcmodelid"
17# Get attribute id of the interref "Referenced subprocess"
18  CC "Core" GET_CLASS_ID classname:"Sub-Process"
19  SET nSubProcessClassId: (classid)
20  CC "Core" GET_ATTR_ID classid: (nSubProcessClassId) attrname:"Referenced subprocess"
21  SET nRSp_AttrId: (attrid)
22# If the referencing interref is of type "Referenced subprocess"
23# than read the value of the "Sub-process"-instance and wirte it into the referenced model
24  IF (nAttrId=nRSp_AttrId) {
25# if the model is not opened -> exit
26    CC "Modeling" IS_OPENED modelid: (nRefModelId)
27    SET nIsOpened: (isopened)
28    IF (nIsOpened = 0) {
29      EXIT
30    }
31    CC "Core" GET_ATTR_VAL objid: (nObjId) attrname:"AdHoc"
32    SET sAttrVal: (val)
33    CC "Core" GET_ATTR_ID classid: (nModelId) attrname:"AdHoc"
34    SET nM_AdHoc_AttrId: (attrid)
35    CC "Core" SET_ATTR_VAL objid: (nModelId) attrid: (nM_AdHoc_AttrId) val: (sAttrVal)
36  }

2) Yes this is a good approach.
The question is, if you want to adjust attribute values of two different instances (model, object); "When do you wnat to trigger it?"
- If it should be adjusted after the model is activated than .... see above.
- If you want the adjustment dynamically when the "Sub-Process"-instance-attribute is changed than you can use the events "SetAttributeValue" or "AfterEditAttributeValue". The implementation would be similar as above.

You can find the online AdoScript documentation, where you can find all the events and the Adoscript commands at the following link:

Attachments: Sample_BPMN2-0 Appication Library.abl (4,437.8k)

RE: InterRef / Model Pointer
1/20/16 3:50 PM as a reply to Mehmet Albayrak.
I've tested your suggestion.
It works fine when hust using one sub-process. But when using at least two sub-processing reffering to the same process. Activating one will set it for both sub-processes. Is there a way to embed the reference into a new class with it's own GraphRep? So I need not to modify the attribute in the sub-process directly.

I will try a new way:
Implement a Sub-Process Modeltype. Add "Adhoc" to AttRep und design GraphRep.
Remove Adhoc from AttrRep in the sub-process class. When Reffering to this model just overwrite sub-process-instance attributes to display the correct collapsed attributes (~).

RE: InterRef / Model Pointer
1/21/16 1:03 PM as a reply to Swante.
You can create an attribute of type record and list the values of the attributes in a table. 
Note that, when you use the command "SET_ATTRIBUTE_VAL" the 'objid' is the rowid of the corresponding row. This is obtained as a result of the command "ADD_REC_ROW". Your code would look like:

1CC "Core" ADD_REC_ROW objid: (nObjId) attrid: (nRecAttrId)
2SET nRecRowId: (rowid)
4CC "Core" SET_ATTR_VAL objid: (nRecRowId) attrname: (sColumnName) val: (sAddHocVal)

The rest is similar to the above AdoScript. If you have any difficulties with the implementation please do not hesitate to ask.

RE: InterRef / Model Pointer
2/15/16 6:58 AM as a reply to Swante.
I've done it with:
2EXPR type:string expr:(try(aval (VAL (irtmodels ("Referenced Process")), "Ad-hoc"),"No"))

Works pretty well.