I'm working on an internal application that utilizes 31 Content Types and 50 Relationships.
As I enumerate the relationship names in my OSGI plugin config file I am realizing that these could be intuitively absorbed by the core API.
Instead of Map<Relationship, List<Contentlet>>
Simply a single List<Contentlet> could be used to contain all of the related content of various types.
Then somewhere in the core business logic it would just do a contentlet.getStructure() on the current contentlet and each contentlet in the list. (Sorting the list on structure name or id would probably be a good idea here.)
It could then dynamically create both possible "parent-child" names and search to see if one of them exists as a relationship. (Try to fetch from relationship cache.)
// continue processing, set this as the Relationship between these two contentlets.
Whichever one exists (I don't think it's possible for both to exist) would then be the relationship to use.
In this way the "Relationship" could be intuitively discovered and we wouldn't have to enumerate every single relationship and pre-fetch them from cache and create very tedious manual maps of type Map<Relationship, List<Contentlet>> for each defined relationship of the content type.
Nathan I. Keiter | Lead Network Applications Programmer | Administrative Advisory Council Member | Benefits Advisory Council Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325