summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-versioning-lib
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-versioning-lib')
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoCassandraImpl.java11
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoFactoryImpl.java4
2 files changed, 12 insertions, 3 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoCassandraImpl.java
index 0845beaa2f..0a14c7ae19 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoCassandraImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoCassandraImpl.java
@@ -24,6 +24,7 @@ import com.datastax.driver.core.ColumnDefinitions;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
import com.datastax.driver.mapping.UDTMapper;
+import org.openecomp.core.dao.UniqueValueDao;
import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
import org.openecomp.core.util.UniqueValueUtil;
@@ -44,12 +45,18 @@ import java.util.stream.Collectors;
class VersionableEntityDaoCassandraImpl implements VersionableEntityDao {
+ private final UniqueValueUtil uniqueValueUtil;
private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
private static Logger Logger =
(Logger) LoggerFactory.getLogger(VersionableEntityDaoCassandraImpl.class);
private static UDTMapper<Version> versionMapper =
noSqlDb.getMappingManager().udtMapper(Version.class);
+ public VersionableEntityDaoCassandraImpl(
+ UniqueValueDao uniqueValueDao) {
+ this.uniqueValueUtil = new UniqueValueUtil(uniqueValueDao);
+ }
+
private static String commaSeparatedQuestionMarks(int size) {
StringBuilder sb = new StringBuilder(size * 2 - 1);
for (int i = 0; i < size; i++) {
@@ -128,7 +135,7 @@ class VersionableEntityDaoCassandraImpl implements VersionableEntityDao {
for (UniqueValueMetadata uniqueMetadata : metadata) {
List<String> uniqueValueCombination = uniqueMetadata.getUniqueConstraintIdentifiers().stream()
.map(colName -> (String) columnNameToValue.get(colName)).collect(Collectors.toList());
- UniqueValueUtil.createUniqueValue(uniqueMetadata.getType(),
+ uniqueValueUtil.createUniqueValue(uniqueMetadata.getType(),
uniqueValueCombination.toArray(new String[uniqueValueCombination.size()]));
}
}
@@ -138,7 +145,7 @@ class VersionableEntityDaoCassandraImpl implements VersionableEntityDao {
for (UniqueValueMetadata uniqueMetadata : metadata) {
List<String> uniqueValueCombination = uniqueMetadata.getUniqueConstraintIdentifiers().stream()
.map(colName -> (String) columnNameToValue.get(colName)).collect(Collectors.toList());
- UniqueValueUtil.deleteUniqueValue(uniqueMetadata.getType(),
+ uniqueValueUtil.deleteUniqueValue(uniqueMetadata.getType(),
uniqueValueCombination.toArray(new String[uniqueValueCombination.size()]));
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoFactoryImpl.java
index 3ab6560c71..d9300a007b 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoFactoryImpl.java
@@ -20,13 +20,15 @@
package org.openecomp.sdc.versioning.dao.impl;
+import org.openecomp.core.dao.UniqueValueDaoFactory;
import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
import org.openecomp.sdc.versioning.dao.VersionableEntityDao;
import org.openecomp.sdc.versioning.dao.VersionableEntityDaoFactory;
import org.openecomp.sdc.versioning.types.VersionableEntityStoreType;
public class VersionableEntityDaoFactoryImpl extends VersionableEntityDaoFactory {
- private static VersionableEntityDao CASSANDRA_INSTANCE = new VersionableEntityDaoCassandraImpl();
+ private static VersionableEntityDao CASSANDRA_INSTANCE = new VersionableEntityDaoCassandraImpl(
+ UniqueValueDaoFactory.getInstance().createInterface());
private static VersionableEntityDao ZUSAMMEN_INSTANCE =
new VersionableEntityDaoZusammenImpl(ZusammenAdaptorFactory.getInstance().createInterface());