home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
msumlexport.tcl
< prev
next >
Wrap
Text File
|
1997-06-03
|
4KB
|
122 lines
source [m4_path_name tcl cginit.tcl]
set msHome [m4_var get M4_home]
set msHome [path_name concat $msHome contrib]
set msHome [path_name concat $msHome ObjectTeamMsRepUml]
source $msHome/tcl/msumlsumma.tcl
source $msHome/tcl/msumlnamed.tcl
source $msHome/tcl/msumleleme.tcl
source $msHome/tcl/msumlassoc.tcl
source $msHome/tcl/msumltypee.tcl
source $msHome/tcl/msumlassro.tcl
source $msHome/tcl/msumlmembe.tcl
source $msHome/tcl/msumlattri.tcl
source $msHome/tcl/msumlopera.tcl
source $msHome/tcl/msumlparam.tcl
source $msHome/tcl/msumlgenel.tcl
source $msHome/tcl/msumltype.tcl
source $msHome/tcl/msumlclass.tcl
source $msHome/tcl/msumlgener.tcl
source $msHome/tcl/msumlmodel.tcl
source $msHome/tcl/msumlpacka.tcl
set rep [OleAutoObject new ObjectTeamMsRepUml.MSRepository]
set repFound 1
if [catch {set root [$rep openDB [lindex $argv 0]]}] {
set repFound 0
}
if !$repFound {
puts "Repository is closed"
return
}
set cc [ClientContext::global]
set cv [$cc currentConfig]
set sv [$cc currentSystem]
OTShRegister::semanticModel
set systemIds [lrange $argv 2 end]
set modelName [lindex $argv 1]
set svs ""
if [llength $systemIds] {
foreach systemId $systemIds {
lappend svs [SystemVersion new $systemId]
}
} elseif ![$sv isNil] {
set svs $sv
}
puts "Starting to export model '$modelName'"
global trans
set trans [[$rep property msObject] property transaction]
set msUMLModel [MSUMLModel new UMLModel $trans]
set umlModel [$msUMLModel ot2ms $root $modelName]
set smModelDict [Dictionary new]
foreach sv $svs {
$smModelDict set $sv [SMSystemModel new $cv $sv]
}
$msUMLModel dictOfSMModels $smModelDict
set externals ""
set doneClasses ""
$trans begin
$smModelDict foreach sv smModel {
set s [$sv system]
puts "Package '[$s name]'"
set umlPackage${sv} [$umlModel createPackage [$s name]]
}
$trans commit
set smClassType [SMTypeDB::find "Class"]
$smModelDict foreach sv smModel {
set smClassObjects [$smModel getSMObjects $smClassType]
set classToMS [$msUMLModel otclass2ms $smClassObjects $smModel [set umlPackage${sv}] $sv]
set doneClasses "$doneClasses [lindex $classToMS 0]"
set externals "$externals [lindex $classToMS 1]"
}
if [llength $externals] {
puts "Exporting package 'Stubs (Externals)'"
set dictOfClasses [$msUMLModel dictOfClasses]
set umlPackage ""
foreach extSMClass $externals {
set definingSysV [$extSMClass getDefiningSystemVersion]
set smModel [$smModelDict set $definingSysV]
if [llength $smModel] {
#available in one of the other packages
set item [$extSMClass getItem]
set defSMClass [$smModel getNamedSMObjects $smClassType $item]
$dictOfClasses set $extSMClass [$dictOfClasses set $defSMClass]
} else {
# not in one of the selected system versions defined
set msumlClass [MSUMLClass new UMLClass $extSMClass ]
$dictOfClasses set $extSMClass $msumlClass
if ![llength $umlPackage] {
$trans begin
set umlPackage [$umlModel createPackage Stubs]
$trans commit
}
$msumlClass ot2ms $umlPackage
}
}
}
set smGenNodeType [SMTypeDB::find "CAD CB Generalization"]
set smAssocType [SMTypeDB::find "CAD CB Association"]
puts "Exporting generalizations and associations"
$smModelDict foreach sv smModel {
set smGenNodes [$smModel getSMObjects $smGenNodeType]
$msUMLModel otgen2ms $smGenNodes [set umlPackage${sv}]
set smAssocs [$smModel getSMObjects $smAssocType]
$msUMLModel otass2ms $smAssocs [set umlPackage${sv}]
}
puts "Exporting model to '$modelName' finished"
$smModelDict foreach sv model {
$model delete
}