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;
systemholds 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 types —
nt:folder(folder),nt:file(file) - Mixins —
mix: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:foldernodes, with domain-specific values as properties (e.g.commerce:status) - Versioning — add
mix:versionableand create versions withcheckout/checkin - Locking — locks for exclusive editing (owner, depth, session scope)
- References —
mix:referenceableadds a UUID; relate with strong (Reference) or weak (WeakReference) references - Standard metadata —
created/createdBy/modified/modifiedBy; files addmimeType/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 nodesquery(statement, language, ...)/xpath(...)/search(text, ...)— search (JCR-SQL2 / XPath / full-text)accessControl(path)/versionHistory(path)— ACL / version historyworkspaces/cluster— workspaces / clusterprocessDefinitions/tasks/incidents(BPM),routes/historyExchanges(EIP)
Main mutations:
createFolder/createFile/deleteNode/renameNodesetProperties/addMixin/deleteMixinlockNode/unlockNode/checkin/checkout/restoreVersionsetAccessControl/deleteAccessControlinitiateMultipartUploadand 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
- The access-control model: "Users, roles & permissions"
- Working with schemas: "Schema Manager"