home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1997
- #
- # File: @(#)drssmmodel.tcl /main/titanic/4
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)drssmmodel.tcl /main/titanic/4 29 Aug 1997 Copyright 1997 Cayenne Software Inc.
-
- # Start user added include file section
- require reqdriver.tcl
- # End user added include file section
-
-
- Class DrsSMModelObject : {Object} {
- method destructor
- constructor
- method initializeSM
- method getItemDefs
- method getSMObjects
- method getSMModel
- method getChildObjects
- method localDefined
- method installRefs
- method showClassFeatures
- method showSMObjects
- attribute childObjects
- attribute smObjects
- attribute itemDefs
- attribute initializedSM
- attribute smModel
- }
-
- method DrsSMModelObject::destructor {this} {
- # Start destructor user section
- if {[$this initializedSM] && [llength [$this smModel]]} {
- [$this smModel] delete
- }
- # End destructor user section
- }
-
- constructor DrsSMModelObject {class this levelVersions} {
- set this [GCObject::constructor $class $this]
- # Start constructor user section
- OtkRegister::semanticModel
- $this levelVersions $levelVersions
- $this initializedSM 0
- # End constructor user section
- return $this
- }
-
- method DrsSMModelObject::initializeSM {this} {
- [.main messageArea] message "Loading Semantic Model ..."
- set level [$this level]
- set childObjects ""
- set itemDefs ""
- set smObjects ""
-
- set configV [$this getConfigVersion]
- set levelV [$level selectedVersion $configV]
- set levelVersions [$this levelVersions]
- if {[$configV isNil] || [$levelV isNil]} {
- $this initializedSM 1
- return $this
- }
- if {[[$this getPhase] name] == "Implementation"} {
- $this initializedSM 1
- return $this
- }
-
- GCControl collect
- set smModel [$this getSMModel]
- $this smModel $smModel
- set smTypeNames [m4_var get M4_doors_semantic_types]
- if ![llength $smTypeNames] {
- set smTypeNames {Class "UCD UseCase"}
- m4_var set M4_doors_semantic_types $smTypeNames
- m4_var saveStatus M4_doors_semantic_types 0
- }
- foreach smRealTypeName $smTypeNames {
- set smType [SMTypeDB::find $smRealTypeName]
- if [$smType isNil] {
- continue
- }
- set smTypeName [ReqDriver::getSMTypeName $smType]
- foreach smNode [$smModel getSMObjects $smType] {
- set workItem [$smNode getWorkItem]
- if [$workItem isNil] {
- continue
- }
- set systemV [$workItem owner]
- set system [$systemV system]
- if [$this localDefined $workItem] {
- lappend childObjects [$smNode getWorkItem].$smTypeName
- lappend itemDefs [$smNode getWorkItem].$smTypeName
- lappend smObjects $smNode
- }
- }
- }
- $this childObjects $childObjects
- $this itemDefs $itemDefs
- $this smObjects $smObjects
- $this initializedSM 1
- }
-
- method DrsSMModelObject::getItemDefs {this} {
- if ![$this initializedSM] {
- $this initializeSM
- }
- return [$this itemDefs]
- }
-
- method DrsSMModelObject::getSMObjects {this} {
- if ![$this initializedSM] {
- $this initializeSM
- }
- return [$this smObjects]
- }
-
- method DrsSMModelObject::getSMModel {this} {
- set smModel [$this smModel]
- if [llength $smModel] {
- return $smModel
- }
- set level [$this level]
- set configV [$this getConfigVersion]
- set levelV [$level selectedVersion $configV]
- set smModel [SM[$level ORB_class]Model new $configV $levelV]
- $this smModel $smModel
- return $smModel
- }
-
- method DrsSMModelObject::getChildObjects {this} {
- if ![$this initializedSM] {
- $this initializeSM
- }
- return [$this childObjects]
- }
-
- method DrsSMModelObject::localDefined {this workItem} {
- set localSysV [[ClientContext::global] currentSystem]
- if [$localSysV isNil] {
- return 1
- }
- set owner [$workItem owner]
- if [$owner isA Graph] {
- return 1
- }
- return [$owner isSame $localSysV]
- }
-
- method DrsSMModelObject::installRefs {this} {
- set dxlCommand ""
- set parentLevelId [$this parentLevelId]
- foreach smObject [$this getSMObjects] {
- set workItem [$smObject getWorkItem]
- set systemV [$workItem owner]
- if [$systemV isA Graph] {
- # scope is diagram
- set graph $systemV
- set system [$graph system]
- set systemV [$system selectedVersion [$this getConfigVersion]]
- } else {
- set system [$systemV system]
- }
- set drsItem [DrsSMItemObject new $smObject $system [ReqDriver::getVersion $systemV]]
- $drsItem dxlCommand $dxlCommand
- set dxlResult [$drsItem install]
- if ![llength $dxlResult] {
- return
- }
- }
- return "1"
- }
-
- method DrsSMModelObject::showClassFeatures {this majorOper minorOper} {
- set confV [$this getConfigVersion]
- set dxlCommand [$this dxlCommand]
- foreach smObject [$this getSMObjects] {
- set workItem [$smObject getWorkItem]
- set item [$smObject getItem]
- set systemV [$workItem owner]
- if ![$systemV isA SystemVersion] {
- # non class items
- continue
- }
- set matrix [$systemV findFileVersion -byItemAndType $item cdm]
- if [$matrix isNil] {
- continue
- }
- $matrix loadRowData "name_type" rows
- set file [$matrix file]
- foreach rowData $rows {
- foreach item [lindex $rowData 1] {
- set workItem [$systemV findDefinition $item $confV]
- set itemType [$item type]
- if {$itemType == "de" || $itemType == "pe"} {
- set drsQItem [DrsQItemObject new $workItem \
- $file [ReqDriver::getVersion $matrix]]
- $drsQItem qualifier [$item qualifier]
- $drsQItem dxlCommand $dxlCommand
- $drsQItem filter $majorOper $minorOper
- }
- }
- }
- }
- }
-
- method DrsSMModelObject::showSMObjects {this majorOper minorOper} {
- set dxlCommand [$this dxlCommand]
- foreach smObject [$this getSMObjects] {
- set workItem [$smObject getWorkItem]
- set systemV [$workItem owner]
- if [$systemV isA Graph] {
- # scope is diagram
- set graph $systemV
- set system [$graph system]
- set systemV [$system selectedVersion [$this getConfigVersion]]
- } else {
- set system [$systemV system]
- }
- set drsItem [DrsSMItemObject new $smObject $system [ReqDriver::getVersion $systemV]]
- $drsItem dxlCommand $dxlCommand
- $drsItem filter $majorOper $minorOper
- }
-
- }
-
- # Do not delete this line -- regeneration end marker
-
-