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 >
Text File  |  1996-11-25  |  7KB  |  278 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #    (c) Cadre Technologies Inc. 1995
  4. #
  5. #    File:        @(#)fillTables.tcl    /main/hindenburg/1
  6. #    Author:        Challenger
  7. #    Description:    Definition of classes to simulate old Report Writer
  8. #            tables.
  9. #
  10. #---------------------------------------------------------------------------
  11. # SccsId = @(#)fillTables.tcl    /main/hindenburg/1    25 Nov 1996    Copyright 1995 Cadre Technologies Inc.
  12.  
  13.  
  14. # main fill routine
  15. #
  16. proc fillTables {} {
  17.     foreach table [usedTables] {
  18.     switch $table {
  19.         project    { fillTableProject }
  20.         phase    { fillTablePhase }
  21.         system    { fillTableSystem }
  22.         file    { fillTableFile }
  23.         component    { fillTableComponent }
  24.         item    { fillTableItem }
  25.         attribute    { fillTableAttribute }
  26.         description    { fillTableDescription }
  27.         compattr    { fillTableCompattr }
  28.  
  29.         default    { error "unknown table: $table" }
  30.     }
  31.     }
  32. }
  33.  
  34.  
  35. # fill routines for each table
  36. #
  37. proc fillTableProject {} {
  38.     global ProjectList
  39.     set ProjectList {}
  40.     foreach configV [allConfigVersions] {
  41.     set newRecord [ProjectRecord new $configV]
  42.     lappend ProjectList $newRecord
  43.     }
  44. }
  45.  
  46.  
  47. proc fillTablePhase {} {
  48.     global PhaseList
  49.     set PhaseList {}
  50.     foreach configV [allConfigVersions] {
  51.     foreach phaseV [osort phase.name [allPhaseVersions $configV]] {
  52.         set newRecord [PhaseRecord new $configV $phaseV]
  53.         lappend PhaseList $newRecord
  54.     }
  55.     }
  56. }
  57.  
  58.  
  59. proc fillTableSystem {} {
  60.     global SystemList
  61.     set SystemList {}
  62.     foreach configV [allConfigVersions] {
  63.     foreach phaseV [osort phase.name [allPhaseVersions $configV]] {
  64.         foreach systemV [osort system.name [allSystemVersions $phaseV]] {
  65.         set newRecord [SystemRecord new $configV $phaseV $systemV]
  66.         lappend SystemList $newRecord
  67.         }
  68.     }
  69.     }
  70. }
  71.  
  72.  
  73. proc fillTableFile {} {
  74.     global FileList
  75.     set FileList {}
  76.     foreach configV [allConfigVersions] {
  77.     foreach phaseV [allPhaseVersions $configV] {
  78.         foreach systemV [allSystemVersions $phaseV] {
  79.         # FileVersion
  80.         foreach fileV [allFileVersions $systemV] {
  81.             set newRecord [FileRecord new $configV $phaseV $systemV \
  82.             $fileV]
  83.             $newRecord _objtype local
  84.             lappend FileList $newRecord
  85.         }
  86.         # SystemFileReference
  87.         foreach ref [$systemV fileVersionReferences] {
  88.             set newRecord [FileRecord new $configV $phaseV $systemV \
  89.             [$ref referredFileVersion]]
  90.             $newRecord _objtype reference
  91.             $newRecord _reference $ref
  92.             lappend FileList $newRecord
  93.         }
  94.         # ExternalLink
  95.         foreach extlink [$systemV externalLinks] {
  96.             set newRecord [FileRecord new $configV $phaseV $systemV \
  97.             [ORB::nil]]
  98.             $newRecord _objtype link
  99.             $newRecord _link $extlink
  100.             lappend FileList $newRecord
  101.         }
  102.         }
  103.     }
  104.     }
  105. }
  106.  
  107.  
  108. proc fillTableComponent {} {
  109.     global ComponentList
  110.     set ComponentList {}
  111.     foreach configV [allConfigVersions] {
  112.     foreach phaseV [allPhaseVersions $configV] {
  113.         foreach systemV [allSystemVersions $phaseV] {
  114.         foreach diagram [query "{isA Diagram} == 1" \
  115.                     [allFileVersions $systemV]] {
  116.             foreach component [$diagram components] {
  117.             set newRecord [ComponentRecord new $configV $phaseV \
  118.                         $systemV $component]
  119.             lappend ComponentList $newRecord
  120.             }
  121.         }
  122.         }
  123.     }
  124.     }
  125. }
  126.  
  127.  
  128. proc fillTableItem {} {
  129.     global ItemList
  130.     set ItemList {}
  131.     foreach configV [allConfigVersions] {
  132.     foreach phaseV [allPhaseVersions $configV] {
  133.         foreach systemV [allSystemVersions $phaseV] {
  134.         foreach wi [$systemV definedItems] {
  135.             set newRecord [ItemRecord new $configV $phaseV $systemV \
  136.                           "" $wi]
  137.             lappend ItemList $newRecord
  138.         }
  139.  
  140.         foreach fileV [allFileVersions $systemV] {
  141.             if [$fileV isA ExternalFileVersion] {
  142.             continue
  143.             }
  144.  
  145.             foreach wi [$fileV definedItems] {
  146.             set newRecord [ItemRecord new $configV $phaseV $systemV\
  147.                           $fileV $wi]
  148.             lappend ItemList $newRecord
  149.             }
  150.         }
  151.         }
  152.     }
  153.     }
  154. }
  155.  
  156.  
  157. proc fillTableAttribute {} {
  158.     global AttributeList
  159.     set AttributeList {}
  160.     foreach configV [allConfigVersions] {
  161.     foreach phaseV [allPhaseVersions $configV] {
  162.         foreach systemV [allSystemVersions $phaseV] {
  163.         set wiList [$systemV definedItems]
  164.         foreach fileV [allFileVersions $systemV] {
  165.             if [$fileV isA ExternalFileVersion] {
  166.             continue
  167.             }
  168.  
  169.             set wiList [concat $wiList [$fileV definedItems]]
  170.         }
  171.  
  172.         foreach wi $wiList {
  173.             if { $wi == "" } {
  174.             continue
  175.             }
  176.             set ip [$wi properties]
  177.             if [$ip isNil] {
  178.             continue
  179.             }
  180.             foreach prop [$ip properties] {
  181.             set newRecord [AttributeRecord new $wi [$prop name] \
  182.                                [$prop value]]
  183.             lappend AttributeList $newRecord
  184.             }
  185.         }
  186.         }
  187.     }
  188.     }
  189. }
  190.  
  191.  
  192. proc fillTableCompattr {} {
  193.     global CompattrList
  194.     set CompattrList {}
  195.     foreach configV [allConfigVersions] {
  196.     foreach phaseV [allPhaseVersions $configV] {
  197.         foreach systemV [allSystemVersions $phaseV] {
  198.         foreach diagram [query "{isA Diagram} == 1" \
  199.                     [allFileVersions $systemV]] {
  200.             foreach comp [$diagram components] {
  201.             foreach prop [$comp properties] {
  202.                 set newRecord [CompattrRecord new $comp \
  203.                                   [$prop name] \
  204.                                   [$prop value]]
  205.                 lappend CompattrList $newRecord
  206.             }
  207.             }
  208.         }
  209.         }
  210.     }
  211.     }
  212. }
  213.  
  214.  
  215. proc fillTableDescription {} {
  216.     global DescriptionList
  217.     set DescriptionList {}
  218.     foreach configV [allConfigVersions] {
  219.     foreach phaseV [allPhaseVersions $configV] {
  220.         foreach systemV [allSystemVersions $phaseV] {
  221.         foreach wi [$systemV definedItems] {
  222.             set newRecord [DescriptionRecord new $configV $phaseV \
  223.             $systemV "" $wi]
  224.             lappend DescriptionList $newRecord
  225.         }
  226.  
  227.         foreach fileV [allFileVersions $systemV] {
  228.             set newRecord [DescriptionRecord new $configV $phaseV \
  229.             $systemV $fileV ""]
  230.             lappend DescriptionList $newRecord
  231.         }
  232.         }
  233.     }
  234.     }
  235. }
  236.  
  237.  
  238.  
  239.  
  240. # procs only used in this file
  241. #
  242. proc allConfigVersions {} {
  243.     switch -exact $CurrentLevel {
  244.     File      { return $ConfigVersion }
  245.     System    { return $ConfigVersion }
  246.     Phase     { return $ConfigVersion }
  247.     Config    { return $ConfigVersion }
  248.     Project   { return [$Project configVersions] }
  249.     default   { return [query -s projects.configVersions $Corporate] }
  250.     }
  251. }
  252.  
  253. proc allPhaseVersions {configV} {
  254.     switch -exact $CurrentLevel {
  255.     File      { return $PhaseVersion }
  256.     System    { return $PhaseVersion }
  257.     Phase     { return $PhaseVersion }
  258.     default   { return [$configV phaseVersions] }
  259.     }
  260. }
  261.  
  262.  
  263. proc allSystemVersions {phaseV} {
  264.     switch -exact $CurrentLevel {
  265.     File      { return $SystemVersion }
  266.     System    { return $SystemVersion }
  267.     default   { return [$phaseV systemVersions] }
  268.     }
  269. }
  270.  
  271.  
  272. proc allFileVersions {systemV} {
  273.     switch -exact $CurrentLevel {
  274.     File      { return $FileVersion }
  275.     default   { return [$systemV localFileVersions] }
  276.     }
  277. }
  278.