summaryrefslogtreecommitdiffstats
path: root/openecomp-be/api
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-06-11 14:22:02 +0300
committerMichael Lando <ml636r@att.com>2017-06-11 17:48:32 +0300
commitb3d4898d9e8452ea0b8d848c048e712d43b8d9a3 (patch)
tree0609319203be13f6c29ccbe24cb39c9d64f90095 /openecomp-be/api
parentaf9929df75604ce407d0ca542b200630164e0ae6 (diff)
[SDC-29] rebase continue work to align source
Change-Id: I218f1c5ee23fb2c8314f1c70921d3ad8682c10f4 Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'openecomp-be/api')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VendorSoftwareProducts.java2
-rw-r--r--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/VendorSoftwareProductsImpl.java280
2 files changed, 146 insertions, 136 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/VendorSoftwareProducts.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/VendorSoftwareProducts.java
index 3ead86dc14..53fe2af31d 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/VendorSoftwareProducts.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/VendorSoftwareProducts.java
@@ -141,7 +141,7 @@ public interface VendorSoftwareProducts extends VspEntities {
notes = "Exports translated file to a zip file",
response = File.class)
Response getTranslatedFile(@PathParam("vspId") String vspId,
- @QueryParam("version") String version,
+ @QueryParam("versionId") String versionId,
@HeaderParam(USER_ID_HEADER_PARAM) String user);
@GET
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/VendorSoftwareProductsImpl.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/VendorSoftwareProductsImpl.java
index 9f8f3d366f..c730066770 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/VendorSoftwareProductsImpl.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/VendorSoftwareProductsImpl.java
@@ -38,9 +38,20 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.VersionedVendorSoftwareProd
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.types.VersionInfo;
import org.openecomp.sdc.versioning.types.VersionableEntityAction;
-import org.openecomp.sdcrests.vendorsoftwareproducts.types.*;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.PackageInfoDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ValidationResponseDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VersionSoftwareProductActionRequestDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspCreationDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDescriptionDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDetailsDto;
import org.openecomp.sdcrests.vsp.rest.VendorSoftwareProducts;
-import org.openecomp.sdcrests.vsp.rest.mapping.*;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapPackageInfoToPackageInfoDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapQuestionnaireResponseToQuestionnaireResponseDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapValidationResponseToDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapVersionedVendorSoftwareProductInfoToVspDetailsDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapVspDescriptionDtoToVspDetails;
+import org.openecomp.sdcrests.vsp.rest.mapping.MspVspDetailsToVspCreationDto;
import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
import org.openecomp.sdcrests.wrappers.StringWrapperResponse;
import org.slf4j.MDC;
@@ -59,49 +70,49 @@ import java.util.List;
@Scope(value = "prototype")
public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
- private VendorSoftwareProductManager vendorSoftwareProductManager =
- VspManagerFactory.getInstance().createInterface();
+ private VendorSoftwareProductManager vendorSoftwareProductManager =
+ VspManagerFactory.getInstance().createInterface();
- private static final Logger logger =
- LoggerFactory.getLogger(VendorSoftwareProductsImpl.class);
+ private static final Logger logger =
+ LoggerFactory.getLogger(VendorSoftwareProductsImpl.class);
- private ActivityLogManager activityLogManager =
- ActivityLogManagerFactory.getInstance().createInterface();
+ private ActivityLogManager activityLogManager =
+ ActivityLogManagerFactory.getInstance().createInterface();
- @Override
- public Response createVsp(VspDescriptionDto vspDescriptionDto, String user) {
- MdcUtil.initMdc(LoggerServiceName.Create_VSP.toString());
- logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CREATE_VSP + vspDescriptionDto.getName());
-
- VspDetails vspDetails =
- new MapVspDescriptionDtoToVspDetails().applyMapping(vspDescriptionDto, VspDetails.class);
+ @Override
+ public Response createVsp(VspDescriptionDto vspDescriptionDto, String user) {
+ MdcUtil.initMdc(LoggerServiceName.Create_VSP.toString());
+ logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CREATE_VSP + vspDescriptionDto.getName());
- vspDetails = vendorSoftwareProductManager.createVsp(vspDetails, user);
+ VspDetails vspDetails =
+ new MapVspDescriptionDtoToVspDetails().applyMapping(vspDescriptionDto, VspDetails.class);
- MspVspDetailsToVspCreationDto mapping = new MspVspDetailsToVspCreationDto();
- VspCreationDto vspCreationDto = mapping.applyMapping(vspDetails, VspCreationDto.class);
+ vspDetails = vendorSoftwareProductManager.createVsp(vspDetails, user);
- return Response.ok(vspCreationDto).build();
- }
+ MspVspDetailsToVspCreationDto mapping = new MspVspDetailsToVspCreationDto();
+ VspCreationDto vspCreationDto = mapping.applyMapping(vspDetails, VspCreationDto.class);
- @Override
- public Response listVsps(String versionFilter, String user) {
- MdcUtil.initMdc(LoggerServiceName.List_VSP.toString());
- List<VersionedVendorSoftwareProductInfo> vspList =
- vendorSoftwareProductManager.listVsps(versionFilter, user);
-
- GenericCollectionWrapper<VspDetailsDto> results = new GenericCollectionWrapper<>();
- if (!vspList.isEmpty()) {
- MapVersionedVendorSoftwareProductInfoToVspDetailsDto mapper =
- new MapVersionedVendorSoftwareProductInfoToVspDetailsDto();
- for (VersionedVendorSoftwareProductInfo versionedVsp : vspList) {
- results.add(mapper.applyMapping(versionedVsp, VspDetailsDto.class));
- }
- }
+ return Response.ok(vspCreationDto).build();
+ }
- return Response.ok(results).build();
+ @Override
+ public Response listVsps(String versionFilter, String user) {
+ MdcUtil.initMdc(LoggerServiceName.List_VSP.toString());
+ List<VersionedVendorSoftwareProductInfo> vspList =
+ vendorSoftwareProductManager.listVsps(versionFilter, user);
+
+ GenericCollectionWrapper<VspDetailsDto> results = new GenericCollectionWrapper<>();
+ if (!vspList.isEmpty()) {
+ MapVersionedVendorSoftwareProductInfoToVspDetailsDto mapper =
+ new MapVersionedVendorSoftwareProductInfoToVspDetailsDto();
+ for (VersionedVendorSoftwareProductInfo versionedVsp : vspList) {
+ results.add(mapper.applyMapping(versionedVsp, VspDetailsDto.class));
+ }
}
+ return Response.ok(results).build();
+ }
+
@Override
public Response getVsp(String vspId, String versionId, String user) {
MdcUtil.initMdc(LoggerServiceName.Get_VSP.toString());
@@ -115,15 +126,15 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
VersionInfo versionInfo = getVersionInfo(vspId, VersionableEntityAction.Read, user);
//
- if(vspDetails.getOldVersion()!=null && !"".equals(vspDetails.getOldVersion())) {
+ if (vspDetails.getOldVersion() != null && !"".equals(vspDetails.getOldVersion())) {
if (Version.valueOf(versionId).equals(versionInfo.getActiveVersion())) {
try {
Version healedVersion = vendorSoftwareProductManager.callAutoHeal(vspId, versionInfo,
- vspDetails , user);
+ vspDetails, user);
vspDetails =
vendorSoftwareProductManager
.getVsp(vspId, resolveVspVersion(vspId, healedVersion.toString(), user,
- VersionableEntityAction.Read),user);
+ VersionableEntityAction.Read), user);
versionInfo = getVersionInfo(vspId, VersionableEntityAction.Read, user);
} catch (Exception e) {
//to do
@@ -137,8 +148,8 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
.applyMapping(new VersionedVendorSoftwareProductInfo(vspDetails, versionInfo),
VspDetailsDto.class);
- return Response.ok(vspDetailsDto).build();
- }
+ return Response.ok(vspDetailsDto).build();
+ }
@Override
public Response updateVsp(String vspId, String versionId, VspDescriptionDto vspDescriptionDto,
@@ -149,23 +160,23 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
vspDetails.setId(vspId);
vspDetails.setVersion(resolveVspVersion(vspId, null, user, VersionableEntityAction.Write));
- vendorSoftwareProductManager.updateVsp(vspDetails, user);
+ vendorSoftwareProductManager.updateVsp(vspDetails, user);
- return Response.ok().build();
- }
+ return Response.ok().build();
+ }
- @Override
- public Response deleteVsp(String vspId, String user) {
- MdcUtil.initMdc(LoggerServiceName.Delete_VSP.toString());
- vendorSoftwareProductManager.deleteVsp(vspId, user);
+ @Override
+ public Response deleteVsp(String vspId, String user) {
+ MdcUtil.initMdc(LoggerServiceName.Delete_VSP.toString());
+ vendorSoftwareProductManager.deleteVsp(vspId, user);
- return Response.ok().build();
- }
+ return Response.ok().build();
+ }
- @Override
- public Response actOnVendorSoftwareProduct(String vspId, String versionId,
- VersionSoftwareProductActionRequestDto request,
- String user) throws IOException {
+ @Override
+ public Response actOnVendorSoftwareProduct(String vspId, String versionId,
+ VersionSoftwareProductActionRequestDto request,
+ String user) throws IOException {
switch (request.getAction()) {
case Checkout:
@@ -207,89 +218,88 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
return Response.ok().build();
}
- @Override
- public Response getValidationVsp(String user)
- throws Exception {
- String validationVspId = vendorSoftwareProductManager.fetchValidationVsp(user);
- StringWrapperResponse response = new StringWrapperResponse(validationVspId);
- return Response.ok(response).build();
- }
+ @Override
+ public Response getValidationVsp(String user)
+ throws Exception {
+ String validationVspId = vendorSoftwareProductManager.fetchValidationVsp(user);
+ StringWrapperResponse response = new StringWrapperResponse(validationVspId);
+ return Response.ok(response).build();
+ }
- @Override
- public Response getOrchestrationTemplate(String vspId, String versionId, String user) {
- MdcUtil.initMdc(LoggerServiceName.Get_Uploaded_File.toString());
- byte[] orchestrationTemplateFile =
- vendorSoftwareProductManager
- .getOrchestrationTemplateFile(vspId,
- resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read), user);
+ @Override
+ public Response getOrchestrationTemplate(String vspId, String versionId, String user) {
+ MdcUtil.initMdc(LoggerServiceName.Get_Uploaded_File.toString());
+ byte[] orchestrationTemplateFile =
+ vendorSoftwareProductManager
+ .getOrchestrationTemplateFile(vspId,
+ resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read), user);
- if (orchestrationTemplateFile == null) {
- return Response.status(Response.Status.NOT_FOUND).build();
- }
- Response.ResponseBuilder response = Response.ok(orchestrationTemplateFile);
- response.header("Content-Disposition", "attachment; filename=LatestHeatPackage.zip");
- return response.build();
+ if (orchestrationTemplateFile == null) {
+ return Response.status(Response.Status.NOT_FOUND).build();
}
+ Response.ResponseBuilder response = Response.ok(orchestrationTemplateFile);
+ response.header("Content-Disposition", "attachment; filename=LatestHeatPackage.zip");
+ return response.build();
+ }
- @Override
- public Response listPackages(String category, String subCategory, String user) {
- MdcUtil.initMdc(LoggerServiceName.List_Packages.toString());
- List<PackageInfo> packageInfoList =
- vendorSoftwareProductManager.listPackages(category, subCategory);
+ @Override
+ public Response listPackages(String category, String subCategory, String user) {
+ MdcUtil.initMdc(LoggerServiceName.List_Packages.toString());
+ List<PackageInfo> packageInfoList =
+ vendorSoftwareProductManager.listPackages(category, subCategory);
- GenericCollectionWrapper<PackageInfoDto> results = new GenericCollectionWrapper<>();
- MapPackageInfoToPackageInfoDto mapper = new MapPackageInfoToPackageInfoDto();
+ GenericCollectionWrapper<PackageInfoDto> results = new GenericCollectionWrapper<>();
+ MapPackageInfoToPackageInfoDto mapper = new MapPackageInfoToPackageInfoDto();
- if (packageInfoList != null) {
- for (PackageInfo packageInfo : packageInfoList) {
- results.add(mapper.applyMapping(packageInfo, PackageInfoDto.class));
- }
- }
- return Response.ok(results).build();
+ if (packageInfoList != null) {
+ for (PackageInfo packageInfo : packageInfoList) {
+ results.add(mapper.applyMapping(packageInfo, PackageInfoDto.class));
+ }
}
+ return Response.ok(results).build();
+ }
@Override
- public Response getTranslatedFile(String vspId, String version, String user) {
+ public Response getTranslatedFile(String vspId, String versionId, String user) {
MdcUtil.initMdc(LoggerServiceName.Get_Translated_File.toString());
- File zipFile =
- vendorSoftwareProductManager.getTranslatedFile(vspId,Version.valueOf(version), user);
- Version versionObj = Version.valueOf(version);
- Version resolvedVersion = versionObj == null
+ Version version = Version.valueOf(versionId);
+ Version resolvedVersion = version == null
? getVersionInfo(vspId, VersionableEntityAction.Read, user).getLatestFinalVersion()
- : versionObj;
-
+ : version;
- Response.ResponseBuilder response = Response.ok(zipFile);
- if (zipFile == null) {
- logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.IMPORT_FAIL + vspId);
- return Response.status(Response.Status.NOT_FOUND).build();
- }
- response.header("Content-Disposition", "attachment; filename=" + zipFile.getName());
+ File zipFile = vendorSoftwareProductManager.getTranslatedFile(vspId, resolvedVersion, user);
- logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.IMPORT_SUCCESS + vspId);
- return response.build();
+ Response.ResponseBuilder response = Response.ok(zipFile);
+ if (zipFile == null) {
+ logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.IMPORT_FAIL + vspId);
+ return Response.status(Response.Status.NOT_FOUND).build();
}
+ response.header("Content-Disposition", "attachment; filename=" + zipFile.getName());
- @Override
- public Response getQuestionnaire(String vspId, String versionId, String user) {
- MdcUtil.initMdc(LoggerServiceName.Get_Questionnaire_VSP.toString());
- QuestionnaireResponse questionnaireResponse =
- vendorSoftwareProductManager.getVspQuestionnaire(vspId,
- resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read), user);
-
- if (questionnaireResponse.getErrorMessage() != null) {
- return Response.status(Response.Status.EXPECTATION_FAILED).entity(
- new MapQuestionnaireResponseToQuestionnaireResponseDto()
- .applyMapping(questionnaireResponse, QuestionnaireResponseDto.class)).build();
- }
+ logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.IMPORT_SUCCESS + vspId);
+ return response.build();
+ }
- QuestionnaireResponseDto result = new MapQuestionnaireResponseToQuestionnaireResponseDto()
- .applyMapping(questionnaireResponse, QuestionnaireResponseDto.class);
- return Response.ok(result).build();
+ @Override
+ public Response getQuestionnaire(String vspId, String versionId, String user) {
+ MdcUtil.initMdc(LoggerServiceName.Get_Questionnaire_VSP.toString());
+ QuestionnaireResponse questionnaireResponse =
+ vendorSoftwareProductManager.getVspQuestionnaire(vspId,
+ resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read), user);
+
+ if (questionnaireResponse.getErrorMessage() != null) {
+ return Response.status(Response.Status.EXPECTATION_FAILED).entity(
+ new MapQuestionnaireResponseToQuestionnaireResponseDto()
+ .applyMapping(questionnaireResponse, QuestionnaireResponseDto.class)).build();
}
+ QuestionnaireResponseDto result = new MapQuestionnaireResponseToQuestionnaireResponseDto()
+ .applyMapping(questionnaireResponse, QuestionnaireResponseDto.class);
+ return Response.ok(result).build();
+ }
+
@Override
public Response updateQuestionnaire(String questionnaireData, String vspId, String
versionId, String user) {
@@ -300,26 +310,26 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
return Response.ok().build();
}
- @Override
- public Response heal(String vspId, String versionId, String user) {
- vendorSoftwareProductManager.heal(vspId, Version.valueOf(versionId), user);
-
- return Response.ok().build();
- }
+ @Override
+ public Response heal(String vspId, String versionId, String user) {
+ vendorSoftwareProductManager.heal(vspId, Version.valueOf(versionId), user);
- @Override
- public Response getVspInformationArtifact(String vspId, String versionId, String user) {
- MdcUtil.initMdc(LoggerServiceName.Get_Information_Artifact.toString());
- File textInformationArtifact =
- vendorSoftwareProductManager.getInformationArtifact(vspId,
- resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read), user);
+ return Response.ok().build();
+ }
- Response.ResponseBuilder response = Response.ok(textInformationArtifact);
- if (textInformationArtifact == null) {
- return Response.status(Response.Status.NOT_FOUND).build();
- }
- response
- .header("Content-Disposition", "attachment; filename=" + textInformationArtifact.getName());
- return response.build();
+ @Override
+ public Response getVspInformationArtifact(String vspId, String versionId, String user) {
+ MdcUtil.initMdc(LoggerServiceName.Get_Information_Artifact.toString());
+ File textInformationArtifact =
+ vendorSoftwareProductManager.getInformationArtifact(vspId,
+ resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read), user);
+
+ Response.ResponseBuilder response = Response.ok(textInformationArtifact);
+ if (textInformationArtifact == null) {
+ return Response.status(Response.Status.NOT_FOUND).build();
}
+ response
+ .header("Content-Disposition", "attachment; filename=" + textInformationArtifact.getName());
+ return response.build();
+ }
}