前页 | 后页 |
Element Class
An Element is the main modeling unit, corresponding to (for example) a 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 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 properties such as Tagged Values, Issues, Constraints and Requirements.
Associated table in repository
t_object
Element Attributes
Attribute |
Remarks |
See also |
---|---|---|
Abstract |
String Notes: Read/Write Indicates if the element is Abstract (1) or Concrete (0). |
|
ActionFlags |
String Notes: Read/Write A structure to hold flags concerned with Action semantics. |
|
Alias |
String Notes: Read/Write An optional alias for this element. |
|
AssociationClassConnectorID |
Long Notes: Read only If the element is an AssociationClass, AssociationClassConnectorID contains the Connector ID of the respective Association connector. |
Element Class |
Attributes |
Collection Notes: Read only A collection of attribute objects for the current element; use the AddNew and Delete functions to manage attributes. |
Attribute Class Collection Class |
AttributesEx |
Collection Notes: Read only A collection of attribute objects belonging to the current element and its parent elements. |
Attribute Class Collection Class |
Author |
String Notes: Read/Write The element author. |
Repository Class |
BaseClasses |
Collection Notes: Read only A list of Base Classes for this element, presented as a collection for convenience. |
Collection Class |
ClassfierID |
Long Notes: Deprecated See ClassifierID |
|
ClassifierID |
Long Notes: 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 Notes: Read/Write Name of associated Classifier (if any). |
|
ClassifierType |
String Notes: Read only Type of associated Classifier. |
|
Complexity |
String Notes: 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 Notes: Read only If the element is Composite, returns its associated diagram; otherwise returns null. |
Diagram Class |
Connectors |
Collection Notes: Read only Returns a collection containing the connectors to other elements. |
Connector Class Collection Class |
Constraints |
Collection Notes: Read only A collection of Constraint objects. |
Constraint Class Collection Class |
ConstraintsEx |
Collection Notes: Read only Collection of Constraint objects belonging to the current element and its parent elements. |
Constraint Class Collection Class |
Created |
Date Notes: Read/Write The date the element was created. |
|
CustomProperties |
Collection Notes: 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. |
CustomProperties Collection |
Diagrams |
Collection Notes: Read only Returns a collection of sub-diagrams (child diagrams) attached to this element as seen in the tree view. |
Diagram Class Collection Class |
Difficulty |
String Notes: 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 Notes: Read only A collection of Effort objects. |
Effort Class Collection Class |
ElementGUID |
String Notes: Read only A globally unique ID for this element; that is, unique across all model files. |
|
ElementID |
Long Notes: Read only The local ID of the element; valid for this file only. |
|
Elements |
Collection Notes: Read only Returns a collection of child elements (sub-elements) attached to this element as seen in the tree view. |
Collection Class |
EmbeddedElements |
Collection Notes: Read only A list of elements that are embedded into this element, such as Ports, Parts, Pins and Parameter Sets. |
EmbeddedElements Collection |
EventFlags |
String Notes: Read/Write A structure to hold a variety of flags to do with signals or events. |
|
ExtensionPoints |
String Notes: Read/Write Optional extension points for a Use Case as a comma-separated list. |
|
Files |
Collection Notes: Read only A collection of File objects. |
File Class Collection Class |
FQName |
String Notes: Read only The fully-qualified name of the element, consisting of a dot-separated list of names including all parent elements and Packages up to the first namespace root that is encountered. |
|
FQStereotype |
String Notes: Read only The fully-qualified stereotype name in the format "Profile::Stereotype". One or more fully-qualified stereotype names can be assigned to StereotypeEx. |
|
GenFile |
String Notes: 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 Notes: Read/Write Links to other Classes discovered at code reversing time; Parents and Implements connectors only. |
|
GenType |
String Notes: Read/Write The code generation type; for example, Java, C++, C#, VBNet, Visual Basic, Delphi. |
|
Header1 |
Variant Notes: Read/Write A user defined string for inclusion as header in the source files generated. |
|
Header2 |
Variant Notes: Read/Write Same as for Header1, but used in the CPP source file. |
|
IsActive |
Boolean Notes: Read/Write Boolean value indicating whether the element is active or not. 1 = True, 0 = False. |
|
IsComposite |
Boolean Notes: Read/Write Indicates whether the element is composite or not. 1 = True, 0 = False. |
|
IsLeaf |
Boolean Notes: Read/Write Indicates whether or not the element is a leaf node (and therefore cannot be a parent for any other elements). 1 = True, 0 = False. |
|
IsNew |
Boolean Notes: Read/Write Boolean value indicating whether the element is new or not. 1 = True, 0 = False. |
|
IsRoot |
Boolean Notes: Read/Write Indicates whether or not the element is a root node (and therefore cannot be descended from another element). 1 = True, 0 = False. |
|
IsSpec |
Boolean Notes: Read/Write; Note that this attribute is no longer used in UML 2.0 and later releases, and is provided only to support models maintained in releases of UML prior to 2.0. Boolean value indicating whether the element is a specification or not. 1 = True, 0 = False. |
|
Issues |
Collection Notes: Read only Collection of Issue objects. |
Issue (Maintenance) Class Collection Class |
Locked |
Boolean Notes: Read/Write Indicates if the element has been locked against further change. |
|
MetaType |
String Notes: Read only The element's domain-specific meta type, as defined by an applied stereotype from an MDG Technology. |
|
Methods |
Collection Notes: Read only Collection of Method objects for current element. |
Method Class Collection Class |
MethodsEx |
Collection Notes: Read only Collection of Method objects belonging to the current element and its parent elements. |
Method Class Collection Class |
Metrics |
Collection Notes: Read only Collection of Metric elements for current element. |
Metric Class Collection Class |
MiscData |
String Notes: Read only This low-level property provides information about the contents of the PData x 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:
|
|
Modified |
Date Notes: Read/Write The date the element was last modified. |
|
Multiplicity |
String Notes: Read/Write Multiplicity value for this element. |
|
Name |
String Notes: Read/Write The element name; should be unique within the current Package. |
|
Notes |
String Notes: Read/Write Further descriptive text about the element. |
|
ObjectType |
ObjectType Notes: Read only Distinguishes objects referenced through a Dispatch interface. |
ObjectType |
PackageID |
Long Notes: Read/Write A local ID for the Package containing this element. |
|
ParentID |
Long Notes: 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 Notes: 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. |
Partitions Collection |
Persistence |
String Notes: Read/Write The persistence associated with this element; can be Persistent or Transient. |
|
Phase |
String Notes: Read/Write The phase this element is scheduled to be constructed in; any string value. |
|
Priority |
String Notes: 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 Notes: 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. |
Properties Class |
PropertyType |
Long Notes: Read/Write The ElementID of a Type associated with this element; only valid for Port and Part elements. |
|
PropertyTypeName |
String Notes: Read The name of a Type associated with this element; only valid for Port and Part elements. |
|
Realizes |
Collection Notes: Read only List of Interfaces realized by this element for convenience. |
Collection Class |
Requirements |
Collection Notes: Read only Collection of Requirement objects. |
Requirement Class Collection Class |
RequirementsEx |
Collection Notes: Read only Collection of Requirement objects belonging to the current element and its parent elements. |
Requirement Class Collection Class |
Resources |
Collection Notes: Read only Collection of Resource objects for current element. |
Resource Class Collection Class |
Risks |
Collection Notes: Read only Collection of Risk objects. |
Risk Class Collection Class |
RunState |
String Notes: Read/Write The object's runstate list as a string. The string consists of a set of statements in the form: string = '@VAR;Variable=<string>;Value=<string>;Op=<string>;@ENDVAR;' Where: Op = ['=','>','<','>=','<=', '!=','<>'] For example: A set of run states can be created by looping through a set of attributes and forming a concatenated string: eRunState = eRunState + "@VAR;Variable="+ attrib.name + ";Value=" + attrib.value +";Op==;@ENDVAR;"; |
|
Scenarios |
Collection Notes: Read only Collection of Scenario objects for current element. |
Scenario Class Collection Class |
StateTransitions |
Collection Notes: Read only List of State Transitions that an element can support; applies in particular to Timing elements. |
Collection Class Transitions Collection |
Status |
String Notes: Read/Write Sets or gets the status, such as Proposed or Approved. |
|
Stereotype |
String Notes: Read/Write The primary element stereotype; the first of the list of stereotypes you can access using the 'StereotypeEx' attribute. When setting this attribute, LastError (for the GetLastError method) will be non-empty if an error occurs. |
|
StereotypeEx |
String Notes: Read/Write All the applied stereotypes of the element in a comma-separated list. Reading the value will provide the stereotype name only; assigning the value accepts either fully-qualified or simple names. When setting this attribute, LastError (for the GetLastError method) will be non-empty if an error occurs. |
|
StyleEx |
String Notes: Read/Write Advanced style settings; reserved for the use of Sparx Systems. |
|
Subtype |
Long Notes: Read/Write A numeric subtype that qualifies the Type of the main element
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.
Note that there are many more Types than indicated in these examples. |
Element Class |
Tablespace |
String Notes: Read/Write Associated tablespace for a Table element. |
|
Tag |
String Notes: Read/Write Corresponds to the 'Keywords' field in the Enterprise Architect user interface. |
General Settings |
TaggedValues |
Collection Notes: Read only Returns a collection of TaggedValue objects. |
TaggedValue Class Collection Class |
TaggedValuesEx |
Collection Notes: 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 Collection Class |
TemplateParameters |
Collection Notes: Read Only A collection of TemplateParameter objects. |
Parameterized Classes (Templates) TemplateParameter Class Collection Class |
Tests |
Collection Notes: Read only A collection of Test objects for the current element. |
Test Class Collection Class |
TreePos |
Long Notes: Read/Write Sets or gets the tree position. |
|
Type |
String Notes: 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:
|
|
TypeInfoProperties |
Notes: Read only Returns an interface pointer of TypeInfoProperties. |
TypeInfoProperties Class |
Version |
String Notes: Read/Write The version of the element. |
|
Visibility |
String Notes: Read/Write The Scope of this element within the current Package. Valid values are: Public, Private, Protected or Package. |
Element Methods
Method |
Remarks |
See also |
---|---|---|
ApplyGroupLock(string aGroupName) |
Boolean Notes: Applies a group lock to the element object, for the specified group, on behalf of the current user. Returns True if the operation is successful; returns False if the operation is unsuccessful. Use 'GetLastError()' to retrieve error information. Parameters:
|
|
ApplyUserLock() |
Boolean Notes: Applies a user lock to the element object for the current user. Returns True if the operation is successful; returns False if the operation is unsuccessful. Use 'GetLastError()' to retrieve error information. |
|
Clone () |
LDISPATCH Notes: Inserts a copy of the selected element under the same parent as the selected element. Returns the newly-created element. |
|
CreateAssociationClass(long ConnectorID) |
Boolean Notes: 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:
Parameters:
|
Element Class |
DeleteLinkedDocument() |
Boolean Notes: Removes the Linked Document for the element. This method does not display a confirmatory prompt. Returns True if a document was deleted. |
Replace or Delete Linked Documents |
GetBusinessRules() |
String Notes: Read Only. Returns all the Business Rules for the element. |
Model Business Rules |
GetChart |
LDISPATCH Notes: For chart elements returns an interface to the chart |
|
GetDecisionTable() |
String Notes: Provides read-only access to a Decision Table XML string. Returns the XML data for the Decision Table as a string. |
Decision Table Editor |
GetElementGrid() |
String Notes: Returns an object of type ElementGrid (a Custom Table Artifact element). |
|
GetLastError() |
String Notes: Returns a string value describing the most recent error that occurred in relation to this object. |
|
GetLinkedDocument() |
String Notes: Returns a string value containing the element's Linked Document contents, in Rich Text Format. If the element contains no Linked Document, an empty string is returned. |
Edit Linked Documents |
GetRelationSet(EnumRelationSetType Type) |
String Notes: 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 Package |
GetStereotypeList() |
String Notes: Returns a comma-separated list of stereotypes allied to this element. |
|
GetTXAlias (string Code, long Flag) |
String Notes: Returns the Alias of the element for a given language. Parameters
|
Translate Page |
GetTXName (string Code, long Flag) |
String Notes: Returns the name of the element for a given language. Parameters
|
Translate Page |
GetTXNote (string Code, long Flag) |
String Returns the Notes of the element for a given language. Parameters
|
Translate Page |
HasStereotype(string Stereotype) |
Boolean Notes: Returns true if the current element has the specified stereotype applied to it. Accepts either qualified or unqualified stereotype names; for example, 'block' or 'SysML1.3::block'. Parameters:
|
|
IsAssociationClass |
Boolean Notes: Returns whether or not the current element is an AssociationClass. |
|
LoadLinkedDocument(string Filename) |
Boolean Notes: Loads the document from the specified file into the element's Linked Document. Parameters:
|
Create Linked Document on an Element |
Refresh() |
Void Notes: Refreshes the element features in the Browser window. Usually called after adding or deleting attributes or methods, when the user interface is required to be updated as well. |
|
ReleaseUserLock() |
Boolean Notes: Releases a user lock or group lock on the element object. Returns True if the operation is successful; returns False if the operation is unsuccessful. Use GetLastError() to retrieve error information. |
|
SaveLinkedDocument(string Filename) |
Boolean Notes: Saves the Linked Document for this element to the specified file. Returns False if the element does not have a Linked document or fails to save the file. Parameters:
|
Edit Linked Documents |
SetAppearance(long Scope, long Item, long Value) |
Void Notes: Sets the visual appearance of the element. Parameters:
|
DiagramObject Class |
SetCompositeDiagram() |
Boolean Notes: Sets the composite diagram of the element. Parameters:
|
Composite Elements |
SetCreated(Date NewVal) |
Void Notes: Deprecated This method is no longer supported. |
|
SetModified(Date NewVal) |
Void Notes: Deprecated This method is no longer supported. |
|
SetTXAlias (string Code, string Translation) |
String Notes - Set the translated Alias of the element for a given language.
|
Translate Page |
SetTXName (string Code, string Translation) |
String Notes - Set the translated name of the element for a given language.
|
Translate Page |
SetTXNote (string Code, string Translation) |
String Notes - Set the translated Notes of the element for a given language.
|
Translate Page |
SynchConstraints(string Profile, string Stereotype) |
Boolean Notes: Synchronizes the constraints of a UML Profile item for this element, only if the specified stereotype has been applied. Parameters:
|
|
SynchTaggedValues(string Profile, string Stereotype) |
Boolean Notes: Synchronizes the Tagged Values of a UML Profile item for this element, only if the specified stereotype has been applied. Parameters:
|
|
UnlinkFromAssociation |
Boolean Notes: Performs the opposite of CreateAssociationClass(). |
Element Class |
Update() |
Boolean Notes: Updates the current element object after modification or appending a new item. If False is returned, check the 'GetLastError()' function for more information. |