@NotNull public static Map<String, String> getOperationResults(@NotNull final Map<String, String> result, @NotNull final String successMessage, final String failureMessage, final String document) { final Map<String, String> results; final String statusCode = result.get(STATUS_CODE); if (Integer.parseInt(statusCode) >= 200 && Integer.parseInt(statusCode) < 300) { results = getSuccessResultsMap(successMessage); if (!isEmpty(document)) results.put(DOCUMENT, document); } else { results = getFailureResultsMap(failureMessage); } results.put(STATUS_CODE, statusCode); return results; } }
Map<String, String> resultsMap = getFailureResultsMap(e); resultsMap.put(PACKETS_SENT, EMPTY_STRING); resultsMap.put(PACKETS_RECEIVED, EMPTY_STRING);
public static Map<String, String> getSuccessResultMapDescribedProvisionedProduct(DescribeProvisionedProductResult result) { Map<String, String> results = getSuccessResultsMap(result.toString()); results.put(PROVISIONED_PRODUCT_ARN, result.getProvisionedProductDetail().getArn()); results.put(PROVISIONED_PRODUCT_CREATED_TIME, result.getProvisionedProductDetail().getCreatedTime().toString()); results.put(PROVISIONED_PRODUCT_ID, result.getProvisionedProductDetail().getId()); results.put(PROVISIONED_PRODUCT_STATUS, result.getProvisionedProductDetail().getStatus()); results.put(PROVISIONED_PRODUCT_NAME, result.getProvisionedProductDetail().getName()); results.put(PROVISIONED_PRODUCT_TYPE, result.getProvisionedProductDetail().getType()); return results; }
connectTimeout, socketTimeout, keepAlive, connectionsMaxPerRoute, connectionsMaxTotal); if (!exceptionMessages.isEmpty()) { return getFailureResultsMap(StringUtilities.join(exceptionMessages, NEW_LINE)); return getFailureResultsMap(exception);
public static Map<String, String> getSuccessResultMapProvisionProduct(ProvisionProductResult result) { Map<String, String> results = getSuccessResultsMap(result.toString()); results.put(CREATED_TIME, result.getRecordDetail().getCreatedTime().toString()); results.put(PATH_ID, result.getRecordDetail().getPathId()); results.put(PRODUCT_ID, result.getRecordDetail().getProductId()); results.put(PROVISIONED_PRODUCT_ID, result.getRecordDetail().getProvisionedProductId()); results.put(PROVISIONED_PRODUCT_NAME, result.getRecordDetail().getProvisionedProductName()); results.put(PROVISIONED_PRODUCT_TYPE, result.getRecordDetail().getProvisionedProductType()); results.put(PROVISIONING_ARTIFACT_ID, result.getRecordDetail().getProvisioningArtifactId()); results.put(STATUS, result.getRecordDetail().getStatus()); return results; }
public static Map<String, String> createInstance(HttpClientInputs httpClientInputs) { final Map<String, String> httpResponse = new HttpClientService().execute(httpClientInputs); if (parseInt(httpResponse.get(STATUS_CODE)) == HTTP_OK) { final CustomInput customInput = new CustomInput(); final Map<String, String> queryPropertyName = new XpathQueryService().execute(customInput.getCommonInputs(httpResponse.get(RETURN_RESULT), XML_DOCUMENT_SOURCE, X_PATH_QUERY_PROPERTY_NAME, SECURE_PROCESSING), customInput.getCustomInputs(QUERY_TYPE, DELIMITER)); final List<String> finalList = new ArrayList<>(); final String[] arrayProp = queryPropertyName.get(SELECTED_VALUE).split(COMMA); int nr = 0; for (String anArrayProp : arrayProp) if (anArrayProp.contains(PARAM)) nr++; listValue(finalList, arrayProp, nr, customInput, httpResponse, PARAM); final String finalResponse = join(finalList, EMPTY); Map<String, String> result = getSuccessResultsMap(RETURN_RESULT_MESSAGE); result.put(PARAM_LIST, finalResponse); return result; } else { return getFailureResultsMap(join(httpResponse.get(EXCEPTION), NEW_LINE)); } }
return getFailureResultsMap(validator.getErrors()); return getFailureResultsMap(e);
public static Map<String, String> getSuccessResultMapUpdateProvisioningProduct(UpdateProvisionedProductResult result) { Map<String, String> results = getSuccessResultsMap(result.toString()); results.put(CREATED_TIME, result.getRecordDetail().getCreatedTime().toString()); results.put(PATH_ID, result.getRecordDetail().getPathId()); results.put(PRODUCT_ID, result.getRecordDetail().getProductId()); results.put(PROVISIONED_PRODUCT_ID, result.getRecordDetail().getProvisionedProductId()); results.put(PROVISIONED_PRODUCT_NAME, result.getRecordDetail().getProvisionedProductName()); results.put(PROVISIONED_PRODUCT_TYPE, result.getRecordDetail().getProvisionedProductType()); results.put(PROVISIONING_ARTIFACT_ID, result.getRecordDetail().getProvisioningArtifactId()); results.put(UPDATE_TIME, result.getRecordDetail().getUpdatedTime().toString()); results.put(RECORD_ID, result.getRecordDetail().getRecordId()); results.put(RECORD_TYPE, result.getRecordDetail().getRecordType()); results.put(RECORD_ERRORS, result.getRecordDetail().getRecordErrors().toString()); results.put(RECORD_TAGS, result.getRecordDetail().getRecordErrors().toString()); results.put(STATUS, result.getRecordDetail().getStatus()); return results; }
return getSuccessResultsMap("No changes in pg_hba.conf"); return getSuccessResultsMap("Updated pg_hba.conf successfully"); } catch (Exception e) { return getFailureResultsMap("Failed to update pg_hba.conf", e);
return getFailureResultsMap(validator.getErrors()); return getFailureResultsMap(e);
@Action(name = "URL Decoder", description = URL_DECODER_DESC, outputs = { @Output(value = EXCEPTION, description = EXCEPTION_DESC), @Output(value = RETURN_CODE, description = RETURN_CODE_DESC), @Output(value = RETURN_RESULT, description = RETURN_RESULT_DESC) }, responses = { @Response(text = SUCCESS, field = RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = FAILURE, field = RETURN_CODE, value = ReturnCodes.FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR) } ) public Map<String, String> execute( @Param(value = URL, required = true, description = URL_DESC) String url, @Param(value = CHARACTER_SET, description = CHARACTER_SET_DESC) String characterSet) { try { if (StringUtils.isEmpty(characterSet)) { characterSet = Utils.DEFAULT_CHARACTER_SET; } final String returnResult = URLDecoder.decode(url, characterSet); return getSuccessResultsMap(returnResult); } catch (Exception e) { return getFailureResultsMap(e.getMessage()); } } }
return getFailureResultsMap(validator.getErrors()); return getFailureResultsMap(e);
final JsonNode jsonNode = JsonService.evaluateJsonPathQuery(jsonObject, jsonPath); if (!jsonNode.isNull()) { return OutputUtilities.getSuccessResultsMap(jsonNode.toString()); return OutputUtilities.getSuccessResultsMap(NULL_STRING); } catch (Exception exception) { return OutputUtilities.getFailureResultsMap(exception);
return getFailureResultsMap(StringUtilities.join(exceptionMessages, NEW_LINE)); return getFailureResultsMap(exception);
@Action(name = "URL Encoder", description = URL_ENCODER_DESC, outputs = { @Output(value = HttpClientService.EXCEPTION, description = EXCEPTION_DESC), @Output(value = RETURN_CODE, description = RETURN_CODE_DESC), @Output(value = RETURN_RESULT, description = RETURN_RESULT_DESC) }, responses = { @Response(text = SUCCESS, field = RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = FAILURE, field = RETURN_CODE, value = ReturnCodes.FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR) } ) public Map<String, String> execute( @Param(value = TEXT, required = true, description = URL_DESC) String text, @Param(value = CHARACTER_SET, description = CHARACTER_SET_DESC) String characterSet) { try { if (StringUtils.isEmpty(characterSet)) { characterSet = Utils.DEFAULT_CHARACTER_SET; } String returnResult = URLEncoder.encode(text, characterSet); return getSuccessResultsMap(returnResult); } catch (Exception e) { return getFailureResultsMap(e.getMessage()); } }
return getFailureResultsMap(StringUtilities.join(exceptionMessages, NEW_LINE)); return getFailureResultsMap(exception);
@Action(name = "URL Encoder", description = URL_ENCODER_DESC, outputs = { @Output(value = HttpClientService.EXCEPTION, description = EXCEPTION_DESC), @Output(value = RETURN_CODE, description = RETURN_CODE_DESC), @Output(value = RETURN_RESULT, description = RETURN_RESULT_DESC) }, responses = { @Response(text = SUCCESS, field = RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = FAILURE, field = RETURN_CODE, value = ReturnCodes.FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR) } ) public Map<String, String> execute( @Param(value = TEXT, required = true, description = URL_DESC) String text, @Param(value = CHARACTER_SET, description = CHARACTER_SET_DESC) String characterSet) { try { if (StringUtils.isEmpty(characterSet)) { characterSet = Utils.DEFAULT_CHARACTER_SET; } String returnResult = URLEncoder.encode(text, characterSet); return getSuccessResultsMap(returnResult); } catch (Exception e) { return getFailureResultsMap(e.getMessage()); } }
connectionsMaxPerRoute, connectionsMaxTotal); if (!exceptionMessages.isEmpty()) { return getFailureResultsMap(StringUtilities.join(exceptionMessages, NEW_LINE)); return getFailureResultsMap(exception);
@Action(name = "URL Decoder", description = URL_DECODER_DESC, outputs = { @Output(value = EXCEPTION, description = EXCEPTION_DESC), @Output(value = RETURN_CODE, description = RETURN_CODE_DESC), @Output(value = RETURN_RESULT, description = RETURN_RESULT_DESC) }, responses = { @Response(text = SUCCESS, field = RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = FAILURE, field = RETURN_CODE, value = ReturnCodes.FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR) } ) public Map<String, String> execute( @Param(value = URL, required = true, description = URL_DESC) String url, @Param(value = CHARACTER_SET, description = CHARACTER_SET_DESC) String characterSet) { try { if (StringUtils.isEmpty(characterSet)) { characterSet = Utils.DEFAULT_CHARACTER_SET; } final String returnResult = URLDecoder.decode(url, characterSet); return getSuccessResultsMap(returnResult); } catch (Exception e) { return getFailureResultsMap(e.getMessage()); } } }
return getFailureResultsMap(StringUtilities.join(exceptionMessages, NEW_LINE)); return getOperationResults(result, returnMessage, returnMessage, EMPTY); } catch (Exception exception) { return getFailureResultsMap(exception);