Chapter 9 Accessing objects using VBScript
You can access and manipulate PowerDesigner internal objects using Visual Basic Scripting. The scripting lets you access and modify object properties, collections, and methods using the public names of objects.
The PowerDesigner metamodel provides useful information about objects:
Information | Description | Example |
---|---|---|
Public name | The name and code of the metamodel objects are the public names of PowerDesigner internal objects | AssociationLinkSymbol
ClassMapping CubeDimensionAssociation |
Object collections | You can identify the collections of a class by observing the associations linked to this class in the diagram. The role of each association is the name of the collection | In PdBPM, an association exists between classes MessageFormat and MessageFlow. The public name of this association is Format. The role of this association is Usedby which corresponds to the collection of message flows of class MessageFormat |
Object attributes | You can view the attributes of a class together with the attributes this class inherits from other classes via generalization links | In PdCommon, in the Common Instantiable Objects diagram, you can view objects BusinessRule, ExtendedDependency and FileObject with their proper attributes, and the abstract classes from which they inherit attributes via generalization links |
Object operations | Operations in metamodel classes correspond to object methods used in VBS | BaseModel contains operation Compare that can be used in VB scripting |
<<notScriptable>> stereotype | Objects that do not support VB scripting have the <<notScriptable>> stereotype | CheckModelInternalMessage
FileReportItem |
PowerDesigner lets you access the MetaData via VBScript using the MetaModel As BaseObject global property. There is only one instance of the MetaModel and it can be reached from anywhere through the global property Application.MetaModel.
Properties and collections are read-only for all MetaData objects.
The main actions you can perform on MetaData are the following:
To access MetaData objects:
Use the following | Description |
---|---|
MetaModel As BaseObject | Global property. Entry point to access MetaData objects |
To retrieve the MetaModel version:
Use the following | Description |
---|---|
Version As String | Property. Allows you to retrieve the MetaModel version |
To retrieve the available types of MetaClass libraries:
Use the following | Description |
---|---|
MetaLibrary | Collection. Allows you to retrieve the available MetaClass of libraries of a given module |
To access the MetaClass of an object:
Use the following | Description |
---|---|
MetaClass As BaseObject | Property. Provides access to the Metaclass of each object |
To access the MetaClass of an object using its public name (from the MetaModel):
Use the following | Description |
---|---|
GetMetaClassByPublicName (ByVal name As String) As BaseObject | Method. Provides access to the MetaClass of an object using its public name |
To access the MetaAttribute and MetaCollection of a metaclass using its public name (from the MetaClass):
Use the following | Description |
---|---|
GetMetaMemberByPublicName (ByVal name As String) As BaseObject | Method. Provides access to a MetaAttribute or a MetaCollection using its public name |
To retrieve the children of a MetaClass:
Use the following | Description |
---|---|
Children As ObjectSet | Collection. Lists the MetaClasses that inherit from the parent MetaClass |
Copyright (C) 2005. Sybase Inc. All rights reserved. |