X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Faai%2Fmodelloader%2Fentity%2Fcatalog%2FVnfCatalogArtifactHandler.java;h=3480c68a142b29a1e5e3c3b9cb8c0a9aa5410647;hb=refs%2Fchanges%2F77%2F48077%2F1;hp=b224407ec827b537f1d0830dc33d781f918447ae;hpb=7b1f813441f94261f43ec4f5bb0944ad2570fbdf;p=aai%2Fmodel-loader.git diff --git a/src/main/java/org/onap/aai/modelloader/entity/catalog/VnfCatalogArtifactHandler.java b/src/main/java/org/onap/aai/modelloader/entity/catalog/VnfCatalogArtifactHandler.java index b224407..3480c68 100644 --- a/src/main/java/org/onap/aai/modelloader/entity/catalog/VnfCatalogArtifactHandler.java +++ b/src/main/java/org/onap/aai/modelloader/entity/catalog/VnfCatalogArtifactHandler.java @@ -1,22 +1,22 @@ /** - * ============LICENSE_START========================================== + * ============LICENSE_START======================================================= * org.onap.aai - * =================================================================== + * ================================================================================ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * =================================================================== + * Copyright © 2017-2018 European Software Marketing Ltd. + * ================================================================================ * 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, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ============LICENSE_END============================================ + * ============LICENSE_END========================================================= */ package org.onap.aai.modelloader.entity.catalog; @@ -89,7 +89,7 @@ public class VnfCatalogArtifactHandler extends ArtifactHandler { // If an empty dataItem is supplied, do nothing. if (dataItem.isEmpty()) { logger.warn(ModelLoaderMsgs.DISTRIBUTION_EVENT, "Empty image data supplied, skipping ingestion."); - return; + continue; } String urlParams; @@ -142,18 +142,13 @@ public class VnfCatalogArtifactHandler extends ArtifactHandler { String uuid = UUID.randomUUID().toString(); dataItem.put(ATTR_UUID, uuid); - String payload = createVnfImagePayload(dataItem); + String payload = new Gson().toJson(dataItem); String putUrl = config.getAaiBaseUrl() + config.getAaiVnfImageUrl() + "/vnf-image/" + uuid; OperationResult putResp = restClient.putResource(putUrl, payload, distributionId, MediaType.APPLICATION_JSON_TYPE); return putResp != null && putResp.getResultCode() == Response.Status.CREATED.getStatusCode(); } - private String createVnfImagePayload(Map dataItem) { - dataItem.put(ATTR_UUID, UUID.randomUUID().toString()); - return new Gson().toJson(dataItem); - } - private List> unmarshallVnfcData(Artifact vnfcArtifact) { // Unmarshall Babel JSON payload into a List of Maps of JSON attribute name/values. return new Gson().fromJson(StringEscapeUtils.unescapeJson(vnfcArtifact.getPayload()),