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
Helper to handle project feeds
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected I18nUtils
I18N Utilsprotected ProjectsCatalogueManager
The project catalogue manager componentstatic final String
Avalon Role -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected String
getEventDescription
(Map<String, Object> event, String lang) Generate a description for this eventAdd 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 eventGenerate a map of project names with the basic projects informations to returnprotected String
Aggregates a list of elements from the event.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 Details
-
ROLE
Avalon Role -
_i18nUtils
I18N Utils -
_projectsCatalogueManager
The project catalogue manager component
-
-
Constructor Details
-
FeedHelper
public FeedHelper()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getProjects
Generate a map of project names with the basic projects informations to return- Returns:
- a map of basic information about projects
-
projectToMap
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
Generate a description for this event- Parameters:
event
- the event to describe- Returns:
- a String of the description
-
getEventUrl
Generate a description for this event- Parameters:
event
- the event to describe- Returns:
- a String of the description
-
getEventDescription
Generate a description for this event- Parameters:
event
- the event to describelang
- the language to use- Returns:
- a String of the description
-
getTitles
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
-