Element Class

An Element is the main modeling unit. It corresponds to (for example) Class, Use Case, Node or Component. You create new elements by adding to the Package Elements collection. Once you have created an element, you can add it to the DiagramObject Class of a diagram to include it in the diagram.

Elements also have a collection of connectors. Each entry in this collection indicates a relationship to another element.

There are also some extended collections for managing addition information about the element, including things such as Tagged Values, Issues, Constraints and Requirements.

Associated table in .EAP file: t_object

Element Attributes

Attribute

Type

Notes

See Also

Abstract

String

Read/Write

Indicates if the element is Abstract (1) or Concrete (0)

 

ActionFlags

String

Read/Write

A structure to hold flags concerned with Action semantics

 

Alias

String

Read/Write

An optional alias for this element

 

AssociationClassConnectorID

Long

Read only

If the element is an AssociationClass, AssociationClassConnectorID contains the Connector ID of the respective Association connector

CreateAssociationClass()

(Information on creating AssociationClasses from elements)

Attributes

Collection

Read only

Collection of Attribute objects for the current element; use the AddNew and Delete functions to manage attributes

 

AttributesEx

Collection

Read only

Collection of Attribute objects belonging to the current element and its parent elements

 

Author

String

Read/Write

The element author

Repository: Authors

BaseClasses

Collection

Read only

List of Base Classes for this element, presented as a collection for convenience

 

ClassfierID

Long

Deprecated

See ClassifierID

 

ClassifierID

Long

Read/Write

The ElementID of a Classifier associated with this element; that is, the base type

Only valid for instance type elements (such as Object or Sequence)

 

ClassifierName

String

Read/Write

Name of associated Classifier (if any)

 

ClassifierType

String

Read only

Type of associated Classifier

 

Complexity

String

Read/Write

A complexity value indicating how complex the element is; used for metric reporting and estimation

Valid values are: 1 for Easy, 2 for Medium, 3 for Difficult

 

CompositeDiagram

Diagram

Read only

If the element is Composite, returns its associated diagram; otherwise returns null

 

Connectors

Collection

Read only

Returns a collection containing the connectors to other elements

 

Constraints

Collection

Read only

Collection of Constraint objects

Constraint Class

ConstraintsEx

Collection

Read only

Collection of Constraint objects belonging to the current element and its parent elements

 

Created

Date

Read/Write

The date the element was created

 

CustomProperties

Collection

Read only

List of advanced properties for an element

The collection of advanced properties differs depending on element type; for example, an Action and an Activity have different advanced properties

Currently only editable from the user interface

 

Diagrams

Collection

Read only

Returns a collection of sub-diagrams (child diagrams) attached to this element as seen in the tree view

 

Difficulty

String

Read/Write

A difficulty level associated with this element for estimation/metrics; only useable for Requirement, Change and Issue element types, otherwise ignored

Valid values are: Low, Medium, High

 

Efforts

Collection

Read only

Collection of Effort objects

Effort Class

ElementGUID

String

Read only

A globally unique ID for this element; that is, unique across all model files

 

ElementID

Long

Read only

The local ID of the Element; valid for this file only

 

Elements

Collection

Read only

Returns a collection of child elements (sub-elements) attached to this element as seen in the tree view

 

EmbeddedElements

Collection

Read only

List of elements that are embedded into this element, such as Ports, Parts, Pins and Parameter Sets

 

EventFlags

String

Read/Write

A structure to hold a variety of flags to do with signals or events

 

ExtensionPoints

String

Read/Write

Optional extension points for a Use Case as a comma-separated list

 

Files

Collection

Read only

Collection of File objects

File Class

GenFile

String

Read/Write

The file associated with this element for code generation and synchronization purposes; can include macro expansion tags for local conversion to full path

 

Genlinks

String

Read/Write

Links to other Classes discovered at code reversing time; Parents and Implements connectors only

 

GenType

String

Read/Write

The code generation type; for example, Java, C++, C#, VBNet, Visual Basic, Delphi

 

Header1

Variant

Read/Write

A user defined string for inclusion as header in the source files generated

 

Header2

Variant

Read/Write

Same as for Header1, but used in the CPP source file

 

IsActive

Boolean

Read/Write

Boolean value indicating whether the element is active or not

1 = True, 0 = False

 

IsComposite

Boolean

Read/Write

Indicates whether the element is composite or not

1 = True, 0 = False

 

IsLeaf

Boolean

Read/Write

Boolean value indicating whether the element is in leaf node or not

1 = True, 0 = False

 

IsNew

Boolean

Read/Write

Boolean value indicating whether the element is new or not

1 = True, 0 = False

 

IsSpec

Boolean

Read/Write

Boolean value indicating whether the element is a specification or not

1 = True, 0 = False

 

Issues

Collection

Read only

Collection of Issue objects

 

Locked

Boolean

Read/Write

Indicates if the element has been locked against further change

 

MetaType

String

Read only

The element's domain-specific meta type, as defined by an applied stereotype from an MDG Technology

 

Methods

Collection

Read only

Collection of Method objects for current element

 

MethodsEx

Collection

Read only

Collection of Method objects belonging to the current element and its parent elements

 

Metrics

Collection

Read only

Collection of Metric elements for current element

 

MiscData

String

Read only

This low-level property provides information about the contents of the PDatax fields

These database fields are not documented, and developers must gain understanding of these fields through their own endeavors to use this property

MiscData is zero based, therefore:

  • MiscData(0) corresponds to PData1
  • MiscData(1) to PData2

and so on

 

Modified

Date

Read/Write

The date the element was last modified

 

Multiplicity

String

Read/Write

Multiplicity value for this element

 

Name

String

Read/Write

The element name; should be unique within the current package

 

Notes

String

Read/Write

Further descriptive text about the element

 

ObjectType

ObjectType

Read only

Distinguishes objects referenced through a Dispatch interface

 

PackageID

Long

Read/Write

A local ID for the package containing this element

 

ParentID

Long

Read/Write

If this element is a child of another, used to set or retrieve the ElementID of the other element; if not, returns 0

 

Partitions

Collection

Read only

List of logical partitions into which an element can be divided

Only valid for elements that support partitions, such as Activities and States

 

Persistence

String

Read/Write

The persistence associated with this element; can be Persistent or Transient

 

Phase

String

Read/Write

The phase this element is scheduled to be constructed in; any string value

 

Priority

String

Read/Write

The priority of this element as compared to other project elements; only applies to Requirement, Change and Issue types, otherwise ignored

Valid values are: Low, Medium and High

 

Properties

Properties

Returns a list of specialized properties that apply to the element that might not be available using the automation model

The properties are purposely undocumented because of their obscure nature and because they are subject to change as progressive enhancements are made to them

 

PropertyType

Long

Read/Write

The ElementID of a Type associated with this element; only valid for Port and Part elements

 

Realizes

Collection

Read only

List of Interfaces realized by this element for convenience

 

Requirements

Collection

Read only

Collection of Requirement objects

Requirement Class

RequirementsEx

Collection

Read only

Collection of Requirement objects belonging to the current element and its parent elements

Requirement Class

Resources

Collection

Read only

Collection of Resource objects for current element

Resource Class

Risks

Collection

Read only

Collection of Risk objects

Risk Class

RunState

String

Read/Write

The object's runstate list as a string

 

Scenarios

Collection

Read only

Collection of Scenario objects for current element

Scenario Class

StateTransitions

Collection

Read only

List of State Transitions that an element can support; applies in particular to Timing elements

 

Status

String

Read/Write

Sets or gets the status, such as Proposed or Approved

 

Stereotype

String

Read/Write

The primary element stereotype; the first of the list of stereotypes you can access using the StereotypeEx attribute

 

StereotypeEx

String

Read/Write

All the applied stereotypes of the element in a comma-separated list

 

StyleEx

String

Read/Write

Advanced style settings; reserved for the use of Sparx Systems

 

Subtype

Long

Read/Write

A numeric subtype that qualifies the Type of the main element; for example:

  • For Event: 0 = Receiver, 1 = Sender
  • For Class: 1 = Parameterised, 2 = Instantiated, 3 = Both, 0 = Neither,
    17 = Association Class

If 17, because an Association Class has been created through the user interface, MiscData(3) contains the ID of the related Association; as MiscData is read-only, you cannot create an Association Class through the Automation Interface

  • For Note: 1 = Note linked to connector, 2 = Constraint linked to connector
  • For StateNode: 100 = ActivityIntitial, 101 = ActivityFinal
  • For Activity: 0 = Activity, 8 = composite Activity (also set to 8 for other composite elements such as Use Cases)
  • For Synchronization: 0 = Horizontal, 1 = Vertical

Note that there are many more Types than indicated in the above examples

Type

Tablespace

String

Read/Write

Associated tablespace for a Table element

 

Tag

String

Read/Write

Corresponds to the Keywords field in the Enterprise Architect user interface

General Settings

TaggedValues

Collection of type TaggedValue

Read only

Returns a collection of TaggedValue objects

TaggedValue Class

TaggedValuesEx

Collection of type TaggedValue

Read only

Returns a collection of TaggedValue objects belonging to the current element and the elements specialized or realized by the current element

TaggedValue Class

Tests

Collection

Read only

Collection of Test objects for current element

Test Class

TreePos

Long

Read/Write

Sets or gets the tree position

 

Type

String

Read/Write

The element type (such as Class, Component)

Note that Type is case sensitive inside Enterprise Architect and should be provided with an initial capital (proper case); valid types are:

 

Action
Activity
ActivityPartition
ActivityRegion
Actor
Artifact
Association
Boundary
Change
Class
Collaboration
Component
Constraint
Decision
DeploymentSpecification
DiagramFrame
EmbeddedElement
Entity
EntryPoint
Event
ExceptionHandler
ExitPoint
ExpansionNode
ExpansionRegion
GUIElement InteractionFragment
 

InteractionOccurrence
InteractionState
Interface
InterruptibleActivityRegion
Issue
Node
Note
Object
Package
Parameter
Part
Port
ProvidedInterface
Report
RequiredInterface
Requirement
Screen
Sequence
State
StateNode
Synchronization
Text
TimeLine
UMLDiagram
UseCase
 

 

Version

String

Read/Write

The version of the element

 

Visibility

String

Read/Write

The Scope of this element within the current package

Valid values are: Public, Private, Protected or Package

 

Element Methods

Method

Type

Notes

See Also

ApplyGroupLock (string aGroupName)

Boolean

Applies a group lock to the element object, for the specified group, on behalf of the current user

Throws an exception if the operation fails; use GetLastError() to retrieve error information

Parameter:

  • aGroupName: String - the name of the user group for which to set the group lock

 

ApplyUserLock ()

Boolean

Applies a user lock to the element object for the current user

Throws an exception if the operation fails; use GetLastError() to retrieve error information

 

CreateAssociationClass (long ConnectorID)

Boolean

Makes this element an AssociationClass of the Association with the provided Connector ID; the return value indicates whether the function succeeded in converting the element to an AssociationClass

AssociationClasses are created only where:

  1. The current element is valid
  2. The current element is a Class
  3. The current element is not already an AssociationClass
  4. The specified connector exists
  5. The specified connector is an Association
  6. The specified connector is not already in an AssociationClass pair
  7. The current element is not at either end of the specified connector

Parameter:

  • ConnectorID: Long - the Connector ID of an Association connector

 

GetLastError ()

String

Returns a string value describing the most recent error that occurred in relation to this object

This function is rarely used as an exception is thrown when an error occurs

 

GetLinkedDocument ()

String

Returns a string value containing the element's linked document contents, in RTF format

If the element contains no linked document, an empty string is returned

 

GetRelationSet (EnumRelationSetType Type)

String

Returns a string containing a comma-separated list of ElementIDs of directly- and indirectly-related elements based on the given type

Recurses using the same relation type on all elements it finds, retrieving all dependencies and sub-dependencies of the current element; for example, Object1 depends on Object2, which depends on Object3, therefore this method returns Object2 and Object3

To obtain only the direct relationships of the element, use the Connector collection instead

EnumRelationSetType

Connector

GetStereotypeList ()

String

Returns a comma-separated list of stereotypes allied to this element

 

IsAssociationClass

Boolean

Returns whether or not the current element is an AssociationClass

 

LoadLinkedDocument (string Filename)

Boolean

Loads the RTF document from the specified file into the element's linked document

Parameter:

  • FileName: String - the name of the file from which to load the RTF document

 

Refresh ()

Void

Refreshes the element features in the Project Browser

Usually called after adding or deleting attributes or methods, when the user interface is required to be updated as well

 

ReleaseUserLock ()

Boolean

Releases a user lock or group lock on the element object

Throws an exception if the operation fails; use GetLastError() to retrieve error information

 

SaveLinkedDocument (string Filename)

Boolean

Saves the linked document for this element to the specified RTF file

Parameter:

  • FileName: String - the name of the RTF file to which to save the linked document

 

SetAppearance (long Scope, long Item, long Value)

Void

Sets the visual appearance of the element

Parameter:

  • Scope: Long - Scope of appearance set to modify
    1 - Base (Default appearance across entire model)
     
    To set appearance for the element (diagram object) in a selected diagram only, see Setting The Style in the DiagramObject Class topic

 

  • Item: Long - Appearance feature to modify
    0 - Background color
    1 - Font Color
    2 - Border Color
    3 - Border Width
  • Value: Long - Value to set appearance to

DiagramObject Class

UnlinkFromAssociation

Boolean

Performs the opposite of CreateAssociationClass()

CreateAssociationClass()

Update ()

Boolean

Update the current element object after modification or appending a new item

If false is returned, check the GetLastError function for more information