@Test @Ignore public void executeSuccessNoGlobalSessionFailure() throws Exception { mockStatic(SQLQueryLobService.class); when(SQLQueryLobService.executeSqlQueryLob(any(SQLInputs.class))).thenReturn(true); final Map<String, String> resultMap = sqlQueryLOB.execute("1", MSSQL_DB_TYPE, "username", "Password", "someInstance", "123", "db", AUTH_SQL, EMPTY, EMPTY, "something", "true", EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, TYPE_FORWARD_ONLY, CONCUR_READ_ONLY, null); verifyStatic(); assertThat(resultMap.get(RETURN_CODE), is(DBReturnCodes.NO_MORE)); }
@Action(name = "SQL Query LOB", outputs = { @Output(RETURN_CODE), @Output(RETURN_RESULT), @Output(EXCEPTION), @Output(ROWS_LEFT), @Output(SQL_QUERY), @Output(COLUMN_NAMES) }, responses = { @Response(text = HAS_MORE, field = RETURN_CODE, value = SUCCESS, matchType = COMPARE_EQUAL, responseType = RESOLVED), @Response(text = NO_MORE, field = RETURN_CODE, value = DBReturnCodes.NO_MORE, matchType = COMPARE_EQUAL, responseType = RESOLVED), @Response(text = FAILURE, field = RETURN_CODE, value = ReturnCodes.FAILURE, matchType = COMPARE_EQUAL, responseType = ERROR, isOnFail = true) }) public Map<String, String> execute(@Param(value = DB_SERVER_NAME, required = true) String dbServerName, @Param(value = DB_TYPE) String dbType, @Param(value = USERNAME) String username, @Param(value = PASSWORD, encrypted = true) String password, @Param(value = INSTANCE) String instance, @Param(value = DB_PORT) String dbPort, @Param(value = DATABASE_NAME, required = true) String databaseName, @Param(value = AUTHENTICATION_TYPE) String authenticationType, @Param(value = DB_CLASS) String dbClass, @Param(value = DB_URL) String dbURL, @Param(value = COMMAND, required = true) String command, @Param(value = TRUST_ALL_ROOTS) String trustAllRoots, @Param(value = TRUST_STORE) String trustStore, @Param(value = TRUST_STORE_PASSWORD) String trustStorePassword, @Param(value = AUTH_LIBRARY_PATH) String authLibraryPath, @Param(value = DELIMITER, required = true) String delimiter, @Param(value = KEY, required = true) String key, @Param(value = TIMEOUT) String timeout, @Param(value = DATABASE_POOLING_PROPERTIES) String databasePoolingProperties, @Param(value = RESULT_SET_TYPE) String resultSetType, @Param(value = RESULT_SET_CONCURRENCY) String resultSetConcurrency, @Param(value = GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Object>> globalSessionObject) { dbType = defaultIfEmpty(dbType, ORACLE_DB_TYPE); username = defaultIfEmpty(username, EMPTY); password = defaultIfEmpty(password, EMPTY); instance = defaultIfEmpty(instance, EMPTY); authenticationType = defaultIfEmpty(authenticationType, AUTH_SQL); trustAllRoots = defaultIfEmpty(trustAllRoots, FALSE); trustStore = defaultIfEmpty(trustStore, EMPTY); trustStorePassword = defaultIfEmpty(trustStorePassword, EMPTY); timeout = defaultIfEmpty(timeout, DEFAULT_TIMEOUT); resultSetType = defaultIfEmpty(resultSetType, TYPE_SCROLL_INSENSITIVE); resultSetConcurrency = defaultIfEmpty(resultSetConcurrency, CONCUR_READ_ONLY); final List<String> preInputsValidation = validateSqlQueryLOBInputs(dbServerName, dbType, username, password, instance, dbPort, databaseName, authenticationType, command, trustAllRoots, trustStore, trustStorePassword, timeout, resultSetType, resultSetConcurrency, authLibraryPath); if (!preInputsValidation.isEmpty()) { return getFailureResultsMap(StringUtils.join(preInputsValidation, NEW_LINE)); } dbType = getDbType(dbType); final SQLInputs sqlInputs = SQLInputs.builder() .dbServer(dbServerName) .dbType(dbType) .username(username) .password(password) .instance(getOrLower(instance, true)) .dbPort(getOrDefaultDBPort(dbPort, dbType)) .dbName(getOrLower(defaultIfEmpty(databaseName, EMPTY), true)) .authenticationType(authenticationType) .dbClass(getOrDefaultDBClass(dbClass, dbType)) .dbUrl(defaultIfEmpty(dbURL, EMPTY)) .sqlCommand(command) .trustAllRoots(BooleanUtilities.toBoolean(trustAllRoots)) .trustStore(trustStore) .trustStorePassword(defaultIfEmpty(trustStorePassword, EMPTY)) .authLibraryPath(authLibraryPath) .strDelim(delimiter) .key(key) .timeout(toInteger(timeout)) .databasePoolingProperties(getOrDefaultDBPoolingProperties(databasePoolingProperties, EMPTY)) .resultSetType(getResultSetTypeForDbType(resultSetType, dbType)) .resultSetConcurrency(getResultSetConcurrency(resultSetConcurrency)) .ignoreCase(true) .isNetcool(checkIsNetcool(dbType)) .build(); try { final String aKey = SQLInputsUtils.getSqlKey(sqlInputs); final String strKeyCol = format(KEY_COLUMNS, aKey); final String strKeyFiles = format(KEY_FILES, aKey); final String strKeyNames = format(KEY_CLOB_NAMES, aKey); final String strKeySkip = format(KEY_SKIP, aKey); globalSessionObject = getOrDefaultGlobalSessionObj(globalSessionObject); final Map<String, Object> sqlConnectionMap = globalSessionObject.get(); Map<String, String> result = new HashMap<>(); if (sqlConnectionMap.containsKey(aKey)) { sqlInputs.setLRows(getRowsFromGlobalSessionMap(globalSessionObject, aKey)); sqlInputs.setStrColumns(getStrColumns(globalSessionObject, strKeyCol)); if (sqlConnectionMap.get(strKeyFiles) != null) { sqlInputs.setSkip((Long) sqlConnectionMap.get(strKeySkip)); sqlInputs.setLRowsFiles((List) sqlConnectionMap.get(strKeyFiles)); sqlInputs.setLRowsNames((List) sqlConnectionMap.get(strKeyNames)); } if (sqlInputs.getLRows().isEmpty() && (sqlInputs.getLRowsFiles() == null || sqlInputs.getLRowsFiles().isEmpty())) { sqlConnectionMap.put(aKey, null); sqlConnectionMap.put(strKeyCol, null); sqlConnectionMap.put(strKeyFiles, null); sqlConnectionMap.put(strKeyNames, null); sqlConnectionMap.put(strKeySkip, 0L); result.put(RETURN_RESULT, NO_MORE); result.put(ROWS_LEFT, ZERO); result.put(RETURN_CODE, DBReturnCodes.NO_MORE); } else if (sqlInputs.getLRowsFiles() == null || sqlInputs.getLRowsFiles().isEmpty() || (sqlInputs.getLRows().size() == sqlInputs.getLRowsFiles().size())) { final String getFirstRow = sqlInputs.getLRows().remove(0); result.put(RETURN_RESULT, getFirstRow); result.put(COLUMN_NAMES, sqlInputs.getStrColumns()); result.put(ROWS_LEFT, String.valueOf(sqlInputs.getLRows().size())); result.put(RETURN_CODE, SUCCESS); sqlConnectionMap.put(aKey, sqlInputs.getLRows()); } else { final String colName = "CLOB column: " + ((List) sqlInputs.getLRowsNames().get(0)).get(0); final File tmpFile = new File(sqlInputs.getLRowsFiles().get(0).get(0)); final String fileContent = FileUtils.readFileToString(tmpFile, StandardCharsets.UTF_8); FileUtils.deleteQuietly(tmpFile); sqlInputs.getLRowsFiles().get(0).remove(0); sqlInputs.getLRowsNames().get(0).remove(0); if (sqlInputs.getLRowsFiles().get(0).isEmpty()) { sqlInputs.getLRowsFiles().remove(0); sqlInputs.getLRowsNames().remove(0); } result.put(RETURN_RESULT, fileContent); result.put(COLUMN_NAMES, colName); result.put(ROWS_LEFT, String.valueOf(sqlInputs.getLRows().size())); result.put(RETURN_CODE, SUCCESS); sqlConnectionMap.put(strKeyFiles, sqlInputs.getLRowsFiles()); sqlConnectionMap.put(strKeyNames, sqlInputs.getLRowsNames()); sqlConnectionMap.put(strKeySkip, sqlInputs.getSkip()); } globalSessionObject.setResource(new SQLSessionResource(sqlConnectionMap)); } else { boolean isLOB = SQLQueryLobService.executeSqlQueryLob(sqlInputs); if (!sqlInputs.getLRows().isEmpty()) { final String getFirstRow = sqlInputs.getLRows().remove(0); result.put(RETURN_RESULT, getFirstRow); result.put(ROWS_LEFT, String.valueOf(sqlInputs.getLRows().size())); result.put(COLUMN_NAMES, sqlInputs.getStrColumns()); result.put(RETURN_CODE, SUCCESS); sqlConnectionMap.put(aKey, sqlInputs.getLRows()); sqlConnectionMap.put(strKeyCol, sqlInputs.getStrColumns()); if (isLOB) { sqlConnectionMap.put(strKeyFiles, sqlInputs.getLRowsFiles()); sqlConnectionMap.put(strKeyNames, sqlInputs.getLRowsNames()); sqlConnectionMap.put(strKeySkip, 0L); } globalSessionObject.setResource(new SQLSessionResource(sqlConnectionMap)); } else { result.put(SQL_QUERY, sqlInputs.getSqlCommand()); result.put(RETURN_RESULT, NO_MORE); result.put(ROWS_LEFT, ZERO); result.put(RETURN_CODE, DBReturnCodes.NO_MORE); } } globalSessionObject.setResource(new SQLSessionResource(sqlConnectionMap)); return result; } catch (Exception e) { final Map<String, String> failureMap = OutputUtilities.getFailureResultsMap(e); failureMap.put(ROWS_LEFT, ZERO); return failureMap; } }
SQLQueryLOB { @Action(name = "SQL Query LOB", outputs = { @Output(RETURN_CODE), @Output(RETURN_RESULT), @Output(EXCEPTION), @Output(ROWS_LEFT), @Output(SQL_QUERY), @Output(COLUMN_NAMES) }, responses = { @Response(text = HAS_MORE, field = RETURN_CODE, value = SUCCESS, matchType = COMPARE_EQUAL, responseType = RESOLVED), @Response(text = NO_MORE, field = RETURN_CODE, value = DBReturnCodes.NO_MORE, matchType = COMPARE_EQUAL, responseType = RESOLVED), @Response(text = FAILURE, field = RETURN_CODE, value = ReturnCodes.FAILURE, matchType = COMPARE_EQUAL, responseType = ERROR, isOnFail = true) }) public Map<String, String> execute(@Param(value = DB_SERVER_NAME, required = true) String dbServerName, @Param(value = DB_TYPE) String dbType, @Param(value = USERNAME) String username, @Param(value = PASSWORD, encrypted = true) String password, @Param(value = INSTANCE) String instance, @Param(value = DB_PORT) String dbPort, @Param(value = DATABASE_NAME, required = true) String databaseName, @Param(value = AUTHENTICATION_TYPE) String authenticationType, @Param(value = DB_CLASS) String dbClass, @Param(value = DB_URL) String dbURL, @Param(value = COMMAND, required = true) String command, @Param(value = TRUST_ALL_ROOTS) String trustAllRoots, @Param(value = TRUST_STORE) String trustStore, @Param(value = TRUST_STORE_PASSWORD) String trustStorePassword, @Param(value = AUTH_LIBRARY_PATH) String authLibraryPath, @Param(value = DELIMITER, required = true) String delimiter, @Param(value = KEY, required = true) String key, @Param(value = TIMEOUT) String timeout, @Param(value = DATABASE_POOLING_PROPERTIES) String databasePoolingProperties, @Param(value = RESULT_SET_TYPE) String resultSetType, @Param(value = RESULT_SET_CONCURRENCY) String resultSetConcurrency, @Param(value = GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Object>> globalSessionObject) { dbType = defaultIfEmpty(dbType, ORACLE_DB_TYPE); username = defaultIfEmpty(username, EMPTY); password = defaultIfEmpty(password, EMPTY); instance = defaultIfEmpty(instance, EMPTY); authenticationType = defaultIfEmpty(authenticationType, AUTH_SQL); trustAllRoots = defaultIfEmpty(trustAllRoots, FALSE); trustStore = defaultIfEmpty(trustStore, EMPTY); trustStorePassword = defaultIfEmpty(trustStorePassword, EMPTY); timeout = defaultIfEmpty(timeout, DEFAULT_TIMEOUT); resultSetType = defaultIfEmpty(resultSetType, TYPE_SCROLL_INSENSITIVE); resultSetConcurrency = defaultIfEmpty(resultSetConcurrency, CONCUR_READ_ONLY); final List<String> preInputsValidation = validateSqlQueryLOBInputs(dbServerName, dbType, username, password, instance, dbPort, databaseName, authenticationType, command, trustAllRoots, trustStore, trustStorePassword, timeout, resultSetType, resultSetConcurrency, authLibraryPath); if (!preInputsValidation.isEmpty()) { return getFailureResultsMap(StringUtils.join(preInputsValidation, NEW_LINE)); } dbType = getDbType(dbType); final SQLInputs sqlInputs = SQLInputs.builder() .dbServer(dbServerName) .dbType(dbType) .username(username) .password(password) .instance(getOrLower(instance, true)) .dbPort(getOrDefaultDBPort(dbPort, dbType)) .dbName(getOrLower(defaultIfEmpty(databaseName, EMPTY), true)) .authenticationType(authenticationType) .dbClass(getOrDefaultDBClass(dbClass, dbType)) .dbUrl(defaultIfEmpty(dbURL, EMPTY)) .sqlCommand(command) .trustAllRoots(BooleanUtilities.toBoolean(trustAllRoots)) .trustStore(trustStore) .trustStorePassword(defaultIfEmpty(trustStorePassword, EMPTY)) .authLibraryPath(authLibraryPath) .strDelim(delimiter) .key(key) .timeout(toInteger(timeout)) .databasePoolingProperties(getOrDefaultDBPoolingProperties(databasePoolingProperties, EMPTY)) .resultSetType(getResultSetTypeForDbType(resultSetType, dbType)) .resultSetConcurrency(getResultSetConcurrency(resultSetConcurrency)) .ignoreCase(true) .isNetcool(checkIsNetcool(dbType)) .build(); try { final String aKey = SQLInputsUtils.getSqlKey(sqlInputs); final String strKeyCol = format(KEY_COLUMNS, aKey); final String strKeyFiles = format(KEY_FILES, aKey); final String strKeyNames = format(KEY_CLOB_NAMES, aKey); final String strKeySkip = format(KEY_SKIP, aKey); globalSessionObject = getOrDefaultGlobalSessionObj(globalSessionObject); final Map<String, Object> sqlConnectionMap = globalSessionObject.get(); Map<String, String> result = new HashMap<>(); if (sqlConnectionMap.containsKey(aKey)) { sqlInputs.setLRows(getRowsFromGlobalSessionMap(globalSessionObject, aKey)); sqlInputs.setStrColumns(getStrColumns(globalSessionObject, strKeyCol)); if (sqlConnectionMap.get(strKeyFiles) != null) { sqlInputs.setSkip((Long) sqlConnectionMap.get(strKeySkip)); sqlInputs.setLRowsFiles((List) sqlConnectionMap.get(strKeyFiles)); sqlInputs.setLRowsNames((List) sqlConnectionMap.get(strKeyNames)); } if (sqlInputs.getLRows().isEmpty() && (sqlInputs.getLRowsFiles() == null || sqlInputs.getLRowsFiles().isEmpty())) { sqlConnectionMap.put(aKey, null); sqlConnectionMap.put(strKeyCol, null); sqlConnectionMap.put(strKeyFiles, null); sqlConnectionMap.put(strKeyNames, null); sqlConnectionMap.put(strKeySkip, 0L); result.put(RETURN_RESULT, NO_MORE); result.put(ROWS_LEFT, ZERO); result.put(RETURN_CODE, DBReturnCodes.NO_MORE); } else if (sqlInputs.getLRowsFiles() == null || sqlInputs.getLRowsFiles().isEmpty() || (sqlInputs.getLRows().size() == sqlInputs.getLRowsFiles().size())) { final String getFirstRow = sqlInputs.getLRows().remove(0); result.put(RETURN_RESULT, getFirstRow); result.put(COLUMN_NAMES, sqlInputs.getStrColumns()); result.put(ROWS_LEFT, String.valueOf(sqlInputs.getLRows().size())); result.put(RETURN_CODE, SUCCESS); sqlConnectionMap.put(aKey, sqlInputs.getLRows()); } else { final String colName = "CLOB column: " + ((List) sqlInputs.getLRowsNames().get(0)).get(0); final File tmpFile = new File(sqlInputs.getLRowsFiles().get(0).get(0)); final String fileContent = FileUtils.readFileToString(tmpFile, StandardCharsets.UTF_8); FileUtils.deleteQuietly(tmpFile); sqlInputs.getLRowsFiles().get(0).remove(0); sqlInputs.getLRowsNames().get(0).remove(0); if (sqlInputs.getLRowsFiles().get(0).isEmpty()) { sqlInputs.getLRowsFiles().remove(0); sqlInputs.getLRowsNames().remove(0); } result.put(RETURN_RESULT, fileContent); result.put(COLUMN_NAMES, colName); result.put(ROWS_LEFT, String.valueOf(sqlInputs.getLRows().size())); result.put(RETURN_CODE, SUCCESS); sqlConnectionMap.put(strKeyFiles, sqlInputs.getLRowsFiles()); sqlConnectionMap.put(strKeyNames, sqlInputs.getLRowsNames()); sqlConnectionMap.put(strKeySkip, sqlInputs.getSkip()); } globalSessionObject.setResource(new SQLSessionResource(sqlConnectionMap)); } else { boolean isLOB = SQLQueryLobService.executeSqlQueryLob(sqlInputs); if (!sqlInputs.getLRows().isEmpty()) { final String getFirstRow = sqlInputs.getLRows().remove(0); result.put(RETURN_RESULT, getFirstRow); result.put(ROWS_LEFT, String.valueOf(sqlInputs.getLRows().size())); result.put(COLUMN_NAMES, sqlInputs.getStrColumns()); result.put(RETURN_CODE, SUCCESS); sqlConnectionMap.put(aKey, sqlInputs.getLRows()); sqlConnectionMap.put(strKeyCol, sqlInputs.getStrColumns()); if (isLOB) { sqlConnectionMap.put(strKeyFiles, sqlInputs.getLRowsFiles()); sqlConnectionMap.put(strKeyNames, sqlInputs.getLRowsNames()); sqlConnectionMap.put(strKeySkip, 0L); } globalSessionObject.setResource(new SQLSessionResource(sqlConnectionMap)); } else { result.put(SQL_QUERY, sqlInputs.getSqlCommand()); result.put(RETURN_RESULT, NO_MORE); result.put(ROWS_LEFT, ZERO); result.put(RETURN_CODE, DBReturnCodes.NO_MORE); } } globalSessionObject.setResource(new SQLSessionResource(sqlConnectionMap)); return result; } catch (Exception e) { final Map<String, String> failureMap = OutputUtilities.getFailureResultsMap(e); failureMap.put(ROWS_LEFT, ZERO); return failureMap; } } }
SQLQueryLOB { @Action(name = "SQL Query LOB", outputs = { @Output(RETURN_CODE), @Output(RETURN_RESULT), @Output(EXCEPTION), @Output(ROWS_LEFT), @Output(SQL_QUERY), @Output(COLUMN_NAMES) }, responses = { @Response(text = HAS_MORE, field = RETURN_CODE, value = SUCCESS, matchType = COMPARE_EQUAL, responseType = RESOLVED), @Response(text = NO_MORE, field = RETURN_CODE, value = DBReturnCodes.NO_MORE, matchType = COMPARE_EQUAL, responseType = RESOLVED), @Response(text = FAILURE, field = RETURN_CODE, value = ReturnCodes.FAILURE, matchType = COMPARE_EQUAL, responseType = ERROR, isOnFail = true) }) public Map<String, String> execute(@Param(value = DB_SERVER_NAME, required = true) String dbServerName, @Param(value = DB_TYPE) String dbType, @Param(value = USERNAME) String username, @Param(value = PASSWORD, encrypted = true) String password, @Param(value = INSTANCE) String instance, @Param(value = DB_PORT) String dbPort, @Param(value = DATABASE_NAME, required = true) String databaseName, @Param(value = AUTHENTICATION_TYPE) String authenticationType, @Param(value = DB_CLASS) String dbClass, @Param(value = DB_URL) String dbURL, @Param(value = COMMAND, required = true) String command, @Param(value = TRUST_ALL_ROOTS) String trustAllRoots, @Param(value = TRUST_STORE) String trustStore, @Param(value = TRUST_STORE_PASSWORD) String trustStorePassword, @Param(value = AUTH_LIBRARY_PATH) String authLibraryPath, @Param(value = DELIMITER, required = true) String delimiter, @Param(value = KEY, required = true) String key, @Param(value = TIMEOUT) String timeout, @Param(value = DATABASE_POOLING_PROPERTIES) String databasePoolingProperties, @Param(value = RESULT_SET_TYPE) String resultSetType, @Param(value = RESULT_SET_CONCURRENCY) String resultSetConcurrency, @Param(value = GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Object>> globalSessionObject) { dbType = defaultIfEmpty(dbType, ORACLE_DB_TYPE); username = defaultIfEmpty(username, EMPTY); password = defaultIfEmpty(password, EMPTY); instance = defaultIfEmpty(instance, EMPTY); authenticationType = defaultIfEmpty(authenticationType, AUTH_SQL); trustAllRoots = defaultIfEmpty(trustAllRoots, FALSE); trustStore = defaultIfEmpty(trustStore, EMPTY); trustStorePassword = defaultIfEmpty(trustStorePassword, EMPTY); timeout = defaultIfEmpty(timeout, DEFAULT_TIMEOUT); resultSetType = defaultIfEmpty(resultSetType, TYPE_SCROLL_INSENSITIVE); resultSetConcurrency = defaultIfEmpty(resultSetConcurrency, CONCUR_READ_ONLY); final List<String> preInputsValidation = validateSqlQueryLOBInputs(dbServerName, dbType, username, password, instance, dbPort, databaseName, authenticationType, command, trustAllRoots, trustStore, trustStorePassword, timeout, resultSetType, resultSetConcurrency, authLibraryPath); if (!preInputsValidation.isEmpty()) { return getFailureResultsMap(StringUtils.join(preInputsValidation, NEW_LINE)); } dbType = getDbType(dbType); final SQLInputs sqlInputs = SQLInputs.builder() .dbServer(dbServerName) .dbType(dbType) .username(username) .password(password) .instance(getOrLower(instance, true)) .dbPort(getOrDefaultDBPort(dbPort, dbType)) .dbName(getOrLower(defaultIfEmpty(databaseName, EMPTY), true)) .authenticationType(authenticationType) .dbClass(getOrDefaultDBClass(dbClass, dbType)) .dbUrl(defaultIfEmpty(dbURL, EMPTY)) .sqlCommand(command) .trustAllRoots(BooleanUtilities.toBoolean(trustAllRoots)) .trustStore(trustStore) .trustStorePassword(defaultIfEmpty(trustStorePassword, EMPTY)) .authLibraryPath(authLibraryPath) .strDelim(delimiter) .key(key) .timeout(toInteger(timeout)) .databasePoolingProperties(getOrDefaultDBPoolingProperties(databasePoolingProperties, EMPTY)) .resultSetType(getResultSetTypeForDbType(resultSetType, dbType)) .resultSetConcurrency(getResultSetConcurrency(resultSetConcurrency)) .ignoreCase(true) .isNetcool(checkIsNetcool(dbType)) .build(); try { final String aKey = SQLInputsUtils.getSqlKey(sqlInputs); final String strKeyCol = format(KEY_COLUMNS, aKey); final String strKeyFiles = format(KEY_FILES, aKey); final String strKeyNames = format(KEY_CLOB_NAMES, aKey); final String strKeySkip = format(KEY_SKIP, aKey); globalSessionObject = getOrDefaultGlobalSessionObj(globalSessionObject); final Map<String, Object> sqlConnectionMap = globalSessionObject.get(); Map<String, String> result = new HashMap<>(); if (sqlConnectionMap.containsKey(aKey)) { sqlInputs.setLRows(getRowsFromGlobalSessionMap(globalSessionObject, aKey)); sqlInputs.setStrColumns(getStrColumns(globalSessionObject, strKeyCol)); if (sqlConnectionMap.get(strKeyFiles) != null) { sqlInputs.setSkip((Long) sqlConnectionMap.get(strKeySkip)); sqlInputs.setLRowsFiles((List) sqlConnectionMap.get(strKeyFiles)); sqlInputs.setLRowsNames((List) sqlConnectionMap.get(strKeyNames)); } if (sqlInputs.getLRows().isEmpty() && (sqlInputs.getLRowsFiles() == null || sqlInputs.getLRowsFiles().isEmpty())) { sqlConnectionMap.put(aKey, null); sqlConnectionMap.put(strKeyCol, null); sqlConnectionMap.put(strKeyFiles, null); sqlConnectionMap.put(strKeyNames, null); sqlConnectionMap.put(strKeySkip, 0L); result.put(RETURN_RESULT, NO_MORE); result.put(ROWS_LEFT, ZERO); result.put(RETURN_CODE, DBReturnCodes.NO_MORE); } else if (sqlInputs.getLRowsFiles() == null || sqlInputs.getLRowsFiles().isEmpty() || (sqlInputs.getLRows().size() == sqlInputs.getLRowsFiles().size())) { final String getFirstRow = sqlInputs.getLRows().remove(0); result.put(RETURN_RESULT, getFirstRow); result.put(COLUMN_NAMES, sqlInputs.getStrColumns()); result.put(ROWS_LEFT, String.valueOf(sqlInputs.getLRows().size())); result.put(RETURN_CODE, SUCCESS); sqlConnectionMap.put(aKey, sqlInputs.getLRows()); } else { final String colName = "CLOB column: " + ((List) sqlInputs.getLRowsNames().get(0)).get(0); final File tmpFile = new File(sqlInputs.getLRowsFiles().get(0).get(0)); final String fileContent = FileUtils.readFileToString(tmpFile, StandardCharsets.UTF_8); FileUtils.deleteQuietly(tmpFile); sqlInputs.getLRowsFiles().get(0).remove(0); sqlInputs.getLRowsNames().get(0).remove(0); if (sqlInputs.getLRowsFiles().get(0).isEmpty()) { sqlInputs.getLRowsFiles().remove(0); sqlInputs.getLRowsNames().remove(0); } result.put(RETURN_RESULT, fileContent); result.put(COLUMN_NAMES, colName); result.put(ROWS_LEFT, String.valueOf(sqlInputs.getLRows().size())); result.put(RETURN_CODE, SUCCESS); sqlConnectionMap.put(strKeyFiles, sqlInputs.getLRowsFiles()); sqlConnectionMap.put(strKeyNames, sqlInputs.getLRowsNames()); sqlConnectionMap.put(strKeySkip, sqlInputs.getSkip()); } globalSessionObject.setResource(new SQLSessionResource(sqlConnectionMap)); } else { boolean isLOB = SQLQueryLobService.executeSqlQueryLob(sqlInputs); if (!sqlInputs.getLRows().isEmpty()) { final String getFirstRow = sqlInputs.getLRows().remove(0); result.put(RETURN_RESULT, getFirstRow); result.put(ROWS_LEFT, String.valueOf(sqlInputs.getLRows().size())); result.put(COLUMN_NAMES, sqlInputs.getStrColumns()); result.put(RETURN_CODE, SUCCESS); sqlConnectionMap.put(aKey, sqlInputs.getLRows()); sqlConnectionMap.put(strKeyCol, sqlInputs.getStrColumns()); if (isLOB) { sqlConnectionMap.put(strKeyFiles, sqlInputs.getLRowsFiles()); sqlConnectionMap.put(strKeyNames, sqlInputs.getLRowsNames()); sqlConnectionMap.put(strKeySkip, 0L); } globalSessionObject.setResource(new SQLSessionResource(sqlConnectionMap)); } else { result.put(SQL_QUERY, sqlInputs.getSqlCommand()); result.put(RETURN_RESULT, NO_MORE); result.put(ROWS_LEFT, ZERO); result.put(RETURN_CODE, DBReturnCodes.NO_MORE); } } globalSessionObject.setResource(new SQLSessionResource(sqlConnectionMap)); return result; } catch (Exception e) { final Map<String, String> failureMap = OutputUtilities.getFailureResultsMap(e); failureMap.put(ROWS_LEFT, ZERO); return failureMap; } }  }
SQLQueryLOB { @Action(name = "SQL Query LOB", outputs = { @Output(RETURN_CODE), @Output(RETURN_RESULT), @Output(EXCEPTION), @Output(ROWS_LEFT), @Output(SQL_QUERY), @Output(COLUMN_NAMES) }, responses = { @Response(text = HAS_MORE, field = RETURN_CODE, value = SUCCESS, matchType = COMPARE_EQUAL, responseType = RESOLVED), @Response(text = NO_MORE, field = RETURN_CODE, value = DBReturnCodes.NO_MORE, matchType = COMPARE_EQUAL, responseType = RESOLVED), @Response(text = FAILURE, field = RETURN_CODE, value = ReturnCodes.FAILURE, matchType = COMPARE_EQUAL, responseType = ERROR, isOnFail = true) }) public Map<String, String> execute(@Param(value = DB_SERVER_NAME, required = true) String dbServerName, @Param(value = DB_TYPE) String dbType, @Param(value = USERNAME) String username, @Param(value = PASSWORD, encrypted = true) String password, @Param(value = INSTANCE) String instance, @Param(value = DB_PORT) String dbPort, @Param(value = DATABASE_NAME, required = true) String databaseName, @Param(value = AUTHENTICATION_TYPE) String authenticationType, @Param(value = DB_CLASS) String dbClass, @Param(value = DB_URL) String dbURL, @Param(value = COMMAND, required = true) String command, @Param(value = TRUST_ALL_ROOTS) String trustAllRoots, @Param(value = TRUST_STORE) String trustStore, @Param(value = TRUST_STORE_PASSWORD) String trustStorePassword, @Param(value = AUTH_LIBRARY_PATH) String authLibraryPath, @Param(value = DELIMITER, required = true) String delimiter, @Param(value = KEY, required = true) String key, @Param(value = TIMEOUT) String timeout, @Param(value = DATABASE_POOLING_PROPERTIES) String databasePoolingProperties, @Param(value = RESULT_SET_TYPE) String resultSetType, @Param(value = RESULT_SET_CONCURRENCY) String resultSetConcurrency, @Param(value = GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Object>> globalSessionObject) { dbType = defaultIfEmpty(dbType, ORACLE_DB_TYPE); username = defaultIfEmpty(username, EMPTY); password = defaultIfEmpty(password, EMPTY); instance = defaultIfEmpty(instance, EMPTY); authenticationType = defaultIfEmpty(authenticationType, AUTH_SQL); trustAllRoots = defaultIfEmpty(trustAllRoots, FALSE); trustStore = defaultIfEmpty(trustStore, EMPTY); trustStorePassword = defaultIfEmpty(trustStorePassword, EMPTY); timeout = defaultIfEmpty(timeout, DEFAULT_TIMEOUT); resultSetType = defaultIfEmpty(resultSetType, TYPE_SCROLL_INSENSITIVE); resultSetConcurrency = defaultIfEmpty(resultSetConcurrency, CONCUR_READ_ONLY); final List<String> preInputsValidation = validateSqlQueryLOBInputs(dbServerName, dbType, username, password, instance, dbPort, databaseName, authenticationType, command, trustAllRoots, trustStore, trustStorePassword, timeout, resultSetType, resultSetConcurrency, authLibraryPath); if (!preInputsValidation.isEmpty()) { return getFailureResultsMap(StringUtils.join(preInputsValidation, NEW_LINE)); } dbType = getDbType(dbType); final SQLInputs sqlInputs = SQLInputs.builder() .dbServer(dbServerName) .dbType(dbType) .username(username) .password(password) .instance(getOrLower(instance, true)) .dbPort(getOrDefaultDBPort(dbPort, dbType)) .dbName(getOrLower(defaultIfEmpty(databaseName, EMPTY), true)) .authenticationType(authenticationType) .dbClass(getOrDefaultDBClass(dbClass, dbType)) .dbUrl(defaultIfEmpty(dbURL, EMPTY)) .sqlCommand(command) .trustAllRoots(BooleanUtilities.toBoolean(trustAllRoots)) .trustStore(trustStore) .trustStorePassword(defaultIfEmpty(trustStorePassword, EMPTY)) .authLibraryPath(authLibraryPath) .strDelim(delimiter) .key(key) .timeout(toInteger(timeout)) .databasePoolingProperties(getOrDefaultDBPoolingProperties(databasePoolingProperties, EMPTY)) .resultSetType(getResultSetTypeForDbType(resultSetType, dbType)) .resultSetConcurrency(getResultSetConcurrency(resultSetConcurrency)) .ignoreCase(true) .isNetcool(checkIsNetcool(dbType)) .build(); try { final String aKey = SQLInputsUtils.getSqlKey(sqlInputs); final String strKeyCol = format(KEY_COLUMNS, aKey); final String strKeyFiles = format(KEY_FILES, aKey); final String strKeyNames = format(KEY_CLOB_NAMES, aKey); final String strKeySkip = format(KEY_SKIP, aKey); globalSessionObject = getOrDefaultGlobalSessionObj(globalSessionObject); final Map<String, Object> sqlConnectionMap = globalSessionObject.get(); Map<String, String> result = new HashMap<>(); if (sqlConnectionMap.containsKey(aKey)) { sqlInputs.setLRows(getRowsFromGlobalSessionMap(globalSessionObject, aKey)); sqlInputs.setStrColumns(getStrColumns(globalSessionObject, strKeyCol)); if (sqlConnectionMap.get(strKeyFiles) != null) { sqlInputs.setSkip((Long) sqlConnectionMap.get(strKeySkip)); sqlInputs.setLRowsFiles((List) sqlConnectionMap.get(strKeyFiles)); sqlInputs.setLRowsNames((List) sqlConnectionMap.get(strKeyNames)); } if (sqlInputs.getLRows().isEmpty() && (sqlInputs.getLRowsFiles() == null || sqlInputs.getLRowsFiles().isEmpty())) { sqlConnectionMap.put(aKey, null); sqlConnectionMap.put(strKeyCol, null); sqlConnectionMap.put(strKeyFiles, null); sqlConnectionMap.put(strKeyNames, null); sqlConnectionMap.put(strKeySkip, 0L); result.put(RETURN_RESULT, NO_MORE); result.put(ROWS_LEFT, ZERO); result.put(RETURN_CODE, DBReturnCodes.NO_MORE); } else if (sqlInputs.getLRowsFiles() == null || sqlInputs.getLRowsFiles().isEmpty() || (sqlInputs.getLRows().size() == sqlInputs.getLRowsFiles().size())) { final String getFirstRow = sqlInputs.getLRows().remove(0); result.put(RETURN_RESULT, getFirstRow); result.put(COLUMN_NAMES, sqlInputs.getStrColumns()); result.put(ROWS_LEFT, String.valueOf(sqlInputs.getLRows().size())); result.put(RETURN_CODE, SUCCESS); sqlConnectionMap.put(aKey, sqlInputs.getLRows()); } else { final String colName = "CLOB column: " + ((List) sqlInputs.getLRowsNames().get(0)).get(0); final File tmpFile = new File(sqlInputs.getLRowsFiles().get(0).get(0)); final String fileContent = FileUtils.readFileToString(tmpFile, StandardCharsets.UTF_8); FileUtils.deleteQuietly(tmpFile); sqlInputs.getLRowsFiles().get(0).remove(0); sqlInputs.getLRowsNames().get(0).remove(0); if (sqlInputs.getLRowsFiles().get(0).isEmpty()) { sqlInputs.getLRowsFiles().remove(0); sqlInputs.getLRowsNames().remove(0); } result.put(RETURN_RESULT, fileContent); result.put(COLUMN_NAMES, colName); result.put(ROWS_LEFT, String.valueOf(sqlInputs.getLRows().size())); result.put(RETURN_CODE, SUCCESS); sqlConnectionMap.put(strKeyFiles, sqlInputs.getLRowsFiles()); sqlConnectionMap.put(strKeyNames, sqlInputs.getLRowsNames()); sqlConnectionMap.put(strKeySkip, sqlInputs.getSkip()); } globalSessionObject.setResource(new SQLSessionResource(sqlConnectionMap)); } else { boolean isLOB = SQLQueryLobService.executeSqlQueryLob(sqlInputs); if (!sqlInputs.getLRows().isEmpty()) { final String getFirstRow = sqlInputs.getLRows().remove(0); result.put(RETURN_RESULT, getFirstRow); result.put(ROWS_LEFT, String.valueOf(sqlInputs.getLRows().size())); result.put(COLUMN_NAMES, sqlInputs.getStrColumns()); result.put(RETURN_CODE, SUCCESS); sqlConnectionMap.put(aKey, sqlInputs.getLRows()); sqlConnectionMap.put(strKeyCol, sqlInputs.getStrColumns()); if (isLOB) { sqlConnectionMap.put(strKeyFiles, sqlInputs.getLRowsFiles()); sqlConnectionMap.put(strKeyNames, sqlInputs.getLRowsNames()); sqlConnectionMap.put(strKeySkip, 0L); } globalSessionObject.setResource(new SQLSessionResource(sqlConnectionMap)); } else { result.put(SQL_QUERY, sqlInputs.getSqlCommand()); result.put(RETURN_RESULT, NO_MORE); result.put(ROWS_LEFT, ZERO); result.put(RETURN_CODE, DBReturnCodes.NO_MORE); } } globalSessionObject.setResource(new SQLSessionResource(sqlConnectionMap)); return result; } catch (Exception e) { final Map<String, String> failureMap = OutputUtilities.getFailureResultsMap(e); failureMap.put(ROWS_LEFT, ZERO); return failureMap; } }  @Action(name = "SQL Query LOB", outputs = { @Output(RETURN_CODE), @Output(RETURN_RESULT), @Output(EXCEPTION), @Output(ROWS_LEFT), @Output(SQL_QUERY), @Output(COLUMN_NAMES) }, responses = { @Response(text = HAS_MORE, field = RETURN_CODE, value = SUCCESS, matchType = COMPARE_EQUAL, responseType = RESOLVED), @Response(text = NO_MORE, field = RETURN_CODE, value = DBReturnCodes.NO_MORE, matchType = COMPARE_EQUAL, responseType = RESOLVED), @Response(text = FAILURE, field = RETURN_CODE, value = ReturnCodes.FAILURE, matchType = COMPARE_EQUAL, responseType = ERROR, isOnFail = true) }) Map<String, String> execute(@Param(value = DB_SERVER_NAME, required = true) String dbServerName,
                                       @Param(value = DB_TYPE) String dbType,
                                       @Param(value = USERNAME) String username,
                                       @Param(value = PASSWORD, encrypted = true) String password,
                                       @Param(value = INSTANCE) String instance,
                                       @Param(value = DB_PORT) String dbPort,
                                       @Param(value = DATABASE_NAME, required = true) String databaseName,
                                       @Param(value = AUTHENTICATION_TYPE) String authenticationType,
                                       @Param(value = DB_CLASS) String dbClass,
                                       @Param(value = DB_URL) String dbURL,
                                       @Param(value = COMMAND, required = true) String command,
                                       @Param(value = TRUST_ALL_ROOTS) String trustAllRoots,
                                       @Param(value = TRUST_STORE) String trustStore,
                                       @Param(value = TRUST_STORE_PASSWORD) String trustStorePassword,
                                       @Param(value = AUTH_LIBRARY_PATH) String authLibraryPath,
                                       @Param(value = DELIMITER, required = true) String delimiter,
                                       @Param(value = KEY, required = true) String key,
                                       @Param(value = TIMEOUT) String timeout,
                                       @Param(value = DATABASE_POOLING_PROPERTIES) String databasePoolingProperties,
                                       @Param(value = RESULT_SET_TYPE) String resultSetType,
                                       @Param(value = RESULT_SET_CONCURRENCY) String resultSetConcurrency,
                                       @Param(value = GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Object>> globalSessionObject); }
SQLQueryLOB { @Action(name = "SQL Query LOB", outputs = { @Output(RETURN_CODE), @Output(RETURN_RESULT), @Output(EXCEPTION), @Output(ROWS_LEFT), @Output(SQL_QUERY), @Output(COLUMN_NAMES) }, responses = { @Response(text = HAS_MORE, field = RETURN_CODE, value = SUCCESS, matchType = COMPARE_EQUAL, responseType = RESOLVED), @Response(text = NO_MORE, field = RETURN_CODE, value = DBReturnCodes.NO_MORE, matchType = COMPARE_EQUAL, responseType = RESOLVED), @Response(text = FAILURE, field = RETURN_CODE, value = ReturnCodes.FAILURE, matchType = COMPARE_EQUAL, responseType = ERROR, isOnFail = true) }) public Map<String, String> execute(@Param(value = DB_SERVER_NAME, required = true) String dbServerName, @Param(value = DB_TYPE) String dbType, @Param(value = USERNAME) String username, @Param(value = PASSWORD, encrypted = true) String password, @Param(value = INSTANCE) String instance, @Param(value = DB_PORT) String dbPort, @Param(value = DATABASE_NAME, required = true) String databaseName, @Param(value = AUTHENTICATION_TYPE) String authenticationType, @Param(value = DB_CLASS) String dbClass, @Param(value = DB_URL) String dbURL, @Param(value = COMMAND, required = true) String command, @Param(value = TRUST_ALL_ROOTS) String trustAllRoots, @Param(value = TRUST_STORE) String trustStore, @Param(value = TRUST_STORE_PASSWORD) String trustStorePassword, @Param(value = AUTH_LIBRARY_PATH) String authLibraryPath, @Param(value = DELIMITER, required = true) String delimiter, @Param(value = KEY, required = true) String key, @Param(value = TIMEOUT) String timeout, @Param(value = DATABASE_POOLING_PROPERTIES) String databasePoolingProperties, @Param(value = RESULT_SET_TYPE) String resultSetType, @Param(value = RESULT_SET_CONCURRENCY) String resultSetConcurrency, @Param(value = GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Object>> globalSessionObject) { dbType = defaultIfEmpty(dbType, ORACLE_DB_TYPE); username = defaultIfEmpty(username, EMPTY); password = defaultIfEmpty(password, EMPTY); instance = defaultIfEmpty(instance, EMPTY); authenticationType = defaultIfEmpty(authenticationType, AUTH_SQL); trustAllRoots = defaultIfEmpty(trustAllRoots, FALSE); trustStore = defaultIfEmpty(trustStore, EMPTY); trustStorePassword = defaultIfEmpty(trustStorePassword, EMPTY); timeout = defaultIfEmpty(timeout, DEFAULT_TIMEOUT); resultSetType = defaultIfEmpty(resultSetType, TYPE_SCROLL_INSENSITIVE); resultSetConcurrency = defaultIfEmpty(resultSetConcurrency, CONCUR_READ_ONLY); final List<String> preInputsValidation = validateSqlQueryLOBInputs(dbServerName, dbType, username, password, instance, dbPort, databaseName, authenticationType, command, trustAllRoots, trustStore, trustStorePassword, timeout, resultSetType, resultSetConcurrency, authLibraryPath); if (!preInputsValidation.isEmpty()) { return getFailureResultsMap(StringUtils.join(preInputsValidation, NEW_LINE)); } dbType = getDbType(dbType); final SQLInputs sqlInputs = SQLInputs.builder() .dbServer(dbServerName) .dbType(dbType) .username(username) .password(password) .instance(getOrLower(instance, true)) .dbPort(getOrDefaultDBPort(dbPort, dbType)) .dbName(getOrLower(defaultIfEmpty(databaseName, EMPTY), true)) .authenticationType(authenticationType) .dbClass(getOrDefaultDBClass(dbClass, dbType)) .dbUrl(defaultIfEmpty(dbURL, EMPTY)) .sqlCommand(command) .trustAllRoots(BooleanUtilities.toBoolean(trustAllRoots)) .trustStore(trustStore) .trustStorePassword(defaultIfEmpty(trustStorePassword, EMPTY)) .authLibraryPath(authLibraryPath) .strDelim(delimiter) .key(key) .timeout(toInteger(timeout)) .databasePoolingProperties(getOrDefaultDBPoolingProperties(databasePoolingProperties, EMPTY)) .resultSetType(getResultSetTypeForDbType(resultSetType, dbType)) .resultSetConcurrency(getResultSetConcurrency(resultSetConcurrency)) .ignoreCase(true) .isNetcool(checkIsNetcool(dbType)) .build(); try { final String aKey = SQLInputsUtils.getSqlKey(sqlInputs); final String strKeyCol = format(KEY_COLUMNS, aKey); final String strKeyFiles = format(KEY_FILES, aKey); final String strKeyNames = format(KEY_CLOB_NAMES, aKey); final String strKeySkip = format(KEY_SKIP, aKey); globalSessionObject = getOrDefaultGlobalSessionObj(globalSessionObject); final Map<String, Object> sqlConnectionMap = globalSessionObject.get(); Map<String, String> result = new HashMap<>(); if (sqlConnectionMap.containsKey(aKey)) { sqlInputs.setLRows(getRowsFromGlobalSessionMap(globalSessionObject, aKey)); sqlInputs.setStrColumns(getStrColumns(globalSessionObject, strKeyCol)); if (sqlConnectionMap.get(strKeyFiles) != null) { sqlInputs.setSkip((Long) sqlConnectionMap.get(strKeySkip)); sqlInputs.setLRowsFiles((List) sqlConnectionMap.get(strKeyFiles)); sqlInputs.setLRowsNames((List) sqlConnectionMap.get(strKeyNames)); } if (sqlInputs.getLRows().isEmpty() && (sqlInputs.getLRowsFiles() == null || sqlInputs.getLRowsFiles().isEmpty())) { sqlConnectionMap.put(aKey, null); sqlConnectionMap.put(strKeyCol, null); sqlConnectionMap.put(strKeyFiles, null); sqlConnectionMap.put(strKeyNames, null); sqlConnectionMap.put(strKeySkip, 0L); result.put(RETURN_RESULT, NO_MORE); result.put(ROWS_LEFT, ZERO); result.put(RETURN_CODE, DBReturnCodes.NO_MORE); } else if (sqlInputs.getLRowsFiles() == null || sqlInputs.getLRowsFiles().isEmpty() || (sqlInputs.getLRows().size() == sqlInputs.getLRowsFiles().size())) { final String getFirstRow = sqlInputs.getLRows().remove(0); result.put(RETURN_RESULT, getFirstRow); result.put(COLUMN_NAMES, sqlInputs.getStrColumns()); result.put(ROWS_LEFT, String.valueOf(sqlInputs.getLRows().size())); result.put(RETURN_CODE, SUCCESS); sqlConnectionMap.put(aKey, sqlInputs.getLRows()); } else { final String colName = "CLOB column: " + ((List) sqlInputs.getLRowsNames().get(0)).get(0); final File tmpFile = new File(sqlInputs.getLRowsFiles().get(0).get(0)); final String fileContent = FileUtils.readFileToString(tmpFile, StandardCharsets.UTF_8); FileUtils.deleteQuietly(tmpFile); sqlInputs.getLRowsFiles().get(0).remove(0); sqlInputs.getLRowsNames().get(0).remove(0); if (sqlInputs.getLRowsFiles().get(0).isEmpty()) { sqlInputs.getLRowsFiles().remove(0); sqlInputs.getLRowsNames().remove(0); } result.put(RETURN_RESULT, fileContent); result.put(COLUMN_NAMES, colName); result.put(ROWS_LEFT, String.valueOf(sqlInputs.getLRows().size())); result.put(RETURN_CODE, SUCCESS); sqlConnectionMap.put(strKeyFiles, sqlInputs.getLRowsFiles()); sqlConnectionMap.put(strKeyNames, sqlInputs.getLRowsNames()); sqlConnectionMap.put(strKeySkip, sqlInputs.getSkip()); } globalSessionObject.setResource(new SQLSessionResource(sqlConnectionMap)); } else { boolean isLOB = SQLQueryLobService.executeSqlQueryLob(sqlInputs); if (!sqlInputs.getLRows().isEmpty()) { final String getFirstRow = sqlInputs.getLRows().remove(0); result.put(RETURN_RESULT, getFirstRow); result.put(ROWS_LEFT, String.valueOf(sqlInputs.getLRows().size())); result.put(COLUMN_NAMES, sqlInputs.getStrColumns()); result.put(RETURN_CODE, SUCCESS); sqlConnectionMap.put(aKey, sqlInputs.getLRows()); sqlConnectionMap.put(strKeyCol, sqlInputs.getStrColumns()); if (isLOB) { sqlConnectionMap.put(strKeyFiles, sqlInputs.getLRowsFiles()); sqlConnectionMap.put(strKeyNames, sqlInputs.getLRowsNames()); sqlConnectionMap.put(strKeySkip, 0L); } globalSessionObject.setResource(new SQLSessionResource(sqlConnectionMap)); } else { result.put(SQL_QUERY, sqlInputs.getSqlCommand()); result.put(RETURN_RESULT, NO_MORE); result.put(ROWS_LEFT, ZERO); result.put(RETURN_CODE, DBReturnCodes.NO_MORE); } } globalSessionObject.setResource(new SQLSessionResource(sqlConnectionMap)); return result; } catch (Exception e) { final Map<String, String> failureMap = OutputUtilities.getFailureResultsMap(e); failureMap.put(ROWS_LEFT, ZERO); return failureMap; } }  @Action(name = "SQL Query LOB", outputs = { @Output(RETURN_CODE), @Output(RETURN_RESULT), @Output(EXCEPTION), @Output(ROWS_LEFT), @Output(SQL_QUERY), @Output(COLUMN_NAMES) }, responses = { @Response(text = HAS_MORE, field = RETURN_CODE, value = SUCCESS, matchType = COMPARE_EQUAL, responseType = RESOLVED), @Response(text = NO_MORE, field = RETURN_CODE, value = DBReturnCodes.NO_MORE, matchType = COMPARE_EQUAL, responseType = RESOLVED), @Response(text = FAILURE, field = RETURN_CODE, value = ReturnCodes.FAILURE, matchType = COMPARE_EQUAL, responseType = ERROR, isOnFail = true) }) Map<String, String> execute(@Param(value = DB_SERVER_NAME, required = true) String dbServerName,
                                       @Param(value = DB_TYPE) String dbType,
                                       @Param(value = USERNAME) String username,
                                       @Param(value = PASSWORD, encrypted = true) String password,
                                       @Param(value = INSTANCE) String instance,
                                       @Param(value = DB_PORT) String dbPort,
                                       @Param(value = DATABASE_NAME, required = true) String databaseName,
                                       @Param(value = AUTHENTICATION_TYPE) String authenticationType,
                                       @Param(value = DB_CLASS) String dbClass,
                                       @Param(value = DB_URL) String dbURL,
                                       @Param(value = COMMAND, required = true) String command,
                                       @Param(value = TRUST_ALL_ROOTS) String trustAllRoots,
                                       @Param(value = TRUST_STORE) String trustStore,
                                       @Param(value = TRUST_STORE_PASSWORD) String trustStorePassword,
                                       @Param(value = AUTH_LIBRARY_PATH) String authLibraryPath,
                                       @Param(value = DELIMITER, required = true) String delimiter,
                                       @Param(value = KEY, required = true) String key,
                                       @Param(value = TIMEOUT) String timeout,
                                       @Param(value = DATABASE_POOLING_PROPERTIES) String databasePoolingProperties,
                                       @Param(value = RESULT_SET_TYPE) String resultSetType,
                                       @Param(value = RESULT_SET_CONCURRENCY) String resultSetConcurrency,
                                       @Param(value = GLOBAL_SESSION_OBJECT) GlobalSessionObject<Map<String, Object>> globalSessionObject);  }