diff options
author | shrikantawachar <shrikant.awachar@amdocs.com> | 2018-02-12 16:57:59 +0530 |
---|---|---|
committer | Avi Gaffa <avi.gaffa@amdocs.com> | 2018-02-14 11:23:44 +0000 |
commit | 9f33060362b6bf8b3a7cdcdab6ce3d1c81946300 (patch) | |
tree | 4900df52242ab5804408ccda3e51159e344f01e4 /openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java | |
parent | 71904f241cd3047054dc0a36c04120a3f53205ae (diff) |
Enforcing HEAT validation after HEAT upload
Back end implementation , Junits for Enforcing HEAT validation after heat upload.
Change-Id: I0572b1d5e455023d45dc3b50b0bae7f3b6bbcc2e
Issue-ID: SDC-1027
Signed-off-by: shrikantawachar <shrikant.awachar@amdocs.com>
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java')
1 files changed, 31 insertions, 0 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java index e6be1dcbe9..d856cfc6e5 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java @@ -1,3 +1,19 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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 + * + * 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. + */ + package org.openecomp.sdcrests.vsp.rest.services; import org.apache.commons.beanutils.BeanUtils; @@ -11,6 +27,8 @@ import org.openecomp.sdc.activitylog.dao.type.ActivityType; import org.openecomp.sdc.common.errors.Messages; import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManager; import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManagerFactory; +import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager; +import org.openecomp.sdc.vendorsoftwareproduct.VspManagerFactory; import org.openecomp.sdc.vendorsoftwareproduct.types.OrchestrationTemplateActionResponse; import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse; import org.openecomp.sdc.vendorsoftwareproduct.types.ValidationResponse; @@ -44,6 +62,8 @@ public class OrchestrationTemplateCandidateImpl implements OrchestrationTemplate private OrchestrationTemplateCandidateManager candidateManager = OrchestrationTemplateCandidateManagerFactory.getInstance().createInterface(); + private VendorSoftwareProductManager vendorSoftwareProductManager = VspManagerFactory + .getInstance().createInterface(); private ActivityLogManager activityLogManager = ActivityLogManagerFactory.getInstance().createInterface(); @@ -75,6 +95,12 @@ public class OrchestrationTemplateCandidateImpl implements OrchestrationTemplate } @Override + public Response abort(String vspId, String versionId) throws Exception { + candidateManager.abort(vspId, new Version(versionId)); + return Response.ok().build(); + } + + @Override public Response process(String vspId, String versionId, String user) throws InvocationTargetException, IllegalAccessException { @@ -121,6 +147,10 @@ public class OrchestrationTemplateCandidateImpl implements OrchestrationTemplate throws Exception { Optional<FilesDataStructure> filesDataStructure = candidateManager.getFilesDataStructure(vspId, new Version(versionId)); + if (!filesDataStructure.isPresent()) { + filesDataStructure = vendorSoftwareProductManager.getOrchestrationTemplateStructure(vspId, + new Version(versionId)); + } FileDataStructureDto fileDataStructureDto = filesDataStructure.map(dataStructure -> new MapFilesDataStructureToDto() @@ -128,4 +158,5 @@ public class OrchestrationTemplateCandidateImpl implements OrchestrationTemplate .orElse(new FileDataStructureDto()); return Response.ok(fileDataStructureDto).build(); } + } |