A single JSON document stored in a KongoDB database, exposed as both a Milton resource and a java.util.Map over its parsed JSON content so admin templates can read its properties directly. Its raw JSON is served on GET for REST clients, replaced on PUT, and updated or deleted through the exported update, save and delete methods for server-side JavaScript.

Group: Resources

Extends: AbstractJsonResource

Implements: ReplaceableResource, PostableResource, DeletableResource, ContentPermissionsResource, Map


Properties

PropertyReturnsDescription
breadCrumbsMap<String,String>Breadcrumb trail for the admin page, covering the path from the root dashboard down to this document's database (root dashboard / JSON Databases / database / this document). The root dashboard entry and this document itself are prepended and appended by the admin theme, so only the intermediate database crumb is returned here, keyed by href with the crumb label as the value.
contentManagedPermissionsbooleanWhether this document's permissions are managed as content permissions. Always false, since a document's access is controlled by its database, not per-document.
createDateDateWhen this document was created.
databaseTitleString
docTypeStringThe document's type, used to group and select Elasticsearch index mappings for documents of this kind.
documentJsonDocumentThe underlying persisted document entity this resource wraps.
emptybooleanWhether this document's parsed JSON content has no properties. Also true if the document has no content or its content cannot be parsed.
jsonStringRaw JSON content of this document, as stored. Returns null if the document has no content, or if its stored content is the literal placeholder value "undefed".
jsonObjectMapThis document's JSON content parsed into a map, cached after the first successful parse. Returns null if the document has no content, or if the content cannot be parsed as JSON.
modifiedByProfileThe profile that last modified this document.
modifiedDateDateWhen this document was last modified.
titleStringDisplay title for this document, formed by prefixing its name with "Document: ".

Methods

getTitle() · getBreadCrumbs() · getDocType() · update(String json) · update(String json, String docType) · getJson() · getJsonObject() · delete() · getModifiedDate() · getCreateDate() · isContentManagedPermissions() · isEmpty() · save() · getModifiedBy() · getDocument()

getTitle()

Returns: String

Display title for this document, formed by prefixing its name with "Document: ".

getBreadCrumbs()

Returns: Map<String,String>

Breadcrumb trail for the admin page, covering the path from the root dashboard down to this document's database (root dashboard / JSON Databases / database / this document). The root dashboard entry and this document itself are prepended and appended by the admin theme, so only the intermediate database crumb is returned here, keyed by href with the crumb label as the value.

getDocType()

Returns: String

The document's type, used to group and select Elasticsearch index mappings for documents of this kind.

update(String json)

Returns: void

Replaces this document's content with the given JSON string, keeping its current document type. The document is re-indexed as part of the update.

ParameterDescription
jsonthe new JSON content, must be a non-blank object starting with "{"

update(String json, String docType)

Returns: void

Replaces this document's content and document type. The document is re-indexed as part of the update.

ParameterDescription
jsonthe new JSON content
docTypethe new document type

getJson()

Returns: String

Raw JSON content of this document, as stored. Returns null if the document has no content, or if its stored content is the literal placeholder value "undefed".

getJsonObject()

Returns: Map

This document's JSON content parsed into a map, cached after the first successful parse. Returns null if the document has no content, or if the content cannot be parsed as JSON.

delete()

Returns: void

Deletes this document and removes it from the database's search index.

getModifiedDate()

Returns: Date

When this document was last modified.

getCreateDate()

Returns: Date

When this document was created.

isContentManagedPermissions()

Returns: boolean

Whether this document's permissions are managed as content permissions. Always false, since a document's access is controlled by its database, not per-document.

isEmpty()

Returns: boolean

Whether this document's parsed JSON content has no properties. Also true if the document has no content or its content cannot be parsed.

save()

Returns: void

Writes any in-memory changes made to this document's parsed JSON content back to the database and search index, by serialising the parsed map and calling update.

getModifiedBy()

Returns: Profile

The profile that last modified this document.

getDocument()

Returns: JsonDocument

The underlying persisted document entity this resource wraps.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.