diff --git a/src/main/java/com/salesforce/dataloader/action/AbstractAction.java b/src/main/java/com/salesforce/dataloader/action/AbstractAction.java index 22f631bd..188340b5 100644 --- a/src/main/java/com/salesforce/dataloader/action/AbstractAction.java +++ b/src/main/java/com/salesforce/dataloader/action/AbstractAction.java @@ -90,11 +90,11 @@ protected AbstractAction(Controller controller, ILoaderProgress monitor) } this.visitor = createVisitor(); int retries = -1; - this.enableRetries = controller.getAppConfig().getBoolean(AppConfig.ENABLE_RETRIES); + this.enableRetries = controller.getAppConfig().getBoolean(AppConfig.PROP_ENABLE_RETRIES); if (this.enableRetries) { try { // limit the number of max retries in case limit is exceeded - retries = Math.min(AppConfig.MAX_RETRIES_LIMIT, controller.getAppConfig().getInt(AppConfig.MAX_RETRIES)); + retries = Math.min(AppConfig.MAX_RETRIES_LIMIT, controller.getAppConfig().getInt(AppConfig.PROP_MAX_RETRIES)); } catch (ParameterLoadException e) { retries = AppConfig.DEFAULT_MAX_RETRIES; } @@ -158,7 +158,7 @@ public final void execute() { private List executeOperation() { List exceptions = new ArrayList<>(); try { - getLogger().info(getMessage("loading", getConfig().getString(AppConfig.OPERATION))); + getLogger().info(getMessage("loading", getConfig().getString(AppConfig.PROP_OPERATION))); getDao().open(); initOperation(); if (writeStatus()) { @@ -189,7 +189,7 @@ private List executeOperation() { //if no exceptions occurred then display success/error if (exceptions.size() == 0) { final Object[] args = {String.valueOf(getVisitor().getNumberSuccesses()), - getConfig().getString(AppConfig.OPERATION), String.valueOf(getVisitor().getNumberErrors())}; + getConfig().getString(AppConfig.PROP_OPERATION), String.valueOf(getVisitor().getNumberErrors())}; // set the monitor to done if (getMonitor().isCanceled()) { @@ -213,7 +213,7 @@ private boolean shouldRetryOperation(Exception e, int numAttempts) { if (numAttempts < this.maxRetries-1 && this.enableRetries) { // loop only if less than MAX_RETRIES logger.warn("Encountered an error on server when performing " - + controller.getAppConfig().getString(AppConfig.OPERATION) + + controller.getAppConfig().getString(AppConfig.PROP_OPERATION) + " on attempt " + numAttempts ); logger.warn(e.getMessage()); @@ -230,7 +230,7 @@ private boolean shouldRetryOperation(Exception e, int numAttempts) { private void retrySleep(int retryNum) { int sleepSecs; try { - sleepSecs = controller.getAppConfig().getInt(AppConfig.MIN_RETRY_SLEEP_SECS); + sleepSecs = controller.getAppConfig().getInt(AppConfig.PROP_MIN_RETRY_SLEEP_SECS); } catch (ParameterLoadException e1) { sleepSecs = AppConfig.DEFAULT_MIN_RETRY_SECS; } @@ -239,7 +239,7 @@ private void retrySleep(int retryNum) { logger.info(Messages.getFormattedString("Client.retryOperation", new String[]{Integer.toString(retryNum + 1), - getController().getAppConfig().getString(AppConfig.OPERATION), + getController().getAppConfig().getString(AppConfig.PROP_OPERATION), Integer.toString(sleepSecs)})); try { Thread.sleep(sleepSecs * 1000); @@ -310,7 +310,7 @@ protected void handleException(Exception e) { * @throws DataAccessObjectInitializationException */ public DataWriter createErrorWriter() throws DataAccessObjectInitializationException { - final String filename = getConfig().getString(AppConfig.OUTPUT_ERROR); + final String filename = getConfig().getString(AppConfig.PROP_OUTPUT_ERROR); if (filename == null || filename.length() == 0) throw new DataAccessObjectInitializationException(getMessage("errorMissingErrorFile")); // TODO: Make sure that specific DAO is not mentioned: use DataReader, DataWriter, or DataAccessObject @@ -323,7 +323,7 @@ public DataWriter createErrorWriter() throws DataAccessObjectInitializationExcep * @throws DataAccessObjectInitializationException */ public DataWriter createSuccesWriter() throws DataAccessObjectInitializationException { - final String filename = getConfig().getString(AppConfig.OUTPUT_SUCCESS); + final String filename = getConfig().getString(AppConfig.PROP_OUTPUT_SUCCESS); if (filename == null || filename.length() == 0) throw new DataAccessObjectInitializationException(getMessage("errorMissingSuccessFile")); // TODO: Make sure that specific DAO is not mentioned: use DataReader, DataWriter, or DataAccessObject @@ -336,8 +336,8 @@ public void openErrorWriter(List headers) throws OperationException { AppConfig appConfig = this.controller.getAppConfig(); if (appConfig.isBulkV2APIEnabled() - && !appConfig.getString(AppConfig.OPERATION).equals(OperationInfo.extract.name()) - && !appConfig.getString(AppConfig.OPERATION).equals(OperationInfo.extract_all.name())) { + && !appConfig.getString(AppConfig.PROP_OPERATION).equals(OperationInfo.extract.name()) + && !appConfig.getString(AppConfig.PROP_OPERATION).equals(OperationInfo.extract_all.name())) { headers.add(0, AppConfig.ID_COLUMN_NAME); headers.add(1, AppConfig.ERROR_COLUMN_NAME); } else { @@ -349,7 +349,7 @@ public void openErrorWriter(List headers) throws OperationException { getErrorWriter().setColumnNames(headers); } catch (final DataAccessObjectInitializationException e) { throw new OperationException( - getMessage("errorOpeningErrorFile", getConfig().getString(AppConfig.OUTPUT_ERROR)), e); + getMessage("errorOpeningErrorFile", getConfig().getString(AppConfig.PROP_OUTPUT_ERROR)), e); } } @@ -359,8 +359,8 @@ public void openSuccessWriter(List headers) throws LoadException { // add the ID column if not there already if (appConfig.isBulkV2APIEnabled() - && !appConfig.getString(AppConfig.OPERATION).equals(OperationInfo.extract.name()) - && !appConfig.getString(AppConfig.OPERATION).equals(OperationInfo.extract_all.name())) { + && !appConfig.getString(AppConfig.PROP_OPERATION).equals(OperationInfo.extract.name()) + && !appConfig.getString(AppConfig.PROP_OPERATION).equals(OperationInfo.extract_all.name())) { if (headers.size() == 0 || !AppConfig.ID_COLUMN_NAME.equals(headers.get(0))) { headers.add(0, AppConfig.ID_COLUMN_NAME); } @@ -376,7 +376,7 @@ public void openSuccessWriter(List headers) throws LoadException { getSuccessWriter().setColumnNames(headers); } catch (final DataAccessObjectInitializationException e) { throw new LoadException( - getMessage("errorOpeningSuccessFile", getConfig().getString(AppConfig.OUTPUT_SUCCESS)), e); + getMessage("errorOpeningSuccessFile", getConfig().getString(AppConfig.PROP_OUTPUT_SUCCESS)), e); } } diff --git a/src/main/java/com/salesforce/dataloader/action/AbstractExtractAction.java b/src/main/java/com/salesforce/dataloader/action/AbstractExtractAction.java index 12c25cdf..c1b5902f 100644 --- a/src/main/java/com/salesforce/dataloader/action/AbstractExtractAction.java +++ b/src/main/java/com/salesforce/dataloader/action/AbstractExtractAction.java @@ -61,15 +61,15 @@ protected boolean visit() throws OperationException, DataAccessObjectException, @Override protected boolean writeStatus() { - return getConfig().getBoolean(AppConfig.LIMIT_OUTPUT_TO_QUERY_FIELDS) && getConfig().getBoolean(AppConfig.ENABLE_EXTRACT_STATUS_OUTPUT); + return getConfig().getBoolean(AppConfig.PROP_LIMIT_OUTPUT_TO_QUERY_FIELDS) && getConfig().getBoolean(AppConfig.PROP_ENABLE_EXTRACT_STATUS_OUTPUT); } @Override protected void checkDao(DataAccessObject dao) throws DataAccessObjectInitializationException { if (!(dao instanceof DataWriter)) { - final String errMsg = getMessage("errorWrongDao", getConfig().getString(AppConfig.DAO_TYPE), + final String errMsg = getMessage("errorWrongDao", getConfig().getString(AppConfig.PROP_DAO_TYPE), DataAccessObjectFactory.CSV_WRITE_TYPE + " or " + DataAccessObjectFactory.DATABASE_WRITE_TYPE, - getConfig().getString(AppConfig.OPERATION)); + getConfig().getString(AppConfig.PROP_OPERATION)); getLogger().fatal(errMsg); throw new DataAccessObjectInitializationException(errMsg); } @@ -86,7 +86,7 @@ public IQueryVisitor getVisitor() { } private List getDaoColumnsFromMapper() { - ((SOQLMapper)getController().getMapper()).initSoqlMapping(getConfig().getString(AppConfig.EXTRACT_SOQL)); + ((SOQLMapper)getController().getMapper()).initSoqlMapping(getConfig().getString(AppConfig.PROP_EXTRACT_SOQL)); return ((SOQLMapper)getController().getMapper()).getDaoColumnsForSoql(); } @@ -137,13 +137,13 @@ protected List getStatusColumns() throws ExtractException { @Override protected void initOperation() throws DataAccessObjectInitializationException, OperationException { ((SOQLMapper)getController().getMapper()).clearMappings(); - if (getController().getAppConfig().getBoolean(AppConfig.LIMIT_OUTPUT_TO_QUERY_FIELDS)) { + if (getController().getAppConfig().getBoolean(AppConfig.PROP_LIMIT_OUTPUT_TO_QUERY_FIELDS)) { final List daoColumns = getDaoColumnsFromMapper(); getDao().setColumnNames(daoColumns); } else { // check for syntactical correctness and presence of nested soql. // nested soql is currently not supported. - ((SOQLMapper)getController().getMapper()).parseSoql(getConfig().getString(AppConfig.EXTRACT_SOQL)); + ((SOQLMapper)getController().getMapper()).parseSoql(getConfig().getString(AppConfig.PROP_EXTRACT_SOQL)); } } diff --git a/src/main/java/com/salesforce/dataloader/action/AbstractLoadAction.java b/src/main/java/com/salesforce/dataloader/action/AbstractLoadAction.java index bdb43c6b..b376d58d 100644 --- a/src/main/java/com/salesforce/dataloader/action/AbstractLoadAction.java +++ b/src/main/java/com/salesforce/dataloader/action/AbstractLoadAction.java @@ -68,9 +68,9 @@ protected AbstractLoadAction(Controller controller, ILoaderProgress monitor) @Override protected void checkDao(DataAccessObject dao) throws DataAccessObjectInitializationException { if (!(dao instanceof DataReader)) { - final String errMsg = getMessage("errorWrongDao", getConfig().getString(AppConfig.DAO_TYPE), + final String errMsg = getMessage("errorWrongDao", getConfig().getString(AppConfig.PROP_DAO_TYPE), DataAccessObjectFactory.CSV_READ_TYPE + " or " + DataAccessObjectFactory.DATABASE_READ_TYPE, - getConfig().getString(AppConfig.OPERATION)); + getConfig().getString(AppConfig.PROP_OPERATION)); getLogger().fatal(errMsg); throw new DataAccessObjectInitializationException(errMsg); } @@ -111,7 +111,7 @@ protected void initOperation() throws MappingInitializationException, DataAccess // ensure all field mappings are valid before data load ((LoadMapper)this.getController().getMapper()).verifyMappingsAreValid(); // start the Progress Monitor - getMonitor().beginTask(getMessage("loading", getConfig().getString(AppConfig.OPERATION)), getDao().getTotalRows()); + getMonitor().beginTask(getMessage("loading", getConfig().getString(AppConfig.PROP_OPERATION)), getDao().getTotalRows()); // set the starting row DAORowUtil.get().skipRowToStartOffset(getConfig(), getDao(), getMonitor(), !getConfig().isBulkAPIEnabled()); } diff --git a/src/main/java/com/salesforce/dataloader/action/DeleteAction.java b/src/main/java/com/salesforce/dataloader/action/DeleteAction.java index a1e9df5b..cd1c989e 100644 --- a/src/main/java/com/salesforce/dataloader/action/DeleteAction.java +++ b/src/main/java/com/salesforce/dataloader/action/DeleteAction.java @@ -47,7 +47,7 @@ public DeleteAction(Controller controller, ILoaderProgress monitor) throws DataA @Override protected DAOLoadVisitor createVisitor() { if (getController().getAppConfig().isRESTAPIEnabled() - && getController().getAppConfig().getBoolean(AppConfig.DELETE_WITH_EXTERNALID)) { + && getController().getAppConfig().getBoolean(AppConfig.PROP_DELETE_WITH_EXTERNALID)) { return new RESTDeleteVisitor(getController(), getMonitor(), getSuccessWriter(), getErrorWriter()); } else { return new PartnerDeleteVisitor(getController(), getMonitor(), getSuccessWriter(), getErrorWriter()); diff --git a/src/main/java/com/salesforce/dataloader/action/visitor/AbstractQueryVisitor.java b/src/main/java/com/salesforce/dataloader/action/visitor/AbstractQueryVisitor.java index 112e0d0e..3d614546 100644 --- a/src/main/java/com/salesforce/dataloader/action/visitor/AbstractQueryVisitor.java +++ b/src/main/java/com/salesforce/dataloader/action/visitor/AbstractQueryVisitor.java @@ -79,7 +79,7 @@ public AbstractQueryVisitor(AbstractExtractAction action, Controller controller, DataWriter successWriter, DataWriter errorWriter) { super(controller, monitor, successWriter, errorWriter); this.queryWriter = queryWriter; - this.soql = getConfig().getString(AppConfig.EXTRACT_SOQL); + this.soql = getConfig().getString(AppConfig.PROP_EXTRACT_SOQL); this.batchRows = new ArrayList(); this.batchIds = new ArrayList(); this.batchSize = getWriteBatchSize(); @@ -115,7 +115,7 @@ protected abstract void writeExtraction() throws AsyncApiException, ExtractExcep @Override protected boolean writeStatus() { - return getConfig().getBoolean(AppConfig.ENABLE_EXTRACT_STATUS_OUTPUT); + return getConfig().getBoolean(AppConfig.PROP_ENABLE_EXTRACT_STATUS_OUTPUT); } private String getSoql() { @@ -127,7 +127,7 @@ private DataWriter getQueryWriter() { } protected void addResultRow(Row row, String id) throws DataAccessObjectException { - if (controller.getAppConfig().getBoolean(AppConfig.INCLUDE_RICH_TEXT_FIELD_DATA_IN_QUERY_RESULTS)) { + if (controller.getAppConfig().getBoolean(AppConfig.PROP_INCLUDE_RICH_TEXT_FIELD_DATA_IN_QUERY_RESULTS)) { getRTFDataForRow(row); } this.batchRows.add(row); @@ -199,7 +199,7 @@ private String getBinaryContentForURL(String urlStr, String fieldName) { + "/services/data/v" + Controller.getAPIVersion() + "/sobjects/" - + controller.getAppConfig().getString(AppConfig.ENTITY) + + controller.getAppConfig().getString(AppConfig.PROP_ENTITY) + "/" + sobjectId + "/richTextImageFields/" @@ -231,7 +231,7 @@ private void writeBatch() throws DataAccessObjectException { writeSuccesses(); } else { writeErrors(Messages.getMessage(getClass(), "statusErrorNotWritten", - getConfig().getString(AppConfig.DAO_NAME))); + getConfig().getString(AppConfig.PROP_DAO_NAME))); } getProgressMonitor().worked(this.batchRows.size()); getProgressMonitor().setSubTask(getRateCalculator().calculateSubTask(getNumberOfRows(), getNumberErrors())); @@ -239,7 +239,7 @@ private void writeBatch() throws DataAccessObjectException { throw ex; } catch (final DataAccessObjectException ex) { writeErrors(Messages.getMessage(getClass(), "statusErrorNotWrittenException", - getConfig().getString(AppConfig.DAO_NAME), ex.getMessage())); + getConfig().getString(AppConfig.PROP_DAO_NAME), ex.getMessage())); } finally { this.batchRows.clear(); this.batchIds.clear(); @@ -263,7 +263,7 @@ private void writeErrors(String errorMessage) throws DataAccessObjectException { protected int getWriteBatchSize() { int daoBatchSize; try { - daoBatchSize = getConfig().getInt(AppConfig.DAO_WRITE_BATCH_SIZE); + daoBatchSize = getConfig().getInt(AppConfig.PROP_DAO_WRITE_BATCH_SIZE); if (daoBatchSize > AppConfig.MAX_DAO_WRITE_BATCH_SIZE) { daoBatchSize = AppConfig.MAX_DAO_WRITE_BATCH_SIZE; } diff --git a/src/main/java/com/salesforce/dataloader/action/visitor/DAOLoadVisitor.java b/src/main/java/com/salesforce/dataloader/action/visitor/DAOLoadVisitor.java index 32dcce2d..ed5aae30 100644 --- a/src/main/java/com/salesforce/dataloader/action/visitor/DAOLoadVisitor.java +++ b/src/main/java/com/salesforce/dataloader/action/visitor/DAOLoadVisitor.java @@ -108,7 +108,7 @@ protected DAOLoadVisitor(Controller controller, ILoaderProgress monitor, DataWri this.batchSize = getConfig().getImportBatchSize(); rowConversionFailureMap = new HashMap(); - String newRichTextRegex = getConfig().getString(AppConfig.RICH_TEXT_FIELD_REGEX); + String newRichTextRegex = getConfig().getString(AppConfig.PROP_RICH_TEXT_FIELD_REGEX); if (newRichTextRegex != null && !newRichTextRegex.isBlank()) { this.richTextRegex = newRichTextRegex; } @@ -127,7 +127,7 @@ public void setRowConversionStatus(int dataSourceRow, boolean conversionSuccess) protected boolean isRowConversionSuccessful() { if (!gotSkippedRowsCount) { try { - skippedRowsCount = controller.getAppConfig().getInt(AppConfig.LOAD_ROW_TO_START_AT); + skippedRowsCount = controller.getAppConfig().getInt(AppConfig.PROP_LOAD_ROW_TO_START_AT); gotSkippedRowsCount = true; } catch (ParameterLoadException e) { // @ignored @@ -153,13 +153,13 @@ public boolean visit(Row row) throws OperationException, DataAccessObjectExcepti // the result are sforce fields mapped to data Row sforceDataRow = getMapper().mapData(row); - if (this.getConfig().getBoolean(AppConfig.TRUNCATE_FIELDS) + if (this.getConfig().getBoolean(AppConfig.PROP_TRUNCATE_FIELDS) && this.getConfig().isRESTAPIEnabled() - && "update".equalsIgnoreCase(this.getConfig().getString(AppConfig.OPERATION))) { + && "update".equalsIgnoreCase(this.getConfig().getString(AppConfig.PROP_OPERATION))) { PartnerClient partnerClient = this.getController().getPartnerClient(); if (cachedFieldAttributesForOperation == null) { cachedFieldAttributesForOperation = partnerClient.getSObjectFieldAttributesForRow( - this.getConfig().getString(AppConfig.ENTITY), sforceDataRow); + this.getConfig().getString(AppConfig.PROP_ENTITY), sforceDataRow); } for (Map.Entry field : sforceDataRow.entrySet()) { for (Field fieldDescribe : cachedFieldAttributesForOperation) { @@ -270,7 +270,7 @@ public void flushRemaining() throws OperationException, DataAccessObjectExceptio public void clearArrays() { // clear the arrays - if (!controller.getAppConfig().getBoolean(AppConfig.BULK_API_ENABLED)) { + if (!controller.getAppConfig().getBoolean(AppConfig.PROP_BULK_API_ENABLED)) { daoRowList.clear(); } dynaArray.clear(); @@ -359,7 +359,7 @@ private Object getHtmlFormattedFieldValue(String fieldName, Object fieldValue) { getHtmlFormattedAndPhoneSforceFieldList(); if (htmlFormattedSforceFieldList == null || !htmlFormattedSforceFieldList.contains(fieldName) - || !getController().getAppConfig().getBoolean(AppConfig.LOAD_PRESERVE_WHITESPACE_IN_RICH_TEXT)) { + || !getController().getAppConfig().getBoolean(AppConfig.PROP_LOAD_PRESERVE_WHITESPACE_IN_RICH_TEXT)) { return fieldValue; } return convertToHTMLFormatting((String)fieldValue, this.richTextRegex); @@ -427,7 +427,7 @@ private Object getPhoneFieldValue(String fieldName, Object fieldValue) { getHtmlFormattedAndPhoneSforceFieldList(); if (this.phoneSforceFieldList == null || !this.phoneSforceFieldList.contains(fieldName) - || !this.getConfig().getBoolean(AppConfig.FORMAT_PHONE_FIELDS)) { + || !this.getConfig().getBoolean(AppConfig.PROP_FORMAT_PHONE_FIELDS)) { return fieldValue; } String localeStr = Locale.getDefault().toString(); diff --git a/src/main/java/com/salesforce/dataloader/action/visitor/bulk/AbstractBulkQueryVisitor.java b/src/main/java/com/salesforce/dataloader/action/visitor/bulk/AbstractBulkQueryVisitor.java index 964a4dc8..f6c6ccb1 100644 --- a/src/main/java/com/salesforce/dataloader/action/visitor/bulk/AbstractBulkQueryVisitor.java +++ b/src/main/java/com/salesforce/dataloader/action/visitor/bulk/AbstractBulkQueryVisitor.java @@ -62,7 +62,7 @@ public AbstractBulkQueryVisitor(AbstractExtractAction action, Controller control protected void writeExtractionForServerStream(InputStream serverResultStream) throws IOException, DataAccessObjectException { File bufferingFile = null; - final boolean bufferResults = getConfig().getBoolean(AppConfig.BUFFER_UNPROCESSED_BULK_QUERY_RESULTS); + final boolean bufferResults = getConfig().getBoolean(AppConfig.PROP_BUFFER_UNPROCESSED_BULK_QUERY_RESULTS); OutputStream bufferingFileWriter = null; InputStream resultStream = serverResultStream; //read directly from server by default @@ -113,11 +113,11 @@ protected void writeExtractionForServerStream(InputStream serverResultStream) th private Row getDaoRow(List queryResultHeaders, List csvRow, StringBuilder id, boolean isFirstRowInBatch) throws DataAccessObjectInitializationException { if (isFirstRowInBatch - && !getConfig().getBoolean(AppConfig.LIMIT_OUTPUT_TO_QUERY_FIELDS)) { + && !getConfig().getBoolean(AppConfig.PROP_LIMIT_OUTPUT_TO_QUERY_FIELDS)) { SOQLMapper mapper = (SOQLMapper)this.controller.getMapper(); mapper.initSoqlMappingFromResultFields(queryResultHeaders); final List daoColumns = mapper.getDaoColumnsForSoql(); - if (getConfig().getBoolean(AppConfig.ENABLE_EXTRACT_STATUS_OUTPUT)) { + if (getConfig().getBoolean(AppConfig.PROP_ENABLE_EXTRACT_STATUS_OUTPUT)) { try { if (this.getErrorWriter() == null) { this.setErrorWriter(this.action.createErrorWriter()); diff --git a/src/main/java/com/salesforce/dataloader/action/visitor/bulk/BulkApiVisitorUtil.java b/src/main/java/com/salesforce/dataloader/action/visitor/bulk/BulkApiVisitorUtil.java index 12aba4e7..ae3076dd 100644 --- a/src/main/java/com/salesforce/dataloader/action/visitor/bulk/BulkApiVisitorUtil.java +++ b/src/main/java/com/salesforce/dataloader/action/visitor/bulk/BulkApiVisitorUtil.java @@ -95,7 +95,7 @@ class BulkApiVisitorUtil { try { // getLong will return 0 if no value is provided - long checkStatusInt = ctl.getAppConfig().getLong(AppConfig.BULK_API_CHECK_STATUS_INTERVAL); + long checkStatusInt = ctl.getAppConfig().getLong(AppConfig.PROP_BULK_API_CHECK_STATUS_INTERVAL); this.checkStatusInterval = checkStatusInt > 0 ? checkStatusInt : AppConfig.DEFAULT_BULK_API_CHECK_STATUS_INTERVAL; } catch (ParameterLoadException e) { @@ -141,7 +141,7 @@ public String getStagingFileInOutputStatusDir(String prefix, String suffix) { Date currentTime = new Date(); SimpleDateFormat format = new SimpleDateFormat("MMddyyhhmmssSSS"); //$NON-NLS-1$ String timestamp = format.format(currentTime); - String statusOutputDir = appConfig.getString(AppConfig.OUTPUT_STATUS_DIR); + String statusOutputDir = appConfig.getString(AppConfig.PROP_OUTPUT_STATUS_DIR); File stagingFile = new File(statusOutputDir, prefix + timestamp + suffix); return stagingFile.getAbsolutePath(); //$NON-NLS-1$ //$NON-NLS-2$ @@ -161,11 +161,11 @@ void createJob() throws AsyncApiException { final OperationEnum op = this.appConfig.getOperationInfo().getBulkOperationEnum(); job.setOperation(op); if (op == OperationEnum.upsert) { - job.setExternalIdFieldName(this.appConfig.getString(AppConfig.IDLOOKUP_FIELD)); + job.setExternalIdFieldName(this.appConfig.getString(AppConfig.PROP_IDLOOKUP_FIELD)); } - job.setObject(this.appConfig.getString(AppConfig.ENTITY)); + job.setObject(this.appConfig.getString(AppConfig.PROP_ENTITY)); ContentType jobContentType = ContentType.CSV; - if (this.appConfig.getBoolean(AppConfig.BULK_API_ZIP_CONTENT) + if (this.appConfig.getBoolean(AppConfig.PROP_BULK_API_ZIP_CONTENT) && op != OperationEnum.query && !this.appConfig.isBulkV2APIEnabled()) { // ZIP CSV content is supported only for Bulk V1 @@ -174,7 +174,7 @@ void createJob() throws AsyncApiException { job.setContentType(jobContentType); ConcurrencyMode jobConcurrencyMode = ConcurrencyMode.Parallel; - if (this.appConfig.getBoolean(AppConfig.BULK_API_SERIAL_MODE) + if (this.appConfig.getBoolean(AppConfig.PROP_BULK_API_SERIAL_MODE) && !this.appConfig.isBulkV2APIEnabled()) { // Serial mode is supported only for Bulk V1 jobConcurrencyMode = ConcurrencyMode.Serial; @@ -182,7 +182,7 @@ void createJob() throws AsyncApiException { job.setConcurrencyMode(jobConcurrencyMode); if (op == OperationEnum.update || op == OperationEnum.upsert || op == OperationEnum.insert) { - final String assRule = this.appConfig.getString(AppConfig.ASSIGNMENT_RULE); + final String assRule = this.appConfig.getString(AppConfig.PROP_ASSIGNMENT_RULE); if (assRule != null && (assRule.length() == 15 || assRule.length() == 18)) { job.setAssignmentRuleId(assRule); } @@ -200,7 +200,7 @@ void createJob() throws AsyncApiException { } } if (isBulkV2QueryJob()) { - job.setObject(this.appConfig.getString(AppConfig.EXTRACT_SOQL)); + job.setObject(this.appConfig.getString(AppConfig.PROP_EXTRACT_SOQL)); logger.info("going to create BulkV2 query job"); } job = this.connection.createJob(job); @@ -263,7 +263,7 @@ long periodicCheckStatus() throws AsyncApiException { try { // limit the number of max retries in case limit is exceeded - maxAttemptsCount = 1 + Math.min(AppConfig.MAX_RETRIES_LIMIT, this.appConfig.getInt(AppConfig.MAX_RETRIES)); + maxAttemptsCount = 1 + Math.min(AppConfig.MAX_RETRIES_LIMIT, this.appConfig.getInt(AppConfig.PROP_MAX_RETRIES)); } catch (ParameterLoadException e) { maxAttemptsCount = 1 + AppConfig.DEFAULT_MAX_RETRIES; } @@ -358,9 +358,9 @@ private int getNumRecordsProcessedInJob() { } int numRecordsPerBatch = 0; try { - numRecordsPerBatch = this.appConfig.getInt(AppConfig.IMPORT_BATCH_SIZE); + numRecordsPerBatch = this.appConfig.getInt(AppConfig.PROP_IMPORT_BATCH_SIZE); } catch (ParameterLoadException e) { - logger.warn("Incorrectly configured " + AppConfig.IMPORT_BATCH_SIZE); + logger.warn("Incorrectly configured " + AppConfig.PROP_IMPORT_BATCH_SIZE); } if (numRecordsProcessedInJob == 0 && this.jobInfo.getNumberBatchesCompleted() > 0) { numRecordsProcessedInJob = numRecordsPerBatch @@ -374,9 +374,9 @@ private int getNumRecordsFailedInJob() { int numRecordsFailedInJob = this.jobInfo.getNumberRecordsFailed(); int numRecordsPerBatch = 0; try { - numRecordsPerBatch = this.appConfig.getInt(AppConfig.IMPORT_BATCH_SIZE); + numRecordsPerBatch = this.appConfig.getInt(AppConfig.PROP_IMPORT_BATCH_SIZE); } catch (ParameterLoadException e) { - logger.warn("Incorrectly configured " + AppConfig.IMPORT_BATCH_SIZE); + logger.warn("Incorrectly configured " + AppConfig.PROP_IMPORT_BATCH_SIZE); } if (numRecordsFailedInJob == 0 && this.jobInfo.getNumberBatchesFailed() > 0) { numRecordsFailedInJob = numRecordsPerBatch * jobInfo.getNumberBatchesFailed(); diff --git a/src/main/java/com/salesforce/dataloader/action/visitor/bulk/BulkLoadVisitor.java b/src/main/java/com/salesforce/dataloader/action/visitor/bulk/BulkLoadVisitor.java index b1ef780e..1de2b958 100644 --- a/src/main/java/com/salesforce/dataloader/action/visitor/bulk/BulkLoadVisitor.java +++ b/src/main/java/com/salesforce/dataloader/action/visitor/bulk/BulkLoadVisitor.java @@ -380,7 +380,7 @@ private void writeRawResultsToCSV(CSVReader serverResultsReader, int batchNum) { } private String generateBatchCSVFilename(String prefix, int batchNum) { - String successResultsFilename = controller.getAppConfig().getString(AppConfig.OUTPUT_SUCCESS); + String successResultsFilename = controller.getAppConfig().getString(AppConfig.PROP_OUTPUT_SUCCESS); int parentDirLocation = successResultsFilename.lastIndexOf(System.getProperty("file.separator")); String resultsDir = successResultsFilename.substring(0, parentDirLocation); return resultsDir @@ -425,8 +425,8 @@ private void getBulkV2LoadJobResults() throws AsyncApiException, OperationExcept this.getErrorWriter().close(); AppConfig appConfig = this.getConfig(); - String successWriterFile = appConfig.getString(AppConfig.OUTPUT_SUCCESS); - String errorWriterFile = appConfig.getString(AppConfig.OUTPUT_ERROR); + String successWriterFile = appConfig.getString(AppConfig.PROP_OUTPUT_SUCCESS); + String errorWriterFile = appConfig.getString(AppConfig.PROP_OUTPUT_ERROR); // TODO for unprocessed records. Also uncomment in Controller.java to set the right value // for Config.OUTPUT_UNPROCESSED_RECORDS // String unprocessedRecordsWriterFile = config.getString(Config.OUTPUT_UNPROCESSED_RECORDS); diff --git a/src/main/java/com/salesforce/dataloader/action/visitor/bulk/BulkV1Connection.java b/src/main/java/com/salesforce/dataloader/action/visitor/bulk/BulkV1Connection.java index c3cac936..faa863d8 100644 --- a/src/main/java/com/salesforce/dataloader/action/visitor/bulk/BulkV1Connection.java +++ b/src/main/java/com/salesforce/dataloader/action/visitor/bulk/BulkV1Connection.java @@ -74,7 +74,7 @@ public JobInfo getJobStatus(String jobId) throws AsyncApiException { } public JobInfo getJobStatus(String jobId, ContentType contentType) throws AsyncApiException { - if (AppConfig.getCurrentConfig().getBoolean(AppConfig.USE_LEGACY_HTTP_GET)) { + if (AppConfig.getCurrentConfig().getBoolean(AppConfig.PROP_USE_LEGACY_HTTP_GET)) { return super.getJobStatus(jobId, contentType); } else { String[] urlParts = {"job", jobId}; @@ -88,7 +88,7 @@ public BatchInfoList getBatchInfoList(String jobId) throws AsyncApiException { } public BatchInfoList getBatchInfoList(String jobId, ContentType contentType) throws AsyncApiException { - if (AppConfig.getCurrentConfig().getBoolean(AppConfig.USE_LEGACY_HTTP_GET)) { + if (AppConfig.getCurrentConfig().getBoolean(AppConfig.PROP_USE_LEGACY_HTTP_GET)) { return super.getBatchInfoList(jobId, contentType); } else { String[] urlParts = {"job", jobId, "batch"}; @@ -98,7 +98,7 @@ public BatchInfoList getBatchInfoList(String jobId, ContentType contentType) thr } public InputStream getBatchResultStream(String jobId, String batchId) throws AsyncApiException { - if (AppConfig.getCurrentConfig().getBoolean(AppConfig.USE_LEGACY_HTTP_GET)) { + if (AppConfig.getCurrentConfig().getBoolean(AppConfig.PROP_USE_LEGACY_HTTP_GET)) { return super.getBatchResultStream(jobId, batchId); } else { String[] urlParts = {"job", jobId, "batch", batchId, "result"}; @@ -111,7 +111,7 @@ public QueryResultList getQueryResultList(String jobId, String batchId) throws A } public QueryResultList getQueryResultList(String jobId, String batchId, ContentType contentType) throws AsyncApiException { - if (AppConfig.getCurrentConfig().getBoolean(AppConfig.USE_LEGACY_HTTP_GET)) { + if (AppConfig.getCurrentConfig().getBoolean(AppConfig.PROP_USE_LEGACY_HTTP_GET)) { return super.getQueryResultList(jobId, batchId, contentType); } else { InputStream in = getBatchResultStream(jobId, batchId); @@ -120,7 +120,7 @@ public QueryResultList getQueryResultList(String jobId, String batchId, ContentT } public InputStream getQueryResultStream(String jobId, String batchId, String resultId) throws AsyncApiException { - if (AppConfig.getCurrentConfig().getBoolean(AppConfig.USE_LEGACY_HTTP_GET)) { + if (AppConfig.getCurrentConfig().getBoolean(AppConfig.PROP_USE_LEGACY_HTTP_GET)) { return super.getQueryResultStream(jobId, batchId, resultId); } else { String[] urlParts = {"job", jobId, "batch", batchId, "result", resultId}; diff --git a/src/main/java/com/salesforce/dataloader/action/visitor/partner/PartnerLoadVisitor.java b/src/main/java/com/salesforce/dataloader/action/visitor/partner/PartnerLoadVisitor.java index 637d810d..77c26742 100644 --- a/src/main/java/com/salesforce/dataloader/action/visitor/partner/PartnerLoadVisitor.java +++ b/src/main/java/com/salesforce/dataloader/action/visitor/partner/PartnerLoadVisitor.java @@ -94,8 +94,8 @@ private void setKeepAccountTeamHeader() { AppConfig appConfig = this.controller.getAppConfig(); OwnerChangeOption keepAccountTeamOption = new OwnerChangeOption(); OwnerChangeOption[] ownerChangeOptionArray; - if (appConfig.getBoolean(AppConfig.PROCESS_KEEP_ACCOUNT_TEAM) - && "Account".equalsIgnoreCase(appConfig.getString(AppConfig.ENTITY))) { + if (appConfig.getBoolean(AppConfig.PROP_PROCESS_KEEP_ACCOUNT_TEAM) + && "Account".equalsIgnoreCase(appConfig.getString(AppConfig.PROP_ENTITY))) { // Support for Keeping Account keepAccountTeam during Account ownership change // More details at https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_header_ownerchangeoptions.htm keepAccountTeamOption.setExecute(true); diff --git a/src/main/java/com/salesforce/dataloader/action/visitor/partner/PartnerQueryVisitor.java b/src/main/java/com/salesforce/dataloader/action/visitor/partner/PartnerQueryVisitor.java index 15cf4ac4..96c23037 100644 --- a/src/main/java/com/salesforce/dataloader/action/visitor/partner/PartnerQueryVisitor.java +++ b/src/main/java/com/salesforce/dataloader/action/visitor/partner/PartnerQueryVisitor.java @@ -100,7 +100,7 @@ protected void writeExtraction() throws DataAccessObjectException, ConnectionExc private Row getDaoRow(SObject sob, boolean firstRowInBatch) { if (firstRowInBatch - && !this.controller.getAppConfig().getBoolean(AppConfig.LIMIT_OUTPUT_TO_QUERY_FIELDS)) { + && !this.controller.getAppConfig().getBoolean(AppConfig.PROP_LIMIT_OUTPUT_TO_QUERY_FIELDS)) { // header field is not set in the mapper Row row = getMapper().mapPartnerSObjectSfdcToLocal(sob); try { @@ -111,7 +111,7 @@ private Row getDaoRow(SObject sob, boolean firstRowInBatch) { final List daoColumns = mapper.getDaoColumnsForSoql(); // setting DAO's column names forces output to be restricted to the provided field names ((DataWriter)controller.getDao()).setColumnNames(daoColumns); - if (getConfig().getBoolean(AppConfig.ENABLE_EXTRACT_STATUS_OUTPUT)) { + if (getConfig().getBoolean(AppConfig.PROP_ENABLE_EXTRACT_STATUS_OUTPUT)) { try { if (this.getErrorWriter() == null) { this.setErrorWriter(this.action.createErrorWriter()); diff --git a/src/main/java/com/salesforce/dataloader/action/visitor/rest/RESTConnection.java b/src/main/java/com/salesforce/dataloader/action/visitor/rest/RESTConnection.java index a75ea7d8..896e1ac1 100644 --- a/src/main/java/com/salesforce/dataloader/action/visitor/rest/RESTConnection.java +++ b/src/main/java/com/salesforce/dataloader/action/visitor/rest/RESTConnection.java @@ -98,7 +98,7 @@ public SaveResult[] loadAction(SessionInfo session, ACTION_ENUM action, List getSobjectMapForCompositeREST(List dynaBeans, String opName) { try { - List> sobjectList = SforceDynaBean.getRESTSObjectArray(controller, dynaBeans, controller.getAppConfig().getString(AppConfig.ENTITY), - controller.getAppConfig().getBoolean(AppConfig.INSERT_NULLS)); + List> sobjectList = SforceDynaBean.getRESTSObjectArray(controller, dynaBeans, controller.getAppConfig().getString(AppConfig.PROP_ENTITY), + controller.getAppConfig().getBoolean(AppConfig.PROP_INSERT_NULLS)); HashMap recordsMap = new HashMap(); recordsMap.put("records", sobjectList); recordsMap.put("allOrNone", false); diff --git a/src/main/java/com/salesforce/dataloader/client/ClientBase.java b/src/main/java/com/salesforce/dataloader/client/ClientBase.java index 4a2431c2..ee2c6427 100644 --- a/src/main/java/com/salesforce/dataloader/client/ClientBase.java +++ b/src/main/java/com/salesforce/dataloader/client/ClientBase.java @@ -70,7 +70,7 @@ protected ClientBase(Controller controller, Logger logger) { this.controller = controller; this.appConfig = controller.getAppConfig(); this.logger = logger; - String apiVersionStr = appConfig.getString(AppConfig.API_VERSION_PROP); + String apiVersionStr = appConfig.getString(AppConfig.PROP_API_VERSION); if (apiVersionStr != null && !apiVersionStr.isEmpty()) { apiVersionForTheSession = apiVersionStr; } @@ -119,23 +119,23 @@ public ConnectorConfig getConnectorConfig() { "client=" + ClientBase.getClientName(this.appConfig)); // set authentication credentials // blank username is not acceptible - String username = appConfig.getString(AppConfig.USERNAME); - boolean isManualSession = appConfig.getBoolean(AppConfig.SFDC_INTERNAL) && appConfig.getBoolean(AppConfig.SFDC_INTERNAL_IS_SESSION_ID_LOGIN); - boolean isOAuthSession = appConfig.getString(AppConfig.OAUTH_ACCESSTOKEN) != null && appConfig.getString(AppConfig.OAUTH_ACCESSTOKEN).trim().length() > 0; + String username = appConfig.getString(AppConfig.PROP_USERNAME); + boolean isManualSession = appConfig.getBoolean(AppConfig.PROP_SFDC_INTERNAL) && appConfig.getBoolean(AppConfig.PROP_SFDC_INTERNAL_IS_SESSION_ID_LOGIN); + boolean isOAuthSession = appConfig.getString(AppConfig.PROP_OAUTH_ACCESSTOKEN) != null && appConfig.getString(AppConfig.PROP_OAUTH_ACCESSTOKEN).trim().length() > 0; if (!isManualSession && !isOAuthSession && (username == null || username.length() == 0)) { - String errMsg = Messages.getMessage(getClass(), "emptyUsername", AppConfig.USERNAME); + String errMsg = Messages.getMessage(getClass(), "emptyUsername", AppConfig.PROP_USERNAME); logger.error(errMsg); throw new IllegalStateException(errMsg); } cc.setUsername(username); - cc.setPassword(appConfig.getString(AppConfig.PASSWORD)); + cc.setPassword(appConfig.getString(AppConfig.PROP_PASSWORD)); AppUtil.setConnectorConfigProxySettings(appConfig, cc); // Time out after 5 seconds for connection int connTimeoutSecs; try { - connTimeoutSecs = appConfig.getInt(AppConfig.CONNECTION_TIMEOUT_SECS); + connTimeoutSecs = appConfig.getInt(AppConfig.PROP_CONNECTION_TIMEOUT_SECS); } catch (ParameterLoadException e1) { connTimeoutSecs = AppConfig.DEFAULT_CONNECTION_TIMEOUT_SECS; } @@ -145,21 +145,21 @@ public ConnectorConfig getConnectorConfig() { // set timeout for operations based on config int timeoutSecs; try { - timeoutSecs = appConfig.getInt(AppConfig.TIMEOUT_SECS); + timeoutSecs = appConfig.getInt(AppConfig.PROP_TIMEOUT_SECS); } catch (ParameterLoadException e) { timeoutSecs = AppConfig.DEFAULT_TIMEOUT_SECS; } cc.setReadTimeout((timeoutSecs * 1000)); // use compression or turn it off - if (appConfig.contains(AppConfig.NO_COMPRESSION)) { - cc.setCompression(!appConfig.getBoolean(AppConfig.NO_COMPRESSION)); + if (appConfig.contains(AppConfig.PROP_NO_COMPRESSION)) { + cc.setCompression(!appConfig.getBoolean(AppConfig.PROP_NO_COMPRESSION)); } - if (appConfig.getBoolean(AppConfig.DEBUG_MESSAGES)) { + if (appConfig.getBoolean(AppConfig.PROP_DEBUG_MESSAGES)) { cc.setTraceMessage(true); cc.setPrettyPrintXml(true); - String filename = appConfig.getString(AppConfig.DEBUG_MESSAGES_FILE); + String filename = appConfig.getString(AppConfig.PROP_DEBUG_MESSAGES_FILE); if (filename.length() > 0) { try { cc.setTraceFile(filename); @@ -174,7 +174,7 @@ public ConnectorConfig getConnectorConfig() { cc.setServiceEndpoint(server + PartnerClient.getServicePath()); // Partner SOAP service cc.setRestEndpoint(server + BulkV1Client.getServicePath()); // REST service: Bulk v1 } - cc.setTraceMessage(appConfig.getBoolean(AppConfig.WIRE_OUTPUT)); + cc.setTraceMessage(appConfig.getBoolean(AppConfig.PROP_WIRE_OUTPUT)); return cc; } diff --git a/src/main/java/com/salesforce/dataloader/client/HttpClientTransport.java b/src/main/java/com/salesforce/dataloader/client/HttpClientTransport.java index 08e4b669..7683e83f 100644 --- a/src/main/java/com/salesforce/dataloader/client/HttpClientTransport.java +++ b/src/main/java/com/salesforce/dataloader/client/HttpClientTransport.java @@ -171,7 +171,7 @@ private synchronized void initializeHttpClient() throws UnknownHostException { closeHttpClient(); httpMethod = null; HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); - if (AppConfig.getCurrentConfig().getBoolean(AppConfig.USE_SYSTEM_PROPS_FOR_HTTP_CLIENT)) { + if (AppConfig.getCurrentConfig().getBoolean(AppConfig.PROP_USE_SYSTEM_PROPS_FOR_HTTP_CLIENT)) { httpClientBuilder = httpClientBuilder.useSystemProperties(); } @@ -442,7 +442,7 @@ private void setAuthAndClientHeadersForHttpMethod() { Header clientIdHeaderVal = this.httpMethod.getFirstHeader(AppConfig.CLIENT_ID_HEADER_NAME); if (clientIdHeaderVal == null) { AppConfig appConfig = AppConfig.getCurrentConfig(); - this.httpMethod.addHeader(AppConfig.CLIENT_ID_HEADER_NAME, appConfig.getString(AppConfig.OAUTH_CLIENTID)); + this.httpMethod.addHeader(AppConfig.CLIENT_ID_HEADER_NAME, appConfig.getString(AppConfig.PROP_OAUTH_CLIENTID)); } Header clientNameHeaderVal = this.httpMethod.getFirstHeader(ClientBase.SFORCE_CALL_OPTIONS_HEADER); if (clientNameHeaderVal == null) { @@ -465,7 +465,7 @@ public static void closeHttpClient() { public static boolean isReuseHttpClient() { AppConfig appConfig = AppConfig.getCurrentConfig(); - return appConfig.getBoolean(AppConfig.REUSE_CLIENT_CONNECTION); + return appConfig.getBoolean(AppConfig.PROP_REUSE_CLIENT_CONNECTION); } public InputStream httpGet(String urlStr) throws IOException, AsyncApiException, HttpClientTransportException { diff --git a/src/main/java/com/salesforce/dataloader/client/PartnerClient.java b/src/main/java/com/salesforce/dataloader/client/PartnerClient.java index 87f11fb6..471fa695 100644 --- a/src/main/java/com/salesforce/dataloader/client/PartnerClient.java +++ b/src/main/java/com/salesforce/dataloader/client/PartnerClient.java @@ -129,7 +129,7 @@ public String getName() { @Override public UpsertResult[] run(SObject[] sObjects) throws ConnectionException { - return getConnection().upsert(appConfig.getString(AppConfig.IDLOOKUP_FIELD), sObjects); + return getConnection().upsert(appConfig.getString(AppConfig.PROP_IDLOOKUP_FIELD), sObjects); } }; @@ -250,7 +250,7 @@ private void setExportBatchSize() { // query header int querySize = AppConfig.DEFAULT_EXPORT_BATCH_SIZE; try { - querySize = appConfig.getInt(AppConfig.EXPORT_BATCH_SIZE); + querySize = appConfig.getInt(AppConfig.PROP_EXPORT_BATCH_SIZE); } catch (ParameterLoadException e) { querySize = AppConfig.DEFAULT_EXPORT_BATCH_SIZE; } @@ -271,8 +271,8 @@ protected boolean connectPostLogin(ConnectorConfig cc) { setExportBatchSize(); // assignment rule for update - if (appConfig.getString(AppConfig.ASSIGNMENT_RULE).length() > 14) { - String rule = appConfig.getString(AppConfig.ASSIGNMENT_RULE); + if (appConfig.getString(AppConfig.PROP_ASSIGNMENT_RULE).length() > 14) { + String rule = appConfig.getString(AppConfig.PROP_ASSIGNMENT_RULE); if (rule.length() > 15) { rule = rule.substring(0, 15); } @@ -280,15 +280,15 @@ protected boolean connectPostLogin(ConnectorConfig cc) { } // field truncation - getConnection().setAllowFieldTruncationHeader(appConfig.getBoolean(AppConfig.TRUNCATE_FIELDS)); + getConnection().setAllowFieldTruncationHeader(appConfig.getBoolean(AppConfig.PROP_TRUNCATE_FIELDS)); // TODO: make this configurable getConnection().setDisableFeedTrackingHeader(true); getConnection().setDuplicateRuleHeader( - appConfig.getBoolean(AppConfig.DUPLICATE_RULE_ALLOW_SAVE), - appConfig.getBoolean(AppConfig.DUPLICATE_RULE_INCLUDE_RECORD_DETAILS), - appConfig.getBoolean(AppConfig.DUPLICATE_RULE_RUN_AS_CURRENT_USER) + appConfig.getBoolean(AppConfig.PROP_DUPLICATE_RULE_ALLOW_SAVE), + appConfig.getBoolean(AppConfig.PROP_DUPLICATE_RULE_INCLUDE_RECORD_DETAILS), + appConfig.getBoolean(AppConfig.PROP_DUPLICATE_RULE_RUN_AS_CURRENT_USER) ); return true; @@ -341,8 +341,8 @@ private SaveResult[] runSaveOperation(List dynaBeans, ClientOperation< private SObject[] getSobjects(List dynaBeans, String opName) { try { - SObject[] sobjects = SforceDynaBean.getSObjectArray(controller, dynaBeans, appConfig.getString(AppConfig.ENTITY), - appConfig.getBoolean(AppConfig.INSERT_NULLS)); + SObject[] sobjects = SforceDynaBean.getSObjectArray(controller, dynaBeans, appConfig.getString(AppConfig.PROP_ENTITY), + appConfig.getBoolean(AppConfig.PROP_INSERT_NULLS)); logger.debug(Messages.getString("Client.arraySize") + sobjects.length); //$NON-NLS-1$ return sobjects; } catch (IllegalAccessException ex) { @@ -513,7 +513,7 @@ private void processResult(boolean success, String successMsgKey, String id, Err for (Error err : errors) { int startRow; try { - startRow = appConfig.getInt(AppConfig.LOAD_ROW_TO_START_AT); + startRow = appConfig.getInt(AppConfig.PROP_LOAD_ROW_TO_START_AT); } catch (ParameterLoadException e) { startRow = 0; } @@ -526,7 +526,7 @@ private void processResult(boolean success, String successMsgKey, String id, Err } public Map getDescribeGlobalResults() { - if (this.describeGlobalResults == null || !appConfig.getBoolean(AppConfig.CACHE_DESCRIBE_GLOBAL_RESULTS)) { + if (this.describeGlobalResults == null || !appConfig.getBoolean(AppConfig.PROP_CACHE_DESCRIBE_GLOBAL_RESULTS)) { this.describeGlobalResultsMap.clear(); try { this.describeGlobalResults = runOperation(DESCRIBE_GLOBAL_OPERATION, null); @@ -554,7 +554,7 @@ private Map getCachedEntityDescribeMap() { } public DescribeSObjectResult getFieldTypes() { - String entity = this.appConfig.getString(AppConfig.ENTITY); + String entity = this.appConfig.getString(AppConfig.PROP_ENTITY); try { return describeSObject(entity); } catch (ConnectionException e) { @@ -577,10 +577,10 @@ public LimitInfo getAPILimitInfo() { } boolean isSessionValid() { - if (appConfig.getBoolean(AppConfig.SFDC_INTERNAL) && appConfig.getBoolean(AppConfig.SFDC_INTERNAL_IS_SESSION_ID_LOGIN)) { + if (appConfig.getBoolean(AppConfig.PROP_SFDC_INTERNAL) && appConfig.getBoolean(AppConfig.PROP_SFDC_INTERNAL_IS_SESSION_ID_LOGIN)) { return true; } - if (appConfig.getString(AppConfig.OAUTH_ACCESSTOKEN) != null && appConfig.getString(AppConfig.OAUTH_ACCESSTOKEN).trim().length() > 0) { + if (appConfig.getString(AppConfig.PROP_OAUTH_ACCESSTOKEN) != null && appConfig.getString(AppConfig.PROP_OAUTH_ACCESSTOKEN).trim().length() > 0) { return true; } return isLoggedIn(); @@ -608,11 +608,11 @@ private boolean login() throws ConnectionException, ApiFault { exceptionMessage = lf.getExceptionMessage(); } logger.warn(Messages.getMessage(this.getClass(), "failedUsernamePasswordAuth", - origEndpoint, appConfig.getString(AppConfig.SELECTED_AUTH_ENVIRONMENT), exceptionMessage)); + origEndpoint, appConfig.getString(AppConfig.PROP_SELECTED_AUTH_ENVIRONMENT), exceptionMessage)); if (!appConfig.isDefaultAuthEndpoint(origEndpoint)) { // retry with default endpoint URL only if user is attempting production login appConfig.setAuthEndpoint(appConfig.getDefaultAuthEndpoint()); - logger.info(Messages.getMessage(this.getClass(), "retryUsernamePasswordAuth", appConfig.getDefaultAuthEndpoint(), appConfig.getString(AppConfig.SELECTED_AUTH_ENVIRONMENT))); + logger.info(Messages.getMessage(this.getClass(), "retryUsernamePasswordAuth", appConfig.getDefaultAuthEndpoint(), appConfig.getString(AppConfig.PROP_SELECTED_AUTH_ENVIRONMENT))); login(); } else { logger.error("Failed to get user info using manually configured session id", e); @@ -635,16 +635,16 @@ private boolean dologin() throws ConnectionException, ApiFault { // identify the client as dataloader conn.setCallOptions(ClientBase.getClientName(this.appConfig), null); - String oauthAccessToken = appConfig.getString(AppConfig.OAUTH_ACCESSTOKEN); + String oauthAccessToken = appConfig.getString(AppConfig.PROP_OAUTH_ACCESSTOKEN); try { if (oauthAccessToken != null && oauthAccessToken.trim().length() > 0) { - cc = getLoginConnectorConfig(appConfig.getString(AppConfig.OAUTH_INSTANCE_URL)); + cc = getLoginConnectorConfig(appConfig.getString(AppConfig.PROP_OAUTH_INSTANCE_URL)); savedIsTraceMessage = cc.isTraceMessage(); cc.setTraceMessage(false); conn = Connector.newConnection(cc); conn = setConfiguredSessionId(conn, oauthAccessToken, null); - } else if (appConfig.getBoolean(AppConfig.SFDC_INTERNAL) && appConfig.getBoolean(AppConfig.SFDC_INTERNAL_IS_SESSION_ID_LOGIN)) { - conn = setConfiguredSessionId(conn, appConfig.getString(AppConfig.SFDC_INTERNAL_SESSION_ID), null); + } else if (appConfig.getBoolean(AppConfig.PROP_SFDC_INTERNAL) && appConfig.getBoolean(AppConfig.PROP_SFDC_INTERNAL_IS_SESSION_ID_LOGIN)) { + conn = setConfiguredSessionId(conn, appConfig.getString(AppConfig.PROP_SFDC_INTERNAL_SESSION_ID), null); } else { setSessionRenewer(conn); loginInternal(conn); @@ -680,7 +680,7 @@ private PartnerConnection setConfiguredSessionId(PartnerConnection conn, String private void loginInternal(final PartnerConnection conn) throws ConnectionException, PasswordExpiredException { final ConnectorConfig cc = conn.getConfig(); - cc.setRequestHeader(AppConfig.CLIENT_ID_HEADER_NAME, appConfig.getString(AppConfig.OAUTH_CLIENTID)); + cc.setRequestHeader(AppConfig.CLIENT_ID_HEADER_NAME, appConfig.getString(AppConfig.PROP_OAUTH_CLIENTID)); try { logger.info(Messages.getMessage(getClass(), "sforceLoginDetail", cc.getAuthEndpoint(), cc.getUsername())); LoginResult loginResult = runOperation(LOGIN_OPERATION, conn); @@ -693,7 +693,7 @@ private void loginInternal(final PartnerConnection conn) throws ConnectionExcept conn.setSessionHeader(loginResult.getSessionId()); String serverUrl = loginResult.getServerUrl(); String server = getAuthenticationHostDomainUrl(serverUrl); - if (appConfig.getBoolean(AppConfig.RESET_URL_ON_LOGIN)) { + if (appConfig.getBoolean(AppConfig.PROP_RESET_URL_ON_LOGIN)) { cc.setServiceEndpoint(serverUrl); } loginSuccess(conn, server, loginResult.getUserInfo()); @@ -718,7 +718,7 @@ private String getServerStringFromUrl(URL url) { } private String getAuthenticationHostDomainUrl(String serverUrl) { - if (appConfig.getBoolean(AppConfig.RESET_URL_ON_LOGIN)) { + if (appConfig.getBoolean(AppConfig.PROP_RESET_URL_ON_LOGIN)) { try { return getServerStringFromUrl(new URL(serverUrl)); } catch (MalformedURLException e) { @@ -760,7 +760,7 @@ public void setFieldReferenceDescribes() throws ConnectionException { } Collection mappedSFFields = null; if (getDescribeGlobalResults() != null) { - String operation = appConfig.getString(AppConfig.OPERATION); + String operation = appConfig.getString(AppConfig.PROP_OPERATION); if (AppUtil.getAppRunMode() == AppUtil.APP_RUN_MODE.BATCH && operation != null && !operation.isBlank() @@ -776,8 +776,8 @@ public void setFieldReferenceDescribes() throws ConnectionException { } public void setFieldReferenceDescribes(Collection sfFields) throws ConnectionException { - if (appConfig.getBoolean(AppConfig.CACHE_DESCRIBE_GLOBAL_RESULTS)) { - referenceEntitiesDescribesMap = parentDescribeCache.get(appConfig.getString(AppConfig.ENTITY)); + if (appConfig.getBoolean(AppConfig.PROP_CACHE_DESCRIBE_GLOBAL_RESULTS)) { + referenceEntitiesDescribesMap = parentDescribeCache.get(appConfig.getString(AppConfig.PROP_ENTITY)); } else { referenceEntitiesDescribesMap.clear(); } @@ -837,10 +837,10 @@ public void setFieldReferenceDescribes(Collection sfFields) throws Conne processParentObjectArrayForLookupReferences(parentObjectNames, childObjectField); } } - if (appConfig.getBoolean(AppConfig.CACHE_DESCRIBE_GLOBAL_RESULTS) + if (appConfig.getBoolean(AppConfig.PROP_CACHE_DESCRIBE_GLOBAL_RESULTS) && sfFields == null) { // got the full list of parents' describes for an sobject - parentDescribeCache.put(appConfig.getString(AppConfig.ENTITY), referenceEntitiesDescribesMap); + parentDescribeCache.put(appConfig.getString(AppConfig.PROP_ENTITY), referenceEntitiesDescribesMap); } } @@ -877,7 +877,7 @@ private void processParentFieldForLookupReference(Field parentField, Field child * @throws ConnectionException */ public void setFieldTypes() throws ConnectionException { - describeSObject(appConfig.getString(AppConfig.ENTITY)); + describeSObject(appConfig.getString(AppConfig.PROP_ENTITY)); } /** @@ -922,7 +922,7 @@ private synchronized ConnectorConfig getLoginConnectorConfig(String serverURL) { public DescribeSObjectResult describeSObject(String entity) throws ConnectionException { DescribeSObjectResult result = null; - if (appConfig.getBoolean(AppConfig.CACHE_DESCRIBE_GLOBAL_RESULTS)) { + if (appConfig.getBoolean(AppConfig.PROP_CACHE_DESCRIBE_GLOBAL_RESULTS)) { result = getCachedEntityDescribeMap().get(entity); } if (result == null) { diff --git a/src/main/java/com/salesforce/dataloader/config/AppConfig.java b/src/main/java/com/salesforce/dataloader/config/AppConfig.java index c8d4c72e..f4ca4206 100644 --- a/src/main/java/com/salesforce/dataloader/config/AppConfig.java +++ b/src/main/java/com/salesforce/dataloader/config/AppConfig.java @@ -186,6 +186,7 @@ public class AppConfig { private Properties readOnlyPropertiesFromPropertiesFile = new LinkedProperties(); private final Properties defaultProperties; private final boolean saveAllProps; + private Map configPropsMap = ConfigProperty.getPropertiesMap(); private Map parameterOverridesMap; @@ -210,56 +211,56 @@ public class AppConfig { // Property name constants (Settings specified in config.properties file or as command line options) // ======================= // Loader Preferences - public static final String HIDE_WELCOME_SCREEN = "loader.hideWelcome"; - public static final String SHOW_LOADER_UPGRADE_SCREEN = "loader.ui.showUpgrade"; + public static final String PROP_HIDE_WELCOME_SCREEN = "loader.hideWelcome"; + public static final String PROP_SHOW_LOADER_UPGRADE_SCREEN = "loader.ui.showUpgrade"; // Delimiter settings - public static final String CSV_DELIMITER_COMMA = "loader.csvComma"; - public static final String CSV_DELIMITER_TAB = "loader.csvTab"; - public static final String CSV_DELIMITER_OTHER = "loader.csvOther"; - public static final String CSV_DELIMITER_OTHER_VALUE = "loader.csvOtherValue"; - public static final String CSV_DELIMITER_FOR_QUERY_RESULTS = "loader.query.delimiter"; - public static final String BUFFER_UNPROCESSED_BULK_QUERY_RESULTS = "loader.bufferUnprocessedBulkQueryResults"; - public static final String INCLUDE_RICH_TEXT_FIELD_DATA_IN_QUERY_RESULTS = "loader.query.includeBinaryData"; - public static final String CACHE_DESCRIBE_GLOBAL_RESULTS = "loader.cacheSObjectNamesAndFields"; + public static final String PROP_CSV_DELIMITER_COMMA = "loader.csvComma"; + public static final String PROP_CSV_DELIMITER_TAB = "loader.csvTab"; + public static final String PROP_CSV_DELIMITER_OTHER = "loader.csvOther"; + public static final String PROP_CSV_DELIMITER_OTHER_VALUE = "loader.csvOtherValue"; + public static final String PROP_CSV_DELIMITER_FOR_QUERY_RESULTS = "loader.query.delimiter"; + public static final String PROP_BUFFER_UNPROCESSED_BULK_QUERY_RESULTS = "loader.bufferUnprocessedBulkQueryResults"; + public static final String PROP_INCLUDE_RICH_TEXT_FIELD_DATA_IN_QUERY_RESULTS = "loader.query.includeBinaryData"; + public static final String PROP_CACHE_DESCRIBE_GLOBAL_RESULTS = "loader.cacheSObjectNamesAndFields"; //Special Internal Configs - public static final String SFDC_INTERNAL = "sfdcInternal"; //$NON-NLS-1$ - public static final String SFDC_INTERNAL_IS_SESSION_ID_LOGIN = "sfdcInternal.isSessionIdLogin"; //$NON-NLS-1$ - public static final String SFDC_INTERNAL_SESSION_ID = "sfdcInternal.sessionId"; //$NON-NLS-1$ + public static final String PROP_SFDC_INTERNAL = "sfdcInternal"; //$NON-NLS-1$ + public static final String PROP_SFDC_INTERNAL_IS_SESSION_ID_LOGIN = "sfdcInternal.isSessionIdLogin"; //$NON-NLS-1$ + public static final String PROP_SFDC_INTERNAL_SESSION_ID = "sfdcInternal.sessionId"; //$NON-NLS-1$ // salesforce client connectivity - public static final String USERNAME = "sfdc.username"; //$NON-NLS-1$ - public static final String PASSWORD = "sfdc.password"; //$NON-NLS-1$ - public static final String AUTH_ENDPOINT_PROD = "sfdc.endpoint.production"; //$NON-NLS-1$ - public static final String AUTH_ENDPOINT_SANDBOX = "sfdc.endpoint.sandbox"; //$NON-NLS-1$ - public static final String PROXY_HOST = "sfdc.proxyHost"; //$NON-NLS-1$ - public static final String PROXY_PORT = "sfdc.proxyPort"; //$NON-NLS-1$ - public static final String PROXY_USERNAME = "sfdc.proxyUsername"; //$NON-NLS-1$ - public static final String PROXY_PASSWORD = "sfdc.proxyPassword"; //$NON-NLS-1$ - public static final String PROXY_NTLM_DOMAIN = "sfdc.proxyNtlmDomain"; //$NON-NLS-1$ - public static final String TIMEOUT_SECS = "sfdc.timeoutSecs"; //$NON-NLS-1$ - public static final String CONNECTION_TIMEOUT_SECS = "sfdc.connectionTimeoutSecs"; //$NON-NLS-1$ - public static final String NO_COMPRESSION = "sfdc.noCompression"; //$NON-NLS-1$ - public static final String ENABLE_RETRIES = "sfdc.enableRetries"; //$NON-NLS-1$ - public static final String MAX_RETRIES = "sfdc.maxRetries"; //$NON-NLS-1$ - public static final String MIN_RETRY_SLEEP_SECS = "sfdc.minRetrySleepSecs"; //$NON-NLS-1$ - public static final String DEBUG_MESSAGES = "sfdc.debugMessages"; //$NON-NLS-1$ - public static final String DEBUG_MESSAGES_FILE = "sfdc.debugMessagesFile"; //$NON-NLS-1$ - public static final String RESET_URL_ON_LOGIN = "sfdc.resetUrlOnLogin"; //$NON-NLS-1$ - public static final String TRUNCATE_FIELDS = "sfdc.truncateFields";//$NON-NLS-1$ - public static final String FORMAT_PHONE_FIELDS = "sfdc.formatPhoneFields";//$NON-NLS-1$ - - public static final String BULK_API_ENABLED = "sfdc.useBulkApi"; - public static final String BULK_API_SERIAL_MODE = "sfdc.bulkApiSerialMode"; - public static final String BULK_API_CHECK_STATUS_INTERVAL = "sfdc.bulkApiCheckStatusInterval"; - public static final String BULK_API_ZIP_CONTENT = "sfdc.bulkApiZipContent"; - public static final String BULKV2_API_ENABLED = "sfdc.useBulkV2Api"; - public static final String UPDATE_WITH_EXTERNALID = "sfdc.updateWithExternalId"; - public static final String DELETE_WITH_EXTERNALID = "sfdc.deleteWithExternalId"; - - public static final String WIRE_OUTPUT = "sfdc.wireOutput"; - public static final String TIMEZONE = "sfdc.timezone"; + public static final String PROP_USERNAME = "sfdc.username"; //$NON-NLS-1$ + public static final String PROP_PASSWORD = "sfdc.password"; //$NON-NLS-1$ + public static final String PROP_AUTH_ENDPOINT_PROD = "sfdc.endpoint.production"; //$NON-NLS-1$ + public static final String PROP_AUTH_ENDPOINT_SANDBOX = "sfdc.endpoint.sandbox"; //$NON-NLS-1$ + public static final String PROP_PROXY_HOST = "sfdc.proxyHost"; //$NON-NLS-1$ + public static final String PROP_PROXY_PORT = "sfdc.proxyPort"; //$NON-NLS-1$ + public static final String PROP_PROXY_USERNAME = "sfdc.proxyUsername"; //$NON-NLS-1$ + public static final String PROP_PROXY_PASSWORD = "sfdc.proxyPassword"; //$NON-NLS-1$ + public static final String PROP_PROXY_NTLM_DOMAIN = "sfdc.proxyNtlmDomain"; //$NON-NLS-1$ + public static final String PROP_TIMEOUT_SECS = "sfdc.timeoutSecs"; //$NON-NLS-1$ + public static final String PROP_CONNECTION_TIMEOUT_SECS = "sfdc.connectionTimeoutSecs"; //$NON-NLS-1$ + public static final String PROP_NO_COMPRESSION = "sfdc.noCompression"; //$NON-NLS-1$ + public static final String PROP_ENABLE_RETRIES = "sfdc.enableRetries"; //$NON-NLS-1$ + public static final String PROP_MAX_RETRIES = "sfdc.maxRetries"; //$NON-NLS-1$ + public static final String PROP_MIN_RETRY_SLEEP_SECS = "sfdc.minRetrySleepSecs"; //$NON-NLS-1$ + public static final String PROP_DEBUG_MESSAGES = "sfdc.debugMessages"; //$NON-NLS-1$ + public static final String PROP_DEBUG_MESSAGES_FILE = "sfdc.debugMessagesFile"; //$NON-NLS-1$ + public static final String PROP_RESET_URL_ON_LOGIN = "sfdc.resetUrlOnLogin"; //$NON-NLS-1$ + public static final String PROP_TRUNCATE_FIELDS = "sfdc.truncateFields";//$NON-NLS-1$ + public static final String PROP_FORMAT_PHONE_FIELDS = "sfdc.formatPhoneFields";//$NON-NLS-1$ + + public static final String PROP_BULK_API_ENABLED = "sfdc.useBulkApi"; + public static final String PROP_BULK_API_SERIAL_MODE = "sfdc.bulkApiSerialMode"; + public static final String PROP_BULK_API_CHECK_STATUS_INTERVAL = "sfdc.bulkApiCheckStatusInterval"; + public static final String PROP_BULK_API_ZIP_CONTENT = "sfdc.bulkApiZipContent"; + public static final String PROP_BULKV2_API_ENABLED = "sfdc.useBulkV2Api"; + public static final String PROP_UPDATE_WITH_EXTERNALID = "sfdc.updateWithExternalId"; + public static final String PROP_DELETE_WITH_EXTERNALID = "sfdc.deleteWithExternalId"; + + public static final String PROP_WIRE_OUTPUT = "sfdc.wireOutput"; + public static final String PROP_TIMEZONE = "sfdc.timezone"; public static final String OAUTH_PREFIX = "sfdc.oauth."; public static final String OAUTH_PARTIAL_BULK = "bulk"; @@ -271,77 +272,77 @@ public class AppConfig { public static final String OAUTH_PARTIAL_BULK_CLIENTID = OAUTH_PARTIAL_BULK + "." + OAUTH_PARTIAL_CLIENTID; public static final String OAUTH_PARTIAL_PARTNER_CLIENTID = OAUTH_PARTIAL_PARTNER + "." + OAUTH_PARTIAL_CLIENTID; - public static final String AUTH_ENVIRONMENTS = OAUTH_PREFIX + "environments"; - public static final String SELECTED_AUTH_ENVIRONMENT = OAUTH_PREFIX + "environment"; - public static final String OAUTH_ACCESSTOKEN = OAUTH_PREFIX + "accesstoken"; - public static final String OAUTH_REFRESHTOKEN = OAUTH_PREFIX + "refreshtoken"; - public static final String OAUTH_SERVER = OAUTH_PREFIX + OAUTH_PARTIAL_SERVER; - public static final String OAUTH_CLIENTSECRET = OAUTH_PREFIX + OAUTH_PARTIAL_CLIENTSECRET; - public static final String OAUTH_CLIENTID = OAUTH_PREFIX + OAUTH_PARTIAL_CLIENTID; - public static final String OAUTH_REDIRECTURI = OAUTH_PREFIX + OAUTH_PARTIAL_REDIRECTURI; - public static final String OAUTH_LOGIN_FROM_BROWSER = OAUTH_PREFIX + "loginfrombrowser"; + public static final String PROP_AUTH_ENVIRONMENTS = OAUTH_PREFIX + "environments"; + public static final String PROP_SELECTED_AUTH_ENVIRONMENT = OAUTH_PREFIX + "environment"; + public static final String PROP_OAUTH_ACCESSTOKEN = OAUTH_PREFIX + "accesstoken"; + public static final String PROP_OAUTH_REFRESHTOKEN = OAUTH_PREFIX + "refreshtoken"; + public static final String PROP_OAUTH_SERVER = OAUTH_PREFIX + OAUTH_PARTIAL_SERVER; + public static final String PROP_OAUTH_CLIENTSECRET = OAUTH_PREFIX + OAUTH_PARTIAL_CLIENTSECRET; + public static final String PROP_OAUTH_CLIENTID = OAUTH_PREFIX + OAUTH_PARTIAL_CLIENTID; + public static final String PROP_OAUTH_REDIRECTURI = OAUTH_PREFIX + OAUTH_PARTIAL_REDIRECTURI; + public static final String PROP_OAUTH_LOGIN_FROM_BROWSER = OAUTH_PREFIX + "loginfrombrowser"; public static final String OAUTH_REDIRECT_URI_SUFFIX = "services/oauth2/success"; - public static final String REUSE_CLIENT_CONNECTION = "sfdc.reuseClientConnection"; - public static final String RICH_TEXT_FIELD_REGEX = "sfdx.richtext.regex"; + public static final String PROP_REUSE_CLIENT_CONNECTION = "sfdc.reuseClientConnection"; + public static final String PROP_RICH_TEXT_FIELD_REGEX = "sfdx.richtext.regex"; // salesforce operation parameters - public static final String INSERT_NULLS = "sfdc.insertNulls"; //$NON-NLS-1$ - public static final String ENTITY = "sfdc.entity"; //$NON-NLS-1$ - public static final String IMPORT_BATCH_SIZE = "sfdc.loadBatchSize"; //$NON-NLS-1$ - public static final String ASSIGNMENT_RULE = "sfdc.assignmentRule"; //$NON-NLS-1$ - public static final String IDLOOKUP_FIELD = "sfdc.externalIdField"; //$NON-NLS-1$ - public static final String EXPORT_BATCH_SIZE = "sfdc.extractionRequestSize"; //$NON-NLS-1$ - public static final String EXTRACT_SOQL = "sfdc.extractionSOQL"; //$NON-NLS-1$ - public static final String SORT_EXTRACT_FIELDS = "sfdc.sortExtractionFields"; //$NON-NLS-1$ - public static final String LOAD_PRESERVE_WHITESPACE_IN_RICH_TEXT = "sfdc.load.preserveWhitespaceInRichText"; + public static final String PROP_INSERT_NULLS = "sfdc.insertNulls"; //$NON-NLS-1$ + public static final String PROP_ENTITY = "sfdc.entity"; //$NON-NLS-1$ + public static final String PROP_IMPORT_BATCH_SIZE = "sfdc.loadBatchSize"; //$NON-NLS-1$ + public static final String PROP_ASSIGNMENT_RULE = "sfdc.assignmentRule"; //$NON-NLS-1$ + public static final String PROP_IDLOOKUP_FIELD = "sfdc.externalIdField"; //$NON-NLS-1$ + public static final String PROP_EXPORT_BATCH_SIZE = "sfdc.extractionRequestSize"; //$NON-NLS-1$ + public static final String PROP_EXTRACT_SOQL = "sfdc.extractionSOQL"; //$NON-NLS-1$ + public static final String PROP_SORT_EXTRACT_FIELDS = "sfdc.sortExtractionFields"; //$NON-NLS-1$ + public static final String PROP_LOAD_PRESERVE_WHITESPACE_IN_RICH_TEXT = "sfdc.load.preserveWhitespaceInRichText"; // // process configuration (action parameters) // // process.name is used to load the DynaBean from process-conf.xml file // with the same id as the value of process.name property. - public static final String PROCESS_NAME = "process.name"; - public static final String OPERATION = "process.operation"; //$NON-NLS-1$ - public static final String MAPPING_FILE = "process.mappingFile"; //$NON-NLS-1$ - public static final String EURO_DATES = "process.useEuropeanDates"; //$NON-NLS-1$ + public static final String PROP_PROCESS_NAME = "process.name"; + public static final String PROP_OPERATION = "process.operation"; //$NON-NLS-1$ + public static final String PROP_MAPPING_FILE = "process.mappingFile"; //$NON-NLS-1$ + public static final String PROP_EURO_DATES = "process.useEuropeanDates"; //$NON-NLS-1$ // process configuration - public static final String OUTPUT_STATUS_DIR = "process.statusOutputDirectory"; //$NON-NLS-1$ - public static final String OUTPUT_SUCCESS = "process.outputSuccess"; //$NON-NLS-1$ - public static final String ENABLE_EXTRACT_STATUS_OUTPUT = "process.enableExtractStatusOutput"; //$NON-NLS-1$ - public static final String ENABLE_LAST_RUN_OUTPUT = "process.enableLastRunOutput"; //$NON-NLS-1$ - public static final String LAST_RUN_OUTPUT_DIR = "process.lastRunOutputDirectory"; //$NON-NLS-1$ - public static final String OUTPUT_ERROR = "process.outputError"; //$NON-NLS-1$ - public static final String OUTPUT_UNPROCESSED_RECORDS = "process.unprocessedRecords"; //$NON-NLS-1$ - public static final String LOAD_ROW_TO_START_AT = "process.loadRowToStartAt"; //$NON-NLS-1$ - public static final String INITIAL_LAST_RUN_DATE = "process.initialLastRunDate"; - public static final String ENCRYPTION_KEY_FILE = "process.encryptionKeyFile"; //$NON-NLS-1$ - public static final String PROCESS_THREAD_NAME = "process.thread.name"; - public static final String PROCESS_KEEP_ACCOUNT_TEAM = "process.keepAccountTeam"; - public static final String PROCESS_EXIT_WITH_ERROR_ON_FAILED_ROWS_BATCH_MODE = "process.batchMode.exitWithErrorOnFailedRows"; + public static final String PROP_OUTPUT_STATUS_DIR = "process.statusOutputDirectory"; //$NON-NLS-1$ + public static final String PROP_OUTPUT_SUCCESS = "process.outputSuccess"; //$NON-NLS-1$ + public static final String PROP_ENABLE_EXTRACT_STATUS_OUTPUT = "process.enableExtractStatusOutput"; //$NON-NLS-1$ + public static final String PROP_ENABLE_LAST_RUN_OUTPUT = "process.enableLastRunOutput"; //$NON-NLS-1$ + public static final String PROP_LAST_RUN_OUTPUT_DIR = "process.lastRunOutputDirectory"; //$NON-NLS-1$ + public static final String PROP_OUTPUT_ERROR = "process.outputError"; //$NON-NLS-1$ + public static final String PROP_OUTPUT_UNPROCESSED_RECORDS = "process.unprocessedRecords"; //$NON-NLS-1$ + public static final String PROP_LOAD_ROW_TO_START_AT = "process.loadRowToStartAt"; //$NON-NLS-1$ + public static final String PROP_INITIAL_LAST_RUN_DATE = "process.initialLastRunDate"; + public static final String PROP_ENCRYPTION_KEY_FILE = "process.encryptionKeyFile"; //$NON-NLS-1$ + public static final String PROP_PROCESS_THREAD_NAME = "process.thread.name"; + public static final String PROP_PROCESS_KEEP_ACCOUNT_TEAM = "process.keepAccountTeam"; + public static final String PROP_PROCESS_EXIT_WITH_ERROR_ON_FAILED_ROWS_BATCH_MODE = "process.batchMode.exitWithErrorOnFailedRows"; // data access configuration (e.g., for CSV file, database, etc). - public static final String DAO_TYPE = "dataAccess.type"; //$NON-NLS-1$ - public static final String DAO_NAME = "dataAccess.name"; //$NON-NLS-1$ - public static final String DAO_READ_BATCH_SIZE = "dataAccess.readBatchSize"; - public static final String DAO_WRITE_BATCH_SIZE = "dataAccess.writeBatchSize"; - public static final String DAO_SKIP_TOTAL_COUNT = "dataAccess.skipTotalCount"; - public static final String DAO_READ_PREPROCESSOR_SCRIPT = "dataAccess.read.preProcessorScript"; - public static final String DAO_WRITE_POSTPROCESSOR_SCRIPT = "dataAccess.write.postProcessorScript"; + public static final String PROP_DAO_TYPE = "dataAccess.type"; //$NON-NLS-1$ + public static final String PROP_DAO_NAME = "dataAccess.name"; //$NON-NLS-1$ + public static final String PROP_DAO_READ_BATCH_SIZE = "dataAccess.readBatchSize"; + public static final String PROP_DAO_WRITE_BATCH_SIZE = "dataAccess.writeBatchSize"; + public static final String PROP_DAO_SKIP_TOTAL_COUNT = "dataAccess.skipTotalCount"; /* * TODO: when batching is introduced to the DataAccess, these parameters will become useful * public static final String DAO_REQUEST_SIZE = "dataAccess.extractionRequestSize"; * public static final String DAO_BATCH_SIZE = "dataAccess.batchSize"; */ - public static final String READ_UTF8 = "dataAccess.readUTF8"; //$NON-NLS-1$ - public static final String WRITE_UTF8 = "dataAccess.writeUTF8"; //$NON-NLS-1$ - public static final String READ_CHARSET = "dataAccess.readCharset"; + public static final String PROP_READ_UTF8 = "dataAccess.readUTF8"; //$NON-NLS-1$ + public static final String PROP_WRITE_UTF8 = "dataAccess.writeUTF8"; //$NON-NLS-1$ + public static final String PROP_READ_CHARSET = "dataAccess.readCharset"; - public static final String API_VERSION_PROP="salesforce.api.version"; - public static final String OAUTH_INSTANCE_URL="salesforce.oauth.instanceURL"; - public static final String USE_LEGACY_HTTP_GET="sfdc.useLegacyHttpGet"; - public static final String USE_SYSTEM_PROPS_FOR_HTTP_CLIENT="sfdc.useSysPropsForHttpClient"; + public static final String PROP_API_VERSION="salesforce.api.version"; + public static final String PROP_OAUTH_INSTANCE_URL="salesforce.oauth.instanceURL"; + public static final String PROP_USE_LEGACY_HTTP_GET="sfdc.useLegacyHttpGet"; + public static final String PROP_USE_SYSTEM_PROPS_FOR_HTTP_CLIENT="sfdc.useSysPropsForHttpClient"; + public static final String PROP_LIMIT_OUTPUT_TO_QUERY_FIELDS = "loader.query.limitOutputToQueryFields"; + /** * =============== PILOT config properties ======== * - These properties are used for the features in pilot phase. These features are @@ -360,10 +361,12 @@ public class AppConfig { public static final String BULK_QUERY_PK_CHUNK_SIZE = PILOT_PROPERTY_PREFIX + "sfdc.bulkQueryPKChunkSize"; public static final String BULK_QUERY_PK_CHUNK_START_ROW = PILOT_PROPERTY_PREFIX + "sfdc.bulkQueryChunkStartRow"; */ - public static final String DUPLICATE_RULE_ALLOW_SAVE = PILOT_PROPERTY_PREFIX + "sfdc.duplicateRule.allowSave"; //$NON-NLS-1$ - public static final String DUPLICATE_RULE_INCLUDE_RECORD_DETAILS = PILOT_PROPERTY_PREFIX + "sfdc.duplicateRule.includeRecordDetails"; //$NON-NLS-1$ - public static final String DUPLICATE_RULE_RUN_AS_CURRENT_USER = PILOT_PROPERTY_PREFIX + "sfdc.duplicateRule.runAsCurrentUser"; //$NON-NLS-1$ - public static final String LIMIT_OUTPUT_TO_QUERY_FIELDS = "loader.query.limitOutputToQueryFields"; + public static final String PROP_DUPLICATE_RULE_ALLOW_SAVE = PILOT_PROPERTY_PREFIX + "sfdc.duplicateRule.allowSave"; //$NON-NLS-1$ + public static final String PROP_DUPLICATE_RULE_INCLUDE_RECORD_DETAILS = PILOT_PROPERTY_PREFIX + "sfdc.duplicateRule.includeRecordDetails"; //$NON-NLS-1$ + public static final String PROP_DUPLICATE_RULE_RUN_AS_CURRENT_USER = PILOT_PROPERTY_PREFIX + "sfdc.duplicateRule.runAsCurrentUser"; //$NON-NLS-1$ + public static final String PROP_DAO_READ_PREPROCESSOR_SCRIPT = PILOT_PROPERTY_PREFIX + "dataAccess.read.preProcessorScript"; + public static final String PROP_DAO_WRITE_POSTPROCESSOR_SCRIPT = PILOT_PROPERTY_PREFIX + "dataAccess.write.postProcessorScript"; + /* * =============================== * End of config properties @@ -451,54 +454,54 @@ public class AppConfig { // - These properties are not set in Advanced Settings dialog. // - Make sure to list all sensitive properties such as password because these properties are not saved. private static final String[] READ_ONLY_PROPERTY_NAMES = { - PASSWORD, - IDLOOKUP_FIELD, - MAPPING_FILE, - EXTRACT_SOQL, - OUTPUT_SUCCESS, - OUTPUT_ERROR, - DAO_NAME, - DAO_TYPE, - ENTITY, - OPERATION, - DEBUG_MESSAGES, - DEBUG_MESSAGES_FILE, - WIRE_OUTPUT, - PROCESS_THREAD_NAME, + PROP_PASSWORD, + PROP_IDLOOKUP_FIELD, + PROP_MAPPING_FILE, + PROP_EXTRACT_SOQL, + PROP_OUTPUT_SUCCESS, + PROP_OUTPUT_ERROR, + PROP_DAO_NAME, + PROP_DAO_TYPE, + PROP_ENTITY, + PROP_OPERATION, + PROP_DEBUG_MESSAGES, + PROP_DEBUG_MESSAGES_FILE, + PROP_WIRE_OUTPUT, + PROP_PROCESS_THREAD_NAME, PROCESS_BULK_CACHE_DATA_FROM_DAO, - PROCESS_EXIT_WITH_ERROR_ON_FAILED_ROWS_BATCH_MODE, + PROP_PROCESS_EXIT_WITH_ERROR_ON_FAILED_ROWS_BATCH_MODE, SAVE_BULK_SERVER_LOAD_AND_RAW_RESULTS_IN_CSV, - API_VERSION_PROP, - READ_CHARSET, + PROP_API_VERSION, + PROP_READ_CHARSET, READ_ONLY_CONFIG_PROPERTIES, - RICH_TEXT_FIELD_REGEX, - DAO_READ_PREPROCESSOR_SCRIPT, - DAO_WRITE_POSTPROCESSOR_SCRIPT, + PROP_RICH_TEXT_FIELD_REGEX, + PROP_DAO_READ_PREPROCESSOR_SCRIPT, + PROP_DAO_WRITE_POSTPROCESSOR_SCRIPT, ENFORCE_WIZARD_WIDTH_HEIGHT_CONFIG, - DELETE_WITH_EXTERNALID, - OAUTH_ACCESSTOKEN, - OAUTH_REFRESHTOKEN, - OAUTH_INSTANCE_URL, - OAUTH_SERVER, - OAUTH_REDIRECTURI, + PROP_DELETE_WITH_EXTERNALID, + PROP_OAUTH_ACCESSTOKEN, + PROP_OAUTH_REFRESHTOKEN, + PROP_OAUTH_INSTANCE_URL, + PROP_OAUTH_SERVER, + PROP_OAUTH_REDIRECTURI, OAUTH_PREFIX + PROD_ENVIRONMENT_VAL + "." + OAUTH_PARTIAL_SERVER, OAUTH_PREFIX + SB_ENVIRONMENT_VAL + "." + OAUTH_PARTIAL_SERVER, OAUTH_PREFIX + PROD_ENVIRONMENT_VAL + "." + OAUTH_PARTIAL_REDIRECTURI, OAUTH_PREFIX + SB_ENVIRONMENT_VAL + "." + OAUTH_PARTIAL_REDIRECTURI, - OAUTH_CLIENTID, - OAUTH_CLIENTSECRET, + PROP_OAUTH_CLIENTID, + PROP_OAUTH_CLIENTSECRET, OAUTH_PREFIX + PROD_ENVIRONMENT_VAL + "." + OAUTH_PARTIAL_CLIENTSECRET, OAUTH_PREFIX + SB_ENVIRONMENT_VAL + "." + OAUTH_PARTIAL_CLIENTSECRET, - RESET_URL_ON_LOGIN, - USE_LEGACY_HTTP_GET, - USE_SYSTEM_PROPS_FOR_HTTP_CLIENT, + PROP_RESET_URL_ON_LOGIN, + PROP_USE_LEGACY_HTTP_GET, + PROP_USE_SYSTEM_PROPS_FOR_HTTP_CLIENT, }; private static final String[] ENCRYPTED_PROPERTY_NAMES = { - PASSWORD, - PROXY_PASSWORD, - OAUTH_ACCESSTOKEN, - OAUTH_REFRESHTOKEN + PROP_PASSWORD, + PROP_PROXY_PASSWORD, + PROP_OAUTH_ACCESSTOKEN, + PROP_OAUTH_REFRESHTOKEN }; /** @@ -537,13 +540,13 @@ private AppConfig(String filename, Map cliOptionsMap) throws Con initializeLastRun(getLastRunPrefix()); // Properties initialization completed. Configure OAuth environment next - setOAuthEnvironment(getString(SELECTED_AUTH_ENVIRONMENT)); + setOAuthEnvironment(getString(PROP_SELECTED_AUTH_ENVIRONMENT)); } private String getLastRunPrefix() { - String lastRunFilePrefix = getString(AppConfig.PROCESS_NAME); + String lastRunFilePrefix = getString(AppConfig.PROP_PROCESS_NAME); if (lastRunFilePrefix == null || lastRunFilePrefix.isBlank()) { - lastRunFilePrefix = getString(AppConfig.ENTITY) + getString(AppConfig.OPERATION); + lastRunFilePrefix = getString(AppConfig.PROP_ENTITY) + getString(AppConfig.PROP_OPERATION); } if (lastRunFilePrefix == null || lastRunFilePrefix.isBlank()) { lastRunFilePrefix = RUN_MODE_UI_VAL; @@ -556,14 +559,14 @@ private void initializeLastRun(String lastRunFileNamePrefix) { lastRunFileNamePrefix = getString(AppConfig.CLI_OPTION_RUN_MODE); } String lastRunFileName = lastRunFileNamePrefix + LAST_RUN_FILE_SUFFIX; - String lastRunDir = getString(AppConfig.LAST_RUN_OUTPUT_DIR); + String lastRunDir = getString(AppConfig.PROP_LAST_RUN_OUTPUT_DIR); if (lastRunDir == null || lastRunDir.length() == 0) { lastRunDir = this.configDir; } - this.lastRunProperties = new LastRunProperties(lastRunFileName, lastRunDir, getBoolean(AppConfig.ENABLE_LAST_RUN_OUTPUT)); + this.lastRunProperties = new LastRunProperties(lastRunFileName, lastRunDir, getBoolean(AppConfig.PROP_ENABLE_LAST_RUN_OUTPUT)); // Need to initialize last run date if it's present neither in config or override - lastRunProperties.setDefault(LastRunProperties.LAST_RUN_DATE, getString(INITIAL_LAST_RUN_DATE)); + lastRunProperties.setDefault(LastRunProperties.LAST_RUN_DATE, getString(PROP_INITIAL_LAST_RUN_DATE)); try { this.lastRunProperties.load(); @@ -581,54 +584,54 @@ private boolean useBulkApiByDefault() { * This sets the current defaults. */ private void setDefaults(Map cliOptionsMap) { - setDefaultValue(HIDE_WELCOME_SCREEN, true); - setDefaultValue(SHOW_LOADER_UPGRADE_SCREEN, true); - - setDefaultValue(CSV_DELIMITER_COMMA, true); - setDefaultValue(CSV_DELIMITER_TAB, true); - setDefaultValue(CSV_DELIMITER_OTHER, false); - setDefaultValue(CSV_DELIMITER_OTHER_VALUE, ""); - setDefaultValue(CSV_DELIMITER_FOR_QUERY_RESULTS, AppUtil.COMMA); - - setDefaultValue(AUTH_ENDPOINT_PROD, DEFAULT_ENDPOINT_URL_PROD); - setDefaultValue(AUTH_ENDPOINT_SANDBOX, DEFAULT_ENDPOINT_URL_SANDBOX); - - setDefaultValue(IMPORT_BATCH_SIZE, useBulkApiByDefault() ? DEFAULT_BULK_API_IMPORT_BATCH_SIZE : DEFAULT_LOAD_BATCH_SIZE); - setDefaultValue(LOAD_ROW_TO_START_AT, 0); - setDefaultValue(TIMEOUT_SECS, DEFAULT_TIMEOUT_SECS); - setDefaultValue(CONNECTION_TIMEOUT_SECS, DEFAULT_CONNECTION_TIMEOUT_SECS); - setDefaultValue(ENABLE_RETRIES, true); - setDefaultValue(MAX_RETRIES, DEFAULT_MAX_RETRIES); - setDefaultValue(MIN_RETRY_SLEEP_SECS, DEFAULT_MIN_RETRY_SECS); - setDefaultValue(ASSIGNMENT_RULE, ""); //$NON-NLS-1$ - setDefaultValue(INSERT_NULLS, false); - setDefaultValue(ENABLE_EXTRACT_STATUS_OUTPUT, false); - setDefaultValue(ENABLE_LAST_RUN_OUTPUT, true); - setDefaultValue(RESET_URL_ON_LOGIN, true); - setDefaultValue(EXPORT_BATCH_SIZE, DEFAULT_EXPORT_BATCH_SIZE); - setDefaultValue(SORT_EXTRACT_FIELDS, true); - setDefaultValue(DAO_WRITE_BATCH_SIZE, DEFAULT_DAO_WRITE_BATCH_SIZE); - setDefaultValue(DAO_READ_BATCH_SIZE, DEFAULT_DAO_READ_BATCH_SIZE); - setDefaultValue(TRUNCATE_FIELDS, true); - setDefaultValue(FORMAT_PHONE_FIELDS, false); + setDefaultValue(PROP_HIDE_WELCOME_SCREEN, true); + setDefaultValue(PROP_SHOW_LOADER_UPGRADE_SCREEN, true); + + setDefaultValue(PROP_CSV_DELIMITER_COMMA, true); + setDefaultValue(PROP_CSV_DELIMITER_TAB, true); + setDefaultValue(PROP_CSV_DELIMITER_OTHER, false); + setDefaultValue(PROP_CSV_DELIMITER_OTHER_VALUE, ""); + setDefaultValue(PROP_CSV_DELIMITER_FOR_QUERY_RESULTS, AppUtil.COMMA); + + setDefaultValue(PROP_AUTH_ENDPOINT_PROD, DEFAULT_ENDPOINT_URL_PROD); + setDefaultValue(PROP_AUTH_ENDPOINT_SANDBOX, DEFAULT_ENDPOINT_URL_SANDBOX); + + setDefaultValue(PROP_IMPORT_BATCH_SIZE, useBulkApiByDefault() ? DEFAULT_BULK_API_IMPORT_BATCH_SIZE : DEFAULT_LOAD_BATCH_SIZE); + setDefaultValue(PROP_LOAD_ROW_TO_START_AT, 0); + setDefaultValue(PROP_TIMEOUT_SECS, DEFAULT_TIMEOUT_SECS); + setDefaultValue(PROP_CONNECTION_TIMEOUT_SECS, DEFAULT_CONNECTION_TIMEOUT_SECS); + setDefaultValue(PROP_ENABLE_RETRIES, true); + setDefaultValue(PROP_MAX_RETRIES, DEFAULT_MAX_RETRIES); + setDefaultValue(PROP_MIN_RETRY_SLEEP_SECS, DEFAULT_MIN_RETRY_SECS); + setDefaultValue(PROP_ASSIGNMENT_RULE, ""); //$NON-NLS-1$ + setDefaultValue(PROP_INSERT_NULLS, false); + setDefaultValue(PROP_ENABLE_EXTRACT_STATUS_OUTPUT, false); + setDefaultValue(PROP_ENABLE_LAST_RUN_OUTPUT, true); + setDefaultValue(PROP_RESET_URL_ON_LOGIN, true); + setDefaultValue(PROP_EXPORT_BATCH_SIZE, DEFAULT_EXPORT_BATCH_SIZE); + setDefaultValue(PROP_SORT_EXTRACT_FIELDS, true); + setDefaultValue(PROP_DAO_WRITE_BATCH_SIZE, DEFAULT_DAO_WRITE_BATCH_SIZE); + setDefaultValue(PROP_DAO_READ_BATCH_SIZE, DEFAULT_DAO_READ_BATCH_SIZE); + setDefaultValue(PROP_TRUNCATE_FIELDS, true); + setDefaultValue(PROP_FORMAT_PHONE_FIELDS, false); // TODO: When we're ready, make Bulk API turned on by default. - setDefaultValue(BULK_API_ENABLED, useBulkApiByDefault()); - setDefaultValue(BULK_API_SERIAL_MODE, false); - setDefaultValue(BULK_API_ZIP_CONTENT, false); - setDefaultValue(BULK_API_CHECK_STATUS_INTERVAL, DEFAULT_BULK_API_CHECK_STATUS_INTERVAL); - setDefaultValue(WIRE_OUTPUT, false); - setDefaultValue(DEBUG_MESSAGES, false); - setDefaultValue(TIMEZONE, TimeZone.getDefault().getID()); + setDefaultValue(PROP_BULK_API_ENABLED, useBulkApiByDefault()); + setDefaultValue(PROP_BULK_API_SERIAL_MODE, false); + setDefaultValue(PROP_BULK_API_ZIP_CONTENT, false); + setDefaultValue(PROP_BULK_API_CHECK_STATUS_INTERVAL, DEFAULT_BULK_API_CHECK_STATUS_INTERVAL); + setDefaultValue(PROP_WIRE_OUTPUT, false); + setDefaultValue(PROP_DEBUG_MESSAGES, false); + setDefaultValue(PROP_TIMEZONE, TimeZone.getDefault().getID()); //sfdcInternal settings - setDefaultValue(SFDC_INTERNAL, false); - setDefaultValue(SFDC_INTERNAL_IS_SESSION_ID_LOGIN, false); - setDefaultValue(SFDC_INTERNAL_SESSION_ID, (String) null); + setDefaultValue(PROP_SFDC_INTERNAL, false); + setDefaultValue(PROP_SFDC_INTERNAL_IS_SESSION_ID_LOGIN, false); + setDefaultValue(PROP_SFDC_INTERNAL_SESSION_ID, (String) null); //oauth settings - setDefaultValue(OAUTH_SERVER, DEFAULT_ENDPOINT_URL_PROD); - setDefaultValue(OAUTH_REDIRECTURI, DEFAULT_ENDPOINT_URL_PROD); - setDefaultValue(SELECTED_AUTH_ENVIRONMENT, PROD_ENVIRONMENT_VAL); - setDefaultValue(AUTH_ENVIRONMENTS, PROD_ENVIRONMENT_VAL + AppUtil.COMMA + SB_ENVIRONMENT_VAL); + setDefaultValue(PROP_OAUTH_SERVER, DEFAULT_ENDPOINT_URL_PROD); + setDefaultValue(PROP_OAUTH_REDIRECTURI, DEFAULT_ENDPOINT_URL_PROD); + setDefaultValue(PROP_SELECTED_AUTH_ENVIRONMENT, PROD_ENVIRONMENT_VAL); + setDefaultValue(PROP_AUTH_ENVIRONMENTS, PROD_ENVIRONMENT_VAL + AppUtil.COMMA + SB_ENVIRONMENT_VAL); /* sfdc.oauth...clientid = DataLoaderBulkUI | DataLoaderPartnerUI */ setDefaultValue(OAUTH_PREFIX + PROD_ENVIRONMENT_VAL + "." + OAUTH_PARTIAL_BULK_CLIENTID, OAUTH_BULK_CLIENTID_VAL); @@ -637,52 +640,52 @@ private void setDefaults(Map cliOptionsMap) { setDefaultValue(OAUTH_PREFIX + SB_ENVIRONMENT_VAL + "." + OAUTH_PARTIAL_BULK_CLIENTID, OAUTH_BULK_CLIENTID_VAL); setDefaultValue(OAUTH_PREFIX + SB_ENVIRONMENT_VAL + "." + OAUTH_PARTIAL_PARTNER_CLIENTID, OAUTH_PARTNER_CLIENTID_VAL); - setDefaultValue(OPERATION, "insert"); - setDefaultValue(REUSE_CLIENT_CONNECTION, true); + setDefaultValue(PROP_OPERATION, "insert"); + setDefaultValue(PROP_REUSE_CLIENT_CONNECTION, true); /* setDefaultValue(ENABLE_BULK_QUERY_PK_CHUNKING, false); setDefaultValue(BULK_QUERY_PK_CHUNK_SIZE, DEFAULT_BULK_QUERY_PK_CHUNK_SIZE); setDefaultValue(BULK_QUERY_PK_CHUNK_START_ROW, ""); */ - setDefaultValue(DUPLICATE_RULE_ALLOW_SAVE, false); - setDefaultValue(DUPLICATE_RULE_INCLUDE_RECORD_DETAILS, false); - setDefaultValue(DUPLICATE_RULE_RUN_AS_CURRENT_USER, false); - setDefaultValue(BUFFER_UNPROCESSED_BULK_QUERY_RESULTS, false); - setDefaultValue(BULKV2_API_ENABLED, false); - setDefaultValue(UPDATE_WITH_EXTERNALID, false); - setDefaultValue(DELETE_WITH_EXTERNALID, false); - setDefaultValue(OAUTH_LOGIN_FROM_BROWSER, true); - setDefaultValue(LOAD_PRESERVE_WHITESPACE_IN_RICH_TEXT, true); + setDefaultValue(PROP_DUPLICATE_RULE_ALLOW_SAVE, false); + setDefaultValue(PROP_DUPLICATE_RULE_INCLUDE_RECORD_DETAILS, false); + setDefaultValue(PROP_DUPLICATE_RULE_RUN_AS_CURRENT_USER, false); + setDefaultValue(PROP_BUFFER_UNPROCESSED_BULK_QUERY_RESULTS, false); + setDefaultValue(PROP_BULKV2_API_ENABLED, false); + setDefaultValue(PROP_UPDATE_WITH_EXTERNALID, false); + setDefaultValue(PROP_DELETE_WITH_EXTERNALID, false); + setDefaultValue(PROP_OAUTH_LOGIN_FROM_BROWSER, true); + setDefaultValue(PROP_LOAD_PRESERVE_WHITESPACE_IN_RICH_TEXT, true); setDefaultValue(AppConfig.CLI_OPTION_RUN_MODE, AppConfig.RUN_MODE_UI_VAL); setDefaultValue(SAVE_BULK_SERVER_LOAD_AND_RAW_RESULTS_IN_CSV, false); setDefaultValue(PROCESS_BULK_CACHE_DATA_FROM_DAO, true); - setDefaultValue(PROCESS_KEEP_ACCOUNT_TEAM, false); + setDefaultValue(PROP_PROCESS_KEEP_ACCOUNT_TEAM, false); setDefaultValue(WIZARD_WIDTH, DEFAULT_WIZARD_WIDTH); setDefaultValue(WIZARD_HEIGHT, DEFAULT_WIZARD_HEIGHT); setDefaultValue(ENFORCE_WIZARD_WIDTH_HEIGHT_CONFIG, true); - setDefaultValue(DAO_READ_PREPROCESSOR_SCRIPT, ""); - setDefaultValue(DAO_WRITE_POSTPROCESSOR_SCRIPT, ""); - setDefaultValue(LIMIT_OUTPUT_TO_QUERY_FIELDS, true); + setDefaultValue(PROP_DAO_READ_PREPROCESSOR_SCRIPT, ""); + setDefaultValue(PROP_DAO_WRITE_POSTPROCESSOR_SCRIPT, ""); + setDefaultValue(PROP_LIMIT_OUTPUT_TO_QUERY_FIELDS, true); setDefaultValue(WIZARD_CLOSE_ON_FINISH, true); setDefaultValue(WIZARD_POPULATE_RESULTS_FOLDER_WITH_PREVIOUS_OP_RESULTS_FOLDER, true); setDefaultValue(WIZARD_X_OFFSET, DEFAULT_WIZARD_X_OFFSET); setDefaultValue(WIZARD_Y_OFFSET, DEFAULT_WIZARD_Y_OFFSET); - setDefaultValue(CACHE_DESCRIBE_GLOBAL_RESULTS, true); - setDefaultValue(PROCESS_EXIT_WITH_ERROR_ON_FAILED_ROWS_BATCH_MODE, false); - setDefaultValue(INCLUDE_RICH_TEXT_FIELD_DATA_IN_QUERY_RESULTS, false); - setDefaultValue(OAUTH_INSTANCE_URL, false); + setDefaultValue(PROP_CACHE_DESCRIBE_GLOBAL_RESULTS, true); + setDefaultValue(PROP_PROCESS_EXIT_WITH_ERROR_ON_FAILED_ROWS_BATCH_MODE, false); + setDefaultValue(PROP_INCLUDE_RICH_TEXT_FIELD_DATA_IN_QUERY_RESULTS, false); + setDefaultValue(PROP_OAUTH_INSTANCE_URL, false); String systemProxyHost = cliOptionsMap.get(AppUtil.CLI_OPTION_SYSTEM_PROXY_HOST); String systemProxyPort = cliOptionsMap.get(AppUtil.CLI_OPTION_SYSTEM_PROXY_PORT); if (systemProxyHost != null && !systemProxyHost.isBlank()) { - setDefaultValue(PROXY_HOST, systemProxyHost); - setDefaultValue(PROXY_PORT, systemProxyPort); + setDefaultValue(PROP_PROXY_HOST, systemProxyHost); + setDefaultValue(PROP_PROXY_PORT, systemProxyPort); } - setDefaultValue(USE_LEGACY_HTTP_GET, false); - setDefaultValue(USE_SYSTEM_PROPS_FOR_HTTP_CLIENT, true); - setDefaultValue(EURO_DATES, false); - setDefaultValue(NO_COMPRESSION, false); - setDefaultValue(READ_UTF8, false); - setDefaultValue(WRITE_UTF8, false); + setDefaultValue(PROP_USE_LEGACY_HTTP_GET, false); + setDefaultValue(PROP_USE_SYSTEM_PROPS_FOR_HTTP_CLIENT, true); + setDefaultValue(PROP_EURO_DATES, false); + setDefaultValue(PROP_NO_COMPRESSION, false); + setDefaultValue(PROP_READ_UTF8, false); + setDefaultValue(PROP_WRITE_UTF8, false); } /** @@ -831,7 +834,7 @@ public > T getEnum(Class enumClass, String name) { } public TimeZone getTimeZone() { - return TimeZone.getTimeZone(getString(TIMEZONE)); + return TimeZone.getTimeZone(getString(PROP_TIMEZONE)); } /** @@ -1136,7 +1139,7 @@ private void initEncryption(Map values) throws ConfigInitializat return; } // initialize encrypter - String keyFile = values.get(ENCRYPTION_KEY_FILE); + String keyFile = values.get(PROP_ENCRYPTION_KEY_FILE); if (keyFile != null && keyFile.length() != 0) { try { encrypter.setCipherKeyFromFilePath(keyFile); @@ -1230,27 +1233,27 @@ public void save() throws IOException, GeneralSecurityException { } public void setAuthEndpoint(String authEndpoint) { - this.setAuthEndpointForEnv(authEndpoint, getString(AppConfig.SELECTED_AUTH_ENVIRONMENT)); + this.setAuthEndpointForEnv(authEndpoint, getString(AppConfig.PROP_SELECTED_AUTH_ENVIRONMENT)); } public void setAuthEndpointForEnv(String authEndpoint, String env) { AppUtil.validateAuthenticationHostDomainUrlAndThrow(authEndpoint); if (env != null && env.equalsIgnoreCase(AppConfig.SB_ENVIRONMENT_VAL)) { - this.setValue(AppConfig.AUTH_ENDPOINT_SANDBOX, authEndpoint); + this.setValue(AppConfig.PROP_AUTH_ENDPOINT_SANDBOX, authEndpoint); } else { - this.setValue(AppConfig.AUTH_ENDPOINT_PROD, authEndpoint); + this.setValue(AppConfig.PROP_AUTH_ENDPOINT_PROD, authEndpoint); } } public String getAuthEndpoint() { String endpoint = null; - if (AppConfig.SB_ENVIRONMENT_VAL.equals(this.getString(AppConfig.SELECTED_AUTH_ENVIRONMENT))) { - endpoint = getString(AppConfig.AUTH_ENDPOINT_SANDBOX); + if (AppConfig.SB_ENVIRONMENT_VAL.equals(this.getString(AppConfig.PROP_SELECTED_AUTH_ENVIRONMENT))) { + endpoint = getString(AppConfig.PROP_AUTH_ENDPOINT_SANDBOX); if (endpoint == null || endpoint.isBlank()) { endpoint = getDefaultAuthEndpoint(); } } else { - endpoint = getString(AppConfig.AUTH_ENDPOINT_PROD); + endpoint = getString(AppConfig.PROP_AUTH_ENDPOINT_PROD); if (endpoint == null || endpoint.isBlank()) { endpoint = getDefaultAuthEndpoint(); } @@ -1260,7 +1263,7 @@ public String getAuthEndpoint() { } public String getDefaultAuthEndpoint() { - if (AppConfig.SB_ENVIRONMENT_VAL.equals(this.getString(AppConfig.SELECTED_AUTH_ENVIRONMENT))) { + if (AppConfig.SB_ENVIRONMENT_VAL.equals(this.getString(AppConfig.PROP_SELECTED_AUTH_ENVIRONMENT))) { return AppConfig.DEFAULT_ENDPOINT_URL_SANDBOX; } else { // assume production is the only alternate environment return AppConfig.DEFAULT_ENDPOINT_URL_PROD; @@ -1271,7 +1274,7 @@ public boolean isDefaultAuthEndpoint(String endpoint) { if (endpoint == null || endpoint.isBlank()) { return false; } - if (AppConfig.SB_ENVIRONMENT_VAL.equals(this.getString(AppConfig.SELECTED_AUTH_ENVIRONMENT))) { + if (AppConfig.SB_ENVIRONMENT_VAL.equals(this.getString(AppConfig.PROP_SELECTED_AUTH_ENVIRONMENT))) { return AppConfig.DEFAULT_ENDPOINT_URL_SANDBOX.equalsIgnoreCase(endpoint); } else { // assume production is the only alternate environment return AppConfig.DEFAULT_ENDPOINT_URL_PROD.equalsIgnoreCase(endpoint); @@ -1397,7 +1400,7 @@ public void setValue(String name, Map valueMap) { public static final String CLIENT_ID_HEADER_NAME="client_id"; public String getClientIdNameValuePair() { - return CLIENT_ID_HEADER_NAME + "=" + this.getString(AppConfig.OAUTH_CLIENTID); + return CLIENT_ID_HEADER_NAME + "=" + this.getString(AppConfig.PROP_OAUTH_CLIENTID); } /** @@ -1469,11 +1472,24 @@ private void setValue(String name, T value, boolean skipIfAlreadySet) { } } + private void setConfigProperty(String propName, String propVal, boolean isDefault) { + ConfigProperty configProp = configPropsMap.get(propName); + if (configProp == null) { + configProp = new ConfigProperty(propName); + configPropsMap.put(propName, configProp); + } + configProp.setValue(propVal); + if (isDefault) { + configProp.setDefaultValue(propVal); + } + } + /** * @param name * @param newValue */ private void setProperty(String name, String newValue, boolean skipIfAlreadySet) { + setConfigProperty(name, newValue, skipIfAlreadySet); final String oldValue = getString(name); if (skipIfAlreadySet && oldValue != null && !oldValue.isBlank()) { // do not override the old value @@ -1510,7 +1526,7 @@ public int getImportBatchSize() { int bs = -1; try { - bs = getInt(IMPORT_BATCH_SIZE); + bs = getInt(PROP_IMPORT_BATCH_SIZE); } catch (ParameterLoadException e) { } int maxBatchSize = bulkApi ? MAX_BULK_API_IMPORT_BATCH_SIZE : MAX_SOAP_API_IMPORT_BATCH_SIZE; @@ -1536,15 +1552,15 @@ public boolean useBulkAPIForCurrentOperation() { } public boolean isBulkAPIEnabled() { - return getBoolean(BULK_API_ENABLED) && !isBulkV2APIEnabled(); + return getBoolean(PROP_BULK_API_ENABLED) && !isBulkV2APIEnabled(); } public boolean isBulkV2APIEnabled() { - return getBoolean(BULKV2_API_ENABLED); + return getBoolean(PROP_BULKV2_API_ENABLED); } public boolean isRESTAPIEnabled() { - return getBoolean(UPDATE_WITH_EXTERNALID); + return getBoolean(PROP_UPDATE_WITH_EXTERNALID); } private boolean isBulkApiOperation() { @@ -1552,14 +1568,14 @@ private boolean isBulkApiOperation() { } public OperationInfo getOperationInfo() { - return getEnum(OperationInfo.class, OPERATION); + return getEnum(OperationInfo.class, PROP_OPERATION); } public String getCsvEncoding(boolean isWrite) { // charset is for CSV read unless isWrite is set to true - String configProperty = READ_UTF8; + String configProperty = PROP_READ_UTF8; if (isWrite) { - configProperty = WRITE_UTF8; + configProperty = PROP_WRITE_UTF8; logger.debug("Getting charset for writing to CSV"); } else { logger.debug("Getting charset for reading from CSV"); @@ -1571,7 +1587,7 @@ public String getCsvEncoding(boolean isWrite) { return StandardCharsets.UTF_8.name(); } if (!isWrite) { - String charset = getString(READ_CHARSET); + String charset = getString(PROP_READ_CHARSET); if (charset != null && !charset.isEmpty()) { return charset; } @@ -1632,7 +1648,7 @@ public void setOAuthEnvironment(String environment) { if (environment == null || environment.isBlank()) { environment = PROD_ENVIRONMENT_VAL; } - String[] envArray = getString(AUTH_ENVIRONMENTS).split(","); + String[] envArray = getString(PROP_AUTH_ENVIRONMENTS).split(","); boolean isEnvMatch = false; for (String env : envArray) { env = env.strip(); @@ -1643,10 +1659,10 @@ public void setOAuthEnvironment(String environment) { if (!isEnvMatch) { environment = PROD_ENVIRONMENT_VAL; } - setValue(SELECTED_AUTH_ENVIRONMENT, environment); + setValue(PROP_SELECTED_AUTH_ENVIRONMENT, environment); String clientId; - if (getBoolean(BULK_API_ENABLED) || getBoolean(BULKV2_API_ENABLED)) { + if (getBoolean(PROP_BULK_API_ENABLED) || getBoolean(PROP_BULKV2_API_ENABLED)) { clientId = getOAuthEnvironmentString(environment, OAUTH_PARTIAL_BULK_CLIENTID); } else { clientId = getOAuthEnvironmentString(environment, OAUTH_PARTIAL_PARTNER_CLIENTID); @@ -1654,8 +1670,8 @@ public void setOAuthEnvironment(String environment) { if (clientId == null || clientId.isEmpty()) { clientId = getOAuthEnvironmentString(environment, OAUTH_PARTIAL_CLIENTID); } - setValue(OAUTH_CLIENTID, clientId); - setValue(OAUTH_CLIENTSECRET, getOAuthEnvironmentString(environment, OAUTH_PARTIAL_CLIENTSECRET)); + setValue(PROP_OAUTH_CLIENTID, clientId); + setValue(PROP_OAUTH_CLIENTSECRET, getOAuthEnvironmentString(environment, OAUTH_PARTIAL_CLIENTSECRET)); // All URLs are driven from Config.ENDPOINT URL setting String endpointURL = getAuthEndpoint(); @@ -1669,7 +1685,7 @@ public void setOAuthEnvironment(String environment) { && !envSpecificOAuthServerURL.contains(AppConfig.DEFAULT_ENDPOINT_URL_PROD)) { endpointURL = envSpecificOAuthServerURL; } - setValue(OAUTH_SERVER, endpointURL); + setValue(PROP_OAUTH_SERVER, endpointURL); String envSpecificOAuthRedirectURI = getOAuthEnvironmentString(environment, OAUTH_PARTIAL_REDIRECTURI); String redirectURI = ""; @@ -1681,7 +1697,7 @@ public void setOAuthEnvironment(String environment) { } else { redirectURI = endpointURL + AppConfig.OAUTH_REDIRECT_URI_SUFFIX; } - setValue(OAUTH_REDIRECTURI, redirectURI); + setValue(PROP_OAUTH_REDIRECTURI, redirectURI); } /** diff --git a/src/main/java/com/salesforce/dataloader/config/ConfigProperty.java b/src/main/java/com/salesforce/dataloader/config/ConfigProperty.java new file mode 100644 index 00000000..0e697704 --- /dev/null +++ b/src/main/java/com/salesforce/dataloader/config/ConfigProperty.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2015, salesforce.com, inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or + * promote products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +package com.salesforce.dataloader.config; + +import java.util.HashMap; + +import com.salesforce.dataloader.ui.Labels; + +/* + * Data class capturing information about configuration property (aka Setting). + */ +public class ConfigProperty { + private static final HashMap propertiesMap = new HashMap(); + + private final String name; + private String defaultValue = ""; + private String value = ""; + private boolean readonly; + private boolean encrypted; + private boolean commandLineOption; + private final String uiLabelTemplate; + private final String uiTooltipTemplate; + + public ConfigProperty(String name) { + this.name = name; + this.uiLabelTemplate = Labels.getString("AdvancedSettingsDialog.uiLabel." + name); + String tooltipText = null; + tooltipText = Labels.getString("AdvancedSettingsDialog.uiTooltip." + name); + if (tooltipText != null && tooltipText.startsWith("!") && tooltipText.endsWith("!")) { + tooltipText = null; + } + String[] propArg = {this.name}; + try { + if (tooltipText == null) { + tooltipText = Labels.getFormattedString("AdvancedSettingsDialog.TooltipPropertyName", propArg); + } else { + tooltipText += "\n\n"; + tooltipText += Labels.getFormattedString("AdvancedSettingsDialog.TooltipPropertyName", propArg); + } + } catch (java.util.MissingResourceException e) { + // do nothing + } + if (tooltipText != null && tooltipText.startsWith("!") && tooltipText.endsWith("!")) { + tooltipText = null; + } + if (tooltipText == null) { + this.uiTooltipTemplate = ""; + } else { + this.uiTooltipTemplate = tooltipText; + }; + } + + public static HashMap getPropertiesMap() { + return propertiesMap; + } + public String getDefaultValue() { + return defaultValue; + } + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + public String getValue() { + return value; + } + public void setValue(String value) { + this.value = value; + } + public boolean isReadonly() { + return readonly; + } + public void setReadonly(boolean readonly) { + this.readonly = readonly; + } + public boolean isEncrypted() { + return encrypted; + } + public void setEncrypted(boolean encrypted) { + this.encrypted = encrypted; + } + public boolean isCommandLineOption() { + return commandLineOption; + } + public void setCommandLineOption(boolean commandLineOption) { + this.commandLineOption = commandLineOption; + } + public String getUiLabelTemplate() { + return uiLabelTemplate; + } + public String getUiTooltip() { + return uiTooltipTemplate; + } +} \ No newline at end of file diff --git a/src/main/java/com/salesforce/dataloader/controller/Controller.java b/src/main/java/com/salesforce/dataloader/controller/Controller.java index d4d04e2e..b82ac191 100644 --- a/src/main/java/com/salesforce/dataloader/controller/Controller.java +++ b/src/main/java/com/salesforce/dataloader/controller/Controller.java @@ -276,11 +276,11 @@ public boolean isLoggedIn() { } private void createDao(String daoTypeStr, String daoNameStr) throws DataAccessObjectInitializationException { - appConfig.setValue(AppConfig.DAO_NAME, daoNameStr); - appConfig.setValue(AppConfig.DAO_TYPE, daoTypeStr); + appConfig.setValue(AppConfig.PROP_DAO_NAME, daoNameStr); + appConfig.setValue(AppConfig.PROP_DAO_TYPE, daoTypeStr); try { - appConfig.getStringRequired(AppConfig.DAO_NAME); // verify required param exists: dao name - dao = daoFactory.getDaoInstance(appConfig.getStringRequired(AppConfig.DAO_TYPE), appConfig); + appConfig.getStringRequired(AppConfig.PROP_DAO_NAME); // verify required param exists: dao name + dao = daoFactory.getDaoInstance(appConfig.getStringRequired(AppConfig.PROP_DAO_TYPE), appConfig); logger.info(Messages.getString("Process.checkingDao")); //$NON-NLS-1$ dao.checkConnection(); } catch (Exception e) { @@ -295,7 +295,7 @@ public void initializeOperation(String daoTypeStr, String daoNameStr, String sOb } catch (DataAccessObjectInitializationException e) { throw new MappingInitializationException(e.getMessage()); } - appConfig.setValue(AppConfig.ENTITY, sObjectName); + appConfig.setValue(AppConfig.PROP_ENTITY, sObjectName); initializeMapping(); // initialize mapping before setting reference describes try { this.setFieldTypes(); @@ -306,7 +306,7 @@ public void initializeOperation(String daoTypeStr, String daoNameStr, String sOb } private void initializeMapping() throws MappingInitializationException { - String mappingFile = appConfig.getString(AppConfig.MAPPING_FILE); + String mappingFile = appConfig.getString(AppConfig.PROP_MAPPING_FILE); if (mappingFile != null && !mappingFile.isBlank() && !Files.exists(Path.of(mappingFile))) { throw new MappingInitializationException("Mapping file " + mappingFile + " does not exist"); @@ -461,11 +461,11 @@ public void setStatusFiles(String statusDirName, boolean createDir, boolean gene } } // if status files are not specified, generate the files automatically - String successPath = appConfig.getString(AppConfig.OUTPUT_SUCCESS); + String successPath = appConfig.getString(AppConfig.PROP_OUTPUT_SUCCESS); if (generateFiles || successPath == null || successPath.length() == 0) { successPath = new File(statusDir, "success" + getFormattedCurrentTimestamp() + ".csv").getAbsolutePath(); //$NON-NLS-1$ //$NON-NLS-2$ } - String errorPath = appConfig.getString(AppConfig.OUTPUT_ERROR); + String errorPath = appConfig.getString(AppConfig.PROP_OUTPUT_ERROR); if (generateFiles || errorPath == null || errorPath.length() == 0) { errorPath = new File(statusDir, "error" + getFormattedCurrentTimestamp() + ".csv").getAbsolutePath(); //$NON-NLS-1$ //$NON-NLS-2$ } @@ -488,9 +488,9 @@ public void setStatusFiles(String statusDirName, boolean createDir, boolean gene throw new ProcessInitializationException(e.getMessage(), e); } - appConfig.setValue(AppConfig.OUTPUT_STATUS_DIR, statusDirName); - appConfig.setValue(AppConfig.OUTPUT_SUCCESS, successPath); - appConfig.setValue(AppConfig.OUTPUT_ERROR, errorPath); + appConfig.setValue(AppConfig.PROP_OUTPUT_STATUS_DIR, statusDirName); + appConfig.setValue(AppConfig.PROP_OUTPUT_SUCCESS, successPath); + appConfig.setValue(AppConfig.PROP_OUTPUT_ERROR, errorPath); // TODO for unprocessed records // config.setValue(Config.OUTPUT_UNPROCESSED_RECORDS, unprocessedRecordsPath); } @@ -504,7 +504,7 @@ public String getFormattedCurrentTimestamp() { private void validateFile(String filePath) throws IOException { File file = new File(filePath); // finally make sure the output isn't the data access file - String daoName = appConfig.getString(AppConfig.DAO_NAME); + String daoName = appConfig.getString(AppConfig.PROP_DAO_NAME); // if it doesn't exist and we can create it, its valid if (!file.exists()) { @@ -529,14 +529,14 @@ public void logout() { this.partnerClient = null; this.bulkV2Client = null; this.restClient = null; - appConfig.setValue(AppConfig.OAUTH_ACCESSTOKEN, ""); + appConfig.setValue(AppConfig.PROP_OAUTH_ACCESSTOKEN, ""); } public boolean attachmentsEnabled() { if (getAppConfig().isBulkV2APIEnabled()) { return false; } else { - return getAppConfig().getBoolean(AppConfig.BULK_API_ZIP_CONTENT); + return getAppConfig().getBoolean(AppConfig.PROP_BULK_API_ZIP_CONTENT); } } diff --git a/src/main/java/com/salesforce/dataloader/dao/DataAccessObjectFactory.java b/src/main/java/com/salesforce/dataloader/dao/DataAccessObjectFactory.java index 62681bdd..07420e9c 100644 --- a/src/main/java/com/salesforce/dataloader/dao/DataAccessObjectFactory.java +++ b/src/main/java/com/salesforce/dataloader/dao/DataAccessObjectFactory.java @@ -52,12 +52,12 @@ public DataAccessObject getDaoInstance(String daoType, AppConfig appConfig) throws DataAccessObjectInitializationException { DataAccessObject dao = null; - logger.info(Messages.getFormattedString("DataAccessObjectFactory.creatingDao", new String[] {appConfig.getString(AppConfig.DAO_NAME), daoType})); + logger.info(Messages.getFormattedString("DataAccessObjectFactory.creatingDao", new String[] {appConfig.getString(AppConfig.PROP_DAO_NAME), daoType})); if (CSV_READ_TYPE.equalsIgnoreCase(daoType)) { - dao = new CSVFileReader(new File(appConfig.getString(AppConfig.DAO_NAME)), appConfig, false, false); + dao = new CSVFileReader(new File(appConfig.getString(AppConfig.PROP_DAO_NAME)), appConfig, false, false); } else if (CSV_WRITE_TYPE.equalsIgnoreCase(daoType)) { - dao = new CSVFileWriter(appConfig.getString(AppConfig.DAO_NAME), appConfig, appConfig.getString(AppConfig.CSV_DELIMITER_FOR_QUERY_RESULTS)); + dao = new CSVFileWriter(appConfig.getString(AppConfig.PROP_DAO_NAME), appConfig, appConfig.getString(AppConfig.PROP_CSV_DELIMITER_FOR_QUERY_RESULTS)); } else if (DATABASE_READ_TYPE.equalsIgnoreCase(daoType)) { dao = new DatabaseReader(appConfig); } else if (DATABASE_WRITE_TYPE.equalsIgnoreCase(daoType)) { diff --git a/src/main/java/com/salesforce/dataloader/dao/csv/CSVFileReader.java b/src/main/java/com/salesforce/dataloader/dao/csv/CSVFileReader.java index 5cccde24..dfe764b4 100644 --- a/src/main/java/com/salesforce/dataloader/dao/csv/CSVFileReader.java +++ b/src/main/java/com/salesforce/dataloader/dao/csv/CSVFileReader.java @@ -88,18 +88,18 @@ public CSVFileReader(File file, AppConfig appConfig, boolean ignoreDelimiterConf LOGGER.debug(Messages.getString("CSVFileDAO.debugMessageCommaSeparator")); } else { if (isQueryOperationResult) { - separator.append(appConfig.getString(AppConfig.CSV_DELIMITER_FOR_QUERY_RESULTS)); + separator.append(appConfig.getString(AppConfig.PROP_CSV_DELIMITER_FOR_QUERY_RESULTS)); } else { // reading CSV for a load operation - if (appConfig.getBoolean(AppConfig.CSV_DELIMITER_COMMA)) { + if (appConfig.getBoolean(AppConfig.PROP_CSV_DELIMITER_COMMA)) { separator.append(AppUtil.COMMA); LOGGER.debug(Messages.getString("CSVFileDAO.debugMessageCommaSeparator")); } - if (appConfig.getBoolean(AppConfig.CSV_DELIMITER_TAB)) { + if (appConfig.getBoolean(AppConfig.PROP_CSV_DELIMITER_TAB)) { separator.append(AppUtil.TAB); LOGGER.debug(Messages.getString("CSVFileDAO.debugMessageTabSeparator")); } - if (appConfig.getBoolean(AppConfig.CSV_DELIMITER_OTHER)) { - separator.append(appConfig.getString(AppConfig.CSV_DELIMITER_OTHER_VALUE)); + if (appConfig.getBoolean(AppConfig.PROP_CSV_DELIMITER_OTHER)) { + separator.append(appConfig.getString(AppConfig.PROP_CSV_DELIMITER_OTHER_VALUE)); LOGGER.debug(Messages.getFormattedString("CSVFileDAO.debugMessageSeparatorChar", separator)); } } diff --git a/src/main/java/com/salesforce/dataloader/dao/database/DatabaseReader.java b/src/main/java/com/salesforce/dataloader/dao/database/DatabaseReader.java index 4412ee0e..976afed1 100644 --- a/src/main/java/com/salesforce/dataloader/dao/database/DatabaseReader.java +++ b/src/main/java/com/salesforce/dataloader/dao/database/DatabaseReader.java @@ -70,7 +70,7 @@ public class DatabaseReader implements DataReader { * @throws DataAccessObjectInitializationException */ public DatabaseReader(AppConfig appConfig) throws DataAccessObjectInitializationException { - this(appConfig, appConfig.getString(AppConfig.DAO_NAME)); + this(appConfig, appConfig.getString(AppConfig.PROP_DAO_NAME)); } /** @@ -134,7 +134,7 @@ private void setupQuery(Map params) throws DataAccessObjectInitia // set the query fetch size int fetchSize; try { - fetchSize = appConfig.getInt(AppConfig.DAO_READ_BATCH_SIZE); + fetchSize = appConfig.getInt(AppConfig.PROP_DAO_READ_BATCH_SIZE); if(fetchSize > AppConfig.MAX_DAO_READ_BATCH_SIZE) { fetchSize = AppConfig.MAX_DAO_READ_BATCH_SIZE; } @@ -229,8 +229,8 @@ public Row readRow() throws DataAccessObjectException { public int getTotalRows() throws DataAccessObjectException { boolean skipRowCount = AppConfig.DEFAULT_SKIP_TOTAL_COUNT; - if (appConfig.contains(AppConfig.DAO_SKIP_TOTAL_COUNT)) - skipRowCount = appConfig.getBoolean(AppConfig.DAO_SKIP_TOTAL_COUNT); + if (appConfig.contains(AppConfig.PROP_DAO_SKIP_TOTAL_COUNT)) + skipRowCount = appConfig.getBoolean(AppConfig.PROP_DAO_SKIP_TOTAL_COUNT); if (skipRowCount == true) return 0; diff --git a/src/main/java/com/salesforce/dataloader/dao/database/DatabaseWriter.java b/src/main/java/com/salesforce/dataloader/dao/database/DatabaseWriter.java index 3ec2039e..7bdaa026 100644 --- a/src/main/java/com/salesforce/dataloader/dao/database/DatabaseWriter.java +++ b/src/main/java/com/salesforce/dataloader/dao/database/DatabaseWriter.java @@ -57,7 +57,7 @@ public class DatabaseWriter implements DataWriter { private final DatabaseContext dbContext; public DatabaseWriter(AppConfig appConfig) throws DataAccessObjectInitializationException { - this(appConfig, appConfig.getString(AppConfig.DAO_NAME)); + this(appConfig, appConfig.getString(AppConfig.PROP_DAO_NAME)); } /** diff --git a/src/main/java/com/salesforce/dataloader/dyna/FileByteArrayConverter.java b/src/main/java/com/salesforce/dataloader/dyna/FileByteArrayConverter.java index c194883c..b6ce1fb1 100644 --- a/src/main/java/com/salesforce/dataloader/dyna/FileByteArrayConverter.java +++ b/src/main/java/com/salesforce/dataloader/dyna/FileByteArrayConverter.java @@ -89,8 +89,8 @@ public Object convert(Class type, Object value) { if (mimeType != null && mimeType.equalsIgnoreCase("text/plain") && appConfig != null - && appConfig.getBoolean(AppConfig.LOAD_PRESERVE_WHITESPACE_IN_RICH_TEXT) - && AppUtil.isContentSObject(appConfig.getString(AppConfig.ENTITY))) { + && appConfig.getBoolean(AppConfig.PROP_LOAD_PRESERVE_WHITESPACE_IN_RICH_TEXT) + && AppUtil.isContentSObject(appConfig.getString(AppConfig.PROP_ENTITY))) { // Preserve the formatting only if the content is of type plain text // AND the flag to preserve whitespace characters in RichText fields is enabled // AND the content is for ContentNote sobject. diff --git a/src/main/java/com/salesforce/dataloader/dyna/SforceDynaBean.java b/src/main/java/com/salesforce/dataloader/dyna/SforceDynaBean.java index cbaf59e1..8ddb122a 100644 --- a/src/main/java/com/salesforce/dataloader/dyna/SforceDynaBean.java +++ b/src/main/java/com/salesforce/dataloader/dyna/SforceDynaBean.java @@ -238,7 +238,7 @@ static public DynaBean convertToDynaBean(BasicDynaClass dynaClass, Row sforceDat && val instanceof String && !((String)val).isBlank() && sforceObj.get(sforceField) == null) { - String errStr = "unable to convert a non-null " + sforceField + "value " + (String)val + " to a field on entity " + AppConfig.getCurrentConfig().getString(AppConfig.ENTITY); + String errStr = "unable to convert a non-null " + sforceField + "value " + (String)val + " to a field on entity " + AppConfig.getCurrentConfig().getString(AppConfig.PROP_ENTITY); logger.error(errStr); //$NON-NLS-1$ throw new LoadException(errStr); } @@ -410,7 +410,7 @@ public static Map getCompositeRESTSObject(Controller controller, * @param useEuroDates if true, european date format will be used */ synchronized static public void registerConverters(AppConfig cfg) { - final boolean useEuroDates = cfg.getBoolean(AppConfig.EURO_DATES); + final boolean useEuroDates = cfg.getBoolean(AppConfig.PROP_EURO_DATES); final TimeZone tz = cfg.getTimeZone(); // Register DynaBean type conversions ConvertUtils.register(new DateTimeConverter(tz, useEuroDates), Calendar.class); diff --git a/src/main/java/com/salesforce/dataloader/model/LoginCriteria.java b/src/main/java/com/salesforce/dataloader/model/LoginCriteria.java index 16a327d8..8a3f70c0 100644 --- a/src/main/java/com/salesforce/dataloader/model/LoginCriteria.java +++ b/src/main/java/com/salesforce/dataloader/model/LoginCriteria.java @@ -96,14 +96,14 @@ public void setSessionId(String sessionId) { public void updateConfig(AppConfig appConfig) { switch (getMode()){ case LoginCriteria.UsernamePasswordLogin: - appConfig.setValue(AppConfig.SFDC_INTERNAL_IS_SESSION_ID_LOGIN, false); - appConfig.setValue(AppConfig.USERNAME, getUserName().trim()); - appConfig.setValue(AppConfig.PASSWORD, getPassword().trim()); + appConfig.setValue(AppConfig.PROP_SFDC_INTERNAL_IS_SESSION_ID_LOGIN, false); + appConfig.setValue(AppConfig.PROP_USERNAME, getUserName().trim()); + appConfig.setValue(AppConfig.PROP_PASSWORD, getPassword().trim()); break; case LoginCriteria.SessionIdLogin: - appConfig.setValue(AppConfig.SFDC_INTERNAL_IS_SESSION_ID_LOGIN, true); - appConfig.setValue(AppConfig.USERNAME, getUserName().trim()); - appConfig.setValue(AppConfig.SFDC_INTERNAL_SESSION_ID, getSessionId().trim()); + appConfig.setValue(AppConfig.PROP_SFDC_INTERNAL_IS_SESSION_ID_LOGIN, true); + appConfig.setValue(AppConfig.PROP_USERNAME, getUserName().trim()); + appConfig.setValue(AppConfig.PROP_SFDC_INTERNAL_SESSION_ID, getSessionId().trim()); break; case LoginCriteria.OAuthLogin: appConfig.setOAuthEnvironment(getEnvironment()); diff --git a/src/main/java/com/salesforce/dataloader/oauth/OAuthFlowUtil.java b/src/main/java/com/salesforce/dataloader/oauth/OAuthFlowUtil.java index aa14a636..469949a9 100644 --- a/src/main/java/com/salesforce/dataloader/oauth/OAuthFlowUtil.java +++ b/src/main/java/com/salesforce/dataloader/oauth/OAuthFlowUtil.java @@ -44,13 +44,13 @@ */ public class OAuthFlowUtil { public static String getStartUrlImpl(AppConfig appConfig) throws UnsupportedEncodingException { - return appConfig.getString(AppConfig.OAUTH_SERVER) + + return appConfig.getString(AppConfig.PROP_OAUTH_SERVER) + "/services/oauth2/authorize" + "?response_type=token" + "&display=popup" + "&" + appConfig.getClientIdNameValuePair() + "&redirect_uri=" - + URLEncoder.encode(appConfig.getString(AppConfig.OAUTH_REDIRECTURI), StandardCharsets.UTF_8.name()); + + URLEncoder.encode(appConfig.getString(AppConfig.PROP_OAUTH_REDIRECTURI), StandardCharsets.UTF_8.name()); } @@ -94,9 +94,9 @@ public static boolean handleCompletedUrl(String url, AppConfig appConfig) throws } appConfig.setAuthEndpoint(token.getInstanceUrl()); - appConfig.setValue(AppConfig.OAUTH_ACCESSTOKEN, token.getAccessToken()); - appConfig.setValue(AppConfig.OAUTH_REFRESHTOKEN, token.getRefreshToken()); - appConfig.setValue(AppConfig.OAUTH_INSTANCE_URL, token.getInstanceUrl()); + appConfig.setValue(AppConfig.PROP_OAUTH_ACCESSTOKEN, token.getAccessToken()); + appConfig.setValue(AppConfig.PROP_OAUTH_REFRESHTOKEN, token.getRefreshToken()); + appConfig.setValue(AppConfig.PROP_OAUTH_INSTANCE_URL, token.getInstanceUrl()); return true; } diff --git a/src/main/java/com/salesforce/dataloader/oauth/OAuthSecretFlowUtil.java b/src/main/java/com/salesforce/dataloader/oauth/OAuthSecretFlowUtil.java index 92236835..5519505c 100644 --- a/src/main/java/com/salesforce/dataloader/oauth/OAuthSecretFlowUtil.java +++ b/src/main/java/com/salesforce/dataloader/oauth/OAuthSecretFlowUtil.java @@ -47,23 +47,23 @@ */ public class OAuthSecretFlowUtil { public static String getStartUrlImpl(AppConfig appConfig) throws UnsupportedEncodingException { - return appConfig.getString(AppConfig.OAUTH_SERVER) + + return appConfig.getString(AppConfig.PROP_OAUTH_SERVER) + "/services/oauth2/authorize" + "?response_type=code" + "&display=popup" + "&" + appConfig.getClientIdNameValuePair() + "&redirect_uri=" - + URLEncoder.encode(appConfig.getString(AppConfig.OAUTH_REDIRECTURI), StandardCharsets.UTF_8.name()); + + URLEncoder.encode(appConfig.getString(AppConfig.PROP_OAUTH_REDIRECTURI), StandardCharsets.UTF_8.name()); } public static SimplePost handleSecondPost(String code, AppConfig appConfig) throws IOException, ParameterLoadException { - String server = appConfig.getString(AppConfig.OAUTH_SERVER) + "/services/oauth2/token"; + String server = appConfig.getString(AppConfig.PROP_OAUTH_SERVER) + "/services/oauth2/token"; SimplePost client = SimplePostFactory.getInstance(appConfig, server, new BasicNameValuePair("grant_type", "authorization_code"), new BasicNameValuePair("code", code), - new BasicNameValuePair(AppConfig.CLIENT_ID_HEADER_NAME, appConfig.getString(AppConfig.OAUTH_CLIENTID)), - new BasicNameValuePair("client_secret", appConfig.getString(AppConfig.OAUTH_CLIENTSECRET)), - new BasicNameValuePair("redirect_uri", appConfig.getString(AppConfig.OAUTH_REDIRECTURI)) + new BasicNameValuePair(AppConfig.CLIENT_ID_HEADER_NAME, appConfig.getString(AppConfig.PROP_OAUTH_CLIENTID)), + new BasicNameValuePair("client_secret", appConfig.getString(AppConfig.PROP_OAUTH_CLIENTSECRET)), + new BasicNameValuePair("redirect_uri", appConfig.getString(AppConfig.PROP_OAUTH_REDIRECTURI)) ); client.post(); if (client.isSuccessful()) { diff --git a/src/main/java/com/salesforce/dataloader/process/ProcessRunner.java b/src/main/java/com/salesforce/dataloader/process/ProcessRunner.java index 642b7476..61f5ec0a 100644 --- a/src/main/java/com/salesforce/dataloader/process/ProcessRunner.java +++ b/src/main/java/com/salesforce/dataloader/process/ProcessRunner.java @@ -99,12 +99,12 @@ public class ProcessRunner implements InitializingBean, IProcess { private ILoaderProgress monitor; private static final String PROP_NAME_ARRAY[] = { - AppConfig.OPERATION, - AppConfig.USERNAME, - AppConfig.PASSWORD, - AppConfig.DAO_TYPE, - AppConfig.DAO_NAME, - AppConfig.ENTITY, + AppConfig.PROP_OPERATION, + AppConfig.PROP_USERNAME, + AppConfig.PROP_PASSWORD, + AppConfig.PROP_DAO_TYPE, + AppConfig.PROP_DAO_NAME, + AppConfig.PROP_ENTITY, }; /** @@ -134,22 +134,22 @@ public synchronized void run(ILoaderProgress monitor) throws Exception { try { logger.info(Messages.getString("Process.initializingEngine")); //$NON-NLS-1$ AppConfig appConfig = controller.getAppConfig(); - if (!(appConfig.contains(AppConfig.USERNAME) && appConfig.contains(AppConfig.PASSWORD)) - && appConfig.getBoolean(AppConfig.OAUTH_LOGIN_FROM_BROWSER)) { + if (!(appConfig.contains(AppConfig.PROP_USERNAME) && appConfig.contains(AppConfig.PROP_PASSWORD)) + && appConfig.getBoolean(AppConfig.PROP_OAUTH_LOGIN_FROM_BROWSER)) { doLoginFromBrowser(appConfig); } // Make sure that the required properties are specified. validateConfigProperties(appConfig); if (name == null || name.isBlank()) { // this can occur only if "process.name" is not specified as a command line option - name = appConfig.getString(AppConfig.OPERATION); + name = appConfig.getString(AppConfig.PROP_OPERATION); this.setName(name); setThreadName(name); }; // create files for status output unless it's an extract and status output is disabled - if (!appConfig.getOperationInfo().isExtraction() || appConfig.getBoolean(AppConfig.ENABLE_EXTRACT_STATUS_OUTPUT)) { - controller.setStatusFiles(appConfig.getString(AppConfig.OUTPUT_STATUS_DIR), true, false); + if (!appConfig.getOperationInfo().isExtraction() || appConfig.getBoolean(AppConfig.PROP_ENABLE_EXTRACT_STATUS_OUTPUT)) { + controller.setStatusFiles(appConfig.getString(AppConfig.PROP_OUTPUT_STATUS_DIR), true, false); } logger.info(Messages.getFormattedString("Process.loggingIn", appConfig.getAuthEndpoint())); //$NON-NLS-1$ @@ -160,8 +160,8 @@ public synchronized void run(ILoaderProgress monitor) throws Exception { // instantiate the map logger.info(Messages.getString("Process.creatingMap")); //$NON-NLS-1$ - controller.initializeOperation(appConfig.getString(AppConfig.DAO_TYPE), - appConfig.getString(AppConfig.DAO_NAME), appConfig.getString(AppConfig.ENTITY)); + controller.initializeOperation(appConfig.getString(AppConfig.PROP_DAO_TYPE), + appConfig.getString(AppConfig.PROP_DAO_NAME), appConfig.getString(AppConfig.PROP_ENTITY)); // execute the requested operation controller.executeAction(monitor); @@ -208,7 +208,7 @@ public synchronized void setConfigOverrideMap(Map configOverride if (this.configOverrideMap.isEmpty()) { this.configOverrideMap.putAll(configOverrideMap); if (getName() != null && !getName().isBlank()) { - this.configOverrideMap.put(AppConfig.PROCESS_NAME, getName()); + this.configOverrideMap.put(AppConfig.PROP_PROCESS_NAME, getName()); } } else { throw new IllegalStateException("Attempting to set configOverrideMap but there are already " @@ -274,7 +274,7 @@ public static ProcessRunner runBatchMode(MapargMap, ILoaderProgr } else if (!progressMonitor.isSuccess()) { logErrorAndExitProcess(progressMonitor.getMessage(), null, AppUtil.EXIT_CODE_SERVER_ERROR); } else if (AppConfig.getCurrentConfig() != null - && AppConfig.getCurrentConfig().getBoolean(AppConfig.PROCESS_EXIT_WITH_ERROR_ON_FAILED_ROWS_BATCH_MODE) + && AppConfig.getCurrentConfig().getBoolean(AppConfig.PROP_PROCESS_EXIT_WITH_ERROR_ON_FAILED_ROWS_BATCH_MODE) && progressMonitor.getNumberRowsWithError() > 0) { DataLoaderRunner.setExitCode(AppUtil.EXIT_CODE_RESULTS_ERROR); } @@ -307,21 +307,21 @@ public static ProcessRunner runBatchMode(MapargMap, ILoaderProgr */ private static synchronized ProcessRunner getInstance(Map argMap) throws ProcessInitializationException { logger.info(Messages.getString("Process.initializingEngine")); //$NON-NLS-1$ - String dynaBeanID = argMap.get(AppConfig.PROCESS_NAME); + String dynaBeanID = argMap.get(AppConfig.PROP_PROCESS_NAME); ProcessRunner runner; if (dynaBeanID == null || dynaBeanID.isEmpty()) { // operation and other process params are specified in config.properties - logger.info(AppConfig.PROCESS_NAME + logger.info(AppConfig.PROP_PROCESS_NAME + "is not specified in the command line. Loading the process properties from config.properties."); runner = new ProcessRunner(); - if (argMap.containsKey(AppConfig.PROCESS_THREAD_NAME)) { - runner.setName(argMap.get(AppConfig.PROCESS_THREAD_NAME)); + if (argMap.containsKey(AppConfig.PROP_PROCESS_THREAD_NAME)) { + runner.setName(argMap.get(AppConfig.PROP_PROCESS_THREAD_NAME)); } } else { // process name specified in the command line arg. // Load its DynaBean through process-conf.xml - logger.info(AppConfig.PROCESS_NAME + logger.info(AppConfig.PROP_PROCESS_NAME + "is specified in the command line. Loading DynaBean with id " + dynaBeanID + " from process-conf.xml located in folder " @@ -353,9 +353,9 @@ private static void validateConfigProperties(AppConfig appConfig) throws Process for (String propName : PROP_NAME_ARRAY) { String propVal = appConfig.getString(propName); - if (propName.equals(AppConfig.PASSWORD) && (propVal == null || propVal.isBlank())) { + if (propName.equals(AppConfig.PROP_PASSWORD) && (propVal == null || propVal.isBlank())) { // OAuth access token must be specified if password is not specified - propVal = appConfig.getString(AppConfig.OAUTH_ACCESSTOKEN); + propVal = appConfig.getString(AppConfig.PROP_OAUTH_ACCESSTOKEN); } if (propVal == null || propVal.isBlank()) { logger.fatal(Messages.getFormattedString("Config.errorNoRequiredParameter", propName)); diff --git a/src/main/java/com/salesforce/dataloader/ui/AdvancedSettingsDialog.java b/src/main/java/com/salesforce/dataloader/ui/AdvancedSettingsDialog.java index b6a35083..38a88f16 100644 --- a/src/main/java/com/salesforce/dataloader/ui/AdvancedSettingsDialog.java +++ b/src/main/java/com/salesforce/dataloader/ui/AdvancedSettingsDialog.java @@ -274,14 +274,14 @@ protected void createContents(final Shell shell) { restComp.setLayout(layout); // Hide welcome screen - createLink(restComp, null, null, AppConfig.HIDE_WELCOME_SCREEN); + createLink(restComp, null, null, AppConfig.PROP_HIDE_WELCOME_SCREEN); buttonShowWelcomeScreen = new Button(restComp, SWT.CHECK); - buttonShowWelcomeScreen.setSelection(!appConfig.getBoolean(AppConfig.HIDE_WELCOME_SCREEN)); + buttonShowWelcomeScreen.setSelection(!appConfig.getBoolean(AppConfig.PROP_HIDE_WELCOME_SCREEN)); // Hide welcome screen - createLink(restComp, null, null, AppConfig.SHOW_LOADER_UPGRADE_SCREEN); + createLink(restComp, null, null, AppConfig.PROP_SHOW_LOADER_UPGRADE_SCREEN); buttonShowLoaderUpgradeScreen = new Button(restComp, SWT.CHECK); - buttonShowLoaderUpgradeScreen.setSelection(appConfig.getBoolean(AppConfig.SHOW_LOADER_UPGRADE_SCREEN)); + buttonShowLoaderUpgradeScreen.setSelection(appConfig.getBoolean(AppConfig.PROP_SHOW_LOADER_UPGRADE_SCREEN)); blank = new Label(restComp, SWT.NONE); data = new GridData(); @@ -306,13 +306,13 @@ protected void createContents(final Shell shell) { apiChoiceComposite.setLayoutData(data); // Enable Bulk API Setting - useBulkAPI = appConfig.getBoolean(AppConfig.BULK_API_ENABLED) && !appConfig.getBoolean(AppConfig.BULKV2_API_ENABLED); - useBulkV2API = appConfig.getBoolean(AppConfig.BULKV2_API_ENABLED); + useBulkAPI = appConfig.getBoolean(AppConfig.PROP_BULK_API_ENABLED) && !appConfig.getBoolean(AppConfig.PROP_BULKV2_API_ENABLED); + useBulkV2API = appConfig.getBoolean(AppConfig.PROP_BULKV2_API_ENABLED); useSoapAPI = !useBulkAPI && !useBulkV2API; buttonUseSOAPApi = new Button(apiChoiceComposite, SWT.RADIO); buttonUseSOAPApi.setToolTipText(Labels.getFormattedString("AdvancedSettingsDialog.uiTooltip.useSOAPApi", - new String[] {AppConfig.BULK_API_ENABLED, AppConfig.BULKV2_API_ENABLED})); + new String[] {AppConfig.PROP_BULK_API_ENABLED, AppConfig.PROP_BULKV2_API_ENABLED})); buttonUseSOAPApi.setSelection(useSoapAPI); buttonUseSOAPApi.setText(Labels.getString("AdvancedSettingsDialog.uiLabel.useSOAPApi")); data = new GridData(GridData.HORIZONTAL_ALIGN_END); @@ -343,7 +343,7 @@ public void widgetSelected(SelectionEvent e) { buttonUseBulkV1Api = new Button(apiChoiceComposite, SWT.RADIO); buttonUseBulkV1Api.setToolTipText(Labels.getFormattedString("AdvancedSettingsDialog.uiTooltip.useBulkV1Api", - new String[] {AppConfig.BULK_API_ENABLED, AppConfig.BULKV2_API_ENABLED})); + new String[] {AppConfig.PROP_BULK_API_ENABLED, AppConfig.PROP_BULKV2_API_ENABLED})); buttonUseBulkV1Api.setSelection(useBulkAPI); buttonUseBulkV1Api.setText(Labels.getString("AdvancedSettingsDialog.uiLabel.useBulkV1Api")); data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER); @@ -375,7 +375,7 @@ public void widgetSelected(SelectionEvent e) { // Enable Bulk API 2.0 Setting buttonUseBulkV2Api = new Button(apiChoiceComposite, SWT.RADIO); buttonUseBulkV2Api.setToolTipText(Labels.getFormattedString("AdvancedSettingsDialog.uiTooltip.useBulkV2Api", - new String[] {AppConfig.BULK_API_ENABLED, AppConfig.BULKV2_API_ENABLED})); + new String[] {AppConfig.PROP_BULK_API_ENABLED, AppConfig.PROP_BULKV2_API_ENABLED})); buttonUseBulkV2Api.setSelection(useBulkV2API); buttonUseBulkV2Api.setText(Labels.getString("AdvancedSettingsDialog.uiLabel.useBulkV2Api")); data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); @@ -415,8 +415,8 @@ public void widgetSelected(SelectionEvent e) { layout.verticalSpacing = 10; this.soapApiOptionsComposite.setLayout(layout); - createLink(soapApiOptionsComposite, null, null, AppConfig.PROCESS_KEEP_ACCOUNT_TEAM); - boolean keepAccountTeam = appConfig.getBoolean(AppConfig.PROCESS_KEEP_ACCOUNT_TEAM); + createLink(soapApiOptionsComposite, null, null, AppConfig.PROP_PROCESS_KEEP_ACCOUNT_TEAM); + boolean keepAccountTeam = appConfig.getBoolean(AppConfig.PROP_PROCESS_KEEP_ACCOUNT_TEAM); buttonKeepAccountTeam = new Button(this.soapApiOptionsComposite, SWT.CHECK); buttonKeepAccountTeam.setSelection(keepAccountTeam); data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); @@ -425,8 +425,8 @@ public void widgetSelected(SelectionEvent e) { buttonKeepAccountTeam.setToolTipText(Labels.getString("AdvancedSettingsDialog.TooltipKeepAccountTeam")); // update using external id - labelUpdateWithExternalId = createLabel(soapApiOptionsComposite, null, null, AppConfig.UPDATE_WITH_EXTERNALID); - boolean updateWithExternalId = appConfig.getBoolean(AppConfig.UPDATE_WITH_EXTERNALID); + labelUpdateWithExternalId = createLabel(soapApiOptionsComposite, null, null, AppConfig.PROP_UPDATE_WITH_EXTERNALID); + boolean updateWithExternalId = appConfig.getBoolean(AppConfig.PROP_UPDATE_WITH_EXTERNALID); buttonUpdateWithExternalId = new Button(this.soapApiOptionsComposite, SWT.CHECK); buttonUpdateWithExternalId.setSelection(updateWithExternalId); data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); @@ -441,25 +441,25 @@ public void widgetSelected(SelectionEvent e) { }); //insert Nulls - labelNulls = createLabel(soapApiOptionsComposite, null, null, AppConfig.INSERT_NULLS); + labelNulls = createLabel(soapApiOptionsComposite, null, null, AppConfig.PROP_INSERT_NULLS); buttonNulls = new Button(this.soapApiOptionsComposite, SWT.CHECK); - buttonNulls.setSelection(appConfig.getBoolean(AppConfig.INSERT_NULLS)); + buttonNulls.setSelection(appConfig.getBoolean(AppConfig.PROP_INSERT_NULLS)); //Field truncation - labelTruncateFields = createLabel(soapApiOptionsComposite, null, null, AppConfig.TRUNCATE_FIELDS); + labelTruncateFields = createLabel(soapApiOptionsComposite, null, null, AppConfig.PROP_TRUNCATE_FIELDS); buttonTruncateFields = new Button(this.soapApiOptionsComposite, SWT.CHECK); - buttonTruncateFields.setSelection(appConfig.getBoolean(AppConfig.TRUNCATE_FIELDS)); + buttonTruncateFields.setSelection(appConfig.getBoolean(AppConfig.PROP_TRUNCATE_FIELDS)); //insert compression - createLabel(soapApiOptionsComposite, null, null, AppConfig.NO_COMPRESSION); + createLabel(soapApiOptionsComposite, null, null, AppConfig.PROP_NO_COMPRESSION); buttonCompression = new Button(soapApiOptionsComposite, SWT.CHECK); - buttonCompression.setSelection(appConfig.getBoolean(AppConfig.NO_COMPRESSION)); + buttonCompression.setSelection(appConfig.getBoolean(AppConfig.PROP_NO_COMPRESSION)); buttonCompression.setToolTipText(Labels.getString("AdvancedSettingsDialog.TooltipCompression")); //timeout size - createLabel(soapApiOptionsComposite, null, null, AppConfig.TIMEOUT_SECS); + createLabel(soapApiOptionsComposite, null, null, AppConfig.PROP_TIMEOUT_SECS); textTimeout = new Text(soapApiOptionsComposite, SWT.BORDER); - textTimeout.setText(appConfig.getString(AppConfig.TIMEOUT_SECS)); + textTimeout.setText(appConfig.getString(AppConfig.PROP_TIMEOUT_SECS)); textTimeout.addVerifyListener(new VerifyListener() { @Override public void verifyText(VerifyEvent event) { @@ -485,9 +485,9 @@ public void verifyText(VerifyEvent event) { layout.verticalSpacing = 10; this.bulkApiOptionsComposite.setLayout(layout); - createLink(bulkApiOptionsComposite, null, null, AppConfig.BULK_API_SERIAL_MODE); + createLink(bulkApiOptionsComposite, null, null, AppConfig.PROP_BULK_API_SERIAL_MODE); buttonBulkApiSerialMode = new Button(this.bulkApiOptionsComposite, SWT.CHECK); - buttonBulkApiSerialMode.setSelection(appConfig.getBoolean(AppConfig.BULK_API_SERIAL_MODE)); + buttonBulkApiSerialMode.setSelection(appConfig.getBoolean(AppConfig.PROP_BULK_API_SERIAL_MODE)); data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); data.grabExcessHorizontalSpace = true; buttonBulkApiSerialMode.setLayoutData(data); @@ -502,9 +502,9 @@ public void verifyText(VerifyEvent event) { layout.verticalSpacing = 10; this.zipContentComposite.setLayout(layout); - createLink(zipContentComposite, null, null, AppConfig.BULK_API_ZIP_CONTENT); + createLink(zipContentComposite, null, null, AppConfig.PROP_BULK_API_ZIP_CONTENT); buttonBulkApiZipContent = new Button(zipContentComposite, SWT.CHECK); - buttonBulkApiZipContent.setSelection(appConfig.getBoolean(AppConfig.BULK_API_ZIP_CONTENT)); + buttonBulkApiZipContent.setSelection(appConfig.getBoolean(AppConfig.PROP_BULK_API_ZIP_CONTENT)); data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); data.grabExcessHorizontalSpace = true; buttonBulkApiZipContent.setLayoutData(data); @@ -521,7 +521,7 @@ public void verifyText(VerifyEvent event) { String[] args = {getImportBatchLimitsURL(), Integer.toString(appConfig.getMaxImportBatchSize(useBulkAPI || useBulkV2API, useBulkV2API))}; - labelImportBatchSize = createLink(importBatchSizeComposite, null, args, AppConfig.IMPORT_BATCH_SIZE); + labelImportBatchSize = createLink(importBatchSizeComposite, null, args, AppConfig.PROP_IMPORT_BATCH_SIZE); textImportBatchSize = new Text(importBatchSizeComposite, SWT.BORDER); textImportBatchSize.setText(Integer.toString(appConfig.getImportBatchSize())); textImportBatchSize.setEnabled(!useBulkV2API); @@ -548,9 +548,9 @@ public void verifyText(VerifyEvent event) { args = new String[]{Integer.toString(AppConfig.MIN_EXPORT_BATCH_SIZE), Integer.toString(AppConfig.MAX_EXPORT_BATCH_SIZE)}; - createLink(exportBatchSizeComposite, null, args, AppConfig.EXPORT_BATCH_SIZE); + createLink(exportBatchSizeComposite, null, args, AppConfig.PROP_EXPORT_BATCH_SIZE); textExportBatchSize = new Text(exportBatchSizeComposite, SWT.BORDER); - textExportBatchSize.setText(appConfig.getString(AppConfig.EXPORT_BATCH_SIZE)); + textExportBatchSize.setText(appConfig.getString(AppConfig.PROP_EXPORT_BATCH_SIZE)); textExportBatchSize.addVerifyListener(new VerifyListener() { @Override public void verifyText(VerifyEvent event) { @@ -589,91 +589,91 @@ public void verifyText(VerifyEvent event) { blank.setLayoutData(data); //assignment rules - createLink(restComp, null, null, AppConfig.ASSIGNMENT_RULE); + createLink(restComp, null, null, AppConfig.PROP_ASSIGNMENT_RULE); textRule = new Text(restComp, SWT.BORDER); data = new GridData(); textRule.setTextLimit(18); data.widthHint = 18 * textSize.x; textRule.setLayoutData(data); - textRule.setText(appConfig.getString(AppConfig.ASSIGNMENT_RULE)); + textRule.setText(appConfig.getString(AppConfig.PROP_ASSIGNMENT_RULE)); textRule.setToolTipText(Labels.getString("AdvancedSettingsDialog.TooltipAssignmentRule")); //endpoints - createLink(restComp, null, null, AppConfig.AUTH_ENDPOINT_PROD); + createLink(restComp, null, null, AppConfig.PROP_AUTH_ENDPOINT_PROD); textProdEndpoint = new Text(restComp, SWT.BORDER); data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = 30 * textSize.x; textProdEndpoint.setLayoutData(data); - String endpoint = appConfig.getString(AppConfig.AUTH_ENDPOINT_PROD); + String endpoint = appConfig.getString(AppConfig.PROP_AUTH_ENDPOINT_PROD); if ("".equals(endpoint)) { //$NON-NLS-1$ endpoint = AppConfig.DEFAULT_ENDPOINT_URL_PROD; } textProdEndpoint.setText(endpoint); - createLink(restComp, null, null, AppConfig.AUTH_ENDPOINT_SANDBOX); + createLink(restComp, null, null, AppConfig.PROP_AUTH_ENDPOINT_SANDBOX); textSBEndpoint = new Text(restComp, SWT.BORDER); data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = 30 * textSize.x; textSBEndpoint.setLayoutData(data); - endpoint = appConfig.getString(AppConfig.AUTH_ENDPOINT_SANDBOX); + endpoint = appConfig.getString(AppConfig.PROP_AUTH_ENDPOINT_SANDBOX); if ("".equals(endpoint)) { //$NON-NLS-1$ endpoint = AppConfig.DEFAULT_ENDPOINT_URL_SANDBOX; } textSBEndpoint.setText(endpoint); // enable/disable sort of fields to extract - createLabel(restComp, null, null, AppConfig.SORT_EXTRACT_FIELDS); + createLabel(restComp, null, null, AppConfig.PROP_SORT_EXTRACT_FIELDS); buttonSortExtractFields = new Button(restComp, SWT.CHECK); - buttonSortExtractFields.setSelection(appConfig.getBoolean(AppConfig.SORT_EXTRACT_FIELDS)); + buttonSortExtractFields.setSelection(appConfig.getBoolean(AppConfig.PROP_SORT_EXTRACT_FIELDS)); // enable/disable limiting query result columns to fields specified in the SOQL query - createLabel(restComp, null, null, AppConfig.LIMIT_OUTPUT_TO_QUERY_FIELDS); + createLabel(restComp, null, null, AppConfig.PROP_LIMIT_OUTPUT_TO_QUERY_FIELDS); buttonLimitQueryResultColumnsToFieldsInQuery = new Button(restComp, SWT.CHECK); - buttonLimitQueryResultColumnsToFieldsInQuery.setSelection(appConfig.getBoolean(AppConfig.LIMIT_OUTPUT_TO_QUERY_FIELDS)); + buttonLimitQueryResultColumnsToFieldsInQuery.setSelection(appConfig.getBoolean(AppConfig.PROP_LIMIT_OUTPUT_TO_QUERY_FIELDS)); //enable/disable output of success file for extracts - createLabel(restComp, null, null, AppConfig.ENABLE_EXTRACT_STATUS_OUTPUT); + createLabel(restComp, null, null, AppConfig.PROP_ENABLE_EXTRACT_STATUS_OUTPUT); buttonOutputExtractStatus = new Button(restComp, SWT.CHECK); - buttonOutputExtractStatus.setSelection(appConfig.getBoolean(AppConfig.ENABLE_EXTRACT_STATUS_OUTPUT)); + buttonOutputExtractStatus.setSelection(appConfig.getBoolean(AppConfig.PROP_ENABLE_EXTRACT_STATUS_OUTPUT)); //utf-8 for loading - createLabel(restComp, null, null, AppConfig.READ_UTF8); + createLabel(restComp, null, null, AppConfig.PROP_READ_UTF8); buttonReadUtf8 = new Button(restComp, SWT.CHECK); - buttonReadUtf8.setSelection(appConfig.getBoolean(AppConfig.READ_UTF8)); + buttonReadUtf8.setSelection(appConfig.getBoolean(AppConfig.PROP_READ_UTF8)); //utf-8 for extraction - createLabel(restComp, null, null, AppConfig.WRITE_UTF8); + createLabel(restComp, null, null, AppConfig.PROP_WRITE_UTF8); buttonWriteUtf8 = new Button(restComp, SWT.CHECK); - buttonWriteUtf8.setSelection(appConfig.getBoolean(AppConfig.WRITE_UTF8)); + buttonWriteUtf8.setSelection(appConfig.getBoolean(AppConfig.PROP_WRITE_UTF8)); //European Dates - createLabel(restComp, null, null, AppConfig.EURO_DATES); + createLabel(restComp, null, null, AppConfig.PROP_EURO_DATES); buttonEuroDates = new Button(restComp, SWT.CHECK); - buttonEuroDates.setSelection(appConfig.getBoolean(AppConfig.EURO_DATES)); + buttonEuroDates.setSelection(appConfig.getBoolean(AppConfig.PROP_EURO_DATES)); //format phone fields on the client side - createLabel(restComp, null, null, AppConfig.FORMAT_PHONE_FIELDS); + createLabel(restComp, null, null, AppConfig.PROP_FORMAT_PHONE_FIELDS); buttonFormatPhoneFields = new Button(restComp, SWT.CHECK); - buttonFormatPhoneFields.setSelection(appConfig.getBoolean(AppConfig.FORMAT_PHONE_FIELDS)); + buttonFormatPhoneFields.setSelection(appConfig.getBoolean(AppConfig.PROP_FORMAT_PHONE_FIELDS)); - createLabel(restComp, null, null, AppConfig.CSV_DELIMITER_COMMA); + createLabel(restComp, null, null, AppConfig.PROP_CSV_DELIMITER_COMMA); buttonCsvComma = new Button(restComp, SWT.CHECK); - buttonCsvComma.setSelection(appConfig.getBoolean(AppConfig.CSV_DELIMITER_COMMA)); + buttonCsvComma.setSelection(appConfig.getBoolean(AppConfig.PROP_CSV_DELIMITER_COMMA)); - createLabel(restComp, null, null, AppConfig.CSV_DELIMITER_TAB); + createLabel(restComp, null, null, AppConfig.PROP_CSV_DELIMITER_TAB); buttonCsvTab = new Button(restComp, SWT.CHECK); - buttonCsvTab.setSelection(appConfig.getBoolean(AppConfig.CSV_DELIMITER_TAB)); + buttonCsvTab.setSelection(appConfig.getBoolean(AppConfig.PROP_CSV_DELIMITER_TAB)); - createLabel(restComp, null, null, AppConfig.CSV_DELIMITER_OTHER_VALUE); + createLabel(restComp, null, null, AppConfig.PROP_CSV_DELIMITER_OTHER_VALUE); textUploadCSVDelimiterValue = new Text(restComp, SWT.BORDER); - textUploadCSVDelimiterValue.setText(appConfig.getString(AppConfig.CSV_DELIMITER_OTHER_VALUE)); + textUploadCSVDelimiterValue.setText(appConfig.getString(AppConfig.PROP_CSV_DELIMITER_OTHER_VALUE)); data = new GridData(); data.widthHint = 15 * textSize.x; textUploadCSVDelimiterValue.setLayoutData(data); - createLabel(restComp, null, null, AppConfig.CSV_DELIMITER_FOR_QUERY_RESULTS); + createLabel(restComp, null, null, AppConfig.PROP_CSV_DELIMITER_FOR_QUERY_RESULTS); textQueryResultsDelimiterValue = new Text(restComp, SWT.BORDER); - textQueryResultsDelimiterValue.setText(appConfig.getString(AppConfig.CSV_DELIMITER_FOR_QUERY_RESULTS)); + textQueryResultsDelimiterValue.setText(appConfig.getString(AppConfig.PROP_CSV_DELIMITER_FOR_QUERY_RESULTS)); textQueryResultsDelimiterValue.setTextLimit(1); data = new GridData(); data.widthHint = 5 * textSize.x; @@ -682,14 +682,14 @@ public void verifyText(VerifyEvent event) { // include image data for Rich Text Fields in query results // Config.INCLUDE_RICH_TEXT_FIELD_DATA_IN_QUERY_RESULTS - createLabel(restComp, null, null, AppConfig.INCLUDE_RICH_TEXT_FIELD_DATA_IN_QUERY_RESULTS); - boolean includeRTFBinaryDataInQueryResults = appConfig.getBoolean(AppConfig.INCLUDE_RICH_TEXT_FIELD_DATA_IN_QUERY_RESULTS); + createLabel(restComp, null, null, AppConfig.PROP_INCLUDE_RICH_TEXT_FIELD_DATA_IN_QUERY_RESULTS); + boolean includeRTFBinaryDataInQueryResults = appConfig.getBoolean(AppConfig.PROP_INCLUDE_RICH_TEXT_FIELD_DATA_IN_QUERY_RESULTS); buttonIncludeRTFBinaryDataInQueryResults = new Button(restComp, SWT.CHECK); buttonIncludeRTFBinaryDataInQueryResults.setSelection(includeRTFBinaryDataInQueryResults); // Cache DescribeGlobal results across operations - createLabel(restComp, null, null, AppConfig.CACHE_DESCRIBE_GLOBAL_RESULTS); - boolean cacheDescribeGlobalResults = appConfig.getBoolean(AppConfig.CACHE_DESCRIBE_GLOBAL_RESULTS); + createLabel(restComp, null, null, AppConfig.PROP_CACHE_DESCRIBE_GLOBAL_RESULTS); + boolean cacheDescribeGlobalResults = appConfig.getBoolean(AppConfig.PROP_CACHE_DESCRIBE_GLOBAL_RESULTS); buttonCacheDescribeGlobalResults = new Button(restComp, SWT.CHECK); buttonCacheDescribeGlobalResults.setSelection(cacheDescribeGlobalResults); @@ -704,7 +704,7 @@ public void verifyText(VerifyEvent event) { empty.setLayoutData(data); // timezone - textTimezone = createTimezoneTextInput(restComp, AppConfig.TIMEZONE, TimeZone.getDefault().getID(), 30 * textSize.x); + textTimezone = createTimezoneTextInput(restComp, AppConfig.PROP_TIMEZONE, TimeZone.getDefault().getID(), 30 * textSize.x); empty = new Label(restComp, SWT.NONE); data = new GridData(); @@ -712,16 +712,16 @@ public void verifyText(VerifyEvent event) { empty.setLayoutData(data); // proxy Host - createLabel(restComp, null, null, AppConfig.PROXY_HOST); + createLabel(restComp, null, null, AppConfig.PROP_PROXY_HOST); textProxyHost = new Text(restComp, SWT.BORDER); - textProxyHost.setText(appConfig.getString(AppConfig.PROXY_HOST)); + textProxyHost.setText(appConfig.getString(AppConfig.PROP_PROXY_HOST)); data = new GridData(GridData.FILL_HORIZONTAL); textProxyHost.setLayoutData(data); //Proxy Port - createLabel(restComp, null, null, AppConfig.PROXY_PORT); + createLabel(restComp, null, null, AppConfig.PROP_PROXY_PORT); textProxyPort = new Text(restComp, SWT.BORDER); - textProxyPort.setText(appConfig.getString(AppConfig.PROXY_PORT)); + textProxyPort.setText(appConfig.getString(AppConfig.PROP_PROXY_PORT)); textProxyPort.addVerifyListener(new VerifyListener() { @Override public void verifyText(VerifyEvent event) { @@ -734,25 +734,25 @@ public void verifyText(VerifyEvent event) { textProxyPort.setLayoutData(data); //Proxy Username - createLabel(restComp, null, null, AppConfig.PROXY_USERNAME); + createLabel(restComp, null, null, AppConfig.PROP_PROXY_USERNAME); textProxyUsername = new Text(restComp, SWT.BORDER); - textProxyUsername.setText(appConfig.getString(AppConfig.PROXY_USERNAME)); + textProxyUsername.setText(appConfig.getString(AppConfig.PROP_PROXY_USERNAME)); data = new GridData(); data.widthHint = 20 * textSize.x; textProxyUsername.setLayoutData(data); //Proxy Password - createLabel(restComp, null, null, AppConfig.PROXY_PASSWORD); + createLabel(restComp, null, null, AppConfig.PROP_PROXY_PASSWORD); textProxyPassword = new Text(restComp, SWT.BORDER | SWT.PASSWORD); - textProxyPassword.setText(appConfig.getString(AppConfig.PROXY_PASSWORD)); + textProxyPassword.setText(appConfig.getString(AppConfig.PROP_PROXY_PASSWORD)); data = new GridData(); data.widthHint = 20 * textSize.x; textProxyPassword.setLayoutData(data); //proxy NTLM domain - createLabel(restComp, null, null, AppConfig.PROXY_NTLM_DOMAIN); + createLabel(restComp, null, null, AppConfig.PROP_PROXY_NTLM_DOMAIN); textProxyNtlmDomain = new Text(restComp, SWT.BORDER); - textProxyNtlmDomain.setText(appConfig.getString(AppConfig.PROXY_NTLM_DOMAIN)); + textProxyNtlmDomain.setText(appConfig.getString(AppConfig.PROP_PROXY_NTLM_DOMAIN)); data = new GridData(GridData.FILL_HORIZONTAL); textProxyNtlmDomain.setLayoutData(data); @@ -761,8 +761,8 @@ public void verifyText(VerifyEvent event) { data.horizontalSpan = 2; empty.setLayoutData(data); - createLabel(restComp, null, null, AppConfig.OAUTH_LOGIN_FROM_BROWSER); - boolean doLoginFromBrowser = appConfig.getBoolean(AppConfig.OAUTH_LOGIN_FROM_BROWSER); + createLabel(restComp, null, null, AppConfig.PROP_OAUTH_LOGIN_FROM_BROWSER); + boolean doLoginFromBrowser = appConfig.getBoolean(AppConfig.PROP_OAUTH_LOGIN_FROM_BROWSER); buttonLoginFromBrowser = new Button(restComp, SWT.CHECK); buttonLoginFromBrowser.setSelection(doLoginFromBrowser); @@ -810,8 +810,8 @@ public void verifyText(VerifyEvent event) { lastBatch = "0"; //$NON-NLS-1$ } - Text labelRowToStart = createLabel(restComp, null, null, AppConfig.LOAD_ROW_TO_START_AT); - labelRowToStart.setText(Labels.getString("AdvancedSettingsDialog.uiLabel." + AppConfig.LOAD_ROW_TO_START_AT) + Text labelRowToStart = createLabel(restComp, null, null, AppConfig.PROP_LOAD_ROW_TO_START_AT); + labelRowToStart.setText(Labels.getString("AdvancedSettingsDialog.uiLabel." + AppConfig.PROP_LOAD_ROW_TO_START_AT) + "\n(" + Labels.getFormattedString("AdvancedSettingsDialog.uiLabel.lastBatch", lastBatch) + ")"); //$NON-NLS-1$ @@ -819,7 +819,7 @@ public void verifyText(VerifyEvent event) { labelRowToStart.setLayoutData(data); textRowToStart = new Text(restComp, SWT.BORDER); - textRowToStart.setText(appConfig.getString(AppConfig.LOAD_ROW_TO_START_AT)); + textRowToStart.setText(appConfig.getString(AppConfig.PROP_LOAD_ROW_TO_START_AT)); data = new GridData(); textRowToStart.setTextLimit(15); data.widthHint = 15 * textSize.x; @@ -978,10 +978,10 @@ public void widgetSelected(SelectionEvent event) { } //set the configValues - appConfig.setValue(AppConfig.HIDE_WELCOME_SCREEN, !buttonShowWelcomeScreen.getSelection()); - appConfig.setValue(AppConfig.SHOW_LOADER_UPGRADE_SCREEN, buttonShowLoaderUpgradeScreen.getSelection()); - appConfig.setValue(AppConfig.INSERT_NULLS, buttonNulls.getSelection()); - appConfig.setValue(AppConfig.IMPORT_BATCH_SIZE, textImportBatchSize.getText()); + appConfig.setValue(AppConfig.PROP_HIDE_WELCOME_SCREEN, !buttonShowWelcomeScreen.getSelection()); + appConfig.setValue(AppConfig.PROP_SHOW_LOADER_UPGRADE_SCREEN, buttonShowLoaderUpgradeScreen.getSelection()); + appConfig.setValue(AppConfig.PROP_INSERT_NULLS, buttonNulls.getSelection()); + appConfig.setValue(AppConfig.PROP_IMPORT_BATCH_SIZE, textImportBatchSize.getText()); boolean isOtherDelimiterSpecified = textUploadCSVDelimiterValue.getText() != null && textUploadCSVDelimiterValue.getText().length() != 0; if (!buttonCsvComma.getSelection() @@ -993,49 +993,49 @@ public void widgetSelected(SelectionEvent event) { alert.open(); return; } - appConfig.setValue(AppConfig.CSV_DELIMITER_OTHER_VALUE, textUploadCSVDelimiterValue.getText()); + appConfig.setValue(AppConfig.PROP_CSV_DELIMITER_OTHER_VALUE, textUploadCSVDelimiterValue.getText()); String queryResultsDelimiterStr = textQueryResultsDelimiterValue.getText(); if (queryResultsDelimiterStr.length() == 0) { queryResultsDelimiterStr = AppUtil.COMMA; // set to default } - appConfig.setValue(AppConfig.CSV_DELIMITER_FOR_QUERY_RESULTS, queryResultsDelimiterStr); - appConfig.setValue(AppConfig.CSV_DELIMITER_COMMA, buttonCsvComma.getSelection()); - appConfig.setValue(AppConfig.CSV_DELIMITER_TAB, buttonCsvTab.getSelection()); - appConfig.setValue(AppConfig.CSV_DELIMITER_OTHER, isOtherDelimiterSpecified); + appConfig.setValue(AppConfig.PROP_CSV_DELIMITER_FOR_QUERY_RESULTS, queryResultsDelimiterStr); + appConfig.setValue(AppConfig.PROP_CSV_DELIMITER_COMMA, buttonCsvComma.getSelection()); + appConfig.setValue(AppConfig.PROP_CSV_DELIMITER_TAB, buttonCsvTab.getSelection()); + appConfig.setValue(AppConfig.PROP_CSV_DELIMITER_OTHER, isOtherDelimiterSpecified); - appConfig.setValue(AppConfig.EXPORT_BATCH_SIZE, textExportBatchSize.getText()); + appConfig.setValue(AppConfig.PROP_EXPORT_BATCH_SIZE, textExportBatchSize.getText()); appConfig.setAuthEndpointForEnv(currentTextProdEndpoint, AppConfig.PROD_ENVIRONMENT_VAL); appConfig.setAuthEndpointForEnv(currentTextSBEndpoint, AppConfig.SB_ENVIRONMENT_VAL); - appConfig.setValue(AppConfig.ASSIGNMENT_RULE, textRule.getText()); - appConfig.setValue(AppConfig.LOAD_ROW_TO_START_AT, textRowToStart.getText()); - appConfig.setValue(AppConfig.NO_COMPRESSION, buttonCompression.getSelection()); - appConfig.setValue(AppConfig.TRUNCATE_FIELDS, buttonTruncateFields.getSelection()); - appConfig.setValue(AppConfig.FORMAT_PHONE_FIELDS, buttonFormatPhoneFields.getSelection()); - appConfig.setValue(AppConfig.TIMEOUT_SECS, textTimeout.getText()); - appConfig.setValue(AppConfig.SORT_EXTRACT_FIELDS, buttonSortExtractFields.getSelection()); - appConfig.setValue(AppConfig.LIMIT_OUTPUT_TO_QUERY_FIELDS, buttonLimitQueryResultColumnsToFieldsInQuery.getSelection()); - appConfig.setValue(AppConfig.ENABLE_EXTRACT_STATUS_OUTPUT, buttonOutputExtractStatus.getSelection()); - appConfig.setValue(AppConfig.READ_UTF8, buttonReadUtf8.getSelection()); - appConfig.setValue(AppConfig.WRITE_UTF8, buttonWriteUtf8.getSelection()); - appConfig.setValue(AppConfig.EURO_DATES, buttonEuroDates.getSelection()); - appConfig.setValue(AppConfig.TIMEZONE, textTimezone.getText()); - appConfig.setValue(AppConfig.PROXY_HOST, textProxyHost.getText()); - appConfig.setValue(AppConfig.PROXY_PASSWORD, textProxyPassword.getText()); - appConfig.setValue(AppConfig.PROXY_PORT, textProxyPort.getText()); - appConfig.setValue(AppConfig.PROXY_USERNAME, textProxyUsername.getText()); - appConfig.setValue(AppConfig.PROXY_NTLM_DOMAIN, textProxyNtlmDomain.getText()); - appConfig.setValue(AppConfig.PROCESS_KEEP_ACCOUNT_TEAM, buttonKeepAccountTeam.getSelection()); - appConfig.setValue(AppConfig.UPDATE_WITH_EXTERNALID, buttonUpdateWithExternalId.getSelection()); - appConfig.setValue(AppConfig.CACHE_DESCRIBE_GLOBAL_RESULTS, buttonCacheDescribeGlobalResults.getSelection()); - appConfig.setValue(AppConfig.INCLUDE_RICH_TEXT_FIELD_DATA_IN_QUERY_RESULTS, buttonIncludeRTFBinaryDataInQueryResults.getSelection()); + appConfig.setValue(AppConfig.PROP_ASSIGNMENT_RULE, textRule.getText()); + appConfig.setValue(AppConfig.PROP_LOAD_ROW_TO_START_AT, textRowToStart.getText()); + appConfig.setValue(AppConfig.PROP_NO_COMPRESSION, buttonCompression.getSelection()); + appConfig.setValue(AppConfig.PROP_TRUNCATE_FIELDS, buttonTruncateFields.getSelection()); + appConfig.setValue(AppConfig.PROP_FORMAT_PHONE_FIELDS, buttonFormatPhoneFields.getSelection()); + appConfig.setValue(AppConfig.PROP_TIMEOUT_SECS, textTimeout.getText()); + appConfig.setValue(AppConfig.PROP_SORT_EXTRACT_FIELDS, buttonSortExtractFields.getSelection()); + appConfig.setValue(AppConfig.PROP_LIMIT_OUTPUT_TO_QUERY_FIELDS, buttonLimitQueryResultColumnsToFieldsInQuery.getSelection()); + appConfig.setValue(AppConfig.PROP_ENABLE_EXTRACT_STATUS_OUTPUT, buttonOutputExtractStatus.getSelection()); + appConfig.setValue(AppConfig.PROP_READ_UTF8, buttonReadUtf8.getSelection()); + appConfig.setValue(AppConfig.PROP_WRITE_UTF8, buttonWriteUtf8.getSelection()); + appConfig.setValue(AppConfig.PROP_EURO_DATES, buttonEuroDates.getSelection()); + appConfig.setValue(AppConfig.PROP_TIMEZONE, textTimezone.getText()); + appConfig.setValue(AppConfig.PROP_PROXY_HOST, textProxyHost.getText()); + appConfig.setValue(AppConfig.PROP_PROXY_PASSWORD, textProxyPassword.getText()); + appConfig.setValue(AppConfig.PROP_PROXY_PORT, textProxyPort.getText()); + appConfig.setValue(AppConfig.PROP_PROXY_USERNAME, textProxyUsername.getText()); + appConfig.setValue(AppConfig.PROP_PROXY_NTLM_DOMAIN, textProxyNtlmDomain.getText()); + appConfig.setValue(AppConfig.PROP_PROCESS_KEEP_ACCOUNT_TEAM, buttonKeepAccountTeam.getSelection()); + appConfig.setValue(AppConfig.PROP_UPDATE_WITH_EXTERNALID, buttonUpdateWithExternalId.getSelection()); + appConfig.setValue(AppConfig.PROP_CACHE_DESCRIBE_GLOBAL_RESULTS, buttonCacheDescribeGlobalResults.getSelection()); + appConfig.setValue(AppConfig.PROP_INCLUDE_RICH_TEXT_FIELD_DATA_IN_QUERY_RESULTS, buttonIncludeRTFBinaryDataInQueryResults.getSelection()); // Config requires Bulk API AND Bulk V2 API settings enabled to use Bulk V2 features // This is different from UI. UI shows them as mutually exclusive. - appConfig.setValue(AppConfig.BULK_API_ENABLED, buttonUseBulkV1Api.getSelection()); - appConfig.setValue(AppConfig.BULK_API_SERIAL_MODE, buttonBulkApiSerialMode.getSelection()); - appConfig.setValue(AppConfig.BULK_API_ZIP_CONTENT, buttonBulkApiZipContent.getSelection()); - appConfig.setValue(AppConfig.BULKV2_API_ENABLED, buttonUseBulkV2Api.getSelection()); - appConfig.setValue(AppConfig.OAUTH_LOGIN_FROM_BROWSER, buttonLoginFromBrowser.getSelection()); + appConfig.setValue(AppConfig.PROP_BULK_API_ENABLED, buttonUseBulkV1Api.getSelection()); + appConfig.setValue(AppConfig.PROP_BULK_API_SERIAL_MODE, buttonBulkApiSerialMode.getSelection()); + appConfig.setValue(AppConfig.PROP_BULK_API_ZIP_CONTENT, buttonBulkApiZipContent.getSelection()); + appConfig.setValue(AppConfig.PROP_BULKV2_API_ENABLED, buttonUseBulkV2Api.getSelection()); + appConfig.setValue(AppConfig.PROP_OAUTH_LOGIN_FROM_BROWSER, buttonLoginFromBrowser.getSelection()); appConfig.setValue(AppConfig.WIZARD_CLOSE_ON_FINISH, buttonCloseWizardOnFinish.getSelection()); appConfig.setValue(AppConfig.WIZARD_WIDTH, textWizardWidth.getText()); appConfig.setValue(AppConfig.WIZARD_HEIGHT, textWizardHeight.getText()); diff --git a/src/main/java/com/salesforce/dataloader/ui/AuthenticationRunner.java b/src/main/java/com/salesforce/dataloader/ui/AuthenticationRunner.java index e33dc828..5076006d 100644 --- a/src/main/java/com/salesforce/dataloader/ui/AuthenticationRunner.java +++ b/src/main/java/com/salesforce/dataloader/ui/AuthenticationRunner.java @@ -90,7 +90,7 @@ private void loginAsync(){ authStatusChangeConsumer.accept(Labels.getString("LoginPage.verifyingLogin")); logger.info(Labels.getString("LoginPage.verifyingLogin")); if (criteria.getMode() == LoginCriteria.OAuthLogin){ - if (appConfig.getBoolean(AppConfig.OAUTH_LOGIN_FROM_BROWSER)) { + if (appConfig.getBoolean(AppConfig.PROP_OAUTH_LOGIN_FROM_BROWSER)) { OAuthLoginFromBrowserFlow flow = new OAuthLoginFromBrowserFlow(shell, appConfig); if (!flow.open()) { String message = Labels.getString("LoginPage.invalidLoginOAuthBrowser"); @@ -98,7 +98,7 @@ private void loginAsync(){ return; } } else { // OAuth login from Data Loader app - boolean hasSecret = !appConfig.getString(AppConfig.OAUTH_CLIENTSECRET).trim().equals(""); + boolean hasSecret = !appConfig.getString(AppConfig.PROP_OAUTH_CLIENTSECRET).trim().equals(""); OAuthFlow flow = hasSecret ? new OAuthSecretFlow(shell, appConfig) : new OAuthTokenFlow(shell, appConfig); if (!flow.open()) { String message = Labels.getString("LoginPage.invalidLoginOAuth"); diff --git a/src/main/java/com/salesforce/dataloader/ui/BaseWizard.java b/src/main/java/com/salesforce/dataloader/ui/BaseWizard.java index 67c8f26e..5d05360d 100644 --- a/src/main/java/com/salesforce/dataloader/ui/BaseWizard.java +++ b/src/main/java/com/salesforce/dataloader/ui/BaseWizard.java @@ -40,7 +40,7 @@ public abstract class BaseWizard extends Wizard { protected BaseWizard(Controller ctl, OperationInfo info) { this.controller = ctl; - getConfig().setValue(AppConfig.OPERATION, info.name()); + getConfig().setValue(AppConfig.PROP_OPERATION, info.name()); this.finishPage = setupPages(); // Set the dialog window title setWindowTitle(getLabel("windowTitle")); diff --git a/src/main/java/com/salesforce/dataloader/ui/CSVChooserDialog.java b/src/main/java/com/salesforce/dataloader/ui/CSVChooserDialog.java index 33d9d8f5..d39720a7 100644 --- a/src/main/java/com/salesforce/dataloader/ui/CSVChooserDialog.java +++ b/src/main/java/com/salesforce/dataloader/ui/CSVChooserDialog.java @@ -172,7 +172,7 @@ public void widgetSelected(SelectionEvent event) { buttonSuccess.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - String successFilePath = getController().getAppConfig().getString(AppConfig.OUTPUT_SUCCESS); + String successFilePath = getController().getAppConfig().getString(AppConfig.PROP_OUTPUT_SUCCESS); if(StringUtils.hasText(successFilePath)) { openViewer(successFilePath, true, false); } else { @@ -191,7 +191,7 @@ public void widgetSelected(SelectionEvent event) { buttonError.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - String errorFilePath = getController().getAppConfig().getString(AppConfig.OUTPUT_ERROR); + String errorFilePath = getController().getAppConfig().getString(AppConfig.PROP_OUTPUT_ERROR); if(StringUtils.hasText(errorFilePath)) { openViewer(errorFilePath, true, false); } else { diff --git a/src/main/java/com/salesforce/dataloader/ui/ChooseLookupFieldForRelationshipPage.java b/src/main/java/com/salesforce/dataloader/ui/ChooseLookupFieldForRelationshipPage.java index d41badb0..e052ae74 100644 --- a/src/main/java/com/salesforce/dataloader/ui/ChooseLookupFieldForRelationshipPage.java +++ b/src/main/java/com/salesforce/dataloader/ui/ChooseLookupFieldForRelationshipPage.java @@ -381,7 +381,7 @@ protected OperationPage getPreviousPageOverride(){ public boolean setupPage() { boolean success = super.setupPage(); if (this.controller != null && this.controller.isLoggedIn()) { - String message = Labels.getFormattedString(this.getClass().getSimpleName() + ".pageMessage", this.controller.getAppConfig().getString(AppConfig.ENTITY)); + String message = Labels.getFormattedString(this.getClass().getSimpleName() + ".pageMessage", this.controller.getAppConfig().getString(AppConfig.PROP_ENTITY)); this.setMessage(message); } return success; diff --git a/src/main/java/com/salesforce/dataloader/ui/ContentLimitLink.java b/src/main/java/com/salesforce/dataloader/ui/ContentLimitLink.java index a3bcaf44..63a89b16 100644 --- a/src/main/java/com/salesforce/dataloader/ui/ContentLimitLink.java +++ b/src/main/java/com/salesforce/dataloader/ui/ContentLimitLink.java @@ -71,9 +71,9 @@ public void handleEvent(Event e) { public void setVisible() { AppConfig appConfig = controller.getAppConfig(); - String operation = appConfig.getString(AppConfig.OPERATION); + String operation = appConfig.getString(AppConfig.PROP_OPERATION); boolean isVisible = AppUtil.isContentSObject( - appConfig.getString(AppConfig.ENTITY)) + appConfig.getString(AppConfig.PROP_ENTITY)) && operation != null && ("insert".equalsIgnoreCase(operation) || "update".equalsIgnoreCase(operation) diff --git a/src/main/java/com/salesforce/dataloader/ui/DataSelectionDialog.java b/src/main/java/com/salesforce/dataloader/ui/DataSelectionDialog.java index 7addcd3a..d52acaf5 100644 --- a/src/main/java/com/salesforce/dataloader/ui/DataSelectionDialog.java +++ b/src/main/java/com/salesforce/dataloader/ui/DataSelectionDialog.java @@ -65,14 +65,14 @@ public DataSelectionDialog(Shell parent, Controller controller, String daoNameSt super(parent, controller); this.daoNameStr = daoNameStr; this.sObjectName = sObjectName; - if (controller.getAppConfig().getBoolean(AppConfig.CSV_DELIMITER_COMMA)) { + if (controller.getAppConfig().getBoolean(AppConfig.PROP_CSV_DELIMITER_COMMA)) { this.delimiterList = " ','"; } - if (controller.getAppConfig().getBoolean(AppConfig.CSV_DELIMITER_TAB)) { + if (controller.getAppConfig().getBoolean(AppConfig.PROP_CSV_DELIMITER_TAB)) { this.delimiterList += " ''"; } - if (controller.getAppConfig().getBoolean(AppConfig.CSV_DELIMITER_OTHER)) { - String otherDelimiters = controller.getAppConfig().getString(AppConfig.CSV_DELIMITER_OTHER_VALUE); + if (controller.getAppConfig().getBoolean(AppConfig.PROP_CSV_DELIMITER_OTHER)) { + String otherDelimiters = controller.getAppConfig().getString(AppConfig.PROP_CSV_DELIMITER_OTHER_VALUE); for (char c : otherDelimiters.toCharArray()) { this.delimiterList += " '" + c + "'"; } @@ -108,7 +108,7 @@ protected void processingWithBusyIndicator(Shell shell) { return; } - String daoPath = getController().getAppConfig().getString(AppConfig.DAO_NAME); + String daoPath = getController().getAppConfig().getString(AppConfig.PROP_DAO_NAME); File file = new File(daoPath); if (!file.exists() || !file.canRead()) { @@ -171,7 +171,7 @@ protected void processingWithBusyIndicator(Shell shell) { + "\n" + Labels.getString("AdvancedSettingsDialog.startRow") + " " - + getController().getAppConfig().getString(AppConfig.LOAD_ROW_TO_START_AT) + + getController().getAppConfig().getString(AppConfig.PROP_LOAD_ROW_TO_START_AT) + "\n" + apiInfoStr ); //$NON-NLS-1$ diff --git a/src/main/java/com/salesforce/dataloader/ui/ExternalIdPage.java b/src/main/java/com/salesforce/dataloader/ui/ExternalIdPage.java index 1d7da48e..5d862479 100644 --- a/src/main/java/com/salesforce/dataloader/ui/ExternalIdPage.java +++ b/src/main/java/com/salesforce/dataloader/ui/ExternalIdPage.java @@ -117,7 +117,7 @@ public boolean setExtIdCombo() { extIdFieldCombo.setEnabled(true); // entity is known at this time, set the correct combo label - labelExtId.setText(Labels.getFormattedString("ExternalIdPage.externalIdComboText", controller.getAppConfig().getString(AppConfig.ENTITY))); //$NON-NLS-1$ + labelExtId.setText(Labels.getFormattedString("ExternalIdPage.externalIdComboText", controller.getAppConfig().getString(AppConfig.PROP_ENTITY))); //$NON-NLS-1$ DescribeSObjectResult fieldTypes = controller.getFieldTypes(); Field[] fields = fieldTypes.getFields(); @@ -135,9 +135,9 @@ public boolean setExtIdCombo() { if(extIdFieldCombo.getItemCount() == 1) { extIdFieldCombo.setEnabled(false); extIdFieldCombo.setText(extIdNames[0]); - labelExtIdInfo.setText(Labels.getFormattedString("ExternalIdPage.externalIdInfoNoExtId", controller.getAppConfig().getString(AppConfig.ENTITY))); //$NON-NLS-1$ + labelExtIdInfo.setText(Labels.getFormattedString("ExternalIdPage.externalIdInfoNoExtId", controller.getAppConfig().getString(AppConfig.PROP_ENTITY))); //$NON-NLS-1$ } else { - labelExtIdInfo.setText(Labels.getFormattedString("ExternalIdPage.externalIdInfoExtIdExists", controller.getAppConfig().getString(AppConfig.ENTITY))); //$NON-NLS-1$ + labelExtIdInfo.setText(Labels.getFormattedString("ExternalIdPage.externalIdInfoExtIdExists", controller.getAppConfig().getString(AppConfig.PROP_ENTITY))); //$NON-NLS-1$ } setPageComplete(); comp.layout(); @@ -181,7 +181,7 @@ private void saveExtIdData() { // external id field String extIdField = extIdFieldCombo.getText(); - appConfig.setValue(AppConfig.IDLOOKUP_FIELD, extIdField); + appConfig.setValue(AppConfig.PROP_IDLOOKUP_FIELD, extIdField); controller.saveConfig(); } diff --git a/src/main/java/com/salesforce/dataloader/ui/FinishPage.java b/src/main/java/com/salesforce/dataloader/ui/FinishPage.java index dff580ee..118af2e2 100644 --- a/src/main/java/com/salesforce/dataloader/ui/FinishPage.java +++ b/src/main/java/com/salesforce/dataloader/ui/FinishPage.java @@ -78,7 +78,7 @@ public void createControl(Composite parent) { dirComp.setLayoutData(data); dirFE = new DirectoryFieldEditor(Labels.getString("FinishPage.output"), Labels.getString("FinishPage.chooseDir"), dirComp); //$NON-NLS-1$ //$NON-NLS-2$ - dirFE.setStringValue(controller.getAppConfig().getString(AppConfig.OUTPUT_STATUS_DIR)); + dirFE.setStringValue(controller.getAppConfig().getString(AppConfig.PROP_OUTPUT_STATUS_DIR)); Text textField = dirFE.getTextControl(dirComp); textField.addModifyListener(new ModifyListener() { diff --git a/src/main/java/com/salesforce/dataloader/ui/LoadFinishDialog.java b/src/main/java/com/salesforce/dataloader/ui/LoadFinishDialog.java index 381fb7bd..0225c324 100644 --- a/src/main/java/com/salesforce/dataloader/ui/LoadFinishDialog.java +++ b/src/main/java/com/salesforce/dataloader/ui/LoadFinishDialog.java @@ -96,7 +96,7 @@ protected void createContents(final Shell shell) { viewSuccess.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { - openViewer(getController().getAppConfig().getString(AppConfig.OUTPUT_SUCCESS)); + openViewer(getController().getAppConfig().getString(AppConfig.PROP_OUTPUT_SUCCESS)); } @Override @@ -109,7 +109,7 @@ public void widgetDefaultSelected(SelectionEvent e) {} viewErrors.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { - openViewer(getController().getAppConfig().getString(AppConfig.OUTPUT_ERROR)); + openViewer(getController().getAppConfig().getString(AppConfig.PROP_OUTPUT_ERROR)); } @Override diff --git a/src/main/java/com/salesforce/dataloader/ui/LoadPage.java b/src/main/java/com/salesforce/dataloader/ui/LoadPage.java index 8bd9fee1..26fa354d 100644 --- a/src/main/java/com/salesforce/dataloader/ui/LoadPage.java +++ b/src/main/java/com/salesforce/dataloader/ui/LoadPage.java @@ -57,7 +57,7 @@ protected String getConfigInfo() { + " " + Labels.getString("AdvancedSettingsDialog.startRow") + " " - + controller.getAppConfig().getString(AppConfig.LOAD_ROW_TO_START_AT); //$NON-NLS-1$ + + controller.getAppConfig().getString(AppConfig.PROP_LOAD_ROW_TO_START_AT); //$NON-NLS-1$ } /* diff --git a/src/main/java/com/salesforce/dataloader/ui/LoadWizard.java b/src/main/java/com/salesforce/dataloader/ui/LoadWizard.java index 0c32b6e6..aa9cd544 100644 --- a/src/main/java/com/salesforce/dataloader/ui/LoadWizard.java +++ b/src/main/java/com/salesforce/dataloader/ui/LoadWizard.java @@ -158,7 +158,7 @@ protected void hook_additionalLoadWizardPages() { super.hook_additionalLoadWizardPages(); if (getController().getAppConfig().isRESTAPIEnabled() && Controller.getAPIMajorVersion() >= 61 - && getController().getAppConfig().getBoolean(AppConfig.DELETE_WITH_EXTERNALID)) { + && getController().getAppConfig().getBoolean(AppConfig.PROP_DELETE_WITH_EXTERNALID)) { addPage(new ExternalIdPage(getController())); } } diff --git a/src/main/java/com/salesforce/dataloader/ui/LoaderWindow.java b/src/main/java/com/salesforce/dataloader/ui/LoaderWindow.java index 43de2cf9..434caf38 100644 --- a/src/main/java/com/salesforce/dataloader/ui/LoaderWindow.java +++ b/src/main/java/com/salesforce/dataloader/ui/LoaderWindow.java @@ -138,10 +138,10 @@ public Controller getController() { */ public void run() { AppConfig appConfig = controller.getAppConfig(); - if (!appConfig.getBoolean(AppConfig.HIDE_WELCOME_SCREEN)) { + if (!appConfig.getBoolean(AppConfig.PROP_HIDE_WELCOME_SCREEN)) { displayTitleDialog(Display.getDefault(), this.operationActionsByIndex, this.controller.getAppConfig()); } - if (appConfig.getBoolean(AppConfig.SHOW_LOADER_UPGRADE_SCREEN)) { + if (appConfig.getBoolean(AppConfig.PROP_SHOW_LOADER_UPGRADE_SCREEN)) { displayUpgradeDialog(Display.getDefault()); } setBlockOnOpen(true); diff --git a/src/main/java/com/salesforce/dataloader/ui/LoginPage.java b/src/main/java/com/salesforce/dataloader/ui/LoginPage.java index 701a1274..a00f7891 100644 --- a/src/main/java/com/salesforce/dataloader/ui/LoginPage.java +++ b/src/main/java/com/salesforce/dataloader/ui/LoginPage.java @@ -86,7 +86,7 @@ public void createControl(Composite parent) { layouts[2].addListener(SWT.Selection, this::selectSessionId); //turn off oauth options if no configured environments found - if (appConfig.getStrings(AppConfig.AUTH_ENVIRONMENTS).size() > 0) { + if (appConfig.getStrings(AppConfig.PROP_AUTH_ENVIRONMENTS).size() > 0) { layouts[0].setSelection(true); selectOAuth(null); } else { @@ -94,7 +94,7 @@ public void createControl(Composite parent) { layouts[1].setSelection(true); selectUnamePwd(null); } - if (!appConfig.getBoolean(AppConfig.SFDC_INTERNAL)){ + if (!appConfig.getBoolean(AppConfig.PROP_SFDC_INTERNAL)){ grid.hide(layouts[2]); if (!layouts[0].getVisible()){ //no options other than standard so don't present them diff --git a/src/main/java/com/salesforce/dataloader/ui/MappingDialog.java b/src/main/java/com/salesforce/dataloader/ui/MappingDialog.java index 1862b815..ea99b27d 100644 --- a/src/main/java/com/salesforce/dataloader/ui/MappingDialog.java +++ b/src/main/java/com/salesforce/dataloader/ui/MappingDialog.java @@ -557,7 +557,7 @@ private void updateSforce() { ArrayList unmappedSobjectFieldList = new ArrayList(); AppConfig appConfig = getController().getAppConfig(); - String extIdField = appConfig.getString(AppConfig.IDLOOKUP_FIELD); + String extIdField = appConfig.getString(AppConfig.PROP_IDLOOKUP_FIELD); if(extIdField == null) { extIdField = ""; } else { diff --git a/src/main/java/com/salesforce/dataloader/ui/MappingPage.java b/src/main/java/com/salesforce/dataloader/ui/MappingPage.java index 38e90c75..d5b8ba02 100644 --- a/src/main/java/com/salesforce/dataloader/ui/MappingPage.java +++ b/src/main/java/com/salesforce/dataloader/ui/MappingPage.java @@ -222,7 +222,7 @@ Field[] getMappableSalesforceFields() { ArrayList mappableFieldList = new ArrayList(); AppConfig appConfig = controller.getAppConfig(); OperationInfo operation = appConfig.getOperationInfo(); - String extIdField = appConfig.getString(AppConfig.IDLOOKUP_FIELD); + String extIdField = appConfig.getString(AppConfig.PROP_IDLOOKUP_FIELD); if(extIdField == null) { extIdField = ""; } else { @@ -240,7 +240,7 @@ Field[] getMappableSalesforceFields() { case delete: if (controller.getAppConfig().isRESTAPIEnabled() && Controller.getAPIMajorVersion() >= 61 - && controller.getAppConfig().getBoolean(AppConfig.DELETE_WITH_EXTERNALID) + && controller.getAppConfig().getBoolean(AppConfig.PROP_DELETE_WITH_EXTERNALID) && field.isIdLookup()) { isMappable = true; } @@ -290,7 +290,7 @@ public Field[] getFieldTypes() { for (Field field : fields) { if (controller.getAppConfig().isRESTAPIEnabled() && Controller.getAPIMajorVersion() >= 61 - && controller.getAppConfig().getBoolean(AppConfig.DELETE_WITH_EXTERNALID) + && controller.getAppConfig().getBoolean(AppConfig.PROP_DELETE_WITH_EXTERNALID) && field.isIdLookup()) { refFieldList.add(field); } else if (field.getType().toString().equalsIgnoreCase("id")) { diff --git a/src/main/java/com/salesforce/dataloader/ui/OAuthLoginControl.java b/src/main/java/com/salesforce/dataloader/ui/OAuthLoginControl.java index c5b276cd..a337ec7a 100644 --- a/src/main/java/com/salesforce/dataloader/ui/OAuthLoginControl.java +++ b/src/main/java/com/salesforce/dataloader/ui/OAuthLoginControl.java @@ -54,9 +54,9 @@ public OAuthLoginControl(Composite parent, int style, LoginPage loginPage, Authe Grid12 grid = new Grid12(this, 40, false, true); grid.createLabel(4, Labels.getString("LoginPage.environment")); - ArrayList environments = authRunner.getConfig().getStrings(AppConfig.AUTH_ENVIRONMENTS); + ArrayList environments = authRunner.getConfig().getStrings(AppConfig.PROP_AUTH_ENVIRONMENTS); environment = grid.createCombo(6, SWT.DROP_DOWN | SWT.BORDER, environments); - String currentEnvironment = authRunner.getConfig().getString(AppConfig.SELECTED_AUTH_ENVIRONMENT); + String currentEnvironment = authRunner.getConfig().getString(AppConfig.PROP_SELECTED_AUTH_ENVIRONMENT); if (environments.contains(currentEnvironment)) { environment.setText(currentEnvironment); } diff --git a/src/main/java/com/salesforce/dataloader/ui/UsernamePasswordLoginControl.java b/src/main/java/com/salesforce/dataloader/ui/UsernamePasswordLoginControl.java index 0299319c..e20d81cb 100644 --- a/src/main/java/com/salesforce/dataloader/ui/UsernamePasswordLoginControl.java +++ b/src/main/java/com/salesforce/dataloader/ui/UsernamePasswordLoginControl.java @@ -70,7 +70,7 @@ public UsernamePasswordLoginControl(Composite parent, int style, LoginPage login usernameLabel.setLayoutData(data); usernameLabel.setText(Labels.getString("LoginPage.username")); userName = new Text(this, SWT.LEFT | SWT.BORDER); - userName.setText(authRunner.getConfig().getString(AppConfig.USERNAME)); + userName.setText(authRunner.getConfig().getString(AppConfig.PROP_USERNAME)); data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL); userName.setLayoutData(data); @@ -92,7 +92,7 @@ public void keyPressed(KeyEvent e){ if (authUsingSessionId) { pwdOrSessionIdLabel.setText(Labels.getString("LoginPage.sessionId")); sessionId = new Text(this, SWT.LEFT | SWT.BORDER); - sessionId.setText(authRunner.getConfig().getString(AppConfig.SFDC_INTERNAL_SESSION_ID)); + sessionId.setText(authRunner.getConfig().getString(AppConfig.PROP_SFDC_INTERNAL_SESSION_ID)); sessionId.setLayoutData(data); password = null; } else { @@ -122,7 +122,7 @@ public void keyPressed(KeyEvent e) { data = new GridData(GridData.HORIZONTAL_ALIGN_END); envLabel.setLayoutData(data); envLabel.setText(Labels.getString("LoginPage.environment")); - ArrayList environments = authRunner.getConfig().getStrings(AppConfig.AUTH_ENVIRONMENTS); + ArrayList environments = authRunner.getConfig().getStrings(AppConfig.PROP_AUTH_ENVIRONMENTS); Combo envDropdown = new Combo(this, SWT.DROP_DOWN | SWT.BORDER); data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL); @@ -130,7 +130,7 @@ public void keyPressed(KeyEvent e) { for (String label: environments) { envDropdown.add(label); } - String currentEnvironment = authRunner.getConfig().getString(AppConfig.SELECTED_AUTH_ENVIRONMENT); + String currentEnvironment = authRunner.getConfig().getString(AppConfig.PROP_SELECTED_AUTH_ENVIRONMENT); if (environments.contains(currentEnvironment)) { envDropdown.setText(currentEnvironment); } diff --git a/src/main/java/com/salesforce/dataloader/ui/extraction/ExtractionFinishDialog.java b/src/main/java/com/salesforce/dataloader/ui/extraction/ExtractionFinishDialog.java index 60c5682a..c6ae1b00 100644 --- a/src/main/java/com/salesforce/dataloader/ui/extraction/ExtractionFinishDialog.java +++ b/src/main/java/com/salesforce/dataloader/ui/extraction/ExtractionFinishDialog.java @@ -89,7 +89,7 @@ protected void createContents(final Shell shell) { buttonComp.setLayoutData(data); // error status output is optional - boolean enableStatusOutput = getController().getAppConfig().getBoolean(AppConfig.ENABLE_EXTRACT_STATUS_OUTPUT); + boolean enableStatusOutput = getController().getAppConfig().getBoolean(AppConfig.PROP_ENABLE_EXTRACT_STATUS_OUTPUT); if (enableStatusOutput) { layout = new GridLayout(3, false); } else { @@ -104,7 +104,7 @@ protected void createContents(final Shell shell) { viewExtraction.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { - openViewer(getController().getAppConfig().getString(AppConfig.DAO_NAME), false); + openViewer(getController().getAppConfig().getString(AppConfig.PROP_DAO_NAME), false); } @Override @@ -121,7 +121,7 @@ public void widgetDefaultSelected(SelectionEvent e) {} viewErrors.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { - openViewer(getController().getAppConfig().getString(AppConfig.OUTPUT_ERROR), true); + openViewer(getController().getAppConfig().getString(AppConfig.PROP_OUTPUT_ERROR), true); } @Override diff --git a/src/main/java/com/salesforce/dataloader/ui/extraction/ExtractionPage.java b/src/main/java/com/salesforce/dataloader/ui/extraction/ExtractionPage.java index 344cf922..10a12da7 100644 --- a/src/main/java/com/salesforce/dataloader/ui/extraction/ExtractionPage.java +++ b/src/main/java/com/salesforce/dataloader/ui/extraction/ExtractionPage.java @@ -55,6 +55,6 @@ public static String getConfigInfo(AppConfig appConfig) { // Batch size settings are applicable only for SOAP API return Labels.getString("ExtractionInputDialog.exportBatchSize") + " " - + appConfig.getString(AppConfig.EXPORT_BATCH_SIZE); + + appConfig.getString(AppConfig.PROP_EXPORT_BATCH_SIZE); } } \ No newline at end of file diff --git a/src/main/java/com/salesforce/dataloader/ui/extraction/ExtractionSOQLPage.java b/src/main/java/com/salesforce/dataloader/ui/extraction/ExtractionSOQLPage.java index 99916747..d93ae9ac 100644 --- a/src/main/java/com/salesforce/dataloader/ui/extraction/ExtractionSOQLPage.java +++ b/src/main/java/com/salesforce/dataloader/ui/extraction/ExtractionSOQLPage.java @@ -623,14 +623,14 @@ protected boolean setupPagePostLogin() { private void initializeSOQLText() { logger.debug(Labels.getString("ExtractionSOQLPage.initializeMsg")); //$NON-NLS-1$ AppConfig appConfig = controller.getAppConfig(); - String entityStr = appConfig.getString(AppConfig.ENTITY); + String entityStr = appConfig.getString(AppConfig.PROP_ENTITY); if (entityStr == null || entityStr.isBlank()) { return; } DescribeSObjectResult result = controller.getFieldTypes(); fieldsInSObject = result.getFields(); - if (appConfig.getBoolean(AppConfig.SORT_EXTRACT_FIELDS)) { + if (appConfig.getBoolean(AppConfig.PROP_SORT_EXTRACT_FIELDS)) { Arrays.sort(fieldsInSObject, new Comparator(){ @Override public int compare(Field f1, Field f2) @@ -643,7 +643,7 @@ public int compare(Field f1, Field f2) updateWhereFieldComboList(null); builderComp.layout(); whereComp.layout(); - fromEntityPart = new StringBuffer("\nFROM ").append(appConfig.getString(AppConfig.ENTITY)).append(" "); //$NON-NLS-1$ //$NON-NLS-2$ + fromEntityPart = new StringBuffer("\nFROM ").append(appConfig.getString(AppConfig.PROP_ENTITY)).append(" "); //$NON-NLS-1$ //$NON-NLS-2$ } private void updateWhereFieldComboList(String filterStr) { @@ -724,7 +724,7 @@ public IWizardPage getNextPage() { */ @Override public boolean finishAllowed() { - if (this.controller.getAppConfig().getBoolean(AppConfig.ENABLE_EXTRACT_STATUS_OUTPUT)) { + if (this.controller.getAppConfig().getBoolean(AppConfig.PROP_ENABLE_EXTRACT_STATUS_OUTPUT)) { // this page is not the finish page if extract status output is enabled return false; } @@ -736,7 +736,7 @@ private boolean saveSoQL() { if (soqlStr == null || soqlStr.isBlank()) { return false; } - controller.getAppConfig().setValue(AppConfig.EXTRACT_SOQL, soqlStr); + controller.getAppConfig().setValue(AppConfig.PROP_EXTRACT_SOQL, soqlStr); if (!controller.saveConfig()) { return false; } return true; } @@ -748,6 +748,6 @@ public void setPageComplete() { @Override public boolean canFlipToNextPage() { - return (this.controller.getAppConfig().getBoolean(AppConfig.ENABLE_EXTRACT_STATUS_OUTPUT) && isPageComplete()); + return (this.controller.getAppConfig().getBoolean(AppConfig.PROP_ENABLE_EXTRACT_STATUS_OUTPUT) && isPageComplete()); } } \ No newline at end of file diff --git a/src/main/java/com/salesforce/dataloader/ui/extraction/ExtractionWizard.java b/src/main/java/com/salesforce/dataloader/ui/extraction/ExtractionWizard.java index 530f0fd0..77d9c113 100644 --- a/src/main/java/com/salesforce/dataloader/ui/extraction/ExtractionWizard.java +++ b/src/main/java/com/salesforce/dataloader/ui/extraction/ExtractionWizard.java @@ -66,7 +66,7 @@ protected WizardPage setPages() { ExtractionPage soqlPage = new ExtractionSOQLPage(controller); addPage(soqlPage); WizardPage finishPage = soqlPage; - if (getConfig().getBoolean(AppConfig.ENABLE_EXTRACT_STATUS_OUTPUT)) { + if (getConfig().getBoolean(AppConfig.PROP_ENABLE_EXTRACT_STATUS_OUTPUT)) { //need to reference the finish page for performFinish() finishPage = new ExtractionFinishPage(controller); addPage(finishPage); @@ -121,7 +121,7 @@ private boolean validateExtractionPath(String filePath) { @Override public boolean performFinish() { - if (!validateExtractionPath(getConfig().getString(AppConfig.DAO_NAME))) { + if (!validateExtractionPath(getConfig().getString(AppConfig.PROP_DAO_NAME))) { return false; } diff --git a/src/main/java/com/salesforce/dataloader/util/AppUtil.java b/src/main/java/com/salesforce/dataloader/util/AppUtil.java index 4cfb6b08..3b95978b 100644 --- a/src/main/java/com/salesforce/dataloader/util/AppUtil.java +++ b/src/main/java/com/salesforce/dataloader/util/AppUtil.java @@ -377,11 +377,11 @@ private static void processArgsForBatchMode(String[] args, Map ar if (!argsMap.containsKey(AppUtil.CLI_OPTION_CONFIG_DIR_PROP)) { argsMap.put(AppUtil.CLI_OPTION_CONFIG_DIR_PROP, args[0]); } - if (!argsMap.containsKey(AppConfig.PROCESS_NAME) + if (!argsMap.containsKey(AppConfig.PROP_PROCESS_NAME) && args.length > 2 && !args[1].contains("=")) { // second argument must be process name - argsMap.put(AppConfig.PROCESS_NAME, args[1]); + argsMap.put(AppConfig.PROP_PROCESS_NAME, args[1]); } } @@ -552,19 +552,19 @@ public static Proxy getSystemHttpsProxy(String[] args) { public static void setConnectorConfigProxySettings(AppConfig appConfig, ConnectorConfig connConfig) { // proxy properties try { - String proxyHost = appConfig.getString(AppConfig.PROXY_HOST); - int proxyPort = appConfig.getInt(AppConfig.PROXY_PORT); + String proxyHost = appConfig.getString(AppConfig.PROP_PROXY_HOST); + int proxyPort = appConfig.getInt(AppConfig.PROP_PROXY_PORT); if (proxyHost != null && proxyHost.length() > 0 && proxyPort > 0) { logger.info(Messages.getFormattedString( "AppUtil.sforceLoginProxyDetail", new String[] { proxyHost, String.valueOf(proxyPort) })); //$NON-NLS-1$ connConfig.setProxy(proxyHost, proxyPort); - String proxyUsername = appConfig.getString(AppConfig.PROXY_USERNAME); + String proxyUsername = appConfig.getString(AppConfig.PROP_PROXY_USERNAME); if (proxyUsername != null && proxyUsername.length() > 0) { logger.info(Messages.getFormattedString("AppUtil.sforceLoginProxyUser", proxyUsername)); //$NON-NLS-1$ connConfig.setProxyUsername(proxyUsername); - String proxyPassword = appConfig.getString(AppConfig.PROXY_PASSWORD); + String proxyPassword = appConfig.getString(AppConfig.PROP_PROXY_PASSWORD); if (proxyPassword != null && proxyPassword.length() > 0) { logger.info(Messages.getString("AppUtil.sforceLoginProxyPassword")); //$NON-NLS-1$ connConfig.setProxyPassword(proxyPassword); @@ -574,7 +574,7 @@ public static void setConnectorConfigProxySettings(AppConfig appConfig, Connecto } } - String proxyNtlmDomain = appConfig.getString(AppConfig.PROXY_NTLM_DOMAIN); + String proxyNtlmDomain = appConfig.getString(AppConfig.PROP_PROXY_NTLM_DOMAIN); if (proxyNtlmDomain != null && proxyNtlmDomain.length() > 0) { logger.info(Messages.getFormattedString("AppUtil.sforceLoginProxyNtlm", proxyNtlmDomain)); //$NON-NLS-1$ connConfig.setNtlmDomain(proxyNtlmDomain); @@ -583,10 +583,10 @@ public static void setConnectorConfigProxySettings(AppConfig appConfig, Connecto } catch (ParameterLoadException e) { logger.error(e.getMessage()); } - if (appConfig.getBoolean(AppConfig.DEBUG_MESSAGES)) { + if (appConfig.getBoolean(AppConfig.PROP_DEBUG_MESSAGES)) { connConfig.setTraceMessage(true); connConfig.setPrettyPrintXml(true); - String filename = appConfig.getString(AppConfig.DEBUG_MESSAGES_FILE); + String filename = appConfig.getString(AppConfig.PROP_DEBUG_MESSAGES_FILE); if (filename.length() > 0) { try { connConfig.setTraceFile(filename); diff --git a/src/main/java/com/salesforce/dataloader/util/DAORowUtil.java b/src/main/java/com/salesforce/dataloader/util/DAORowUtil.java index 2f31ae98..3fb623d3 100644 --- a/src/main/java/com/salesforce/dataloader/util/DAORowUtil.java +++ b/src/main/java/com/salesforce/dataloader/util/DAORowUtil.java @@ -197,7 +197,7 @@ private void rowToStart(AppConfig cfg, DataReader daoReader) throws DataAccessOb // start at the correct row final int rowToStart; try { - rowToStart = cfg.getInt(AppConfig.LOAD_ROW_TO_START_AT); + rowToStart = cfg.getInt(AppConfig.PROP_LOAD_ROW_TO_START_AT); } catch (final ParameterLoadException e) { return; } diff --git a/src/main/java/com/salesforce/dataloader/util/OAuthBrowserLoginRunner.java b/src/main/java/com/salesforce/dataloader/util/OAuthBrowserLoginRunner.java index 29dd0cda..3dcfbc54 100644 --- a/src/main/java/com/salesforce/dataloader/util/OAuthBrowserLoginRunner.java +++ b/src/main/java/com/salesforce/dataloader/util/OAuthBrowserLoginRunner.java @@ -95,11 +95,11 @@ private void retryBrowserLoginWithDefaultURL(AppConfig appConfig, boolean skipUs private void startBrowserLogin(AppConfig appConfig, boolean skipUserCodePage) throws IOException, ParameterLoadException, OAuthBrowserLoginRunnerException { setLoginStatus(LoginStatus.WAIT); this.appConfig = appConfig; - appConfig.setOAuthEnvironment(appConfig.getString(AppConfig.SELECTED_AUTH_ENVIRONMENT)); - oAuthTokenURLStr = appConfig.getString(AppConfig.OAUTH_SERVER) + "/services/oauth2/token"; + appConfig.setOAuthEnvironment(appConfig.getString(AppConfig.PROP_SELECTED_AUTH_ENVIRONMENT)); + oAuthTokenURLStr = appConfig.getString(AppConfig.PROP_OAUTH_SERVER) + "/services/oauth2/token"; SimplePost client = SimplePostFactory.getInstance(appConfig, oAuthTokenURLStr, new BasicNameValuePair("response_type", "device_code"), - new BasicNameValuePair(AppConfig.CLIENT_ID_HEADER_NAME, appConfig.getString(AppConfig.OAUTH_CLIENTID)), + new BasicNameValuePair(AppConfig.CLIENT_ID_HEADER_NAME, appConfig.getString(AppConfig.PROP_OAUTH_CLIENTID)), new BasicNameValuePair("scope", "api") ); client.post(); @@ -201,7 +201,7 @@ public void run() { elapsedTimeInSec += pollingIntervalInSec; client = SimplePostFactory.getInstance(appConfig, oAuthTokenURLStr, new BasicNameValuePair("grant_type", "device"), - new BasicNameValuePair(AppConfig.CLIENT_ID_HEADER_NAME, appConfig.getString(AppConfig.OAUTH_CLIENTID)), + new BasicNameValuePair(AppConfig.CLIENT_ID_HEADER_NAME, appConfig.getString(AppConfig.PROP_OAUTH_CLIENTID)), new BasicNameValuePair("code", deviceCode) ); try { @@ -334,8 +334,8 @@ public static void processSuccessfulLogin(InputStream httpResponseInputStream, A .create(); OAuthToken token = gson.fromJson(jsonTokenResult, OAuthToken.class); appConfig.setAuthEndpoint(token.getInstanceUrl()); - appConfig.setValue(AppConfig.OAUTH_ACCESSTOKEN, token.getAccessToken()); - appConfig.setValue(AppConfig.OAUTH_REFRESHTOKEN, token.getRefreshToken()); - appConfig.setValue(AppConfig.OAUTH_INSTANCE_URL, token.getInstanceUrl()); + appConfig.setValue(AppConfig.PROP_OAUTH_ACCESSTOKEN, token.getAccessToken()); + appConfig.setValue(AppConfig.PROP_OAUTH_REFRESHTOKEN, token.getRefreshToken()); + appConfig.setValue(AppConfig.PROP_OAUTH_INSTANCE_URL, token.getInstanceUrl()); } } diff --git a/src/test/java/com/salesforce/dataloader/ConfigTestBase.java b/src/test/java/com/salesforce/dataloader/ConfigTestBase.java index 7fb74d97..846f30c7 100644 --- a/src/test/java/com/salesforce/dataloader/ConfigTestBase.java +++ b/src/test/java/com/salesforce/dataloader/ConfigTestBase.java @@ -42,8 +42,8 @@ public abstract class ConfigTestBase extends TestBase { @Deprecated protected static enum TestProperties { @Deprecated - ENTITY_DEFAULT(AppConfig.ENTITY), @Deprecated - ACCOUNT_EXTID(AppConfig.IDLOOKUP_FIELD); + ENTITY_DEFAULT(AppConfig.PROP_ENTITY), @Deprecated + ACCOUNT_EXTID(AppConfig.PROP_IDLOOKUP_FIELD); private final String configName; @@ -69,16 +69,16 @@ public void putConfigSetting(Map destConfig) { protected Map getTestConfig() { final HashMap configBase = new HashMap(this.baseConfig); - configBase.put(AppConfig.LAST_RUN_OUTPUT_DIR, getTestStatusDir()); + configBase.put(AppConfig.PROP_LAST_RUN_OUTPUT_DIR, getTestStatusDir()); for (TestProperties prop : getDefaultTestPropertiesSet()) { prop.putConfigSetting(configBase); } configBase.put(AppUtil.CLI_OPTION_CONFIG_DIR_PROP, TEST_CONF_DIR); - String proxyUsername = System.getProperty(AppConfig.PROXY_USERNAME); - String proxyPassword = System.getProperty(AppConfig.PROXY_PASSWORD); + String proxyUsername = System.getProperty(AppConfig.PROP_PROXY_USERNAME); + String proxyPassword = System.getProperty(AppConfig.PROP_PROXY_PASSWORD); if (proxyUsername != null && proxyPassword != null) { - configBase.put(AppConfig.PROXY_USERNAME, proxyUsername); - configBase.put(AppConfig.PROXY_PASSWORD, proxyPassword); + configBase.put(AppConfig.PROP_PROXY_USERNAME, proxyUsername); + configBase.put(AppConfig.PROP_PROXY_PASSWORD, proxyPassword); } return configBase; } diff --git a/src/test/java/com/salesforce/dataloader/TestBase.java b/src/test/java/com/salesforce/dataloader/TestBase.java index 45f5b866..58f61aad 100644 --- a/src/test/java/com/salesforce/dataloader/TestBase.java +++ b/src/test/java/com/salesforce/dataloader/TestBase.java @@ -261,8 +261,8 @@ protected PartnerConnectionForTest getBinding() { protected ConnectorConfig getWSCConfig(String apiVersionStr) { ConnectorConfig bindingConfig = new ConnectorConfig(); - bindingConfig.setUsername(getController().getAppConfig().getString(AppConfig.USERNAME)); - bindingConfig.setPassword(getController().getAppConfig().getString(AppConfig.PASSWORD)); + bindingConfig.setUsername(getController().getAppConfig().getString(AppConfig.PROP_USERNAME)); + bindingConfig.setPassword(getController().getAppConfig().getString(AppConfig.PROP_PASSWORD)); String configEndpoint = getController().getAppConfig().getAuthEndpoint(); if (!configEndpoint.equals("")) { //$NON-NLS-1$ try { @@ -273,10 +273,10 @@ protected ConnectorConfig getWSCConfig(String apiVersionStr) { bindingConfig.setManualLogin(true); // set long timeout for tests with larger data sets bindingConfig.setReadTimeout(5 * 60 * 1000); - if (getController().getAppConfig().getBoolean(AppConfig.DEBUG_MESSAGES)) { + if (getController().getAppConfig().getBoolean(AppConfig.PROP_DEBUG_MESSAGES)) { bindingConfig.setTraceMessage(true); bindingConfig.setPrettyPrintXml(true); - String filename = getController().getAppConfig().getString(AppConfig.DEBUG_MESSAGES_FILE); + String filename = getController().getAppConfig().getString(AppConfig.PROP_DEBUG_MESSAGES_FILE); if (!filename.isEmpty()) { try { bindingConfig.setTraceFile(filename); diff --git a/src/test/java/com/salesforce/dataloader/TestSetting.java b/src/test/java/com/salesforce/dataloader/TestSetting.java index dcc15113..897b26f0 100644 --- a/src/test/java/com/salesforce/dataloader/TestSetting.java +++ b/src/test/java/com/salesforce/dataloader/TestSetting.java @@ -35,21 +35,21 @@ */ public enum TestSetting { - BULK_API_ENABLED(AppConfig.BULK_API_ENABLED, Boolean.TRUE), - BULK_API_DISABLED(AppConfig.BULK_API_ENABLED, Boolean.FALSE), - BULK_API_ZIP_CONTENT_ENABLED(AppConfig.BULK_API_ZIP_CONTENT, Boolean.TRUE), - BULK_API_SERIAL_MODE_ENABLED(AppConfig.BULK_API_SERIAL_MODE, Boolean.TRUE), + BULK_API_ENABLED(AppConfig.PROP_BULK_API_ENABLED, Boolean.TRUE), + BULK_API_DISABLED(AppConfig.PROP_BULK_API_ENABLED, Boolean.FALSE), + BULK_API_ZIP_CONTENT_ENABLED(AppConfig.PROP_BULK_API_ZIP_CONTENT, Boolean.TRUE), + BULK_API_SERIAL_MODE_ENABLED(AppConfig.PROP_BULK_API_SERIAL_MODE, Boolean.TRUE), BULK_API_CACHE_DAO_UPLOAD_ENABLED(AppConfig.PROCESS_BULK_CACHE_DATA_FROM_DAO, Boolean.TRUE), - BULK_V2_API_ENABLED(AppConfig.BULKV2_API_ENABLED, Boolean.TRUE), - BULK_V2_API_DISABLED(AppConfig.BULKV2_API_ENABLED, Boolean.FALSE), - COMPOSITE_REST_API_DISABLED(AppConfig.UPDATE_WITH_EXTERNALID, Boolean.FALSE), - COMPOSITE_REST_API_ENABLED(AppConfig.UPDATE_WITH_EXTERNALID, Boolean.TRUE), - WRITE_UTF8_ENABLED(AppConfig.WRITE_UTF8, Boolean.TRUE), - WRITE_UTF8_DISABLED(AppConfig.WRITE_UTF8, Boolean.FALSE), - READ_UTF8_ENABLED(AppConfig.READ_UTF8, Boolean.TRUE), - READ_UTF8_DISABLED(AppConfig.READ_UTF8, Boolean.FALSE), - COMPRESSION_ENABLED(AppConfig.NO_COMPRESSION, Boolean.FALSE), - COMPRESSION_DISABLED(AppConfig.NO_COMPRESSION, Boolean.TRUE) + BULK_V2_API_ENABLED(AppConfig.PROP_BULKV2_API_ENABLED, Boolean.TRUE), + BULK_V2_API_DISABLED(AppConfig.PROP_BULKV2_API_ENABLED, Boolean.FALSE), + COMPOSITE_REST_API_DISABLED(AppConfig.PROP_UPDATE_WITH_EXTERNALID, Boolean.FALSE), + COMPOSITE_REST_API_ENABLED(AppConfig.PROP_UPDATE_WITH_EXTERNALID, Boolean.TRUE), + WRITE_UTF8_ENABLED(AppConfig.PROP_WRITE_UTF8, Boolean.TRUE), + WRITE_UTF8_DISABLED(AppConfig.PROP_WRITE_UTF8, Boolean.FALSE), + READ_UTF8_ENABLED(AppConfig.PROP_READ_UTF8, Boolean.TRUE), + READ_UTF8_DISABLED(AppConfig.PROP_READ_UTF8, Boolean.FALSE), + COMPRESSION_ENABLED(AppConfig.PROP_NO_COMPRESSION, Boolean.FALSE), + COMPRESSION_DISABLED(AppConfig.PROP_NO_COMPRESSION, Boolean.TRUE) ; private final String parameter; diff --git a/src/test/java/com/salesforce/dataloader/client/PartnerClientTest.java b/src/test/java/com/salesforce/dataloader/client/PartnerClientTest.java index 1aeb13cd..d07815de 100644 --- a/src/test/java/com/salesforce/dataloader/client/PartnerClientTest.java +++ b/src/test/java/com/salesforce/dataloader/client/PartnerClientTest.java @@ -69,7 +69,7 @@ public class PartnerClientTest extends ProcessTestBase { @Test public void testPartnerClientConnect() throws Exception { PartnerClient client = new PartnerClient(getController()); - assertFalse(getController().getAppConfig().getBoolean(AppConfig.SFDC_INTERNAL_IS_SESSION_ID_LOGIN)); + assertFalse(getController().getAppConfig().getBoolean(AppConfig.PROP_SFDC_INTERNAL_IS_SESSION_ID_LOGIN)); boolean connect = client.connect(); assertTrue(connect); assertNotNull(client.getConnection()); @@ -81,17 +81,17 @@ public void testPartnerClientConnect() throws Exception { @Test public void testPartnerClientNoUserName() throws ConnectionException { AppConfig appConfig = getController().getAppConfig(); - String origUserName = appConfig.getString(AppConfig.USERNAME); + String origUserName = appConfig.getString(AppConfig.PROP_USERNAME); try { - appConfig.setValue(AppConfig.USERNAME, ""); + appConfig.setValue(AppConfig.PROP_USERNAME, ""); PartnerClient client = new PartnerClient(getController()); boolean connect = client.connect(); assertFalse("Should not connect with empty username", connect); } catch (RuntimeException e) { //make sure we get the right error message that mentions the username - assertTrue(e.getMessage().contains(AppConfig.USERNAME)); + assertTrue(e.getMessage().contains(AppConfig.PROP_USERNAME)); } finally { - appConfig.setValue(AppConfig.USERNAME, origUserName); + appConfig.setValue(AppConfig.PROP_USERNAME, origUserName); } } @@ -99,8 +99,8 @@ public void testPartnerClientNoUserName() throws ConnectionException { public void testPartnerClientSfdcInternalSessionIdConnect() throws Exception { AppConfig appConfig = getController().getAppConfig(); - final String origUsername = appConfig.getString(AppConfig.USERNAME); - final String origPassword = appConfig.getString(AppConfig.PASSWORD); + final String origUsername = appConfig.getString(AppConfig.PROP_USERNAME); + final String origPassword = appConfig.getString(AppConfig.PROP_PASSWORD); final String origEndpoint = appConfig.getAuthEndpoint(); //login normally just to get sessionId and endpoint @@ -111,23 +111,23 @@ public void testPartnerClientSfdcInternalSessionIdConnect() throws Exception { setupOnlyClient.disconnect(); try { - appConfig.setValue(AppConfig.USERNAME, ""); - appConfig.setValue(AppConfig.PASSWORD, ""); + appConfig.setValue(AppConfig.PROP_USERNAME, ""); + appConfig.setValue(AppConfig.PROP_PASSWORD, ""); - appConfig.setValue(AppConfig.SFDC_INTERNAL, true); - appConfig.setValue(AppConfig.SFDC_INTERNAL_IS_SESSION_ID_LOGIN, true); + appConfig.setValue(AppConfig.PROP_SFDC_INTERNAL, true); + appConfig.setValue(AppConfig.PROP_SFDC_INTERNAL_IS_SESSION_ID_LOGIN, true); appConfig.setAuthEndpoint(endpoint); - appConfig.setValue(AppConfig.SFDC_INTERNAL_SESSION_ID, sessionId); + appConfig.setValue(AppConfig.PROP_SFDC_INTERNAL_SESSION_ID, sessionId); PartnerClient client = new PartnerClient(getController()); assertTrue(client.connect()); } finally { - appConfig.setValue(AppConfig.USERNAME, origUsername); - appConfig.setValue(AppConfig.PASSWORD, origPassword); + appConfig.setValue(AppConfig.PROP_USERNAME, origUsername); + appConfig.setValue(AppConfig.PROP_PASSWORD, origPassword); appConfig.setAuthEndpoint(origEndpoint); - appConfig.setValue(AppConfig.SFDC_INTERNAL, false); - appConfig.setValue(AppConfig.SFDC_INTERNAL_IS_SESSION_ID_LOGIN, false); - appConfig.setValue(AppConfig.SFDC_INTERNAL_SESSION_ID, ""); + appConfig.setValue(AppConfig.PROP_SFDC_INTERNAL, false); + appConfig.setValue(AppConfig.PROP_SFDC_INTERNAL_IS_SESSION_ID_LOGIN, false); + appConfig.setValue(AppConfig.PROP_SFDC_INTERNAL_SESSION_ID, ""); } } @@ -135,8 +135,8 @@ public void testPartnerClientSfdcInternalSessionIdConnect() throws Exception { public void testPartnerClientSfdcInternalSessionIdWithoutSfdcInternalConnect() throws Exception { AppConfig appConfig = getController().getAppConfig(); - final String origUsername = appConfig.getString(AppConfig.USERNAME); - final String origPassword = appConfig.getString(AppConfig.PASSWORD); + final String origUsername = appConfig.getString(AppConfig.PROP_USERNAME); + final String origPassword = appConfig.getString(AppConfig.PROP_PASSWORD); final String origEndpoint = appConfig.getAuthEndpoint(); //login normally just to get sessionId and endpoint @@ -147,13 +147,13 @@ public void testPartnerClientSfdcInternalSessionIdWithoutSfdcInternalConnect() t setupOnlyClient.disconnect(); try { - appConfig.setValue(AppConfig.USERNAME, ""); - appConfig.setValue(AppConfig.PASSWORD, ""); + appConfig.setValue(AppConfig.PROP_USERNAME, ""); + appConfig.setValue(AppConfig.PROP_PASSWORD, ""); - appConfig.setValue(AppConfig.SFDC_INTERNAL, false); - appConfig.setValue(AppConfig.SFDC_INTERNAL_IS_SESSION_ID_LOGIN, true); + appConfig.setValue(AppConfig.PROP_SFDC_INTERNAL, false); + appConfig.setValue(AppConfig.PROP_SFDC_INTERNAL_IS_SESSION_ID_LOGIN, true); appConfig.setAuthEndpoint(endpoint); - appConfig.setValue(AppConfig.SFDC_INTERNAL_SESSION_ID, sessionId); + appConfig.setValue(AppConfig.PROP_SFDC_INTERNAL_SESSION_ID, sessionId); PartnerClient client = new PartnerClient(getController()); client.connect(); @@ -164,12 +164,12 @@ public void testPartnerClientSfdcInternalSessionIdWithoutSfdcInternalConnect() t "Empty salesforce.com username specified. Please make sure that parameter sfdc.username is set to correct username.", e.getMessage()); } finally { - appConfig.setValue(AppConfig.USERNAME, origUsername); - appConfig.setValue(AppConfig.PASSWORD, origPassword); + appConfig.setValue(AppConfig.PROP_USERNAME, origUsername); + appConfig.setValue(AppConfig.PROP_PASSWORD, origPassword); appConfig.setAuthEndpoint(origEndpoint); - appConfig.setValue(AppConfig.SFDC_INTERNAL, false); - appConfig.setValue(AppConfig.SFDC_INTERNAL_IS_SESSION_ID_LOGIN, false); - appConfig.setValue(AppConfig.SFDC_INTERNAL_SESSION_ID, ""); + appConfig.setValue(AppConfig.PROP_SFDC_INTERNAL, false); + appConfig.setValue(AppConfig.PROP_SFDC_INTERNAL_IS_SESSION_ID_LOGIN, false); + appConfig.setValue(AppConfig.PROP_SFDC_INTERNAL_SESSION_ID, ""); } } @@ -178,14 +178,14 @@ public void testIsSessionValidAlwaysTrueForSessionIdLogin() throws Exception { AppConfig appConfig = getController().getAppConfig(); try { - appConfig.setValue(AppConfig.SFDC_INTERNAL, true); - appConfig.setValue(AppConfig.SFDC_INTERNAL_IS_SESSION_ID_LOGIN, true); + appConfig.setValue(AppConfig.PROP_SFDC_INTERNAL, true); + appConfig.setValue(AppConfig.PROP_SFDC_INTERNAL_IS_SESSION_ID_LOGIN, true); PartnerClient client = new PartnerClient(getController()); assertTrue(client.isSessionValid()); } finally { - appConfig.setValue(AppConfig.SFDC_INTERNAL, false); - appConfig.setValue(AppConfig.SFDC_INTERNAL_IS_SESSION_ID_LOGIN, false); + appConfig.setValue(AppConfig.PROP_SFDC_INTERNAL, false); + appConfig.setValue(AppConfig.PROP_SFDC_INTERNAL_IS_SESSION_ID_LOGIN, false); } } @@ -317,7 +317,7 @@ private void doTestUpdateBasic(boolean noCompression) throws Exception { List beanList = new ArrayList(); beanList.add(sforceObj); - getController().getAppConfig().setValue(AppConfig.NO_COMPRESSION, noCompression); + getController().getAppConfig().setValue(AppConfig.PROP_NO_COMPRESSION, noCompression); // get the client and make the insert call PartnerClient client = new PartnerClient(getController()); @@ -413,7 +413,7 @@ public void testUpsertFkFailBasic() throws Exception { } private void doUpsertAccount(boolean upsertFk) throws Exception { - String origExtIdField = getController().getAppConfig().getString(AppConfig.IDLOOKUP_FIELD); + String origExtIdField = getController().getAppConfig().getString(AppConfig.PROP_IDLOOKUP_FIELD); try { // make sure the external id is set @@ -446,7 +446,7 @@ private void doUpsertAccount(boolean upsertFk) throws Exception { } private void doUpsertContact(boolean upsertFk) throws Exception { - String origExtIdField = getController().getAppConfig().getString(AppConfig.IDLOOKUP_FIELD); + String origExtIdField = getController().getAppConfig().getString(AppConfig.PROP_IDLOOKUP_FIELD); try { // make sure the external id is set @@ -463,7 +463,7 @@ private void doUpsertContact(boolean upsertFk) throws Exception { // Add upsert on FK -- reference to an account if (upsertFk) { // remember original ext id field - String oldExtIdField = getController().getAppConfig().getString(AppConfig.IDLOOKUP_FIELD); + String oldExtIdField = getController().getAppConfig().getString(AppConfig.PROP_IDLOOKUP_FIELD); String acctExtIdField = setExtIdField(DEFAULT_ACCOUNT_EXT_ID_FIELD); Object accountExtIdValue = getRandomExtId("Account", ACCOUNT_WHERE_CLAUSE, null); diff --git a/src/test/java/com/salesforce/dataloader/config/ConfigTest.java b/src/test/java/com/salesforce/dataloader/config/ConfigTest.java index f23f5dbd..92bbb00c 100644 --- a/src/test/java/com/salesforce/dataloader/config/ConfigTest.java +++ b/src/test/java/com/salesforce/dataloader/config/ConfigTest.java @@ -52,7 +52,7 @@ public void testProperty_SELECTED_AUTH_ENVIRONMENT() { try { AppConfig appConfig = AppConfig.getInstance(getTestConfig()); appConfig.setOAuthEnvironment(AppConfig.PROD_ENVIRONMENT_VAL); - String selectedAuthEnv = appConfig.getString(AppConfig.SELECTED_AUTH_ENVIRONMENT); + String selectedAuthEnv = appConfig.getString(AppConfig.PROP_SELECTED_AUTH_ENVIRONMENT); assertEquals(selectedAuthEnv, AppConfig.PROD_ENVIRONMENT_VAL); } catch (ConfigInitializationException | FactoryConfigurationError @@ -67,9 +67,9 @@ public void testProperty_OAUTH_CLIENTID() { try { AppConfig appConfig = AppConfig.getInstance(getTestConfig()); appConfig.setOAuthEnvironment(AppConfig.PROD_ENVIRONMENT_VAL); - String configuredClientId = appConfig.getString(AppConfig.OAUTH_CLIENTID); - if (appConfig.getBoolean(AppConfig.BULK_API_ENABLED) - || appConfig.getBoolean(AppConfig.BULKV2_API_ENABLED)) { + String configuredClientId = appConfig.getString(AppConfig.PROP_OAUTH_CLIENTID); + if (appConfig.getBoolean(AppConfig.PROP_BULK_API_ENABLED) + || appConfig.getBoolean(AppConfig.PROP_BULKV2_API_ENABLED)) { assertTrue(configuredClientId != null && configuredClientId.startsWith("DataLoaderBulkUI")); } else { assertTrue(configuredClientId != null && configuredClientId.startsWith("DataLoaderPartnerUI")); @@ -87,7 +87,7 @@ public void testProperty_OAUTH_CLIENTSECRET() { try { AppConfig appConfig = AppConfig.getInstance(getTestConfig()); appConfig.setOAuthEnvironment(AppConfig.PROD_ENVIRONMENT_VAL); - String configuredClientSecret = appConfig.getString(AppConfig.OAUTH_CLIENTSECRET); + String configuredClientSecret = appConfig.getString(AppConfig.PROP_OAUTH_CLIENTSECRET); assertTrue(configuredClientSecret == null || configuredClientSecret.isBlank()); } catch (ConfigInitializationException | FactoryConfigurationError @@ -102,7 +102,7 @@ public void testProperty_OAUTH_SERVER() { try { AppConfig appConfig = AppConfig.getInstance(getTestConfig()); appConfig.setOAuthEnvironment(AppConfig.PROD_ENVIRONMENT_VAL); - String configuredOAuthServer = appConfig.getString(AppConfig.OAUTH_SERVER); + String configuredOAuthServer = appConfig.getString(AppConfig.PROP_OAUTH_SERVER); String expectedOAuthServer = getProperty("test.endpoint"); if (expectedOAuthServer == null || expectedOAuthServer.isBlank()) { logger.info("Expected prefix is " + expectedOAuthServer); @@ -111,7 +111,7 @@ public void testProperty_OAUTH_SERVER() { assertTrue(configuredOAuthServer.startsWith(expectedOAuthServer)); appConfig.setOAuthEnvironment(AppConfig.SB_ENVIRONMENT_VAL); - configuredOAuthServer = appConfig.getString(AppConfig.OAUTH_SERVER); + configuredOAuthServer = appConfig.getString(AppConfig.PROP_OAUTH_SERVER); assertTrue(configuredOAuthServer.startsWith(AppConfig.DEFAULT_ENDPOINT_URL_SANDBOX)); } catch (ConfigInitializationException | FactoryConfigurationError @@ -128,7 +128,7 @@ public void testProperty_OAUTH_REDIRECTURI() { Map testConfigMap = getTestConfig(); AppConfig appConfig = AppConfig.getInstance(testConfigMap); appConfig.setOAuthEnvironment(AppConfig.PROD_ENVIRONMENT_VAL); - String configuredOAuthRedirectURI = appConfig.getString(AppConfig.OAUTH_REDIRECTURI); + String configuredOAuthRedirectURI = appConfig.getString(AppConfig.PROP_OAUTH_REDIRECTURI); String expectedOAuthRedirectURIPrefix = getProperty("test.endpoint"); if (expectedOAuthRedirectURIPrefix == null || expectedOAuthRedirectURIPrefix.isBlank()) { logger.info("Expected prefix is " + expectedOAuthRedirectURIPrefix); diff --git a/src/test/java/com/salesforce/dataloader/dao/CsvTest.java b/src/test/java/com/salesforce/dataloader/dao/CsvTest.java index 6f239007..dd7eb51d 100644 --- a/src/test/java/com/salesforce/dataloader/dao/CsvTest.java +++ b/src/test/java/com/salesforce/dataloader/dao/CsvTest.java @@ -80,16 +80,16 @@ public void testCSVReadUTF8BOMBasic() throws Exception{ @Test public void testCSVReadUTF16BEBOMBasic() throws Exception{ - getController().getAppConfig().setValue(AppConfig.READ_CHARSET, "UTF-16BE"); + getController().getAppConfig().setValue(AppConfig.PROP_READ_CHARSET, "UTF-16BE"); testCSVReadBasic("csvtext_BOM_UTF16BE.csv"); - getController().getAppConfig().setValue(AppConfig.READ_CHARSET, ""); + getController().getAppConfig().setValue(AppConfig.PROP_READ_CHARSET, ""); } @Test public void testCSVReadUTF16LEBOMBasic() throws Exception{ - getController().getAppConfig().setValue(AppConfig.READ_CHARSET, "UTF-16LE"); + getController().getAppConfig().setValue(AppConfig.PROP_READ_CHARSET, "UTF-16LE"); testCSVReadBasic("csvtext_BOM_UTF16LE.csv"); - getController().getAppConfig().setValue(AppConfig.READ_CHARSET, ""); + getController().getAppConfig().setValue(AppConfig.PROP_READ_CHARSET, ""); } private void testCSVReadBasic(String csvFile) throws Exception { @@ -225,28 +225,28 @@ private void compareWriterFile(String filePath, String delimiterStr, boolean ign String storedDelimiter; boolean storedCsvDelimiterComma = false, storedCsvDelimiterTab = false, storedCsvDelimiterOther = false; if (isQueryResultsCSV) { - storedDelimiter = appConfig.getString(AppConfig.CSV_DELIMITER_FOR_QUERY_RESULTS); - appConfig.setValue(AppConfig.CSV_DELIMITER_FOR_QUERY_RESULTS, delimiterStr); + storedDelimiter = appConfig.getString(AppConfig.PROP_CSV_DELIMITER_FOR_QUERY_RESULTS); + appConfig.setValue(AppConfig.PROP_CSV_DELIMITER_FOR_QUERY_RESULTS, delimiterStr); } else { - storedDelimiter = appConfig.getString(AppConfig.CSV_DELIMITER_OTHER_VALUE); - storedCsvDelimiterComma = appConfig.getBoolean(AppConfig.CSV_DELIMITER_COMMA); - storedCsvDelimiterTab = appConfig.getBoolean(AppConfig.CSV_DELIMITER_TAB); - storedCsvDelimiterOther = appConfig.getBoolean(AppConfig.CSV_DELIMITER_OTHER); - appConfig.setValue(AppConfig.CSV_DELIMITER_COMMA, false); - appConfig.setValue(AppConfig.CSV_DELIMITER_TAB, false); - appConfig.setValue(AppConfig.CSV_DELIMITER_OTHER, false); - appConfig.setValue(AppConfig.CSV_DELIMITER_OTHER_VALUE, delimiterStr); + storedDelimiter = appConfig.getString(AppConfig.PROP_CSV_DELIMITER_OTHER_VALUE); + storedCsvDelimiterComma = appConfig.getBoolean(AppConfig.PROP_CSV_DELIMITER_COMMA); + storedCsvDelimiterTab = appConfig.getBoolean(AppConfig.PROP_CSV_DELIMITER_TAB); + storedCsvDelimiterOther = appConfig.getBoolean(AppConfig.PROP_CSV_DELIMITER_OTHER); + appConfig.setValue(AppConfig.PROP_CSV_DELIMITER_COMMA, false); + appConfig.setValue(AppConfig.PROP_CSV_DELIMITER_TAB, false); + appConfig.setValue(AppConfig.PROP_CSV_DELIMITER_OTHER, false); + appConfig.setValue(AppConfig.PROP_CSV_DELIMITER_OTHER_VALUE, delimiterStr); if (AppUtil.COMMA.equals(delimiterStr)) { - appConfig.setValue(AppConfig.CSV_DELIMITER_COMMA, true); + appConfig.setValue(AppConfig.PROP_CSV_DELIMITER_COMMA, true); } else if (" ".equals(delimiterStr)) { - appConfig.setValue(AppConfig.CSV_DELIMITER_TAB, true); + appConfig.setValue(AppConfig.PROP_CSV_DELIMITER_TAB, true); } else { - appConfig.setValue(AppConfig.CSV_DELIMITER_OTHER, true); - storedDelimiter = appConfig.getString(AppConfig.CSV_DELIMITER_OTHER_VALUE); - appConfig.setValue(AppConfig.CSV_DELIMITER_OTHER_VALUE, delimiterStr); + appConfig.setValue(AppConfig.PROP_CSV_DELIMITER_OTHER, true); + storedDelimiter = appConfig.getString(AppConfig.PROP_CSV_DELIMITER_OTHER_VALUE); + appConfig.setValue(AppConfig.PROP_CSV_DELIMITER_OTHER_VALUE, delimiterStr); } } - appConfig.setValue(AppConfig.CSV_DELIMITER_FOR_QUERY_RESULTS, delimiterStr); + appConfig.setValue(AppConfig.PROP_CSV_DELIMITER_FOR_QUERY_RESULTS, delimiterStr); CSVFileReader csv = new CSVFileReader(new File(filePath), appConfig, ignoreDelimiterConfig, isQueryResultsCSV); try { csv.open(); @@ -274,12 +274,12 @@ private void compareWriterFile(String filePath, String delimiterStr, boolean ign } csv.close(); if (isQueryResultsCSV) { - appConfig.setValue(AppConfig.CSV_DELIMITER_FOR_QUERY_RESULTS, storedDelimiter); + appConfig.setValue(AppConfig.PROP_CSV_DELIMITER_FOR_QUERY_RESULTS, storedDelimiter); } else { - appConfig.setValue(AppConfig.CSV_DELIMITER_OTHER_VALUE, storedDelimiter); - appConfig.setValue(AppConfig.CSV_DELIMITER_COMMA, storedCsvDelimiterComma); - appConfig.setValue(AppConfig.CSV_DELIMITER_TAB, storedCsvDelimiterTab); - appConfig.setValue(AppConfig.CSV_DELIMITER_OTHER, storedCsvDelimiterOther); + appConfig.setValue(AppConfig.PROP_CSV_DELIMITER_OTHER_VALUE, storedDelimiter); + appConfig.setValue(AppConfig.PROP_CSV_DELIMITER_COMMA, storedCsvDelimiterComma); + appConfig.setValue(AppConfig.PROP_CSV_DELIMITER_TAB, storedCsvDelimiterTab); + appConfig.setValue(AppConfig.PROP_CSV_DELIMITER_OTHER, storedCsvDelimiterOther); } } } diff --git a/src/test/java/com/salesforce/dataloader/mapping/SOQLMapperTest.java b/src/test/java/com/salesforce/dataloader/mapping/SOQLMapperTest.java index b03647f3..31a928b4 100644 --- a/src/test/java/com/salesforce/dataloader/mapping/SOQLMapperTest.java +++ b/src/test/java/com/salesforce/dataloader/mapping/SOQLMapperTest.java @@ -60,7 +60,7 @@ public void createSoqlMapper() throws Exception { @Test public void testRelationshipQuery() throws Exception { - getController().getAppConfig().setValue(AppConfig.ENTITY, "User"); + getController().getAppConfig().setValue(AppConfig.PROP_ENTITY, "User"); soqlMapper.initSoqlMapping("select Id, Contact.Accountid from User"); List daoColumnsForSoql = soqlMapper.getDaoColumnsForSoql(); diff --git a/src/test/java/com/salesforce/dataloader/oauth/OAuthFlowUtilTests.java b/src/test/java/com/salesforce/dataloader/oauth/OAuthFlowUtilTests.java index 42aabc22..37c7fb1c 100644 --- a/src/test/java/com/salesforce/dataloader/oauth/OAuthFlowUtilTests.java +++ b/src/test/java/com/salesforce/dataloader/oauth/OAuthFlowUtilTests.java @@ -52,13 +52,13 @@ public class OAuthFlowUtilTests extends ConfigTestBase { @Before public void testSetup(){ appConfig = getController().getAppConfig(); - existingOAuthEnvironments = appConfig.getStrings(AppConfig.AUTH_ENVIRONMENTS); + existingOAuthEnvironments = appConfig.getStrings(AppConfig.PROP_AUTH_ENVIRONMENTS); existingEndPoint = appConfig.getAuthEndpoint(); oauthServer = "https://OAUTH_PARTIAL_SERVER"; oauthClientId = "CLIENTID"; oauthRedirectUri = "REDIRECTURI"; - appConfig.setValue(AppConfig.AUTH_ENVIRONMENTS, "Testing"); + appConfig.setValue(AppConfig.PROP_AUTH_ENVIRONMENTS, "Testing"); appConfig.setOAuthEnvironmentString("Testing", AppConfig.OAUTH_PARTIAL_SERVER, oauthServer); appConfig.setOAuthEnvironmentString("Testing", AppConfig.OAUTH_PARTIAL_CLIENTID, oauthClientId); appConfig.setOAuthEnvironmentString("Testing", AppConfig.OAUTH_PARTIAL_REDIRECTURI, oauthRedirectUri); @@ -67,14 +67,14 @@ public void testSetup(){ @After public void testCleanup(){ - appConfig.setValue(AppConfig.AUTH_ENVIRONMENTS, existingOAuthEnvironments.toArray(new String[0])); + appConfig.setValue(AppConfig.PROP_AUTH_ENVIRONMENTS, existingOAuthEnvironments.toArray(new String[0])); appConfig.setAuthEndpoint(existingEndPoint); } @Test public void testGetStartUrl(){ try { - appConfig.setValue(AppConfig.OAUTH_CLIENTID, "CLIENTID"); + appConfig.setValue(AppConfig.PROP_OAUTH_CLIENTID, "CLIENTID"); String expected = "https://OAUTH_PARTIAL_SERVER/services/oauth2/authorize" + "?response_type=token" + "&display=popup" @@ -115,7 +115,7 @@ public void testValidResponseUrlSetsAccessToken(){ try { OAuthFlowUtil.handleCompletedUrl( "https://OAUTH_PARTIAL_SERVER/services/oauth2/authorize#access_token=TOKEN&instance_url=https://INSTANCEURL", appConfig); String expected = "TOKEN"; - String actual = appConfig.getString(AppConfig.OAUTH_ACCESSTOKEN); + String actual = appConfig.getString(AppConfig.PROP_OAUTH_ACCESSTOKEN); Assert.assertEquals("Incorrect access token found in config", expected, actual); } catch (URISyntaxException e) { @@ -128,7 +128,7 @@ public void testValidResponseUrlSetsRefreshToken(){ try { OAuthFlowUtil.handleCompletedUrl( "https://OAUTH_PARTIAL_SERVER/services/oauth2/authorize#access_token=TOKEN&refresh_token=REFRESHTOKEN&instance_url=https://INSTANCEURL", appConfig); String expected = "REFRESHTOKEN"; - String actual = appConfig.getString(AppConfig.OAUTH_REFRESHTOKEN); + String actual = appConfig.getString(AppConfig.PROP_OAUTH_REFRESHTOKEN); Assert.assertEquals("Incorrect refresh token found in config", expected, actual); } catch (URISyntaxException e) { @@ -141,7 +141,7 @@ public void testValidResponseUrlSetsEndPoint(){ try { OAuthFlowUtil.handleCompletedUrl( "https://OAUTH_PARTIAL_SERVER/services/oauth2/authorize#access_token=TOKEN&instance_url=https://INSTANCEURL", appConfig); String expected = "https://INSTANCEURL"; - String actual = appConfig.getString(AppConfig.OAUTH_INSTANCE_URL); + String actual = appConfig.getString(AppConfig.PROP_OAUTH_INSTANCE_URL); Assert.assertEquals("Incorrect refresh token found in config", expected, actual); } catch (URISyntaxException e) { diff --git a/src/test/java/com/salesforce/dataloader/oauth/OAuthSecretFlowUtilTests.java b/src/test/java/com/salesforce/dataloader/oauth/OAuthSecretFlowUtilTests.java index 5f6f7aeb..1f1cd0f5 100644 --- a/src/test/java/com/salesforce/dataloader/oauth/OAuthSecretFlowUtilTests.java +++ b/src/test/java/com/salesforce/dataloader/oauth/OAuthSecretFlowUtilTests.java @@ -66,14 +66,14 @@ public class OAuthSecretFlowUtilTests extends ConfigTestBase { @Before public void testSetup(){ appConfig = getController().getAppConfig(); - existingOAuthEnvironments = appConfig.getStrings(AppConfig.AUTH_ENVIRONMENTS); + existingOAuthEnvironments = appConfig.getStrings(AppConfig.PROP_AUTH_ENVIRONMENTS); existingEndPoint = appConfig.getAuthEndpoint(); oauthServer = "https://OAUTH_PARTIAL_SERVER"; oauthClientId = "CLIENTID"; oauthRedirectUri = "https://REDIRECTURI"; mockSimplePost = mock(SimplePost.class); - appConfig.setValue(AppConfig.AUTH_ENVIRONMENTS, "Testing"); + appConfig.setValue(AppConfig.PROP_AUTH_ENVIRONMENTS, "Testing"); appConfig.setOAuthEnvironmentString("Testing", AppConfig.OAUTH_PARTIAL_SERVER, oauthServer); appConfig.setOAuthEnvironmentString("Testing", AppConfig.OAUTH_PARTIAL_CLIENTID, oauthClientId); appConfig.setOAuthEnvironmentString("Testing", AppConfig.OAUTH_PARTIAL_REDIRECTURI, oauthRedirectUri); @@ -85,7 +85,7 @@ public void testSetup(){ @After public void testCleanup(){ - appConfig.setValue(AppConfig.AUTH_ENVIRONMENTS, existingOAuthEnvironments.toArray(new String[0])); + appConfig.setValue(AppConfig.PROP_AUTH_ENVIRONMENTS, existingOAuthEnvironments.toArray(new String[0])); appConfig.setAuthEndpoint(existingEndPoint); SimplePostFactory.setConstructor(existingConstructor); } @@ -93,7 +93,7 @@ public void testCleanup(){ @Test public void testGetStartUrl(){ try { - appConfig.setValue(AppConfig.OAUTH_CLIENTID, "CLIENTID"); + appConfig.setValue(AppConfig.PROP_OAUTH_CLIENTID, "CLIENTID"); String expected = "https://OAUTH_PARTIAL_SERVER/services/oauth2/authorize" + "?response_type=code" + "&display=popup" @@ -150,7 +150,7 @@ public void testValidSecondResponseAccessToken(){ SimplePost simplePost = OAuthSecretFlowUtil.handleSecondPost("simplePost", appConfig); String expected = "ACCESS"; - String actual = appConfig.getString(AppConfig.OAUTH_ACCESSTOKEN); + String actual = appConfig.getString(AppConfig.PROP_OAUTH_ACCESSTOKEN); when(mockSimplePost.isSuccessful()).thenReturn(true); Assert.assertEquals("Access token was not set", expected, actual); @@ -179,7 +179,7 @@ public void testValidSecondResponseRefreshToken(){ SimplePost simplePost = OAuthSecretFlowUtil.handleSecondPost("simplePost", appConfig); String expected = "REFRESHTOKEN"; - String actual = appConfig.getString(AppConfig.OAUTH_REFRESHTOKEN); + String actual = appConfig.getString(AppConfig.PROP_OAUTH_REFRESHTOKEN); Assert.assertEquals("Access token was not set", expected, actual); @@ -206,7 +206,7 @@ public void testValidSecondResponseInstanceUrl(){ SimplePost simplePost = OAuthSecretFlowUtil.handleSecondPost("simplePost", appConfig); String expected = "https://INSTANCEURL"; - String actual = appConfig.getString(AppConfig.OAUTH_INSTANCE_URL);; + String actual = appConfig.getString(AppConfig.PROP_OAUTH_INSTANCE_URL);; Assert.assertEquals("Access token was not set", expected, actual); diff --git a/src/test/java/com/salesforce/dataloader/process/BulkV1CsvProcessTest.java b/src/test/java/com/salesforce/dataloader/process/BulkV1CsvProcessTest.java index 3932061a..ce6f0f00 100644 --- a/src/test/java/com/salesforce/dataloader/process/BulkV1CsvProcessTest.java +++ b/src/test/java/com/salesforce/dataloader/process/BulkV1CsvProcessTest.java @@ -69,15 +69,15 @@ public static void setUpData() { @Before public void createArgMap() { argMap = getTestConfig(OperationInfo.insert, CSV_FILE_PATH, getTestDataDir() + File.separator + "NAProcessTest.sdl", false); - argMap.put(AppConfig.ENTITY, "Task"); - argMap.remove(AppConfig.IDLOOKUP_FIELD); - argMap.put(AppConfig.BULK_API_ENABLED, Boolean.TRUE.toString()); + argMap.put(AppConfig.PROP_ENTITY, "Task"); + argMap.remove(AppConfig.PROP_IDLOOKUP_FIELD); + argMap.put(AppConfig.PROP_BULK_API_ENABLED, Boolean.TRUE.toString()); } @Test public void testBatchSizes() throws Exception { writeCsv(validRow, validRow); - argMap.put(AppConfig.IMPORT_BATCH_SIZE, "1"); + argMap.put(AppConfig.PROP_IMPORT_BATCH_SIZE, "1"); ILoaderProgress monitor = runProcess(argMap, 2, 0, 0, false); assertEquals("Inserting 2 rows with batch size of 1 should have produced 2 batches", 2, monitor.getNumberBatchesTotal()); } @@ -85,7 +85,7 @@ public void testBatchSizes() throws Exception { @Test public void testBatchSizesNotAlteredByInvalidData() throws Exception { writeCsv(validRow, invalidRow, validRow); - argMap.put(AppConfig.IMPORT_BATCH_SIZE, "2"); + argMap.put(AppConfig.PROP_IMPORT_BATCH_SIZE, "2"); ILoaderProgress monitor = runProcess(argMap, 2, 0, 1, false); assertEquals("Even though middle row contains invalid data only 1 batch should have been created", 1, monitor.getNumberBatchesTotal()); } diff --git a/src/test/java/com/salesforce/dataloader/process/CsvEncodingProcessTest.java b/src/test/java/com/salesforce/dataloader/process/CsvEncodingProcessTest.java index db06e512..9edf6bed 100644 --- a/src/test/java/com/salesforce/dataloader/process/CsvEncodingProcessTest.java +++ b/src/test/java/com/salesforce/dataloader/process/CsvEncodingProcessTest.java @@ -108,17 +108,17 @@ public void testUnicodeExtraction() throws Exception { private Map getBulkUnicodeExtractConfig(String soql) { final Map argMap = getTestConfig(OperationInfo.extract, true); - argMap.put(AppConfig.ENTITY, "Account"); - argMap.put(AppConfig.EXTRACT_SOQL, soql); - argMap.put(AppConfig.ENABLE_EXTRACT_STATUS_OUTPUT, AppConfig.TRUE); - argMap.put(AppConfig.EXPORT_BATCH_SIZE, "2000"); + argMap.put(AppConfig.PROP_ENTITY, "Account"); + argMap.put(AppConfig.PROP_EXTRACT_SOQL, soql); + argMap.put(AppConfig.PROP_ENABLE_EXTRACT_STATUS_OUTPUT, AppConfig.TRUE); + argMap.put(AppConfig.PROP_EXPORT_BATCH_SIZE, "2000"); argMap.putAll(config); - argMap.remove(AppConfig.MAPPING_FILE); + argMap.remove(AppConfig.PROP_MAPPING_FILE); return argMap; } private void validateExtraction(final String name, final Map testConfig) throws IOException { - FileInputStream fis = new FileInputStream(new File(testConfig.get(AppConfig.DAO_NAME))); + FileInputStream fis = new FileInputStream(new File(testConfig.get(AppConfig.PROP_DAO_NAME))); try { CSVReader rdr = new CSVReader(fis, StandardCharsets.UTF_8.name()); int nameidx = rdr.nextRecord().indexOf("Name"); diff --git a/src/test/java/com/salesforce/dataloader/process/CsvExtractAggregateQueryProcessTest.java b/src/test/java/com/salesforce/dataloader/process/CsvExtractAggregateQueryProcessTest.java index 61ca4436..6370c348 100644 --- a/src/test/java/com/salesforce/dataloader/process/CsvExtractAggregateQueryProcessTest.java +++ b/src/test/java/com/salesforce/dataloader/process/CsvExtractAggregateQueryProcessTest.java @@ -59,9 +59,9 @@ public class CsvExtractAggregateQueryProcessTest extends ProcessTestBase { @Before public void setUpTestConfig() { testConfig = getTestConfig(OperationInfo.extract, true); - testConfig.put(AppConfig.ENTITY, "Contact"); - testConfig.put(AppConfig.ENABLE_EXTRACT_STATUS_OUTPUT, AppConfig.TRUE); - testConfig.remove(AppConfig.MAPPING_FILE); + testConfig.put(AppConfig.PROP_ENTITY, "Contact"); + testConfig.put(AppConfig.PROP_ENABLE_EXTRACT_STATUS_OUTPUT, AppConfig.TRUE); + testConfig.remove(AppConfig.PROP_MAPPING_FILE); } @Test @@ -75,19 +75,19 @@ public void testAggregateQuery() throws Exception { } private void runExtraction(String extractionQuery) throws ProcessInitializationException, DataAccessObjectException { - testConfig.put(AppConfig.EXTRACT_SOQL, extractionQuery); - testConfig.put(AppConfig.LIMIT_OUTPUT_TO_QUERY_FIELDS, AppConfig.TRUE); + testConfig.put(AppConfig.PROP_EXTRACT_SOQL, extractionQuery); + testConfig.put(AppConfig.PROP_LIMIT_OUTPUT_TO_QUERY_FIELDS, AppConfig.TRUE); runProcess(testConfig, 1, true); } private void runExtractionDoNotLimitOutputToQueryFields(String extractionQuery) throws ProcessInitializationException, DataAccessObjectException { - testConfig.put(AppConfig.EXTRACT_SOQL, extractionQuery); - testConfig.put(AppConfig.LIMIT_OUTPUT_TO_QUERY_FIELDS, AppConfig.FALSE); + testConfig.put(AppConfig.PROP_EXTRACT_SOQL, extractionQuery); + testConfig.put(AppConfig.PROP_LIMIT_OUTPUT_TO_QUERY_FIELDS, AppConfig.FALSE); runProcess(testConfig, 1, true); } private void validateAccountNameInOutputFile(final String accountName, boolean isLimitOutputToQueryFields) throws IOException { - FileInputStream fis = new FileInputStream(new File(testConfig.get(AppConfig.DAO_NAME))); + FileInputStream fis = new FileInputStream(new File(testConfig.get(AppConfig.PROP_DAO_NAME))); try { CSVReader rdr = new CSVReader(fis, StandardCharsets.UTF_8.name()); int acctNameIndex = 0; diff --git a/src/test/java/com/salesforce/dataloader/process/CsvExtractProcessTest.java b/src/test/java/com/salesforce/dataloader/process/CsvExtractProcessTest.java index 43e2ca93..27c70905 100644 --- a/src/test/java/com/salesforce/dataloader/process/CsvExtractProcessTest.java +++ b/src/test/java/com/salesforce/dataloader/process/CsvExtractProcessTest.java @@ -178,7 +178,7 @@ public void testPolymorphicRelationshipExtract() throws Exception { GetUserInfoResult userInfo = getBinding().getUserInfo(); // open the results of the extraction - final CSVFileReader rdr = new CSVFileReader(new File(argmap.get(AppConfig.DAO_NAME)), getController().getAppConfig(), true, false); + final CSVFileReader rdr = new CSVFileReader(new File(argmap.get(AppConfig.PROP_DAO_NAME)), getController().getAppConfig(), true, false); rdr.open(); Row row = rdr.readRow(); assertNotNull(row); @@ -247,12 +247,12 @@ private void testLastRunOutput(boolean useDefault, String baseProcessName, boole throws DataAccessObjectException, ProcessInitializationException { final String soql = "Select ID FROM ACCOUNT WHERE " + ACCOUNT_WHERE_CLAUSE + " limit 1"; Map argMap = getExtractionTestConfig(soql, "Account", false); - argMap.remove(AppConfig.LAST_RUN_OUTPUT_DIR); + argMap.remove(AppConfig.PROP_LAST_RUN_OUTPUT_DIR); // set last run output paramerers if (!useDefault) { - argMap.put(AppConfig.ENABLE_LAST_RUN_OUTPUT, String.valueOf(enableOutput)); - argMap.put(AppConfig.LAST_RUN_OUTPUT_DIR, outputDir); + argMap.put(AppConfig.PROP_ENABLE_LAST_RUN_OUTPUT, String.valueOf(enableOutput)); + argMap.put(AppConfig.PROP_LAST_RUN_OUTPUT_DIR, outputDir); } this.baseName = baseProcessName; @@ -262,9 +262,9 @@ private void testLastRunOutput(boolean useDefault, String baseProcessName, boole String lastRunFilePath = appConfig.getLastRunFilename(); File lastRunFile = new File(lastRunFilePath); try { - String lastrunFileNamePrefix = appConfig.getString(AppConfig.PROCESS_NAME); + String lastrunFileNamePrefix = appConfig.getString(AppConfig.PROP_PROCESS_NAME); if (lastrunFileNamePrefix == null || lastrunFileNamePrefix.isBlank()) { - lastrunFileNamePrefix = appConfig.getString(AppConfig.ENTITY) + appConfig.getString(AppConfig.OPERATION); + lastrunFileNamePrefix = appConfig.getString(AppConfig.PROP_ENTITY) + appConfig.getString(AppConfig.PROP_OPERATION); } String defaultFileName = lastrunFileNamePrefix + "_lastRun.properties"; File expectedFile = useDefault ? new File(appConfig.constructConfigFilePath(defaultFileName)) : new File( @@ -318,7 +318,7 @@ private void testBinaryDataInRTFQueryResult(String inclueRTFBinaryData) throws E getTestDataDir() + "/acctsWithBinaryDataInRTF.csv", false); Controller controller = runProcess(insertArgMap, 1); List ids = new ArrayList(); - String fileName = controller.getAppConfig().getString(AppConfig.OUTPUT_SUCCESS); + String fileName = controller.getAppConfig().getString(AppConfig.PROP_OUTPUT_SUCCESS); final CSVFileReader successRdr = new CSVFileReader(new File(fileName), getController().getAppConfig(), true, false); String idFieldName = this.isBulkV2APIEnabled(insertArgMap)?"sf__Id":"ID"; try { @@ -335,11 +335,11 @@ private void testBinaryDataInRTFQueryResult(String inclueRTFBinaryData) throws E // set config property loader.query.includeBinaryData to true String soql = "Select ID,RICHTEXT__C FROM Account where id='" + ids.get(0) + "'"; Map queryArgMap = getExtractionTestConfig(soql, "Account", false); - queryArgMap.put(AppConfig.INCLUDE_RICH_TEXT_FIELD_DATA_IN_QUERY_RESULTS, inclueRTFBinaryData); + queryArgMap.put(AppConfig.PROP_INCLUDE_RICH_TEXT_FIELD_DATA_IN_QUERY_RESULTS, inclueRTFBinaryData); // query the account and verify results controller = runProcess(queryArgMap, 1); - CSVFileReader queryResultsReader = new CSVFileReader(new File(queryArgMap.get(AppConfig.DAO_NAME)), getController().getAppConfig(), true, false); + CSVFileReader queryResultsReader = new CSVFileReader(new File(queryArgMap.get(AppConfig.PROP_DAO_NAME)), getController().getAppConfig(), true, false); queryResultsReader.open(); Row queryResultsRow = queryResultsReader.readRow(); String queryResultsRTVal = (String)queryResultsRow.get("RICHTEXT__c"); @@ -350,7 +350,7 @@ private void testBinaryDataInRTFQueryResult(String inclueRTFBinaryData) throws E Row uploadedRow = uploadedCSVReader.readRow(); String uploadedRTVal = (String)queryResultsRow.get("RICHTEXT__c"); assertEquals("Binary data in query result file does not match uploaded data: " - + queryArgMap.get(AppConfig.DAO_NAME), queryResultsRTVal, uploadedRTVal); + + queryArgMap.get(AppConfig.PROP_DAO_NAME), queryResultsRTVal, uploadedRTVal); } else { assertTrue(queryResultsRTVal.contains(".file.force.com/servlet/rtaImage?")); } diff --git a/src/test/java/com/salesforce/dataloader/process/CsvHardDeleteTest.java b/src/test/java/com/salesforce/dataloader/process/CsvHardDeleteTest.java index c30bd44d..e4ba9896 100644 --- a/src/test/java/com/salesforce/dataloader/process/CsvHardDeleteTest.java +++ b/src/test/java/com/salesforce/dataloader/process/CsvHardDeleteTest.java @@ -99,7 +99,7 @@ public void testHardDeleteUserPermOff() throws Exception { // attempt to hard delete 100 accounts as a user without the "Bulk API Hard Delete" user perm enabled final Map argMap = getHardDeleteTestConfig(new AccountIdTemplateListener(100)); // change the configured user to be the standard user (ie without the perm) - argMap.put(AppConfig.USERNAME, getProperty("test.user.restricted")); + argMap.put(AppConfig.PROP_USERNAME, getProperty("test.user.restricted")); runProcessNegative(argMap, "You need the Bulk API Hard Delete user permission to permanently delete records."); } @@ -152,8 +152,8 @@ public void testHardDeleteBulkApiSetToFalse() throws DataAccessObjectException { // set batch process parameters Map argMap = getHardDeleteTestConfig(new AccountIdTemplateListener(1)); - argMap.remove(AppConfig.BULK_API_ENABLED); - argMap.remove(AppConfig.BULKV2_API_ENABLED); + argMap.remove(AppConfig.PROP_BULK_API_ENABLED); + argMap.remove(AppConfig.PROP_BULKV2_API_ENABLED); try { runProcess(argMap, 889); Assert.fail("hard delete should not succeed if bulk api is turned off"); @@ -221,7 +221,7 @@ public void testHardDeleteInvalidIDFailsOtherValidIDPasses() throws Exception { public void testHardDeleteIDFromOtherObjectFails() throws Exception { // set batch process parameters Map argMap = getHardDeleteTestConfig(new AccountIdTemplateListener(1)); - argMap.put(AppConfig.ENTITY, "Contact"); + argMap.put(AppConfig.PROP_ENTITY, "Contact"); Controller theController = runProcessWithErrors(argMap, 0, 1); // verify there were errors during operation diff --git a/src/test/java/com/salesforce/dataloader/process/CsvProcessAttachmentTest.java b/src/test/java/com/salesforce/dataloader/process/CsvProcessAttachmentTest.java index 79eb2c85..6ab68d1e 100644 --- a/src/test/java/com/salesforce/dataloader/process/CsvProcessAttachmentTest.java +++ b/src/test/java/com/salesforce/dataloader/process/CsvProcessAttachmentTest.java @@ -91,12 +91,12 @@ public void testCreateAttachment() throws ProcessInitializationException, DataAc new AttachmentTemplateListener()); final Map argMap = getTestConfig(OperationInfo.insert, fileName, false); - argMap.put(AppConfig.ENTITY, "Attachment"); + argMap.put(AppConfig.PROP_ENTITY, "Attachment"); // this feature does not work when bulk api is enabled but the zip content type is not final boolean bulkApi = isBulkAPIEnabled(argMap); final boolean bulkV2Api = isBulkV2APIEnabled(argMap); - final boolean zipContent = isSettingEnabled(argMap, AppConfig.BULK_API_ZIP_CONTENT); + final boolean zipContent = isSettingEnabled(argMap, AppConfig.PROP_BULK_API_ZIP_CONTENT); if ((bulkApi || bulkV2Api) && !zipContent) { final String failureMessage = "Data Loader cannot map \"Body\" field using Bulk API and CSV content type. Please enable the ZIP_CSV content type for Bulk API."; runProcessNegative(argMap, failureMessage); @@ -116,7 +116,7 @@ public void testPolymorphicRelationshipInAttachment() throws ProcessInitializati // this feature does not work when bulk api is enabled but the zip content type is not final boolean bulkApi = isBulkAPIEnabled(configMap); final boolean bulkV2Api = isBulkV2APIEnabled(configMap); - final boolean zipContent = isSettingEnabled(configMap, AppConfig.BULK_API_ZIP_CONTENT); + final boolean zipContent = isSettingEnabled(configMap, AppConfig.PROP_BULK_API_ZIP_CONTENT); if (bulkApi && !zipContent) { // attachment is supported only if content is zipped return; @@ -138,7 +138,7 @@ public void testPolymorphicRelationshipInAttachment() throws ProcessInitializati results = getBinding().create(parentContacts); parentContacts[0].addField("id", results[0]); - configMap.put(AppConfig.ENTITY, "Attachment"); + configMap.put(AppConfig.PROP_ENTITY, "Attachment"); runProcess(configMap, 2); } @@ -156,14 +156,14 @@ public void testCreateAttachmentMultipleFiles() throws Exception { myAttachmentTemplateListener); final Map argMap = getTestConfig(OperationInfo.insert, fileName, false); - argMap.put(AppConfig.ENTITY, "Attachment"); + argMap.put(AppConfig.PROP_ENTITY, "Attachment"); // force multiple batches - argMap.put(AppConfig.IMPORT_BATCH_SIZE, "1"); + argMap.put(AppConfig.PROP_IMPORT_BATCH_SIZE, "1"); // this feature does not work when bulk api is enabled but the zip content type is not final boolean bulkApi = isBulkAPIEnabled(argMap); final boolean bulkV2Api = isBulkV2APIEnabled(argMap); - final boolean zipContent = isSettingEnabled(argMap, AppConfig.BULK_API_ZIP_CONTENT); + final boolean zipContent = isSettingEnabled(argMap, AppConfig.PROP_BULK_API_ZIP_CONTENT); if ((bulkApi || bulkV2Api) && !zipContent) { final String failureMessage = "Data Loader cannot map \"Body\" field using Bulk API and CSV content type. Please enable the ZIP_CSV content type for Bulk API."; runProcessNegative(argMap, failureMessage); @@ -237,7 +237,7 @@ private Controller runProcessWithErrorsWithAttachmentListener(Map getParameters() { @Test public void testInsertAccountCsv() throws Exception { Map configMap = getTestConfig(OperationInfo.insert, false); - if (isSettingEnabled(configMap, AppConfig.BULK_API_ZIP_CONTENT) + if (isSettingEnabled(configMap, AppConfig.PROP_BULK_API_ZIP_CONTENT) || isSettingEnabled(configMap, AppConfig.PROCESS_BULK_CACHE_DATA_FROM_DAO) - || isSettingEnabled(configMap, AppConfig.BULK_API_SERIAL_MODE) - || isSettingEnabled(configMap, AppConfig.NO_COMPRESSION) + || isSettingEnabled(configMap, AppConfig.PROP_BULK_API_SERIAL_MODE) + || isSettingEnabled(configMap, AppConfig.PROP_NO_COMPRESSION) ) { return; } @@ -107,16 +107,16 @@ public void testInsertAccountCsv() throws Exception { @Test public void testInsertAccountWithMultipleBatchesCSV() throws ProcessInitializationException, DataAccessObjectException { Map configMap = getTestConfig(OperationInfo.insert, false); - if (isSettingEnabled(configMap, AppConfig.BULK_API_ZIP_CONTENT) - || isSettingEnabled(configMap, AppConfig.UPDATE_WITH_EXTERNALID) - || isSettingEnabled(configMap, AppConfig.BULK_API_SERIAL_MODE) - || isSettingEnabled(configMap, AppConfig.NO_COMPRESSION) + if (isSettingEnabled(configMap, AppConfig.PROP_BULK_API_ZIP_CONTENT) + || isSettingEnabled(configMap, AppConfig.PROP_UPDATE_WITH_EXTERNALID) + || isSettingEnabled(configMap, AppConfig.PROP_BULK_API_SERIAL_MODE) + || isSettingEnabled(configMap, AppConfig.PROP_NO_COMPRESSION) ) { return; } - configMap.put(AppConfig.IMPORT_BATCH_SIZE, "1"); + configMap.put(AppConfig.PROP_IMPORT_BATCH_SIZE, "1"); Controller controller = runProcessWithErrors(configMap, 2, 1); - String successFileName = controller.getAppConfig().getString(AppConfig.OUTPUT_SUCCESS); + String successFileName = controller.getAppConfig().getString(AppConfig.PROP_OUTPUT_SUCCESS); File successFile = new File(successFileName); CSVFileReader csvReader = new CSVFileReader(successFile, controller.getAppConfig(), false, false); Row row1 = csvReader.readRow(); @@ -137,11 +137,11 @@ public void testInsertAccountWithMultipleBatchesCSV() throws ProcessInitializati @Test public void testInsertTaskWithContactAsWhoCsv() throws Exception { Map configMap = getTestConfig(OperationInfo.insert, false); - if (isSettingEnabled(configMap, AppConfig.BULK_API_ZIP_CONTENT) - || isSettingEnabled(configMap, AppConfig.UPDATE_WITH_EXTERNALID) + if (isSettingEnabled(configMap, AppConfig.PROP_BULK_API_ZIP_CONTENT) + || isSettingEnabled(configMap, AppConfig.PROP_UPDATE_WITH_EXTERNALID) || isSettingEnabled(configMap, AppConfig.PROCESS_BULK_CACHE_DATA_FROM_DAO) - || isSettingEnabled(configMap, AppConfig.BULK_API_SERIAL_MODE) - || isSettingEnabled(configMap, AppConfig.NO_COMPRESSION) + || isSettingEnabled(configMap, AppConfig.PROP_BULK_API_SERIAL_MODE) + || isSettingEnabled(configMap, AppConfig.PROP_NO_COMPRESSION) ) { return; } @@ -157,11 +157,11 @@ public void testInsertTaskWithContactAsWhoCsv() throws Exception { Object extIdValue = getRandomExtId("Contact", CONTACT_WHERE_CLAUSE, null); sforceMapping.put(extIdField, extIdValue); - String oldExtIdField = getController().getAppConfig().getString(AppConfig.IDLOOKUP_FIELD); + String oldExtIdField = getController().getAppConfig().getString(AppConfig.PROP_IDLOOKUP_FIELD); setExtIdField(extIdField); doUpsert("Contact", sforceMapping); setExtIdField(oldExtIdField); - configMap.put(AppConfig.ENTITY, "Task"); + configMap.put(AppConfig.PROP_ENTITY, "Task"); runProcess(configMap, 1); } @@ -171,11 +171,11 @@ public void testInsertTaskWithContactAsWhoCsv() throws Exception { @Test public void testUpdateAccountCsv() throws Exception { Map configMap = getUpdateTestConfig(false, null, 100); - if (isSettingEnabled(configMap, AppConfig.BULK_API_ZIP_CONTENT) + if (isSettingEnabled(configMap, AppConfig.PROP_BULK_API_ZIP_CONTENT) || isSettingEnabled(configMap, AppConfig.PROCESS_BULK_CACHE_DATA_FROM_DAO) - || isSettingEnabled(configMap, AppConfig.BULK_API_SERIAL_MODE) - || isSettingEnabled(configMap, AppConfig.NO_COMPRESSION) - || isSettingEnabled(configMap, AppConfig.UPDATE_WITH_EXTERNALID) + || isSettingEnabled(configMap, AppConfig.PROP_BULK_API_SERIAL_MODE) + || isSettingEnabled(configMap, AppConfig.PROP_NO_COMPRESSION) + || isSettingEnabled(configMap, AppConfig.PROP_UPDATE_WITH_EXTERNALID) ) { return; } @@ -185,7 +185,7 @@ public void testUpdateAccountCsv() throws Exception { @Test public void testUpdateAccountWithExternalIdCsv() throws Exception { Map configMap = getUpdateTestConfig(false, null, 5); - if (!isSettingEnabled(configMap, AppConfig.UPDATE_WITH_EXTERNALID)) { + if (!isSettingEnabled(configMap, AppConfig.PROP_UPDATE_WITH_EXTERNALID)) { return; } runProcess(configMap, 5); @@ -197,11 +197,11 @@ public void testUpdateAccountWithExternalIdCsv() throws Exception { @Test public void testUpsertAccountCsv() throws Exception { Map configMap = getUpdateTestConfig(true, DEFAULT_ACCOUNT_EXT_ID_FIELD, 50); - if (isSettingEnabled(configMap, AppConfig.BULK_API_ZIP_CONTENT) - || isSettingEnabled(configMap, AppConfig.UPDATE_WITH_EXTERNALID) + if (isSettingEnabled(configMap, AppConfig.PROP_BULK_API_ZIP_CONTENT) + || isSettingEnabled(configMap, AppConfig.PROP_UPDATE_WITH_EXTERNALID) || isSettingEnabled(configMap, AppConfig.PROCESS_BULK_CACHE_DATA_FROM_DAO) - || isSettingEnabled(configMap, AppConfig.BULK_API_SERIAL_MODE) - || isSettingEnabled(configMap, AppConfig.NO_COMPRESSION) + || isSettingEnabled(configMap, AppConfig.PROP_BULK_API_SERIAL_MODE) + || isSettingEnabled(configMap, AppConfig.PROP_NO_COMPRESSION) ) { return; } @@ -223,10 +223,10 @@ public void testUpsertAccountCsv() throws Exception { @Test public void testConstantMappingInCsv() throws Exception { Map configMap = getTestConfig(OperationInfo.insert, false); - if (isSettingEnabled(configMap, AppConfig.BULK_API_ZIP_CONTENT) + if (isSettingEnabled(configMap, AppConfig.PROP_BULK_API_ZIP_CONTENT) || isSettingEnabled(configMap, AppConfig.PROCESS_BULK_CACHE_DATA_FROM_DAO) - || isSettingEnabled(configMap, AppConfig.BULK_API_SERIAL_MODE) - || isSettingEnabled(configMap, AppConfig.NO_COMPRESSION) + || isSettingEnabled(configMap, AppConfig.PROP_BULK_API_SERIAL_MODE) + || isSettingEnabled(configMap, AppConfig.PROP_NO_COMPRESSION) ) { return; } @@ -262,10 +262,10 @@ public void testConstantMappingInCsv() throws Exception { public void testDescriptionAsConstantMappingInCsv() throws Exception { Map configMap = getTestConfig(OperationInfo.insert, getTestDataDir() + "/constantMappingInCsv.csv", false); - if (isSettingEnabled(configMap, AppConfig.BULK_API_ZIP_CONTENT) + if (isSettingEnabled(configMap, AppConfig.PROP_BULK_API_ZIP_CONTENT) || isSettingEnabled(configMap, AppConfig.PROCESS_BULK_CACHE_DATA_FROM_DAO) - || isSettingEnabled(configMap, AppConfig.BULK_API_SERIAL_MODE) - || isSettingEnabled(configMap, AppConfig.NO_COMPRESSION) + || isSettingEnabled(configMap, AppConfig.PROP_BULK_API_SERIAL_MODE) + || isSettingEnabled(configMap, AppConfig.PROP_NO_COMPRESSION) ) { return; } @@ -297,10 +297,10 @@ public void testDescriptionAsConstantMappingInCsv() throws Exception { public void testFieldAndConstantFieldClash() throws Exception { Map configMap = getTestConfig(OperationInfo.insert, getTestDataDir() + "/constantMappingInCsvClashing.csv", false); - if (isSettingEnabled(configMap, AppConfig.BULK_API_ZIP_CONTENT) + if (isSettingEnabled(configMap, AppConfig.PROP_BULK_API_ZIP_CONTENT) || isSettingEnabled(configMap, AppConfig.PROCESS_BULK_CACHE_DATA_FROM_DAO) - || isSettingEnabled(configMap, AppConfig.BULK_API_SERIAL_MODE) - || isSettingEnabled(configMap, AppConfig.NO_COMPRESSION) + || isSettingEnabled(configMap, AppConfig.PROP_BULK_API_SERIAL_MODE) + || isSettingEnabled(configMap, AppConfig.PROP_NO_COMPRESSION) ) { return; } @@ -363,7 +363,7 @@ public void testNullConstantAssignment() throws Exception { private SObject[] retrieveAccounts(Controller resultController, String... accountFieldsToReturn) throws Exception { List ids = new ArrayList(); - String fileName = resultController.getAppConfig().getString(AppConfig.OUTPUT_SUCCESS); + String fileName = resultController.getAppConfig().getString(AppConfig.PROP_OUTPUT_SUCCESS); final CSVFileReader successRdr = new CSVFileReader(new File(fileName), getController().getAppConfig(), true, false); try { // TODO: revise the use of Integer.MAX_VALUE @@ -396,7 +396,7 @@ private SObject[] retrieveAccounts(Controller resultController, String... accoun @Test public void testUpsertFkAccountOldFormatCsv() throws Exception { Map configMap = getTestConfig(OperationInfo.upsert, false); - if (isSettingEnabled(configMap, AppConfig.UPDATE_WITH_EXTERNALID)) { + if (isSettingEnabled(configMap, AppConfig.PROP_UPDATE_WITH_EXTERNALID)) { return; } // manually inserts 100 accounts, then upserts specifying account parent for 50 accounts @@ -406,7 +406,7 @@ public void testUpsertFkAccountOldFormatCsv() throws Exception { @Test public void testUpsertFkAccountNewFormatCsv() throws Exception { Map configMap = getTestConfig(OperationInfo.upsert, false); - if (isSettingEnabled(configMap, AppConfig.UPDATE_WITH_EXTERNALID)) { + if (isSettingEnabled(configMap, AppConfig.PROP_UPDATE_WITH_EXTERNALID)) { return; } // manually inserts 100 accounts, then upserts specifying account parent for 5 accounts @@ -419,7 +419,7 @@ public void testUpsertFkAccountNewFormatCsv() throws Exception { @Test public void testDeleteAccountCsv() throws Exception { Map configMap = getTestConfig(OperationInfo.delete, false); - if (isSettingEnabled(configMap, AppConfig.UPDATE_WITH_EXTERNALID)) { + if (isSettingEnabled(configMap, AppConfig.PROP_UPDATE_WITH_EXTERNALID)) { return; } AccountIdTemplateListener listener = new AccountIdTemplateListener(100); @@ -428,14 +428,14 @@ public void testDeleteAccountCsv() throws Exception { Controller theController = runProcess(argMap, 100); String[] accountIds = listener.getAccountIds(); verifySuccessIds(theController, accountIds); - if (argMap.containsKey(AppConfig.BULK_API_ENABLED) && argMap.get(AppConfig.BULK_API_ENABLED).equalsIgnoreCase("true")) { + if (argMap.containsKey(AppConfig.PROP_BULK_API_ENABLED) && argMap.get(AppConfig.PROP_BULK_API_ENABLED).equalsIgnoreCase("true")) { return; } // partner API - do an undelete operation - argMap.put(AppConfig.OPERATION, OperationInfo.undelete.name()); + argMap.put(AppConfig.PROP_OPERATION, OperationInfo.undelete.name()); theController = runProcess(argMap, 100); verifySuccessIds(theController, accountIds); - argMap.put(AppConfig.OPERATION, OperationInfo.delete.name()); + argMap.put(AppConfig.PROP_OPERATION, OperationInfo.delete.name()); theController = runProcess(argMap, 100); verifySuccessIds(theController, accountIds); } @@ -462,8 +462,8 @@ public void testCreateAttachment() throws Exception { new AttachmentTemplateListener()); final Map argMap = getTestConfig(OperationInfo.insert, fileName, false); - argMap.put(AppConfig.ENTITY, "Attachment"); - if (isSettingEnabled(argMap, AppConfig.UPDATE_WITH_EXTERNALID)) { + argMap.put(AppConfig.PROP_ENTITY, "Attachment"); + if (isSettingEnabled(argMap, AppConfig.PROP_UPDATE_WITH_EXTERNALID)) { return; } if (isSettingEnabled(argMap, AppConfig.PROCESS_BULK_CACHE_DATA_FROM_DAO)) { @@ -473,7 +473,7 @@ public void testCreateAttachment() throws Exception { // this feature does not work when bulk api is enabled but the zip content type is not final boolean bulkApi = isBulkAPIEnabled(argMap); final boolean bulkV2Api = isBulkV2APIEnabled(argMap); - final boolean zipContent = isSettingEnabled(argMap, AppConfig.BULK_API_ZIP_CONTENT); + final boolean zipContent = isSettingEnabled(argMap, AppConfig.PROP_BULK_API_ZIP_CONTENT); if ((bulkApi || bulkV2Api) && !zipContent) { final String failureMessage = "Data Loader cannot map \"Body\" field using Bulk API and CSV content type. Please enable the ZIP_CSV content type for Bulk API."; runProcessNegative(argMap, failureMessage); @@ -500,7 +500,7 @@ public void testNonMappedFieldsPermittedInDLTransaction() throws Exception { // insert the values Map argumentMap = getTestConfig(OperationInfo.insert, getTestDataDir() + "/accountsForInsert.csv", false); - if (isSettingEnabled(argumentMap, AppConfig.UPDATE_WITH_EXTERNALID)) { + if (isSettingEnabled(argumentMap, AppConfig.PROP_UPDATE_WITH_EXTERNALID)) { return; } SObject[] returnedAccounts = retrieveAccounts(runProcess(argumentMap, numberOfRows), "ShippingState", @@ -537,17 +537,17 @@ private void _doTestHtmlFormattingInInsert(boolean preserveWhitespaceInRichText) getTestDataDir() + "/accountsForInsert.csv", getTestDataDir() + "/nonMappedFieldsPermittedInDLTransactionMap.sdl", false); - if (isSettingEnabled(argumentMap, AppConfig.UPDATE_WITH_EXTERNALID)) { + if (isSettingEnabled(argumentMap, AppConfig.PROP_UPDATE_WITH_EXTERNALID)) { return; } - if (isSettingEnabled(argumentMap, AppConfig.BULK_API_ZIP_CONTENT) + if (isSettingEnabled(argumentMap, AppConfig.PROP_BULK_API_ZIP_CONTENT) || isSettingEnabled(argumentMap, AppConfig.PROCESS_BULK_CACHE_DATA_FROM_DAO) - || isSettingEnabled(argumentMap, AppConfig.BULK_API_SERIAL_MODE) - || isSettingEnabled(argumentMap, AppConfig.NO_COMPRESSION) + || isSettingEnabled(argumentMap, AppConfig.PROP_BULK_API_SERIAL_MODE) + || isSettingEnabled(argumentMap, AppConfig.PROP_NO_COMPRESSION) ) { return; } - argumentMap.put(AppConfig.LOAD_PRESERVE_WHITESPACE_IN_RICH_TEXT, + argumentMap.put(AppConfig.PROP_LOAD_PRESERVE_WHITESPACE_IN_RICH_TEXT, Boolean.toString(preserveWhitespaceInRichText)); @@ -634,11 +634,11 @@ public void testTimezoneNotTruncated() throws Exception { //find the csv file Map argumentMap = getTestConfig(OperationInfo.insert, getTestDataDir() + "/timeZoneFormatTesting.csv", false); - if (isSettingEnabled(argumentMap, AppConfig.BULK_API_ZIP_CONTENT) - || isSettingEnabled(argumentMap, AppConfig.UPDATE_WITH_EXTERNALID) + if (isSettingEnabled(argumentMap, AppConfig.PROP_BULK_API_ZIP_CONTENT) + || isSettingEnabled(argumentMap, AppConfig.PROP_UPDATE_WITH_EXTERNALID) || isSettingEnabled(argumentMap, AppConfig.PROCESS_BULK_CACHE_DATA_FROM_DAO) - || isSettingEnabled(argumentMap, AppConfig.BULK_API_SERIAL_MODE) - || isSettingEnabled(argumentMap, AppConfig.NO_COMPRESSION) + || isSettingEnabled(argumentMap, AppConfig.PROP_BULK_API_SERIAL_MODE) + || isSettingEnabled(argumentMap, AppConfig.PROP_NO_COMPRESSION) ) { return; } @@ -690,11 +690,11 @@ public void testOneToManySforceFieldsMappingInCsv() throws Exception { // insert the values Map argumentMap = getTestConfig(OperationInfo.insert, getTestDataDir() + "/oneToManySforceFieldsMappingInCsv.csv", false); - if (isSettingEnabled(argumentMap, AppConfig.BULK_API_ZIP_CONTENT) - || isSettingEnabled(argumentMap, AppConfig.UPDATE_WITH_EXTERNALID) + if (isSettingEnabled(argumentMap, AppConfig.PROP_BULK_API_ZIP_CONTENT) + || isSettingEnabled(argumentMap, AppConfig.PROP_UPDATE_WITH_EXTERNALID) || isSettingEnabled(argumentMap, AppConfig.PROCESS_BULK_CACHE_DATA_FROM_DAO) - || isSettingEnabled(argumentMap, AppConfig.BULK_API_SERIAL_MODE) - || isSettingEnabled(argumentMap, AppConfig.NO_COMPRESSION) + || isSettingEnabled(argumentMap, AppConfig.PROP_BULK_API_SERIAL_MODE) + || isSettingEnabled(argumentMap, AppConfig.PROP_NO_COMPRESSION) ) { return; } @@ -714,7 +714,7 @@ public void testOneToManySforceFieldsMappingInCsv() throws Exception { } // test with insert nulls set to true. - argumentMap.put(AppConfig.INSERT_NULLS, "true"); + argumentMap.put(AppConfig.PROP_INSERT_NULLS, "true"); controller = runProcess(argumentMap, 2); for (SObject acct : retrieveAccounts(controller, "Name", "Description", "BillingState", "ShippingState")) { if ("ABC Corp".equals(acct.getField("Name"))) { @@ -734,11 +734,11 @@ public void testOneToManySforceFieldsMappingInCsv() throws Exception { @Test public void testEmptyFirstRowFieldValueInCsv() throws Exception { Map argumentMap = getUpdateTestConfig(false, null, 2); - if (isSettingEnabled(argumentMap, AppConfig.BULK_API_ZIP_CONTENT) + if (isSettingEnabled(argumentMap, AppConfig.PROP_BULK_API_ZIP_CONTENT) || isSettingEnabled(argumentMap, AppConfig.PROCESS_BULK_CACHE_DATA_FROM_DAO) - || isSettingEnabled(argumentMap, AppConfig.BULK_API_SERIAL_MODE) - || isSettingEnabled(argumentMap, AppConfig.NO_COMPRESSION) - || isSettingEnabled(argumentMap, AppConfig.UPDATE_WITH_EXTERNALID) + || isSettingEnabled(argumentMap, AppConfig.PROP_BULK_API_SERIAL_MODE) + || isSettingEnabled(argumentMap, AppConfig.PROP_NO_COMPRESSION) + || isSettingEnabled(argumentMap, AppConfig.PROP_UPDATE_WITH_EXTERNALID) ) { return; } @@ -769,8 +769,8 @@ private void runTestErrorsGeneratedOnInvalidDateMatchWithOffset(Integer rowOffse //find the csv file Map argumentMap = getTestConfig(OperationInfo.insert, getTestDataDir() + "/timeZoneFormatTestingWithErrors.csv", false); - argumentMap.put(AppConfig.LOAD_ROW_TO_START_AT, rowOffset.toString()); - if (isSettingEnabled(argumentMap, AppConfig.UPDATE_WITH_EXTERNALID)) { + argumentMap.put(AppConfig.PROP_LOAD_ROW_TO_START_AT, rowOffset.toString()); + if (isSettingEnabled(argumentMap, AppConfig.PROP_UPDATE_WITH_EXTERNALID)) { return; } diff --git a/src/test/java/com/salesforce/dataloader/process/CsvProcessWithOffsetTest.java b/src/test/java/com/salesforce/dataloader/process/CsvProcessWithOffsetTest.java index 5b8f3275..f78ed6c9 100644 --- a/src/test/java/com/salesforce/dataloader/process/CsvProcessWithOffsetTest.java +++ b/src/test/java/com/salesforce/dataloader/process/CsvProcessWithOffsetTest.java @@ -141,7 +141,7 @@ private void runOffsetValueTest(Object offset, int numberOfInserts) throws Excep expectedUpdates); // now check offset specs - String rowOffset = ctl.getAppConfig().getString(AppConfig.LOAD_ROW_TO_START_AT); + String rowOffset = ctl.getAppConfig().getString(AppConfig.PROP_LOAD_ROW_TO_START_AT); if (rowOffset != null) { verifyOffsetFromInputAndOutputFiles(iOffset, ctl.getAppConfig()); @@ -157,15 +157,15 @@ private void verifyOffsetFromInputAndOutputFiles(int numberOfOffsetRows, AppConf // finding rows in input file and opening it - numberOfInputRows = getNumCsvRows(cfg, AppConfig.DAO_NAME); + numberOfInputRows = getNumCsvRows(cfg, AppConfig.PROP_DAO_NAME); // finding rows in success file and opening it - CSVFileReader successFileReader = openConfiguredPath(cfg, AppConfig.OUTPUT_SUCCESS); - numberOfSuccessRows = getNumCsvRows(cfg, AppConfig.OUTPUT_SUCCESS); + CSVFileReader successFileReader = openConfiguredPath(cfg, AppConfig.PROP_OUTPUT_SUCCESS); + numberOfSuccessRows = getNumCsvRows(cfg, AppConfig.PROP_OUTPUT_SUCCESS); // finding rows in error file and opening it - CSVFileReader errorFileReader = openConfiguredPath(cfg, AppConfig.OUTPUT_ERROR); - numberOfErrorRows = getNumCsvRows(cfg, AppConfig.OUTPUT_ERROR); + CSVFileReader errorFileReader = openConfiguredPath(cfg, AppConfig.PROP_OUTPUT_ERROR); + numberOfErrorRows = getNumCsvRows(cfg, AppConfig.PROP_OUTPUT_ERROR); if (numberOfOffsetRows <= numberOfInputRows) { assertEquals("Number of lines between input and output do not match", numberOfInputRows, @@ -193,7 +193,7 @@ private void verifyOffsetFromInputAndOutputFiles(int numberOfOffsetRows, AppConf } if (numberOfInputRows > 0) { - final CSVFileReader inputFileReader = openConfiguredPath(cfg, AppConfig.DAO_NAME); + final CSVFileReader inputFileReader = openConfiguredPath(cfg, AppConfig.PROP_DAO_NAME); getFirstRow(firstInputOffsetAdjustedRow, inputFileReader, false, numberOfOffsetRows); getLastRow(lastInputRow, inputFileReader, false); @@ -264,7 +264,7 @@ private void getLastRow(Row rowResult, CSVFileReader reader, boolean isSuccessFi private Map getRowOffsetTestConfig(Object offset, int numInserts) throws DataAccessObjectException { final Map argMap = getUpdateTestConfig(FILE_NAME_BASE, true, DEFAULT_ACCOUNT_EXT_ID_FIELD, numInserts); - argMap.put(AppConfig.LOAD_ROW_TO_START_AT, offset.toString()); + argMap.put(AppConfig.PROP_LOAD_ROW_TO_START_AT, offset.toString()); return argMap; } } diff --git a/src/test/java/com/salesforce/dataloader/process/CsvUpsertProcessTest.java b/src/test/java/com/salesforce/dataloader/process/CsvUpsertProcessTest.java index 112cdc09..0cb6b689 100644 --- a/src/test/java/com/salesforce/dataloader/process/CsvUpsertProcessTest.java +++ b/src/test/java/com/salesforce/dataloader/process/CsvUpsertProcessTest.java @@ -69,7 +69,7 @@ public void testUpsertWithRowOffset() throws Exception { Map argMap = getUpdateTestConfig(true, DEFAULT_ACCOUNT_EXT_ID_FIELD, 10); // start at 3, not 0!! - argMap.put(AppConfig.LOAD_ROW_TO_START_AT, "3"); + argMap.put(AppConfig.PROP_LOAD_ROW_TO_START_AT, "3"); // perform the upsert runUpsertProcess(argMap, 0, 7); diff --git a/src/test/java/com/salesforce/dataloader/process/DatabaseProcessTest.java b/src/test/java/com/salesforce/dataloader/process/DatabaseProcessTest.java index d6b77060..fff7980b 100644 --- a/src/test/java/com/salesforce/dataloader/process/DatabaseProcessTest.java +++ b/src/test/java/com/salesforce/dataloader/process/DatabaseProcessTest.java @@ -129,7 +129,7 @@ public void testUpsertAccountDb() throws Exception { // This test happens to configure its own encryption file and encrypted password // so we need to remove the default test password from the config final Map argMap = getTestConfig(); - argMap.remove(AppConfig.PASSWORD); + argMap.remove(AppConfig.PROP_PASSWORD); // insert testUpsertAccountsDb(argMap, NUM_ROWS, true, false); // update @@ -145,10 +145,10 @@ private void testUpsertAccountsDb(Map args, int numRows, boolean // specify the name of the configured process and select appropriate database access type if (args == null) args = getTestConfig(); - args.put(AppConfig.PROCESS_NAME, processName); + args.put(AppConfig.PROP_PROCESS_NAME, processName); AppConfig.DATE_FORMATTER.parse(startTime); args.put(LastRunProperties.LAST_RUN_DATE, startTime); - args.put(AppConfig.OPERATION, OperationInfo.upsert.name()); + args.put(AppConfig.PROP_OPERATION, OperationInfo.upsert.name()); runUpsertProcess(args, isInsert ? numRows : 0, isInsert ? 0 : numRows); } @@ -162,12 +162,12 @@ public void testInsertNullsDB() throws Exception { } // TODO: we need to get the accounts from sfdc and check that field values were updated correctly // create some rows with non-null values in them - args.put(AppConfig.INSERT_NULLS, Boolean.toString(false)); + args.put(AppConfig.PROP_INSERT_NULLS, Boolean.toString(false)); testUpsertAccountsDb(args, 10, true, false); // update the rows with some null values, but with insert nulls disabled testUpsertAccountsDb(args, 10, false, true); // update the rows with some null values, but with insert nulls enabled - args.put(AppConfig.INSERT_NULLS, Boolean.toString(true)); + args.put(AppConfig.PROP_INSERT_NULLS, Boolean.toString(true)); testUpsertAccountsDb(args, 10, false, true); } @@ -177,15 +177,15 @@ private void doExtractAccountDb(String processName, int expectedSuccesses, int e // specify the name of the configured process and select appropriate database access type OperationInfo op = isInsert ? OperationInfo.insert : OperationInfo.update; Map argMap = getTestConfig(); - argMap.put(AppConfig.OPERATION, OperationInfo.extract.name()); - argMap.put(AppConfig.PROCESS_NAME, processName); - argMap.put(AppConfig.DAO_NAME, op.name() + "Account"); - argMap.put(AppConfig.OUTPUT_SUCCESS, new File(getTestStatusDir(), baseName + op.name() + "Success.csv") + argMap.put(AppConfig.PROP_OPERATION, OperationInfo.extract.name()); + argMap.put(AppConfig.PROP_PROCESS_NAME, processName); + argMap.put(AppConfig.PROP_DAO_NAME, op.name() + "Account"); + argMap.put(AppConfig.PROP_OUTPUT_SUCCESS, new File(getTestStatusDir(), baseName + op.name() + "Success.csv") .getAbsolutePath()); - argMap.put(AppConfig.OUTPUT_ERROR, new File(getTestStatusDir(), baseName + op.name() + "Error.csv") + argMap.put(AppConfig.PROP_OUTPUT_ERROR, new File(getTestStatusDir(), baseName + op.name() + "Error.csv") .getAbsolutePath()); - argMap.put(AppConfig.ENABLE_EXTRACT_STATUS_OUTPUT, AppConfig.TRUE); - argMap.put(AppConfig.DAO_WRITE_BATCH_SIZE, String.valueOf(BATCH_SIZE)); + argMap.put(AppConfig.PROP_ENABLE_EXTRACT_STATUS_OUTPUT, AppConfig.TRUE); + argMap.put(AppConfig.PROP_DAO_WRITE_BATCH_SIZE, String.valueOf(BATCH_SIZE)); Date startTime = new Date(); @@ -203,7 +203,7 @@ private void verifyDbSuccess(Controller theController, String dbConfigName, int try { reader = new DatabaseReader(theController.getAppConfig(), dbConfigName); reader.open(); - int readBatchSize = theController.getAppConfig().getInt(AppConfig.DAO_READ_BATCH_SIZE); + int readBatchSize = theController.getAppConfig().getInt(AppConfig.PROP_DAO_READ_BATCH_SIZE); List successRows = reader.readRowList(readBatchSize); int rowsProcessed = 0; assertNotNull("Error reading " + readBatchSize + " rows", successRows); diff --git a/src/test/java/com/salesforce/dataloader/process/DateOnlyProcessTest.java b/src/test/java/com/salesforce/dataloader/process/DateOnlyProcessTest.java index ff6cc426..8bf72faa 100644 --- a/src/test/java/com/salesforce/dataloader/process/DateOnlyProcessTest.java +++ b/src/test/java/com/salesforce/dataloader/process/DateOnlyProcessTest.java @@ -58,7 +58,7 @@ public DateOnlyProcessTest() { @Override protected Map getTestConfig() { Map cfg = super.getTestConfig(); - cfg.put(AppConfig.ENTITY, "Account"); + cfg.put(AppConfig.PROP_ENTITY, "Account"); return cfg; } @@ -67,13 +67,13 @@ public void testDateOnlyWithTimeZone() throws Exception { Map testConfig = getTestConfig(OperationInfo.insert, false); // need to do this before calling runProcess to avoid incorrect timezone setting for DateOnlyConverter - testConfig.put(AppConfig.TIMEZONE, "IST"); + testConfig.put(AppConfig.PROP_TIMEZONE, "IST"); System.out.println("===== DateOnlyProcessTest.testDateWithTimeZone: going to call runProcess with timezone=IST"); // need to do this before calling runProcess to avoid incorrect timezone setting for DateOnlyConverter Controller controller = runProcess(testConfig, 2); - String tz = controller.getAppConfig().getString(AppConfig.TIMEZONE); + String tz = controller.getAppConfig().getString(AppConfig.PROP_TIMEZONE); System.out.println("===== DateOnlyProcessTest.testDateWithTimeZone: configured timezone before first query is " + tz); QueryResult qr = getBinding().query("select CustomDateOnly__c from Account where AccountNumber__c='ACCT_0'"); assertEquals(1, qr.getSize()); @@ -86,7 +86,7 @@ public void testDateOnlyWithTimeZone() throws Exception { assertEquals(1, qr.getSize()); // 2nd entry specifies the date-only field without 'Z' - tz = controller.getAppConfig().getString(AppConfig.TIMEZONE); + tz = controller.getAppConfig().getString(AppConfig.PROP_TIMEZONE); System.out.println("===== DateOnlyProcessTest.testDateWithTimeZone: configured timezone before 2nd query is " + tz); assertEquals("2010-10-14", (String)qr.getRecords()[0].getField("CustomDateOnly__c")); diff --git a/src/test/java/com/salesforce/dataloader/process/DateProcessTest.java b/src/test/java/com/salesforce/dataloader/process/DateProcessTest.java index 4519498d..e613bd8c 100644 --- a/src/test/java/com/salesforce/dataloader/process/DateProcessTest.java +++ b/src/test/java/com/salesforce/dataloader/process/DateProcessTest.java @@ -79,8 +79,8 @@ public static Collection getTestParameters() { @Override protected Map getTestConfig() { Map cfg = super.getTestConfig(); - cfg.put(AppConfig.TIMEZONE, "PDT"); - cfg.put(AppConfig.ENTITY, "Account"); + cfg.put(AppConfig.PROP_TIMEZONE, "PDT"); + cfg.put(AppConfig.PROP_ENTITY, "Account"); return cfg; } diff --git a/src/test/java/com/salesforce/dataloader/process/NAProcessTest.java b/src/test/java/com/salesforce/dataloader/process/NAProcessTest.java index ec32a20d..fc8d92da 100644 --- a/src/test/java/com/salesforce/dataloader/process/NAProcessTest.java +++ b/src/test/java/com/salesforce/dataloader/process/NAProcessTest.java @@ -153,7 +153,7 @@ private void runNAtest(String nullFieldName, boolean isDateField, OperationInfo AppConfig appConfig = getController().getAppConfig(); if (!appConfig.isBulkAPIEnabled() && !appConfig.isBulkV2APIEnabled() && isDateField) { controller = runProcess(argMap, true, null, 0, 0, 1, false); - String errorFile = controller.getAppConfig().getStringRequired(AppConfig.OUTPUT_ERROR); + String errorFile = controller.getAppConfig().getStringRequired(AppConfig.PROP_OUTPUT_ERROR); String errorMessage = getCsvFieldValue(errorFile, "ERROR"); assertEquals("unexpected error message", "Error converting value to correct data type: Failed to parse date: #N/A", errorMessage); @@ -162,7 +162,7 @@ private void runNAtest(String nullFieldName, boolean isDateField, OperationInfo int numUpdate = operation.equals(OperationInfo.update) ? 1 : 0; controller = runProcess(argMap, true, null, numInsert, numUpdate, 0, false); String actualNullFieldValue = getFieldValueAfterOperation(nullFieldName, controller); - String expectedNullFieldValue = getController().getAppConfig().getBoolean(AppConfig.BULK_API_ENABLED) ? null : NATextValue.getInstance().toString(); + String expectedNullFieldValue = getController().getAppConfig().getBoolean(AppConfig.PROP_BULK_API_ENABLED) ? null : NATextValue.getInstance().toString(); assertEquals("unexpected field value", expectedNullFieldValue, actualNullFieldValue); } } @@ -183,7 +183,7 @@ private void runEmptyFieldUpdateTest(String nullFieldName, boolean isDateField) } private String getFieldValueAfterOperation(String nullFieldName, Controller controller) throws Exception { - String successFile = controller.getAppConfig().getStringRequired(AppConfig.OUTPUT_SUCCESS); + String successFile = controller.getAppConfig().getStringRequired(AppConfig.PROP_OUTPUT_SUCCESS); String taskId = getCsvFieldValue(successFile, "ID"); QueryResult result = getController().getPartnerClient().query("select " + nullFieldName + " from Task where Id='" + taskId + "'"); assertEquals(1, result.getSize()); @@ -192,8 +192,8 @@ private String getFieldValueAfterOperation(String nullFieldName, Controller cont private Map getArgMap(OperationInfo operation) { Map argMap = getTestConfig(operation, CSV_FILE_PATH, getTestDataDir() + File.separator + "NAProcessTest.sdl", false); - argMap.put(AppConfig.ENTITY, "Task"); - argMap.remove(AppConfig.IDLOOKUP_FIELD); + argMap.put(AppConfig.PROP_ENTITY, "Task"); + argMap.remove(AppConfig.PROP_IDLOOKUP_FIELD); return argMap; } @@ -222,7 +222,7 @@ private String getCsvFieldValue(String csvFile, String fieldName) throws Excepti private String getUserId() throws Exception { QueryResult result = getController().getPartnerClient().query( - "select id from user where username='" + getController().getAppConfig().getString(AppConfig.USERNAME) + "'"); + "select id from user where username='" + getController().getAppConfig().getString(AppConfig.PROP_USERNAME) + "'"); assertEquals(1, result.getSize()); return result.getRecords()[0].getId(); } diff --git a/src/test/java/com/salesforce/dataloader/process/ProcessExtractTestBase.java b/src/test/java/com/salesforce/dataloader/process/ProcessExtractTestBase.java index 54a688c6..e721e681 100644 --- a/src/test/java/com/salesforce/dataloader/process/ProcessExtractTestBase.java +++ b/src/test/java/com/salesforce/dataloader/process/ProcessExtractTestBase.java @@ -122,13 +122,13 @@ protected Map getExtractionTestConfig(String soql, String entity final Map argMap = getTestConfig(isExtractAll() ? OperationInfo.extract_all : OperationInfo.extract, true); - argMap.put(AppConfig.ENTITY, entity); - argMap.put(AppConfig.EXTRACT_SOQL, soql); - argMap.put(AppConfig.ENABLE_EXTRACT_STATUS_OUTPUT, AppConfig.TRUE); - argMap.put(AppConfig.LIMIT_OUTPUT_TO_QUERY_FIELDS, AppConfig.TRUE); - argMap.put(AppConfig.EXPORT_BATCH_SIZE, "2000"); + argMap.put(AppConfig.PROP_ENTITY, entity); + argMap.put(AppConfig.PROP_EXTRACT_SOQL, soql); + argMap.put(AppConfig.PROP_ENABLE_EXTRACT_STATUS_OUTPUT, AppConfig.TRUE); + argMap.put(AppConfig.PROP_LIMIT_OUTPUT_TO_QUERY_FIELDS, AppConfig.TRUE); + argMap.put(AppConfig.PROP_EXPORT_BATCH_SIZE, "2000"); if (!useMappingFile) { - argMap.remove(AppConfig.MAPPING_FILE); + argMap.remove(AppConfig.PROP_MAPPING_FILE); } return argMap; } @@ -136,7 +136,7 @@ protected Map getExtractionTestConfig(String soql, String entity Map getDoNotLimitOutputToQueryFieldsTestConfig(String soql, String entity, boolean useMappingFile) { final Map argMap = getExtractionTestConfig(soql, entity, useMappingFile); - argMap.put(AppConfig.LIMIT_OUTPUT_TO_QUERY_FIELDS, AppConfig.FALSE); + argMap.put(AppConfig.PROP_LIMIT_OUTPUT_TO_QUERY_FIELDS, AppConfig.FALSE); return argMap; } @@ -150,7 +150,7 @@ protected void verifyIdsInCSV(Controller control, String[] ids, boolean checkPho // assert that it's a CSV...if not fail final Set unexpectedIds = new HashSet(); final Set expectedIds = new HashSet(Arrays.asList(ids)); - String fileName = control.getAppConfig().getString(AppConfig.OUTPUT_SUCCESS); + String fileName = control.getAppConfig().getString(AppConfig.PROP_OUTPUT_SUCCESS); final DataReader resultReader = new CSVFileReader(new File(fileName), getController().getAppConfig(), true, false); try { resultReader.open(); @@ -266,7 +266,7 @@ protected void runTestSelectFieldsSoql() throws ProcessInitializationException, Controller control = runProcess(testConfig, 1); // verify IDs and phone format verifyIdsInCSV(control, testFieldIds, false); - String fileName = control.getAppConfig().getString(AppConfig.OUTPUT_SUCCESS); + String fileName = control.getAppConfig().getString(AppConfig.PROP_OUTPUT_SUCCESS); final DataReader resultReader = new CSVFileReader(new File(fileName), getController().getAppConfig(), true, false); try { resultReader.open(); @@ -362,7 +362,7 @@ private void doRunSoqlRelationshipTest(String contactId, String accountId, final throws ProcessInitializationException, DataAccessObjectException { runProcess(argMap, 1); - final CSVFileReader resultReader = new CSVFileReader(new File(argMap.get(AppConfig.DAO_NAME)), getController().getAppConfig(), true, false); + final CSVFileReader resultReader = new CSVFileReader(new File(argMap.get(AppConfig.PROP_DAO_NAME)), getController().getAppConfig(), true, false); try { final Row resultRow = resultReader.readRow(); assertEquals("Query returned incorrect Contact ID", contactId, resultRow.get("CONTACT_ID")); @@ -396,14 +396,14 @@ protected void runTestExtractAccountCsv() throws ProcessInitializationException, } Map testConfig = getExtractionTestConfig(soql, "Account", true); - testConfig.put(AppConfig.DAO_WRITE_BATCH_SIZE, "10"); // total 100 entries in the results file, write in chunks of 10 + testConfig.put(AppConfig.PROP_DAO_WRITE_BATCH_SIZE, "10"); // total 100 entries in the results file, write in chunks of 10 Controller control = runProcess(testConfig, numRecords); // verify IDs and phone format verifyIdsInCSV(control, accountIds, true); // Verify that column positions match positions // specified in the mapping (.sdl) file. - String fileName = control.getAppConfig().getString(AppConfig.DAO_NAME); + String fileName = control.getAppConfig().getString(AppConfig.PROP_DAO_NAME); final DataReader extractionReader = new CSVFileReader(new File(fileName), getController().getAppConfig(), true, false); try { extractionReader.open(); @@ -461,7 +461,7 @@ protected void runTestExtractAccountCsvAggregate() throws ConnectionException, P "Aggregate Relationships not supported in Bulk Query"); } else { runProcess(argMap, 1, true); - final CSVFileReader resultReader = new CSVFileReader(new File(argMap.get(AppConfig.DAO_NAME)), getController().getAppConfig(), true, false); + final CSVFileReader resultReader = new CSVFileReader(new File(argMap.get(AppConfig.PROP_DAO_NAME)), getController().getAppConfig(), true, false); try { assertEquals(String.valueOf(numRecords - 1), resultReader.readRow().get("MAX(NUMBEROFEMPLOYEES)")); } finally { diff --git a/src/test/java/com/salesforce/dataloader/process/ProcessTestBase.java b/src/test/java/com/salesforce/dataloader/process/ProcessTestBase.java index fdb6ae2f..4ec198af 100644 --- a/src/test/java/com/salesforce/dataloader/process/ProcessTestBase.java +++ b/src/test/java/com/salesforce/dataloader/process/ProcessTestBase.java @@ -84,7 +84,7 @@ protected ProcessTestBase(Map config) { } protected void verifyErrors(Controller controller, String expectedErrorMessage) throws DataAccessObjectException { - String fileName = controller.getAppConfig().getString(AppConfig.OUTPUT_ERROR); + String fileName = controller.getAppConfig().getString(AppConfig.PROP_OUTPUT_ERROR); final CSVFileReader errReader = new CSVFileReader(new File(fileName), getController().getAppConfig(), true, false); try { errReader.open(); @@ -104,7 +104,7 @@ protected void verifySuccessIds(Controller theController, String[] ids) throws D } protected void verifySuccessIds(Controller ctl, Set ids) throws DataAccessObjectException { - String fileName = ctl.getAppConfig().getString(AppConfig.OUTPUT_SUCCESS); + String fileName = ctl.getAppConfig().getString(AppConfig.PROP_OUTPUT_SUCCESS); final CSVFileReader successRdr = new CSVFileReader(new File(fileName), ctl.getAppConfig(), true, false); final Set remaining = new HashSet(ids); final Set unexpected = new HashSet(); @@ -336,7 +336,7 @@ private String[] upsertSfdcRecords(SObject[] records, boolean ignoreOutput, try { UpsertResult[] results = getBinding().upsert( getController().getAppConfig().getString( - AppConfig.IDLOOKUP_FIELD), records); + AppConfig.PROP_IDLOOKUP_FIELD), records); String[] ids = new String[results.length]; for (int i = 0; i < results.length; i++) { UpsertResult result = results[i]; @@ -638,25 +638,25 @@ protected final Map getTestConfig(OperationInfo op, String daoNa protected final Map getTestConfig(OperationInfo op, String daoName, String mappingFile, boolean isExtraction) { Map res = super.getTestConfig(); - res.put(AppConfig.MAPPING_FILE, mappingFile); - res.put(AppConfig.OPERATION, op.name()); - res.put(AppConfig.DAO_NAME, daoName); - res.put(AppConfig.DAO_TYPE, isExtraction ? DataAccessObjectFactory.CSV_WRITE_TYPE + res.put(AppConfig.PROP_MAPPING_FILE, mappingFile); + res.put(AppConfig.PROP_OPERATION, op.name()); + res.put(AppConfig.PROP_DAO_NAME, daoName); + res.put(AppConfig.PROP_DAO_TYPE, isExtraction ? DataAccessObjectFactory.CSV_WRITE_TYPE : DataAccessObjectFactory.CSV_READ_TYPE); - res.put(AppConfig.OUTPUT_STATUS_DIR, getTestStatusDir()); + res.put(AppConfig.PROP_OUTPUT_STATUS_DIR, getTestStatusDir()); String apiType = "Soap"; if (isBulkAPIEnabled(res)) { apiType = "Bulk"; } else if (isBulkV2APIEnabled(res)) { apiType = "BulkV2"; } - res.put(AppConfig.OUTPUT_SUCCESS, getSuccessFilePath(apiType)); - res.put(AppConfig.OUTPUT_ERROR, getErrorFilePath(apiType)); + res.put(AppConfig.PROP_OUTPUT_SUCCESS, getSuccessFilePath(apiType)); + res.put(AppConfig.PROP_OUTPUT_ERROR, getErrorFilePath(apiType)); // Don't debug by default, as it slows down the processing if (ProcessTestBase.DEBUG_MESSAGES) { - res.put(AppConfig.DEBUG_MESSAGES, "true"); - res.put(AppConfig.DEBUG_MESSAGES_FILE, + res.put(AppConfig.PROP_DEBUG_MESSAGES, "true"); + res.put(AppConfig.PROP_DEBUG_MESSAGES_FILE, new File(getTestStatusDir(), this.baseName + apiType + "DebugTrace.log").getAbsolutePath()); } @@ -688,7 +688,7 @@ private Controller runProcessWithErrors(Map argMap, int numSucce int numInserts = 0; int numUpdates = 0; - OperationInfo op = OperationInfo.valueOf(argMap.get(AppConfig.OPERATION)); + OperationInfo op = OperationInfo.valueOf(argMap.get(AppConfig.PROP_OPERATION)); if (op == OperationInfo.insert) numInserts = numSuccesses; else if (op != null && op != OperationInfo.upsert) @@ -716,7 +716,7 @@ protected Controller runProcessNegative(Map args, String failure protected IProcess runBatchProcess(Map argMap) { if (argMap == null) argMap = getTestConfig(); - argMap.put(AppConfig.PROCESS_THREAD_NAME, this.baseName); + argMap.put(AppConfig.PROP_PROCESS_THREAD_NAME, this.baseName); argMap.put(AppConfig.READ_ONLY_CONFIG_PROPERTIES, Boolean.TRUE.toString()); argMap.put(AppConfig.CLI_OPTION_RUN_MODE, AppConfig.RUN_MODE_BATCH_VAL); @@ -724,9 +724,9 @@ protected IProcess runBatchProcess(Map argMap) { String[] args = new String[argMap.size()+1]; args[0] = getTestConfDir(); int i = 1; - if (argMap.containsKey(AppConfig.PROCESS_NAME)) { - args[i++] = argMap.get(AppConfig.PROCESS_NAME); - argMap.remove(AppConfig.PROCESS_NAME); + if (argMap.containsKey(AppConfig.PROP_PROCESS_NAME)) { + args[i++] = argMap.get(AppConfig.PROP_PROCESS_NAME); + argMap.remove(AppConfig.PROP_PROCESS_NAME); } for (Map.Entry entry: argMap.entrySet()) { @@ -787,7 +787,7 @@ protected void setServerApiInvocationThreshold(int threshold) { protected void verifySuccessFile(Controller ctl, int numInserts, int numUpdates, boolean emptyId) throws ParameterLoadException, DataAccessObjectException { - final String successFile = ctl.getAppConfig().getStringRequired(AppConfig.OUTPUT_SUCCESS); + final String successFile = ctl.getAppConfig().getStringRequired(AppConfig.PROP_OUTPUT_SUCCESS); //final String suceessFule2 = ctl.getConfig(). assertNumRowsInCSVFile(successFile, numInserts + numUpdates); boolean isBulkV2Operation = ctl.getAppConfig().isBulkV2APIEnabled(); @@ -910,7 +910,7 @@ protected void verifyAttachmentObjects(Map dbaseFileCorresponden protected void verifyFailureFile(Controller ctl, int numFailures) throws ParameterLoadException, DataAccessObjectException { assertNumRowsInCSVFile(ctl.getAppConfig().getStringRequired( - AppConfig.OUTPUT_ERROR), numFailures); + AppConfig.PROP_OUTPUT_ERROR), numFailures); } private void assertNumRowsInCSVFile(String fName, int expectedRows) throws DataAccessObjectException { @@ -921,12 +921,12 @@ private void assertNumRowsInCSVFile(String fName, int expectedRows) throws DataA } protected boolean isBulkAPIEnabled(Map argMap) { - return isSettingEnabled(argMap, AppConfig.BULK_API_ENABLED) - && !isSettingEnabled(argMap, AppConfig.BULKV2_API_ENABLED); + return isSettingEnabled(argMap, AppConfig.PROP_BULK_API_ENABLED) + && !isSettingEnabled(argMap, AppConfig.PROP_BULKV2_API_ENABLED); } protected boolean isBulkV2APIEnabled(Map argMap) { - return isSettingEnabled(argMap, AppConfig.BULKV2_API_ENABLED); + return isSettingEnabled(argMap, AppConfig.PROP_BULKV2_API_ENABLED); } protected boolean isSettingEnabled(Map argMap, String configKey) { return AppConfig.TRUE.equalsIgnoreCase(argMap.get(configKey)); @@ -962,7 +962,7 @@ protected Map getUpdateTestConfig(String fileNameBase, boolean i final File mappingFile = new File(getTestDataDir(), fileNameBase + "Map.sdl"); final Map argMap = getTestConfig(isUpsert ? OperationInfo.upsert : OperationInfo.update, updateFileName, mappingFile.getAbsolutePath(), false); - if (hasExtId) argMap.put(AppConfig.IDLOOKUP_FIELD, extIdField); + if (hasExtId) argMap.put(AppConfig.PROP_IDLOOKUP_FIELD, extIdField); return argMap; } @@ -1003,7 +1003,7 @@ protected UpsertResult[] doUpsert(String entity, Map sforceMappi * Make sure to set external id field */ protected String setExtIdField(String extIdField) { - getController().getAppConfig().setValue(AppConfig.IDLOOKUP_FIELD, extIdField); + getController().getAppConfig().setValue(AppConfig.PROP_IDLOOKUP_FIELD, extIdField); return extIdField; } @@ -1025,7 +1025,7 @@ protected Object getRandomExtId(String entity, String whereClause, Object prevVa upsertSfdcRecords(entity, 2); // get the client and make the query call - String extIdField = getController().getAppConfig().getString(AppConfig.IDLOOKUP_FIELD); + String extIdField = getController().getAppConfig().getString(AppConfig.PROP_IDLOOKUP_FIELD); PartnerClient client = new PartnerClient(getController()); // only get the records that have external id set, avoid nulls String soql = "select " + extIdField + " from " + entity + " where " + whereClause + " and " + extIdField @@ -1048,7 +1048,7 @@ protected Object getRandomExtId(String entity, String whereClause, Object prevVa } protected BasicDynaClass setupDynaClass(String entity, Collection sfFields) throws ConnectionException { - getController().getAppConfig().setValue(AppConfig.ENTITY, entity); + getController().getAppConfig().setValue(AppConfig.PROP_ENTITY, entity); PartnerClient client = getController().getPartnerClient(); if (!client.isLoggedIn()) { client.connect();