---
version: 20
data:

- type: "ModificationMethod"
  variation: null
  replacePermissions: true
  replaceObject: true
  attributes:
    category: "Misc"
    code: |-
      /*
      * *****************************************************************************
      * The following variables are available in this script:
      * =====================================================
      * ctx             : A context object that offers a number of methods.
      *                   The method indexOf() can be used to get the index of a
      *                   specific column within the dataArray.
      * dataArray       : The data array. This array contains the contents of all
      *                   columns of the current row of the table that is being
      *                   masked by this method.
      *
      * Additionally for column based modification methods the following two
      * variables are available:
      * columnName      : The name of the column that matched the pattern.
      * columnIndex     : The position of the column that matched the pattern within
      *                   the data array. This value is zero-based.
      * *****************************************************************************
      */

      /*
      * This function is called once before the processing starts. The method
      * is called once per table.
      */
      function init() {

      }

      /*
      * This function should modify the row that is provided by the dataArray. The
      * method is called for each single row of the table.
      */
      function apply() {
         ctx.setData(columnIndex, "unknownName@unknownAddress.com");
      }

      /*
      * This function is executed once after the modification of a table is complete. The method
      * is called once per table.
      */
      function close() {

      }
    description: "Inserts a dummy email address into a target column."
    displayName: "Set default email"
    inputType: "COLUMN"
    javaScriptLibraries: []
    parameters: []

- type: "ModificationSet"
  variation: null
  replacePermissions: true
  replaceObject: true
  attributes:
    activationScript: ""
    active: true
    description: |-
      In this example, the source table, which is named 'EXAMPLE_S.ADDRESSES', has the following columns filled with generic example values: 'ID', 'FIRSTNAME', 'LASTNAME', 'STREET', 'CITY', 'POSTCODE'.
      The target table, which is named 'EXAMPLE_T.ADDRESSES', has an additional EMAIL column, which is not nullable and has no default value.
    displayName: "Set default email"
    libraries: []
    scriptLanguage: "JAVA_SCRIPT"
  children:
    - type: "ModificationRule"
      variation: null
      replacePermissions: true
      replaceObject: true
      attributes:
        active: true
        adaptionScript: |-
          /*
           * This function adjusts the dataArray before executing the actual modification method.
           */
          /*
          function convertTo() { }
          */
          
          /*
           * This function adjusts the dataArray after execution of the actual modification method.
           */
          /*
          function convertFrom() { }
          */
        automaticDatatypeConversionPerRow: false
        columnPattern: "EMAIL"
        conditionScript: |-
          /*
           * This function should return true or false and determines whether
           * the modification method is executed.
           */
          
          /*
           function condition() {
              return true;
          }
          */
        description: ""
        modificationMethod: "Set default email"
        modificationPropagation: false
        namePattern: "ADDRESSES"
        schemaPattern: "EXAMPLE_T"
        scope: "TARGET"