Customization File

 

Harmony Core Customization File

 

Various aspects of a Harmony Core environment can be customized by crating a customization file, which is a JSON file named HarmonyCoreCustomization.json. You must place this file in the same location as the CodeGen templates that you are using.

 

The customization file must contain at minimum an empty JSON object:

 

          {

          }

 

You can then customize various aspects of your Harmony Core environment by adding specific named properties to the object. Examples of doing so can be found below.

 

Customizing Relations

To customize the relation names produced by the <HARMONYCORE_RELATION_NAME> and <HARMONYCORE_FROM_RELATION_NAME> expansion tokens you must add a property named CustomRelationNames to the JSON object. The property must define an array of objects, each of which provides a custom name for a specific relationship. For example:

 

{

  "CustomRelations": [

    {

      "FromStructure": "CUSTOMERS",

      "FromKey": "CUSTOMER_NUMBER",

      "ToStructure": "ORDERS",

      "ToKey": "CUSTOMER_NUMBER",

      "RelationName": "CustomerOrders",

      "RelationType": "D",

      "ValidationMode": "None",

      "CustomValidatorName": "",

      "BackRelation": "ORDERS-CUSTOMERS-CUSTOMER_NUMBER-CUSTOMER_NUMBER"

    },

    {

      "FromStructure": "CUSTOMERS",

      "FromKey": "FAVORITE_ITEM",

      "ToStructure": "ITEMS",

      "ToKey": "ITEM_NUMBER",

      "RelationName": "CustomerFavoriteItem",

      "RelationType": "C",

      "ValidationMode": "ValuePresent",

      "CustomValidatorName": "",

      "BackRelation": "ITEMS-CUSTOMERS-ITEM_NUMBER-FAVORITE_ITEM"

    },

    {

      "FromStructure": "CUSTOMERS",

      "FromKey": "CUSTOMER_NUMBER",

      "ToStructure": "CUSTOMER_NOTES",

      "ToKey": "CUSTOMER_NUMBER",

      "RelationName": "CustomerNotes",

      "RelationType": "D",

      "ValidationMode": "None",

      "CustomValidatorName": "",

      "BackRelation": "CUSTOMER_NOTES-CUSTOMERS-CUSTOMER_NUMBER-CUSTOMER_NUMBER"

    }

  ]

}

 

You may add any number of objects to the array to customize any number of relations. Structure and key names must be specified exactly as defined in the repository and must be in upper case.

 

 FromStructure Property

 

This property should be set to the name of the FROM STRUCTURE in the repository for the relation being customized, and is used for identifying the repository relation to be customized.

 

 FromKey Property

 

This property should be set to the name of the FROM KEY in the repository for the relation being customized, and is used for identifying the repository relation to be customized.

 

 ToStructure Property

 

This property should be set to the name of the TO STRUCTURE in the repository for the relation being customized, and is used for identifying the repository relation to be customized.

 

 ToKey Property

 

This property should be set to the name of the TO KEY in the repository for the relation being customized, and is used for identifying the repository relation to be customized.

 

 RelationName Property

 

This property can be used to customize the name of the navigation property that is added to data model classes to expose the relation. By default the navigation property will be named REL_<ToStructureName>, but when overridden will be set to REL_<RelationName>.

 

 RelationType Property

 

This property can be used to override the Harmony Core relation type for the relationship, in the event that CodeGen identifies an incorrect relation type. The relation types are:

 

Type

Name

Description

A

Many to One to Many

Many records in the "from" file are associated with a single record in the "to" file and vice versa.

B

One to One to One

Each record in the "from” file is associated with one record in the "to” file and vice versa.

C

One to One

Each record in the "from” file is associated with one record in the "to” file, but there is no reverse relationship.

D

One to Many to One

Each record in the "from” file is associated with one or more records in the "to” file and vice versa.

E

One to Many

Each record in the "from" file is associated with one or more records in the "to" file, but there is no reverse relationship.

 

 RequiresMatch Property (DEPRECATED)

 

This property was previously used to define whether a relation required validation. When set to true validation would always be attempted. When set to false validation would only be attempted when a non-space (alpha) or non-zero (decimal) value was present in the source field. This mechanism proved to be insufficient to correctly perform validation in several possible scenarios, and has been replaced by the ValidationMode property (see below).

 

If RequiresMatch=true is found in a customization file and ValidationMode is not present, the ValidationMode is set to Always.

 

If RequiresMatch=false is found in a customization file and ValidationMode is not present, the ValidationMode is set to None.

 

We recommend removing all instances of RequiresMatch and replacement with an appropriate ValidationMode property.

 

 ValidationMode Property

 

This property defines what validation is performed when processing inbound data and when the ENABLE_RELATIONS_VALIDATION setting is enabled. Possible values for this property are:

 

Value

Meaning

None

No validation should ever be performed.

ValuePresent

Validation should be performed only if a non-blank (alpha) or non-zero (numeric) value is present in the source field.

Always

Validation should always be performed, regardless of the value in the source field.

CustomCode

Validation will be performed by custom code named in the CustomValidatioName property

 

 CustomValidatorName Property

 

This property will be used to name a custom validation mechanism that will be used to validate relation data. This mechanism has not yet been defined.

 

 BackRelation Property

 

TBD.

 

 

 


Copyright © 2018  Synergex International, Inc.