Package org.opencms.ugc.client.export
Class CmsClientUgcSession
- java.lang.Object
-
- org.opencms.ugc.client.export.CmsClientUgcSession
-
- All Implemented Interfaces:
org.timepedia.exporter.client.Exportable
public class CmsClientUgcSession extends java.lang.Object implements org.timepedia.exporter.client.Exportable
Client side object representing a form editing session.
-
-
Constructor Summary
Constructors Constructor Description CmsClientUgcSession(CmsXmlContentUgcApi apiRoot, org.opencms.ugc.shared.CmsUgcContent content)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
Destroys the session.CmsXmlContentUgcApi
getContentFormApi()
Gets the content form API instance.void
getLink(java.lang.String path, I_CmsStringCallback callback)
Fetches the link for a given path from the server.java.lang.String
getSessionId()
Gets the session id.java.lang.String
getSitePath()
Gets the site path of the edited content.com.google.gwt.core.client.JavaScriptObject
getValues()
Gets the old content values as a Javascript object.void
initFormElement(com.google.gwt.dom.client.Element formElement)
Initializes the form belonging to this session.org.opencms.util.CmsUUID
internalGetSessionId()
Gets the session id as a UUID.void
saveContent(com.google.gwt.core.client.JavaScriptObject newValues, I_CmsStringCallback onSuccess, I_CmsErrorCallback onFailure)
Asks the server to save the values set via setNewValue in the XML content.void
uploadFiles(java.lang.String[] fieldNames, I_CmsJavaScriptObjectCallback fileCallback, I_CmsErrorCallback errorCallback)
Uploads multiple files.void
validate(com.google.gwt.core.client.JavaScriptObject newValues, I_CmsJavaScriptObjectCallback onSuccess)
Validates the new content values.
-
-
-
Constructor Detail
-
CmsClientUgcSession
public CmsClientUgcSession(CmsXmlContentUgcApi apiRoot, org.opencms.ugc.shared.CmsUgcContent content)
Creates a new instance.- Parameters:
apiRoot
- the CmsXmlContentFormApi instance which was used to create this session objectcontent
- the form data returned from the server
-
-
Method Detail
-
destroy
public void destroy()
Destroys the session.
-
getContentFormApi
public CmsXmlContentUgcApi getContentFormApi()
Gets the content form API instance.- Returns:
- the content form API instance
-
getLink
public void getLink(java.lang.String path, I_CmsStringCallback callback)
Fetches the link for a given path from the server.- Parameters:
path
- the path for which we want the linkcallback
- the callback to call with the result
-
getSessionId
public java.lang.String getSessionId()
Gets the session id.- Returns:
- the session id
-
getSitePath
public java.lang.String getSitePath()
Gets the site path of the edited content.- Returns:
- the site path of the edited content
-
getValues
public com.google.gwt.core.client.JavaScriptObject getValues()
Gets the old content values as a Javascript object.- Returns:
- a Javascript object whose properties are the xpaths of the existing content values
-
initFormElement
public void initFormElement(com.google.gwt.dom.client.Element formElement)
Initializes the form belonging to this session.- Parameters:
formElement
- the form element
-
internalGetSessionId
public org.opencms.util.CmsUUID internalGetSessionId()
Gets the session id as a UUID.- Returns:
- the session id
-
saveContent
public void saveContent(com.google.gwt.core.client.JavaScriptObject newValues, I_CmsStringCallback onSuccess, I_CmsErrorCallback onFailure)
Asks the server to save the values set via setNewValue in the XML content.- Parameters:
newValues
- the new values to setonSuccess
- the callback to be called in case of successonFailure
- the callback to be called in case of failure
-
uploadFiles
public void uploadFiles(java.lang.String[] fieldNames, I_CmsJavaScriptObjectCallback fileCallback, I_CmsErrorCallback errorCallback)
Uploads multiple files.- Parameters:
fieldNames
- the array of form field names containing files to uploadfileCallback
- the callback for the resultserrorCallback
- the error handling callback
-
validate
public void validate(com.google.gwt.core.client.JavaScriptObject newValues, I_CmsJavaScriptObjectCallback onSuccess)
Validates the new content values.- Parameters:
newValues
- a Javascript object with the value xpaths as keys and the corresponding content values as values.onSuccess
- the callback to call with the validation results
-
-