Hello all -
I've created an object hierarchy (Area <- AreaCollection) using the Composite Pattern (GoF). The objects in my hierarchy represent geographical regions illustrated below:
World
- Asia
- Europe
- North America
- Canada
- United States
and so on...
Each area can have a set of users associated with them such that:
World
- Asia (J. Smith)
- Europe
- North America (M. Smith)
- Canada
- United States (T. Reilly)
I'd like to invoke a method defined in the Composite class that returns the user associated with that object. However, if there is no user defined for that object, the method will recursively traverse up the tree until a user is found. I have created an implementation that allows me to traverse upward until a user is found, but I'd like a little more granular control, similar to the LDAP class SearchControls OBJECT_SCOPE, ONELEVEL_SCOPE, SUBTREE_SCOPE.
I have given a lot of thought of how to accomplish this and tried to find resources on the web that gives an example of how to do this, however, I can't think of a way to do this.
Can anyone provide me with some ideas or direction on how to accomplish this? Any advice you can offer is appreciated.
Thanks!
R. Alcazar
I've created an object hierarchy (Area <- AreaCollection) using the Composite Pattern (GoF). The objects in my hierarchy represent geographical regions illustrated below:
World
- Asia
- Europe
- North America
- Canada
- United States
and so on...
Each area can have a set of users associated with them such that:
World
- Asia (J. Smith)
- Europe
- North America (M. Smith)
- Canada
- United States (T. Reilly)
I'd like to invoke a method defined in the Composite class that returns the user associated with that object. However, if there is no user defined for that object, the method will recursively traverse up the tree until a user is found. I have created an implementation that allows me to traverse upward until a user is found, but I'd like a little more granular control, similar to the LDAP class SearchControls OBJECT_SCOPE, ONELEVEL_SCOPE, SUBTREE_SCOPE.
I have given a lot of thought of how to accomplish this and tried to find resources on the web that gives an example of how to do this, however, I can't think of a way to do this.
Can anyone provide me with some ideas or direction on how to accomplish this? Any advice you can offer is appreciated.
Thanks!
R. Alcazar