Package org.ametys.plugins.frontedition
Class GetServerValuesAction
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.apache.cocoon.acting.AbstractAction
-
- org.apache.cocoon.acting.ServiceableAction
-
- org.ametys.plugins.frontedition.GetServerValuesAction
-
- All Implemented Interfaces:
Initializable
,Component
,LogEnabled
,Serviceable
,Action
public class GetServerValuesAction extends ServiceableAction implements Initializable
Check if the content can be edited, and return the value
-
-
Field Summary
Fields Modifier and Type Field Description protected CurrentUserProvider
_currentUserProvider
The current user providerprotected HelpManager
_helpManager
The help manager to get url for each propertyprotected LockContentManager
_lockContentManager
Lock Content Managerprotected org.slf4j.Logger
_logger
The loggerprotected RenderingContextHandler
_renderingContextHandler
The rendering context handlerprotected AmetysObjectResolver
_resolver
The ametys object resolverprotected UserHelper
_userHelper
User helper-
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 GetServerValuesAction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<String,Object>
_contentAttribute2Json(Content content, ModelItem modelItem, String attributePath, List<String> languages)
Convert the content attribute at the given path into a JSON objectprotected String
_getModelItemHelpLink(ModelItem modelItem, List<String> languages)
Retrieves the Help link for the given model itemMap
act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters)
protected boolean
checkRestriction(Content content, ModelItem modelItem)
Check if attribute can be editedprotected ModelItem
getDefinition(Content content, String attributePath)
Get the definition to the given attribute pathprotected List<String>
getLanguages(Request request)
list all languages requested by the client in the requestvoid
initialize()
protected UserIdentity
isContentLocked(Content content)
Check if the content is lockedvoid
service(ServiceManager serviceManager)
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_logger
protected org.slf4j.Logger _logger
The logger
-
_resolver
protected AmetysObjectResolver _resolver
The ametys object resolver
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider
-
_renderingContextHandler
protected RenderingContextHandler _renderingContextHandler
The rendering context handler
-
_userHelper
protected UserHelper _userHelper
User helper
-
_lockContentManager
protected LockContentManager _lockContentManager
Lock Content Manager
-
_helpManager
protected HelpManager _helpManager
The help manager to get url for each property
-
-
Constructor Detail
-
GetServerValuesAction
public GetServerValuesAction()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classServiceableAction
- Throws:
ServiceException
-
initialize
public void initialize() throws Exception
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
act
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception
-
checkRestriction
protected boolean checkRestriction(Content content, ModelItem modelItem)
Check if attribute can be edited- Parameters:
content
- the contentmodelItem
- the definition of attribute- Returns:
- true if the attribute can be edited
-
isContentLocked
protected UserIdentity isContentLocked(Content content)
Check if the content is locked- Parameters:
content
- The content- Returns:
- UserIdentity of the locker, of null if not locked
-
getLanguages
protected List<String> getLanguages(Request request)
list all languages requested by the client in the request- Parameters:
request
- the request- Returns:
- an ordered list of all languages requested by the client (or server default locale if none requested by the client)
-
getDefinition
protected ModelItem getDefinition(Content content, String attributePath) throws ProcessingException, AmetysRepositoryException
Get the definition to the given attribute path- Parameters:
content
- the contentattributePath
- the path of the attribute- Returns:
- the model item
- Throws:
ProcessingException
- if the attribute is not defined by the modelAmetysRepositoryException
- if an error occurred
-
_contentAttribute2Json
protected Map<String,Object> _contentAttribute2Json(Content content, ModelItem modelItem, String attributePath, List<String> languages) throws ProcessingException
Convert the content attribute at the given path into a JSON object- Parameters:
content
- the contentmodelItem
- the attribute definitionattributePath
- the path of the attribute to convertlanguages
- all languages requested by the client- Returns:
- the attribute as a JSON object
- Throws:
ProcessingException
- if an error occurs
-
_getModelItemHelpLink
protected String _getModelItemHelpLink(ModelItem modelItem, List<String> languages)
Retrieves the Help link for the given model item- Parameters:
modelItem
- the model itemlanguages
- all languages requested by the client- Returns:
- the help link
-
-