home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / t_file.tcl < prev    next >
Text File  |  1996-06-03  |  7KB  |  261 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #    (c) Cadre Technologies Inc. 1995
  4. #
  5. #    File:        %W%
  6. #    Author:        Challenger
  7. #    Description:    Implementation of old Report Writer table File
  8. #
  9. #---------------------------------------------------------------------------
  10. # SccsId = %W%    %G%    Copyright 1995 Cadre Technologies Inc.
  11.  
  12.  
  13. constructor FileRecord {class this configVersion phaseVersion systemVersion \
  14.             fileVersion} {
  15.     set this [GCObject::constructor $class $this]
  16.  
  17.     set system [$systemVersion system]
  18.     set phase [$phaseVersion phase]
  19.  
  20.     if ![$fileVersion isNil] {
  21.     set file [$fileVersion file]
  22.     }
  23.  
  24.     # extra attributes
  25.     #
  26.  
  27.     if ![$fileVersion isNil] {
  28.     $this _file $file
  29.     $this _fileVersion $fileVersion
  30.     }
  31.  
  32.     $this _configVersion $configVersion
  33.     $this _objtype ""
  34.     $this _reference ""
  35.     $this _link ""
  36.  
  37.     $this project_version [$configVersion versionNumber]
  38.     $this phase_version [$phaseVersion versionNumber]
  39.     $this phase_id [$phase identity]
  40.     $this system_version [$systemVersion versionNumber]
  41.     $this system_id [$system identity]
  42.     if ![$fileVersion isNil] {
  43.     $this file_id [$file identity]
  44.     $this file_version [$fileVersion versionNumber]
  45.     $this name [$file name]
  46.     $this item_id [[$file item] identity]
  47.     $this file_type [$file type]
  48.     $this working [expr {[$fileVersion status] == "working"}]
  49.     $this status [expr { [$fileVersion status] == "working"
  50.         ? "Unfrozen" : "Frozen" }]
  51.     $this check_status [$fileVersion getPropertyValue check_status]
  52.     $this frz_time [fmtclock [$fileVersion freezeTime] "%e-%h-%Y %X"]
  53.     $this comment [$fileVersion comments]
  54.     }
  55.     $this link_desc_id ""
  56.     $this link_desc_type ""
  57.     $this backup_version ""
  58.  
  59.     return $this
  60. }
  61.  
  62. method FileRecord::qualifier {this} {
  63.     set qual [[[$this _file] item] qualifier]
  64.     if ![$qual isNil] {
  65.     return [$qual name]
  66.     }
  67.     return ""
  68. }
  69.  
  70. method FileRecord::qualifier_id {this} {
  71.     set qual [[[$this _file] item] qualifier]
  72.     if ![$qual isNil] {
  73.     return [$qual identity]
  74.     }
  75.  
  76.     return 0
  77. }
  78.  
  79. method FileRecord::link_to_system {this} {
  80.     if { [$this _objtype] != "reference" } {
  81.     return ""
  82.     }
  83.     return [[[$this _reference] referredSystem] name]
  84. }
  85.  
  86. method FileRecord::link_to_file {this} {
  87.     if { [$this _objtype] != "reference" } {
  88.     return ""
  89.     }
  90.     return [[[$this _reference] referredFile] name]
  91. }
  92.  
  93. method FileRecord::link_type {this} {
  94.     if { [$this _objtype] == "local" } {
  95.     return "no link"
  96.     }
  97.     if { [$this _objtype] == "reference" } {
  98.     return "symbolic link"
  99.     }
  100.     if { [$this _objtype] == "link" } {
  101.     return "external link"
  102.     }
  103.  
  104.     return ""
  105. }
  106.  
  107. method FileRecord::link_status {this} {
  108.     if { [$this _objtype] != "reference" } {
  109.     return ""
  110.     }
  111.     if [$this working] {
  112.     return working
  113.     } else {
  114.     return fixed
  115.     }
  116. }
  117.  
  118. method FileRecord::link_phase_id {this} {
  119.     if { [$this _objtype] != "reference" } {
  120.     return ""
  121.     }
  122.     return [[[[$this _reference] referredSystem] phase] identity]
  123. }
  124.  
  125. method FileRecord::link_phase_name {this} {
  126.     if { [$this _objtype] != "reference" } {
  127.     return ""
  128.     }
  129.     return [[[[$this _reference] referredSystem] phase] name]
  130. }
  131.  
  132. method FileRecord::link_phase_version {this} {
  133.     if { [$this _objtype] != "reference" } {
  134.     return ""
  135.     }
  136.     return [[[[$this _reference] referredSystem] phase] \
  137.                 selectedVersion [$reference referredConfigVersion]]
  138. }
  139.  
  140. method FileRecord::link_system_id {this} {
  141.     if { [$this _objtype] != "reference" } {
  142.     return ""
  143.     }
  144.     return [[[$this _reference] referredSystem] identity]
  145. }
  146.  
  147. method FileRecord::link_system_name {this} {
  148.     if { [$this _objtype] != "reference" } {
  149.     return ""
  150.     }
  151.     return [[[$this _reference] referredSystem] name]
  152. }
  153.  
  154. method FileRecord::link_system_version {this} {
  155.     if { [$this _objtype] != "reference" } {
  156.     return ""
  157.     }
  158.     return [[[$this _reference] referredSystem] selectedVersion \
  159.                         [$reference referredConfigVersion]]
  160. }
  161.  
  162. method FileRecord::link_file_id {this} {
  163.     if { [$this _objtype] != "reference" } {
  164.     return ""
  165.     }
  166.     return [[[$this _reference] referredFile] identity]
  167. }
  168.  
  169. method FileRecord::link_file_name {this} {
  170.     if { [$this _objtype] != "reference" } {
  171.     return ""
  172.     }
  173.     return [[[$this _reference] referredFile] name]
  174. }
  175.  
  176. method FileRecord::link_file_version {this} {
  177.     if { [$this _objtype] != "reference" } {
  178.     return ""
  179.     }
  180.     set reffilev [[$this _reference] referredFileVersion]
  181.     if ![$reffilev isNil] {
  182.     return [$reffilev versionNumber]
  183.     } else {
  184.     return -1
  185.     }
  186. }
  187.  
  188. method FileRecord::link_file_type {this} {
  189.     if { [$this _objtype] != "reference" } {
  190.     return ""
  191.     }
  192.     return [[[$this _reference] referredFile] type]
  193. }
  194.  
  195. method FileRecord::link_item_id {this} {
  196.     if { [$this _objtype] != "reference" } {
  197.     return ""
  198.     }
  199.     return [[[[$this _reference] referredFile] item] identity]
  200. }
  201.  
  202. method FileRecord::link_item_name {this} {
  203.     if { [$this _objtype] != "reference" } {
  204.     return ""
  205.     }
  206.     return [[[[$this _reference] referredFile] item] name]
  207. }
  208.  
  209. method FileRecord::link_item_type {this} {
  210.     if { [$this _objtype] != "reference" } {
  211.     return ""
  212.     }
  213.     return [[[[$this _reference] referredFile] item] type]
  214. }
  215.  
  216. method FileRecord::link_item_scope {this} {
  217.     if { [$this _objtype] != "reference" } {
  218.     return ""
  219.     }
  220.     if ![[[[[$this _reference] referredFile] item] qualifier] isNil] {
  221.     return qualified
  222.     } else {
  223.     set scope [[[[$this _reference] referredFile] item] scope]
  224.     return [old2newscope $scope]
  225.     }
  226.     return ""
  227. }
  228.  
  229. method FileRecord::section_type {this} {
  230.     if { [$this _objtype] == "local" } {
  231.     if { [[$this _file] type] == "dsm" } {
  232.         return [[$this _fileVersion] getPropertyValue SECTIONTYPE]
  233.     }
  234.     return ""
  235.     }
  236.     if { [$this _objtype] == "reference" } {
  237.     return [[$this _reference] getPropertyValue SECTIONTYPE]
  238.     }
  239.  
  240.     return ""
  241. }
  242.  
  243.  
  244. method FileRecord::file_path {this} {
  245.     if { [$this _objtype] == "local" } {
  246.     if [[$this _fileVersion] isA ExternalFileVersion] {
  247.         set extfilv [ExternalFileVersion new \
  248.                         [[$this _fileVersion] identity]]
  249.         if ![$extfilv isNil] {
  250.         return [$extfilv path [$this _configVersion]]
  251.         }
  252.     }
  253.     }
  254.  
  255.     if { [$this _objtype] == "link" } {
  256.     return [[$this _link] path]
  257.     }
  258.  
  259.     return ""
  260. }
  261.