[Modeling-cvs] ProjectModeling/Modeling/tests/testPackages/StoreEmployees Holidays.py,NONE,1.1 Emplo
Status: Abandoned
Brought to you by:
sbigaret
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests/testPackages/StoreEmployees In directory sc8-pr-cvs1:/tmp/cvs-serv5376/tests/testPackages/StoreEmployees Modified Files: Employee.py model_StoreEmployees.py model_StoreEmployees.xml pymodel_StoreEmployees.py Added Files: Holidays.py Log Message: Added Relationship.anyInverseRelationship() --plus entity Holidays in test model StoreEmployees, with a toMany rel. Employee-->Holidays having no inverse. This is the first step towards the removal of the constraint on to-many relationships that should have an inverse toOne rel. for the moment being. --- NEW FILE: Holidays.py --- # Modeling from Modeling.CustomObject import CustomObject from Modeling.Validation import ValidationException class Holidays(CustomObject): """ Holidays are objects ... """ __implements__ = CustomObject.__implements__ def __init__(self): "Initializer" self._startDate = None self._endDate = None def entityName(self): "Used by the framework to link this object to its entity" return "Holidays" # do not change # Attribute: month def getStartDate(self): "Return the Holidays / startDate attribute value" self.willRead() return self._startDate def setStartDate(self,startDate): "Change the Holidays / startDate attribute value" self.willChange() self._startDate = startDate def validateStartDate(self, value): "Edit this to enforce custom business logic" if 0: # your custom bizlogic raise ValidationException return # Attribute: endDate def getEndDate(self): "Return the Holidays / endDate attribute value" self.willRead() return self._endDate def setEndDate(self,endDate): "Change the Holidays / endDate attribute value" self.willChange() self._endDate = endDate def validateEndDate(self, value): "Edit this to enforce custom business logic" if 0: # your custom bizlogic raise ValidationException return Index: Employee.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/testPackages/StoreEmployees/Employee.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Employee.py 2 Oct 2002 08:39:59 -0000 1.3 --- Employee.py 25 Jul 2003 15:39:04 -0000 1.4 *************** *** 17,20 **** --- 17,21 ---- self._firstName = None self._toAddresses=[] + self._holidays=[] self._toStore=None *************** *** 83,86 **** --- 84,111 ---- _toAddresses.remove(object) self._toAddresses=tuple(_toAddresses) + + + + # Relationship: holidays + + def getHolidays(self): + "Returns the holidays relationship (toMany)" + self.willRead() + return self._holidays + + def addToHolidays(self,object): + "Add the holidays relationship (toMany)" + if object not in self._holidays: + self.willChange() + _holidays=list(self._holidays) + _holidays.append(object) + self._holidays=tuple(_holidays) + + def removeFromHolidays(self,object): + "Remove the holidays relationship (toMany)" + self.willChange() + _holidays=list(self._holidays) + _holidays.remove(object) + self._holidays=tuple(_holidays) Index: model_StoreEmployees.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/testPackages/StoreEmployees/model_StoreEmployees.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** model_StoreEmployees.py 7 May 2003 11:27:10 -0000 1.5 --- model_StoreEmployees.py 25 Jul 2003 15:39:04 -0000 1.6 *************** *** 23,26 **** --- 23,29 ---- <join sourceAttribute='fkStoreId' destinationAttribute='id'/> </relation> + <relation deleteRule='0' isClassProperty='1' multiplicityUpperBound='-1' multiplicityLowerBound='0' destinationEntity='Holidays' name='holidays' displayLabel='' joinSemantic='0'> + <join sourceAttribute='id' destinationAttribute='fkEmployeeId'/> + </relation> </entity> <entity isReadOnly='0' isAbstract='0' name='Address' parentEntity='' moduleName='Address' className='Address' typeName='' externalName='ADDRESS'> *************** *** 50,53 **** --- 53,59 ---- <join sourceAttribute='fkStoreId' destinationAttribute='id'/> </relation> + <relation deleteRule='0' isClassProperty='1' multiplicityUpperBound='-1' multiplicityLowerBound='0' destinationEntity='Holidays' name='holidays' displayLabel='' joinSemantic='0'> + <join sourceAttribute='id' destinationAttribute='fkEmployeeId'/> + </relation> </entity> <entity isReadOnly='0' isAbstract='0' name='Executive' parentEntity='Employee' moduleName='Executive' className='Executive' typeName='' externalName='EXECUTIVE'> *************** *** 69,72 **** --- 75,81 ---- <join sourceAttribute='id' destinationAttribute='FK_Executive_id'/> </relation> + <relation deleteRule='0' isClassProperty='1' multiplicityUpperBound='-1' multiplicityLowerBound='0' destinationEntity='Holidays' name='holidays' displayLabel='' joinSemantic='0'> + <join sourceAttribute='id' destinationAttribute='fkEmployeeId'/> + </relation> </entity> <entity isReadOnly='0' isAbstract='0' name='Mark' parentEntity='' moduleName='Mark' className='Mark' typeName='' externalName='MARK'> *************** *** 80,84 **** </relation> </entity> </model> - """ --- 89,99 ---- </relation> </entity> + <entity isReadOnly='0' isAbstract='0' name='Holidays' parentEntity='' moduleName='Holidays' className='Holidays' typeName='' externalName='HOLIDAYS'> + <primaryKey attributeName='id'/> + <attribute isClassProperty='0' width='0' columnName='ID' isRequired='1' precision='0' defaultValue='None' externalType='INTEGER' name='id' scale='0' type='int' displayLabel=''/> + <attribute isClassProperty='1' width='0' columnName='START_DATE' isRequired='1' precision='0' defaultValue='None' externalType='TIMESTAMP' name='startDate' scale='0' type='DateTime' displayLabel=''/> + <attribute isClassProperty='1' width='0' columnName='END_DATE' isRequired='1' precision='0' defaultValue='None' externalType='TIMESTAMP' name='endDate' scale='0' type='DateTime' displayLabel=''/> + <attribute isClassProperty='0' width='0' columnName='FK_EMPLOYEE_ID' isRequired='0' precision='0' defaultValue='None' externalType='INTEGER' name='fkEmployeeId' scale='0' type='int' displayLabel=''/> + </entity> </model> """ Index: model_StoreEmployees.xml =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/testPackages/StoreEmployees/model_StoreEmployees.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** model_StoreEmployees.xml 7 May 2003 11:27:11 -0000 1.5 --- model_StoreEmployees.xml 25 Jul 2003 15:39:04 -0000 1.6 *************** *** 23,26 **** --- 23,29 ---- <join sourceAttribute='fkStoreId' destinationAttribute='id'/> </relation> + <relation deleteRule='0' isClassProperty='1' multiplicityUpperBound='-1' multiplicityLowerBound='0' destinationEntity='Holidays' name='holidays' displayLabel='' joinSemantic='0'> + <join sourceAttribute='id' destinationAttribute='fkEmployeeId'/> + </relation> </entity> <entity isReadOnly='0' isAbstract='0' name='Address' parentEntity='' moduleName='Address' className='Address' typeName='' externalName='ADDRESS'> *************** *** 50,53 **** --- 53,59 ---- <join sourceAttribute='fkStoreId' destinationAttribute='id'/> </relation> + <relation deleteRule='0' isClassProperty='1' multiplicityUpperBound='-1' multiplicityLowerBound='0' destinationEntity='Holidays' name='holidays' displayLabel='' joinSemantic='0'> + <join sourceAttribute='id' destinationAttribute='fkEmployeeId'/> + </relation> </entity> <entity isReadOnly='0' isAbstract='0' name='Executive' parentEntity='Employee' moduleName='Executive' className='Executive' typeName='' externalName='EXECUTIVE'> *************** *** 69,72 **** --- 75,81 ---- <join sourceAttribute='id' destinationAttribute='FK_Executive_id'/> </relation> + <relation deleteRule='0' isClassProperty='1' multiplicityUpperBound='-1' multiplicityLowerBound='0' destinationEntity='Holidays' name='holidays' displayLabel='' joinSemantic='0'> + <join sourceAttribute='id' destinationAttribute='fkEmployeeId'/> + </relation> </entity> <entity isReadOnly='0' isAbstract='0' name='Mark' parentEntity='' moduleName='Mark' className='Mark' typeName='' externalName='MARK'> *************** *** 79,82 **** --- 88,98 ---- <join sourceAttribute='FK_Executive_id' destinationAttribute='id'/> </relation> + </entity> + <entity isReadOnly='0' isAbstract='0' name='Holidays' parentEntity='' moduleName='Holidays' className='Holidays' typeName='' externalName='HOLIDAYS'> + <primaryKey attributeName='id'/> + <attribute isClassProperty='0' width='0' columnName='ID' isRequired='1' precision='0' defaultValue='None' externalType='INTEGER' name='id' scale='0' type='int' displayLabel=''/> + <attribute isClassProperty='1' width='0' columnName='START_DATE' isRequired='1' precision='0' defaultValue='None' externalType='TIMESTAMP' name='startDate' scale='0' type='DateTime' displayLabel=''/> + <attribute isClassProperty='1' width='0' columnName='END_DATE' isRequired='1' precision='0' defaultValue='None' externalType='TIMESTAMP' name='endDate' scale='0' type='DateTime' displayLabel=''/> + <attribute isClassProperty='0' width='0' columnName='FK_EMPLOYEE_ID' isRequired='0' precision='0' defaultValue='None' externalType='INTEGER' name='fkEmployeeId' scale='0' type='int' displayLabel=''/> </entity> </model> Index: pymodel_StoreEmployees.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/testPackages/StoreEmployees/pymodel_StoreEmployees.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pymodel_StoreEmployees.py 7 Jul 2003 14:57:15 -0000 1.2 --- pymodel_StoreEmployees.py 25 Jul 2003 15:39:04 -0000 1.3 *************** *** 58,62 **** AInteger('mark', isRequired=1), ] ! ) ] model.associations=[ --- 58,67 ---- AInteger('mark', isRequired=1), ] ! ), ! Entity('Holidays', ! properties=[ ADateTime('startDate', isRequired=1), ! ADateTime('endDate', isRequired=1), ! ] ! ), ] model.associations=[ *************** *** 74,77 **** --- 79,86 ---- delete=['nullify', 'deny'], keys=['fkStoreId', 'id']), + Association('Holidays', 'Employee', + relations=[None, 'holidays'], + delete=[None, 'cascade'], + keys=['fkEmployeeId', 'id']), ] |