home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
reportbase.tcl
< prev
next >
Wrap
Text File
|
1996-11-20
|
6KB
|
239 lines
#---------------------------------------------------------------------------
#
# (c) Cadre Technologies Inc. 1995
#
# File: @(#)reportbase.tcl /main/hindenburg/3
# Author: Harm Leijendeckers
# Description: Base of all report classes
#
#---------------------------------------------------------------------------
# SccsId = @(#)reportbase.tcl /main/hindenburg/3 20 Nov 1996 Copyright 1995 Cadre Technologies Inc.
Class ReportBase : {GCObject} {
method destructor
constructor
method setHeader
method setFooter
method corporateReport
method projectReport
method configReport
method phaseReport
method systemReport
method fileReport
method levelError
method execute
attribute corporate
attribute project
attribute configV
attribute phaseV
attribute systemV
attribute fileV
attribute report
attribute reportName
attribute logo1
attribute logo2
attribute logo3
attribute logo4
}
constructor ReportBase {class this} {
set this [GCObject::constructor $class $this]
$this report [Report new]
$this reportName unknown
$this logo1 ""
$this logo2 "ObjectTeam"
$this logo3 [versionInfo majorVersion].[versionInfo minorVersion].[versionInfo maintVersion]
$this logo4 ""
return $this
}
method ReportBase::destructor {this} {
[$this report] delete
}
method ReportBase::setHeader {this} {
# set a file-version header if on context level file
if ![[$this fileV] isNil] {
[$this report] header {
set report [$this report]
$report print - 131 fill line
$report print [$this logo1] 13 center break
$report print "| "
$report print "Report : [$this reportName]" 57
$report print "Date : [$report date]" line
$report print [$this logo2] 13 center break
$report print "| "
$report space 57
$report print "Creator :\
[[[$this corporate] currentUser] name]" line
$report print [$this logo3] 13 center break
$report print "| "
$report print "Project : [[$this project] name]" 57
$report print "System Version:\
[[[$this systemV] system] name].[[$this systemV] versionName]"
$report line
$report print [$this logo4] 13 center break
$report print "| "
$report print "Phase Version:\
[[[$this phaseV] phase] name].[[$this phaseV] versionName]" 57
$report print "File Version :\
[[[$this fileV] file] qualifiedName].[[[$this fileV] file] \
type].[[$this fileV] versionName]"
$report line
$report print - 131 fill line
$report line
}
return
}
# header for levels project, configuration, phase and system
[$this report] header {
set report [$this report]
$report print - 131 fill line
$report print [$this logo1] 13 center break
$report print "| "
$report print "Report : [$this reportName]" 57
$report print "Date : [$report date]" line
$report print [$this logo2] 13 center break
$report print "| "
$report space 57
$report print "Creator :\
[[[$this corporate] currentUser] name]" line
$report print [$this logo3] 13 center break
$report print "| "
if ![[$this project] isNil] {
$report print "Project :\
[[$this project] name]" 57
if ![[$this phaseV] isNil] {
$report print "Phase Version :\
[[[$this phaseV] phase] name].[[$this phaseV] versionName]"
}
}
$report line
$report print [$this logo4] 13 center break
$report print "| "
if ![[$this configV] isNil] {
$report print "Configuration Version:\
[[[$this configV] config] name].[[$this configV] versionName]" 57
if ![[$this systemV] isNil] {
$report print "System Version:\
[[[$this systemV] system] name].[[$this systemV] versionName]"
}
}
$report line
$report print - 131 fill line
$report line
}
}
method ReportBase::setFooter {this} {
[$this report] footer {
[$this report] line
[$this report] print "- [[$this report] pageno] -" 131 center line
}
}
method ReportBase::corporateReport {this} {
foreach project [osort name [[$this corporate] projects]] {
$this project $project
if { [$this projectReport] == -1 } {
return -1
}
}
return 0
}
method ReportBase::projectReport {this} {
foreach configV [osort config.name versionNumber -versnum \
[[$this project] configVersions]] {
$this configV $configV
if { [$this configReport] == -1 } {
return -1
}
}
return 0
}
method ReportBase::configReport {this} {
foreach phaseV [[$this configV] phaseVersions] {
$this phaseV $phaseV
if { [$this phaseReport] == -1 } {
return -1
}
}
return 0
}
method ReportBase::phaseReport {this} {
foreach systemV [osort system.name versionNumber -versnum \
[query "system.type == system" [[$this phaseV] systemVersions]]] {
$this systemV $systemV
if { [$this systemReport] == -1 } {
return -1
}
}
return 0
}
method ReportBase::systemReport {this} {
foreach fileV [osort file.type file.name versionNumber -versnum \
[[$this systemV] localFileVersions]] {
$this fileV $fileV
if { [$this fileReport] == -1 } {
return -1
}
}
return 0
}
method ReportBase::fileReport {this} {
$this levelError
return -1
}
method ReportBase::levelError {this} {
[$this report] print "This report cannot be executed on context "
[$this report] print "level [[ClientContext::global] currentLevel]"
[$this report] line
}
method ReportBase::execute {this} {
set cc [ClientContext::global]
$this corporate [$cc currentCorporate]
$this project [$cc currentProject]
$this configV [$cc currentConfig]
$this phaseV [$cc currentPhase]
$this systemV [$cc currentSystem]
$this fileV [$cc currentFile]
$this setHeader
$this setFooter
case [$cc currentLevel] in {
Corporate { $this corporateReport }
Project { $this projectReport }
Config { $this configReport }
Phase { $this phaseReport }
System { $this systemReport }
File { $this fileReport }
default { $this levelError }
}
}