Skip to content

Commit

Permalink
Merge pull request #44 from AO-StreetArt/objectQueryReturn
Browse files Browse the repository at this point in the history
Allow Object Query to return multiple records
  • Loading branch information
AO-StreetArt committed Mar 6, 2018
2 parents cb4adf9 + 192c6a8 commit 8e4bdee
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/main/java/adrestia/controller/obj3/ObjectController.java
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public ResponseEntity<ObjectDocument> deleteObject(
* Scene name input as path variable, Request Parameters accepted.
*/
@RequestMapping(method = RequestMethod.GET, path = "scene/{scn_name}/object")
public ResponseEntity<ObjectDocument> queryObject(
public ResponseEntity<ObjectList> queryObject(
@PathVariable("scn_name") String sceneName,
@RequestParam(value = "type", defaultValue = "") String type,
@RequestParam(value = "subtype", defaultValue = "") String subtype,
Expand All @@ -300,9 +300,7 @@ public ResponseEntity<ObjectDocument> queryObject(

// Update our HTTP Response based on the Clyman response
HttpStatus returnCode = utils.translateDvsError(clymanResponse.getErrorCode());
if (isSuccessResponse(clymanResponse)) {
returnObj = clymanResponse.getDocuments()[0];
} else {
if (!(isSuccessResponse(clymanResponse))) {
logger.debug("Failure Registered. Clyman Response Error Code and Length:");
logger.debug(clymanResponse.getNumRecords());
logger.debug(clymanResponse.getErrorCode());
Expand All @@ -313,7 +311,7 @@ public ResponseEntity<ObjectDocument> queryObject(
responseHeaders.set("Content-Type", "application/json");

// Create and return the new HTTP Response
return new ResponseEntity<ObjectDocument>(returnObj, responseHeaders, returnCode);
return new ResponseEntity<ObjectList>(clymanResponse, responseHeaders, returnCode);
}

private ResponseEntity<ObjectDocument> lockTransaction(String sceneName,
Expand Down

0 comments on commit 8e4bdee

Please sign in to comment.