Accessing a Repository Document

You can drill down to the repository documents located in the Repository root using the ChildObjects collection (containing both documents and folders) and any subfolders.

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

The repository documents are the following:

Repository document

Description

RepositoryModel

Contains any type of PowerDesigner model

RepositoryReport

Contains consolidated multi-model reports

RepositoryDocument

Contains non-PowerDesigner files (text, Word, or Excel)

OtherRepositoryDocument

Contains non-PowerDesigner models defined using the Java Repository interface, which allows you to define your metamodels

You can access a RepositoryModel document and the sub-objects of a RepositoryModel document using the following collection: ChildObjects As ObjectCol.

Example

' Retrieve the deepest folder under the connection
 Dim CurrentObject, LastFolder
 set LastFolder = Nothing
 for each CurrentObject in C.ChildObjects
 if CurrentObject.IsKindOf(cls_RepositoryFolder) then
   set LastFolder = CurrentObject
  end if
 next

The ChildObjects collection is not automatically updated when the Repository is modified during a script execution. To refresh all the collections, you can use the following method: Refresh().

Example

C.Refresh

You can test if a model has already been consolidated using the following method: FindInRepository() As BaseObject.

Example

Set repmodel = model.FindInRepository()
If repmodel Is Nothing Then
  ' Model was not consolidated yet...
 model.ConsolidateNew
Else
 ' Model was already consolidated...
 repmodel.Freeze
 model.Consolidate 
End If