|
From: <de...@us...> - 2003-06-16 07:53:29
|
Update of /cvsroot/pymerase/pymerase/pymerase/input
In directory sc8-pr-cvs1:/tmp/cvs-serv13305
Modified Files:
parseXMI.py
Log Message:
Hopefully I now have all of the class construction code properly
initializing the UUID field.
Even though it's currently only the raw name, this does avoid issues with
the name mangler getting confused and creating duplicate class naems.
Index: parseXMI.py
===================================================================
RCS file: /cvsroot/pymerase/pymerase/pymerase/input/parseXMI.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** parseXMI.py 29 May 2003 07:20:08 -0000 1.19
--- parseXMI.py 16 Jun 2003 07:53:26 -0000 1.20
***************
*** 45,48 ****
--- 45,49 ----
import os
+ import pprint
import re
import string
***************
*** 311,327 ****
continue
! # Map type name to UUID:
! for uuid, classModel in classesInModel.items():
! if attributeType.getTypeString() == classModel.name:
! attributeUUID = uuid
! break
! else:
! warn("In %s couldn't find %s" % (
! thisEndType.getName(None),
! attributeType.getTypeString()),
! RuntimeWarning)
!
!
! otherEndType = classesInModel.get(attributeUUID, None)
if otherEndType is not None:
#print "NEED to convert %s to relation" % (attributeType)
--- 312,328 ----
continue
! # # Map type name to UUID:
! # for uuid, classModel in classesInModel.items():
! # if attributeType.getTypeString() == classModel.name:
! # attributeUUID = uuid
! # break
! # else:
! # warn("In %s couldn't find %s" % (
! # thisEndType.getName(None),
! # attributeType.getTypeString()),
! # RuntimeWarning)
! #
! otherEndType = classesInModel.get(attribute.getUUID(), None)
!
if otherEndType is not None:
#print "NEED to convert %s to relation" % (attributeType)
***************
*** 415,419 ****
classMetaInfo = classesInModel.setdefault(UUID,
XMIClassMetaInfo(self.pymeraseConfig, name))
!
classMetaInfo.setAbstract(xmiClass.isAbstract)
classMetaInfo.setPackage(xmiClass.namespace.name)
--- 416,420 ----
classMetaInfo = classesInModel.setdefault(UUID,
XMIClassMetaInfo(self.pymeraseConfig, name))
! classMetaInfo.setUUID(UUID)
classMetaInfo.setAbstract(xmiClass.isAbstract)
classMetaInfo.setPackage(xmiClass.namespace.name)
***************
*** 421,428 ****
for generalization in xmiClass.generalization:
baseClassName = generalization.parent.name
! baseClassUUID = self.getUUID(generalization)
baseClassRef = classesInModel.setdefault(baseClassUUID,
XMIClassMetaInfo(self.pymeraseConfig,
baseClassName))
classMetaInfo.appendBaseClass(baseClassRef)
--- 422,430 ----
for generalization in xmiClass.generalization:
baseClassName = generalization.parent.name
! baseClassUUID = self.getUUID(generalization.parent)
baseClassRef = classesInModel.setdefault(baseClassUUID,
XMIClassMetaInfo(self.pymeraseConfig,
baseClassName))
+ baseClassRef.setUUID(baseClassUUID)
classMetaInfo.appendBaseClass(baseClassRef)
***************
*** 452,460 ****
def parseXMIAssociation(self, classesInModel, classMetaInfo, end):
thisName = end.name
! thisUUID = end.__uniqueID__
otherName = self.getOppositeEnd(end).name
! otherUUID = self.getOppositeEnd(end).__uniqueID__
associationName = end.association.name
! associationUUID = end.association.__uniqueID__
associationNameTuple = (associationName, thisName, otherName)
--- 454,462 ----
def parseXMIAssociation(self, classesInModel, classMetaInfo, end):
thisName = end.name
! thisUUID = self.getUUID(end)
otherName = self.getOppositeEnd(end).name
! otherUUID = self.getUUID(self.getOppositeEnd(end))
associationName = end.association.name
! associationUUID = self.getUUID(end.association)
associationNameTuple = (associationName, thisName, otherName)
***************
*** 464,468 ****
# get names of types
thisEndTypeName = self.getEndClassName(end)
! thisEndTypeUUID = self.getUUID(end)
otherEndTypeName = self.getEndClassName(self.getOppositeEnd(end))
otherEndTypeUUID = self.getUUID(self.getOppositeEnd(end))
--- 466,470 ----
# get names of types
thisEndTypeName = self.getEndClassName(end)
! thisEndTypeUUID = elf.getUUID(end)
otherEndTypeName = self.getEndClassName(self.getOppositeEnd(end))
otherEndTypeUUID = self.getUUID(self.getOppositeEnd(end))
***************
*** 472,478 ****
--- 474,482 ----
XMIClassMetaInfo(self.pymeraseConfig,
thisEndTypeName))
+ thisEndType.setUUID(thisEndTypeUUID)
otherEndType = classesInModel.setdefault(otherEndTypeUUID,
XMIClassMetaInfo(self.pymeraseConfig,
otherEndTypeName))
+ otherEndType.setUUID(otherEndTypeUUID)
#################
***************
*** 574,578 ****
if parsedClass is not None:
classesInModel[parsedClass.getUUID()] = parsedClass
!
addForeignKeys(pymeraseConfig, classesInModel)
--- 578,584 ----
if parsedClass is not None:
classesInModel[parsedClass.getUUID()] = parsedClass
!
! pprint.pprint(classesInModel)
! print len(classesInModel)
addForeignKeys(pymeraseConfig, classesInModel)
|