[4.0.1] Intuitive Relationships (Feature Request)

4 views
Skip to first unread message

Nathan Keiter

unread,
Aug 29, 2017, 3:15:27 PM8/29/17
to dot...@googlegroups.com
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.


[cid:7ba21624-3fd5-4358-8e60-6e1b3ab8b4e0]


[cid:8df13951-2ac5-4654-99fa-43ddd88827f6]


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.)


For example "A-B" and "B-A".


Relationship relationship = CacheLocator.getRelationshipCache.getRelationshipByName(

"A-B" ) != null ?

CacheLocator.getRelationshipCache.getRelationshipByName( "A-B" ) :

CacheLocator.getRelationshipCache.getRelationshipByName( "B-A" );


if ( relationship != null )

{

// 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
Phone: 717.337.6993
https://www.gettysburg.edu
Reply all
Reply to author
Forward
0 new messages