Class CmsJsonDocumentXmlContent
- java.lang.Object
-
- org.opencms.xml.xml2json.document.A_CmsJsonDocument
-
- org.opencms.xml.xml2json.document.CmsJsonDocumentResource
-
- org.opencms.xml.xml2json.document.CmsJsonDocumentXmlContent
-
- All Implemented Interfaces:
I_CmsJsonDocument
- Direct Known Subclasses:
CmsJsonDocumentContainerPage
,CmsJsonDocumentEmbeddedXmlContent
,CmsJsonDocumentList
public class CmsJsonDocumentXmlContent extends CmsJsonDocumentResource
Class representing a JSON document for an XML content.
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_embedLinkedModelgroup
Whether to embed linked contents.protected boolean
m_throwException
Whether to throw exceptions.protected CmsXmlContent
m_xmlContent
The XML content.-
Fields inherited from class org.opencms.xml.xml2json.document.CmsJsonDocumentResource
m_helper, m_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 CmsJsonDocumentXmlContent(CmsJsonRequest jsonRequest, CmsXmlContent xmlContent)
Creates a new JSON document.CmsJsonDocumentXmlContent(CmsJsonRequest jsonRequest, CmsXmlContent xmlContent, boolean embedLinkedModelgroup)
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
insertJsonLinkedContent(CmsResource resource)
Inserts a JSON representation of a linked content into this JSON document.protected void
insertJsonLinkedContents()
For each linked content, inserts a JSON representation of the linked content into this JSON document.protected void
insertJsonWrapper()
Inserts a wrapper with resource information into this JSON document.protected boolean
isLocaleAllRequest()
Whether all locales of this XML content are requested.protected boolean
isLocalePathRequest()
Whether one locale of this XML content is requested.protected boolean
isLocaleRequest()
Whether a part of a locale of this XML content is requested.protected boolean
isShowFallbackLocaleRequest()
Whether the default locale content shall be shown in the case the requested locale is not available.protected boolean
isShowLinkedContentsRequest()
Whether all linked contents shall be embedded into this document.protected boolean
isShowWrapperRequest()
Whether to show the wrapper with resource information.-
Methods inherited from class org.opencms.xml.xml2json.document.CmsJsonDocumentResource
insertJsonResource, insertJsonResourceAttributes, insertJsonResourceFile, insertJsonResourceParams, insertJsonResourcePathAndLink, insertJsonResourceProperties
-
-
-
-
Field Detail
-
m_xmlContent
protected CmsXmlContent m_xmlContent
The XML content.
-
m_throwException
protected boolean m_throwException
Whether to throw exceptions.
-
m_embedLinkedModelgroup
protected boolean m_embedLinkedModelgroup
Whether to embed linked contents.
-
-
Constructor Detail
-
CmsJsonDocumentXmlContent
public CmsJsonDocumentXmlContent(CmsJsonRequest jsonRequest, CmsXmlContent xmlContent) throws java.lang.Exception
Creates a new JSON document.- Parameters:
jsonRequest
- the JSON requestxmlContent
- the XML content- Throws:
java.lang.Exception
- if something goes wrong
-
CmsJsonDocumentXmlContent
public CmsJsonDocumentXmlContent(CmsJsonRequest jsonRequest, CmsXmlContent xmlContent, boolean embedLinkedModelgroup) throws java.lang.Exception
Creates a new JSON document.- Parameters:
jsonRequest
- the JSON requestxmlContent
- the XML contentembedLinkedModelgroup
- whether to embed linked model groups- Throws:
java.lang.Exception
- if something goes wrong
-
-
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
- Overrides:
getJson
in classCmsJsonDocumentResource
- 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:
CmsJsonDocumentResource.getJson()
-
insertJsonLinkedContent
protected void insertJsonLinkedContent(CmsResource resource) throws java.lang.Exception
Inserts a JSON representation of a linked content into this JSON document.- Parameters:
resource
- the resource- Throws:
java.lang.Exception
- if something goes wrong
-
insertJsonLinkedContents
protected void insertJsonLinkedContents() throws java.lang.Exception
For each linked content, inserts a JSON representation of the linked content into this JSON document.- Throws:
java.lang.Exception
- if something goes wrong
-
insertJsonWrapper
protected void insertJsonWrapper() throws JSONException, CmsException
Inserts a wrapper with resource information into this JSON document.- Throws:
JSONException
- if JSON rendering failsCmsException
- if reading resource properties fails
-
isLocaleAllRequest
protected boolean isLocaleAllRequest()
Whether all locales of this XML content are requested.- Returns:
- whether all or not
-
isLocalePathRequest
protected boolean isLocalePathRequest()
Whether one locale of this XML content is requested.- Returns:
- whether one locale or not
-
isLocaleRequest
protected boolean isLocaleRequest()
Whether a part of a locale of this XML content is requested.- Returns:
- whether a part of a locale or not
-
isShowFallbackLocaleRequest
protected boolean isShowFallbackLocaleRequest()
Whether the default locale content shall be shown in the case the requested locale is not available.- Returns:
- whether to show the default locale or not
-
isShowLinkedContentsRequest
protected boolean isShowLinkedContentsRequest()
Whether all linked contents shall be embedded into this document.- Returns:
- whether to embed the linked contents or not
-
isShowWrapperRequest
protected boolean isShowWrapperRequest()
Whether to show the wrapper with resource information. For backward compatibility the wrapper is shown for the all locale request but not for the locale and locale path request as a default. This default behavior can be changed by means of the "wrapper" request parameter. For locale path requests, wrapper information is not available.- Returns:
- whether to show the wrapper or not
-
-