aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/api
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/api')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolLimitsImpl.java62
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupLimitsImpl.java50
-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/mapping/MapValidationResponseToDto.java32
3 files changed, 76 insertions, 68 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolLimitsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolLimitsImpl.java
index 36e25e0f2e..4365ace85d 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolLimitsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolLimitsImpl.java
@@ -32,7 +32,9 @@ import javax.ws.rs.core.Response;
public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits {
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
private VendorLicenseManager vendorLicenseManager =
- VendorLicenseManagerFactory.getInstance().createInterface();
+ VendorLicenseManagerFactory.getInstance().createInterface();
+
+ public static final String parent = "EntitlementPool";
@Override
public Response createLimit(LimitRequestDto request,
@@ -44,18 +46,19 @@ public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits {
MdcUtil.initMdc(LoggerServiceName.Create_LIMIT.toString());
vendorLicenseManager.getEntitlementPool(new EntitlementPoolEntity(vlmId, Version.valueOf
- (versionId), entitlementPoolId), user);
+ (versionId), entitlementPoolId), user);
LimitEntity limitEntity =
- new MapLimitRequestDtoToLimitEntity()
- .applyMapping(request, LimitEntity.class);
+ new MapLimitRequestDtoToLimitEntity()
+ .applyMapping(request, LimitEntity.class);
limitEntity.setEpLkgId(entitlementPoolId);
limitEntity.setVendorLicenseModelId(vlmId);
+ limitEntity.setParent(parent);
LimitEntity createdLimit = vendorLicenseManager.createLimit(limitEntity, user);
MapLimitEntityToLimitCreationDto mapper = new MapLimitEntityToLimitCreationDto();
LimitCreationDto createdLimitDto = mapper.applyMapping(createdLimit, LimitCreationDto
- .class);
+ .class);
/*StringWrapperResponse result =
createdLimit != null ? new StringWrapperResponse(createdLimit.getId())
@@ -65,24 +68,24 @@ public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits {
//return Response.ok(result).build();
return Response.ok(createdLimitDto != null ? createdLimitDto : null)
- .build();
+ .build();
}
@Override
public Response listLimits(String vlmId, String versionId, String entitlementPoolId, String
- user) {
+ user) {
mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "EP id", entitlementPoolId);
MdcUtil.initMdc(LoggerServiceName.List_EP.toString());
vendorLicenseManager.getEntitlementPool(new EntitlementPoolEntity(vlmId, Version.valueOf
- (versionId), entitlementPoolId), user);
+ (versionId), entitlementPoolId), user);
Collection<LimitEntity> limits =
- vendorLicenseManager.listLimits(vlmId, Version.valueOf(versionId), entitlementPoolId, user);
+ vendorLicenseManager.listLimits(vlmId, Version.valueOf(versionId), entitlementPoolId, user);
GenericCollectionWrapper<LimitEntityDto> result = new GenericCollectionWrapper<>();
MapLimitEntityToLimitDto outputMapper =
- new MapLimitEntityToLimitDto();
+ new MapLimitEntityToLimitDto();
for (LimitEntity limit : limits) {
result.add(outputMapper.applyMapping(limit, LimitEntityDto.class));
}
@@ -96,12 +99,12 @@ public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits {
public Response getLimit( String vlmId, String versionId, String entitlementPoolId,
String limitId, String user) {
mdcDataDebugMessage.debugEntryMessage("VLM id, EP id, Limit Id", vlmId, entitlementPoolId,
- limitId);
+ limitId);
MdcUtil.initMdc(LoggerServiceName.Get_LIMIT.toString());
vendorLicenseManager.getEntitlementPool(new EntitlementPoolEntity(vlmId, Version.valueOf
- (versionId), entitlementPoolId), user);
+ (versionId), entitlementPoolId), user);
LimitEntity epInput = new LimitEntity();
epInput.setVendorLicenseModelId(vlmId);
epInput.setVersion(Version.valueOf(versionId));
@@ -110,11 +113,11 @@ public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits {
LimitEntity limit = vendorLicenseManager.getLimit(epInput, user);
LimitEntityDto entitlementPoolEntityDto = limit == null ? null :
- new MapLimitEntityToLimitDto()
- .applyMapping(limit, LimitEntityDto.class);
+ new MapLimitEntityToLimitDto()
+ .applyMapping(limit, LimitEntityDto.class);
mdcDataDebugMessage.debugExitMessage("VLM id, EP id, Limit Id", vlmId, entitlementPoolId,
- limitId);
+ limitId);
return Response.ok(entitlementPoolEntityDto).build();
}
@@ -127,39 +130,40 @@ public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits {
String limitId,
String user) {
mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "EP id", entitlementPoolId, "limit Id",
- limitId);
+ limitId);
MdcUtil.initMdc(LoggerServiceName.Update_LIMIT.toString());
vendorLicenseManager.getEntitlementPool(new EntitlementPoolEntity(vlmId, Version.valueOf
- (versionId), entitlementPoolId), user);
+ (versionId), entitlementPoolId), user);
LimitEntity limitEntity =
- new MapLimitRequestDtoToLimitEntity()
- .applyMapping(request, LimitEntity.class);
+ new MapLimitRequestDtoToLimitEntity()
+ .applyMapping(request, LimitEntity.class);
limitEntity.setEpLkgId(entitlementPoolId);
limitEntity.setVendorLicenseModelId(vlmId);
limitEntity.setId(limitId);
+ limitEntity.setParent(parent);
vendorLicenseManager.updateLimit(limitEntity, user);
mdcDataDebugMessage.debugExitMessage("VLM id", vlmId, "EP id", entitlementPoolId, "limit Id",
- limitId);
+ limitId);
return Response.ok().build();
}
/**
- * Delete entitlement pool.
- *
- * @param vlmId the vlm id
- * @param entitlementPoolId the entitlement pool id
- * @param limitId the limitId
- * @param user the user
- * @return the response
+ * Delete entitlement pool.
+ *
+ * @param vlmId the vlm id
+ * @param entitlementPoolId the entitlement pool id
+ * @param limitId the limitId
+ * @param user the user
+ * @return the response
*/
public Response deleteLimit(String vlmId, String versionId, String entitlementPoolId,
- String limitId, String user) {
+ String limitId, String user) {
mdcDataDebugMessage.debugEntryMessage("VLM id, Verison Id, EP id, Limit Id", vlmId, versionId, entitlementPoolId, limitId);
MdcUtil.initMdc(LoggerServiceName.Delete_LIMIT.toString());
@@ -170,6 +174,8 @@ public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits {
limitInput.setVendorLicenseModelId(vlmId);
limitInput.setEpLkgId(entitlementPoolId);
limitInput.setId(limitId);
+ limitInput.setParent(parent);
+
vendorLicenseManager.deleteLimit(limitInput, user);
mdcDataDebugMessage.debugExitMessage("VLM id, Verison Id, EP id, Limit Id", vlmId, versionId, entitlementPoolId, limitId);
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupLimitsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupLimitsImpl.java
index 4c85cfa45f..bedbc928ed 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupLimitsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupLimitsImpl.java
@@ -32,7 +32,9 @@ public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits {
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
private VendorLicenseManager vendorLicenseManager =
- VendorLicenseManagerFactory.getInstance().createInterface();
+ VendorLicenseManagerFactory.getInstance().createInterface();
+
+ public static final String parent = "LicenseKeyGroup";
@Override
public Response createLimit(LimitRequestDto request,
@@ -48,15 +50,16 @@ public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits {
(versionId), licenseKeyGroupId), user);
LimitEntity limitEntity =
- new MapLimitRequestDtoToLimitEntity()
- .applyMapping(request, LimitEntity.class);
+ new MapLimitRequestDtoToLimitEntity()
+ .applyMapping(request, LimitEntity.class);
limitEntity.setEpLkgId(licenseKeyGroupId);
limitEntity.setVendorLicenseModelId(vlmId);
+ limitEntity.setParent(parent);
LimitEntity createdLimit = vendorLicenseManager.createLimit(limitEntity, user);
MapLimitEntityToLimitCreationDto mapper = new MapLimitEntityToLimitCreationDto();
LimitCreationDto createdLimitDto = mapper.applyMapping(createdLimit, LimitCreationDto
- .class);
+ .class);
/*StringWrapperResponse result =
createdLimit != null ? new StringWrapperResponse(createdLimit.getId())
: null;*/
@@ -65,24 +68,24 @@ public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits {
//return Response.ok(result).build();
return Response.ok(createdLimitDto != null ? createdLimitDto : null)
- .build();
+ .build();
}
@Override
public Response listLimits(String vlmId, String versionId, String licenseKeyGroupId, String
- user) {
+ user) {
mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "LKG id", licenseKeyGroupId);
MdcUtil.initMdc(LoggerServiceName.List_EP.toString());
vendorLicenseManager.getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, Version.valueOf
- (versionId), licenseKeyGroupId), user);
+ (versionId), licenseKeyGroupId), user);
Collection<LimitEntity> limits =
- vendorLicenseManager.listLimits(vlmId, Version.valueOf(versionId), licenseKeyGroupId, user);
+ vendorLicenseManager.listLimits(vlmId, Version.valueOf(versionId), licenseKeyGroupId, user);
GenericCollectionWrapper<LimitEntityDto> result = new GenericCollectionWrapper<>();
MapLimitEntityToLimitDto outputMapper =
- new MapLimitEntityToLimitDto();
+ new MapLimitEntityToLimitDto();
for (LimitEntity limit : limits) {
result.add(outputMapper.applyMapping(limit, LimitEntityDto.class));
}
@@ -100,24 +103,25 @@ public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits {
String limitId,
String user) {
mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "LKG id", licenseKeyGroupId, "limit Id",
- limitId);
+ limitId);
MdcUtil.initMdc(LoggerServiceName.Update_LIMIT.toString());
vendorLicenseManager.getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, Version.valueOf
- (versionId), licenseKeyGroupId), user);
+ (versionId), licenseKeyGroupId), user);
LimitEntity limitEntity =
- new MapLimitRequestDtoToLimitEntity()
- .applyMapping(request, LimitEntity.class);
+ new MapLimitRequestDtoToLimitEntity()
+ .applyMapping(request, LimitEntity.class);
limitEntity.setEpLkgId(licenseKeyGroupId);
limitEntity.setVendorLicenseModelId(vlmId);
limitEntity.setId(limitId);
+ limitEntity.setParent(parent);
vendorLicenseManager.updateLimit(limitEntity, user);
mdcDataDebugMessage.debugExitMessage("VLM id", vlmId, "LKG id", licenseKeyGroupId, "limit Id",
- limitId);
+ limitId);
return Response.ok().build();
}
@@ -134,20 +138,22 @@ public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits {
public Response deleteLimit(String vlmId, String versionId, String licenseKeyGroupId,
String limitId, String user) {
mdcDataDebugMessage.debugEntryMessage("VLM id, Verison Id, LKG id, Limit Id", vlmId, versionId,
- licenseKeyGroupId, limitId);
+ licenseKeyGroupId, limitId);
MdcUtil.initMdc(LoggerServiceName.Delete_LIMIT.toString());
vendorLicenseManager.getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, Version.valueOf
- (versionId), licenseKeyGroupId), user);
+ (versionId), licenseKeyGroupId), user);
LimitEntity limitInput = new LimitEntity();
limitInput.setVendorLicenseModelId(vlmId);
limitInput.setEpLkgId(licenseKeyGroupId);
limitInput.setId(limitId);
+ limitInput.setParent(parent);
+
vendorLicenseManager.deleteLimit(limitInput, user);
mdcDataDebugMessage.debugExitMessage("VLM id, Verison Id, LKG id, Limit Id", vlmId, versionId,
- licenseKeyGroupId, limitId);
+ licenseKeyGroupId, limitId);
return Response.ok().build();
}
@@ -156,11 +162,11 @@ public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits {
public Response getLimit( String vlmId, String versionId, String licenseKeyGroupId,
String limitId, String user) {
mdcDataDebugMessage.debugEntryMessage("VLM id, LKG id, Limit Id", vlmId, licenseKeyGroupId,
- limitId);
+ limitId);
MdcUtil.initMdc(LoggerServiceName.Get_LIMIT.toString());
vendorLicenseManager.getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, Version.valueOf
- (versionId), licenseKeyGroupId), user);
+ (versionId), licenseKeyGroupId), user);
LimitEntity epInput = new LimitEntity();
epInput.setVendorLicenseModelId(vlmId);
epInput.setVersion(Version.valueOf(versionId));
@@ -169,11 +175,11 @@ public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits {
LimitEntity limit = vendorLicenseManager.getLimit(epInput, user);
LimitEntityDto entitlementPoolEntityDto = limit == null ? null :
- new MapLimitEntityToLimitDto()
- .applyMapping(limit, LimitEntityDto.class);
+ new MapLimitEntityToLimitDto()
+ .applyMapping(limit, LimitEntityDto.class);
mdcDataDebugMessage.debugExitMessage("VLM id, LKG id, Limit Id", vlmId, licenseKeyGroupId,
- limitId);
+ limitId);
return Response.ok(entitlementPoolEntityDto).build();
}
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/mapping/MapValidationResponseToDto.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/mapping/MapValidationResponseToDto.java
index 89d210f372..3cabebbb69 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/mapping/MapValidationResponseToDto.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/mapping/MapValidationResponseToDto.java
@@ -24,8 +24,6 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.openecomp.sdc.common.errors.ErrorCode;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
-import org.openecomp.sdc.vendorsoftwareproduct.types.ComponentValidationResult;
-import org.openecomp.sdc.vendorsoftwareproduct.types.DeploymentFlavorValidationResult;
import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireValidationResult;
import org.openecomp.sdc.vendorsoftwareproduct.types.ValidationResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
@@ -49,37 +47,37 @@ import java.util.Set;
import java.util.stream.Collectors;
public class MapValidationResponseToDto
- extends MappingBase<ValidationResponse, ValidationResponseDto> {
+ extends MappingBase<ValidationResponse, ValidationResponseDto> {
private static Map<String, List<ErrorMessageDto>> mapUploadDataErrors(
- Map<String, List<ErrorMessage>> uploadDataErrors) {
+ Map<String, List<ErrorMessage>> uploadDataErrors) {
if (MapUtils.isEmpty(uploadDataErrors)) {
return null;
}
return uploadDataErrors.entrySet().stream().collect(
- Collectors.toMap(entry -> entry.getKey(), entry -> mapErrorMessages(entry.getValue())));
+ Collectors.toMap(entry -> entry.getKey(), entry -> mapErrorMessages(entry.getValue())));
}
private static QuestionnaireValidationResultDto mapQuestionnaireValidationResult(
- QuestionnaireValidationResult questionnaireValidationResult) {
+ QuestionnaireValidationResult questionnaireValidationResult) {
if (Objects.isNull(questionnaireValidationResult)
- || Objects.isNull(questionnaireValidationResult.getValidationData())) {
+ || Objects.isNull(questionnaireValidationResult.getValidationData())) {
return null;
}
QuestionnaireValidationResultDto questionnaireValidationResultDto =
- new QuestionnaireValidationResultDto();
+ new QuestionnaireValidationResultDto();
questionnaireValidationResultDto.setValid(questionnaireValidationResult.isValid());
Set<CompositionEntityValidationDataDto> validationDataDto = new HashSet<>();
for(CompositionEntityValidationData validationData : questionnaireValidationResult.getValidationData()){
validationDataDto.add(new MapCompositionEntityValidationDataToDto().applyMapping
- (validationData, CompositionEntityValidationDataDto.class));
+ (validationData, CompositionEntityValidationDataDto.class));
}
questionnaireValidationResultDto.setValidationData(validationDataDto);
return questionnaireValidationResultDto;
}
- private static ComponentValidationResultDto mapcomponentValidationResult(
+ /*private static ComponentValidationResultDto mapcomponentValidationResult(
ComponentValidationResult componentValidationResult) {
if (componentValidationResult == null) {
return null;
@@ -115,18 +113,18 @@ public class MapValidationResponseToDto
deploymentFlavorValidationResultDto.setValidationData(validationDataDto);
return deploymentFlavorValidationResultDto;
- }
+ }*/
private static List<ErrorMessageDto> mapErrorMessages(List<ErrorMessage> errorMessages) {
return errorMessages == null ? null : errorMessages.stream().map(
- errorMessage -> new MapErrorMessageToDto()
- .applyMapping(errorMessage, ErrorMessageDto.class)).collect(Collectors.toList());
+ errorMessage -> new MapErrorMessageToDto()
+ .applyMapping(errorMessage, ErrorMessageDto.class)).collect(Collectors.toList());
}
private static Collection<ErrorCodeDto> mapErrorCodes(Collection<ErrorCode> errorCodes) {
return CollectionUtils.isEmpty(errorCodes) ? null : errorCodes.stream()
- .map(errorCode -> new MapErrorCodeToDto().applyMapping(errorCode, ErrorCodeDto.class))
- .collect(Collectors.toList());
+ .map(errorCode -> new MapErrorCodeToDto().applyMapping(errorCode, ErrorCodeDto.class))
+ .collect(Collectors.toList());
}
@Override
@@ -136,8 +134,6 @@ public class MapValidationResponseToDto
target.setLicensingDataErrors(mapErrorCodes(source.getLicensingDataErrors()));
target.setUploadDataErrors(mapUploadDataErrors(source.getUploadDataErrors()));
target.setQuestionnaireValidationResult(
- mapQuestionnaireValidationResult(source.getQuestionnaireValidationResult()));
- target.setComponentValidationResult(mapcomponentValidationResult(source.getComponentValidationResult()));
- target.setDeploymentFlavorValidationResult(mapdeploymentFlavorValidationResult(source.getDeploymentFlavorValidationResult()));
+ mapQuestionnaireValidationResult(source.getQuestionnaireValidationResult()));
}
}