Improve handling 'empty'/null string in Service fields
[sdc.git] / catalog-be / src / main / java / org / openecomp / sdc / be / components / impl / ServiceImportParseLogic.java
index 5bde56d..9365fac 100644 (file)
@@ -35,6 +35,7 @@ import lombok.Getter;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.MapUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.tuple.ImmutablePair;
 import org.openecomp.sdc.be.components.csar.CsarInfo;
 import org.openecomp.sdc.be.components.impl.artifact.ArtifactOperationInfo;
@@ -763,7 +764,7 @@ public class ServiceImportParseLogic {
     public void validateVendorReleaseName(User user, Resource resource, AuditingActionEnum actionEnum) {
         String vendorRelease = resource.getVendorRelease();
         log.debug("validate vendor relese name");
-        if (!ValidationUtils.validateStringNotEmpty(vendorRelease)) {
+        if (StringUtils.isEmpty(vendorRelease)) {
             log.info("vendor relese name is missing.");
             ResponseFormat errorResponse = componentsUtils.getResponseFormat(ActionStatus.MISSING_VENDOR_RELEASE);
             componentsUtils.auditResource(errorResponse, user, resource, actionEnum);
@@ -814,14 +815,14 @@ public class ServiceImportParseLogic {
             throw new ComponentException(ActionStatus.RESOURCE_TOO_MUCH_SUBCATEGORIES);
         }
         SubCategoryDefinition subcategory = subcategories.get(0);
-        if (!ValidationUtils.validateStringNotEmpty(category.getName())) {
+        if (StringUtils.isEmpty(category.getName())) {
             log.debug(CATEGORY_IS_EMPTY);
             ResponseFormat responseFormat = componentsUtils
                 .getResponseFormat(ActionStatus.COMPONENT_MISSING_CATEGORY, ComponentTypeEnum.RESOURCE.getValue());
             componentsUtils.auditResource(responseFormat, user, resource, actionEnum);
             throw new ComponentException(ActionStatus.COMPONENT_MISSING_CATEGORY, ComponentTypeEnum.RESOURCE.getValue());
         }
-        if (!ValidationUtils.validateStringNotEmpty(subcategory.getName())) {
+        if (StringUtils.isEmpty(subcategory.getName())) {
             log.debug(CATEGORY_IS_EMPTY);
             ResponseFormat responseFormat = componentsUtils
                 .getResponseFormat(ActionStatus.COMPONENT_MISSING_SUBCATEGORY, ComponentTypeEnum.RESOURCE.getValue());
@@ -875,7 +876,7 @@ public class ServiceImportParseLogic {
 
     protected void validateVendorName(User user, Resource resource, AuditingActionEnum actionEnum) {
         String vendorName = resource.getVendorName();
-        if (!ValidationUtils.validateStringNotEmpty(vendorName)) {
+        if (StringUtils.isEmpty(vendorName)) {
             log.info("vendor name is missing.");
             ResponseFormat errorResponse = componentsUtils.getResponseFormat(ActionStatus.MISSING_VENDOR_NAME);
             componentsUtils.auditResource(errorResponse, user, resource, actionEnum);