Schema Manager

Schema Manager is the admin app for defining and managing JCR metadata schemas and mixins — property types and constraints, calculated fields, inheritance via mixins, and bulk import from JSON.

Admin only (adminOnly) / editor (application/vnd.webtop.metadata-schema+json) / singleton.

Opening it

Open Schema Manager from the menu.

Layout

  • Sidebar (left) — a tree of schemas and their properties (filterable); mixins carry a badge
  • Editor (right) — the edit form for the selected schema / property
  • Status bar — schema / mixin / property counts, unsaved count, save state

Key tasks

Create a schema

Use New → Add Schema, then enter a key (e.g. article), label and description. Expand to Add Property and save with Ctrl+S.

Define a property

For each property, set key, type (required), label and description, plus:

  • Behavior — calculated, default value (static or a formula)
  • Validation — required, multiple
  • Constraints — length, pattern (regex), min/max value, decimal places, choices
  • UI hints — read only, editor type, display format, and more

Use mixins

Define shared properties as a mixin and attach it to schemas to inherit them. A same-keyed property on the schema shadows (overrides) the mixin's. You can also extract selected properties into a new mixin.

Import from JSON

Use Scan Properties, drag a JSON file, and adjust which items, naming conventions and prefix to import in bulk.

Scripts (ECMAScript)

A few fields are written in ECMAScript (JavaScript). The editor provides syntax highlighting and can be maximized to full screen from the button at the top right. Every script receives a shared context object, ctx.

For ctx.formatDate / ctx.formatCurrency, locale / timeZone default to Preferences > Localization in the browser. On the server they default to the JVM, so set them explicitly when needed.

Default value (calculated)

When Behavior > Default value is set to Calculated, you can write a script that produces the default value. return the value. For a static String, switching UI hints > Editor type to JSON / XML / HTML changes the highlighting.

return ctx.item.name;

Validation

Behavior > Validation validates a property value. Return one of:

  • { valid: true }
  • { valid: false, errors: [{ messageId, severity?, params?, ruleId?, fallbackMessage? }, ...] }

Key members of ctx:

Member Description
item Snapshot of the target node (item.name, item.path, item.mimeType, …)
propertyName Name of the property being validated
value / values / isArray The input value (single / array) and whether it is an array
get(name) / getString(name) / getNumber(name) / getValues(name) Read other property values
formatCurrency(amount, currencyCodeOrOptions?) Currency formatting (options: { currency?, locale? })
formatDate(date, optionsOrPattern?) Date/time formatting (options: { pattern?, locale?, timeZone? })
const v = ctx.getString(ctx.propertyName);
if (v.length > 100) {
  return {
    valid: false,
    errors: [{
      messageId: "cms.validation.string.tooLong",
      severity: "error",
      ruleId: "maxLength",
      params: { max: 100, actual: v.length },
      fallbackMessage: "Too long (max 100)"
    }]
  };
}
return { valid: true };

Display format

UI hints > Display format produces the display string for a value. return the string to show.

Key members of ctx: value, values, item (item.name, item.path, …), get(name) / getString(name) / getNumber(name) / getValues(name), formatCurrency(amount, currencyCodeOrOptions?), formatDate(date, optionsOrPattern?).

return ctx.value;

Tips

  • Deletion is a soft delete confirmed on save; use Restore to undo.
  • Renaming a key cascades updates to schemas that reference it.