Class CmsJsonDocumentResource
- java.lang.Object
-
- org.opencms.xml.xml2json.document.A_CmsJsonDocument
-
- org.opencms.xml.xml2json.document.CmsJsonDocumentResource
-
- All Implemented Interfaces:
I_CmsJsonDocument
- Direct Known Subclasses:
CmsJsonDocumentXmlContent
public class CmsJsonDocumentResource extends A_CmsJsonDocument implements I_CmsJsonDocument
Class representing a JSON document for a CMS resource.
-
-
Field Summary
Fields Modifier and Type Field Description protected CmsResourceDataJsonHelper
m_helper
The resource data helper.protected CmsResource
m_resource
The resource.-
Fields inherited from class org.opencms.xml.xml2json.document.A_CmsJsonDocument
FIELD_LINKED_CONTENTS, m_context, m_json, m_jsonRequest
-
-
Constructor Summary
Constructors Constructor Description CmsJsonDocumentResource(CmsJsonRequest jsonRequest, CmsResource resource)
Creates a new JSON document.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
getJson()
Returns the JSON document.protected void
insertJsonResource()
If the request parameter "wrapper" is set, inserts information about this resource into the JSON document.protected void
insertJsonResourceAttributes()
Inserts the resource attributes into this JSON document.protected void
insertJsonResourceFile()
Inserts file type information into this JSON document.protected void
insertJsonResourceParams()
Inserts information about the effective request parameters into this JSON document.protected void
insertJsonResourcePathAndLink()
Inserts path and link information about this resource into this JSON document.protected void
insertJsonResourceProperties()
Inserts the properties of this resource into the JSON document.
-
-
-
Field Detail
-
m_helper
protected CmsResourceDataJsonHelper m_helper
The resource data helper.
-
m_resource
protected CmsResource m_resource
The resource.
-
-
Constructor Detail
-
CmsJsonDocumentResource
public CmsJsonDocumentResource(CmsJsonRequest jsonRequest, CmsResource resource)
Creates a new JSON document.- Parameters:
jsonRequest
- the JSON requestresource
- the resource
-
-
Method Detail
-
getJson
public java.lang.Object getJson() throws JSONException, CmsException, CmsJsonHandlerException, CmsJsonHandlerXmlContent.PathNotFoundException, java.lang.Exception
Description copied from interface:I_CmsJsonDocument
Returns the JSON document.- Specified by:
getJson
in interfaceI_CmsJsonDocument
- Returns:
- the JSON document
- Throws:
JSONException
- if rendering the JSON document failsCmsException
- if reading a resource or evaluating a SOLR search failsCmsJsonHandlerException
- if the request is not valid according to the specificationCmsJsonHandlerXmlContent.PathNotFoundException
- if the selected path does not existjava.lang.Exception
- if something else goes wrong- See Also:
I_CmsJsonDocument.getJson()
-
insertJsonResource
protected void insertJsonResource() throws JSONException, CmsException
If the request parameter "wrapper" is set, inserts information about this resource into the JSON document.- Throws:
JSONException
CmsException
-
insertJsonResourceAttributes
protected void insertJsonResourceAttributes() throws JSONException
Inserts the resource attributes into this JSON document.- Throws:
JSONException
- if JSON rendering fails
-
insertJsonResourceFile
protected void insertJsonResourceFile() throws JSONException
Inserts file type information into this JSON document.- Throws:
JSONException
- if JSON rendering fails
-
insertJsonResourceParams
protected void insertJsonResourceParams() throws JSONException
Inserts information about the effective request parameters into this JSON document.- Throws:
JSONException
- if JSON rendering fails
-
insertJsonResourcePathAndLink
protected void insertJsonResourcePathAndLink() throws JSONException
Inserts path and link information about this resource into this JSON document.- Throws:
JSONException
- if JSON rendering fails
-
insertJsonResourceProperties
protected void insertJsonResourceProperties() throws JSONException, CmsException
Inserts the properties of this resource into the JSON document.- Throws:
JSONException
- if JSON rendering failsCmsException
- if reading the properties fails
-
-