Implementing ZPattern: Containment
Hi, How could containment be implemented with ZPatterns. Container -n-----1- ContainedItem -n-----1- ContainedSubItem I suppose there would be a Containter Specialist containing a ContainerItem Specialist. But Specialists retrieve objects by IDs so there would also be a list of ContainerItem ID in the Container object. Are there any other way to do it, for instance keeping a list of object references that would be retrieve from the ContainerItem Specialist by a attribute provider in the Containter Specialist? But I still need the list of IDs don't I or how else would the ContainerItem Specialist know what objects to return? TIA, Johan Carlsson
Hi Johan, Have a look at http://www.zope.org/Members/sspickle/DumbZPatternsExample The best way I've found is to provide a method (or methods) in the Specialist of the contained item to get ids of those instances satisfying certain criteria... e.g., getToDoIdsForDoer( aDoer ) (the contained item keeps a reference to the id of its container.) -steve
"Johan" == Johan Carlsson <johanc@torped.se> writes:
Johan> Hi, How could containment be implemented with ZPatterns. Johan> Container -n-----1- ContainedItem -n-----1- Johan> ContainedSubItem Johan> I suppose there would be a Containter Specialist containing Johan> a ContainerItem Specialist. But Specialists retrieve Johan> objects by IDs so there would also be a list of Johan> ContainerItem ID in the Container object. Johan> Are there any other way to do it, for instance keeping a Johan> list of object references that would be retrieve from the Johan> ContainerItem Specialist by a attribute provider in the Johan> Containter Specialist? But I still need the list of IDs Johan> don't I or how else would the ContainerItem Specialist know Johan> what objects to return? Johan> TIA, Johan Carlsson Johan> ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÙ¢ÿ ëæj)eËÿf^ü7¯ÿ:){ú+m§ÿÿ+-³üè¥ïè®æj)fjåËbú?Î^ýׯÿóhrº,²,¶Ê+3zw(v)àÿÿÿEéZµçeËlþm§ÿÿ+-³üè¥ïè®æj)fjåËbú?Î^ý©ç¢éÜzm§ÿÿ+-³üè¥ïè®æj)fjåËbú?Î^
Hi Johan,
Have a look at http://www.zope.org/Members/sspickle/DumbZPatternsExample
The best way I've found is to provide a method (or methods) in the Specialist of the contained item to get ids of those instances satisfying certain criteria...
e.g., getToDoIdsForDoer( aDoer )
(the contained item keeps a reference to the id of its container.)
Thanks Steve, I like that because the container doesn't know about it's Content, but how does that comply to the Who I Know pattern? TIA/Johan
participants (2)
-
Johan Carlsson -
Steve Spicklemire