Book a Demo

Author Topic: Identify between technology type in elements  (Read 7290 times)

Arshad

  • EA User
  • **
  • Posts: 292
  • Karma: +21/-1
    • View Profile
Identify between technology type in elements
« on: August 11, 2015, 05:37:44 pm »
Hi

If i have both the  BPMN1.0 Activity  and BPMN2.0 Activity elements in EA , how to identify whether the activity is from BPMN1.0 or BPMN2.0  using c#.
Is there any default API calls there to identify it..?  :-/  :-/

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Identify between technology type in elements
« Reply #1 on: August 11, 2015, 06:09:17 pm »
IIRC you shall have activated either MDG and not both in one repository.

q.

Arshad

  • EA User
  • **
  • Posts: 292
  • Karma: +21/-1
    • View Profile
Re: Identify between technology type in elements
« Reply #2 on: August 11, 2015, 06:12:45 pm »
Thanks for the reply and yes i have activated both the BPMN 1 and 2 technology in EA and have created activity in both the technologies.But i need find what technology its refers from c# (ie) outside of EA i need to identify the technology of bothe the element. is it possible..?

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Identify between technology type in elements
« Reply #3 on: August 11, 2015, 08:57:40 pm »
Hi Arshad,


If you open the properties dialog, you can see which profile was used to create the element by looking at the tagged value sections on the left. There's one called "Tagged Values", which contains tagged values which do not derive from any profile. Tagged values which do derive from a profile will be grouped in a separate node of the same name, so there will be a node called either "BPMN", "BPMN1.1" or "BPMN2.0". So that's how you can do it in the GUI.

In the database, the obscure magic table t_xref contains this information. The following search will show you the profiles:
Code: [Select]
select t_object.ea_guid as CLASSGUID, t_object.Object_Type as CLASSTYPE, t_object.Name, t_xref.Description
from t_object, t_xref
where t_object.Stereotype = 'Activity'
and t_xref.Client = t_object.ea_guid
and t_xref.Description like '@STEREO%'
(Note that you may need to replace the wildcard character '%' in the last clause depending on the DB engine.) So that's how you can do it in SQL.

To my knowledge the t_xref table is not accessible through the Element class in the API. But in this specific case you're dealing with BPMN Activities, so there's a way out.

The Element.CustomProperties collection is used by EA to store various things, including the default composite diagram type, which you can use to retrieve the profile.

This simple VBScript browser script lists an element's custom properties.
Code: [Select]
option explicit

!INC Local Scripts.EAConstants-VBScript

sub OnProjectBrowserScript()
    dim treeSelectedType
    treeSelectedType = Repository.GetTreeSelectedItemType()
    Repository.EnsureOutputVisible "Script"
    
    select case treeSelectedType
        case otElement
            dim theElement as EA.Element
            set theElement = Repository.GetTreeSelectedObject()
            dim i
            for i = 0 to theElement.CustomProperties.Count - 1
                Session.Output theElement.CustomProperties(i).Name & ":  " & theElement.CustomProperties(i).Value
            next
        case else
            Session.Prompt "This script does not support items of this type.", promptOK
    end select
end sub

OnProjectBrowserScript
Run that on any BPMN Activity or BusinessProcess and you'll see that they include the property "_defaultDiagramType" with the value "BPMN::BPMN", "BPMN1.1::BPMN", etc (and there may be other useful properties as well).

You can easily scan for the different BPMN versions in these properties.

HTH,


/Uffe
« Last Edit: August 11, 2015, 11:08:19 pm by Uffe »
My theories are always correct, just apply them to the right reality.