diff options
author | ur326r <ur326r@att.com> | 2017-08-14 14:49:45 -0400 |
---|---|---|
committer | ur326r <ur326r@att.com> | 2017-08-14 15:21:37 -0400 |
commit | ff7ec85b8b2870856387951899c680a11860f2a4 (patch) | |
tree | 99522995785d9dab94771e481a0a6f0521a1e4aa /aai-traversal/src/main/java/org | |
parent | 619ac4c234f186e1aea9add8f2f9e119b8ec4266 (diff) |
[AAI-168 Amsterdam] add stored queries
Change-Id: I3ab0459c97ebbab98b0a6dc4c9d3cb701aac548f
Signed-off-by: ur326r <ur326r@att.com>
Diffstat (limited to 'aai-traversal/src/main/java/org')
-rw-r--r-- | aai-traversal/src/main/java/org/openecomp/aai/rest/QueryConsumer.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/aai-traversal/src/main/java/org/openecomp/aai/rest/QueryConsumer.java b/aai-traversal/src/main/java/org/openecomp/aai/rest/QueryConsumer.java index a5f476a..2264f24 100644 --- a/aai-traversal/src/main/java/org/openecomp/aai/rest/QueryConsumer.java +++ b/aai-traversal/src/main/java/org/openecomp/aai/rest/QueryConsumer.java @@ -38,6 +38,7 @@ import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; @@ -87,7 +88,7 @@ public class QueryConsumer extends RESTAPI { Response response = null; TransactionalGraphEngine dbEngine = null; try { - + this.checkQueryParams(info.getQueryParameters()); Format format = Format.valueOf(queryFormat); if (queryProcessor != null) { processorType = QueryProcessorType.valueOf(queryProcessor); @@ -156,7 +157,7 @@ public class QueryConsumer extends RESTAPI { DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, sourceOfTruth); FormatFactory ff = new FormatFactory(httpEntry.getLoader(), serializer); - Formatter formater = ff.get(format); + Formatter formater = ff.get(format, info.getQueryParameters()); result = formater.output(vertices).toString(); @@ -178,5 +179,18 @@ public class QueryConsumer extends RESTAPI { return response; } + + public void checkQueryParams(MultivaluedMap<String, String> params) throws AAIException { + + if (params.containsKey("depth") && params.getFirst("depth").matches("\\d+")) { + String depth = params.getFirst("depth"); + Integer i = Integer.parseInt(depth); + if (i > 1) { + throw new AAIException("AAI_3303"); + } + } + + + } } |