Erwin API Ref
Erwin API Ref
This documentation may not be copied, transferred, reproduced, disclosed or duplicated, in whole or in part,
without the prior written consent of CA. This documentation is proprietary information of CA and protected by the
copyright laws of the United States and international treaties.
Notwithstanding the foregoing, licensed users may print a reasonable number of copies of this documentation for
their own internal use, provided that all CA copyright notices and legends are affixed to each reproduced copy.
Only authorized employees, consultants, or agents of the user who are bound by the confidentiality provisions of
the license for the software are permitted to have access to such copies.
This right to print copies is limited to the period during which the license for the product remains in full force and
effect. Should the license terminate for any reason, it shall be the user’s responsibility to return to CA the
reproduced copies or to certify to CA that same have been destroyed.
To the extent permitted by applicable law, CA provides this documentation “as is” without warranty of any kind,
including without limitation, any implied warranties of merchantability, fitness for a particular purpose or
noninfringement. In no event will CA be liable to the end user or any third party for any loss or damage, direct or
indirect, from the use of this documentation, including without limitation, lost profits, business interruption,
goodwill, or lost data, even if CA is expressly advised of such loss or damage.
The use of any product referenced in this documentation and this documentation is governed by the end user’s
applicable license agreement.
Provided with “Restricted Rights” as set forth in 48 C.F.R. Section 12.212, 48 C.F.R. Sections 52.227-19(c)(1) and
(2) or DFARS Section 252.227-7013(c)(1)(ii) or applicable successor provisions.
Chapter 1: Introduction
Major Features ............................................................................... 1-1
Typical Use Cases............................................................................. 1-2
Standalone Client ......................................................................... 1-3
Add-in Component or Script ............................................................... 1-4
Contents iii
Chapter 3: API Tasks
Getting Started ................................................................................ 3-1
API Environment .......................................................................... 3-1
Creating the ISCApplication Object ......................................................... 3-2
Application Properties ......................................................................... 3-3
ISCApplication Interface ................................................................... 3-3
ISCApplicationEnvironment ................................................................ 3-4
Accessing a Model ............................................................................ 3-7
Using the API as an Add-in Tool ............................................................ 3-7
ISCApplication Interface ............................................................... 3-8
ISCPersistenceUnitCollection Interface ................................................... 3-8
ISCPersistenceUnit Interface ............................................................ 3-9
ISCPropertyBag Interface .............................................................. 3-11
Using the API as a Standalone Executable ................................................... 3-13
Creating a Model ......................................................................... 3-14
ISCPersistenceUnitCollection Interface .................................................. 3-14
ISCPropertyBag Interface .............................................................. 3-15
Opening an Existing Model ................................................................ 3-16
ISCPersistenceUnitCollection Interface .................................................. 3-16
Opening a Session ........................................................................ 3-17
ISCSessionCollection Interface ......................................................... 3-17
ISCSession Interface................................................................... 3-18
Accessing a Model Set .................................................................... 3-19
ISCPersistenceUnit Interface ........................................................... 3-19
ISCModelSet Interface ................................................................. 3-20
ISCModelSetCollection Interface ....................................................... 3-20
ISCSession Interface................................................................... 3-21
Accessing Objects in a Model .................................................................. 3-23
Interfaces Used to Access Model Objects .................................................... 3-23
ISCSession Interface................................................................... 3-23
ISCModelObjectCollection Interface .................................................... 3-23
ISCModelObject Interface.............................................................. 3-24
Accessing a Specific Object ................................................................ 3-27
ISCModelObjectCollection Interface .................................................... 3-27
Filtering Object Collections ................................................................ 3-28
ISCModelObjectCollection Interface .................................................... 3-28
Object Type Filter ..................................................................... 3-30
Depth Filter .......................................................................... 3-30
MustBeOn/MustBeOff Filter ........................................................... 3-31
Contents v
Accessing Metamodel Information ............................................................. 3-58
ISCApplicationEnvironment Interface ...................................................... 3-59
ISCSession Interface ...................................................................... 3-60
Closing the API .............................................................................. 3-62
Closing the Session ....................................................................... 3-62
ISCSession Interface................................................................... 3-62
ISCSessionCollection Interface ......................................................... 3-62
Clearing Persistence Units ................................................................. 3-63
ISCPersistenceUnitCollection Interface .................................................. 3-64
Error Handling............................................................................... 3-65
ISCApplicationEnvironment ............................................................... 3-66
Advanced Tasks ............................................................................. 3-69
Creating User-Defined Properties .......................................................... 3-69
History Tracking ......................................................................... 3-73
ISCSession Interface................................................................... 3-73
Contents vii
ISCPropertyValue ....................................................................... A-59
ISCPropertyValue::ValueId Arguments ................................................ A-60
ISCPropertyValue::Value Arguments .................................................. A-61
ISCPropertyValueCollection .............................................................. A-62
ISCPropertyValueCollection::Item Arguments .......................................... A-62
ISCSession .............................................................................. A-63
ISCSession::BeginNamedTransaction Arguments ....................................... A-65
ISCSession::CommitTransaction Arguments ............................................ A-66
ISCSession::IsTransactionEmpty Arguments............................................ A-66
ISCSession::Open Arguments ......................................................... A-67
ISCSession::RollbackTransaction Arguments ........................................... A-68
ISCSessionCollection..................................................................... A-68
ISCSessionCollection::Item Arguments................................................. A-69
ISCSessionCollection::Remove Arguments ............................................. A-69
Enumerations ............................................................................... A-70
SC_ModelDirectoryFlags ................................................................. A-70
SC_ModelDirectoryType ................................................................. A-70
SC_ModelObjectFlags .................................................................... A-70
SC_ModelPropertyFlags ................................................................. A-71
SC_SessionFlags ......................................................................... A-72
SC_SessionLevel......................................................................... A-72
SC_ValueTypes ......................................................................... A-72
Property Bag Reference ...................................................................... A-74
Property Bag for Application Environment................................................. A-74
ISCApplicationEnvironment::PropertyBag ............................................. A-74
Category Parameter Contains an Empty String ......................................... A-75
Application Category ................................................................ A-75
[Link] Category ............................................................ A-76
[Link] Category .................................................... A-76
[Link] Category ................................................ A-77
[Link] Category ....................................................... A-80
[Link] Category ............................................... A-80
[Link] Category...................................................... A-80
[Link] Category ........................................... A-80
[Link].................................................... A-81
Property Bag for Model Directory and Model Directory Unit ................................ A-81
Property Bag for Persistence Units and Persistence Unit Collections .......................... A-85
ISCPersistenceUnit::PropertyBag Arguments (Get Function) ............................. A-86
ISCPersistenceUnit::PropertyBag Arguments (Set Function).............................. A-86
Property Bag Contents for Persistence Unit and Persistence Unit Collection ............... A-87
Property Bag for Session ................................................................. A-90
Index
Contents ix
Chapter
Introduction
1
The Script Client API that is part of AllFusion® ERwin® Data Modeler (hereafter
referred to as AllFusion ERwin DM) provides advanced customization
capabilities that enable you to access and manipulate modeling data in AllFusion
ERwin DM memory at runtime, as well as models persisted in files and in the
AllFusion® Model Manager repository. The AllFusion ERwin DM API interfaces
are automation-compatible and provide extensive design and runtime facilities
for third-party integrators as well as users of script-based environments.
The AllFusion ERwin DM API enables you to complement the original modeling
tool with custom components when you use scripts, add-ins, and COM-based
API technologies. Because of its flexibility, the AllFusion ERwin DM API
promotes the seamless integration of the modeling tool in a client development
cycle.
Major Features
The AllFusion ERwin DM API is essentially a group of interfaces that include the
following functionality:
■ Active Model Data Objects (AMDO)—Allows a third-party client to access
model data through a COM automation-compatible API. This feature is the
major component in the AllFusion ERwin DM API functionality. All
interfaces that comprise the AllFusion ERwin DM API are automation-based,
and are therefore dual. These dual interfaces allow you faster access to
methods and properties. Using dual interfaces, you can directly call the
functions without using an Invoke() function.
■ Collections and enumerators—Facilitates programming constructions in
script languages that target the AMDO automation features.
■ Connection points—Supporting the sync event facilities of languages, the
AllFusion ERwin DM API delivers a collection of connection points interfaces
and support for the ITypeInfo2 interface.
■ Automation-rich error handling—The AllFusion ERwin DM API supports
automation-rich error handling through IErrorInfo interfaces exposed by the
AllFusion ERwin DM API components.
Introduction 1–1
Typical Use Cases
Many users of the AllFusion ERwin DM API are automation and script-based
clients. These clients have very specific interface design requirements imposed
by COM automation standards. For instance, they are often limited to a single
incoming and outgoing interface exposed by any particular COM object. This
limitation is due to the fact that the only recognizable interface type for pure
automation is IDispatch and it renders the use of QueryInterface functionality
unfit. The common technique to address the problem includes Alternate
Identities and read-only properties that expose secondary interfaces.
Standalone Client
There can be times when AllFusion ERwin DM API clients compete with other
parties over access to model data. Using AllFusion Model Manager provides
advanced model sharing facilities to prevent other parties from accessing the
model during your session.
Introduction 1–3
Typical Use Cases
You can observe changes in a model on the screen and can activate a pause to
investigate the state of a model by accessing the modeling tool user interface.
API Components
2
This chapter describes the AllFusion ERwin DM API components.
Overview
The AllFusion ERwin DM API is a collection of interfaces that represent
AllFusion ERwin DM functionality. The application exports the top-level
interface, from which the client obtains lower-level interfaces as needed.
Interfaces are logically grouped into tiers, where each tier includes interfaces that
represent the functionality of the application. Each tier is represented in the
following sections, with a table describing the interfaces grouped into that tier.
Application Tier
Interface Role
ISCApplication Represents application-wide
functionality, and serves as the entry
point for the interface hierarchy of the
AllFusion ERwin DM API. Holds a list
of available persistence units and
connections between the client and
persistence units.
ISCApplicationEnvironment Provides information about the
runtime environment.
ISCApplicationServiceCollection Provides access to a variety of
application services, such as Forward
Engineering, Reverse Engineering,
Complete Compare, and so on.
Interface Role
ISCPersistenceUnitCollection Collects all active persistence units
known to the application.
ISCPersistenceUnit Represents an active persistence unit
(such as an AllFusion ERwin DM
model) within the application. A
persistence unit groups data in the
form of model sets. Clients can connect
to persistence units to manipulate them
and the data they contain.
ISCModelSetCollection Represents model sets associated with
a persistence unit.
ISCModelSet Represents a model set (such as EMX or
EM2 classes of model data) within a
single persistence unit.
ISCPropertyBag Represents an array of properties for
application tier interface calls.
Has Provides
1 1
<<Interface>> <<Interface>>
ISCPersistenceUnitCollection ISCApplicationServicesCollection
Employs
1
Consists of
0..*
<<Interface>> Top 1 <<Interface>>
ISCPersistenceUnit ISCModelSet
0..*
Consists of Owns
1
1 <<Interface>>
ISCModelSetCollection
The Model Directory Tier accesses and manipulates the persistence storage
directories, such as a file system directory or an AllFusion Model Manager
directory. The following table describes the interfaces of the Model Directory
Tier:
Interface Role
ISCModelDirectoryCollection Enumerates all top-level model
directories available for the AllFusion
ERwin DM API client.
ISCModelDirectory Encapsulates information on a single
model directory entry.
ISCModelDirectoryUnit Encapsulates information on a single
directory unit.
Has 1
Consists of
0..*
<<Interface>>
ISCModelDirectory
Lists
0..*
<<Interface>> Describes <<Interface>>
ISCPersistenceUnit ISCModelDirectoryUnit
(from Application Tier)
1 1
Sessions Tier
The Sessions Tier establishes access to model data in memory. The following
table describes the interfaces of the Sessions Tier:
Interface Role
ISCSessionCollection Collects all active sessions between the
AllFusion ERwin DM API client and
the persistence units.
ISCSession Represents an active connection
between the client and a model. Clients
create sessions, and then open them
against model sets of persistence units.
An open session exposes a single level
(such as data, metadata, and so on) of a
model set.
Consists Of
0..*
<<Interface>>
ISCSession
0..*
Accesses
1
<<Interface>>
ISCPersistenceUnit
(from Application Tier)
The Model Data Tier accesses and manipulates model data. The following table
describes the interfaces of the Model Data Tier:
Interface Role
ISCModelObjectCollection Represents objects available for
manipulation. Membership in this
collection can be limited by
establishing filter criteria.
ISCModelObject Accesses and manipulates a single
object within a model.
ISCModelPropertyCollection Represents a list of properties owned
by a single object. The list can be
limited by using filters.
ISCModelProperty Accesses and manipulates a single
property. Note that properties may
contain multiple values. Values within
a multi-valued property are accessed
by keys. The current multi-valued
property implementation treats the
value list as an array, and the key is the
array index.
ISCPropertyValueCollection Represents a list of single property
values.
ISCPropertyValue Data and a key are contained within a
single value.
<<Interface>> Accesses
ISCSession
(from Sessions Tier)
1
<<Interface>>
ISCModelObjectCollection
0..*
Produces
Consists Of
Owned By
0..*
<<Interface>> Has 0..* <<Interface>>
ISCModelObject ISCModelPropertyCollection
1
Consists Of
0..*
<<Interface>> Has <<Interface>>
ISCPropertyValueCollection ISCModelProperty
Consists Of
0..*
<<Interface>>
ISCPropertyValue
The API clients access the model data by constructing a session and connecting it
to a model set using the Session component. A model set contains several levels
of data. It contains the data the application manipulates, such as entity instances,
attribute instances, or relationship instances.
The model set also contains metadata: a description of the objects and properties
that may occur within the application’s data. In AllFusion ERwin DM, metadata
includes object and property classes, object aggregations, and property
associations. The metadata defines each object class that may occur within a
model, for example, an entity class, an attribute class, or a relationship class.
Object aggregations identify an ownership relationship between classes of
objects. For example, a model owns entities, entities own attributes, and so on.
The property associations define property usage by object classes. For instance,
the metadata includes property associations for every object class that has the
Name property.
Clients specify the necessary level of model data at the same time as connecting a
session to a model set.
When a new model is created it acquires a set of default objects, such as model
object, main subject area, and stored display.
Levels are identified by long integer values. Values have symbolic definitions.
Object Identifiers
The AllFusion ERwin DM API presents data in object/property form. In an
AllFusion ERwin DM model, for example, an attribute is represented by an
instance of an attribute object. The name of the attribute is contained in the Name
property of the attribute object.
Each object must bear an identifier—a value that uniquely identifies the object
instance. Internally, object identifiers are 20 bytes long. They contain two
components: a GUID (also known as a UUID) in the first 16 bytes, and a 32-bit
unsigned integer suffix in the last 4 bytes.
The following table lists aliases used in this guide and in the interface definitions:
Consider the relationship between object instances in the SCD_SL_ M0 layer and
object instances in the SCD_SL_ M1 layer. An instance in the SCD_SL_ M0 layer
is described by an instance in the SCD_SL_ M1 layer. For instance, a single object
in the SCD_SL_ M1 layer describes every entity instance in the SCD_SL_ M0
layer.
Since all type codes are also object identifiers, they must have the same format.
IDispatch IEnumVARIANT
Collection Enumerator
_NewEnum Property
Create
Created
Create OK
Reset Next
Reset Next
Next End
BeforeStart In List At End
Delete
Delete Delete
Deleted
When the iterator is created, it enters the Created state. It then forces itself into the
BeforeStart state. A successful advance drives the iterator into the InList state,
while an unsuccessful advance drives it into the AtEnd state. A Reset drives the
iterator back to the BeforeStart state, and deletion drives it into the Deleted state.
The iterator is positioned over a member of the collection (that is, is associated
with a current member) if and only if it is in the InList state.
Default Properties
For automation, a default property is the property that is accessed when the
object is referred to without any explicit property or method call. The property
dispatch identifier is DISPID_VALUE.
Optional Parameter
If you run the Custom Setup type of installation, select ERwin API Sample Client
when prompted to select the program features you want to install. After
installation, you can access the two sample Visual Basic 6.0 projects from the
Sample Client subdirectory. The path is AllFusion ERwin Data Modeler
r7\Samples\ERwin API\Sample Client.
This section describes how to utilize the AllFusion ERwin DM API sample client
as a standalone version and as an add-in component.
The Models menu shows in-memory models that are currently open. You can use
the upper part of the menu to access model data, and you can use the lower part
to access the metamodel information associated with the model.
When the sequence is executed, a new menu item is created in the AllFusion
ERwin DM Tools menu under Add-Ins. The name of the item matches the text
that was typed in Name field of the Add New Menu Item dialog, which in this
case is AddIn Sample. You can select this new menu item to activate the add-in
sample component. The Models menu of the add-in shows the models opened in
AllFusion ERwin DM.
ERwin Spy
The ERwin Spy application visualizes metadata information and provides
intrinsic and model-specific metadata. It demonstrates the API functionality and
provides a set of useful features to study how AllFusion ERwin DM stores model
data. ERwin Spy reads the AllFusion ERwin DM metamodel and simplifies the
task of comprehending the intricate details of any AllFusion ERwin DM model,
which can be a complicated net of model objects, properties, and
cross-references. When you install AllFusion ERwin DM, you can choose to
install the optional ERwin Spy utility.
There are two versions of the utility available in the ERwin Spy folder:
■ Standalone version—[Link]
■ Add-in version—ERwinSpy_AddIn.[Link]
These versions are identical in functionality and vary only in how you wish to
launch the application. The standalone version runs without AllFusion ERwin
DM present and can access models stored in .erwin files, while the add-in
version launches within AllFusion ERwin DM from the Tools menu and can
access models in AllFusion ERwin DM memory and .erwin files.
To see how ERwin Spy can help you visualize metadata information, do the
following:
■ Start with an empty logical-physical model.
■ Run ERwin Spy by selecting it from the Tools/Add-Ins menu.
■ In ERwin Spy, select the top item from the Models menu, which should be
your empty model.
■ The left panel of ERwin Spy is the Objects list. Double-click the Model object
to expand it. You should see a picture similar to the following:
As you can see, there are quite a number of objects listed by ERwin Spy. Even
though the model is empty, you will still see objects there that represent
AllFusion ERwin DM defaults, such as Domains, Main Subject Area, Trigger
Templates, and so on. All default objects are marked with a { Default; } flag to the
right of the type of the model object.
The right panel of ERwin Spy displays object properties. To see a specific object’s
properties, select the object, click the button located in the center of the screen,
and the selected object’s properties display in the right panel. The following
graphic shows the properties of a specific entity that was added to this model:
The first column shows property names, such as Name, Long ID, Type, Physical
Name, and so on.
The second column, DT, shows property datatypes, such as Str for a string, I4 for
a number, Bool for Boolean, Id for a reference to another object, and so on.
The third column, Value, displays the property value in native format.
The rest of the columns in the right panel represent property flags. You may have
to scroll to the right in order to see them. The following describes the meaning of
these columns:
■ NL—Properties with NULL/no value (the flag is never on for ERwin Spy)
■ UD—User-defined properties
■ VC—Vector properties
■ TL—Properties that are maintained by AllFusion ERwin DM and that cannot
be changed directly using the API
■ RO—Read-only properties
■ DR—Derived properties whose value was inherited (from a parent domain,
for instance)
■ OP—Property is optional and can be removed
In the previous graphic, we had added a primary key attribute named ATTR01
to Entity_1. It was migrated to Entity_2 by creating an identifying relationship.
To see how ERwin Spy displays the information, double-click Entity_2, and then
select ATTR01. Click the button in the center of the screen to view its properties
on the right.
One point of interest is the Parent Relationship property. Since the attribute is a
product of foreign-key migration, this property shows which relationship object
is used to store data about it. The value Id in the DT column shows that the
property is a reference, which just means that the value is a unique ID of the
involved relationship object.
In order to traverse back to the relationship object, look at the name in the As
String column or locate an object by its unique ID. In order to see objects IDs,
enable this option by selecting Show Ids from the File/Options menu. With this
option enabled, when the cursor is positioned over an object in the left panel, that
object’s unique ID is displayed in a popup window.
Now, compare the Parent Relationship property with the Parent Attribute Ref
and the Master Attribute properties. Note that the Master Attribute property is
read-only. This means that it is displayed for informational purposes only and
cannot be changed using the API. As you build your model, you can expand
objects in the model to see how AllFusion ERwin DM uses their properties to
represent different relationships in the model.
Take advantage of the ERwin Spy utility to see and understand the details of the
data in an AllFusion ERwin DM model that is available through the API. If you
need to learn how particular data is represented in an AllFusion ERwin DM
model, you can use the scenarios that were just described. Start with an empty
model, create the minimum model that is necessary to represent the feature in
question, and then use ERwin Spy to look at the details of the data
representation.
API Tasks
3
This chapter describes how to perform basic tasks using the AllFusion ERwin
DM API. Each task is documented with a table that lists the interfaces and
methods needed for that task. In most cases, the table shows a subset of all the
methods for the given interface. For a complete list of API interfaces and their
respective methods, see the appendix “API Interfaces Reference.”
Getting Started
This section describes what you need to begin using the AllFusion ERwin DM
API.
API Environment
The API is packaged as a set of COM Dynamic Link Libraries (DLL) and works
as a part of a customer process. [Link] is responsible for launching the API
environment. When AllFusion ERwin DM is installed, [Link] and the rest of the
API components are copied to the Binaries directory, (a subdirectory of the
install directory) and the installer registers the API with the System Registry.
To use the API in a development environment, use the API Type Library
embedded as a resource in the [Link] file. This operation is language specific.
Consult your development environment documentation for details.
The AllFusion ERwin DM API works in two different modes: standalone mode
and add-in mode. In the standalone mode, the API is activated and controlled by
a client application that hosts its own process.
In the add-in mode, the API is also activated and controlled by a client
application, but the client application is implemented as a COM DLL. The
AllFusion ERwin DM executable owns a process and all the client application
DLLs run inside of that process. To be available for the add-in mode activation,
COM DLLs must be registered with the System Registry and with the AllFusion
ERwin DM Add-In Manager.
Behavior of the API components in both modes is the same with a few
exceptions that are discussed further in this section.
The entry point into the interface hierarchy of the API is through the
ISCApplication interface. The ISCApplication interface provides access to the
persistence units and sessions. You must create an instance of ISCApplication
prior to using any of the other interfaces in the API.
ISCApplicationPtr scAppPtr;
HRESULT hr;
hr = [Link](__uuidof(SCAPI::Application));
Application Properties
You can get information about the AllFusion ERwin DM application by using the
following tables.
ISCApplication Interface
ISCApplicationEnvironment
If the Category parameter is not set, then the Property Bag property returns the
complete set of all the features from all the available categories.
The following examples illustrate how to use the API to retrieve the Application
Features. The examples use the Application object created in Example 1 shown
previously:
Example 2
Next Idx
End If
End Sub
Accessing a Model
An API client accesses model data by working with a pool of available
persistence units. A persistence unit is the API concept that describes all data
related to a single model. A persistence unit can be accessed and saved to
persistence storage, such as a file or an AllFusion Model Manager model. A
client manipulates persistence units by using the Persistence Units collection.
Similarly, when the client program is terminated, the arrangement for the
persistence units in memory is as follows:
■ Standalone mode—All units are closed.
■ Add-in component—After the client program has ended, the units are still
open and available in the AllFusion ERwin DM user interface with the
exception of those that were explicitly closed and removed from the
persistence unit collection before exiting the program.
Note: For AllFusion ERwin DM, the collection is a snapshot. The collection
includes only those units that exist at the moment of collection construction
(such as at the moment when the PersistenceUnits method of the ISCApplication
interface was called). An exception to this is units added or deleted from the
collection—these changes are reflected. All new collections reflect the changes as
well.
When the API client is a DLL that is invoked by selecting Add-Ins from the
AllFusion ERwin DM Tools menu, the client runs within the environment of
AllFusion ERwin DM. As a result, all the models that are currently open within
AllFusion ERwin DM are populated in the PersistenceUnits property of the
ISCApplication interface, when an instance of the interface is created.
To iterate through the models that are currently open in AllFusion ERwin DM,
you can use the ISCApplication interface, ISCPersistenceUnitCollection interface,
and the ISCPersistenceUnit interface, which are described in the sections that
follow.
ISCApplication Interface
ISCPersistenceUnitCollection Interface
ISCPersistenceUnit Interface
The following table shows some property names and descriptions for property
bag members of an existing persistence unit. Note: For the complete set of
available properties, see the appendix, “API Interfaces Reference.”
ISCPropertyBag Interface
The following examples illustrate how to use the API as an add-in tool to iterate
through the open models. The examples use the Application object created in
Example 1 previously:
Example 3
ISCPersistenceUnitPtr scPUnit = 0;
long lCnt = scPUnitColPtr->GetCount();
scPersistenceUnitCol = [Link]
propBag = [Link]("Locator")
[Link]( [Link] ) ' name of model
[Link]( [Link](0)) ' full path of model
' …
Next
End If
End Sub
When the API client is a standalone executable, the client runs outside the
AllFusion ERwin DM environment. As a result, when the ISCApplication
interface is created, the PersistenceUnits property is an empty collection. Even if
AllFusion ERwin DM is running and there are open models, the PersistenceUnits
property is still empty because the API environment is independent of the
AllFusion ERwin DM environment. To get a valid persistence unit, the API client
needs to either create a new model or open an existing model.
Creating a Model
To create a new model using the API, you first need to create a new instance of
ISCPropertyBag. The ISCPropertyBag interface is a property bag that is used to
hold the properties of the new model. The following properties are used in
creating a new model.
Note: For the complete set of properties, see the appendix “API Interfaces
Reference.”
type is provided)
■ 2—Physical (for physical models)
Target Server Long Sets the target database properties for physical and
Target Server Version logical/physical models.
Target Server Minor Version For more details, see the appendix “API Interfaces
Reference.”
Once the property bag is created and populated, a new persistence unit must be
created within the persistence unit collection.
ISCPersistenceUnitCollection Interface
ISCPropertyBag Interface
The following examples illustrate how to create a new persistence unit. The
examples use the Application object created in Example 1 previously:
Example 4
ISCPropertyBagPtr propBag;
HRESULT hr =[Link](__uuidof(SCAPI::PropertyBag));
if (FAILED(hr))
return;
propBag->Add("Name", “Test Model”);
propBag->Add("ModelType", “Logical”);
ISCPersistenceUnitPtr scPUnitPtr = scPUnitColPtr->Create(propBag,vtMissing);
return scPUnitPtr;
}
ISCPersistenceUnitCollection Interface
The following examples illustrate how to open an existing model. The examples
use the Application object created in Example 1 previously:
Example 5
OpenModel = [Link](fullModelPath)
End Sub
Opening a Session
Before the objects of a model can be accessed using the API, an ISCSession
instance must first be established for the ISCPersistenceUnit of the model. To
open a session for a persistence unit, add a new ISCSession to the
ISCSessionCollection, and then open the ISCPersistenceUnit in the new session.
ISCSessionCollection Interface
ISCSession Interface
The following examples illustrate how to open a session. The examples use the
Application object created in Example 1 and the CreateNewModel function from
Example 4:
Example 6
A persistence unit contains data as a group of linked model sets. The model sets
are arranged in a tree-like hierarchy with a single model set at the top.
The top model set in a persistence unit contains the bulk of modeling data. The
AllFusion ERwin DM API uses the abbreviation EMX to identify the top model
set.
The EMX model set owns a secondary model set, abbreviated as EM2, that
contains user options and user interface settings.
The ISCSession interface allows you to open the top model set by simply
providing a pointer to the ISCPersistenceUnit interface in ISCSession::Open call.
It is possible to iterate over all model sets constituting a persistence unit. While
iterating, a pointer to the ISCModelSet interface can be used to open a session
with the particular model set. This is done by submitting the pointer to
ISCSession::Open call as the first parameter, instead of a persistence unit.
ISCPersistenceUnit Interface
ISCModelSet Interface
ISCModelSetCollection Interface
ISCSession Interface
The following examples illustrate how to open a session with the EM2 model of
a persistence unit. The examples use the Application object created in Example 1
and the CreateNewModel function from Example 4:
Example 7
GetItem(COleVariant("EM2"));
if (scEM2ModelPtr != NULL)
{
ISCSessionPtr scSessionPtr = scSessionColPtr->Add(); // add a new session
CComVariant varResult = scSessionPtr->Open(scEM2ModelSetPtr);
if ([Link] == VT_BOOL && [Link] == FALSE)
return;
// …
}
scSessionCol = [Link]
scPUnit = CreateNewModel(scApp) ‘ From Example 4
The following sections describe the interfaces used to access model objects.
ISCSession Interface
ISCModelObjectCollection Interface
ISCModelObject Interface
The following examples illustrate how to access model objects. The examples use
the Application object created in Example 1 and the OpenSession function from
Example 6:
Example 8
ISCModelObjectCollection Interface
The following examples illustrate how to access a specific object. The examples
use a Session object from Example 6:
Example 9
Visual Basic .NET Public Sub GetObject(ByRef scSession As [Link], ByRef objID As String)
Dim scObjCol as [Link]
Dim scObj as [Link]
scObjCol = [Link]
scObj = [Link](objID) ' retrieves object with given object ID
End Sub
ISCModelObjectCollection Interface
VARIANT ClassId [optional], represents a subcollection pointer of the root object. Returns the
VARIANT Depth [optional], of itself. descendants of the given object.
■ VT_BSTR—The Object ID of the root
VARIANT MustBeOn The method creates a valid
[optional], VARIANT object. Returns the descendants of the
collection even though the
MustBeOff [optional]) object with the given object identifier.
collection may be empty.
ClassId:
■ VT_ARRAY|VT_BSTR—SAFEARRAY
SCD_MOF_DONT_CARE.
MustBeOff:
■ VT_I4 —Returns the descendants of the
SCD_MOF_DONT_CARE.
The following sections show the code examples for the different filters.
The following examples illustrate the Object Type filter. The examples use the
Session object from Example 6 and create a collection of objects of csType type,
owned by the rootObj object:
Example 10
End Sub
Depth Filter
End Sub
MustBeOn/MustBeOff Filter
End Sub
Iteration of Properties
This section describes the interfaces involved with the iteration of properties.
ISCModelObject Interface
ISCModelPropertyCollection Interface
ISCModelProperty Interface
The following examples illustrate the iteration of properties. The examples use a
Model Object object from Example 9:
Example 13
_NewEnum = propColPtr->Get_NewEnum();
if (_NewEnum != NULL)
{
HRESULT hr = _NewEnum->QueryInterface(IID_IEnumVARIANT, (LPVOID*)
&propCollection);
if (!FAILED(hr))
{
COleVariant xObject;
while (S_OK == propCollection->Next(1,&xObject,NULL))
{
ISCModelPropertyPtr scObjPropPtr = (V_DISPATCH (&xObject));
[Link]();
if ([Link]())
{
CString csPropName = (LPSTR) scObjPropPtr->GetClassName();
CString csPropVal= (LPSTR) scObjPropPtr->FormatAsString();
// …
}
} // property iteration
}
if (propCollection)
propCollection->Release();
}
}
End Sub
The type of a property can be recognized by reviewing the property flags. Scalar
properties have a SCD_MPF_SCALAR flag.
For more information about specific property flags, see the section Enumerations
in the appendix “API Interfaces Reference.”
A property, either scalar or non-scalar, can have a special NULL value. The
properties with a NULL value have a SCD_MPF_NULL flag set.
ISCModelProperty Interface
The following examples illustrate how to access scalar property values. The
examples use a Model Property object from Example 13:
Example 14
End Sub
ISCModelProperty Interface
ISCPropertyValueCollection Interface
ISCPropertyValue Interface
SCVT_DEFAULT
—If the property is
non-scalar, the
value of the
property index is
returned.
■ Empty—Defaults to
SCVT_DEFAULT.
SC_CLSID PropertyClassId() Returns the class None
identifier of the current
property
BSTR PropertyClassName() Returns the class name None
of the current property
The following examples illustrate how to access non-scalar property values. The
examples use a Model Property object from Example 13:
Example 15
// …
}
}
}
For non-scalar properties, you can directly access individual values by using the
Item method of ISCPropertyValueCollection.
ISCPropertyValueCollection Interface
Note: For r7, AllFusion ERwin DM does not support naming of non-scalar
property members.
C++ // This function retrieves a specific value with the given index from the
property with the
// given name.
ISCPropertyValuePtr GetPropValue(ISCModelObjectPtr & scObjPtr, CString & csName,
int index)
{
ISCModelPropertyCollectionPtr propColPtr = scObjPtr->GetProperties();
ISCModelPropertyPtr scObjPropPtr = propColPtr->GetItem(COleVariant(csName));
ISCPropertyValueCollectionPtr propVals = scObjPropPtr->GetPropertyValues();
return propVals->GetItem(COleVariant(index));
}
Visual Basic .NET ' This function retrieves a specific value with the given index from the property
with the
' given name.
Public Function GetPropValue(ByRef scObj As [Link], ByRef propName As
String, _
index As Integer) As [Link]
End Function
Filtering Properties
ISCModelObject Interface
Note: Setting certain filter criteria can influence the effectiveness of data
retrieving. For example, setting the MustBeOn filter to SCD_MPF_DERIVED
builds a collection with only the calculated and derived properties. Requests to
evaluate the calculated and derived properties will reduce performance while
iterating over the collection. However, setting the MustBeOff filter to the same
value, SCD_MPF_DERIVED, which excludes the calculated and derived
properties, improves performance.
The following examples illustrate how to filter properties. The examples use a
Model Object object from Example 9:
Example 17
ISCModelPropertyCollectionPtr propColPtr;
VARIANT valFlags;
V_VT(&valFlags) = VT_I4;
V_I4(&valFlags) = SCD_MPF_SCALAR;
Note: In r7, the nested transactions and rollbacks are supported with certain
limitations. The limitation is illustrated in the following state diagram:
Data Modification
Data Modification
I II
Begin
Inner Transaction
Commit Inner Transaction
After the beginning of an outer transaction, the API is in State I of the diagram. A
new nested transaction can be opened or the outer transaction can be closed.
Any operation other than the open or close of a transaction, such as creating,
modifying objects, properties, and so on, will transfer the API to State II. In that
state further modifications can continue, but no new nested transactions are
allowed. The API continues to be in that state until the current transaction is
committed or rolled back.
Use of nested transactions allows better control over modification flow. The
following describes a few examples:
Rollback A rollback of the outer transaction cancels out the results of all nested
transactions, even the ones that were committed before the rollback.
Begin Transaction
ISCSession Interface
The following examples illustrate modifying the model using the Begin
Transaction. The examples use a Session object from Example 6:
Example 18
void OpenSession(ISCSessionPtr & scSessionPtr )
C++ {
variant_t transactionId; // transaction ID for the session
VariantInit(&transactionId);
transactionId = scSessionPtr->BeginTransaction();
// …
}
Commit Transaction
ISCSession Interface
The following examples illustrate modifying the model using the Commit
Transaction. The examples use a Session object from Example 6:
Example 19
VariantInit(&transactionId);
transactionId = scSessionPtr->BeginTransaction();
scSessionPtr->CommitTransaction(transactionId);
}
scTransactionId = [Link]
[Link]( scTransactionId )
End Sub
Creating Objects
The first step in creating a new object is to retrieve the ISCModelObject instance
of the parent of the new object. From the parent of the new object, retrieve its
child objects in an instance of ISCModelObjectCollection. You then need to add
the new object to the child objects collection. For information on valid object class
names and object class identifiers, see the appendix “AllFusion ERwin DM
Metamodel.”
The following section describes the interfaces used when you create a new model
object.
ISCModelObjectCollection Interface
of an object.
Depth:
■ VT_I4—Set depth to 1 when obtaining the
of an object.
MustBeOff:
■ Empty—Not needed when obtaining the children
of an object.
The following examples illustrate how to create objects. The examples use a
Session object from Example 6:
Example 20
VariantInit(&transactionId);
transactionId = scSessionPtr->BeginTransaction();
transactionID = [Link]
scChildObjCol = [Link](parentObj, , 1) ' child
objects collection
scObj = [Link](type) ' add new object to the child object
collection
[Link]( transactionID )
End Sub
The valid VARIANT types that can be used to set a scalar property value is
dependent on the type of the property. For information, see the appendix
“AllFusion ERwin DM Metamodel.”
ISCModelProperty Interface
The following examples illustrate how to set scalar property values. The
examples use a Model Object object from Example 9 and assumes that a
transaction has opened:
Example 21
Visual Basic .NET ' NOTE: ISCSession::BeginTransaction() must be called prior to calling this
function
' ISCSession::CommitTransaction() must be called upon returning from this
function
Public Sub SetScalarPropValue(ByRef scObj As [Link], ByRef val As
Variant)
Dim modelProp As [Link]
modelProp = [Link](“Name”)
[Link] = val
End Sub
To set a non-scalar property value, you must identify the specific value that you
want to set. This is done through the ValueId parameter. The ValueId can either
be the zero-based index of the property value collection or the name of the
member if the property is a structure.
Note: For r7, AllFusion ERwin DM does not support naming non-scalar
property members.
ISCModelProperty Interface
The following examples illustrate how to set non-scalar property values. The
examples use a Model Object object from Example 9 and assumes that a
transaction has opened:
Example 22
Visual Basic .NET ' NOTE: ISCSession::BeginTransaction() must be called prior to calling this
function
' ISCSession::CommitTransaction() must be called upon returning from this
function
Public Sub SetScalarPropValue(ByRef scObj As [Link], ByRef val As
Variant)
Dim modelProp As [Link]
modelProp = [Link](“Name”)
Dim index As Long
Index = 0 ‘ Setting index to zero
[Link](index) = val ' index is used to access non-scalar property
End Sub
Deleting Objects
You can delete an object by removing the ISCModelObject interface instance of
the object from the instance of ISCModelObjectCollection. You identify the object
that you want to delete either by its pointer to the interface or by its object
identifier.
The following section describes the interface used to delete model objects.
ISCModelObjectCollection Interface
The following examples illustrate how to delete objects if there is a model objects
collection and that a transaction has opened:
Example 23
The following sections describe the interfaces used to delete model properties
and model property values.
ISCModelPropertyCollection Interface
ISCModelProperty Interface
To remove all the values from a non-scalar property, remove the property itself
from the ISCModelPropertyCollection using the Remove method. To remove a
specific value from a non-scalar property, use the RemoveValue method of the
ISCModelProperty interface. As with accessing the non-scalar property values,
the property value is identified using the ValueId parameter. ValueId can either
be the zero-based index of the value, or the name of the member if the property
type is a structure.
Note: For r7, AllFusion ERwin DM does not support naming non-scalar
property members.
ISCPersistenceUnit Interface
The following examples illustrate how to save a model. The examples use a
Persistence Unit object from Example 5:
Example 26
There is a special case for the intrinsic metamodel. To obtain the intrinsic
metamodel for a specific class of metadata, you can use the Property Bag
component created with the PropertyBag method of the
ISCApplicationEnvironment interface. A Property Bag instance populated with
EMX Metadata Class or EM2 Metadata Class properties from the Application
category indicates the type of the intrinsic metamodel to access. The instance
must be submitted as the first parameter in an ISCSession::Open call, instead of
ISCPersistenceUnit or ISCModelSet pointers. If the first parameter in an
ISCSession::Open call is NULL, then the intrinsic metamodel for the top model
set in a persistence unit, the EMX class metadata, will be accessed.
To indicate that a session will access metamodel information, you set the Level
parameter of the Open method to SCD_SL_M1.
ISCApplicationEnvironment Interface
ISCSession Interface
model set.
Level:
■ SCD_SL_M1—Metadata access.
Flags:
■ Empty—Defaults to SCD_SF_NONE.
ISCSession Interface
ISCSessionCollection Interface
The following examples illustrate how to close a session. It assumes that there is
a Session object and the session is open. The examples use an Application object
from Example 1:
Example 28
ISCPersistenceUnitCollection Interface
The following examples illustrate how to clear persistence units. It assumes that
there is an Application object from Example 1:
Example 29
Error Handling
The AllFusion ERwin DM API uses a generic COM error object to handle errors.
Depending on the programming environment, languages have their own
protocols to retrieve errors from the generic error object. For example, C++ and
Visual Basic .NET use exception handling to handle errors. To ensure a stable
application, it is recommended that API clients use error handling to trap
potential errors such as attempting to access an object that was deleted, or
attempting to access an empty collection.
Visual Basic .NET Public Sub GetObject(ByRef scSession As [Link], ByRef objID As String)
Dim scObjCol as [Link]
Dim scObj as [Link]
Try
scObjCol = [Link]
scObj = [Link](objID) ' retrieves object with given object ID
Catch ex As Exception
' Failed
[Link](" API Failed With Error message :" + [Link]())
End Try
End Sub
In addition to the generic error object, the API provides an extended error
handling mechanism with the Application Environment Message log. The
message log can handle a sequence of messages that is especially useful in a
context of complex operations like transactions.
For details on the Application Environment Message log organization, see the
section Property Bag for Application Environment in the appendix “API
Interfaces Reference.”
ISCApplicationEnvironment
The following examples illustrate how to use the API to check messages from the
API extended message log. It assumes that there is an Application object from
Example 1:
Example 32
long numErrors = 0;
VARIANT vValue = pArray[0]; // number of errors
if ([Link] == VT_I4)
numErrors = [Link];
// …
SafeArrayUnaccessData([Link]);
}
}
}
End If
End Sub
Advanced Tasks
The material in this section provides examples of some specific advanced tasks
and how they can be executed.
The structure of the UDP definition is similar to the definition of all native
properties. The following diagram shows the metamodel objects involved when
you define a UDP:
Property Type
+Name
+Data type : long = String
+Is Locally Defined : bool = True
+Definition
+IsLogical
Object Type +IsPhysical
+Name +Udp_Default_Value
+Udp_Datatype
+Udp_Owner_Type
+Udp_Values_List
* +Valid Properties
1 1
In this diagram an instance of the Property Type object defines a UDP class, the
Object Type object defines an object class with which the UDP is associated, and
the Association Type object defines the association between object and property
classes.
You are only required to create an instance of the Property Type object to define
a UDP. AllFusion ERwin DM populates the rest of the necessary data. The
following table describes the properties and tags of the Property Type object:
The following example illustrates how to use the API to define a UDP:
Example 33
' Start a session on the metadata level with the top (EMX) model set from
the model
[Link](oPU, SCAPI.SC_SessionLevel.SCD_SL_M1)
End Sub
History Tracking
AllFusion ERwin DM can save historical information for your model, entities,
attributes, tables, and columns. AllFusion ERwin DM uses History objects to
store the information in the model.
ISCSession Interface
The following table describes the properties used in creating a new model:
Note: For the complete set of properties, see the appendix “API Interfaces
Reference.”
The following example illustrates how to mark history records for entities and
attributes as API events, and how to mark history records with the API History
Tracking description:
Example 34
oSession = [Link]
[Link](oPU)
oEntity = [Link]("Entity")
oAttribute = [Link](oEntity).Add("Attribute")
[Link]("Name").Value = "Attr A"
' Commit
[Link](nTransId)
End Sub
You can select the history options for the model objects for which you want to
preserve history, as well as to control the type of events to track. This is done
within the History Options tab in the Model Properties dialog. For more
information on this procedure, see the section Preserve Model History in the
chapter “Working with Design Layers” in the AllFusion ERwin DM Getting
Started guide.
If the checkbox for API events is cleared (unchecked), then no historic events
from the API category are recorded. It is possible to control the status of that
checkbox, as well as the checkboxes for model object types from the API, by
controlling the value of properties in the model where the status of these
checkboxes is stored.
API Interfaces
This section describes each AllFusion ERwin DM API interface, and the methods
associated with them. Where applicable, signatures and valid arguments are also
described.
ISCApplication
The ISCApplication interface is the entry point for the API client. Only one
instance of the component can be externally instantiated to activate the AllFusion
ERwin DM API. The client navigates the interface hierarchy by using interface
properties and methods to gain access to the rest of the AllFusion ERwin DM
API functionality.
The following table contains the methods for the ISCApplication interface:
Method Description
BSTR ApiVersion() The API version
ISCApplicationEnvironment * Reports attributes of runtime
ApplicationEnvironment() environment and available features,
such as add-in mode, user interface
visibility, and so on
Method Description
ISCApplicationServiceCollection * Provides access to a variety of
ApplicationServices() application services, such as Forward
Engineering, Reverse Engineering,
Complete Compare, and so on. Not
available in the current version of
AllFusion ERwin DM API.
ISCModelDirectoryCollection * Collects model directories accessible
ModelDirectories() from the current machine
BSTR Name() Modeling tool application name
ISCPersistenceUnitCollection * Returns a collection of all persistence
PersistenceUnits() units loaded in the application
ISCSessionCollection * Sessions() Returns a collection of sessions created
within the application
BSTR Version() Modeling tool application version
ISCApplicationEnvironment
Method Description
ISCPropertyBag * Populates a property bag with one or
PropertyBag(VARIANT Category more property values as indicated by
[optional], Category and Name.
VARIANT Name [optional], VARIANT
See Application Environment Property
AsString [optional])
Bag section for details.
ISCApplicationEnvironment::PropertyBag Arguments
The following table contains the valid arguments for the PropertyBag function:
ISCModelDirectory
The following table contains the methods for the ISCModelDirectory interface:
Method Description
VARIANT_BOOL CopyDirectory(BSTR Source, Recursively copies one or more model directories
BSTR Destination, VARIANT Disposition [optional], from one location to another.
VARIANT Overwrite [optional])
VARIANT_BOOL CopyDirectoryUnit(BSTR Source, Copies one or more model directory units from
BSTR Destination, VARIANT Disposition [optional], one location to another.
VARIANT Overwrite [optional])
VARIANT_BOOL CreateDirectory( BSTR Name) Creates a model directory.
VARIANT_BOOL DeleteDirectory( BSTR Locator, Deletes the specified model directories and their
VARIANT Force [optional]) contents.
VARIANT_BOOL DeleteDirectoryUnit( BSTR Deletes specified model directory units.
Locator, VARIANT Force [optional])
VARIANT_BOOL DirectoryExists( BSTR Locator) Returns TRUE if a specified directory exists.
VARIANT_BOOL DirectoryUnitExists( BSTR Returns TRUE if a specified directory unit exists.
Locator)
SC_ModelDirectoryFlags Flags() Model Directory flags. A 32-bit property flag
word.
VARIANT_BOOL IsOfType( ISCModelDirectory * Returns TRUE if Directory has the same type of
Directory) connection as self.
For example, directory entries from the same mart
and with the same login attributes, such as user,
password, and so on, are considered of the same
type.
ISCModelDirectory * LocateDirectory (BSTR Locator, Starts enumeration over the directory sub-entries.
VARIANT Filter [optional])
ISCModelDirectory * LocateDirectoryNext() Locates the next sub-entry in the directory
enumeration. Returns a NULL pointer if no more
model directory entries can be found.
ISCModelDirectoryUnit * LocateDirectoryUnit (BSTR Starts enumeration over the directory units.
Locator, VARIANT Filter [optional])
Method Description
ISCModelDirectoryUnit * Locates the next unit in the directory enumeration.
LocateDirectoryUnitNext()
BSTR Locator() Location of the directory including the absolute
path and parameters. Does not include password
information.
VARIANT_BOOL MoveDirectory( BSTR Source, Recursively moves one or more directories from
BSTR Destination, VARIANT Disposition [optional], one location to another.
VARIANT Overwrite [optional])
VARIANT_BOOL MoveDirectoryUnit( BSTR Source, Moves one or more model directory units from
BSTR Destination, VARIANT Disposition [optional], one location to another.
VARIANT Overwrite [optional])
BSTR Name() Model Directory name. For example, the file
system directory name without path information.
ISCPropertyBag* PropertyBag( VARIANT List Returns a pointer on a property bag with the
[optional], VARIANT AsString [optional]) directory properties.
Note: A directory property is present in the
resulting bag only if it has a value. If the property
does not have any value set, the property bag will
not have the property listed.
void PropertyBag( VARIANT List [optional], Accepts a pointer on a property bag with the
VARIANT AsString [optional], ISCPropertyBag* directory properties.
Property Bag)
SC_ModelDirectoryType Type() Type of a directory.
ISCModelDirectory::CopyDirectory Arguments
The following table contains the valid arguments for the CopyDirectory function:
ISCModelDirectory::CopyDirectoryUnit Arguments
The following table contains the valid arguments for the CopyDirectoryUnit
function:
ISCModelDirectory::CreateDirectory Arguments
The following table contains the valid arguments for the CreateDirectory
function:
ISCModelDirectory::DeleteDirectory Arguments
The following table contains the valid arguments for the DeleteDirectory
function:
ISCModelDirectory::DeleteDirectoryUnit Arguments
The following table contains the valid arguments for the DeleteDirectoryUnit
function:
ISCModelDirectory::DirectoryExists Arguments
The following table contains the valid arguments for the DirectoryExists
function:
ISCModelDirectory::DirectoryUnitExists Arguments
The following table contains the valid arguments for the DirectoryUnitExists
function:
ISCModelDirectory::IsOfType Arguments
The following table contains the valid arguments for the IsOfType function:
ISCModelDirectory::LocateDirectory Arguments
The following table contains the valid arguments for the LocateDirectory
function:
ISCModelDirectory::LocateDirectoryUnit Arguments
The following table contains the valid arguments for the LocateDirectoryUnit
function:
ISCModelDirectory::MoveDirectory Arguments
The following table contains the valid arguments for the MoveDirectory
function:
ISCModelDirectory::MoveDirectoryUnit Arguments
The following table contains the valid arguments for the MoveDirectory
function:
The following table contains the valid arguments for the PropertyBag (Get)
function:
The following table contains the valid arguments for the PropertyBag (Set)
function:
ISCModelDirectoryCollection
The Model Directory Collection lists all top-level Model Directories available
including the one made available with the application user interface. A client can
register new Model Directories with this collection.
Method Description
IUnknown _NewEnum() Constructs an instance of the collection
enumerator object.
ISCModelDirectory * Add(BSTR Adds a new top-level directory on the
Locator, VARIANT Disposition list of available directories.
[optional])
VARIANT_BOOL Clear() Removes all the top-level directories
from a collection and disconnects the
directories from associated marts.
long Count() The number of ModelDirectory
components in the collection.
Method Description
ISCModelObject * Item(long nIndex) Returns an IUnknown interface pointer
identified by its ordered position.
VARIANT_BOOL Remove(VARIANT Removes a top-level directory from the
Selector, list of available directories.
VARIANT_BOOL Disconnect
[optional])
ISCModelDirectoryCollection::Add Arguments
The following table contains the valid arguments for the Add function:
ISCModelDirectoryCollection::Item Arguments
The following table contains the valid arguments for the Item function:
ISCModelDirectoryCollection::Remove Arguments
The following table contains the valid arguments for the Remove function:
ISCModelDirectoryUnit
Method Description
SC_ModelDirectoryFlags Flags() Model directory unit flags. A 32-bit
property flag word.
For information on Model Directory
flags, see the Enumerations section in
this appendix.
VARIANT_BOOL IsOfType( Returns TRUE if directory has the
ISCModelDirectory * Directory) same type of connection as self.
For example, directory entries from
the same mart and with the same
login attributes, such as user,
password, and so on, are considered
of the same type.
BSTR Locator() Location of the directory unit
including the absolute path and
parameters. Does not include
password information.
Method Description
BSTR Name() Model directory unit name. For
example, the file system file name
without path information.
ISCPropertyBag* PropertyBag( Returns a pointer on a property bag
VARIANT List [optional], VARIANT with the directory unit properties.
AsString [optional])
Note: A directory unit property is
present in the resulting bag only if it
has a value. If the property does not
have any value set, the property bag
will not have the property listed.
void PropertyBag( VARIANT List Accepts a pointer on a property bag
[optional], VARIANT AsString with the directory unit properties.
[optional], ISCPropertyBag* Property
Bag)
SC_ModelDirectoryType Type() Type of a directory.
ISCModelDirectoryUnit::IsOfType Arguments
The following table contains the valid arguments for the IsOfType function:
The following table contains the valid arguments for the PropertyBag (Get)
function:
The following table contains the valid arguments for the PropertyBag (Set)
function:
ISCModelObject
The following table contains the methods for the ISCModelObject interface:
Method Description
SC_ModelObjectFlags Flags() Returns the flags of the object.
For information on
SC_ModelObjectFlags, see the
Enumerations section in this appendix.
SC_CLSID ClassId() Returns the class identifier of the
current object.
BSTR ClassName() Returns the class name of the current
object.
Method Description
ISCModelPropertyCollection * Returns a property collection of the
CollectProperties(VARIANT ClassIds type that you want. This method
[optional], VARIANT MustBeOn always returns a valid collection even if
[optional], VARIANT MustBeOff the collection is empty.
[optional])
ISCModelObject * Context() Passes back the context (parent) of the
object in the model’s object tree. Passes
back NULL if the current object is the
tree root.
VARIANT_BOOL Returns TRUE if self is an instance of
IsInstanceOf(VARIANT ClassId) the passed class. This method respects
inheritance. If ClassId contains an
ancestor class, the method returns
TRUE.
VARIANT_BOOL IsValid() Returns TRUE if self is valid. This
method is used to detect if the
referenced object is deleted.
BSTR Name() Returns the name or a string identifier
of the current object.
SC_OBJID ObjectId() Uniquely identifies the current object.
ISCModelPropertyCollection * Returns a property collection of all
Properties() available properties.
ISCModelObject::CollectProperties Arguments
The following table contains the valid arguments for the CollectProperties
function:
ISCModelObject::IsInstanceOf Arguments
The following table contains the valid arguments for the IsInstanceOf function:
ISCModelObjectCollection
Method Description
IUnknown _NewEnum() Constructs an instance of the collection
enumerator object.
ISCModelObject * Add(VARIANT Adds an object of type Class to the
Class, VARIANT ObjectId) model.
Method Description
SC_CLSID * ClassIds() Returns a SAFEARRAY of class
identifiers (such as object type IDs).
Represents a value of the Model Object
collection attribute that limited the
membership in the collection at the
time when this collection was created
and can be used for reference purposes.
ClassIds contains a list of acceptable
class identifiers (such as object types). If
this list is non-empty, the collection
includes only those objects whose class
identifier appears in the list. If the list is
empty or returns a NULL pointer, then
all objects are included.
For information on object class
identifiers, see the appendix “AllFusion
ERwin DM Metamodel.”
BSTR * ClassNames() Similar to ClassIds except that it
returns a SAFEARRAY of class names
(such as object type names).
For information on object class names,
see the appendix “AllFusion ERwin
DM Metamodel.”
ISCModelObjectCollection * Creates a collection of Model Objects,
Collect(VARIANT Root, VARIANT which represents a subcollection of
ClassId [optional], VARIANT Depth itself. All filtering criteria specified in
[optional], VARIANT MustBeOn the Collect call is applied toward
[optional], VARIANT MustBeOff membership in the collection.
[optional])
The method creates a valid collection
even though the collection may be
empty.
All enumerations are depth-first.
long Count() Number of objects in the collection. The
number does not include the root
object.
long Depth() Depth limit on iteration in the
collection. -1 represents unlimited
depth.
Method Description
ISCModelObject * Item(VARIANT Returns an IUnknown pointer for a
nIndex, VARIANT Class [optional]) Model Object component identified by
the Index parameter.
SC_ModelObjectFlags MustBeOff() Filter on model object flags in the
collection.
SC_ModelObjectFlags MustBeOn() Filter on model object flags in the
collection.
VARIANT_BOOL Remove(VARIANT Removes the specified model object
Object) from a model.
ISCModelObject * Root() Returns a pointer to the root object in a
collection.
ISCModelObjectCollection::Add Arguments
The following table contains the valid arguments for the Add function:
ISCModelObjectCollection::Collect Arguments
The following table contains the valid arguments for the Collect function:
ISCModelObjectCollection::Item Arguments
The following table contains the valid arguments for the Item function:
ISCModelObjectCollection::Remove Arguments
The following table contains the valid arguments for the Remove function:
ISCModelProperty
The following table contains the methods for the ISCModelProperty interface:
Method Description
SC_CLSID ClassId() Returns the class identifier of the
property.
For information on property class
identifiers, see the appendix “AllFusion
ERwin DM Metamodel.”
BSTR ClassName() Returns the class name of the property.
For information on property class
names, see the appendix “AllFusion
ERwin DM Metamodel.”
long Count() Contains the number of values in the
property.
SC_ValueTypes DataType(VARIANT Passes back the identifier of the native
ValueId [optional]) value type for the indicated property
value.
For information on SC_ValueTypes, see
the Enumerations section in this
appendix.
VARIANT_BOOL IsValid() Returns TRUE if self is valid.
SC_ModelPropertyFlags Flags() Returns the flags of the property.
For information on
SC_ModelPropertyFlags, see the
Enumerations section in this appendix.
BSTR FormatAsString() Formats the property value as a string.
ISCPropertyValueCollection * Returns the collection of values for the
PropertyValues() model property.
VARIANT_BOOL RemoveAllValues() Removes all values from the property.
VARIANT_BOOL Removes the specified value from the
RemoveValue(VARIANT ValueId property. If no values remain after the
[optional]) removal, the property has a NULL
value.
Returns TRUE if the value was
removed.
Method Description
VARIANT Value(VARIANT ValueId Retrieves the indicated property value
[optional], VARIANT ValueType in the requested format.
[optional])
For information on property data types,
see SC_ValueTypes in the
Enumerations section in this appendix.
void Value(VARIANT ValueId Sets the indicated property value with
[optional], VARIANT ValueType the given value.
[optional], VARIANT Val )
ISCModelProperty::DataType Arguments
The following table contains the valid arguments for the DataType function:
ISCModelProperty::RemoveValue Arguments
The following table contains the valid arguments for the RemoveValue function:
The following table contains the valid arguments for the Value (Get) function:
The following table contains the valid arguments for the Value (Set) function:
ISCModelPropertyCollection
Method Description
IUnknown _NewEnum() Constructs an instance of the collection
enumerator object.
ISCModelProperty * Add(VARIANT Construct a new property for a bound
ClassId) model object if it does not exist.
SC_CLSID * ClassIds() Returns a SAFEARRAY of property
class identifiers in the property
collection.
Represents a value of the
ModelProperties collection attribute
that limited the membership at the time
when this collection was created and
can be used for reference purposes.
ClassIds contain an array of acceptable
class identifiers (such as property
classes). If this list is non-empty, the
property collection includes only those
properties whose class identifier
appears on the list. If the list is empty
or the caller supplies a NULL pointer,
the collection includes all the properties
owned by the object.
For information on property class
identifiers, see the appendix “AllFusion
ERwin DM Metamodel.”
BSTR * ClassNames() Same as the ClassIds property, but
returns a SAFEARRAY of property
type names in the property collection.
For information on property class
names, see the appendix “AllFusion
ERwin DM Metamodel.”
long Count() Number of properties in the collection.
Method Description
VARIANT_BOOL Returns TRUE if the object owns a
HasProperty(VARIANT ClassId, property of the passed class.
VARIANT MustBeOn [optional],
Treats properties as absent if they fail
VARIANT MustBeOff [optional])
to satisfy ClassIds, MustBeOn, and
MustBeOff attributes of the collection.
Alternative MustBeOn, MustBeOff can
be offered using optional parameters.
ISCModelProperty * Item(VARIANT Returns a model object property.
Class)
The method checks if the property
exists. If it does not, the method creates
a property description, returns an
ISCModelProperty instance, and sets
the NULL flag for the property. A new
property value can be set by using the
Value property of the instance.
However, it will fail to retrieve a value
before it is set.
The method allows you to create an
instance of ISCModelProperty for
properties like ReadOnly, Maintained
By the Tool, and so on. The value for
these properties cannot be changed or
assigned. Yet property flags, datatype,
and so on are available even when the
collection does not have the property
instance. Use HasProperty to check on
the existence of the property for a
model object instance.
SC_ModelPropertyFlags MustBeOff() Filter on property flags in the
collection. The filter is set when the
property collection is created through
the ISCModelObject::CollectProperties
method.
For information on
SC_ModelPropertyFlags, see the
Enumerations section in this appendix.
Method Description
SC_ModelPropertyFlags MustBeOn() Filter on property flags in the
collection. The filter is set when the
property collection is created through
the ISCModelObject::CollectProperties
method.
For information on
SC_ModelPropertyFlags, see the
Enumerations section in this appendix.
VARIANT_BOOL Remove(VARIANT Removes the indicated property from
ClassId) the bound object.
Successful execution of the call renders
all binds with the removed property
invalid. The client should release all
ISCModelProperty pointers, and all
related Value Collection and Value
pointers known to represent such an
association. Calls to interfaces fail and
the IsValid method returns FALSE.
ISCModelPropertyCollection::Add Arguments
The following table contains the valid arguments for the Add function:
ISCModelPropertyCollection::HasProperty Arguments
The following table contains the valid arguments for the HasProperty function:
ISCModelPropertyCollection::Item Arguments
The following table contains the valid arguments for the Item function:
ISCModelPropertyCollection::Remove Arguments
The following table contains the valid arguments for the Remove function:
ISCModelSet
The following table contains the methods for the ISCModelSet interface:
Method Description
SC_MODELTYPEID ClassId() Class identifier for metadata associated
with the model set.
For information on metadata class
identifiers, see the appendix “AllFusion
ERwin DM Metamodel.”
BSTR ClassName() Class name for metadata associated
with the model set.
For information on metadata class
names, see the appendix “AllFusion
ERwin DM Metamodel.”
VARIANT_BOOL DirtyBit() Returns a flag that indicates that the
data has changed in the model set.
void DirtyBit(VARIANT_BOOL ) Sets the flag that indicates that the data
in the model set has changed.
SC_MODELTYPEID ModelSetId() Passes back an identifier for the model
set.
BSTR Name() Passes back a persistence unit name.
ISCModelSet * Owner() A pointer to the owner model set.
Returns NULL for the top model set in
the persistence unit.
ISCModelSetCollection * Provides a collection with directly
OwnedModelSets() owned model sets.
SC_MODELTYPEID The identifier for the persistence unit
PersistenceUnitId() that contains the model set.
Method Description
ISCPropertyBag * Returns a property bag with the model
PropertyBag(VARIANT List [optional], set’s properties.
VARIANT AsString [optional])
A model set property is present in the
resulting bag only if it has a value. If
the property does not have any value
set, the property bag will not have the
property listed.
void PropertyBag(VARIANT List Sets a model set with the properties in
[optional], VARIANT AsString the given property bag.
[optional], ISCPropertyBag * propBag)
The following table contains the valid arguments for the PropertyBag (Get)
function:
The following table contains the valid arguments for the PropertyBag (Set)
function:
ISCModelSetCollection
A Model Set Collection contains all model sets directly owned by an owner
model set.
Method Description
IUnknown _NewEnum() Constructs an instance of a model set
enumerator object.
long Count() Number of model sets in the collection.
ISCPersistenceUnit * Item(VARIANT Passes back a pointer for a ModelSet
nIndex) component.
ISCModelSet * Owner() Returns a pointer to the owner model
set.
ISCModelSetCollection::Item Arguments
The following table contains the valid arguments for the Item function:
ISCPersistenceUnit
The following table contains the methods for the ISCPersistenceUnit interface:
Method Description
VARIANT_BOOL DirtyBit() Returns a flag that indicates that the
data has changed in the persistence
unit.
void DirtyBit(VARIANT_BOOL ) Sets the flag that indicates that the data
in the persistence unit has changed.
VARIANT_BOOL HasSession() Returns TRUE if a unit has one or more
sessions connected.
VARIANT_BOOL IsValid() Returns TRUE if self is valid.
ISCModelSet * ModelSet() Passes back a pointer on the top model
set in the Persistence Unit.
BSTR Name() Passes back a persistence unit name.
SC_MODELTYPEID ObjectId() Passes back an identifier for the
persistence unit.
Method Description
ISCPropertyBag * Returns a property bag with the
PropertyBag(VARIANT List [optional], persistence unit’s properties.
VARIANT AsString [optional])
A unit property is present in the
resulting bag only if it has a value. If
the property does not have any value
set, the property bag will not have the
property listed.
For a detailed description of properties,
see the Property Bag for Persistence
Units and the Persistence Unit
Collections section in this Appendix.
void PropertyBag(VARIANT List Sets a persistence unit with the
[optional], VARIANT AsString properties in the given property bag.
[optional], ISCPropertyBag * propBag)
VARIANT_BOOL Save(VARIANT Persists model data to external storage.
Locator [optional], VARIANT Uncommitted transactions are ignored.
Disposition [optional])
The following table contains the valid arguments for the PropertyBag (Get)
function:
The following table contains the valid arguments for the PropertyBag (Set)
function:
ISCPersistenceUnit::Save Arguments
The following table contains the valid arguments for the Save function:
ISCPersistenceUnitCollection
Method Description
IUnknown _NewEnum() Constructs an instance of unit
enumerator object.
ISCPersistenceUnit * Add(VARIANT Adds a new persistence unit to the unit
Locator, VARIANT Disposition collection.
[optional])
VARIANT_BOOL Clear() Purges all units from the collection.
long Count() Number of persistence units in the
collection.
ISCPersistenceUnit * Creates a new unit, and registers the
Create(ISCPropertyBag * PropertyBag, unit with the collection.
VARIANT ObjectId [optional])
For a detailed description of properties
in the Property Bag, see the Property
Bag for Persistence Units section and
the Persistence Unit Collections section
in this appendix.
ISCPersistenceUnit * Item(VARIANT Passes back an IUnknown pointer for a
nIndex) PersistenceUnit component.
VARIANT_BOOL Remove(VARIANT Removes a persistence unit from the
Selector, VARIANT Save [optional]) collection.
ISCPersistenceUnitCollection::Add Arguments
The following table contains the valid arguments for the Add function:
ISCPersistenceUnitCollection::Create Arguments
The following table contains the valid arguments for the Create function:
ISCPersistenceUnitCollection::Item Arguments
The following table contains the valid arguments for the Item function:
ISCPersistenceUnitCollection::Remove Arguments
The following table contains the valid arguments for the Remove function:
ISCPropertyBag
The following table contains the methods for the ISCPropertyBag interface:
Method Description
VARIANT_BOOL Add(BSTR Name, Adds a new property to the bag. Does
VARIANT Value) not check for duplicate names. Returns
TRUE if the property was added to the
bag, otherwise, it is FALSE.
void ClearAll() Removes all properties from the bag.
long Count() Returns the number of properties.
BSTR Name(long PropertyIdx) Retrieves the indicated property name
in the bag.
VARIANT Value(VARIANT Property) Retrieves the indicated property in the
bag.
void Value(VARIANT Property, Sets the indicated property in the bag.
VARIANT Val)
ISCPropertyBag::Add Arguments
The following table contains the valid arguments for the Add function:
ISCPropertyBag::Name Arguments
The following table contains the valid arguments for the Name function:
The following table contains the valid arguments for the Value (Get) function:
The following table contains the valid arguments for the Value (Set) function:
ISCPropertyValue
The following table contains the methods for the ISCPropertyValue interface:
Method Description
SC_ValueTypes * Groups a list of supported value types
GetSupportedValueIdTypes() for the current value identifier and
returns it as a SAFEARRAY.
The GetValue method must be able to
convert the current value into any
value type whose code appears in the
returned list. If the list is empty, the
value is available only in its native
(such as default) format. Reference
properties must return an empty list.
SC_ValueTypes * Groups a list of supported value types
GetSupportedValueTypes() and returns it as a SAFEARRAY.
The GetValueId method must be able
to convert the current value into any
value type whose code appears in the
returned list. If the list is empty, then
the current identifier is available only
in its native (such as default) format.
SC_CLSID PropertyClassId() Returns the class identifier of the
current property.
Method Description
BSTR PropertyClassName() Returns the class name of the current
property.
VARIANT Value(VARIANT Converts the current value to the
ValueType [optional]) passed value type.
For information on the value data
types, see SC_ValueTypes in the
Enumerations section in this appendix.
VARIANT ValueId(VARIANT Uniquely identifies the value in a non-
ValueType [optional]) scalar property.
SC_ValueTypes ValueIdType() Passes back the default type of the
ValueId that identifies the value within
the non-scalar property.
SC_ValueTypes ValueType() Passes back the default type of the
property value.
ISCPropertyValue::ValueId Arguments
The following table contains the valid arguments for the ValueId function:
ISCPropertyValue::Value Arguments
The following table contains the valid arguments for the Value function:
ISCPropertyValueCollection
Method Description
IUnknown _NewEnum() Constructs an instance of the collection
enumerator object.
long Count() Number of values in the collection.
ISCPropertyValue * Item(VARIANT Returns a single value from the
ValueId) property value collection.
ISCPropertyValueCollection::Item Arguments
The following table contains the valid arguments for the Item function:
ISCSession
The ISCSession interface is an active connection between the API client and a
model.
The following table contains the methods for the ISCSession interface:
Method Description
VARIANT BeginTransaction() Opens a transaction on the session. The
method passes back a transaction
identifier. Implementations use the
identifier to scope Commit and
Rollback operations. If the application
does not support nested transactions, it
passes back VT_EMPTY.
Transaction nesting is implicit. If an
AllFusion ERwin DM API client
invokes BeginTransaction and a
transaction is already open, the new
transaction is nested inside the existing
one.
VARIANT Opens a transaction on the session.
BeginNamedTransaction(BSTR Name, Similar to BeginTransaction with an
VARIANT PropertyBag [optional]) option to provide a transaction name
and additional properties.
For information on the transaction’s
properties, see the section Property Bag
for Session in this appendix.
VARIANT_BOOL Changes the model access to the
ChangeAccess(SC_SessionFlags Flags) specified level.
For information on valid
SC_SessionFlags, see the Enumerations
section in this appendix.
VARIANT_BOOL Close() Disconnects self from its associated
persistence unit or model set.
VARIANT_BOOL Commits the specified transaction and
CommitTransaction(VARIANT all nested transactions contained within
TransactionId) it.
Method Description
SC_SessionFlags Flags() Returns a set of flags associated with
the session.
For information on SC_SessionFlags,
see the Enumerations section in this
appendix.
VARIANT_BOOL IsValid() Returns TRUE if self is valid.
VARIANT_BOOL IsTransactionEmpty( TRUE if there was no data modification
VARIANT All [optional] ) applied from the beginning of the outer
transaction or for the duration of the
current transaction.
Returns TRUE with no open
transaction present.
SC_SessionLevel Level() Returns the level at which the
persistence unit or model is bound.
This value is valid only if the session is
open.
For information on SC_SessionLevel,
see the Enumerations section in this
appendix.
VARIANT_BOOL IsOpen() TRUE if and only if the session is open.
ISCModelObjectCollection * Creates a ModelObject collection for
ModelObjects() the session.
The returned collection contains every
object associated with the persistence
unit or model set.
SC_MODELTYPEID ModelSetId() Passes back an identifier for the model
set associated with the session.
BSTR Name() Name of the associated persistence unit
or model set.
Contains a valid name only when self is
in the Opened state.
Method Description
VARIANT_BOOL Open(IUnknown * Binds to the persistence unit, model set,
Target, VARIANT Level [optional], or intrinsic metamodel identified by the
VARIANT Flags [optional]) Target parameter.
ISCPersistenceUnit * PersistenceUnit() Persistence unit associated with the
session. Contains a valid pointer only
when it is in the Opened state.
long TransactionDepth() Returns the current depth level of the
nested transaction. Returns zero if there
are no active transactions present.
ISCSession::BeginNamedTransaction Arguments
ISCSession::CommitTransaction Arguments
The following table contains the valid arguments for the CommitTransaction
function:
ISCSession::IsTransactionEmpty Arguments
The following table contains the valid arguments for the IsTransactionEmpty
function:
ISCSession::Open Arguments
The following table contains the valid arguments for the Open function:
ISCSession::RollbackTransaction Arguments
The following table contains the valid arguments for the RollbackTransaction
function:
ISCSessionCollection
The Session Collection contains the active connections between the AllFusion
ERwin DM API client and the application.
The following table contains the methods for the ISCSessionCollection interface:
Method Description
IUnknown _NewEnum() Constructs an instance of a session
enumerator object.
ISCSession * Add() Construct a new, closed Session object,
and adds it to the collection.
VARIANT_BOOL Clear() Removes all Session objects from the
collection
long Count() The number of sessions in the
collection.
ISCSession * Item(long nIndex) Passes back a session identified by its
ordered position.
VARIANT_BOOL Remove(VARIANT Removes a Session object from the
SessionId) collection. If the session is opened, it is
closed before it is removed. All
committed changes are saved in the
persistence unit.
ISCSessionCollection::Item Arguments
The following table contains the valid arguments for the Item function:
ISCSessionCollection::Remove Arguments
The following table contains the valid arguments for the Remove function:
Enumerations
This section contains information regarding the various enumerations for the
AllFusion ERwin DM API. The enumerations define valid values for various
properties.
SC_ModelDirectoryFlags
SC_ModelDirectoryType
SC_ModelObjectFlags
SC_ModelPropertyFlags
SC_SessionFlags
SC_SessionLevel
SC_ValueTypes
This property bag provides access for Application Features sets. The parameters
of the PropertyBag call determine the context of the bag. The contents of the bag
can have one of two available forms: native format, or a string based on the
optional parameter of the PropertyBag property of the
ISCApplicationEnvironment interface.
If the Category parameter is not set, then the Property Bag property returns the
complete set of all the features from all the available categories.
The following tables summarize the available feature categories and lists the
Property Bag properties for each category.
ISCApplicationEnvironment::PropertyBag
The following table describes the Category parameter that contains an empty
string:
Application Category
The following table describes the Application category, which describes the
features associated with the AllFusion ERwin DM tool:
[Link] Category
The following table describes the [Link] category, which describes the
features associated with the AllFusion ERwin DM API:
[Link] Category
[Link] Category
[Link] Category
[Link] Category
[Link] Category
[Link] Category
[Link]
This Property Bag provides access to the properties of the Model Directory and
the Model Directory Unit objects. The PropertyBag property for both the
ISCModelDirectory interface and the ISCModelDirectoryUnit interface populates
the bag with the set of current properties. The same property of these interfaces
allows modification of directory (if it is not read-only) or directory unit
attributes. The contents of the bag can have one of two available forms: native
format or as a string based on the optional parameter of the PropertyBag
property of ISCModelDirectory and ISCModelDirectoryUnit. The client can
populate the bag in either of these two forms. Different forms can be mixed in the
same instance of the bag.
Not all properties that exist in the directory or directory unit have to be present
in the bag when it is submitted. All property data as well as property names are
validated by the AllFusion ERwin DM API, and all are either accepted or
rejected. The rejection forces a method call to fail. If the bag includes properties
that are read-only at the moment, for example, the Locator property, then such
properties are ignored and do not affect validation of the bag data.
The following table lists the Property Bag properties and datatypes for the Model
Directory:
The following table lists the Property Bag properties and datatypes for the Model
Directory Unit:
Not all properties that exist in the unit have to be present in the bag when it is
submitted. All property data as well as property names are validated by the
AllFusion ERwin DM API and either all are accepted or all are rejected. The
rejection forces a method call to fail. If the bag includes properties that are
read-only at the moment, for instance, the model type for an AllFusion ERwin
DM model when the model was created previously, then such properties are
ignored and will not affect validation of the bag data.
The following table contains the valid arguments for the PropertyBag (Get)
function:
The following table contains the valid arguments for the PropertyBag (Set)
function:
Property Bag Contents for Persistence Unit and Persistence Unit Collection
The following table lists the Property Bag properties and datatypes recognized
by AllFusion ERwin DM:
The Target Server property is a vector that consists of three members. The first
member of the vector contains a DBMS brand identifier, the second member is
the major version value, and the last member is the minor version value.
The following table lists DBMS brand identifiers for the Target Server property.
The table also lists the brand names that are used when the identifier is presented
as a string:
Not all properties have to be present in the bag when it is submitted. All
property data as well as property names are validated by the AllFusion ERwin
DM API, and all are either accepted or rejected. The rejection forces a method call
to fail.
The following table lists the Property Bag properties and datatypes for the
BeginNamedTransaction:
Locator Property
The following table describes the syntax supported by the Locator property:
Syntax Arguments
[provider://]pathinfo[?param=value[;param=value]…n] provider: This is a type of persistence storage. Use
erwin to specify file system, and use mmart for an
AllFusion Model Manager repository. If this is
skipped, erwin is the default.
pathinfo: This is the path to the storage location,
which is either a file path or the AllFusion Model
Manager path.
param: This is either a parameter name or a
keyword.
value: This is a text string.
There are no param keywords defined for the file system persistence storage.
For a list of Locator param keywords for use with the mmart type of provider for
models stored in AllFusion Model Manager, see the following table.
Note: There is a special arrangement for the AllFusion Model Manager Locator.
Part of the Locator string with params can be omitted if an application has
connections open with one or more AllFusion Model Manager repositories. In
this case, the params part of the Locator string can have only partial information
or not be present at all, as long as it is clear to which connection from the
available list it refers.
Currently, the AllFusion ERwin DM client for AllFusion Model Manager allows
only one open connection to an AllFusion Model Manager repository at any
given time. Therefore, it is possible, after establishing a connection, to omit the
params part of the Locator string completely and to provide the model path
information only.
The following table provides a list of Locator param keywords for use with the
mmart type of provider for models stored in AllFusion Model Manager:
The following table describes various scenarios in which you can use the Locator
param keyword along with the mmart type of provider for models stored in
AllFusion Model Manager:
Scenario Description
AllFusion Model Manager using SQL If you have a model called MyModel located in MyLib, which
Server is in MyMart in AllFusion Model Manager, you can use the
following:
mmart://MyMart/MyLib/MyModel?SRV=MyServer;SRT=SQL Server
2000/2005 (using db-lib);UID=<mm user id>;PSW=<password>
AllFusion Model Manager using Oracle If you have a model called MyModel located in MyLib, which
is on OracleHome in AllFusion Model Manager (the database
name is not indicated, and the additional slash ( / ) is
required), you can use the following:
mmart:///MyLib/MyModel?SRV=OracleHome;SRT=Oracle Vers.
[Link]/9i/10g;UID=<mm user id>;PSW=<password>
Local drive If you have a model called [Link] located in the models
directory on the C drive, you can use the following:
C:\models\[Link]
Disposition Property
The following table describes the syntax supported by the Disposition property:
Syntax Arguments
param=value[;param=value]…n param: This is either a parameter name
or a keyword.
value: Yes/No.
The following table lists Disposition param keywords for use with the erwin
type of provider, such as for models stored in the file system:
The following table lists Disposition param keywords for use with the
modelmart type of provider for models stored in AllFusion Model Manager:
Metadata Organization
The following is a diagram that shows the organization of the metadata:
*
Object Type Property Type
* +Name
+Name
+Parent +Is Abstract +Data type
+Tags +Is Reference
+Valid Owners +Tags
0..1
* +Valid Properties
*
+Participating Object +Participating Property
Association Type
1 +Tags 1
Metamodel Elements
AllFusion ERwin DM organizes data as a group of linked model sets. The model
sets are arranged in a tree-like hierarchy with a single model set at the top.
The top model set contains the bulk of the modeling data. The AllFusion ERwin
DM API uses the abbreviation EMX to identify the top model set.
The EMX model set owns a secondary model set, abbreviated as EM2, which
contains user interface settings and user options for AllFusion ERwin DM
services such as Forward Engineering, Complete Compare, and so on.
EMX
Model Set
Owns
EMX2
Model Set
The API clients access the model data by constructing a session and connecting it
to a model set using the Session component.
A model set contains several levels of data. It contains the data the application
manipulates, such as entity instances, attribute instances, relationship instances,
and so on.
The model set also contains metadata: a description of the objects and properties
that may occur within the application’s data.
In AllFusion ERwin DM, the metadata includes object and property classes,
object aggregations, and property associations:
■ Object classes—Define the type of objects that may occur within a model
such as an entity class, an attribute class, or a relationship class.
■ Property classes—Define the type of properties an object may have such as
the Name property, Comment property, or Parent Domain Ref property.
■ Object aggregations—Identify an ownership relationship between classes of
objects, such as a model that owns entities, or entities that own attributes,
and so on.
■ Property associations—Define property usage by object classes. For instance,
the metadata includes property associations for every object class that has
the Name property.
Metadata Tags
Each metadata object may include one or more tags. A tag is a metadata object
property that conveys certain descriptive meta information, such as if an object
class is logical, physical, valid for a specific target DBMS, and so on.
A tag on an object aggregation overrides the identical tag set on the associated
owned object class.
A tag on a property association overrides the identical tag set on the associated
property class.
The following graphic provides an example of these elements, specifically for the
DBMS_Brands_And_Versions tag:
The first element, the DBMS brand ID, is for Oracle, which is 1075858979.
The second element, the minimum version level for this DBMS, multiplied by
1000, is 8000. This means the minimum DBMS version level for this DBMS,
which is Oracle, is 8.0.
The third element, the maximum version level for this DBMS, is 999000 in this
example, which means there is no maximum version level for this DBMS.
Only instances of the concrete, non-abstract object classes may occur within the
application’s data. AllFusion ERwin DM uses the generalization mechanism to
flatten metadata by replicating aggregations, associations, and tags from the
abstract object classes in the concrete object classes.
Metamodel Classes
A unique metadata class identifies what type of metadata a model set contains.
The following describes these classes:
■ EMX Class Model Set—Contains the bulk of model data such as entities and
attributes.
– Class name—EMX
– Class identifier—The value defined in the Application Environment
component, category Application, property EMX Metadata Class.
■ EM2 Class Model Set—Stores additional data such as user interface settings
and user options for AllFusion ERwin DM services such as Forward
Engineering and Complete Compare.
– Class name—EM2
– Class identifier—The value defined in the Application Environment
component, category Application, property EM2 Metadata Class.
Metadata Reports
AllFusion ERwin DM makes metadata descriptions available in various formats.
Metamodel Document
You can generate metamodel documents from the AllFusion ERwin DM Help
menu.
The application can generate a document for the complete EMX model or for just
the current model. If you generate a metamodel document for the current model,
you have an additional option to filter your output based on the target DBMS of
the current model, and this option also allows you to see user defined properties.
However you choose to generate the document, it will contain the following
definitions:
■ Object definitions
■ Property definitions
■ Association definitions (for property ownership)
■ Aggregation definitions (for object ownership)
The default output of this document is in HTML format, and AllFusion ERwin
DM provides a template for this format. However, you can create your own
template for the output that you require.
Object and property class names appear as titles for definition descriptions:
For object types that are specific to an AllFusion ERwin DM 4.1.4 model that is
being upgraded, the object definition is TRUE for the Is Deprecated field. These
object types are not available otherwise. Likewise for property types that are
specific to an AllFusion ERwin DM 4.1.4 model that is being upgraded, the
property definition Is Deprecated field is TRUE. These property types are not
available otherwise.
The following is an example of an object type that has TRUE defined for the Is
Deprecated field:
The object definition is TRUE for the Is Abstract field for abstract object types.
These types are used for defining metadata only. No model data objects have
them as their object type.
The following is an example of an object type that has TRUE defined for the Is
Abstract field:
The value in the Long Id field is the API’s metadata object identifier. Information
on object identifiers and type codes is in the section Object Identifiers in the
chapter “API Components.”
XML Schema
An XML schema is a document or a set of documents that defines the XML file’s
structure and legal elements. XML schemas can be used to ensure that an XML
file is syntactically correct and conforms to the defined schema. AllFusion ERwin
DM provides such a schema and uses the schema to validate XML files when
they are opened in the tool.
The AllFusion ERwin DM installation places the complete set of XML schema
files necessary for an XML file validation into the Doc directory. The schema files
have .xsd extensions. The following is the list of XML schema files provided by
AllFusion ERwin DM:
■ [Link]—Top level schema
■ [Link]—Schema for UDP definitions
■ [Link]—Schema for object hierarchy
■ [Link]—Schema for non-transactional data
■ [Link]—Schema for object properties and UDP instances
XML schemas contain descriptions of model object and property classes and
define property containment by object classes. Schema definitions for EMX and
EM2 classes are provided. XML schemas do not include deprecated classes.
The following is a diagram of the five AllFusion ERwin DM XML schema files:
[Link]
Top level schema
Namespace: [Link]
Imports Imports
Includes
[Link]
Schema for object properties
and UDP instances
Namespace: [Link]
ERwin/data
The schema files under the Doc directory are not database specific and represent
the entire AllFusion ERwin DM metamodel. The schema contains all possible
objects and properties for all valid database targets. If you need database specific
schema, those files are located in the Doc\DBMS_schemas directory. Within the
Doc\DBMS_schemas directory, there is a folder for each target database that
AllFusion ERwin DM supports. The database specific schema files are stored in
that folder and only consist of objects and properties that are valid for the given
database target.
Note: The XML schema that is in the Doc directory is always used by AllFusion
ERwin DM to validate an XML file; the database specific schema is not used. The
database specific schemas are provided for documentation purposes and to assist
third party tool integrators to determine the valid objects and properties for a
given database target. An external XML validation tool can be used to validate
an XML file against a database specific schema.
ERwin Spy
r7 does not use the UDP Definition object type to define UDP properties. In r7,
UDP definitions are part of the metadata. In order to define a new UDP, a new
Property Type object must be added to the metadata of the EMX model set.
For more information, see the section Creating User-Defined Properties in the
chapter, “API Tasks.”
The files listed in the following table contain only object and property types with
changed names, but their role in model data remains the same. There are a
number of objects and properties that were deprecated and replaced by new
object and property types. These new and replaced types are described in the
files shown in the table in the next section, Additions and Deprecations in
Metadata.
Note: The Api Appendix B. EMX Renamed [Link] file and the Api
Appendix [Link] Renamed [Link] file are similar, they just break down
the object and property types separately.
The following table lists the files that reflect the changes in the metadata:
Datatype Changes
The file Api Appendix [Link] Property datatype [Link] provides a list of
properties with changed datatypes. AllFusion ERwin DM uses the properties in a
way similar to Release 4.1.4, however, the datatype of those properties was
changed to accommodate the new, expanded use in r7.
deleting
non-scalar property values, 3-57
objects, 3-54
A
properties and property values, 3-55
scalar properties, 3-56
active scripting, 1-2, 1-4 depth filter, 3-30
disposition property, A-94
API environment, 3-1
abstract metadata objects, B-6 error handling, 3-65
accessing ERwin Spy application, 2-14, B-11
metamodel information, 3-58 filtering
model data, 3-7 object collections, 3-28
model objects, 3-23, 3-25 object collections, filters used, 3-30
non-scalar property values, 3-36, 3-40 properties, 3-42
object properties, 3-31 iterating through open models, 3-7
scalar property values, 3-34 iteration of properties, 3-32
specific objects, 3-27 locator property, A-92
specific properties, 3-41 major features, 1-1
advanced tasks, 3-69 metadata tags, B-3
creating UDPs, 3-69, 3-73 metamodel
application environment property bag, A-74 classes, B-6
automation documents, B-7
default properties, 2-12 elements, B-1
optional parameter, 2-12 model directory property bag, A-81, A-90
Begin Transaction, 3-46 model directory unit property bag, A-81, A-90
clearing a persistence unit, 3-64 ModelObjects property, 3-23
closing a session, 3-63 MustBeOn/MustBeOff filter, 3-31
Commit Transaction, 3-47 object identifiers, 2-8
converting Version 4.1.4 to r7, B-11 object type filter, 3-30
metadata additions and deprecations, B-12 opening
type names, B-12 a session, 3-17
UDPs, B-11 an existing model, 3-16
creating persistence unit collections property bag, A-85
a new model, 3-14 persistence units property bag, A-85
a new persistence unit, 3-15 property bag reference, A-74
an entry point, 3-2 sample client, 2-12
ISCApplication object, 3-2 session transactions, 3-45
objects, 3-49 setting
UDPs, 3-69, 3-73 non-scalar property values, 3-52
DBMS brand IDs, B-5 property values, 3-51
for target server property, A-89 scalar property values, 3-51
typical use cases, 1-2
Index–1
using ISCPersistenceUnitCollection
as a standalone executable, 1-3, 3-13 clearing persistence units, 3-64
as an add-in or script, 1-4 creating a new model, 3-14
as an add-in tool, 3-7 description of, A-53
XML schema, B-9 opening an existing model, 3-16
using with API as add-in, 3-8
API interfaces
ISCPropertyBag
IEnumVARIANT, 2-10
creating a new model, 3-15
ISCApplication
description of, A-57
application properties, 3-3
using with API as add-in, 3-11
description of, A-1
ISCPropertyValue, 2-5
using with API as add-in, 3-8
accessing non-scalar property values, 3-38
ISCApplicationEnvironment
description of, A-59
application properties, 3-4, 3-59, 3-66
ISCPropertyValueCollection
description of, A-2
accessing non-scalar property values, 3-37
ISCModelDirectory, 2-3, 2-7
accessing specific properties, 3-41
description of, A-4
description of, A-62
ISCModelDirectoryCollection
ISCSession, 2-4, 2-7, 3-21
description of, A-18
accessing metamodel information, 3-60
ISCModelDirectoryUnit, 2-3
accessing model objects, 3-23
ISCModelObject, 2-5
Begin Transaction, 3-46
accessing model objects, 3-24
closing the session, 3-62
description of, A-23
Commit transaction, 3-47, 3-73
filtering properties, 3-43
description of, A-63
iteration of properties, 3-32
opening a session, 3-18
ISCModelObjectCollection, 2-5
ISCSessionCollection, 2-4
accessing
closing the session, 3-62
model objects, 3-23
description of, A-68
specific objects, 3-27
opening a session, 3-17
creating objects, 3-49
ISCValueCollection, 2-5
deleting objects, 3-54
description of, A-27 Application Tier
filtering object collections, 3-28 overview, 2-1
ISCModelProperty, 2-5
automation
accessing non-scalar property values, 3-36
default properties, 2-12
accessing scalar property values, 3-34
optional parameter, 2-12
deleting properties and property values, 3-56
description of, A-34
iteration of properties, 3-32
setting non-scalar property values, 3-53 C
setting scalar property values, 3-51
ISCModelPropertyCollection
deleting properties and property values, 3-55 Class parameter, 3-27
description of, A-38 Collect method, 3-28
iteration of properties, 3-32
ISCModelSet, 3-20 CollectProperties method, 3-42
description of, A-44 components
ISCModelSetCollection, 3-20 values, 2-5, 2-8
description of, A-47
ISCPersistenceUnit creating a new model, 3-14
description of, A-48
saving the model, 3-57
using with API as add-in, 3-9
Index–3
model N
accessing
metamodel information, 3-58
model objects, 3-23, 3-25 nIndex parameter, 3-27
non-scalar property values, 3-36, 3-40
object properties, 3-31 non-scalar properties, accessing specific, 3-41
scalar property values, 3-34
specific objects, 3-27
specific properties, 3-41 O
Begin Transaction, 3-46
clearing a persistence unit, 3-64
closing a session, 3-63 Open method, 3-58
Commit Transaction, 3-47
creating
new, 3-14 P
new persistence unit, 3-15
objects, 3-49
deleting parameters
non-scalar property values, 3-57 Class, 3-27
objects, 3-54 Level, 3-58
properties and property values, 3-55 nIndex, 3-27
scalar properties, 3-56 Unit, 3-18, 3-60
depth filter, 3-30 ValueId, 3-52, 3-56
error handling, 3-65
filtering persistence unit
object collections, 3-28 new, 3-14
object collections, filters used, 3-30 property bag members for, 3-9
properties, 3-42 properties
iteration accessing
of properties, 3-32 non-scalar values of, 3-36
through, 3-7 scalar values of, 3-34
MustBeOn/MustBeOff filter, 3-31 specific, 3-41
object type filter, 3-30 deleting, 3-55
opening non-scalar values of, 3-56
a session, 3-17 scalar, 3-56
an existing, 3-16 iteration of, 3-32
setting ModelObjects, 3-23
non-scalar property values, 3-52 PersistenceUnits, 3-7, 3-13
property values, 3-51 setting values of, 3-51
scalar property values, 3-51 Value, 3-34
Model Data Tier property bag members, for a persistence unit, 3-9
overview, 2-5
property bag reference, A-74
Model Directory Tier
overview, 2-3 property of model object
flags, A-4
ModelObjects property, 3-23 multi-valued, 2-5
property, accessing specific, 3-41
PropertyValues member, 3-36
transactions
Begin, 3-46
Commit, 3-47
Index–5