Improve handling 'empty'/null string in Service fields
[sdc.git] / catalog-be / src / main / java / org / openecomp / sdc / be / components / validation / component / ComponentContactIdValidator.java
index 0c1face..5f27ba1 100644 (file)
@@ -17,9 +17,9 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.openecomp.sdc.be.components.validation.component;
 
+import org.apache.commons.lang3.StringUtils;
 import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
@@ -46,8 +46,7 @@ public class ComponentContactIdValidator implements ComponentFieldValidator {
         log.debug("validate component contactId");
         ComponentTypeEnum type = component.getComponentType();
         String contactId = component.getContactId();
-
-        if (!ValidationUtils.validateStringNotEmpty(contactId)) {
+        if (StringUtils.isEmpty(contactId)) {
             log.info("contact is missing.");
             ResponseFormat errorResponse = componentsUtils.getResponseFormat(ActionStatus.COMPONENT_MISSING_CONTACT, type.getValue());
             componentsUtils.auditComponentAdmin(errorResponse, user, component, actionEnum, type);
@@ -56,7 +55,8 @@ public class ComponentContactIdValidator implements ComponentFieldValidator {
         validateContactId(contactId, user, component, actionEnum, type);
     }
 
-    private void validateContactId(String contactId, User user, org.openecomp.sdc.be.model.Component component, AuditingActionEnum actionEnum, ComponentTypeEnum type) {
+    private void validateContactId(String contactId, User user, org.openecomp.sdc.be.model.Component component, AuditingActionEnum actionEnum,
+                                   ComponentTypeEnum type) {
         if (contactId != null && !ValidationUtils.validateContactId(contactId)) {
             log.info("contact is invalid.");
             ResponseFormat errorResponse = componentsUtils.getResponseFormat(ActionStatus.COMPONENT_INVALID_CONTACT, type.getValue());