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
Modifier and TypeFieldDescriptionprotected I18nUtils
I18N Utilsprotected ProjectsCatalogueManager
The project catalogue manager componentstatic final String
Avalon Role -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
getActivityDescription
(Map<String, Object> activity, String lang) Generate a description for this activityAdd infos to the activity, so it can be displayed by the appprotected String
getActivityObjectId
(Map<String, Object> activity) Generate a description for this activityprotected String
getActivityUrl
(Map<String, Object> activity) Generate a description for this activityGenerate a map of project names with the basic projects informations to returnprotected String
Aggregates a list of elements from the activity.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
-
getActivityInfos
public Map<String,Object> getActivityInfos(Map<String, Object> activity, Map<String, Object> project, String lang) Add infos to the activity, so it can be displayed by the app- Parameters:
activity
- the json representing the activity 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
-
getActivityObjectId
Generate a description for this activity- Parameters:
activity
- the activity to describe- Returns:
- a String of the description
-
getActivityUrl
Generate a description for this activity- Parameters:
activity
- the activity to describe- Returns:
- a String of the description
-
getActivityDescription
Generate a description for this activity- Parameters:
activity
- the activity to describelang
- the language to use- Returns:
- a String of the description
-
getTitles
Aggregates a list of elements from the activity. activity = { mapKey : [ { titleKey : "Title 1", … }, { titleKey : "Title 2", … }, { titleKey : "Title 3", … } ], … }- Parameters:
activity
- the activity to usemapKey
- the key of the list to usetitleKey
- title to use from the map- Returns:
- a list, separated with commas, between each titles
-