X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Fcrud%2Fparser%2FCrudResponseBuilder.java;h=18b50ef8f976b0058a9670b09d1011de6e40b0df;hb=0c40bcde9facc109ceb8dabb91156df2b4fb4129;hp=62d14082069d4624ad3eeefcf4d443d57e275052;hpb=94cbd3286b5fdd2f3f8fa3325835e713d71aac73;p=aai%2Fgizmo.git diff --git a/src/main/java/org/onap/crud/parser/CrudResponseBuilder.java b/src/main/java/org/onap/crud/parser/CrudResponseBuilder.java index 62d1408..18b50ef 100644 --- a/src/main/java/org/onap/crud/parser/CrudResponseBuilder.java +++ b/src/main/java/org/onap/crud/parser/CrudResponseBuilder.java @@ -1,16 +1,15 @@ /** * ============LICENSE_START======================================================= - * Gizmo + * org.onap.aai * ================================================================================ - * Copyright © 2017 AT&T Intellectual Property. - * Copyright © 2017 Amdocs - * All rights reserved. + * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright © 2017-2018 Amdocs * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -18,8 +17,6 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END========================================================= - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ package org.onap.crud.parser; @@ -27,18 +24,13 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Set; - -import javax.ws.rs.core.Response.Status; - import org.onap.crud.entity.Edge; import org.onap.crud.entity.Vertex; import org.onap.crud.exception.CrudException; import org.onap.crud.service.BulkPayload; import org.onap.crud.service.EdgePayload; import org.onap.crud.service.VertexPayload; -import org.onap.schema.RelationshipSchemaLoader; - +import org.onap.schema.EdgeRulesLoader; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; @@ -123,7 +115,7 @@ public class CrudResponseBuilder { EdgePayload inEdge = new EdgePayload(); inEdge.setId(e.getId().get()); inEdge.setType(e.getType()); - inEdge.setUrl(URL_BASE + "relationships/" + RelationshipSchemaLoader.getLatestSchemaVersion() + "/" + inEdge.setUrl(URL_BASE + "relationships/" + EdgeRulesLoader.getLatestSchemaVersion() + "/" + e.getType() + "/" + e.getId().get()); inEdge.setSource(URL_BASE + version + "/" + e.getSource().getType() + "/" + e.getSource().getId().get()); @@ -132,7 +124,7 @@ public class CrudResponseBuilder { EdgePayload outEdge = new EdgePayload(); outEdge.setId(e.getId().get()); outEdge.setType(e.getType()); - outEdge.setUrl(URL_BASE + "relationships/" + RelationshipSchemaLoader.getLatestSchemaVersion() + "/" + outEdge.setUrl(URL_BASE + "relationships/" + EdgeRulesLoader.getLatestSchemaVersion() + "/" + e.getType() + "/" + e.getId().get()); outEdge.setTarget(URL_BASE + version + "/" + e.getTarget().getType() + "/" + e.getTarget().getId().get()); outEdges.add(outEdge); @@ -153,6 +145,13 @@ public class CrudResponseBuilder { item.addProperty("id", v.getId().get()); item.addProperty("type", v.getType()); item.addProperty("url", "services/inventory/" + version + "/" + v.getType() + "/" + v.getId().get()); + if (!v.getProperties().isEmpty()) { + JsonObject propertiesObject = new JsonObject(); + for (String key : v.getProperties().keySet()) { + propertiesObject.addProperty(key, v.getProperties().get(key).toString()); + } + item.add("properties", propertiesObject); + } arry.add(item); }