- Transaction transaction = new Transaction();
-
- transaction.setExecutionEndPoint(resourceUri);
- transaction.setExecutionRPC(ctx.getAttribute(FlowControllerConstants.INPUT_REQUEST_ACTION_TYPE));
- transaction.setAction(FlowControllerConstants.INPUT_REQUEST_ACTION);
- if(ctx.getAttribute(FlowControllerConstants.INPUT_REQUEST_ACTION_TYPE) == null || ctx.getAttribute(FlowControllerConstants.INPUT_REQUEST_ACTION_TYPE).isEmpty())
- throw new Exception("Dont know REST operation for Action " + transaction.getExecutionRPC());
- if(ctx.getAttribute(FlowControllerConstants.INPUT_REQUEST_ACTION) == null || ctx.getAttribute(FlowControllerConstants.INPUT_REQUEST_ACTION).isEmpty())
- throw new Exception("Dont know request-action " + transaction.getAction());
-
- //This code need to get changed to get the UserID and pass from a common place.
- if(transaction.getuId() == null )
- transaction.setuId(prop.getProperty(ctx.getAttribute(FlowControllerConstants.INPUT_REQUEST_ACTION).concat(".default-rest-user")));
- if(transaction.getPswd() == null)
- transaction.setPswd(prop.getProperty(ctx.getAttribute(FlowControllerConstants.INPUT_REQUEST_ACTION).concat(".default-rest-pass")));
-
- HashMap<String, String> output = restRequestExecutor.execute(transaction, ctx);
-
- if(output.get("restResponse") !=null && isValidJSON(output.get("restResponse")) != null)
- {
- ctx.setAttribute(responsePrefix + "." + FlowControllerConstants.OUTPUT_STATUS_MESSAGE , output.get("restResponse"));
-// JsonNode restResponse = isValidJSON(output.get("restResponse"));
-// for (String key : inParams.keySet()) {
-// if(key !=null && key.startsWith("output-")){
-// log.info("Found Key = " + key);
-// log.info("Found Key in Params " + inParams.get(key) + ".");
-// JsonNode setValue = restResponse.findValue(inParams.get(key));
-// log.info("Found value = " + setValue);
-// if(setValue !=null && setValue.textValue() !=null && !setValue.textValue().isEmpty())
-// ctx.setAttribute(responsePrefix + "." + key, setValue.textValue());
-// else
-// ctx.setAttribute(responsePrefix + "." + key, null);
-// }
-// }
+
+ Transaction transaction = transactionHandler.buildTransaction(ctx, prop, resourceUri);
+ Map<String, String> output = restExecutor.execute(transaction, ctx);
+
+ String json = output.get(REST_RESPONSE);
+ log.info("Received response from Interface " + json);
+
+ JsonNode validatedJson = JsonValidator.validate(json);
+
+ if (validatedJson != null) {
+ log.info("state is " + validatedJson.findValue("state"));
+ ctx.setAttribute(responsePrefix + OUTPUT_STATUS_MESSAGE, output.get(REST_RESPONSE));