home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
msumlexport.tcl
< prev
next >
Wrap
Text File
|
1997-10-03
|
3KB
|
119 lines
source [m4_path_name tcl cginit.tcl]
require msumlsumma.tcl
require msumlnamed.tcl
require msumleleme.tcl
require msumlassoc.tcl
require msumltypee.tcl
require msumlassro.tcl
require msumlmembe.tcl
require msumlattri.tcl
require msumlopera.tcl
require msumlparam.tcl
require msumlgenel.tcl
require msumltype.tcl
require msumlclass.tcl
require msumlgener.tcl
require msumlmodel.tcl
require 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 "Could not open Repository."
puts "Not enough memory, try again."
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
}