diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api')
-rw-r--r-- | openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/main/java/org/openecomp/core/util/UniqueValueUtil.java | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/main/java/org/openecomp/core/util/UniqueValueUtil.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/main/java/org/openecomp/core/util/UniqueValueUtil.java index 15e9ceeee7..4341899d8a 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/main/java/org/openecomp/core/util/UniqueValueUtil.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/main/java/org/openecomp/core/util/UniqueValueUtil.java @@ -27,7 +27,6 @@ import org.openecomp.core.utilities.CommonMethods; import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.common.errors.ErrorCategory; import org.openecomp.sdc.common.errors.ErrorCode; -import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; import java.util.Optional; @@ -37,8 +36,6 @@ public class UniqueValueUtil { private static final UniqueValueDao uniqueValueDao = UniqueValueDaoFactory.getInstance().createInterface(); - private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); - /** * Create unique value. * @@ -46,16 +43,12 @@ public class UniqueValueUtil { * @param uniqueCombination the unique combination */ public static void createUniqueValue(String type, String... uniqueCombination) { - mdcDataDebugMessage.debugEntryMessage(null); - Optional<String> value = formatValue(uniqueCombination); if (!value.isPresent()) { return; } validateUniqueValue(type, value.get(), uniqueCombination); uniqueValueDao.create(new UniqueValueEntity(type, value.get())); - - mdcDataDebugMessage.debugExitMessage(null); } /** @@ -65,17 +58,11 @@ public class UniqueValueUtil { * @param uniqueCombination the unique combination */ public static void deleteUniqueValue(String type, String... uniqueCombination) { - - - mdcDataDebugMessage.debugEntryMessage(null); - Optional<String> value = formatValue(uniqueCombination); if (!value.isPresent()) { return; } uniqueValueDao.delete(new UniqueValueEntity(type, value.get())); - - mdcDataDebugMessage.debugExitMessage(null); } /** @@ -88,16 +75,10 @@ public class UniqueValueUtil { */ public static void updateUniqueValue(String type, String oldValue, String newValue, String... uniqueContext) { - - - mdcDataDebugMessage.debugEntryMessage(null); - if (newValue == null || oldValue == null || !newValue.equalsIgnoreCase(oldValue)) { createUniqueValue(type, CommonMethods.concat(uniqueContext, new String[]{newValue})); deleteUniqueValue(type, CommonMethods.concat(uniqueContext, new String[]{oldValue})); } - - mdcDataDebugMessage.debugExitMessage(null); } /** @@ -107,20 +88,14 @@ public class UniqueValueUtil { * @param uniqueCombination the unique combination */ public static void validateUniqueValue(String type, String... uniqueCombination) { - mdcDataDebugMessage.debugEntryMessage(null); - Optional<String> value = formatValue(uniqueCombination); if (!value.isPresent()) { return; } validateUniqueValue(type, value.get(), uniqueCombination); - - mdcDataDebugMessage.debugExitMessage(null); } private static void validateUniqueValue(String type, String value, String... uniqueCombination) { - mdcDataDebugMessage.debugEntryMessage(null); - if (uniqueValueDao.get(new UniqueValueEntity(type, value)) != null) { throw new CoreException(new ErrorCode.ErrorCodeBuilder() .withCategory(ErrorCategory.APPLICATION) @@ -128,15 +103,9 @@ public class UniqueValueUtil { .withMessage(String.format(UNIQUE_VALUE_VIOLATION_MSG, type, uniqueCombination[uniqueCombination.length - 1])).build()); } - - mdcDataDebugMessage.debugExitMessage(null); } private static Optional<String> formatValue(String[] uniqueCombination) { - - - mdcDataDebugMessage.debugEntryMessage(null); - if (uniqueCombination == null || uniqueCombination.length == 0 || uniqueCombination[uniqueCombination.length - 1] == null) { return Optional.empty(); @@ -144,8 +113,6 @@ public class UniqueValueUtil { uniqueCombination[uniqueCombination.length - 1] = uniqueCombination[uniqueCombination.length - 1].toLowerCase(); - - mdcDataDebugMessage.debugExitMessage(null); return Optional.of(CommonMethods.arrayToSeparatedString(uniqueCombination, '_')); } } |