Chapter 9 Accessing objects using VBScript


Manipulating the Repository using VBScript

PowerDesigner lets you access the Repository feature via VBScript using the RepositoryConnection as BaseObject global property.

It allows you to retrieve the current repository connection, which is the object that manages the connection to the repository server and provides access to documents and objects stored under the repository.

The RepositoryConnection is equivalent to the root node in the Repository browser.

You can access the repository documents, but you cannot access the repository administration objects, like users, groups, configurations, branches, and list of locks.

In addition, only the last version of a repository document is accessible using VBScript.

The main actions you can perform are the following:

Repository database connection

To retrieve the current repository connection:

Use the following Description
RepositoryConnection As BaseObject Global property which manages the connection to the repository database

To connect to a repository database:

Use the following Description
Open (ByVal RepDef As String = "", ByVal User As String = "", ByVal Pass As String = "", ByVal DBUser As String = "", ByVal DBPass As String = "") As Boolean Method on RepositoryConnection that allows you to perform a repository connection

To disconnect from the repository:

Use the following Description
Close() Method on RepositoryConnection that allows you to disconnect from the repository database

Repository document access

To browse for a document:

Use the following Description
ChildObjects As ObjectCol Collection on StoredObject which manages the access to the repository documents

To update a document version:

Use the following Description
Refresh() Method on RepositoryConnection which lets you visualize new documents, update versions of existing documents, or hide deleted ones

To find a document:

Use the following Description
FindInRepository() As BaseObject Method on BaseModel that allows you to check if a model has already been consolidated

Repository document extraction

To extract any document:

Use the following Description
ExtractToFile(ByVal FileName As String, ByVal MergeMode As Long = 2, ByVal OpenMode As Boolean = -1, ByRef Actions As String = NULL, ByRef Conflicts As String = NULL) As BaseObject Method on RepositoryModel that allows you to extract any kind of document

To extract a PowerDesigner document:

Use the following Description
UpdateFromRepository(ByVal MergeMode As Integer = 2, ByRef actions As String = NULL, ByRef conflicts As String = NULL) As Boolean Method on BaseModel that allows you to extract PowerDesigner documents

Repository document consolidation

To consolidate any document:

Use the following Description
ConsolidateDocument(ByVal FileName As String, ByVal MergeMode As Long = 2, ByRef Actions As String = NULL, ByRef Conflicts As String = NULL) As BaseObject Method on RepositoryFolder that allows you to consolidate any kind of document

To consolidate a PowerDesigner document:

Use the following Description
ConsolidateNew(ByVal RepositoryFolder As BaseObject, ByRef actions As String = NULL, ByRef conflicts As String = NULL) As BaseObject Method on BaseModel that allows you to consolidate PowerDesigner documents
Consolidate(ByVal MergeMode As Integer = 2, ByRef actions As String = NULL, ByRef conflicts As String = NULL) As BaseObject Method on BaseModel that allows you to consolidate additional repository versions of a PowerDesigner document

Document version management

To freeze and unfreeze a document version:

Use the following Description
Freeze(ByVal Comment As String = "") As Boolean Method on RepositoryDocumentBase that allows you to create an archived version of a document
Unfreeze() As Boolean Method on RepositoryDocumentBase that allows you to modify the current version in the repository to reflect changes performed on your local machine

To lock and unlock a document version:

Use the following Description
Lock(ByVal Comment As String = "") As Boolean Method on RepositoryDocumentBase that allows you to prevent other users from updating the consolidated version
Unlock() As Boolean Method on RepositoryDocumentBase that allows other users to update the consolidated version

To delete a document version:

Use the following Description
DeleteVersion() As Boolean Method on RepositoryDocumentBase that allows you to delete a document version

Repository browser management

To create a folder:

Use the following Description
CreateFolder(ByVal FolderName As String) As BaseObject Method on RepositoryFolder that allows you to create a new folder in the repository browser

To delete an empty folder:

Use the following Description
DeleteEmptyFolder() As Boolean Method on RepositoryFolder that allows you to delete an empty folder in the repository browser

For more information on documents, see the "Accessing repository documents" section.

 


Copyright (C) 2005. Sybase Inc. All rights reserved.