aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api
diff options
context:
space:
mode:
authorAviZi <avi.ziv@amdocs.com>2017-06-09 02:39:56 +0300
committerAviZi <avi.ziv@amdocs.com>2017-06-09 02:39:56 +0300
commit280f8015d06af1f41a3ef12e8300801c7a5e0d54 (patch)
tree9c1d3978c04cd28068f02073038c936bb49ca9e0 /openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api
parentfd3821dad11780d33c5373d74c957c442489945e (diff)
[SDC-29] Amdocs OnBoard 1707 initial commit.
Change-Id: Ie4d12a3f574008b792899b368a0902a8b46b5370 Signed-off-by: AviZi <avi.ziv@amdocs.com>
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/pom.xml19
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml.versionsBackup45
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/main/java/org/openecomp/core/util/UniqueValueUtil.java41
3 files changed, 92 insertions, 13 deletions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml
index 4ff52e5e33..bce553cfde 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml
@@ -2,6 +2,10 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+ <name>openecomp-nosqldb-api</name>
+ <artifactId>openecomp-nosqldb-api</artifactId>
+ <groupId>org.openecomp.core</groupId>
+
<parent>
<artifactId>openecomp-sdc-lib</artifactId>
<groupId>org.openecomp.sdc</groupId>
@@ -9,13 +13,9 @@
<relativePath>../../..</relativePath>
</parent>
- <name>openecomp-nosqldb-api</name>
- <artifactId>openecomp-nosqldb-api</artifactId>
-
-
<dependencies>
<dependency>
- <groupId>org.openecomp.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<artifactId>openecomp-facade-api</artifactId>
<version>${project.version}</version>
</dependency>
@@ -30,11 +30,16 @@
<version>${datasatx.version}</version>
</dependency>
<dependency>
- <groupId>org.openecomp.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<artifactId>openecomp-facade-core</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-logging-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
-</project> \ No newline at end of file
+</project>
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml.versionsBackup
new file mode 100644
index 0000000000..288274d728
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml.versionsBackup
@@ -0,0 +1,45 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>openecomp-nosqldb-api</name>
+ <artifactId>openecomp-nosqldb-api</artifactId>
+ <groupId>org.openecomp.core</groupId>
+
+ <parent>
+ <artifactId>openecomp-sdc-lib</artifactId>
+ <groupId>org.openecomp.sdc</groupId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../..</relativePath>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-facade-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.datastax.cassandra</groupId>
+ <artifactId>cassandra-driver-core</artifactId>
+ <version>${datasatx.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.datastax.cassandra</groupId>
+ <artifactId>cassandra-driver-mapping</artifactId>
+ <version>${datasatx.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-facade-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-logging-core</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+
+</project> \ No newline at end of file
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 a82c97c51c..d2dee5e512 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,21 +27,18 @@ 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.common.utils.CommonUtil;
+import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
import java.util.Optional;
-/**
- * The type Unique value util.
- */
public class UniqueValueUtil {
- /**
- * The constant UNIQUE_VALUE_VIOLATION.
- */
public static final String UNIQUE_VALUE_VIOLATION = "UNIQUE_VALUE_VIOLATION";
private static final String UNIQUE_VALUE_VIOLATION_MSG = "%s with the value '%s' already exists.";
private static final UniqueValueDao uniqueValueDao =
UniqueValueDaoFactory.getInstance().createInterface();
+ private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
/**
* Create unique value.
@@ -50,12 +47,18 @@ public class UniqueValueUtil {
* @param uniqueCombination the unique combination
*/
public static void createUniqueValue(String type, String... uniqueCombination) {
+
+
+ mdcDataDebugMessage.debugEntryMessage(null, 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, null);
}
/**
@@ -65,11 +68,17 @@ public class UniqueValueUtil {
* @param uniqueCombination the unique combination
*/
public static void deleteUniqueValue(String type, String... uniqueCombination) {
+
+
+ mdcDataDebugMessage.debugEntryMessage(null, null);
+
Optional<String> value = formatValue(uniqueCombination);
if (!value.isPresent()) {
return;
}
uniqueValueDao.delete(new UniqueValueEntity(type, value.get()));
+
+ mdcDataDebugMessage.debugExitMessage(null, null);
}
/**
@@ -82,12 +91,18 @@ public class UniqueValueUtil {
*/
public static void updateUniqueValue(String type, String oldValue, String newValue,
String... uniqueContext) {
+
+
+ mdcDataDebugMessage.debugEntryMessage(null, null);
+
if ((newValue != null && oldValue != null
&& !newValue.toLowerCase().equals(oldValue.toLowerCase()))
|| newValue == null || oldValue == null) {
createUniqueValue(type, CommonMethods.concat(uniqueContext, new String[]{newValue}));
deleteUniqueValue(type, CommonMethods.concat(uniqueContext, new String[]{oldValue}));
}
+
+ mdcDataDebugMessage.debugExitMessage(null, null);
}
/**
@@ -97,14 +112,20 @@ public class UniqueValueUtil {
* @param uniqueCombination the unique combination
*/
public static void validateUniqueValue(String type, String... uniqueCombination) {
+ mdcDataDebugMessage.debugEntryMessage(null, null);
+
Optional<String> value = formatValue(uniqueCombination);
if (!value.isPresent()) {
return;
}
validateUniqueValue(type, value.get(), uniqueCombination);
+
+ mdcDataDebugMessage.debugExitMessage(null, null);
}
private static void validateUniqueValue(String type, String value, String... uniqueCombination) {
+ mdcDataDebugMessage.debugEntryMessage(null, null);
+
if (uniqueValueDao.get(new UniqueValueEntity(type, value)) != null) {
throw new CoreException(new ErrorCode.ErrorCodeBuilder()
.withCategory(ErrorCategory.APPLICATION)
@@ -112,9 +133,15 @@ public class UniqueValueUtil {
.withMessage(String.format(UNIQUE_VALUE_VIOLATION_MSG, type,
uniqueCombination[uniqueCombination.length - 1])).build());
}
+
+ mdcDataDebugMessage.debugExitMessage(null, null);
}
private static Optional<String> formatValue(String[] uniqueCombination) {
+
+
+ mdcDataDebugMessage.debugEntryMessage(null, null);
+
if (uniqueCombination == null || uniqueCombination.length == 0
|| uniqueCombination[uniqueCombination.length - 1] == null) {
return Optional.empty();
@@ -122,6 +149,8 @@ public class UniqueValueUtil {
uniqueCombination[uniqueCombination.length - 1] =
uniqueCombination[uniqueCombination.length - 1].toLowerCase();
+
+ mdcDataDebugMessage.debugExitMessage(null, null);
return Optional.of(CommonMethods.arrayToSeparatedString(uniqueCombination, '_'));
}
}