home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
fillTables.tcl
< prev
next >
Wrap
Text File
|
1996-11-25
|
7KB
|
278 lines
#---------------------------------------------------------------------------
#
# (c) Cadre Technologies Inc. 1995
#
# File: @(#)fillTables.tcl /main/hindenburg/1
# Author: Challenger
# Description: Definition of classes to simulate old Report Writer
# tables.
#
#---------------------------------------------------------------------------
# SccsId = @(#)fillTables.tcl /main/hindenburg/1 25 Nov 1996 Copyright 1995 Cadre Technologies Inc.
# main fill routine
#
proc fillTables {} {
foreach table [usedTables] {
switch $table {
project { fillTableProject }
phase { fillTablePhase }
system { fillTableSystem }
file { fillTableFile }
component { fillTableComponent }
item { fillTableItem }
attribute { fillTableAttribute }
description { fillTableDescription }
compattr { fillTableCompattr }
default { error "unknown table: $table" }
}
}
}
# fill routines for each table
#
proc fillTableProject {} {
global ProjectList
set ProjectList {}
foreach configV [allConfigVersions] {
set newRecord [ProjectRecord new $configV]
lappend ProjectList $newRecord
}
}
proc fillTablePhase {} {
global PhaseList
set PhaseList {}
foreach configV [allConfigVersions] {
foreach phaseV [osort phase.name [allPhaseVersions $configV]] {
set newRecord [PhaseRecord new $configV $phaseV]
lappend PhaseList $newRecord
}
}
}
proc fillTableSystem {} {
global SystemList
set SystemList {}
foreach configV [allConfigVersions] {
foreach phaseV [osort phase.name [allPhaseVersions $configV]] {
foreach systemV [osort system.name [allSystemVersions $phaseV]] {
set newRecord [SystemRecord new $configV $phaseV $systemV]
lappend SystemList $newRecord
}
}
}
}
proc fillTableFile {} {
global FileList
set FileList {}
foreach configV [allConfigVersions] {
foreach phaseV [allPhaseVersions $configV] {
foreach systemV [allSystemVersions $phaseV] {
# FileVersion
foreach fileV [allFileVersions $systemV] {
set newRecord [FileRecord new $configV $phaseV $systemV \
$fileV]
$newRecord _objtype local
lappend FileList $newRecord
}
# SystemFileReference
foreach ref [$systemV fileVersionReferences] {
set newRecord [FileRecord new $configV $phaseV $systemV \
[$ref referredFileVersion]]
$newRecord _objtype reference
$newRecord _reference $ref
lappend FileList $newRecord
}
# ExternalLink
foreach extlink [$systemV externalLinks] {
set newRecord [FileRecord new $configV $phaseV $systemV \
[ORB::nil]]
$newRecord _objtype link
$newRecord _link $extlink
lappend FileList $newRecord
}
}
}
}
}
proc fillTableComponent {} {
global ComponentList
set ComponentList {}
foreach configV [allConfigVersions] {
foreach phaseV [allPhaseVersions $configV] {
foreach systemV [allSystemVersions $phaseV] {
foreach diagram [query "{isA Diagram} == 1" \
[allFileVersions $systemV]] {
foreach component [$diagram components] {
set newRecord [ComponentRecord new $configV $phaseV \
$systemV $component]
lappend ComponentList $newRecord
}
}
}
}
}
}
proc fillTableItem {} {
global ItemList
set ItemList {}
foreach configV [allConfigVersions] {
foreach phaseV [allPhaseVersions $configV] {
foreach systemV [allSystemVersions $phaseV] {
foreach wi [$systemV definedItems] {
set newRecord [ItemRecord new $configV $phaseV $systemV \
"" $wi]
lappend ItemList $newRecord
}
foreach fileV [allFileVersions $systemV] {
if [$fileV isA ExternalFileVersion] {
continue
}
foreach wi [$fileV definedItems] {
set newRecord [ItemRecord new $configV $phaseV $systemV\
$fileV $wi]
lappend ItemList $newRecord
}
}
}
}
}
}
proc fillTableAttribute {} {
global AttributeList
set AttributeList {}
foreach configV [allConfigVersions] {
foreach phaseV [allPhaseVersions $configV] {
foreach systemV [allSystemVersions $phaseV] {
set wiList [$systemV definedItems]
foreach fileV [allFileVersions $systemV] {
if [$fileV isA ExternalFileVersion] {
continue
}
set wiList [concat $wiList [$fileV definedItems]]
}
foreach wi $wiList {
if { $wi == "" } {
continue
}
set ip [$wi properties]
if [$ip isNil] {
continue
}
foreach prop [$ip properties] {
set newRecord [AttributeRecord new $wi [$prop name] \
[$prop value]]
lappend AttributeList $newRecord
}
}
}
}
}
}
proc fillTableCompattr {} {
global CompattrList
set CompattrList {}
foreach configV [allConfigVersions] {
foreach phaseV [allPhaseVersions $configV] {
foreach systemV [allSystemVersions $phaseV] {
foreach diagram [query "{isA Diagram} == 1" \
[allFileVersions $systemV]] {
foreach comp [$diagram components] {
foreach prop [$comp properties] {
set newRecord [CompattrRecord new $comp \
[$prop name] \
[$prop value]]
lappend CompattrList $newRecord
}
}
}
}
}
}
}
proc fillTableDescription {} {
global DescriptionList
set DescriptionList {}
foreach configV [allConfigVersions] {
foreach phaseV [allPhaseVersions $configV] {
foreach systemV [allSystemVersions $phaseV] {
foreach wi [$systemV definedItems] {
set newRecord [DescriptionRecord new $configV $phaseV \
$systemV "" $wi]
lappend DescriptionList $newRecord
}
foreach fileV [allFileVersions $systemV] {
set newRecord [DescriptionRecord new $configV $phaseV \
$systemV $fileV ""]
lappend DescriptionList $newRecord
}
}
}
}
}
# procs only used in this file
#
proc allConfigVersions {} {
switch -exact $CurrentLevel {
File { return $ConfigVersion }
System { return $ConfigVersion }
Phase { return $ConfigVersion }
Config { return $ConfigVersion }
Project { return [$Project configVersions] }
default { return [query -s projects.configVersions $Corporate] }
}
}
proc allPhaseVersions {configV} {
switch -exact $CurrentLevel {
File { return $PhaseVersion }
System { return $PhaseVersion }
Phase { return $PhaseVersion }
default { return [$configV phaseVersions] }
}
}
proc allSystemVersions {phaseV} {
switch -exact $CurrentLevel {
File { return $SystemVersion }
System { return $SystemVersion }
default { return [$phaseV systemVersions] }
}
}
proc allFileVersions {systemV} {
switch -exact $CurrentLevel {
File { return $FileVersion }
default { return [$systemV localFileVersions] }
}
}