Class CmsJsonDocumentFolder
- java.lang.Object
-
- org.opencms.xml.xml2json.document.A_CmsJsonDocument
-
- org.opencms.xml.xml2json.document.CmsJsonDocumentFolder
-
- All Implemented Interfaces:
I_CmsJsonDocument
public class CmsJsonDocumentFolder extends A_CmsJsonDocument implements I_CmsJsonDocument
Class representing a JSON document for a folder.
-
-
Field Summary
-
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 CmsJsonDocumentFolder(CmsJsonRequest jsonRequest)
Creates a new JSON document.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected JSONObject
folderListingJson(CmsResource target, int levelsLeft)
Formats folder listing as a JSON object, with the individual file names in the folder as keys.java.lang.Object
getJson()
Returns the JSON document.
-
-
-
Constructor Detail
-
CmsJsonDocumentFolder
public CmsJsonDocumentFolder(CmsJsonRequest jsonRequest)
Creates a new JSON document.- Parameters:
jsonRequest
- the JSON request
-
-
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()
-
folderListingJson
protected JSONObject folderListingJson(CmsResource target, int levelsLeft) throws java.lang.Exception
Formats folder listing as a JSON object, with the individual file names in the folder as keys.- Parameters:
target
- the folderlevelsLeft
- the number of levels to format (if 1, only the direct children are listed)- Returns:
- the JSON representation of the folder listing
- Throws:
java.lang.Exception
- if something goes wrong
-
-