Author Topic: How to create TOGAF add-in element with script?  (Read 3492 times)

AlexY

  • EA User
  • **
  • Posts: 60
  • Karma: +3/-0
    • View Profile
How to create TOGAF add-in element with script?
« on: June 20, 2011, 10:19:39 pm »
QUESTION: I want the elements created by script to have TOGAF add-in properties. How can I do this? Thanks.
(Background information is below).


I use TOGAF add-in and need to import many elements representing physical application components.

The TOGAF add-in has a special element "PhysicalApplicationComponent" in toolbox intended to represent physical application - see image below..



The element has a set of TOGAF properties defined as tags - see the image below..



When add elements with script:
Code: [Select]
var thePackage as EA.Package;
var elements as EA.Collection;
var element as EA.Element;

thePackage = Repository.GetTreeSelectedPackage();
elements = thePackage.Elements;      
element = elements.AddNew( "Created by script", "Component" );
element.Stereotype = "PhysicalApplicationComponent";


The element created does not have TOGAF properties..



So, how to create an element which will have the TOGAF properties as defined by the TOGAF add-in?


Luis J. Lobo

  • EA User
  • **
  • Posts: 252
  • Karma: +0/-0
  • IT Consultant
    • View Profile
Re: How to create TOGAF add-in element with script
« Reply #1 on: June 20, 2011, 11:51:03 pm »
Change the line:

element = elements.AddNew( "Created by script", "Component" );

to:

element = elements.AddNew( "Created by script", "TOGAF::PhysicalApplicationComponent" );
« Last Edit: June 20, 2011, 11:51:26 pm by Deiser »

AlexY

  • EA User
  • **
  • Posts: 60
  • Karma: +3/-0
    • View Profile
Re: How to create TOGAF add-in element with script
« Reply #2 on: June 21, 2011, 12:56:32 am »
Yes, it worked! Thanks, Luis.