Aligning Mismatched Content

What to do when the content type doesn't match between the source and destination?

When syncing content between repositories, you will run into cases when the content doesn't match up correctly. Maybe the name of a field is wrong or the content type has a different name. Let's say that you have a WebContentGeneric CT in the source but a RichText CT in the destination, that will store the same data. You can solve this by creating a content mapping configuration.

How to align mismatched content

At this time, we do not have this functionality available in our UI. Instead you will need to use the REST endpoints to save the content mapping configuration. However, we do plan on add this functionality to the UI. Stay tuned.

Create/Update Config API

To create a content mapping config, you will need to use the "Motator" API. Using cURL, you can make a request like the following:

curl --location -g --request POST '{{impulse-protocol}}://{{impulse-domain}}:{{impulse-port}}/private/motator/mappings/{{job-id}}' \
--data-raw '{
  "endpointId" : "8eb1794f-b0e7-45f0-911d-45c2dd2798c6",
  "destinationContentTypeUniqueName": "MotatorImpulsePoc",
  "fieldMappings": [
    {
     "sourceFieldUniqueName": "title",
     "destinationFieldUniqueName": "motatorTitle",
     "destinationFieldType": "String"
    },
    {
     "sourceFieldUniqueName": "body",
     "destinationFieldUniqueName": "motatorBody",
     "destinationFieldType": "Textarea",
     "systemProperties": {"system_key": "system_value"}
    }
  ]
}'

Request Body

The request body with variables to send is similar to the following:

{
  "endpointId" : "8eb1794f-b0e7-45f0-911d-45c2dd2798c6",
  "destinationContentTypeUniqueName": "MotatorImpulsePoc",
  "fieldMappings": [
    {
     "sourceFieldUniqueName": "title",
     "destinationFieldUniqueName": "motatorTitle",
     "destinationFieldType": "String"
    },
    {
     "sourceFieldUniqueName": "body",
     "destinationFieldUniqueName": "motatorBody",
     "destinationFieldType": "Textarea",
     "systemProperties": {"system_key": "system_value"}
    }
  ]
}

Each attribute of the request body maps a portion of the source content to the destination content. A quick description of each attribute follows:

  • endpointId: Destination Endpoint Id.

  • destinationContentTypeUniqueName: Destination Content Type Unique Id.

  • fieldMappings: Array of the fields that you want to map.

    • fieldMappings.sourceFieldUniqueName: Source Field Unique Id/Name, for example in dotCMS -> velocity variable name.

    • fieldMappings.destinationFieldUniqueName: Destination Field Unique Id/Name.

    • fieldMappings.systemProperties: JSON object or escaped string of a JSON object that has key value pairs for system specific attributes.

      • optional

Running a Sync

After the content mapping config is created, you can run a sync. While the transaction is in progress the source content will be mapped based on the saved config. Then when the content is synced to the destination, it will match the destination content type from the mapping.

Aligning Mismatched Content Deep Dive

  • All mapped content will live under Diesel /mapped bucket, using the same id that the motation.

  • All matches are case-sensitive. Be aware of that when using the API.

Further details can be found in the API doc.

Last updated