Fix sonar issues in ElasticSearchController 48/85048/1
authorburdziak <olaf.burdziakowski@nokia.com>
Thu, 11 Apr 2019 12:16:05 +0000 (14:16 +0200)
committerburdziak <olaf.burdziakowski@nokia.com>
Thu, 11 Apr 2019 12:16:05 +0000 (14:16 +0200)
Change-Id: I7b8d00de321d9c58f38f9105ea1aa764dbf17fc8
Issue-ID: PORTAL-523
Signed-off-by: burdziak <olaf.burdziakowski@nokia.com>
ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/ElasticSearchController.java

index 1adf0db..37c4eb7 100644 (file)
@@ -105,23 +105,22 @@ public class ElasticSearchController extends RestrictedBaseController{
                
                SuggestResult result = client.execute(suggest);
                System.err.println(result.getJsonObject().toString());
-               return new ResponseEntity<Result>(new Result(result.getJsonObject().toString()),HttpStatus.OK);
+               return new ResponseEntity<>(new Result(result.getJsonObject().toString()),HttpStatus.OK);
        }
        
-       @RequestMapping(value="/es_search/{task}",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)      
+       @RequestMapping(value="/es_search/{task}",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
        public ResponseEntity<Result> doSearch(@PathVariable("task") String task) throws IOException {
                JSONObject obj = new JSONObject(task);
                String searchTerm = obj.getString("data");
                String searchSize = obj.getString("size");
-               // String searchFuzzy = obj.getString("fuzzy");
-               
+
                JestClientFactory factory = new JestClientFactory();
                factory.setHttpClientConfig(new HttpClientConfig
                        .Builder("http://todo_elastic_search_server")
                    .multiThreaded(true)
                    .build());
                JestClient client = factory.getObject();
-               
+
                Search search = new Search.Builder("{\n"
                        +"\"query\" : {\n"
                                +"\"query_string\" : {\n"
@@ -129,16 +128,16 @@ public class ElasticSearchController extends RestrictedBaseController{
                                +"}\n"
                +"}\n"
                +"}").addIndex("customer").setParameter(Parameters.SIZE,Integer.valueOf(searchSize)).build();
-               
+
                SearchResult result = client.execute(search);
                System.err.println(result.getJsonObject().toString());
-               return new ResponseEntity<Result>(new Result(result.getJsonObject().toString()),HttpStatus.OK);
+               return new ResponseEntity<>(new Result(result.getJsonObject().toString()),HttpStatus.OK);
        }
-       
+
        public ResponseEntity<Result> sendResult(Result result) {
-               return new ResponseEntity<Result>(result, HttpStatus.OK);
+               return new ResponseEntity<>(result, HttpStatus.OK);
        }
-       
+
        @Override
        public boolean isRESTfulCall() {
                return true;