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 I18nUtilsI18N Utilsprotected ProjectsCatalogueManagerThe project catalogue manager componentstatic final StringAvalon Role -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringgetActivityDescription(Map<String, Object> activity, String lang) Generate a description for this activityAdd infos to the activity, so it can be displayed by the appprotected StringgetActivityObjectId(Map<String, Object> activity) Generate a description for this activityprotected StringgetActivityUrl(Map<String, Object> activity) Generate a description for this activityGenerate a map of project names with the basic projects informations to returnprotected StringAggregates a list of elements from the activity.projectToMap(Project project) Transform aProjectinto a json mapvoidservice(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:
servicein 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 aProjectinto 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
-