aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org
diff options
context:
space:
mode:
authorShwetank Dave <shwetank.dave@amdocs.com>2018-04-05 10:13:31 -0400
committerShwetank Dave <shwetank.dave@amdocs.com>2018-04-06 08:31:09 -0400
commit3c702a13da91564f65fbc2a002b7737325daaf56 (patch)
tree9140f9964de7a0093a833811147890af98a1962e /src/main/java/org
parentf9be5d8fc3070659a302d34a9c027569aa807c0f (diff)
Rename Path search-db to search-data-service.
Fix mixtakes in processGet Remove requestBody from where it's not needed. Remove elastic-search dependency Issue-ID: AAI-598 Change-Id: Ib9693297230daba43ed604013c9cf4d32355da92 Signed-off-by: Shwetank Dave <shwetank.dave@amdocs.com>
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/onap/aai/sa/rest/AnalyzerApi.java19
-rw-r--r--src/main/java/org/onap/aai/sa/rest/SearchServiceApi.java63
2 files changed, 42 insertions, 40 deletions
diff --git a/src/main/java/org/onap/aai/sa/rest/AnalyzerApi.java b/src/main/java/org/onap/aai/sa/rest/AnalyzerApi.java
index de7ba59..8db9a42 100644
--- a/src/main/java/org/onap/aai/sa/rest/AnalyzerApi.java
+++ b/src/main/java/org/onap/aai/sa/rest/AnalyzerApi.java
@@ -40,12 +40,17 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.http.HttpStatus;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
-//@Path("/analyzers")
+@Component
+@EnableWebSecurity
@RestController
-@RequestMapping("/services/search-db-service/v1/analyzers")
+@RequestMapping("/services/search-data-service/v1/analyzers/search")
public class AnalyzerApi {
private SearchServiceApi searchService = null;
@@ -59,10 +64,12 @@ public class AnalyzerApi {
this.searchService = searchService;
}
- @GET
- public ResponseEntity<String> processGet(@Context HttpServletRequest request,
- @Context HttpHeaders headers,
- ApiUtils apiUtils) {
+ @RequestMapping(method = RequestMethod.GET,
+ consumes = {"application/json"},
+ produces = {"application/json"})
+ public ResponseEntity<String> processGet(HttpServletRequest request,
+ @RequestHeader HttpHeaders headers,
+ ApiUtils apiUtils) {
HttpStatus responseCode = HttpStatus.INTERNAL_SERVER_ERROR;
String responseString = "Undefined error";
diff --git a/src/main/java/org/onap/aai/sa/rest/SearchServiceApi.java b/src/main/java/org/onap/aai/sa/rest/SearchServiceApi.java
index 9552658..7e187ee 100644
--- a/src/main/java/org/onap/aai/sa/rest/SearchServiceApi.java
+++ b/src/main/java/org/onap/aai/sa/rest/SearchServiceApi.java
@@ -35,12 +35,10 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.security.cert.X509Certificate;
-// import javax.servlet.http.HttpServletRequest;
-
@Component
@EnableWebSecurity
@RestController
-@RequestMapping("/services/search-db-service/v1")
+@RequestMapping("/services/search-data-service/v1/search")
public class SearchServiceApi {
/**
@@ -88,10 +86,9 @@ public class SearchServiceApi {
method = RequestMethod.DELETE,
consumes = {"application/json"},
produces = {"application/json"})
- public ResponseEntity<String> processDeleteIndex(String requestBody,
- HttpServletRequest request,
- @RequestHeader HttpHeaders headers,
- @PathVariable ("index") String index) {
+ public ResponseEntity<String> processDeleteIndex(HttpServletRequest request,
+ @RequestHeader HttpHeaders headers,
+ @PathVariable ("index") String index) {
// Forward the request to our index API to delete the index.
IndexApi indexApi = new IndexApi(this);
@@ -102,7 +99,7 @@ public class SearchServiceApi {
@RequestMapping(value = "/indexes/{index}/documents",
method = RequestMethod.POST,
consumes = {"application/json"})
- public ResponseEntity<String> processCreateDocWithoutId(String requestBody,
+ public ResponseEntity<String> processCreateDocWithoutId(@RequestBody String requestBody,
HttpServletRequest request,
HttpServletResponse httpResponse,
@RequestHeader HttpHeaders headers,
@@ -117,7 +114,7 @@ public class SearchServiceApi {
@RequestMapping(value = "/indexes/{index}/documents/{id}",
method = RequestMethod.PUT,
consumes = {"application/json"})
- public ResponseEntity<String> processUpsertDoc(String requestBody,
+ public ResponseEntity<String> processUpsertDoc(@RequestBody String requestBody,
HttpServletRequest request,
HttpServletResponse httpResponse,
@RequestHeader HttpHeaders headers,
@@ -131,9 +128,9 @@ public class SearchServiceApi {
}
@RequestMapping(value = "/indexes/{index}/documents/{id}",
- method = RequestMethod.GET)
- public ResponseEntity<String> processGetDocument(String requestBody,
- HttpServletRequest request,
+ method = RequestMethod.GET,
+ consumes = {"application/json"})
+ public ResponseEntity<String> processGetDocument(HttpServletRequest request,
HttpServletResponse httpResponse,
@RequestHeader HttpHeaders headers,
@PathVariable ("index") String index,
@@ -141,48 +138,46 @@ public class SearchServiceApi {
// Forward the request to our document API to retrieve the document.
DocumentApi documentApi = new DocumentApi(this);
- return documentApi.processGet(requestBody, request, headers, httpResponse,
+ return documentApi.processGet("", request, headers, httpResponse,
index, id, documentStore);
}
@RequestMapping(value = "/indexes/{index}/documents/{id}",
method = RequestMethod.DELETE,
consumes = {"application/json"})
- public ResponseEntity<String> processDeleteDoc(String requestBody,
- HttpServletRequest request,
- HttpServletResponse httpResponse,
- @RequestHeader HttpHeaders headers,
- @PathVariable ("index") String index,
- @PathVariable ("id") String id) {
+ public ResponseEntity<String> processDeleteDoc(HttpServletRequest request,
+ HttpServletResponse httpResponse,
+ @RequestHeader HttpHeaders headers,
+ @PathVariable ("index") String index,
+ @PathVariable ("id") String id) {
// Forward the request to our document API to delete the document.
DocumentApi documentApi = new DocumentApi(this);
- return documentApi.processDelete(requestBody, request, headers, httpResponse,
+ return documentApi.processDelete("", request, headers, httpResponse,
index, id, documentStore);
}
@RequestMapping(value = "/indexes/{index}/query/{queryText}",
method = RequestMethod.GET,
consumes = {"application/json"})
- public ResponseEntity<String> processInlineQuery(String requestBody,
- HttpServletRequest request,
- @RequestHeader HttpHeaders headers,
- @PathVariable ("index") String index,
- @PathVariable ("queryText") String queryText) {
+ public ResponseEntity<String> processInlineQuery(HttpServletRequest request,
+ @RequestHeader HttpHeaders headers,
+ @PathVariable ("index") String index,
+ @PathVariable ("queryText") String queryText) {
// Forward the request to our document API to delete the document.
DocumentApi documentApi = new DocumentApi(this);
- return documentApi.processSearchWithGet(requestBody, request, headers,
+ return documentApi.processSearchWithGet("", request, headers,
index, queryText, documentStore);
}
@RequestMapping(value = "/indexes/{index}/query",
method = RequestMethod.GET,
consumes = {"application/json"})
- public ResponseEntity<String> processQueryWithGet(String requestBody,
- HttpServletRequest request,
- @RequestHeader HttpHeaders headers,
- @PathVariable ("index") String index) {
+ public ResponseEntity<String> processQueryWithGet(@RequestBody String requestBody,
+ HttpServletRequest request,
+ @RequestHeader HttpHeaders headers,
+ @PathVariable ("index") String index) {
// Forward the request to our document API to delete the document.
DocumentApi documentApi = new DocumentApi(this);
@@ -192,7 +187,7 @@ public class SearchServiceApi {
@RequestMapping(value = "/indexes/{index}/query",
method = RequestMethod.POST,
consumes = {"application/json"})
- public ResponseEntity<String> processQuery(String requestBody,
+ public ResponseEntity<String> processQuery(@RequestBody String requestBody,
HttpServletRequest request,
@RequestHeader HttpHeaders headers,
@PathVariable ("index") String index) {
@@ -205,7 +200,7 @@ public class SearchServiceApi {
@RequestMapping(value = "/indexes/{index}/suggest",
method = RequestMethod.POST,
consumes = {"application/json"})
- public ResponseEntity<String> processSuggestQuery(String requestBody, HttpServletRequest request,
+ public ResponseEntity<String> processSuggestQuery(@RequestBody String requestBody, HttpServletRequest request,
@RequestHeader HttpHeaders headers, @PathVariable("index") String index) {
// Forward the request to our document API to query suggestions in the
// document.
@@ -217,7 +212,7 @@ public class SearchServiceApi {
@RequestMapping(value = "/indexes/dynamic/{index}",
method = RequestMethod.PUT,
consumes = {"application/json"})
- public ResponseEntity<String> processCreateDynamicIndex(String requestBody,
+ public ResponseEntity<String> processCreateDynamicIndex(@RequestBody String requestBody,
HttpServletRequest request,
@RequestHeader HttpHeaders headers,
@PathVariable ("index") String index) {
@@ -230,7 +225,7 @@ public class SearchServiceApi {
@RequestMapping(value = "/bulk",
method = RequestMethod.POST,
consumes = {"application/json"})
- public ResponseEntity<String> processBulkRequest(String requestBody,
+ public ResponseEntity<String> processBulkRequest(@RequestBody String requestBody,
HttpServletRequest request,
@RequestHeader HttpHeaders headers) {