Interface JsonSettings
public interface JsonSettings
Settings for json output rendering. The current default version is
version 1.0
.
CAUTION:
This class is still in development and may change drastically without any further notice.- Since:
- 5.2.190507
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull JsonSettings
create()
Create a new defaultJsonSettings
object.int
Returns the set data render depth.@NotNull String
Returns the json format setting.@Nullable de.espirit.firstspirit.generate.functions.json.HtmlTemplateProvider
Get the currently set HtmlTemplateProvider.boolean
Gets the NonDisplayedSectionsRendering-parameter NonDisplayedSectionsRendering indicates whether non displayedSection
should be renderedint
Get the length limit of the generated JSON output.boolean
Check if the currentHtmlTemplateProvider
is the DefaultHtmlTemplateProvider and return the result.boolean
Returns the metaFormData
rendering setting.boolean
Gets the current MetaInheritanceRendering-Settingboolean
Returns the prettyPrinting setting.boolean
Get the current resolve dynamic content setting.boolean
Returns the section template rendering setting.boolean
Get the current attribute output setting.@NotNull JsonSettings
setDataRenderDepth
(int dataRenderDepth) Sets the render depth of linkedDataset
s in theJsonOutput
.@NotNull JsonSettings
setFormatVersion
(@NotNull String formatVersion) Sets the json format version for rendering.void
setHtmlTemplateProvider
(@Nullable de.espirit.firstspirit.generate.functions.json.HtmlTemplateProvider htmlTemplateProvider) Provides means to inject arbitrary templates into the JSON rendering.@NotNull JsonSettings
setMetaDataRendering
(boolean metaDataRendering) Turns the meta data for elements on or off.void
setMetaInheritanceRendering
(boolean metaInheritanceRendering) Activates or deactivates the rendering of inherited meta data values.void
setNonDisplayedSectionsRendering
(boolean shouldRenderNonDisplayedSections) Sets the NonDisplayedSectionsRendering-parameter NonDisplayedSectionsRendering indicates whether non-displayedSection
should be renderedsetOutputLengthLimit
(int limit) Set the length limit of the generated JSON output.@NotNull JsonSettings
setPrettyPrinting
(boolean value) Turns the prettyPrinting setting on or off.setResolveDynamicContent
(boolean enabled) Sets the resolve dynamic content setting.@NotNull JsonSettings
setSectionTemplateRendering
(boolean sectionTemplateRendering) Turns the template rendering forSection
type elements on or off.@NotNull JsonSettings
setTemplateAttributeRendering
(boolean enabled) Sets the template attribute output setting on or off.setUseDefaultHtmlTemplateProvider
(boolean setUseDefaultHtmlTemplateProvider) Shortcut for setting the DefaultHtmlTemplateProvider as the current htmlTemplateProvider on or off.
-
Field Details
-
VERSION_0_2
JSON Format-Version 0.2. A Pre-Release-Version.- See Also:
-
VERSION_1_0
JSON Format-Version 1.0. The first released version.- Since:
- 5.2.191206
- See Also:
-
VERSION_1_1
JSON Format-Version 1.1. This version introduces Full PageRef Rendering, which outputs the PageRef entirely and references the page instead of copying most of the Page attributes.- Since:
- 5.2.200205
- See Also:
-
VERSION_1_2
JSON Format-Version 1.2. This version introduces dom property config rendering- Since:
- 5.2.210904
- See Also:
-
-
Method Details
-
create
Create a new defaultJsonSettings
object.- Returns:
- new
JsonSettings
instance
-
isPrettyPrinting
@ApiDoc(since="5.2.190507", comment="Retrieve the pretty printing setting for json output.") boolean isPrettyPrinting()Returns the prettyPrinting setting.- Returns:
true
if pretty printing is enabled,false
otherwise- Since:
- 5.2.190507
-
setPrettyPrinting
@NotNull @ApiDoc(since="5.2.190507", comment="Switch pretty printing on/off.") @NotNull JsonSettings setPrettyPrinting(boolean value) Turns the prettyPrinting setting on or off. If pretty printing is set tofalse
no whitespaces will be added, making it the best option for data transfers. If pretty printing istrue
then the json output will be rendered more readable for humans using indentations and other whitespace for the json output.- Parameters:
value
- the new setting for prettyPrinting- Since:
- 5.2.190507
-
getFormatVersion
@ApiDoc(since="5.2.191206", comment="Retrieve the current json format version.") @NotNull @NotNull String getFormatVersion()Returns the json format setting.- Returns:
- the numeric json format version
- Since:
- 5.2.191206
-
setFormatVersion
@ApiDoc(since="5.2.191206", comment="Set the json format version string.") @NotNull @NotNull JsonSettings setFormatVersion(@NotNull @NotNull String formatVersion) Sets the json format version for rendering. Different json formats may structure data differently.- Since:
- 5.2.191206
-
isSectionTemplateRendering
@ApiDoc(since="5.2.191206", comment="Retrieve the SectionTemplateRendering setting for json output.") boolean isSectionTemplateRendering()Returns the section template rendering setting.- Returns:
true
if section template rendering is enabled,false
otherwise- Since:
- 5.2.191206
-
setSectionTemplateRendering
@ApiDoc(since="5.2.191206", comment="Set section template rendering on/off.") @NotNull @NotNull JsonSettings setSectionTemplateRendering(boolean sectionTemplateRendering) Turns the template rendering forSection
type elements on or off. If template rendering is set totrue
the template of everySection
is evaluated and the template result is the json output. If section template rendering isfalse
the default section rendering will be active and render the section as a simple JsonObject with its form data.- Parameters:
sectionTemplateRendering
- the value to set- Since:
- 5.2.191206
-
isMetaDataRendering
@ApiDoc(since="5.2.191206", comment="Retrieve the MetaDataRendering setting for json output.") boolean isMetaDataRendering()Returns the metaFormData
rendering setting.- Returns:
true
if meta data rendering is enabled,false
otherwise- Since:
- 5.2.191206
-
setMetaDataRendering
@ApiDoc(since="5.2.191206", comment="Set meta data rendering on/off.") @NotNull @NotNull JsonSettings setMetaDataRendering(boolean metaDataRendering) Turns the meta data for elements on or off. If meta data rendering istrue
the json output will contain a 'metaFormData' attribute containing the meta data.- Parameters:
metaDataRendering
- the value to set- Since:
- 5.2.191206
-
setDataRenderDepth
@NotNull @ApiDoc(since="5.2.191206", comment="Set the renderdepth for datasets.") @NotNull JsonSettings setDataRenderDepth(int dataRenderDepth) Sets the render depth of linkedDataset
s in theJsonOutput
.
- 0: all
Dataset
instances in the output are rendered as a reference - 1:
Dataset
instances in the output are rendered in full but Datasets in the hierarchy are rendered as reference - 2:
Dataset
instances in the output hierarchy that have two or more Dataset parents are rendered as a reference... and so on
- Parameters:
dataRenderDepth
- the value to set- Since:
- 5.2.191206
- 0: all
-
getDataRenderDepth
@ApiDoc(since="5.2.191206", comment="Retrieve the renderdepth for datasets.") int getDataRenderDepth()Returns the set data render depth.- Returns:
- the set data render depth
- Since:
- 5.2.191206
-
setOutputLengthLimit
Set the length limit of the generated JSON output. If the limit is exceeded, the JSON rendering will throw anIOException
. The default limit isInteger.MAX_VALUE
.- Parameters:
limit
- The length limit for the generated JSON output.- Since:
- 5.2.230506
-
getOutputLenthLimit
@Experimental int getOutputLenthLimit()Get the length limit of the generated JSON output. If the limit is exceeded, an exception will be thrown. The default limit isInteger.MAX_VALUE
.- Returns:
- The length limit for the generated JSON output.
- Since:
- 5.2.230506
-
setTemplateAttributeRendering
Sets the template attribute output setting on or off. Iftrue
allTemplateProvider
elements will render the optional "template" attribute describing the template the element is based on.- Parameters:
enabled
- the value to set.
-
isTemplateAttributeRendering
@Internal boolean isTemplateAttributeRendering()Get the current attribute output setting. Defaults totrue
- Returns:
true
if the template attribute is rendered,false
otherwise
-
getHtmlTemplateProvider
@Nullable @Internal @Nullable de.espirit.firstspirit.generate.functions.json.HtmlTemplateProvider getHtmlTemplateProvider()Get the currently set HtmlTemplateProvider. Null by default.- Returns:
- the current HtmlTemplateProvider or null if none is set.
-
setHtmlTemplateProvider
@Internal void setHtmlTemplateProvider(@Nullable @Nullable de.espirit.firstspirit.generate.functions.json.HtmlTemplateProvider htmlTemplateProvider) Provides means to inject arbitrary templates into the JSON rendering. The format templates returned by the set htmlTemplateProvider are used instead of the defined project format templates. This function was specifically developed to allow CMS_INPUT_DOM JSON Rendering without the need to maintain templates in a project.- Parameters:
htmlTemplateProvider
- theHtmlTemplateProvider
to set.
-
getUseDefaultHtmlTemplateProvider
@Internal boolean getUseDefaultHtmlTemplateProvider()Check if the currentHtmlTemplateProvider
is the DefaultHtmlTemplateProvider and return the result.- Returns:
true
if the currentHtmlTemplateProvider
is the DefaultHtmlTemplateProvider,false
otherwise
-
setUseDefaultHtmlTemplateProvider
Shortcut for setting the DefaultHtmlTemplateProvider as the current htmlTemplateProvider on or off.- Parameters:
setUseDefaultHtmlTemplateProvider
- theHtmlTemplateProvider
to set.
-
isResolveDynamicContent
@Internal boolean isResolveDynamicContent()Get the current resolve dynamic content setting. Defaults totrue
.- Returns:
true
if dynamic content is resolved and rendered,false
otherwise
-
setResolveDynamicContent
Sets the resolve dynamic content setting. This setting refers to the rendering ofContent2Section
s. By default this setting is true and the dynamic content ofContent2Section
s is resolved. In that case the Content2Section template is used to render all data, that can be derived from the current State of thePageRef
via itsContent2Params
.
If set to false, theContent2Section
s will be rendered as a placeholder reference, meaning it contains information with which the content can be retrieved, instead of the content itself. A client may then use the placeholder information to retrieve the actual content at a later time.- Parameters:
enabled
- the value to set
-
setNonDisplayedSectionsRendering
void setNonDisplayedSectionsRendering(boolean shouldRenderNonDisplayedSections) Sets the NonDisplayedSectionsRendering-parameter NonDisplayedSectionsRendering indicates whether non-displayedSection
should be rendered- Parameters:
shouldRenderNonDisplayedSections
-true
non displayedSection
will be included in JSON-Output- Since:
- 5.2.210102
-
getNonDisplayedSectionsRendering
boolean getNonDisplayedSectionsRendering()Gets the NonDisplayedSectionsRendering-parameter NonDisplayedSectionsRendering indicates whether non displayedSection
should be rendered- Returns:
true
non displayedSection
will be included in JSON-Output- Since:
- 5.2.210102
-
setMetaInheritanceRendering
void setMetaInheritanceRendering(boolean metaInheritanceRendering) Activates or deactivates the rendering of inherited meta data values. If this setting is set totrue
, the rendered meta data will include values from the parent hierarchy. If this setting is set tofalse
, only the meta data from the current element will be rendered.- Parameters:
metaInheritanceRendering
-- Since:
- 5.2.210409
-
isMetaInheritanceRendering
boolean isMetaInheritanceRendering()Gets the current MetaInheritanceRendering-Setting- Returns:
- metaInheritanceRendering
- Since:
- 5.2.210409
-