OK, but how to define event handlers for diagrams? I did it few times for classes in the BPM diagrams (directly in the *.xpl files), but here ... do I have to do it somehow in the extension files for the particular diagram types?
It would have to be a kind of CanCreate() handler ... right?
The other issue, once we have the folder structure is, how to prevent users from using wrong diagram elements for wrong purposes ...
Let's say, we have a diagram containing of 3 levels of "boxes".
The very first two levels contains of Architecture Areas, which has been subclasses into: process cluster and process, the third elements in a Business Function with the synonym SubProcess.
The idea, how those elements shall be used in the diagram is this:
1. Process Cluster has to be the first element on the diagram
2. Process must be used only inside of (nested in) the Process Cluster
3. SubProcess must be used only inside of (nested in) Process
All synonyms are populated to metaclass status.
So finally only such a constellation is possible:
What I want to achieve now, is to develop a custom check (OnCreate() event?), preventing the user creating f.e. a Process Cluster directly on the diagram, or creating a SubProcess directly in the Process Cluster.
I have started with a simple CanCreate(parent) function, same as for the BPM diagrams, but most probably, because of the differences in the meta-tree between EA and BPM, I can't simply use the CanCreate() function to check for the parent, as the parent is not as I would expect for SubProcess_1 the Process_1, but SubProcess_1 parent is ... the diagram itself.
Event Handler:
Function %CanCreate%(parent)
' Implement your creation validation rule on <parent> here
' and return True in case of success
output "Stereotype : " + parent.Stereotype
output "Name : " + parent.Name
output "MetaClass : " + parent.MetaClass
%CanCreate% = False
End Function
Outcome:
Stereotype :
Name : L1 (Secondary) Process Cluster Map_12 <- diagram name
MetaClass : Metaclass 'Enterprise Architecture Model'
And finally the question: how to derive the parent for SubProcess_1?
Maybe my understanding, of how it should work is wrong, but in the BPM using the CanCreate() event, I can prevent the user f.e. from creating a Signal Start Event on the first level of Swimlanes ... etc. So the parent is really, what I can find in the meta-tree for the particular language definition.