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
-
-
Field Summary
Fields Modifier and Type Field Description private ContentTypesHelper_contentTypeHelperprivate ContentWorkflowHelper_contentWorkflowHelperprivate Context_contextprivate ContentTypeExtensionPoint_cTypeExtPtprivate CurrentUserProvider_currentUserProviderprivate JSONUtils_jsonUtilsprivate FrontOfficeSearcherFactory_searcherFactoryprivate SourceResolver_srcResolverprivate UploadManager_uploadManagerstatic StringROLEThe component role.
-
Constructor Summary
Constructors Constructor Description FOContentCreationHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Request_getRequest()Get the requestprivate Map<String,Object>_getUploadFileValue(Part partUploaded)private void_saxContentEnumeratorValue(ContentHandler contentHandler, MetadataDefinition metadataDef, String language)Sax enumeration value for enum or a content metadataprivate boolean_validateFormField(MetadataDefinition metadataDef, String fieldName, Object value, Multimap<String,I18nizableText> errors)voidcontextualize(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(Map<String,Object> rawValues, ContentType contentType, String viewName, Multimap<String,I18nizableText> errors)Get the values for this content type from requestMap<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 enumerationvoidsaxContentValues(ContentHandler contentHandler, ContentType contentType, String rootTagName, String language)SAX contents values for metadata of type CONTENTvoidsaxViewIfExists(ContentHandler contentHandler, ContentType contentType, String rootTagName, String viewName)SAX the view of a content typevoidservice(ServiceManager smanager)-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_contentTypeHelper
private ContentTypesHelper _contentTypeHelper
-
_jsonUtils
private JSONUtils _jsonUtils
-
_uploadManager
private UploadManager _uploadManager
-
_currentUserProvider
private CurrentUserProvider _currentUserProvider
-
_contentWorkflowHelper
private ContentWorkflowHelper _contentWorkflowHelper
-
_srcResolver
private SourceResolver _srcResolver
-
_cTypeExtPt
private ContentTypeExtensionPoint _cTypeExtPt
-
_searcherFactory
private FrontOfficeSearcherFactory _searcherFactory
-
-
Constructor Detail
-
FOContentCreationHelper
public FOContentCreationHelper()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
_getRequest
protected Request _getRequest()
Get the request- Returns:
- the request
-
saxViewIfExists
public void saxViewIfExists(ContentHandler contentHandler, ContentType contentType, String rootTagName, String viewName) throws SAXException
SAX the view of a content type- Parameters:
contentHandler- The content handler to sax intocontentType- The content typerootTagName- the root tag nameviewName- The view name- Throws:
SAXException- if an error occurs
-
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
-
_saxContentEnumeratorValue
private void _saxContentEnumeratorValue(ContentHandler contentHandler, MetadataDefinition metadataDef, String language) throws SAXException
Sax enumeration value for enum or a content metadata- Parameters:
contentHandler- The content handler to sax intometadataDef- The metadata definition.language- The current language- Throws:
SAXException- If an error occurred while 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(Map<String,Object> rawValues, ContentType contentType, String viewName, Multimap<String,I18nizableText> errors)
Get the values for this content type from request- Parameters:
rawValues- the input valuescontentType- the edited content typeviewName- the view nameerrors- The errors to fill- Returns:
- The values
-
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
-
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 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
-
_validateFormField
private boolean _validateFormField(MetadataDefinition metadataDef, String fieldName, Object value, Multimap<String,I18nizableText> errors)
-
_getUploadFileValue
private Map<String,Object> _getUploadFileValue(Part partUploaded)
-
-