[Modeling-cvs] ProjectModeling/Modeling Relationship.py,1.11,1.12
Status: Abandoned
Brought to you by:
sbigaret
From: <sbi...@us...> - 2003-07-24 11:13:31
|
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv22581 Modified Files: Relationship.py Log Message: Fixed methods in FlattenedRelationship that were copy-pasted from SipleRelationship but were inappropriate Index: Relationship.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/Relationship.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Relationship.py 23 Jul 2003 12:17:41 -0000 1.11 --- Relationship.py 24 Jul 2003 11:13:27 -0000 1.12 *************** *** 686,689 **** --- 686,691 ---- def __eq__(self, aRelationship): "Tests whether both relationship are equal" + if aRelationship.isFlattened(): + return 0 try: # _TBD define __eq__ for Entity *************** *** 841,850 **** def checkRelationshipValidity(self): """ Checks the relationship validity. This includes the following tests: - cardinality > 0 ! - len(joins) > 0 - name - source and destinationEntity are not None - - joins' sources are identical (idem for destinations) Raises the relation is invalid. """ --- 843,852 ---- def checkRelationshipValidity(self): """ + Not Implemented Checks the relationship validity. This includes the following tests: - cardinality > 0 ! - definition is set - name - source and destinationEntity are not None Raises the relation is invalid. """ *************** *** 885,896 **** def destinationAttributes(self): """ ! Simply returns the list of joins' destination attributes """ ! return () def destinationEntity(self): """ ! Returns the destination entity, or 'None' if the relationship has no joins ! yet """ components=self.componentRelationships() --- 887,899 ---- def destinationAttributes(self): """ ! Unimplemented """ ! raise NotImplementedError ! #return () def destinationEntity(self): """ ! Returns the destination entity, or 'None' if the relationship has no ! definition yet """ components=self.componentRelationships() *************** *** 950,958 **** def isSimple(self): """ ! Indicates whether the relation holds one join. ! Note that this method return also 'true' when the relationship ! is invalid (i.e. it holds no joins) """ ! return not (self._joins and len(self._joins)>1) def isToMany(self): --- 953,959 ---- def isSimple(self): """ ! Unappropriate """ ! self.raiseUnappropriate() def isToMany(self): *************** *** 971,986 **** def joins(self): ! "Return the whole set of joins registered in this relationship" ! return () def ownsDestination(self): # strict equival. toUML aggregate ? """ ! Returns true if the relationship owns the destinationEntity. ! See also: setOwnsDestination() ! When a relationship owns its destination, the related entity object ! cannot exist without the source object. Thus, as a side-effect, this ! sets the delete rule to 'cascade'. """ ! return self._ownsDestination def propagatesPrimaryKey(self): --- 972,983 ---- def joins(self): ! "Unappropriate for flattened relationship" ! self.raiseUnappropriate() def ownsDestination(self): # strict equival. toUML aggregate ? """ ! Unappropriate """ ! self.raiseUnappropriate() def propagatesPrimaryKey(self): *************** *** 1043,1049 **** def sourceAttributes(self): """ ! Simply returns the list of joins' source attributes """ ! return map(lambda o:o.sourceAttribute(), self._joins) def validateRelationship(self): --- 1040,1046 ---- def sourceAttributes(self): """ ! Unimplemented """ ! raise NotImplementedError def validateRelationship(self): *************** *** 1116,1119 **** --- 1113,1118 ---- def __eq__(self, aRelationship): "Tests whether both relationship are equal" + if not aRelationship.isFlattened(): + return 0 try: # _TBD define __eq__ for Entity *************** *** 1132,1139 **** self.ownsDestination()!=aRelationship.ownsDestination(): return 0 - # Test joins set!! - if len(self._joins)!=len(aRelationship.joins()): return 0 - for aJoin in aRelationship.joins(): - if aJoin not in self._joins: return 0 except: return 0 --- 1131,1134 ---- |