home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cadre Technologies Inc. 1996
- #
- # File: %W%
- # Author: Harm Leijendeckers
- # Description: Upgrade contents of an Ot4OMT-4.0/00 repository
- # to an Ot4OMT-4.0/01 repository
- #
- #---------------------------------------------------------------------------
- # SccsId = %W% %G% Copyright 1996 Cadre Technologies Inc.
-
- source [m4_path_name tcl libocl.tcl]
-
- OTShRegister::repository
- OTShRegister::reportWriter
-
- require upgrade_menus.tcl
-
-
- set CC [ClientContext::global]
-
-
- proc upgradeContents {} {
- set corp [$CC currentCorporate]
-
- puts "Upgrading repository contents for corporate '[$corp name]'"
- puts ""
-
- foreach proj [$corp projects] {
- foreach cv [$proj configVersions] {
- foreach pv [$cv phaseVersions] {
- foreach dv [query "system.type == document && \
- status == working" $pv.systemVersions] {
- $CC setLevelIds /[$corp identity]/[$proj identity]/[$cv \
- identity]/[$pv identity]/[$dv identity]
- upgradeDocument $dv
- }
- }
- }
- }
-
- puts ""
- puts "Upgrading repository contents finished"
- }
-
-
- proc upgradeDocument { dv } {
- puts "Upgrading document '[[$dv system] name]'"
- if { [$dv status] == "frozen" } {
- if { [$dv unfreeze] == -1 } {
- return
- }
- }
-
- set allItprops [query "\"findProperty SECTIONTYPE\" != [ORB::nil] && \
- \"findProperty SECTIONTYPE.value\" == Itemprop" \
- [$dv localFileVersions]]
- set allFiprops [query "\"findProperty SECTIONTYPE\" != [ORB::nil] && \
- \"findProperty SECTIONTYPE.value\" == Fileprop" \
- [$dv localFileVersions]]
-
- foreach itprop $allItprops {
- set name [[$itprop findProperty fileSystemPath] value]
- set refProps [[$itprop findProperty properties] value]
- set refItem [Item new [[$itprop findProperty repItemId] value]]
- set refVers [Version new [[$itprop findProperty repItemKeeper] value]]
- set refObject [$refVers object]
-
- set newIp [$dv createItemPropRef $name Itemprop $refObject $refItem]
-
- $newIp setProperty SECTIONTYPE ItemProp
- $newIp setProperty fileSystemPath $name.text
- $newIp setProperty refProperties $refProps
-
- # remove old one
- $dv remove -fileVersion $itprop
- }
-
- foreach fiprop $allFiprops {
- set name [[$fiprop findProperty fileSystemPath ] value]
- set refProps [[$fiprop findProperty properties ] value]
- set refFile [File new [[$fiprop findProperty repFile] value]]
-
- set newFp [$dv createFilePropRef $name Fileprop $refFile]
-
- $newFp setProperty SECTIONTYPE FileProp
- $newFp setProperty fileSystemPath $name.text
- $newFp setProperty refProperties $refProps
-
- # remove old one
- $dv remove -fileVersion $fiprop
- }
- }
-
-
- if { [catch { upgradeContents; upgradeRepMenus } string] == 1 } {
- puts $errorInfo
- exit
- }
-