Skip to content

Commit

Permalink
Improve efficiency how result of event generation is handled
Browse files Browse the repository at this point in the history
  • Loading branch information
shudhansu-shekhar committed Nov 5, 2024
1 parent b6ec668 commit 4f0b700
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## 2.1.14
- Modify /generate end-point to work for Gen1 templates
- Made changes to /generate end-point to improve efficiency how result of event generation is handled

## 2.1.13
- Made changes to /generate end-point to work for Gen1 templates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.ericsson.eiffel.remrem.protocol.MsgService;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.*;
Expand All @@ -33,7 +32,6 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.RequestEntity;
Expand Down Expand Up @@ -173,7 +171,7 @@ public ResponseEntity<?> generate(final String msgProtocol, final String msgType
int failedCount = 0;
for (JsonElement element : inputEventJsonArray) {
try {
JsonObject generatedEvent = processEvent(msgProtocol, msgType,
JsonObject generatedEvent = generateEvent(msgProtocol, msgType,
failIfMultipleFound, failIfNoneFound, lookupInExternalERs, lookupLimit,
okToLeaveOutInvalidOptionalFields, element.getAsJsonObject());
generatedEventResults.add(generatedEvent);
Expand Down Expand Up @@ -202,7 +200,7 @@ public ResponseEntity<?> generate(final String msgProtocol, final String msgType

} else if (inputData.isJsonObject()) {
JsonObject inputJsonObject = inputData.getAsJsonObject();
JsonObject processedJson = processEvent(msgProtocol, msgType, failIfMultipleFound, failIfNoneFound,
JsonObject processedJson = generateEvent(msgProtocol, msgType, failIfMultipleFound, failIfNoneFound,
lookupInExternalERs, lookupLimit, okToLeaveOutInvalidOptionalFields, inputJsonObject);
return new ResponseEntity<>(processedJson, HttpStatus.OK);
} else {
Expand Down Expand Up @@ -295,9 +293,9 @@ private ResponseEntity<JsonObject> handleException(Exception e) {
* @param jsonObject The content of the message which is used in creating the event details.
* @return JsonObject generated event
*/
public JsonObject processEvent(String msgProtocol, String msgType, Boolean failIfMultipleFound,
Boolean failIfNoneFound, Boolean lookupInExternalERs, int lookupLimit,
Boolean okToLeaveOutInvalidOptionalFields, JsonObject jsonObject) throws REMGenerateException, JsonSyntaxException {
public JsonObject generateEvent(String msgProtocol, String msgType, Boolean failIfMultipleFound,
Boolean failIfNoneFound, Boolean lookupInExternalERs, int lookupLimit,
Boolean okToLeaveOutInvalidOptionalFields, JsonObject jsonObject) throws REMGenerateException, JsonSyntaxException {
JsonElement parsedResponse;

JsonObject event = erLookup(jsonObject, failIfMultipleFound, failIfNoneFound, lookupInExternalERs, lookupLimit);
Expand Down

0 comments on commit 4f0b700

Please sign in to comment.