Package org.ametys.web.content
Class FOContentCreationHelper
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.web.content.FOContentCreationHelper
-
- All Implemented Interfaces:
LogEnabled
,Component
,Contextualizable
,Serviceable
public class FOContentCreationHelper extends AbstractLogEnabled implements Serviceable, Component, Contextualizable
Helper for creating and editing a content from the submitted form
-
-
Constructor Summary
Constructors Constructor Description FOContentCreationHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Request
_getRequest()
Get the requestvoid
contextualize(Context context)
Map<String,Object>
createAndEditContent(int initActionId, String[] contentTypeIds, String[] mixinIds, String siteName, String contentName, String contentTitle, String language, Map<String,Object> values, String workflowName, String viewName, Map<String,Object> inputs)
Create and edit a contentMap<String,Object>
createAndEditContent(int initActionId, String contentTypeId, String siteName, String contentName, String contentTitle, String language, Map<String,Object> values, String workflowName, String viewName)
Create and edit a contentMap<String,Object>
createAndEditContent(int initActionId, String contentTypeId, String siteName, String contentName, String contentTitle, String language, Map<String,Object> values, String workflowName, String viewName, Map<String,Object> inputs)
Create and edit a contentMap<String,Object>
getAndValidateFormValues(Request request, ContentType contentType, String viewName, Multimap<String,I18nizableText> errors)
Get the values for this content type from requestprotected Map<String,String>
getContentValues(String cTypeId, String language)
Get values for contents enumerationvoid
saxContentValues(ContentHandler contentHandler, ContentType contentType, String rootTagName, String language)
SAX contents values for metadata of type CONTENTvoid
service(ServiceManager smanager)
Multimap<String,I18nizableText>
validateValues(Map<String,Object> values, ContentType contentType, String viewName)
Validate the given values-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Constructor Detail
-
FOContentCreationHelper
public FOContentCreationHelper()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
_getRequest
protected Request _getRequest()
Get the request- Returns:
- the request
-
saxContentValues
public void saxContentValues(ContentHandler contentHandler, ContentType contentType, String rootTagName, String language) throws SAXException
SAX contents values for metadata of type CONTENT- Parameters:
contentHandler
- The content handler to sax intocontentType
- The content typerootTagName
- The root tag namelanguage
- the current language- Throws:
SAXException
- if an error occurs when saxing
-
getContentValues
protected Map<String,String> getContentValues(String cTypeId, String language)
Get values for contents enumeration- Parameters:
cTypeId
- The id of content typelanguage
- The current language- Returns:
- The contents
-
getAndValidateFormValues
public Map<String,Object> getAndValidateFormValues(Request request, ContentType contentType, String viewName, Multimap<String,I18nizableText> errors)
Get the values for this content type from request- Parameters:
request
- the requestcontentType
- the edited content typeviewName
- the view nameerrors
- The errors to fill- Returns:
- The values
-
validateValues
public Multimap<String,I18nizableText> validateValues(Map<String,Object> values, ContentType contentType, String viewName)
Validate the given values- Parameters:
values
- the values to validatecontentType
- the edited content typeviewName
- the view name- Returns:
- The errors if some values are not valid
-
createAndEditContent
public Map<String,Object> createAndEditContent(int initActionId, String contentTypeId, String siteName, String contentName, String contentTitle, String language, Map<String,Object> values, String workflowName, String viewName) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
Create and edit a content- Parameters:
initActionId
- The initial workflow action id for creation and editioncontentTypeId
- The id of content typesiteName
- The current site namecontentName
- The content namecontentTitle
- The content titlelanguage
- The content languagevalues
- The submitted valuesworkflowName
- The workflow nameviewName
- The view name- Returns:
- The workflow result
- Throws:
AmetysRepositoryException
- if an error occurscom.opensymphony.workflow.WorkflowException
- if an error occurs
-
createAndEditContent
public Map<String,Object> createAndEditContent(int initActionId, String contentTypeId, String siteName, String contentName, String contentTitle, String language, Map<String,Object> values, String workflowName, String viewName, Map<String,Object> inputs) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
Create and edit a content- Parameters:
initActionId
- The initial workflow action id for creation and editioncontentTypeId
- The id of content typesiteName
- The current site namecontentName
- The content namecontentTitle
- The content titlelanguage
- The content languagevalues
- The submitted valuesworkflowName
- The workflow nameviewName
- The view nameinputs
- The initial workflow inputs- Returns:
- The workflow result
- Throws:
AmetysRepositoryException
- if an error occurscom.opensymphony.workflow.WorkflowException
- if an error occurs
-
createAndEditContent
public Map<String,Object> createAndEditContent(int initActionId, String[] contentTypeIds, String[] mixinIds, String siteName, String contentName, String contentTitle, String language, Map<String,Object> values, String workflowName, String viewName, Map<String,Object> inputs) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
Create and edit a content- Parameters:
initActionId
- The initial workflow action id for creation and editioncontentTypeIds
- The new content types. Cannot be null. Cannot be empty.mixinIds
- The new mixins. Can be null. Can be empty.siteName
- The current site namecontentName
- The content namecontentTitle
- The content titlelanguage
- The content languagevalues
- The values of the content attributesworkflowName
- The workflow nameviewName
- The view nameinputs
- The initial workflow inputs- Returns:
- The workflow result
- Throws:
AmetysRepositoryException
- if an error occurscom.opensymphony.workflow.WorkflowException
- if an error occurs
-
-