Package org.ametys.plugins.mobileapp
Class FeedHelper
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.mobileapp.FeedHelper
-
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
public class FeedHelper extends AbstractLogEnabled implements Serviceable, Component
Helper to handle project feeds
-
-
Field Summary
Fields Modifier and Type Field Description protected I18nUtils
_i18nUtils
I18N Utilsprotected ProjectsCatalogueManager
_projectsCatalogueManager
The project catalogue manager componentstatic String
ROLE
Avalon Role
-
Constructor Summary
Constructors Constructor Description FeedHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
getEventDescription(Map<String,Object> event, String lang)
Generate a description for this eventMap<String,Object>
getEventInfos(Map<String,Object> event, Map<String,Object> project, String lang)
Add infos to the event, so it can be displayed by the appprotected String
getEventObjectId(Map<String,Object> event)
Generate a description for this eventprotected String
getEventUrl(Map<String,Object> event)
Generate a description for this eventMap<String,Map<String,Object>>
getProjects()
Generate a map of project names with the basic projects informations to returnprotected String
getTitles(Map<String,Object> event, String mapKey, String titleKey)
Aggregates a list of elements from the event.Map<String,Object>
projectToMap(Project project)
Transform aProject
into a json mapvoid
service(ServiceManager manager)
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_i18nUtils
protected I18nUtils _i18nUtils
I18N Utils
-
_projectsCatalogueManager
protected ProjectsCatalogueManager _projectsCatalogueManager
The project catalogue manager component
-
-
Constructor Detail
-
FeedHelper
public FeedHelper()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getProjects
public Map<String,Map<String,Object>> getProjects()
Generate a map of project names with the basic projects informations to return- Returns:
- a map of basic information about projects
-
projectToMap
public Map<String,Object> projectToMap(Project project)
Transform aProject
into a json map- Parameters:
project
- the project to parse- Returns:
- a json map
-
getEventInfos
public Map<String,Object> getEventInfos(Map<String,Object> event, Map<String,Object> project, String lang)
Add infos to the event, so it can be displayed by the app- Parameters:
event
- the event to parseproject
- the project, as a json map (seeprojectToMap(Project)
)lang
- language to use to translate the short description- Returns:
- a map to return in json
-
getEventObjectId
protected String getEventObjectId(Map<String,Object> event)
Generate a description for this event- Parameters:
event
- the event to describe- Returns:
- a String of the description
-
getEventUrl
protected String getEventUrl(Map<String,Object> event)
Generate a description for this event- Parameters:
event
- the event to describe- Returns:
- a String of the description
-
getEventDescription
protected String getEventDescription(Map<String,Object> event, String lang)
Generate a description for this event- Parameters:
event
- the event to describelang
- the language to use- Returns:
- a String of the description
-
getTitles
protected String getTitles(Map<String,Object> event, String mapKey, String titleKey)
Aggregates a list of elements from the event. event = { mapKey : [ { titleKey : "Title 1", … }, { titleKey : "Title 2", … }, { titleKey : "Title 3", … } ], … }- Parameters:
event
- the event to usemapKey
- the key of the list to usetitleKey
- title to use from the map- Returns:
- a list, separated with commas, between each titles
-
-