Skip to content

Commit

Permalink
Modified generate's endpoint generate to accept array of events
Browse files Browse the repository at this point in the history
  • Loading branch information
shudhansu-shekhar committed Aug 5, 2024
1 parent 962cabb commit dbb2ed3
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public ResponseEntity<?> generate(final String msgProtocol, final String msgType
*/
public ResponseEntity<JsonObject> createResponseEntity(HttpStatus status, String responseMessage, String resultMessage,
JsonObject errorResponse) {
initializeResponse(status, responseMessage, resultMessage, errorResponse);
initializeResponse(status, resultMessage, responseMessage, errorResponse);
return new ResponseEntity<>(errorResponse, status);
}

Expand All @@ -226,7 +226,7 @@ public ResponseEntity<JsonObject> createResponseEntity(HttpStatus status, String
* @param resultMessage whatever the result this message gives you idea about that
* @return ResponseEntity
*/
public ResponseEntity<JsonObject> createResponseEntity(HttpStatus status, String responseMessage, String resultMessage) {
public ResponseEntity<JsonObject> createResponseEntity(HttpStatus status, String resultMessage, String responseMessage) {
return createResponseEntity(status, responseMessage, resultMessage, new JsonObject());
}

Expand All @@ -236,7 +236,7 @@ public ResponseEntity<JsonObject> createResponseEntity(HttpStatus status, String
* @param resultMessage whatever the result this message gives you idea about that
* @param errorResponse is to collect all the responses here.
*/
public void initializeResponse(HttpStatus status, String errorMessage, String resultMessage, JsonObject errorResponse) {
public void initializeResponse(HttpStatus status, String resultMessage, String errorMessage, JsonObject errorResponse) {
errorResponse.addProperty(JSON_STATUS_CODE, status.value());
errorResponse.addProperty(JSON_STATUS_RESULT, resultMessage);
errorResponse.addProperty(JSON_ERROR_MESSAGE_FIELD, errorMessage);
Expand Down Expand Up @@ -299,7 +299,7 @@ public JsonObject processEvent(String msgProtocol, String msgType, Boolean failI

if (parsedJson.has(JSON_ERROR_MESSAGE_FIELD)) {
JsonObject eventResponse = new JsonObject();
createResponseEntity(HttpStatus.BAD_REQUEST, JSON_ERROR_STATUS, TEMPLATE_ERROR, eventResponse);
createResponseEntity(HttpStatus.BAD_REQUEST, parsedJson.toString(), JSON_ERROR_STATUS, eventResponse);
return eventResponse;
} else {
return parsedJson;
Expand Down

0 comments on commit dbb2ed3

Please sign in to comment.