You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(57) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(44) |
Feb
(151) |
Mar
(131) |
Apr
(171) |
May
(125) |
Jun
(43) |
Jul
(26) |
Aug
(19) |
Sep
(10) |
Oct
|
Nov
(4) |
Dec
(28) |
2004 |
Jan
(134) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <de...@us...> - 2002-12-20 02:23:05
|
Update of /cvsroot/pymerase/pymerase/util In directory sc8-pr-cvs1:/tmp/cvs-serv30420 Modified Files: PymeraseType.py Log Message: handle double type Index: PymeraseType.py =================================================================== RCS file: /cvsroot/pymerase/pymerase/util/PymeraseType.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PymeraseType.py 11 Dec 2002 17:32:15 -0000 1.8 --- PymeraseType.py 20 Dec 2002 02:23:02 -0000 1.9 *************** *** 109,112 **** --- 109,114 ---- elif re.match("float.*", self.type_string): return "double precision" + elif re.match("double.*", self.type_string): + return "double precision" elif re.match("text", self.type_string): return "text" *************** *** 138,141 **** --- 140,145 ---- return "types.IntType" elif re.match("float", self.type_string): + return "types.FloatType" + elif re.match("double.*", self.type_string): return "types.FloatType" elif re.match("bool", self.type_string): |
Update of /cvsroot/pymerase/pymerase/examples/varTypes In directory sc8-pr-cvs1:/tmp/cvs-serv29358 Added Files: createapi.py createpytkwidgets.py createreport.py createsql.py varTypes.zargo varTypes_.xmi Log Message: Examples which uses most common variable data types --- NEW FILE: createapi.py --- #!/usr/bin/env python import sys import os import pymerase # NOTE: Jython can't use the python way to load modules based on their name # NOTE: so we have to manually import the modules we're using # NOTE: and pass them to pymerase.run import input.parseXMI import output.CreateDBAPI if __name__ == "__main__": schema = os.path.abspath("./varTypes_.xmi") outputPath = os.path.abspath("./VarTypesAPI") #pymerase.run(schema, 'parseXMI', output, 'CreateDBAPI') pymerase.run(schema, input.parseXMI, outputPath, output.CreateDBAPI) --- NEW FILE: createpytkwidgets.py --- #!/usr/bin/env python import sys import os import pymerase # NOTE: Jython can't use the python way to load modules based on their name # NOTE: so we have to manually import the modules we're using # NOTE: and pass them to pymerase.run import input.parseXMI import output.CreatePyTkWidgets if __name__ == "__main__": schema = os.path.abspath("./varTypes_.xmi") outputPath = os.path.abspath("./widgets") #pymerase.run(schema, 'parseXMI', output, 'CreateDBAPI') pymerase.run(schema, input.parseXMI, outputPath, output.CreatePyTkWidgets) --- NEW FILE: createreport.py --- #!/usr/bin/env python import sys import os import pymerase import input.parseXMI import output.CreateReport if __name__ == "__main__": schema = os.path.abspath("./varTypes_.xmi") outputPath = os.path.abspath("./report.txt") pymerase.run(schema, input.parseXMI, outputPath, output.CreateReport) --- NEW FILE: createsql.py --- #!/usr/bin/env python import sys import os import pymerase import input.parseXMI import output.CreateDBAPI if __name__ == "__main__": schema = os.path.abspath("./varType_.xmi") outputPath = os.path.abspath("./varType.sql") pymerase.run(schema, input.parseXMI, outputPath, output.CreateSQL) --- NEW FILE: varTypes.zargo --- (This appears to be a binary file; contents omitted.) --- NEW FILE: varTypes_.xmi --- <?xml version="1.0" encoding="UTF-8"?> <XMI xmi.version="1.0"> <XMI.header> <XMI.documentation> <XMI.exporter>Novosoft UML Library</XMI.exporter> <XMI.exporterVersion>0.4.20</XMI.exporterVersion> </XMI.documentation> <XMI.metamodel xmi.name="UML" xmi.version="1.3"/> </XMI.header> <XMI.content> <Model_Management.Model xmi.id="xmi.1" xmi.uuid="127-0-0-1-6090ee:f2399ec162:-8000"> <Foundation.Core.ModelElement.name>DataTypeTest</Foundation.Core.ModelElement.name> <Foundation.Core.ModelElement.isSpecification xmi.value="false"/> <Foundation.Core.GeneralizableElement.isRoot xmi.value="false"/> <Foundation.Core.GeneralizableElement.isLeaf xmi.value="false"/> <Foundation.Core.GeneralizableElement.isAbstract xmi.value="false"/> <Foundation.Core.Namespace.ownedElement> <Foundation.Core.Class xmi.id="xmi.2" xmi.uuid="127-0-0-1-6090ee:f2399ec162:-7fff"> <Foundation.Core.ModelElement.name>VarTypes</Foundation.Core.ModelElement.name> <Foundation.Core.ModelElement.isSpecification xmi.value="false"/> <Foundation.Core.GeneralizableElement.isRoot xmi.value="false"/> <Foundation.Core.GeneralizableElement.isLeaf xmi.value="false"/> <Foundation.Core.GeneralizableElement.isAbstract xmi.value="false"/> <Foundation.Core.Class.isActive xmi.value="false"/> <Foundation.Core.ModelElement.namespace> <Foundation.Core.Namespace xmi.idref="xmi.1"/> </Foundation.Core.ModelElement.namespace> <Foundation.Core.Classifier.feature> <Foundation.Core.Attribute xmi.id="xmi.3"> <Foundation.Core.ModelElement.name>myString</Foundation.Core.ModelElement.name> <Foundation.Core.ModelElement.visibility xmi.value="public"/> <Foundation.Core.ModelElement.isSpecification xmi.value="false"/> <Foundation.Core.Attribute.initialValue> <Foundation.Data_Types.Expression xmi.id="xmi.4"> <Foundation.Data_Types.Expression.language>Java</Foundation.Data_Types.Expression.language> </Foundation.Data_Types.Expression> </Foundation.Core.Attribute.initialValue> <Foundation.Core.Feature.owner> <Foundation.Core.Classifier xmi.idref="xmi.2"/> </Foundation.Core.Feature.owner> <Foundation.Core.StructuralFeature.type> <Foundation.Core.Classifier xmi.idref="xmi.5"/> </Foundation.Core.StructuralFeature.type> </Foundation.Core.Attribute> <Foundation.Core.Attribute xmi.id="xmi.6"> <Foundation.Core.ModelElement.name>myInteger</Foundation.Core.ModelElement.name> <Foundation.Core.ModelElement.visibility xmi.value="public"/> <Foundation.Core.ModelElement.isSpecification xmi.value="false"/> <Foundation.Core.Attribute.initialValue> <Foundation.Data_Types.Expression xmi.id="xmi.7"> <Foundation.Data_Types.Expression.language>Java</Foundation.Data_Types.Expression.language> </Foundation.Data_Types.Expression> </Foundation.Core.Attribute.initialValue> <Foundation.Core.Feature.owner> <Foundation.Core.Classifier xmi.idref="xmi.2"/> </Foundation.Core.Feature.owner> <Foundation.Core.StructuralFeature.type> <Foundation.Core.Classifier xmi.idref="xmi.8"/> </Foundation.Core.StructuralFeature.type> </Foundation.Core.Attribute> <Foundation.Core.Attribute xmi.id="xmi.9"> <Foundation.Core.ModelElement.name>myChar</Foundation.Core.ModelElement.name> <Foundation.Core.ModelElement.visibility xmi.value="public"/> <Foundation.Core.ModelElement.isSpecification xmi.value="false"/> <Foundation.Core.Attribute.initialValue> <Foundation.Data_Types.Expression xmi.id="xmi.10"> <Foundation.Data_Types.Expression.language>Java</Foundation.Data_Types.Expression.language> </Foundation.Data_Types.Expression> </Foundation.Core.Attribute.initialValue> <Foundation.Core.Feature.owner> <Foundation.Core.Classifier xmi.idref="xmi.2"/> </Foundation.Core.Feature.owner> <Foundation.Core.StructuralFeature.type> <Foundation.Core.Classifier xmi.idref="xmi.11"/> </Foundation.Core.StructuralFeature.type> </Foundation.Core.Attribute> <Foundation.Core.Attribute xmi.id="xmi.12"> <Foundation.Core.ModelElement.name>myFloat</Foundation.Core.ModelElement.name> <Foundation.Core.ModelElement.visibility xmi.value="public"/> <Foundation.Core.ModelElement.isSpecification xmi.value="false"/> <Foundation.Core.Attribute.initialValue> <Foundation.Data_Types.Expression xmi.id="xmi.13"> <Foundation.Data_Types.Expression.language>Java</Foundation.Data_Types.Expression.language> </Foundation.Data_Types.Expression> </Foundation.Core.Attribute.initialValue> <Foundation.Core.Feature.owner> <Foundation.Core.Classifier xmi.idref="xmi.2"/> </Foundation.Core.Feature.owner> <Foundation.Core.StructuralFeature.type> <Foundation.Core.Classifier xmi.idref="xmi.14"/> </Foundation.Core.StructuralFeature.type> </Foundation.Core.Attribute> <Foundation.Core.Attribute xmi.id="xmi.15"> <Foundation.Core.ModelElement.name>myDouble</Foundation.Core.ModelElement.name> <Foundation.Core.ModelElement.visibility xmi.value="public"/> <Foundation.Core.ModelElement.isSpecification xmi.value="false"/> <Foundation.Core.Attribute.initialValue> <Foundation.Data_Types.Expression xmi.id="xmi.16"> <Foundation.Data_Types.Expression.language>Java</Foundation.Data_Types.Expression.language> </Foundation.Data_Types.Expression> </Foundation.Core.Attribute.initialValue> <Foundation.Core.Feature.owner> <Foundation.Core.Classifier xmi.idref="xmi.2"/> </Foundation.Core.Feature.owner> <Foundation.Core.StructuralFeature.type> <Foundation.Core.Classifier xmi.idref="xmi.17"/> </Foundation.Core.StructuralFeature.type> </Foundation.Core.Attribute> <Foundation.Core.Attribute xmi.id="xmi.18"> <Foundation.Core.ModelElement.name>myBoolean</Foundation.Core.ModelElement.name> <Foundation.Core.ModelElement.visibility xmi.value="public"/> <Foundation.Core.ModelElement.isSpecification xmi.value="false"/> <Foundation.Core.Attribute.initialValue> <Foundation.Data_Types.Expression xmi.id="xmi.19"> <Foundation.Data_Types.Expression.language>Java</Foundation.Data_Types.Expression.language> </Foundation.Data_Types.Expression> </Foundation.Core.Attribute.initialValue> <Foundation.Core.Feature.owner> <Foundation.Core.Classifier xmi.idref="xmi.2"/> </Foundation.Core.Feature.owner> <Foundation.Core.StructuralFeature.type> <Foundation.Core.Classifier xmi.idref="xmi.20"/> </Foundation.Core.StructuralFeature.type> </Foundation.Core.Attribute> </Foundation.Core.Classifier.feature> </Foundation.Core.Class> <Foundation.Core.DataType xmi.id="xmi.8"> <Foundation.Core.ModelElement.name>int</Foundation.Core.ModelElement.name> <Foundation.Core.ModelElement.isSpecification xmi.value="false"/> <Foundation.Core.GeneralizableElement.isRoot xmi.value="false"/> <Foundation.Core.GeneralizableElement.isLeaf xmi.value="false"/> <Foundation.Core.GeneralizableElement.isAbstract xmi.value="false"/> <Foundation.Core.ModelElement.namespace> <Foundation.Core.Namespace xmi.idref="xmi.1"/> </Foundation.Core.ModelElement.namespace> </Foundation.Core.DataType> <Model_Management.Package xmi.id="xmi.21"> <Foundation.Core.ModelElement.name>java</Foundation.Core.ModelElement.name> <Foundation.Core.ModelElement.isSpecification xmi.value="false"/> <Foundation.Core.GeneralizableElement.isRoot xmi.value="false"/> <Foundation.Core.GeneralizableElement.isLeaf xmi.value="false"/> <Foundation.Core.GeneralizableElement.isAbstract xmi.value="false"/> <Foundation.Core.ModelElement.namespace> <Foundation.Core.Namespace xmi.idref="xmi.1"/> </Foundation.Core.ModelElement.namespace> <Foundation.Core.Namespace.ownedElement> <Model_Management.Package xmi.id="xmi.22"> <Foundation.Core.ModelElement.name>lang</Foundation.Core.ModelElement.name> <Foundation.Core.ModelElement.isSpecification xmi.value="false"/> <Foundation.Core.GeneralizableElement.isRoot xmi.value="false"/> <Foundation.Core.GeneralizableElement.isLeaf xmi.value="false"/> <Foundation.Core.GeneralizableElement.isAbstract xmi.value="false"/> <Foundation.Core.ModelElement.namespace> <Foundation.Core.Namespace xmi.idref="xmi.21"/> </Foundation.Core.ModelElement.namespace> <Foundation.Core.Namespace.ownedElement> <Foundation.Core.Class xmi.id="xmi.5"> <Foundation.Core.ModelElement.name>String</Foundation.Core.ModelElement.name> <Foundation.Core.ModelElement.isSpecification xmi.value="false"/> <Foundation.Core.GeneralizableElement.isRoot xmi.value="false"/> <Foundation.Core.GeneralizableElement.isLeaf xmi.value="false"/> <Foundation.Core.GeneralizableElement.isAbstract xmi.value="false"/> <Foundation.Core.Class.isActive xmi.value="false"/> <Foundation.Core.ModelElement.namespace> <Foundation.Core.Namespace xmi.idref="xmi.22"/> </Foundation.Core.ModelElement.namespace> </Foundation.Core.Class> <Foundation.Core.Class xmi.id="xmi.23"> <Foundation.Core.ModelElement.name>Char</Foundation.Core.ModelElement.name> <Foundation.Core.ModelElement.isSpecification xmi.value="false"/> <Foundation.Core.GeneralizableElement.isRoot xmi.value="false"/> <Foundation.Core.GeneralizableElement.isLeaf xmi.value="false"/> <Foundation.Core.GeneralizableElement.isAbstract xmi.value="false"/> <Foundation.Core.Class.isActive xmi.value="false"/> <Foundation.Core.ModelElement.namespace> <Foundation.Core.Namespace xmi.idref="xmi.22"/> </Foundation.Core.ModelElement.namespace> </Foundation.Core.Class> <Foundation.Core.Class xmi.id="xmi.24"> <Foundation.Core.ModelElement.name>Double</Foundation.Core.ModelElement.name> <Foundation.Core.ModelElement.isSpecification xmi.value="false"/> <Foundation.Core.GeneralizableElement.isRoot xmi.value="false"/> <Foundation.Core.GeneralizableElement.isLeaf xmi.value="false"/> <Foundation.Core.GeneralizableElement.isAbstract xmi.value="false"/> <Foundation.Core.Class.isActive xmi.value="false"/> <Foundation.Core.ModelElement.namespace> <Foundation.Core.Namespace xmi.idref="xmi.22"/> </Foundation.Core.ModelElement.namespace> </Foundation.Core.Class> <Foundation.Core.Class xmi.id="xmi.25"> <Foundation.Core.ModelElement.name>Float</Foundation.Core.ModelElement.name> <Foundation.Core.ModelElement.isSpecification xmi.value="false"/> <Foundation.Core.GeneralizableElement.isRoot xmi.value="false"/> <Foundation.Core.GeneralizableElement.isLeaf xmi.value="false"/> <Foundation.Core.GeneralizableElement.isAbstract xmi.value="false"/> <Foundation.Core.Class.isActive xmi.value="false"/> <Foundation.Core.ModelElement.namespace> <Foundation.Core.Namespace xmi.idref="xmi.22"/> </Foundation.Core.ModelElement.namespace> </Foundation.Core.Class> <Foundation.Core.Class xmi.id="xmi.26"> <Foundation.Core.ModelElement.name>Boolean</Foundation.Core.ModelElement.name> <Foundation.Core.ModelElement.isSpecification xmi.value="false"/> <Foundation.Core.GeneralizableElement.isRoot xmi.value="false"/> <Foundation.Core.GeneralizableElement.isLeaf xmi.value="false"/> <Foundation.Core.GeneralizableElement.isAbstract xmi.value="false"/> <Foundation.Core.Class.isActive xmi.value="false"/> <Foundation.Core.ModelElement.namespace> <Foundation.Core.Namespace xmi.idref="xmi.22"/> </Foundation.Core.ModelElement.namespace> </Foundation.Core.Class> <Foundation.Core.DataType xmi.id="xmi.11"> <Foundation.Core.ModelElement.name>char</Foundation.Core.ModelElement.name> <Foundation.Core.ModelElement.isSpecification xmi.value="false"/> <Foundation.Core.GeneralizableElement.isRoot xmi.value="false"/> <Foundation.Core.GeneralizableElement.isLeaf xmi.value="false"/> <Foundation.Core.GeneralizableElement.isAbstract xmi.value="false"/> <Foundation.Core.ModelElement.namespace> <Foundation.Core.Namespace xmi.idref="xmi.22"/> </Foundation.Core.ModelElement.namespace> </Foundation.Core.DataType> <Foundation.Core.DataType xmi.id="xmi.14"> <Foundation.Core.ModelElement.name>float</Foundation.Core.ModelElement.name> <Foundation.Core.ModelElement.isSpecification xmi.value="false"/> <Foundation.Core.GeneralizableElement.isRoot xmi.value="false"/> <Foundation.Core.GeneralizableElement.isLeaf xmi.value="false"/> <Foundation.Core.GeneralizableElement.isAbstract xmi.value="false"/> <Foundation.Core.ModelElement.namespace> <Foundation.Core.Namespace xmi.idref="xmi.22"/> </Foundation.Core.ModelElement.namespace> </Foundation.Core.DataType> <Foundation.Core.DataType xmi.id="xmi.17"> <Foundation.Core.ModelElement.name>double</Foundation.Core.ModelElement.name> <Foundation.Core.ModelElement.isSpecification xmi.value="false"/> <Foundation.Core.GeneralizableElement.isRoot xmi.value="false"/> <Foundation.Core.GeneralizableElement.isLeaf xmi.value="false"/> <Foundation.Core.GeneralizableElement.isAbstract xmi.value="false"/> <Foundation.Core.ModelElement.namespace> <Foundation.Core.Namespace xmi.idref="xmi.22"/> </Foundation.Core.ModelElement.namespace> </Foundation.Core.DataType> <Foundation.Core.DataType xmi.id="xmi.20"> <Foundation.Core.ModelElement.name>boolean</Foundation.Core.ModelElement.name> <Foundation.Core.ModelElement.isSpecification xmi.value="false"/> <Foundation.Core.GeneralizableElement.isRoot xmi.value="false"/> <Foundation.Core.GeneralizableElement.isLeaf xmi.value="false"/> <Foundation.Core.GeneralizableElement.isAbstract xmi.value="false"/> <Foundation.Core.ModelElement.namespace> <Foundation.Core.Namespace xmi.idref="xmi.22"/> </Foundation.Core.ModelElement.namespace> </Foundation.Core.DataType> </Foundation.Core.Namespace.ownedElement> </Model_Management.Package> <Model_Management.Package xmi.id="xmi.27"> <Foundation.Core.ModelElement.name>math</Foundation.Core.ModelElement.name> <Foundation.Core.ModelElement.isSpecification xmi.value="false"/> <Foundation.Core.GeneralizableElement.isRoot xmi.value="false"/> <Foundation.Core.GeneralizableElement.isLeaf xmi.value="false"/> <Foundation.Core.GeneralizableElement.isAbstract xmi.value="false"/> <Foundation.Core.ModelElement.namespace> <Foundation.Core.Namespace xmi.idref="xmi.21"/> </Foundation.Core.ModelElement.namespace> <Foundation.Core.Namespace.ownedElement> <Foundation.Core.Class xmi.id="xmi.28"> <Foundation.Core.ModelElement.name>BigDecimal</Foundation.Core.ModelElement.name> <Foundation.Core.ModelElement.isSpecification xmi.value="false"/> <Foundation.Core.GeneralizableElement.isRoot xmi.value="false"/> <Foundation.Core.GeneralizableElement.isLeaf xmi.value="false"/> <Foundation.Core.GeneralizableElement.isAbstract xmi.value="false"/> <Foundation.Core.Class.isActive xmi.value="false"/> <Foundation.Core.ModelElement.namespace> <Foundation.Core.Namespace xmi.idref="xmi.27"/> </Foundation.Core.ModelElement.namespace> </Foundation.Core.Class> </Foundation.Core.Namespace.ownedElement> </Model_Management.Package> </Foundation.Core.Namespace.ownedElement> </Model_Management.Package> </Foundation.Core.Namespace.ownedElement> </Model_Management.Model> </XMI.content> </XMI> |
From: <ki...@us...> - 2002-12-20 02:17:55
|
Update of /cvsroot/pymerase/pymerase/examples/varTypes In directory sc8-pr-cvs1:/tmp/cvs-serv29166/varTypes Log Message: Directory /cvsroot/pymerase/pymerase/examples/varTypes added to the repository |
From: <de...@us...> - 2002-12-20 01:55:54
|
Update of /cvsroot/pymerase/pymerase/input In directory sc8-pr-cvs1:/tmp/cvs-serv21313 Modified Files: parseGenexSchemaXML.py Log Message: Ignore errors from marking an attribute as a primary key if it's not present in the current class (though issue a warning). Hopefully the attribute will be defined in a base class. Index: parseGenexSchemaXML.py =================================================================== RCS file: /cvsroot/pymerase/pymerase/input/parseGenexSchemaXML.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** parseGenexSchemaXML.py 14 Dec 2002 02:20:11 -0000 1.21 --- parseGenexSchemaXML.py 20 Dec 2002 01:47:08 -0000 1.22 *************** *** 293,303 **** # FIXME: in both as a flag in the attribute and as the name # FIXME: in the ClassMetaInfo # update class attribute with indication that it's the primary key ! class_name = attributes['column_id'] ! classAttribute = self.currentTable.getAttributeByName(class_name, None) ! classAttribute.setPrimaryKey(1) ! self.currentTable.setPrimaryKeyName(classAttribute.getName(None)) ! self.currentTable.setAutoSequence(attributes.get('serial', 0)) ! elif name == "foreign_key": # get name of this association & class/type ref --- 293,312 ---- # FIXME: in both as a flag in the attribute and as the name # FIXME: in the ClassMetaInfo + # FIXME: + # FXIME: Also Jason's perl code seems to be using the primary key + # FIXME: flag as an indicator that there should be a constraint + # FIXME: in postgres # update class attribute with indication that it's the primary key ! attributeName = attributes['column_id'] ! classAttribute = self.currentTable.getAttributeByName(attributeName,None) ! if attributeName is None: ! msg = "Trying to mark attribute %s of class as a primary key failed," ! msg += os.linesep + "I hope it's in a base class" ! msg %= (attributeName, self.currentTable.getName(None)) ! warn(msg, RuntimeWarning) ! else: ! classAttribute.setPrimaryKey(1) ! self.currentTable.setPrimaryKeyName(classAttribute.getName(None)) ! self.currentTable.setAutoSequence(attributes.get('serial', 0)) elif name == "foreign_key": # get name of this association & class/type ref |
From: <de...@us...> - 2002-12-20 01:54:00
|
Update of /cvsroot/pymerase/pymerase/input In directory sc8-pr-cvs1:/tmp/cvs-serv23194 Modified Files: parseGenexSchemaXML.py Log Message: forgot a '%s' Index: parseGenexSchemaXML.py =================================================================== RCS file: /cvsroot/pymerase/pymerase/input/parseGenexSchemaXML.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** parseGenexSchemaXML.py 20 Dec 2002 01:50:12 -0000 1.23 --- parseGenexSchemaXML.py 20 Dec 2002 01:53:58 -0000 1.24 *************** *** 301,305 **** classAttribute = self.currentTable.getAttributeByName(attributeName,None) if classAttribute is None: ! msg = "Trying to mark attribute %s of class as a primary key failed," msg += os.linesep + "I hope it's in a base class" msg %= (attributeName, self.currentTable.getName(None)) --- 301,305 ---- classAttribute = self.currentTable.getAttributeByName(attributeName,None) if classAttribute is None: ! msg = "Trying to mark attribute %s of class %s as a primary key failed" msg += os.linesep + "I hope it's in a base class" msg %= (attributeName, self.currentTable.getName(None)) |
From: <de...@us...> - 2002-12-20 01:50:16
|
Update of /cvsroot/pymerase/pymerase/input In directory sc8-pr-cvs1:/tmp/cvs-serv22180 Modified Files: parseGenexSchemaXML.py Log Message: D'oh! put wrong variable in as the expression for an if statement. Index: parseGenexSchemaXML.py =================================================================== RCS file: /cvsroot/pymerase/pymerase/input/parseGenexSchemaXML.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** parseGenexSchemaXML.py 20 Dec 2002 01:47:08 -0000 1.22 --- parseGenexSchemaXML.py 20 Dec 2002 01:50:12 -0000 1.23 *************** *** 300,304 **** attributeName = attributes['column_id'] classAttribute = self.currentTable.getAttributeByName(attributeName,None) ! if attributeName is None: msg = "Trying to mark attribute %s of class as a primary key failed," msg += os.linesep + "I hope it's in a base class" --- 300,304 ---- attributeName = attributes['column_id'] classAttribute = self.currentTable.getAttributeByName(attributeName,None) ! if classAttribute is None: msg = "Trying to mark attribute %s of class as a primary key failed," msg += os.linesep + "I hope it's in a base class" |
From: <de...@us...> - 2002-12-14 02:25:38
|
Update of /cvsroot/pymerase/pymerase/util In directory sc8-pr-cvs1:/tmp/cvs-serv13630 Modified Files: NameMangling.py Log Message: Added a class to compute primary and foreign key names. Index: NameMangling.py =================================================================== RCS file: /cvsroot/pymerase/pymerase/util/NameMangling.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NameMangling.py 11 Dec 2002 20:30:53 -0000 1.4 --- NameMangling.py 14 Dec 2002 02:25:35 -0000 1.5 *************** *** 101,103 **** --- 101,131 ---- def createAppender(self, name): return "append_%s" % (self.mangle(name)) + + + class RelationalKey: + """Given a name, convert it into primary and foreign key names. + + getPrimaryKey('name_pk') -> 'name_pk' + getPrimaryKey('name_fk') -> 'name_pk' + getPrimaryKey('name') -> 'name_pk' + getForeignKey('name_pk') -> 'name_fk' + getForeignKey('name_fk') -> 'name_fk' + getForeignKey('name') -> 'name_fk' + """ + def getPrimaryKey(self, name): + if re.search("[Pp][Kk]$", name): + return name + elif re.search("[Ff][Kk]$", name): + return re.sub("[Ff][Kk]$", "pk", name) + else: + return name + "_pk" + + def getForeignKey(self, name): + if re.search("[Pp][Kk]$", name): + return re.sub("[Pf][Kk]$", "fk", name) + elif re.search("[Ff][Kk]$", name): + return name + else: + return name + "_fk" + |
From: <de...@us...> - 2002-12-14 02:23:16
|
Update of /cvsroot/pymerase/pymerase/output/dbAPI In directory sc8-pr-cvs1:/tmp/cvs-serv13245 Modified Files: fkeyTypes.py Log Message: Added function to compute the multiplicity "opposite" to our current perspective. e.g. one to one -> many to one, many to one -> one to one. Index: fkeyTypes.py =================================================================== RCS file: /cvsroot/pymerase/pymerase/output/dbAPI/fkeyTypes.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** fkeyTypes.py 15 Aug 2002 00:09:21 -0000 1.2 --- fkeyTypes.py 14 Dec 2002 02:23:14 -0000 1.3 *************** *** 37,38 **** --- 37,52 ---- OneToLots = 3 + def getOppositeMultiplicity(multiplicity): + """Give a particular multiplicity return a reasonable value for this association being viewed from the 'other' side. + """ + + if multiplicity == OneToOne: + return ManyToOne + elif multiplicity == ManyToOne: + return OneToOne + elif multiplicity == ManyToMany: + return ManyToMany + elif multiplicity == OneToLots: + return OneToOne + else: + raise ValueError("invalid fkey enumeration value") |
From: <de...@us...> - 2002-12-14 02:22:22
|
Update of /cvsroot/pymerase/pymerase/output In directory sc8-pr-cvs1:/tmp/cvs-serv13101 Modified Files: CreateDBAPI.py Log Message: Moved computing key names into ClassMembers. Removed a test that was always true (which ment that all classes had functions returning primary keys.) Changed isAutoSequence to be inherited from base class. Index: CreateDBAPI.py =================================================================== RCS file: /cvsroot/pymerase/pymerase/output/CreateDBAPI.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** CreateDBAPI.py 19 Nov 2002 00:47:14 -0000 1.23 --- CreateDBAPI.py 14 Dec 2002 02:22:19 -0000 1.24 *************** *** 136,143 **** header.append(u"") header.append(u"def getPrimaryKeyName():") ! header.append(u" return '%s'" % (classMetaInfo.getRootClass().getName(SQL_TRANSLATOR_NAME)+"_pk")) header.append(u"") header.append(u"def getForeignKeyName():") ! header.append(u" return '%s'" % (classMetaInfo.getRootClass().getName(SQL_TRANSLATOR_NAME)+"_fk")) header.append(u"") header.append(u"def getClass():") --- 136,144 ---- header.append(u"") header.append(u"def getPrimaryKeyName():") ! #header.append(u" return '%s'" % (classMetaInfo.getRootClass().getName(SQL_TRANSLATOR_NAME)+"_pk")) ! header.append(u" return '%s'" % (classMetaInfo.getPrimaryKeyName(SQL_TRANSLATOR_NAME))) header.append(u"") header.append(u"def getForeignKeyName():") ! header.append(u" return '%s'" % (classMetaInfo.getForeignKeyName(SQL_TRANSLATOR_NAME))) header.append(u"") header.append(u"def getClass():") *************** *** 241,262 **** def createUtilityAccessors(indent, classMetaInfo): """Create member functions for returning information ! not directly stored in the database """ utilities = [] ! if classMetaInfo.isRootClass() is not None: ! utilities.append(u"def getPrimaryKeyName(self):") ! utilities.append(u" return '%s'" % (classMetaInfo.getRootClass().getName(SQL_TRANSLATOR_NAME)+"_pk")) ! utilities.append(u"") ! utilities.append(u"def getForeignKeyName(self):") ! utilities.append(u" return '%s'" % (classMetaInfo.getRootClass().getName(SQL_TRANSLATOR_NAME)+"_fk")) ! utilities.append(u"") ! utilities.append(u"def getClassName(self):") ! utilities.append(u" return '%s'" % (classMetaInfo.getName(TRANSLATOR_NAME))) ! utilities.append(u"") ! utilities.append(u"def getTableName(self):") ! utilities.append(u" return '%s'" % (classMetaInfo.getName(SQL_TRANSLATOR_NAME))) ! utilities.append(u"") # FIXME: can there be an autosequence without a primary key? utilities.append(u"def isAutoSequence(self):") --- 242,270 ---- def createUtilityAccessors(indent, classMetaInfo): """Create member functions for returning information ! not directly stored in the classes defining an association. """ utilities = [] ! # since we travel down the list of base classes for the key information ! # unless the user overrides, we should always provide the key methods ! # on the off chance that the user overrides the foreign key name. ! utilities.append(u"def getPrimaryKeyName(self):") ! utilities.append(u" return '%s'" % (classMetaInfo.getPrimaryKeyName(SQL_TRANSLATOR_NAME))) ! #utilities.append(u" return '%s'" % (classMetaInfo.getRootClass().getName(SQL_TRANSLATOR_NAME)+"_pk")) ! utilities.append(u"") ! utilities.append(u"def getForeignKeyName(self):") ! utilities.append(u" return '%s'" % (classMetaInfo.getForeignKeyName(SQL_TRANSLATOR_NAME))) ! utilities.append(u"") ! utilities.append(u"def getClassName(self):") ! utilities.append(u" return '%s'" % (classMetaInfo.getName(TRANSLATOR_NAME))) ! utilities.append(u"") ! utilities.append(u"def getTableName(self):") ! utilities.append(u" return '%s'" % (classMetaInfo.getName(SQL_TRANSLATOR_NAME))) ! utilities.append(u"") + # since the sequence is defined for the root class + # we should ask only the root class to if there's a sequence + # defined for us. + if classMetaInfo.isRootClass(): # FIXME: can there be an autosequence without a primary key? utilities.append(u"def isAutoSequence(self):") *************** *** 332,335 **** --- 340,344 ---- """ className = classMetaInfo.getName(TRANSLATOR_NAME) + print classMetaInfo.getAssociationEnds().items() classAssociationEnds = classMetaInfo.getAssociationEnds().values() classAttributes = classMetaInfo.getAttributes() |
From: <de...@us...> - 2002-12-14 02:20:14
|
Update of /cvsroot/pymerase/pymerase/input In directory sc8-pr-cvs1:/tmp/cvs-serv12658 Modified Files: parseGenexSchemaXML.py Log Message: Updated foreign_key parsing to follow new association end model Also for some reason 'thisEndType.setAssociationEnd(thisEnd)' caused a duplicate entry on the association hash. perhaps since we have a reference instead of copy of the hash? (also fixed for otherEndType need to look into XMI parser and see if this is also bad there.) Index: parseGenexSchemaXML.py =================================================================== RCS file: /cvsroot/pymerase/pymerase/input/parseGenexSchemaXML.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** parseGenexSchemaXML.py 19 Nov 2002 00:43:43 -0000 1.20 --- parseGenexSchemaXML.py 14 Dec 2002 02:20:11 -0000 1.21 *************** *** 16,21 **** from ClassMembers import ModelElement from ClassMembers import ClassAttribute ! from ClassMembers import ClassAssociation from ClassMembers import ClassMetaInfo from util.bool import parseBoolValue from util.PymeraseType import PymeraseType --- 16,24 ---- from ClassMembers import ModelElement from ClassMembers import ClassAttribute ! from ClassMembers import Association ! from ClassMembers import AssociationEnd from ClassMembers import ClassMetaInfo + from ClassMembers import createAssociation + from util.bool import parseBoolValue from util.PymeraseType import PymeraseType *************** *** 61,79 **** return self.attributes[u"privileges"] ! class ERClassAssociation(ClassAssociation): ! """Extension of ClassAssociation for some of the extra ER related ! concepts. (Maybe, probably needs to be refactored more) ! """ ! def __init__(self, pymeraseConfig, name=None): ! ClassAssociation.__init__(self, pymeraseConfig, name) ! self.targetAttributeName = None ! ! def setTargetAttributeName(self, value): ! self.targetAttributeName = value ! ! def getTargetAttributeName(self, translatorName): ! mangler = self.config.getNameMangler(translatorName) ! return mangler.mangle(self.targetAttributeName) ! class ERClassAttribute(ClassAttribute): """Extention of ClassAttribute to keep track of indexed fields --- 64,82 ---- return self.attributes[u"privileges"] ! #class ERAssociation(Association): ! # """Extension of Association for some of the extra ER related ! # concepts. (Maybe, probably needs to be refactored more) ! # """ ! # def __init__(self, pymeraseConfig, name=None): ! # Association.__init__(self, pymeraseConfig, name) ! # self.targetAttributeName = None ! # ! # def setTargetAttributeName(self, value): ! # self.targetAttributeName = value ! # ! # def getTargetAttributeName(self, translatorName): ! # mangler = self.config.getNameMangler(translatorName) ! # return mangler.mangle(self.targetAttributeName) ! # class ERClassAttribute(ClassAttribute): """Extention of ClassAttribute to keep track of indexed fields *************** *** 298,347 **** elif name == "foreign_key": ! # Define a name for an association ! attributeName = attributes.get('column_id', UNDEFINED) ! classAssociation = ERClassAssociation(self.pymeraseConfig, attributeName) ! ! classAssociation.setAssociationAttributeName(attributeName) ! classAssociation.setContainingClass(self.currentTable) ! # Handle getting a reference to the target class object ! targetClassName = attributes.get('foreign_table') ! if targetClassName is None: ! # Really should be some kind of parse error ! raise ValueError("required xml attribute, foreign_table, missing") ! targetClass = self.tables.setdefault(targetClassName, ERClassMetaInfo(self.pymeraseConfig, ! targetClassName)) ! classAssociation.setTargetClass(targetClass) ! # parseFkey would die on UNDEFINED, so might as well throw ! # the exception here ! classAssociation.setCardinality( ! parseGenexFKeyType(attributes['fkey_type'], ! self.currentTable.getName(None))) ! classAssociation.setTargetAttributeName( ! attributes.get('foreign_table_pkey', UNDEFINED)) ! classToCreateName = attributes.get('foreign_table') ! if classToCreateName is not None: ! classToCreateRef = self.tables.setdefault(classToCreateName, ! ERClassMetaInfo(self.pymeraseConfig, ! classToCreateName)) ! classAssociation.setClassToCreate(classToCreateRef) ! localAssociationName = attributes.get('local_association_name') ! if localAssociationName is not None: ! classAssociation.setLocalAssociationName(localAssociationName) ! ! foreignAssociationName = attributes.get('foreign_association_name') ! if foreignAssociationName is not None: ! classAssociation.setForeignAssociationName(foreignAssociationName) ! ! external_keys = self.currentTable.addAssociation(classAssociation) ! # if we have a foreign key that needs to link from another ! # table, save it for after we've finished processing all the ! # xml files ! if external_keys is not None: ! name, foreign_key = external_keys ! self.external_keys.setdefault(name, []).append(foreign_key) elif name == "grant": --- 301,358 ---- elif name == "foreign_key": ! # get name of this association & class/type ref ! thisEndType = self.currentTable ! thisName = attributes.get('local_association_name') ! if thisName is None: ! thisName = self.currentTable.getName(None) ! ! # get name of other end & it's class/type classref ! otherTypeName = attributes.get('foreign_table') ! if otherTypeName is None: ! raise ValueError("required xml attribute 'foreign_table' is missing") ! otherEndType = self.tables.setdefault(otherTypeName, ERClassMetaInfo(self.pymeraseConfig, ! otherTypeName)) ! otherName = attributes.get('foreign_association_name') ! if otherName is None: ! otherName = otherTypeName ! ! print "%s:%s <-> %s:%s" % (thisEndType.getName(None), ! thisName, ! otherEndType.getName(None), ! otherName) ! ################# ! # make this association end ! # grab a copy of the AssociationEnd from 'this' class if it exists ! # else make a new AssociationEnd ! thisAssociationEnds = thisEndType.getAssociationEnds() ! thisEnd = thisAssociationEnds.setdefault(otherName, # note uses UUID ! AssociationEnd(self.pymeraseConfig, ! thisName)) ! # finish setting up this association end ! #thisEnd.setUUID(thisUUID) # used by XMI ! thisEnd.setType(thisEndType) ! ! thisEnd.setMultiplicity(fkeyTypes.getOppositeMultiplicity(parseGenexFKeyType(attributes['fkey_type'], self.currentTable.getName(None)))) ! thisEnd.setAttributeName(attributes.get('column_id', None)) ! thisEnd.setNavigable(1) ! # construct other end ! otherAssociationEnds = otherEndType.getAssociationEnds() ! otherEnd = otherAssociationEnds.setdefault(thisName, ! AssociationEnd(self.pymeraseConfig, ! otherName)) ! #otherEnd.setUUID(otherUUID) ! otherEnd.setType(otherEndType) ! otherEnd.setAttributeName(attributes.get('foreign_table_pkey', None)) ! otherEnd.setMultiplicity(parseGenexFKeyType(attributes['fkey_type'], self.currentTable.getName(None))) ! ! # set the foreign key name in case the user is customizing it ! otherEndType.setForeignKeyName(attributes.get('column_id', None)) ! ! ! association = createAssociation(self.pymeraseConfig, thisEnd, otherEnd) elif name == "grant": |
From: <de...@us...> - 2002-12-14 02:17:32
|
Update of /cvsroot/pymerase/pymerase/input In directory sc8-pr-cvs1:/tmp/cvs-serv11955 Modified Files: parseXMI.py Log Message: Move createAssociation to ClassMembers.py Index: parseXMI.py =================================================================== RCS file: /cvsroot/pymerase/pymerase/input/parseXMI.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** parseXMI.py 19 Nov 2002 00:42:57 -0000 1.11 --- parseXMI.py 14 Dec 2002 02:17:29 -0000 1.12 *************** *** 55,58 **** --- 55,59 ---- from ClassMembers import AssociationEnd from ClassMembers import Association + from ClassMembers import createAssociation from ClassMembers import ClassMetaInfo from util.bool import parseBoolValue *************** *** 429,464 **** attribute.setName(attribute.getName(None) + "_fk") - def createAssociation(pymeraseConfig, thisEnd, otherEnd, associationName=None, associationUUID=None): - """Combine two associationEnds put them into a new association - """ - # Make sure the AssociationEnds are bound to an Association - if associationName is None: - associationName = thisEnd.getName(None) + otherEnd.getName(None) - - if associationUUID is None: - associationUUID = thisEnd.getName(None) + otherEnd.getName(None) - - if thisEnd.getAssociation() is None and otherEnd.getAssociation() is None: - association = Association(pymeraseConfig, associationName) - association.setUUID(associationUUID) - thisEnd.setAssociation(association) - association.addAssociationEnd(thisEnd) - otherEnd.setAssociation(association) - association.addAssociationEnd(otherEnd) - # since we always construct both ends at a time is this code actually - # needed? - elif thisEnd.getAssociation() is None: - association = otherEnd.getAssociation() - thisEnd.setAssociation(association) - association.addAssociationEnd(thisEnd) - elif otherEnd.getAssociation() is None: - association = thisEnd.getAssociation() - otherEnd.setAssociation(association) - association.addAssociationEnd(otherEnd) - else: - # everything is already set up - pass - - def constructForeignKey(pymeraseConfig, classesInModel, attributeName): """Construct an attribute to store a foreign key --- 430,433 ---- |
From: <de...@us...> - 2002-12-14 02:16:44
|
Update of /cvsroot/pymerase/pymerase/examples/school/schema In directory sc8-pr-cvs1:/tmp/cvs-serv11208/schema Modified Files: Classes.xml Employees.xml Students.xml Log Message: Getting parseGenexTableDTD to follow the new more UML-esque handling of Associations seemed to require updating my schema. Some examples were obviously wrong. (like in Students, having the advisior and house links having different multiplicities.) However I'm not really sure if all of the changes were correct. (like with the change in multiplicity for the Manager/Manged in the Employees class. Index: Classes.xml =================================================================== RCS file: /cvsroot/pymerase/pymerase/examples/school/schema/Classes.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Classes.xml 15 Sep 2002 06:50:32 -0000 1.4 --- Classes.xml 14 Dec 2002 02:16:41 -0000 1.5 *************** *** 16,20 **** foreign_table ="People" foreign_table_pkey ="Uid" ! fkey_type ="&fkey_linking;"/> <column name="course_fk" full_name="course_fk" --- 16,21 ---- foreign_table ="People" foreign_table_pkey ="Uid" ! fkey_type ="&fkey_oto;" ! foreign_association_name="Students"/> <column name="course_fk" full_name="course_fk" *************** *** 25,29 **** foreign_table ="Courses" foreign_table_pkey ="course_pk" ! fkey_type ="&fkey_linking;"/> <column name="grade" full_name="grade" --- 26,30 ---- foreign_table ="Courses" foreign_table_pkey ="course_pk" ! fkey_type ="&fkey_oto;"/> <column name="grade" full_name="grade" Index: Employees.xml =================================================================== RCS file: /cvsroot/pymerase/pymerase/examples/school/schema/Employees.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Employees.xml 15 Sep 2002 06:51:10 -0000 1.3 --- Employees.xml 14 Dec 2002 02:16:41 -0000 1.4 *************** *** 16,20 **** foreign_table ="Employees" foreign_table_pkey ="Uid" ! fkey_type ="&fkey_oto;" local_association_name="Manager" foreign_association_name="Managed" /> --- 16,20 ---- foreign_table ="Employees" foreign_table_pkey ="Uid" ! fkey_type ="&fkey_mto;" local_association_name="Manager" foreign_association_name="Managed" /> Index: Students.xml =================================================================== RCS file: /cvsroot/pymerase/pymerase/examples/school/schema/Students.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Students.xml 15 Sep 2002 06:52:04 -0000 1.3 --- Students.xml 14 Dec 2002 02:16:41 -0000 1.4 *************** *** 20,24 **** foreign_table="Faculty" foreign_table_pkey="uid" ! fkey_type="&fkey_mto;" foreign_association_name="Advisor" local_association_name="Students"/> --- 20,24 ---- foreign_table="Faculty" foreign_table_pkey="uid" ! fkey_type="&fkey_oto;" foreign_association_name="Advisor" local_association_name="Students"/> |
From: <de...@us...> - 2002-12-14 02:16:44
|
Update of /cvsroot/pymerase/pymerase/examples/school In directory sc8-pr-cvs1:/tmp/cvs-serv11208 Modified Files: TestSchool.py Log Message: Getting parseGenexTableDTD to follow the new more UML-esque handling of Associations seemed to require updating my schema. Some examples were obviously wrong. (like in Students, having the advisior and house links having different multiplicities.) However I'm not really sure if all of the changes were correct. (like with the change in multiplicity for the Manager/Manged in the Employees class. Index: TestSchool.py =================================================================== RCS file: /cvsroot/pymerase/pymerase/examples/school/TestSchool.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TestSchool.py 15 Sep 2002 06:49:23 -0000 1.8 --- TestSchool.py 14 Dec 2002 02:16:41 -0000 1.9 *************** *** 189,192 **** --- 189,193 ---- erin.setFamilyName("Ericsson") erin.setHouses(houses['page']) + faculty['yolanda'].appendStudents(erin) faculty['yolanda'].commit() *************** *** 198,201 **** --- 199,203 ---- erin_loaded = erin_list[0] + print erin.id(), erin_loaded.id() self.failUnless(erin.id() == erin_loaded.id()) self.failUnless(erin.getGivenName() == erin_loaded.getGivenName()) *************** *** 235,247 **** classes = s.Classes() ! classes.appendCourses(bi188) ! classes.appendPeople(charles) classes.setTerm(DateTime.DateTime(2002,04,01)) classes.commit() classes = s.Classes() ! classes.appendCourses(bi188) ! classes.appendPeople(daria) classes.setTerm(DateTime.DateTime(2002,04,01)) classes.commit() --- 237,251 ---- classes = s.Classes() ! classes.setCourses(bi188) ! classes.setStudents(charles) classes.setTerm(DateTime.DateTime(2002,04,01)) + classes.setGrade(3.3) classes.commit() classes = s.Classes() ! classes.setCourses(bi188) ! classes.setStudents(daria) classes.setTerm(DateTime.DateTime(2002,04,01)) + classes.setGrade(3.7) classes.commit() |
From: <de...@us...> - 2002-12-14 02:13:48
|
Update of /cvsroot/pymerase/pymerase In directory sc8-pr-cvs1:/tmp/cvs-serv11116 Modified Files: ClassMembers.py Log Message: Add functions for returning a foreign key name. move CreateAssociations from parseXMI as it's now shared between parseXMI and parseGenexTableDTD. Index: ClassMembers.py =================================================================== RCS file: /cvsroot/pymerase/pymerase/ClassMembers.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ClassMembers.py 12 Dec 2002 20:54:25 -0000 1.14 --- ClassMembers.py 14 Dec 2002 02:13:44 -0000 1.15 *************** *** 188,191 **** --- 188,225 ---- return self.primaryKey + def createAssociation(pymeraseConfig, thisEnd, otherEnd, associationName=None, associationUUID=None): + """Helper function to create association with provided associationEnds + """ + # Make sure the AssociationEnds are bound to an Association + if associationName is None: + associationName = thisEnd.getName(None) + otherEnd.getName(None) + + if associationUUID is None: + associationUUID = thisEnd.getName(None) + otherEnd.getName(None) + + if thisEnd.getAssociation() is None and otherEnd.getAssociation() is None: + print "no associations" + association = Association(pymeraseConfig, associationName) + association.setUUID(associationUUID) + thisEnd.setAssociation(association) + association.addAssociationEnd(thisEnd) + otherEnd.setAssociation(association) + association.addAssociationEnd(otherEnd) + # since we always construct both ends at a time is this code actually + # needed? + elif thisEnd.getAssociation() is None: + print "this is none" + association = otherEnd.getAssociation() + thisEnd.setAssociation(association) + association.addAssociationEnd(thisEnd) + elif otherEnd.getAssociation() is None: + print "other is none" + association = thisEnd.getAssociation() + otherEnd.setAssociation(association) + association.addAssociationEnd(otherEnd) + else: + # everything is already set up + pass + class Association(ModelElement): """Describe the meta info regarding the between two objects *************** *** 412,415 **** --- 446,450 ---- self.primaryKeyName = None self.primaryKeyConstructed = 0 + self.foreignKeyName = None self.security = [] self.indices = [] *************** *** 646,660 **** def getPrimaryKeyName(self, translatorName): """return primary key name """ ! if not self.primaryKeyConstructed: self.setPrimaryKeyName() ! if self.primaryKeyName is not None: ! mangler = self.config.getNameMangler(translatorName) ! return mangler.mangle(self.primaryKeyName) else: ! # we inherit from some other class (which has the primary key) ! return None def getIndices(self): return [] --- 681,724 ---- def getPrimaryKeyName(self, translatorName): """return primary key name + + Default to user defined key otherwise use the primary key name + of the base class. """ ! ! if self.primaryKeyName is not None: ! primaryKeyName = self.primaryKeyName ! elif self.isRootClass() and not self.primaryKeyConstructed: self.setPrimaryKeyName() + primaryKeyName = self.primaryKeyName + else: + return self.getBasePrimaryKeyName(translatorName) + + mangler = self.config.getNameMangler(translatorName) + return mangler.mangle(self.primaryKeyName) ! ! def setForeignKeyName(self, keyName): ! """Set the foreign key name that should be used for this class. ! """ ! self.foreignKeyName = keyName ! ! def getForeignKeyName(self, translatorName): ! """Return the foreign key name that should be used for this class. ! """ ! mangler = self.config.getNameMangler(translatorName) ! ! if self.foreignKeyName is not None: ! return mangler.mangle(self.foreignKeyName) ! elif not self.isRootClass(): ! rootClass = self.getRootClass() ! return rootClass.getForeignKeyName(translatorName) else: ! warn("No foreign key name set for %s, making one up" % (self.name), ! InfoWarning) ! primaryKeyName = self.getPrimaryKeyName(None) ! self.foreignKeyName = util.NameMangling.RelationalKey().getForeignKey(primaryKeyName) ! return self.foreignKeyName + def getIndices(self): return [] |
From: <ki...@us...> - 2002-12-13 00:36:56
|
Update of /cvsroot/pymerase/pymerase/output/PyTkWidgets In directory sc8-pr-cvs1:/tmp/cvs-serv16272 Modified Files: HelperUtil.py Log Message: now supports Tkinter.Text Index: HelperUtil.py =================================================================== RCS file: /cvsroot/pymerase/pymerase/output/PyTkWidgets/HelperUtil.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HelperUtil.py 12 Dec 2002 21:25:01 -0000 1.1 --- HelperUtil.py 13 Dec 2002 00:36:52 -0000 1.2 *************** *** 104,106 **** --- 104,145 ---- return string.join(code, '\n') + + def makeLabelText(self, name, labelText): + """ + Creates the code for generating a Label & Text pair and returns the code + """ + + code = [] + code.append(" self.%sLabel = Tkinter.Label(self.parent, text=\"%s:\")" % \ + (name, labelText)) + code.append(" self.%sLabel.grid(row=%s, column=0)" % (name, self.getRowCounter())) + code.append(" self.%sText = Tkinter.Text(self.parent, width=40, height=5)" % (name)) + code.append(" self.%sText.grid(row=%s, column=0)" % (name, self.getRowCounter())) + code.append("") + code.append("%VAR_ELEMENT%") + + return string.join(code, '\n') + + + def makeGetLabelText(self, name): + + code = [] + code.append(" def get%sText(self):" % (name)) + code.append(" return self.%sText.get(0.0, Tkinter.END)" % (name)) + code.append("") + code.append("%GET_FUNCTION%") + + return string.join(code, '\n') + + def makeSetLabelText(self, name): + + code = [] + code.append(" def set%sText(self, text=None):" % (name)) + code.append(" self.%sText.delete(0.0, Tkinter.END)" % (name)) + code.append(" if text is not None:") + code.append(" self.%sText.insert(0, text)" % (name)) + code.append("") + code.append("%SET_FUNCTION%") + + return string.join(code, '\n') |
From: <ki...@us...> - 2002-12-13 00:36:22
|
Update of /cvsroot/pymerase/pymerase/output In directory sc8-pr-cvs1:/tmp/cvs-serv16069 Modified Files: CreatePyTkWidgets.py Log Message: Updated to generate text boxes Index: CreatePyTkWidgets.py =================================================================== RCS file: /cvsroot/pymerase/pymerase/output/CreatePyTkWidgets.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CreatePyTkWidgets.py 12 Dec 2002 21:22:46 -0000 1.1 --- CreatePyTkWidgets.py 13 Dec 2002 00:36:16 -0000 1.2 *************** *** 32,36 **** # ! """Creates HTML Forms of each Class/Table""" import os --- 32,36 ---- # ! """Creates Python TK Widgets of each Class/Table""" import os *************** *** 150,153 **** --- 150,164 ---- #Process Text elif type == "text": + code = re.sub('%VAR_ELEMENT%', + util.makeLabelText(attrib.getName(DBAPI_TRANSLATOR), + attrib.getName(TRANSLATOR_NAME)), + code) + code = re.sub('%GET_FUNCTION%', + util.makeGetLabelText(attrib.getName(DBAPI_TRANSLATOR)), + code) + + code = re.sub('%SET_FUNCTION%', + util.makeSetLabelText(attrib.getName(DBAPI_TRANSLATOR)), + code) pass #Process Variable Characters |
From: <ki...@us...> - 2002-12-12 21:32:09
|
Update of /cvsroot/pymerase/pymerase/examples/dvd In directory sc8-pr-cvs1:/tmp/cvs-serv15766 Added Files: createpytkwidgets.py Log Message: create PyTkWidgets --- NEW FILE: createpytkwidgets.py --- #!/usr/bin/env python import sys import os import pymerase # NOTE: Jython can't use the python way to load modules based on their name # NOTE: so we have to manually import the modules we're using # NOTE: and pass them to pymerase.run import input.parseXMI import output.CreatePyTkWidgets if __name__ == "__main__": schema = os.path.abspath("./dvd_.xmi") outputPath = os.path.abspath("./widgets") #pymerase.run(schema, 'parseXMI', output, 'CreateDBAPI') pymerase.run(schema, input.parseXMI, outputPath, output.CreatePyTkWidgets) |
From: <ki...@us...> - 2002-12-12 21:31:33
|
Update of /cvsroot/pymerase/pymerase/examples/xmiSchool In directory sc8-pr-cvs1:/tmp/cvs-serv15489 Added Files: createpytkwidgets.py Log Message: generate PyTkWidgets --- NEW FILE: createpytkwidgets.py --- #!/usr/bin/env python import sys import os import pymerase # NOTE: Jython can't use the python way to load modules based on their name # NOTE: so we have to manually import the modules we're using # NOTE: and pass them to pymerase.run import input.parseXMI import output.CreatePyTkWidgets if __name__ == "__main__": schema = os.path.abspath("./school.xmi") outputPath = os.path.abspath("./widgets") #pymerase.run(schema, 'parseXMI', output, 'CreateDBAPI') pymerase.run(schema, input.parseXMI, outputPath, output.CreatePyTkWidgets) |
From: <ki...@us...> - 2002-12-12 21:26:45
|
Update of /cvsroot/pymerase/pymerase/output/PyTkWidgets In directory sc8-pr-cvs1:/tmp/cvs-serv13439 Added Files: .cvsignore Log Message: usual --- NEW FILE: .cvsignore --- *.pyc *.class |
From: <ki...@us...> - 2002-12-12 21:25:06
|
Update of /cvsroot/pymerase/pymerase/output/PyTkWidgets In directory sc8-pr-cvs1:/tmp/cvs-serv13117 Added Files: HelperUtil.py Log Message: Early version of PyTkWidgets.HelperUtil --- NEW FILE: HelperUtil.py --- ########################################################################### # # # C O P Y R I G H T N O T I C E # # Copyright (c) 2002 by: # # * California Institute of Technology # # # # All Rights Reserved. # # # # Permission is hereby granted, free of charge, to any person # # obtaining a copy of this software and associated documentation files # # (the "Software"), to deal in the Software without restriction, # # including without limitation the rights to use, copy, modify, merge, # # publish, distribute, sublicense, and/or sell copies of the Software, # # and to permit persons to whom the Software is furnished to do so, # # subject to the following conditions: # # # # The above copyright notice and this permission notice shall be # # included in all copies or substantial portions of the Software. # # # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS # # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN # # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # # SOFTWARE. # ########################################################################### # # Authors: Brandon King # Last Modified: $Date: 2002/12/12 21:25:01 $ # import string class HelperUtil: def __init__(self): self.rowCounter = 0 self.colCounter = 0 def setRowCounter(self, value): self.rowCounter = value def getRowCounter(self): counter = self.rowCounter self.rowCounter += 1 return counter def resetRowCounter(self): self.rowCounter = 0 def getPrimaryKeyLabel(self, name, value): code = [] code.append(" self.%sLabel = Tkinter.Label(self.parent, text=\"%s: %s\")" % \ (label, label, value)) code.append(" self.%sLabel.grid(row=%s, column=0)" % (label, self.getRowCounter())) code.append("") code.append("%VAR_ELEMENT%") return string.join(code, '\n') def makeLabelEntry(self, name, labelText): """ Creates the code for generating a Label & Entry pair and returns the code """ counter = self.getRowCounter() code = [] code.append(" self.%sLabel = Tkinter.Label(self.parent, text=\"%s:\")" % \ (name, labelText)) code.append(" self.%sLabel.grid(row=%s, column=0)" % (name, counter)) code.append(" self.%sEntry = Tkinter.Entry(self.parent)" % (name)) code.append(" self.%sEntry.grid(row=%s, column=1)" % (name, counter)) code.append("") code.append("%VAR_ELEMENT%") return string.join(code, '\n') def makeGetLabelEntry(self, name): code = [] code.append(" def get%sEntry(self):" % (name)) code.append(" return self.%sEntry.get()" % (name)) code.append("") code.append("%GET_FUNCTION%") return string.join(code, '\n') def makeSetLabelEntry(self, name): code = [] code.append(" def set%sEntry(self, text=None):" % (name)) code.append(" self.%sEntry.delete(0, Tkinter.END)" % (name)) code.append(" if text is not None:") code.append(" self.%sEntry.insert(0, text)" % (name)) code.append("") code.append("%SET_FUNCTION%") return string.join(code, '\n') |
From: <ki...@us...> - 2002-12-12 21:24:00
|
Update of /cvsroot/pymerase/pymerase/output/PyTkWidgets In directory sc8-pr-cvs1:/tmp/cvs-serv12841 Added Files: __init__.py Log Message: PyTkWidgets Package --- NEW FILE: __init__.py --- #!/usr/bin/env python ########################################################################### # # # C O P Y R I G H T N O T I C E # # Copyright (c) 2002 by: # # * California Institute of Technology # # # # All Rights Reserved. # # # # Permission is hereby granted, free of charge, to any person # # obtaining a copy of this software and associated documentation files # # (the "Software"), to deal in the Software without restriction, # # including without limitation the rights to use, copy, modify, merge, # # publish, distribute, sublicense, and/or sell copies of the Software, # # and to permit persons to whom the Software is furnished to do so, # # subject to the following conditions: # # # # The above copyright notice and this permission notice shall be # # included in all copies or substantial portions of the Software. # # # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS # # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN # # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # # SOFTWARE. # ########################################################################### # # Authors: Brandon King # Last Modified: $Date: 2002/12/12 21:23:56 $ # |
From: <ki...@us...> - 2002-12-12 21:23:07
|
Update of /cvsroot/pymerase/pymerase/output/PyTkWidgets In directory sc8-pr-cvs1:/tmp/cvs-serv12614/PyTkWidgets Log Message: Directory /cvsroot/pymerase/pymerase/output/PyTkWidgets added to the repository |
From: <ki...@us...> - 2002-12-12 21:22:50
|
Update of /cvsroot/pymerase/pymerase/output In directory sc8-pr-cvs1:/tmp/cvs-serv11976 Added Files: CreatePyTkWidgets.py Log Message: First Semi-working version Only handles varchar entries currently, but soon more. =o) --- NEW FILE: CreatePyTkWidgets.py --- ########################################################################### # # # C O P Y R I G H T N O T I C E # # Copyright (c) 2002 by: # # * California Institute of Technology # # # # All Rights Reserved. # # # # Permission is hereby granted, free of charge, to any person # # obtaining a copy of this software and associated documentation files # # (the "Software"), to deal in the Software without restriction, # # including without limitation the rights to use, copy, modify, merge, # # publish, distribute, sublicense, and/or sell copies of the Software, # # and to permit persons to whom the Software is furnished to do so, # # subject to the following conditions: # # # # The above copyright notice and this permission notice shall be # # included in all copies or substantial portions of the Software. # # # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS # # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN # # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # # SOFTWARE. # ########################################################################### # # Authors: Brandon King # Last Modified: $Date: 2002/12/12 21:22:46 $ # """Creates HTML Forms of each Class/Table""" import os import sys import re from output.PyTkWidgets import HelperUtil from util import PymeraseType from ClassMembers import getAllAttributes from ClassMembers import getAllAssociations ############################ # Globals TRANSLATOR_NAME='CreatePyTkWidgets' DBAPI_TRANSLATOR='CreateDBAPI' ############################ # Writer components def getTemplate(): template = """#!/usr/bin/env python import Tkinter class %CLASSNAME%Widget: def __init__(self, master): self.parent = master %VAR_ELEMENT% def getParent(self): return self.parent %GET_FUNCTION% %SET_FUNCTION% if __name__ == '__main__': root = Tkinter.Tk(className=\" %CLASSNAME%\") %CLASSNAME%gui = %CLASSNAME%Widget(root) root.mainloop() """ return template #def isFKey(name): # """ # Checks to see if a field is a foreign key or primary key. # # returns 1 if is fk or pk # returns 0 if is not fk or pk # """ # #FIXME: GeneX specific currently... needs to be more generic. # #FIXME: Should make sure FK/PK are at end of string # result = re.search('Fk', name) # result2 = re.search('Pk', name) # result3 = re.search('ID', name) # if result != None or result2 != None or result3 != None: # return 1 # else: # return 0 def checkDestination(destination): """ Checks to see if the destination path exists, if it doesn't it creates the directory and moves into it. """ destination = os.path.abspath(destination) if os.path.exists(destination) == 0: os.mkdir(destination) elif os.path.isdir(destination) == 0: print "%s exists but is not a directory." % (destination) sys.exit(2) ############################################### #CreateTkWidgets write function -- called by pymerase def write(destination, classList): """ Creates PyTk Widgets in destination dirctory. """ checkDestination(destination) util = HelperUtil.HelperUtil() #Iterate through the tables/classes and process the data for myClass in classList: code = getTemplate() #Replace Template %CLASSNAME% with actual class name code = re.sub('%CLASSNAME%', myClass.getName(DBAPI_TRANSLATOR), code) #Reset Grid Layout rowCounter util.resetRowCounter() for attrib in getAllAttributes(classList, myClass, DBAPI_TRANSLATOR): type = attrib.getType().getSQLType() print "Processing(%s:%s)" % (myClass.getName(TRANSLATOR_NAME), type) print " CapsWord: %s; English: %s" % (myClass.getName(DBAPI_TRANSLATOR), myClass.getName(TRANSLATOR_NAME)) #Process Foriegn keys #if isFKey(attrib.getName(TRANSLATOR_NAME)) or type == "serial": # pass #Process Integers and Doubles if type == "integer" or type == "double precision": pass elif type == "name": pass #Process Text elif type == "text": pass #Process Variable Characters elif PymeraseType.isVarchar(type): code = re.sub('%VAR_ELEMENT%', util.makeLabelEntry(attrib.getName(DBAPI_TRANSLATOR), attrib.getName(TRANSLATOR_NAME)), code) code = re.sub('%GET_FUNCTION%', util.makeGetLabelEntry(attrib.getName(DBAPI_TRANSLATOR)), code) code = re.sub('%SET_FUNCTION%', util.makeSetLabelEntry(attrib.getName(DBAPI_TRANSLATOR)), code) #Process Characters elif PymeraseType.isChar(type): pass #PymeraseType.getVarcharLen(type), #Process Boolean elif type == "boolean": pass #Process Time Stamps elif type == "timestamp with time zone": pass #Write out what is not being handled. else: print "Table(%s), Type(%s), Attribute(%s) not processed." % \ (myClass.getName(TRANSLATOR_NAME), type, attrib.getName(TRANSLATOR_NAME)) #Remove '%*%' code = re.sub('%VAR_ELEMENT%', '', code) code = re.sub('%GET_FUNCTION%', '', code) code = re.sub('%SET_FUNCTION%', '', code) #Write TkWidget to file fileName = "%sWidget.py" % (myClass.getName(DBAPI_TRANSLATOR)) filePath = os.path.join(os.path.abspath(destination), fileName) f = open(filePath, 'w') f.write(code) f.close() print os.linesep \ + "HTML Form Generation Complete... Good Bye." \ + os.linesep |
From: <ki...@us...> - 2002-12-12 20:54:29
|
Update of /cvsroot/pymerase/pymerase In directory sc8-pr-cvs1:/tmp/cvs-serv1374 Modified Files: ClassMembers.py Log Message: forgot a TRANSLATOR_NAME variable Index: ClassMembers.py =================================================================== RCS file: /cvsroot/pymerase/pymerase/ClassMembers.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ClassMembers.py 11 Dec 2002 20:29:12 -0000 1.13 --- ClassMembers.py 12 Dec 2002 20:54:25 -0000 1.14 *************** *** 44,48 **** if len(tbl.getBaseClassNames(TRANSLATOR_NAME)) > 0: for tblName in tbl.getBaseClassNames(TRANSLATOR_NAME): ! atts += getAllAttributes(tables, getClassByName(tables, tblName)) atts += tbl.getAttributes() return atts --- 44,48 ---- if len(tbl.getBaseClassNames(TRANSLATOR_NAME)) > 0: for tblName in tbl.getBaseClassNames(TRANSLATOR_NAME): ! atts += getAllAttributes(tables, getClassByName(tables, tblName), TRANSLATOR_NAME) atts += tbl.getAttributes() return atts |
From: <ki...@us...> - 2002-12-12 17:55:28
|
Update of /cvsroot/pymerase/pymerase/util In directory sc8-pr-cvs1:/tmp/cvs-serv30680 Modified Files: xor_string.py Log Message: Changed the author to proper name. Index: xor_string.py =================================================================== RCS file: /cvsroot/pymerase/pymerase/util/xor_string.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** xor_string.py 11 Dec 2002 22:31:30 -0000 1.3 --- xor_string.py 12 Dec 2002 17:55:25 -0000 1.4 *************** *** 28,32 **** # SOFTWARE. # ########################################################################### ! # Authors: Brandon King # Last Modified: $Date$ # --- 28,32 ---- # SOFTWARE. # ########################################################################### ! # Authors: Diane Trout # Last Modified: $Date$ # |