Relaxed CNDs

Use relaxed node types for documents and compounds.

Introduction

How to convert document types to use relaxed node types.

 

Convert compound types to extend hippo:compound

Using relaxed compound types, custom compound types can now be implemented as:

[my:address] > hippo:compound, hippostd:relaxed 

This allows later editing of the type, without having to update the content.

It is also still possible to use strict compound types, even when the document types are relaxed:

[my:address] > hippo:compound
- my:street (string)
- my:city (string)

In this mixed model, it is recommended to use a separate namespace for the strict and the relaxed types.  This allows the creation of update modules to upgrade between strict types.

Create upgrade module

An upgrade module that takes care of converting the editors and type descriptions under /hippo:namespaces, a special base updater module class is available.  The org.hippoecm.frontend.upgrade.RelaxingDoctypeUpdaterModule class from the hippo-cms-upgrade module should be subclassed to provide the namespace prefix.  What is also required is the new, relaxed, cnd.

Add the following dependency to the content module of your project:

    <dependency>
        <groupId>org.onehippo.cms7</groupId>
        <artifactId>hippo-cms-upgrade</artifactId>
        <version>${hippo.cms.version}</version>
    </dependency>

An sample update module for prefix 'myproject', with the corresponding 'myproject.cnd':

public class RelaxingProjectUpgrader extends RelaxingDoctypeUpdaterModule {
  public RelaxingProjectUpgrader() {
    super("myproject", "myproject.cnd");
  }
}

Note that the cnd does need to contain a new namespace URI.

The upgrade can be triggered by adding the value 'upgrade-doctypes-trigger' to the hippo:version property in /hippo:configuration/hippo:initialize.  All relaxing updater modules will then run.

Hippo Europe: +31 (0)20 5224466
Hippo North America: +1 (707) 773-4646