void run()

in src/com/epam/digital/data/platform/pipelines/stages/impl/dataplatform/HistoryExcerptorDataValidation.groovy [27:45]


    void run() {

        context.logger.info("Validating requested table name")
        String currentSchemaName = context.postgres.getCurrentSchema(context.postgres.masterRepPod, "registry", context.postgres.analytical_pg_user).trim()
        if (!context.postgres.psqlCommand(context.postgres.masterRepPod,
                "select count(*) from pg_tables where tablename='${context.script.env.NAME_OF_TABLE}' " +
                        "and schemaname='${currentSchemaName}';", "registry", context.postgres.analytical_pg_user).trim().toBoolean()) {
            context.script.error("Table ${context.script.env.NAME_OF_TABLE} does'nt exist. Validadion FAILED")
        }
        context.logger.info("Table name validation passed")
        try {
            UUID uuid = UUID.fromString(context.script.env.ID)
            context.logger.info("Requested ID is VALID: ${uuid}")
            context.logger.info("UUID validation passed")
        } catch (IllegalArgumentException exception) {
            context.script.error("Please enter ID in UUID format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. " +
                    "Validadion FAILED")
        }
    }