From ac2e0f701893cd6659b261705c942c74ee48597a Mon Sep 17 00:00:00 2001 From: Rene Krenn Date: Sat, 6 Apr 2024 18:33:27 +0200 Subject: [PATCH] wire encoding dbtool options for xls tasks --- .../java/org/phoenixctms/ctsms/executable/DBTool.java | 11 ++++++++--- .../org/phoenixctms/ctsms/util/DBToolOptions.java | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/core/src/exec/java/org/phoenixctms/ctsms/executable/DBTool.java b/core/src/exec/java/org/phoenixctms/ctsms/executable/DBTool.java index 8f3e383b0c90..30df54101869 100644 --- a/core/src/exec/java/org/phoenixctms/ctsms/executable/DBTool.java +++ b/core/src/exec/java/org/phoenixctms/ctsms/executable/DBTool.java @@ -827,13 +827,15 @@ public static void main(String[] args) { job = DBToolOptions.getTaskAndLockProcess(DBToolOptions.IMPORT_INPUT_FIELDS_OPT); dbTool.initJob(line).printPrelude(job); if (dbTool.testForced(line, "DB will be modified - input fields and selection set values will be updated!")) { - sendEmail = dbTool.getXlsImporter().loadInputFields(line.getOptionValue(DBToolOptions.IMPORT_INPUT_FIELDS_OPT), getAuthenticationOptionValue(line)) > 0l; + sendEmail = dbTool.getXlsImporter().loadInputFields(line.getOptionValue(DBToolOptions.IMPORT_INPUT_FIELDS_OPT), + line.getOptionValue(DBToolOptions.ENCODING_OPT), getAuthenticationOptionValue(line)) > 0l; } } else if (line.hasOption(DBToolOptions.IMPORT_ECRFS_OPT)) { job = DBToolOptions.getTaskAndLockProcess(DBToolOptions.IMPORT_ECRFS_OPT); dbTool.initJob(line).printPrelude(job); if (dbTool.testForced(line, "DB will be modified - eCRFs, eCRF fields, input fields and selection set values will be updated!")) { - sendEmail = dbTool.getXlsImporter().loadEcrfs(line.getOptionValue(DBToolOptions.IMPORT_ECRFS_OPT), getAuthenticationOptionValue(line), + sendEmail = dbTool.getXlsImporter().loadEcrfs(line.getOptionValue(DBToolOptions.IMPORT_ECRFS_OPT), line.getOptionValue(DBToolOptions.ENCODING_OPT), + getAuthenticationOptionValue(line), getIdOptionValue(line, true)) > 0l; } } else if (line.hasOption(DBToolOptions.EXPORT_INPUT_FIELD_OPT)) { @@ -843,6 +845,7 @@ public static void main(String[] args) { || dbTool.testOverwriteFile(line, line.getOptionValue(DBToolOptions.EXPORT_INPUT_FIELD_OPT))) { sendEmail = dbTool.getXlsExporter().exportInputField( line.getOptionValue(DBToolOptions.EXPORT_INPUT_FIELD_OPT), + line.getOptionValue(DBToolOptions.ENCODING_OPT), getAuthenticationOptionValue(line), getIdOptionValue(line, true)) > 0l; } } else if (line.hasOption(DBToolOptions.EXPORT_ECRFS_OPT)) { @@ -852,6 +855,7 @@ public static void main(String[] args) { || dbTool.testOverwriteFile(line, line.getOptionValue(DBToolOptions.EXPORT_ECRFS_OPT))) { sendEmail = dbTool.getXlsExporter().exportEcrfs( line.getOptionValue(DBToolOptions.EXPORT_ECRFS_OPT), + line.getOptionValue(DBToolOptions.ENCODING_OPT), getAuthenticationOptionValue(line), getIdOptionValue(line, true)) > 0l; } } else if (line.hasOption(DBToolOptions.IMPORT_RANDOMIZATION_LISTS_OPT)) { @@ -859,12 +863,13 @@ public static void main(String[] args) { dbTool.initJob(line).printPrelude(job); if (dbTool.testForced(line, "DB will be modified - randomization lists will be updated!")) { sendEmail = dbTool.getXlsImporter().loadRandomizationLists(line.getOptionValue(DBToolOptions.IMPORT_RANDOMIZATION_LISTS_OPT), + line.getOptionValue(DBToolOptions.ENCODING_OPT), getAuthenticationOptionValue(line), getIdOptionValue(line, true), true) > 0l; } } else if (line.hasOption(DBToolOptions.IMPORT_ASPS_OPT)) { job = DBToolOptions.getTaskAndLockProcess(DBToolOptions.IMPORT_ASPS_OPT); dbTool.getJobOutput().printPrelude(job); - sendEmail = dbTool.getXlsImporter().loadAsps(line.getOptionValue(DBToolOptions.IMPORT_ASPS_OPT), + sendEmail = dbTool.getXlsImporter().loadAsps(line.getOptionValue(DBToolOptions.IMPORT_ASPS_OPT), line.getOptionValue(DBToolOptions.ENCODING_OPT), line.hasOption(DBToolOptions.FLUSH_REVISION_OPT), line.getOptionValue(DBToolOptions.ASP_REVISION_OPT)) > 0l; } else if (line.hasOption(DBToolOptions.EXPORT_ECRF_PDFS_OPT)) { job = DBToolOptions.getTaskAndLockProcess(DBToolOptions.EXPORT_ECRF_PDFS_OPT); diff --git a/core/src/exec/java/org/phoenixctms/ctsms/util/DBToolOptions.java b/core/src/exec/java/org/phoenixctms/ctsms/util/DBToolOptions.java index a717e2f14e99..22090558e36b 100644 --- a/core/src/exec/java/org/phoenixctms/ctsms/util/DBToolOptions.java +++ b/core/src/exec/java/org/phoenixctms/ctsms/util/DBToolOptions.java @@ -380,7 +380,7 @@ public String toString() { options.addOption(registerOptionalOption(LIMIT_OPT, "limit", "limit for number of (processed) records", 1)); options.addOption(registerOptionalOption(FLUSH_REVISION_OPT, "flush_revision", "flush alpha id, ops code, asp, asp, icd or ops systematics records prior to import", 0)); - options.addOption(registerOptionalOption(ENCODING_OPT, "encoding", "encoding of csv/text file to import", 1)); + options.addOption(registerOptionalOption(ENCODING_OPT, "encoding", "encoding of file to import/export", 1)); options.addOption(registerOptionalOption(USERNAME_OPT, "username", "username", 1)); options.addOption(registerOptionalOption(PASSWORD_OPT, "password", "user password", 1)); options.addOption(registerOptionalOption(AUTH_OPT, "auth", "base64 encoded username and password", 1));