Chapter 9 Accessing objects using VBScript


Accessing repository documents

You can drill down to the repository documents located in the Repository browser using the ChildObjects collection (containing both documents and folders) that also allows you to drill down to documents located in folders of the Repository if any.

The repository documents are the following:

Repository document Description
RepositoryModel Contains any type of PowerDesigner model (CDM, PDM, OOM, BPM, XSM, ILM, RQM or FEM)
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

 


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