public class GroupSearchContentHelper extends Object implements Component, Serviceable
| Modifier and Type | Field and Description | 
|---|---|
private ContentHelper | 
_contentHelper  | 
private I18nUtils | 
_i18nUtils  | 
private SystemPropertyExtensionPoint | 
_systemPropertyExtensionPoint  | 
private UserManager | 
_userManager  | 
static String | 
ROLE
The Avalon role name 
 | 
| Constructor and Description | 
|---|
GroupSearchContentHelper()  | 
| Modifier and Type | Method and Description | 
|---|---|
private String | 
_getGroupValueAsString(String fieldId,
                      Object value,
                      ContentType contentType,
                      Locale locale)  | 
private Map<Object,List<Content>> | 
_groupBy(Iterable<Content> contents,
        String fieldId,
        Locale locale)
Group contents by given grouping field 
 | 
private void | 
_organizeContents(GroupSearchContent parent,
                 Iterable<Content> contents,
                 List<String> groupingFields,
                 ContentType contentType,
                 Locale locale)
Recursive function that create sub GroupSearchContent to organize the contents in a hierarchy according to a list of metadata
 Example Continent/Country/City 
 | 
GroupSearchContent | 
organizeContentsInGroups(Iterable<Content> contents,
                        List<String> groupingFields,
                        ContentType contentType,
                        Locale locale)
Create GroupSearchContent to organize the contents in a hierarchy according to a list of metadata
 Example Continent/Country/City 
 | 
void | 
service(ServiceManager serviceManager)  | 
private SystemPropertyExtensionPoint _systemPropertyExtensionPoint
private ContentHelper _contentHelper
private UserManager _userManager
private I18nUtils _i18nUtils
public GroupSearchContentHelper()
public void service(ServiceManager serviceManager) throws ServiceException
service in interface ServiceableServiceExceptionpublic GroupSearchContent organizeContentsInGroups(Iterable<Content> contents, List<String> groupingFields, ContentType contentType, Locale locale)
contents - contents that need to be sortedgroupingFields - list of metadata to group with (ordered)contentType - the content typelocale - The locale for groups. Can be null. Only useful if grouping by multilingual contents or multilingual stringprivate void _organizeContents(GroupSearchContent parent, Iterable<Content> contents, List<String> groupingFields, ContentType contentType, Locale locale)
parent - parent group in which contents will be added, or in which new groups will be createdcontents - contents that need to be sortedgroupingFields - list of metadata to group with (ordered)contentType - the content typelocale - The local to get i18n titlesprivate Map<Object,List<Content>> _groupBy(Iterable<Content> contents, String fieldId, Locale locale)
contents - list of contentfieldId - The id of grouping field. Can be the path of a metadata or the system propertylocale - The local to get i18n titlesprivate String _getGroupValueAsString(String fieldId, Object value, ContentType contentType, Locale locale)