Content Diff module

Edition

Incubator (services)

Issues

Git

Git

Latest

1.0.6

Compatible with Magnolia 6.2.

The Content Diff module lets you compare your current content version with the previous version.

This module is at the INCUBATOR level.

Installing with Maven

Maven is the easiest way to install the module. Add the following to your bundle:

<dependency>
  <groupId>info.magnolia.content</groupId>
  <artifactId>magnolia-content-diff</artifactId>
  <version>1.0.6</version>
</dependency>

Usage

This sections shows you how to configure and use the module.

Add show diff action to your app

subApps:
  browser:
    actions:
      diffWithPreviousVersion:
        label: 'Show diff content'
        icon: icon-show-versions
        $type: openDialogAction
        dialogId: content-diff:contentDiff
        availability:
          rules:
            notDeleted:
              $type: jcrIsDeletedRule
              negate: true
            hasVersionsRule:
              $type: jcrHasVersionsRule
    actionbar:
      sections:
        - name: item #please modify this name according to your section definition
          groups:
            - name: versioning
              items:
                - name: diffWithPreviousVersion

Configuration

You can configure from which workspace properties should get reference values. This is done in your config.yaml file. This configuration enable you configure for multiple apps by specify workspaceName property.

config.yaml
################# SPECIFY THE PROPERTY/WORKSPACE CONFIGURATION #################
referencedConfigs:
  website:
    workspaceName: website
    referencedWorkspaces:
      image: dam
    depth: 5 (1)
    datePropertiesFormat: (2)
      scheduleDate: "yyyy-MM-dd"
      expiredDate: "datetime short"
    dataFormats: (3)
      meter: # propertyName
        class: # class which implement from DataConverter
      currency: # propertyName
        class: # class which implement from DataConverter
    excludedNodeTypes: (4)
      - mgnl:componentVariants
      - mgnl:versionMetaData
    excludedNodeNames: (5)
      - footer
      - footer1
      - mgnl:versionMetaData
1 depth: the depth of the node you want to compare.
2 datePropertiesFormat: configure the date format for your properties.
3 dataFormats: support conversions to other data formats, such as currency or meters to feet.
4 excludedNodeTypes: the specific node types to be excluded.
5 excludedNodeNames: the specific property names to be excluded.

Data converter

Create a class implement (info.magnolia.content.diff.data.DataConverter) to convert and format specific data.

Example
public class MeterToFeetFormat implements DataConverter {

    @Override
    public String format(String propertyValue) {
        int meter = Integer.parseInt(propertyValue);
        double feet = 3.281 * meter;
        return String.valueOf(feet);
    }
}

Decoration

You can decorate your Content Diff module configuration based on your needs. For example, if you needed to have an Award field for different apps.

config.yaml
################# SPECIFY THE MULTIPLE WORKSPACE CONFIGURATION #################
referencedConfigs:
  hotels:
    workspaceName: hotels
    referencedWorkspaces:
      award: hotel-awards
  tours:
    workspaceName: tours
    referencedWorkspaces:
      award: tours-awards

This can be done via a decorations registry in your own light module. The decorations you define impact the Content Diff module’s config.yaml file.

For more on decorating via light modules, see Definition decoration.
Expected structure
your-light-module/ (1)
├── decorations/ (2)
│   └── content-diff/ (3)
        └── config.yaml (4)
1 From within your own light module.
2 The decorations registry.
3 This tells Magnolia to decorate the content-diff module.
4 Use the config.yaml file to decorate as you see fit.

Content Diff dialog

The Content Diff dialog shows the comparison result. The dialog shows these columns:

  • Property Name

  • Old Value

  • New Value

Table 1. Example
Property Name Old Value New Value

test.title

Old Title

New Title

test.title_de

Alter Titel

Neuer Titel

content diff header

Changelog

Version Notes

1.0.6

1.0.5

1.0.4

1.0.3

1.0.2

1.0.1

1.0

Initial release of the module.

Feedback

Incubators

×

Location

This widget lets you know where you are on the docs site.

You are currently perusing through the Content Diff module docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules