JCR data model & schema

Content in MintJams CMS is stored in a repository based on JCR (Content Repository for Java Technology API 2.0 / JSR 283). This page covers the data model a developer should know, metadata schemas, and the GraphQL API for access.

Fundamentals

  • Workspace — an isolated content store; system holds identity (users/groups/roles)
  • Node — a tree element with a path (e.g. /content/commerce/orders/)
  • Property — a node attribute, with a namespace prefix (e.g. commerce:order_id)
  • Primary node typesnt:folder (folder), nt:file (file)
  • Mixinsmix:referenceable (adds a UUID, makes it referenceable), mix:versionable (enables versioning)
  • Namespaces — standard prefixes (jcr / nt / mix …) plus app-specific ones you register (e.g. commerce:)

Repository layout (example)

Content is placed in a tree by purpose. A commerce example:

/content/commerce/
├── orders/raw/{yyyy}/{MM}/order_{id}.json   # received orders
├── products/product_{id}.json               # products
├── inventory/levels/{inventory_item_id}.json# inventory
└── endpoints/*.groovy                        # server-side endpoints
/etc/commerce/config/*.yml                     # configuration
/etc/metadata/definitions                      # metadata schema definitions
/etc/i18n/*.json                               # message bundles
/home/users|groups|roles                       # identity (system workspace)

Content modeling

  • Files/folders are nt:file / nt:folder nodes, with domain-specific values as properties (e.g. commerce:status)
  • Versioning — add mix:versionable and create versions with checkout / checkin
  • Locking — locks for exclusive editing (owner, depth, session scope)
  • Referencesmix:referenceable adds a UUID; relate with strong (Reference) or weak (WeakReference) references
  • Standard metadatacreated / createdBy / modified / modifiedBy; files add mimeType / size / encoding

Metadata schema

In Schema Manager you define schemas and mixins for JCR properties. Each property has a type (String / Long / Double / Boolean / Date / Binary / Name / Path / Reference / WeakReference / URI, …) plus constraints (required, multiple, length, pattern, min/max, choices), calculated fields and UI hints. Shared properties can be grouped into a mixin and attached to schemas for inheritance. For the operational side, see "Schema Manager".

GraphQL API

Content, identity and BPM/EIP are accessed through GraphQL. Main queries:

  • node(path) / children(path, ...) — fetch / list nodes
  • query(statement, language, ...) / xpath(...) / search(text, ...) — search (JCR-SQL2 / XPath / full-text)
  • accessControl(path) / versionHistory(path) — ACL / version history
  • workspaces / cluster — workspaces / cluster
  • processDefinitions / tasks / incidents (BPM), routes / historyExchanges (EIP)

Main mutations:

  • createFolder / createFile / deleteNode / renameNode
  • setProperties / addMixin / deleteMixin
  • lockNode / unlockNode / checkin / checkout / restoreVersion
  • setAccessControl / deleteAccessControl
  • initiateMultipartUpload and friends (uploading large binaries)

Property values are passed via type-specific inputs (stringValue / longValue / dateValue / referenceValue, …). Example:

mutation {
  setProperties(path: "/content/articles/hello.json",
    properties: [{ name: "commerce:status", value: { stringValue: "received" } }]
  ) { node { path } errors { name message } }
}

Related