---
version: 20
data:

- type: "ModificationMethod"
  variation: null
  replacePermissions: true
  replaceObject: true
  attributes:
    category: "Kunden-Snippets"
    code: "/*\n * *****************************************************************************\n\
      \ * The following variables are available in this script:\n * =====================================================\
      \ \n * ctx             : A context object that offers a number of methods. \n\
      \ *                   The method indexOf() can be used to get the index of a\
      \ \n *                   specific column within the dataArray. \n * dataArray\
      \       : The data array. This array contains the contents of all \n *     \
      \              columns of the current row of the table that is being \n *  \
      \                 masked by this method.\n *\n * Additionally for column based\
      \ modification methods the following two\n * variables are available:\n * columnName\
      \      : The name of the column that matched the pattern.\n * columnIndex  \
      \   : The position of the column that matched the pattern within\n *       \
      \            the data array. This value is zero-based.\n * *****************************************************************************\n\
      \ */\n\n/*\n * This function is called once before the processing starts. The\
      \ method\n * is called once per table. \n */\nfunction init() {\n  \nvar maxValue\
      \ = ctx.fetchSingleValueFromConnection(\"TARGET\", \"SELECT MAX(\" + columnName\
      \ + \") FROM \\\"\" + getCurrentTableMappedSchema() +\"\\\".\\\"\"+ getCurrentTableMappedName()\
      \ + \"\\\"\");\n\nvar pool = ctx.getCurrentTargetConnectionPool();\n\nconnection\
      \ = pool.get();\nstmt = connection.createStatement();\nstmt.execute(\"ALTER\
      \ TABLE \\\"\" + getCurrentTableMappedSchema() +\"\\\".\\\"\"+ getCurrentTableMappedName()\
      \ + \"\\\" ALTER COLUMN \" + columnName + \" RESTART WITH \" + (parseInt(maxValue)+1));\n\
      pool.put(connection);\n\t\n}\n\n/* \n * This function should modify the row\
      \ that is provided by the dataArray. The \n * method is called for each single\
      \ row of the table. \n */\nfunction apply() {\n\t\n}\n\n/*\n * This function\
      \ is executed once after the modification of a table is complete. The method\n\
      \ * is called once per table. \n */\nfunction close() {\n\t\n}"
    description: ""
    displayName: "New Sequence"
    inputType: "COLUMN"
    javaScriptLibraries: []
    parameters: []