Update of /cvsroot/pymerase/pymerase/pymerase/input
In directory sc8-pr-cvs1:/tmp/cvs-serv6598
Modified Files:
parseXMI.py
Log Message:
Changed to be complient with new SMW package which does a better job
of importing 1.3 models into 1.4? (or perhaps I just don't have a test
1.3 model...) It did seem need to specify the the UML model to import.
Also added a test to PymeraseTypes to skip over converting types to
classes in the model if they're ones that are "native" language
types. e.g. integers, floats, strings.
Index: parseXMI.py
===================================================================
RCS file: /cvsroot/pymerase/pymerase/pymerase/input/parseXMI.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** parseXMI.py 25 Apr 2003 23:53:41 -0000 1.16
--- parseXMI.py 7 May 2003 21:50:41 -0000 1.17
***************
*** 312,315 ****
--- 312,322 ----
# if this attribute is actually a defined class create an association to it
attributeType = attribute.getType()
+ # check to see if our type is one of the "standard" types
+ # so we don't try turning it into an association
+ # FIXME: the type system of pymerase desperatly needs to be reworked.
+
+ if attributeType.isNativeType(language="python"):
+ return
+
otherEndType = classesInModel.get(attributeType.getTypeString(), None)
if otherEndType is not None:
***************
*** 539,556 ****
"""Convert external UML model to pymerase's model classes.
"""
!
! if isinstance(model, UML14.Model):
! umlClass = UML14.Class
! uml = uml14Parser(pymeraseConfig)
! elif isinstance(model, UML13.Model):
! umlClass = UML13.Class
! uml = uml13Parser(pymeraseConfig)
! else:
! raise ValueError("Pymerase only supports UML 1.3 and 1.4 metamodel")
classes = filter(lambda c: isinstance(c, umlClass), model.ownedElement)
for xmiClass in classes:
! parsedClass = uml.parseXMIClass(classesInModel, xmiClass)
if parsedClass is not None:
classesInModel[parsedClass.getName(None)] = parsedClass
--- 546,556 ----
"""Convert external UML model to pymerase's model classes.
"""
! umlClass = UML14.Class
! umlParser = uml14Parser(pymeraseConfig)
classes = filter(lambda c: isinstance(c, umlClass), model.ownedElement)
for xmiClass in classes:
! parsedClass = umlParser.parseXMIClass(classesInModel, xmiClass)
if parsedClass is not None:
classesInModel[parsedClass.getName(None)] = parsedClass
***************
*** 569,573 ****
base, ext = os.path.splitext(filename)
! model = loadModel(source)
objects = parseXMI(pymeraseConfig, model, classesInModel)
--- 569,573 ----
base, ext = os.path.splitext(filename)
! model = loadModel(source, UML14)
objects = parseXMI(pymeraseConfig, model, classesInModel)
|