public class CmsUgcSession extends java.lang.Object implements I_CmsSessionDestroyHandler
| Modifier and Type | Class and Description |
|---|---|
static class |
CmsUgcSession.PathComparator
Compares XPaths.
|
| Modifier | Constructor and Description |
|---|---|
protected |
CmsUgcSession(CmsObject cms)
Constructor.
|
|
CmsUgcSession(CmsObject adminCms,
CmsObject cms,
CmsUgcConfiguration configuration)
Constructor.
|
|
CmsUgcSession(CmsObject cms,
CmsUgcConfiguration configuration)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addContentValue(CmsXmlContent content,
java.util.Locale locale,
java.lang.String path,
java.lang.String value)
Adds the given value to the content document.
|
protected CmsXmlContent |
addContentValues(CmsFile file,
java.util.Map<java.lang.String,java.lang.String> contentValues)
Adds the given values to the content document.
|
protected void |
addContentValues(CmsXmlContent content,
java.util.Locale locale,
java.util.Map<java.lang.String,java.lang.String> contentValues)
Adds the given values to the content document.
|
CmsResource |
createUploadResource(java.lang.String fieldName,
java.lang.String rawFileName,
byte[] content)
Creates a new resource from upload data.
|
CmsResource |
createXmlContent()
Creates a new edit resource.
|
protected void |
deleteContentValue(CmsXmlContent content,
java.util.Locale locale,
java.lang.String path)
Deletes the given value path from the content document.
|
void |
disableCleanup()
Disables auto-cleanup on session destruction.
|
void |
finish()
Finishes the session and publishes the changed resources if necessary.
|
CmsObject |
getCmsObject()
Gets the CMS context used by this session.
|
protected java.util.Map<java.lang.String,java.lang.String> |
getContentValues(CmsXmlContent content,
java.util.Locale locale)
Returns the content values of the requested locale.
|
CmsUgcUploadHelper |
getFormUploadHelper()
Gets the form upload helper belonging to this session.
|
CmsUUID |
getId()
Returns the session id.
|
java.util.Locale |
getMessageLocale()
Returns the locale to use for messages generated by the form session which are intended to be displayed on the client.
|
CmsProject |
getProject()
Returns the edit project.
|
CmsResource |
getResource()
Returns the edit resource.
|
java.util.Map<java.lang.String,java.lang.String> |
getValues()
Returns the content values.
|
boolean |
isFinished()
Returns true if the session is finished.
|
CmsResource |
loadXmlContent(java.lang.String fileName)
Loads the existing edit resource.
|
void |
onSessionDestroyed()
This method is called when the session in which this object is stored as an attribute is destroyed.
|
CmsXmlContentErrorHandler |
saveContent(java.util.Map<java.lang.String,java.lang.String> contentValues)
Saves the content values to the sessions edit resource.
|
CmsXmlContentErrorHandler |
validateContent(java.util.Map<java.lang.String,java.lang.String> contentValues)
Validates the content values.
|
public CmsUgcSession(CmsObject adminCms, CmsObject cms, CmsUgcConfiguration configuration) throws CmsException
adminCms - the cms context with admin privilegescms - the cms contextconfiguration - the form configurationCmsException - if creating the session project failspublic CmsUgcSession(CmsObject cms, CmsUgcConfiguration configuration) throws CmsException
cms - the cms contextconfiguration - the form configurationCmsException - if creating the session project failsprotected CmsUgcSession(CmsObject cms)
cms - the cms contextpublic CmsResource createUploadResource(java.lang.String fieldName, java.lang.String rawFileName, byte[] content) throws CmsUgcException
fieldName - the name of the form field for the uploadrawFileName - the file namecontent - the file contentCmsUgcException - if creating the resource failspublic CmsResource createXmlContent() throws CmsUgcException
CmsUgcException - if creating the resource failspublic void disableCleanup()
public void finish() throws CmsException
CmsException - if something goes wrongpublic CmsObject getCmsObject()
public CmsUgcUploadHelper getFormUploadHelper()
public java.util.Locale getMessageLocale()
public CmsProject getProject()
public CmsResource getResource()
public java.util.Map<java.lang.String,java.lang.String> getValues() throws CmsException
CmsException - if reading the content failspublic boolean isFinished()
public CmsResource loadXmlContent(java.lang.String fileName) throws CmsUgcException
fileName - the resource file nameCmsUgcException - if reading the resource failspublic void onSessionDestroyed()
I_CmsSessionDestroyHandleronSessionDestroyed in interface I_CmsSessionDestroyHandlerI_CmsSessionDestroyHandler.onSessionDestroyed()public CmsXmlContentErrorHandler saveContent(java.util.Map<java.lang.String,java.lang.String> contentValues) throws CmsUgcException
contentValues - the content values by XPathCmsUgcException - if writing the content failspublic CmsXmlContentErrorHandler validateContent(java.util.Map<java.lang.String,java.lang.String> contentValues) throws CmsUgcException
contentValues - the content values to validateCmsUgcException - if reading the content file failsprotected void addContentValue(CmsXmlContent content, java.util.Locale locale, java.lang.String path, java.lang.String value)
content - the content documentlocale - the content localepath - the value XPathvalue - the valueprotected CmsXmlContent addContentValues(CmsFile file, java.util.Map<java.lang.String,java.lang.String> contentValues) throws CmsException
file - the content filecontentValues - the values to addCmsException - if writing the XML failsprotected void addContentValues(CmsXmlContent content, java.util.Locale locale, java.util.Map<java.lang.String,java.lang.String> contentValues) throws CmsXmlException
content - the content documentlocale - the content localecontentValues - the valuesCmsXmlException - if writing the XML failsprotected void deleteContentValue(CmsXmlContent content, java.util.Locale locale, java.lang.String path)
content - the content documentlocale - the content localepath - the value XPathprotected java.util.Map<java.lang.String,java.lang.String> getContentValues(CmsXmlContent content, java.util.Locale locale)
content - the content documentlocale - the content locale