Class GetFeedsContentsAction
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.apache.cocoon.acting.AbstractAction
-
- org.apache.cocoon.acting.ServiceableAction
-
- org.ametys.plugins.mobileapp.action.GetFeedsContentsAction
-
- All Implemented Interfaces:
Component
,LogEnabled
,Serviceable
,Action
public class GetFeedsContentsAction extends ServiceableAction
Returns the list of feeds for a user
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
GetFeedsContentsAction.QuerySearchresult
Content fetched from a query
-
Field Summary
Fields Modifier and Type Field Description protected CurrentUserProvider
_currentUserProvider
The current user providerprotected JSONUtils
_jsonUtils
JSON Utilsprotected QueriesHelper
_queryHelper
The Ametys object resolver-
Fields inherited from class org.apache.cocoon.acting.ServiceableAction
manager
-
Fields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP
-
-
Constructor Summary
Constructors Constructor Description GetFeedsContentsAction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map
act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters)
protected int
compareDates(Object o1, Object o2)
protected Map<String,String>
contentToJson(GetFeedsContentsAction.QuerySearchresult searchResult)
Transform a content into a json mapMap<String,Object>
doAction(Request request, Map<String,Object> jsonParams)
Execute the actionprotected Map<String,Object>
doLoggedInAction(Request request, Map<String,Object> jsonParams)
Execute the action that requires to be logged inprotected Object
getParameter(String name, Map<String,Object> jsonParams, Request request)
Get a parameter either from the POST body or directly from the request parametersprotected Map<String,Object>
getParameters(Map objectModel)
Get a map of parameters from the POST bodyvoid
service(ServiceManager smanager)
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_queryHelper
protected QueriesHelper _queryHelper
The Ametys object resolver
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider
-
_jsonUtils
protected JSONUtils _jsonUtils
JSON Utils
-
-
Constructor Detail
-
GetFeedsContentsAction
public GetFeedsContentsAction()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
doLoggedInAction
protected Map<String,Object> doLoggedInAction(Request request, Map<String,Object> jsonParams)
Execute the action that requires to be logged in- Parameters:
request
- the requestjsonParams
- map of parameters passed in the post body as json- Returns:
- the json map to return
-
contentToJson
protected Map<String,String> contentToJson(GetFeedsContentsAction.QuerySearchresult searchResult)
Transform a content into a json map- Parameters:
searchResult
- the search result containing tho content- Returns:
- a json map
-
compareDates
protected int compareDates(Object o1, Object o2) throws ClassCastException
- Parameters:
o1
- aZonedDateTime
and/orLocalDate
and/orDate
o2
- aZonedDateTime
and/orLocalDate
and/orDate
- Returns:
- -1 if o1 is before o2, +1 if o1 is after o2, 0 if same date (not equals)
- Throws:
ClassCastException
- one of the object is not aZonedDateTime
orLocalDate
orDate
-
doAction
public Map<String,Object> doAction(Request request, Map<String,Object> jsonParams)
Execute the action- Parameters:
request
- the requestjsonParams
- map of parameters passed in the post body as json- Returns:
- the json map to return
-
act
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception
- Throws:
Exception
-
getParameters
protected Map<String,Object> getParameters(Map objectModel) throws IOException
Get a map of parameters from the POST body- Parameters:
objectModel
- the objectModel from whidh the body will be read- Returns:
- a Map representing the body, parsed as json
- Throws:
IOException
- something went wrong
-
getParameter
protected Object getParameter(String name, Map<String,Object> jsonParams, Request request)
Get a parameter either from the POST body or directly from the request parameters- Parameters:
name
- the name of the parameter to fetchjsonParams
- the json parameters passedrequest
- the request to read from- Returns:
- an Object (if from json) or a String (if from the request)
-
-