summaryrefslogtreecommitdiffstats
path: root/aai-resources/src/main/java/org
diff options
context:
space:
mode:
authorLaMont, William (wl2432) <wl2432@att.com>2020-06-26 17:24:51 -0400
committerLaMont, William (wl2432) <wl2432@att.com>2020-06-26 17:25:39 -0400
commit9666d712661e58fa4918f9c49d03fde6f4434e07 (patch)
tree575ea35b8ae09ec5a07acf5af212fe4fa91f94f3 /aai-resources/src/main/java/org
parent486d7f22a047b1465abc5a1365560ebf44c0e589 (diff)
support for v20
Issue-ID: AAI-2965 Change-Id: I87737d2cfcf6b499af6083c2355042d66278e73c Signed-off-by: LaMont, William (wl2432) <wl2432@att.com>
Diffstat (limited to 'aai-resources/src/main/java/org')
-rw-r--r--aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java3
-rw-r--r--aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java12
-rw-r--r--aai-resources/src/main/java/org/onap/aai/rest/URLFromVertexIdConsumer.java5
3 files changed, 11 insertions, 9 deletions
diff --git a/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java
index 3f595d1..4bd1a0d 100644
--- a/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java
+++ b/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java
@@ -354,8 +354,7 @@ public abstract class BulkConsumer extends RESTAPI {
throw new AAIException("AAI_6111", String.format("input payload does not follow %s interface", module));
}
}
-
- Gson gson = new Gson();
+ Gson gson = new GsonBuilder().serializeNulls().create();
String bodyStr = gson.toJson(bodyObj);
bulkOperation.setRawReq(bodyStr);
diff --git a/aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java
index e6dcc77..8939d04 100644
--- a/aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java
+++ b/aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java
@@ -227,7 +227,8 @@ public class LegacyMoxyConsumer extends RESTAPI {
SchemaVersion version = new SchemaVersion(versionParam);
final HttpEntry traversalUriHttpEntry = SpringContextAware.getBean("traversalUriHttpEntry", HttpEntry.class);
- traversalUriHttpEntry.setHttpEntryProperties(version);
+ String serverBase = req.getRequestURL().toString().replaceAll("/(v[0-9]+|latest)/.*", "/");
+ traversalUriHttpEntry.setHttpEntryProperties(version, serverBase);
dbEngine = traversalUriHttpEntry.getDbEngine();
loader = traversalUriHttpEntry.getLoader();
MultivaluedMap<String, String> params = info.getQueryParameters();
@@ -438,7 +439,7 @@ public class LegacyMoxyConsumer extends RESTAPI {
@Path("/{uri: .+}/relationship-list")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
- public Response getRelationshipList (@DefaultValue("-1") @QueryParam("resultIndex") String resultIndex, @DefaultValue("-1") @QueryParam("resultSize") String resultSize, @PathParam("version")String versionParam, @PathParam("uri") @Encoded String uri, @DefaultValue("false") @QueryParam("cleanup") String cleanUp, @Context HttpHeaders headers, @Context UriInfo info) {
+ public Response getRelationshipList (@DefaultValue("-1") @QueryParam("resultIndex") String resultIndex, @DefaultValue("-1") @QueryParam("resultSize") String resultSize, @PathParam("version")String versionParam, @PathParam("uri") @Encoded String uri, @DefaultValue("false") @QueryParam("cleanup") String cleanUp, @Context HttpHeaders headers, @Context HttpServletRequest req,@Context UriInfo info) {
return runner(AAIConstants.AAI_CRUD_TIMEOUT_ENABLED,
AAIConstants.AAI_CRUD_TIMEOUT_APP,
AAIConstants.AAI_CRUD_TIMEOUT_LIMIT,
@@ -448,7 +449,7 @@ public class LegacyMoxyConsumer extends RESTAPI {
new AaiCallable<Response>() {
@Override
public Response process() {
- return getRelationshipList(versionParam, uri, cleanUp, headers, info, resultIndex, resultSize);
+ return getRelationshipList(versionParam, req, uri, cleanUp, headers, info, resultIndex, resultSize);
}
}
);
@@ -463,7 +464,7 @@ public class LegacyMoxyConsumer extends RESTAPI {
* @param info
* @return
*/
- public Response getRelationshipList(String versionParam, String uri, String cleanUp, HttpHeaders headers, UriInfo info, String resultIndex, String resultSize) {
+ public Response getRelationshipList(String versionParam, HttpServletRequest req, String uri, String cleanUp, HttpHeaders headers, UriInfo info, String resultIndex, String resultSize) {
String sourceOfTruth = headers.getRequestHeaders().getFirst("X-FromAppId");
String transId = headers.getRequestHeaders().getFirst("X-TransactionId");
Response response = null;
@@ -475,7 +476,8 @@ public class LegacyMoxyConsumer extends RESTAPI {
SchemaVersion version = new SchemaVersion(versionParam);
final HttpEntry traversalUriHttpEntry = SpringContextAware.getBean("traversalUriHttpEntry", HttpEntry.class);
- traversalUriHttpEntry.setHttpEntryProperties(version);
+ String serverBase = req.getRequestURL().toString().replaceAll("/(v[0-9]+|latest)/.*", "/");
+ traversalUriHttpEntry.setHttpEntryProperties(version, serverBase);
dbEngine = traversalUriHttpEntry.getDbEngine();
loader = traversalUriHttpEntry.getLoader();
MultivaluedMap<String, String> params = info.getQueryParameters();
diff --git a/aai-resources/src/main/java/org/onap/aai/rest/URLFromVertexIdConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/URLFromVertexIdConsumer.java
index 041952b..9293569 100644
--- a/aai-resources/src/main/java/org/onap/aai/rest/URLFromVertexIdConsumer.java
+++ b/aai-resources/src/main/java/org/onap/aai/rest/URLFromVertexIdConsumer.java
@@ -74,7 +74,8 @@ public class URLFromVertexIdConsumer extends RESTAPI {
TransactionalGraphEngine dbEngine = null;
try {
HttpEntry resourceHttpEntry = SpringContextAware.getBean("traversalUriHttpEntry", HttpEntry.class);
- resourceHttpEntry.setHttpEntryProperties(version);
+ String serverBase = req.getRequestURL().toString().replaceAll("/(v[0-9]+|latest)/.*", "/");
+ resourceHttpEntry.setHttpEntryProperties(version, serverBase);
dbEngine = resourceHttpEntry.getDbEngine();
DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, sourceOfTruth);
@@ -88,7 +89,7 @@ public class URLFromVertexIdConsumer extends RESTAPI {
result.append(uri.getRawPath());
result.insert(0, version);
- result.insert(0, AAIConfig.get("aai.server.url.base"));
+ result.insert(0, serverBase);
response = Response.ok().entity(result.toString()).status(Status.OK).type(MediaType.TEXT_PLAIN).build();
} catch (AAIException e) {
//TODO check that the details here are sensible