---
version: 44
data:

  - type: "WorkflowTemplate"
    variation: null
    replacePermissions: false
    replaceObject: true
    attributes:
      deleteExecutionFilesOnSuccess: "false"
      description: "This Workflow Template searches all Lookup Scripts and Base Table\
      \ Conditional Scripts from Application Models to identify the deprecated form\
      \ of null values (\"<null-value>\"). A table of the found objects is printed\
      \ to the Workflow Controller Log. "
      displayName: "FindInvalidNullValuesWorkflowTemplate"
      executionPlatform: "default"
      executionRetentionPeriod: "-1"
      libraries: []
      scriptLanguage: "GROOVY"
      tags: []
      taskExecutionReport: []
      workflow: "def foundObjects = []\n\nboolean containsNullAsString(String content)\
      \ {\n    return content != null && content.contains(\"<null-value>\")\n}\n\n\
      api.applicationModels.each { applicationModel ->\n  applicationModel.versionList.each\
      \ { version ->\n    version.dataRelationRule.each { rule ->\n      def lookupScript\
      \ = rule.lookupScript\n      def conditionScript = rule.conditionScript\n\n\
      \      if (containsNullAsString(lookupScript)) {\n          foundObjects.add(new\
      \ FoundObject(applicationModel.displayName, version.displayName, rule.displayName,\
      \ \"Lookup Script\"))\n      }\n      if (containsNullAsString(conditionScript))\
      \ {\n        foundObjects.add(new FoundObject(applicationModel.displayName,\
      \ version.displayName, rule.displayName, \"Base Table Conditional Script\"))\n\
      \      }\n    }                           \n  }                            \
      \                                          \n}\n\nif (foundObjects.isEmpty())\
      \ {\n  println(\"All Lookup Scripts and Base Table Condition Scripts from Data\
      \ Relation Rules were checked. Nothing irregular was found.\")\n} else {\n \
      \   def nameApplicationModelWidth = Math.max(18, foundObjects.collect { it.nameApplicationModel.length()\
      \ }.max() ?: 18)\n    def nameVersionWidth    = Math.max(9, foundObjects.collect\
      \ { it.nameVersion.length() }.max() ?: 9)\n    def nameDataRelationRuleWidth\
      \ = Math.max(20, foundObjects.collect { it.nameDataRelationRule.length() }.max()\
      \ ?: 20)\n    def foundInScriptWidth = Math.max(20, foundObjects.collect { it.foundInScript?.length()\
      \ }.max() ?: 20)\n\n    def hFormat    = \"| %-${nameApplicationModelWidth}s\
      \ | %-${nameVersionWidth}s | %-${nameDataRelationRuleWidth}s | %-${foundInScriptWidth}s\
      \ |\"\n    def rFormat    = \"| %-${nameApplicationModelWidth}s | %-${nameVersionWidth}s\
      \ | %-${nameDataRelationRuleWidth}s | %-${foundInScriptWidth}s |\"\n    def\
      \ line = '+' +\n        '-'.center(nameApplicationModelWidth + 2, '-') + '+'\
      \ +\n        '-'.center(nameVersionWidth + 2, '-') + '+' +\n        '-'.center(nameDataRelationRuleWidth\
      \ + 2, '-') + '+' +\n        '-'.center(foundInScriptWidth + 2, '-') + '+'\n\
      \n    println(\"The following scripts were identified for using the null value\
      \ string placeholder (''<null-value>').\\n\" + \n            \"To further use\
      \ these scripts, real null values need to be used instead of a string placeholder!\"\
      )\n    println line\n    println String.format(hFormat, \"Application Model\"\
      , \"Version\", \"Data Relation Rule\", \"Script Type\")\n    println line\n\
      \    foundObjects.each { object ->\n        println String.format(rFormat, object.nameApplicationModel,\
      \ object.nameVersion, object.nameDataRelationRule, object.foundInScript)\n \
      \   }\n    println line\n    executionContext.put(\"⚠ Warning\", \"Attention\
      \ is required because invalid null values were found. Look at the Workflow Controller\
      \ Log for details.\")\n}\n\nclass FoundObject {\n  String nameDataRelationRule\n\
      \  String foundInScript\n  String nameApplicationModel\n  String nameVersion\n\
      \n  FoundObject(String nameApplicationModel, String nameVersion, String nameDataRelationRule,\
      \ String foundInScript) {\n    this.nameApplicationModel = nameApplicationModel\n\
      \    this.nameVersion = nameVersion\n    this.nameDataRelationRule = nameDataRelationRule\n\
      \    this.foundInScript = foundInScript\n  }\n}\n"
      workflowCallEntries: []
    children:
      - type: "Workflow"
        variation: null
        replacePermissions: false
        replaceObject: true
        attributes:
          description: "Execute the search."
          displayName: "RUN"
          tags: []