home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
drslinkabl.tcl
< prev
next >
Wrap
Text File
|
1997-09-23
|
6KB
|
169 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)drslinkabl.tcl /main/titanic/5
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)drslinkabl.tcl /main/titanic/5 23 Sep 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
# End user added include file section
require "drslevelob.tcl"
Class DrsLinkableObject : {DrsLevelObject} {
constructor
method destructor
method isIntegrated
method lock
method saveReference
method linkToPrevPhase
attribute locked
}
constructor DrsLinkableObject {class this level levelVersion pLevel pVersion} {
set this [DrsLevelObject::constructor $class $this $level $levelVersion $pLevel $pVersion]
# Start constructor user section
$this locked 0
# End constructor user section
return $this
}
method DrsLinkableObject::destructor {this} {
# Start destructor user section
# End destructor user section
$this DrsLevelObject::destructor
}
method DrsLinkableObject::isIntegrated {this doorsObjId} {
if ![llength $doorsObjId] {
return 0
}
set level [$this getPropertyObject]
set intPhase [$level getPropertyValue ${DrsDriver::FORMALMODULE}_Phase]
if ![llength $intPhase] {
return 0
}
set intProject [$level getPropertyValue ${DrsDriver::FORMALMODULE}_Project]
if ![llength $intProject] {
return 0
}
set currPhase [$this getPhase]
set currPhaseName [$currPhase name]
if {$intPhase != $currPhaseName} {
return 0
}
set currProjName [[$currPhase project] name]
if {$intProject != $currProjName} {
set timeStampObj [$this getTimeStampObject]
set currTime [$timeStampObj updateTime]
set intTime [$level getPropertyValue ${DrsDriver::FORMALMODULE}_TIMESTAMP]
if {$currTime > [expr $intTime + 5]} {
$level setProperty ${DrsDriver::FORMALMODULE}_Project $currProjName
return 0
}
}
return 1
}
method DrsLinkableObject::lock {this} {
set propObj [$this getPropertyObject]
set intPhase [$propObj getPropertyValue ${DrsDriver::FORMALMODULE}_Phase]
set currPhase [$this getPhase]
set currPhaseName [$currPhase name]
if {$intPhase == $currPhaseName} {
set intProject [$propObj getPropertyValue ${DrsDriver::FORMALMODULE}_Project]
set currProjName [[$currPhase project] name]
if {[llength $intProject] && $intProject == $currProjName} {
# The current linkable object is already available in DOORS
return 1
}
}
set levelV [$this getLevelV]
if {[$levelV isA FileVersion] && [$levelV status] != "working"} {
return 0
}
set thisLevel [$this level]
if [$thisLevel isA WorkItem] {
set owner [$thisLevel owner]
if {[$owner status] != "working"} {
return 0
}
}
set cc [ClientContext::global]
set currentFile [$cc currentFile]
$this locked 1
if {$levelV != $currentFile } {
# don't lock the current file if in edit mode
$levelV edit
$levelV quit
}
return 1
}
method DrsLinkableObject::saveReference {this level drsRef parOTVers selIts} {
$this DrsLevelObject::saveReference $level $drsRef $parOTVers $selIts
set level [$this getPropertyObject]
set phase [$this getPhase]
set phaseName [$phase name]
set project [$phase project]
set projectName [$project name]
$level setProperty ${DrsDriver::FORMALMODULE}_Phase $phaseName
$level setProperty ${DrsDriver::FORMALMODULE}_Project $projectName
if ![$this locked] {
return
}
set levelV [$this getLevelV]
if [llength $levelV] {
# only file versions and system versions
set drsRef [lindex $drsRef 0]
$levelV setProperty ${DrsDriver::FORMALMODULE} $drsRef
$levelV setProperty ${DrsDriver::FORMALMODULE}_Phase $phaseName
$levelV setProperty ${DrsDriver::FORMALMODULE}_Project $projectName
}
}
method DrsLinkableObject::linkToPrevPhase {this levelVObjId newDoorsObject} {
set levelV [$this getLevelV]
set linkedInPhase [$levelV getPropertyValue ${DrsDriver::FORMALMODULE}_Phase]
set phase [$this getPhase]
set phaseName [$phase name]
if {$phaseName != "Implementation" && $linkedInPhase == $phaseName} {
return
}
set projectName [[$phase project] name]
set linkedInProject [$levelV getPropertyValue ${DrsDriver::FORMALMODULE}_Project]
if {$phaseName != "Implementation" && $linkedInProject != $projectName} {
return
}
set dxlCommand [$this dxlCommand]
set prevPhase [$phase previous]
if ![$prevPhase isNil] {
#check whether to link from previous to current
if {$phaseName == "Implementation" || [$prevPhase name] == $linkedInPhase} {
set prevPhaseObj [$dxlCommand doorsObjectFind $levelVObjId]
$dxlCommand doorsObjectCreateLink $newDoorsObject $prevPhaseObj\
[m4_var get M4_doors_trace_link_module]
}
}
set nextPhase [$phase next]
if ![$nextPhase isNil] {
#check whether to link from current to next
if {[$nextPhase name] == $linkedInPhase} {
set nextPhaseObj [$dxlCommand doorsObjectFind $levelVObjId]
$dxlCommand doorsObjectCreateLink $nextPhaseObj $newDoorsObject\
[m4_var get M4_doors_trace_link_module]
}
}
}
# Do not delete this line -- regeneration end marker