summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib')
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml9
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java3
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml4
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java22
-rw-r--r--openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-api/src/main/java/org/openecomp/sdc/activitylog/dao/type/ActivityLogEntity.java13
-rw-r--r--openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-core/src/main/java/org/openecomp/sdc/activitylog/dao/impl/ActivityLogDaoCassandraImpl.java24
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceArtifactDao.java28
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceArtifactDaoFactory.java32
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceTemplateDao.java25
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceTemplateDaoFactory.java32
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceArtifactDao.java44
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceArtifactDaoFactory.java32
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDao.java44
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDaoFactory.java32
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDaoInter.java48
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/src/main/java/org/openecomp/sdc/model/impl/AbstractServiceModelDao.java218
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceArtifactDaoCassandraFactoryImpl.java35
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceArtifactDaoCassandraImpl.java140
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceModelDaoImpl.java55
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceTemplateDaoCassandraFactoryImpl.java35
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceTemplateDaoCassandraImpl.java150
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceArtifactDaoCassandraFactoryImpl.java33
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceArtifactDaoCassandraImpl.java142
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceModelDaoImpl.java48
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceTemplateDaoCassandraFactoryImpl.java33
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceTemplateDaoCassandraImpl.java145
-rw-r--r--openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-worker/pom.xml2
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/EntitlementPoolCassandraDaoImpl.java148
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/FeatureGroupCassandraDaoImpl.java202
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseAgreementCassandraDaoImpl.java156
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseKeyGroupCassandraDaoImpl.java130
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/VendorLicenseModelCassandraDaoImpl.java77
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ProcessEntity.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoCassandraImpl.java156
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDependencyModelDaoCassandraImpl.java94
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComputeDaoCassandraImpl.java135
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/DeploymentFlavorDaoCassandraImpl.java111
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ImageDaoImpl.java144
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VspMergeDaoImpl.java13
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionHistoryDao.java27
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionHistoryDaoFactory.java30
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Version.java1
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoDeletedEntity.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoEntity.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionHistoryCassandraDaoImpl.java70
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionHistoryDaoFactoryImpl.java33
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoCassandraImpl.java9
49 files changed, 48 insertions, 2926 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 5e50fc69b6..38863bd88f 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
@@ -27,12 +27,17 @@
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
- <version>${datasatx.version}</version>
+ <version>${datastax.cassandra.version}</version>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-mapping</artifactId>
- <version>${datasatx.version}</version>
+ <version>${datastax.cassandra.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.datastax.cassandra</groupId>
+ <artifactId>cassandra-driver-extras</artifactId>
+ <version>${datastax.cassandra.version}</version>
</dependency>
<dependency>
<groupId>org.openecomp.sdc.core</groupId>
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java
index f06817965b..ee7ef2eef0 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java
@@ -19,6 +19,7 @@ package org.openecomp.core.nosqldb.impl.cassandra;
import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.ConsistencyLevel;
import com.datastax.driver.core.QueryOptions;
+import com.datastax.driver.core.RemoteEndpointAwareJdkSSLOptions;
import com.datastax.driver.core.SSLOptions;
import com.datastax.driver.core.Session;
import com.datastax.driver.core.policies.DCAwareRoundRobinPolicy;
@@ -132,7 +133,7 @@ public class CassandraSessionFactory {
SSLContext context = getSslContext(trustStorePath.get(), trustStorePassword.get());
String[] css = new String[]{"TLS_RSA_WITH_AES_128_CBC_SHA"};
- return new SSLOptions(context, css);
+ return RemoteEndpointAwareJdkSSLOptions.builder().withSSLContext(context).withCipherSuites(css).build();
}
private static SSLContext getSslContext(String truststorePath, String trustStorePassword) {
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml
index ab34ecc8f1..50574a0900 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml
@@ -39,7 +39,7 @@
<artifactId>zusammen-collaboration-cassandra-plugin</artifactId>
<version>${zusammen-collaboration-store.version}</version>
<scope>runtime</scope>
- <exclusions>
+<!-- <exclusions>
<exclusion>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
@@ -48,7 +48,7 @@
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-mapping</artifactId>
</exclusion>
- </exclusions>
+ </exclusions>-->
</dependency>
<dependency>
<groupId>com.amdocs.zusammen.plugin</groupId>
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java
index 5b7e1b2c8e..cb5787405b 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java
@@ -43,12 +43,10 @@ import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_QUERY_
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
import com.datastax.driver.core.Statement;
-import com.datastax.driver.core.UDTValue;
import com.datastax.driver.core.exceptions.NoHostAvailableException;
import com.datastax.driver.core.querybuilder.QueryBuilder;
import com.datastax.driver.mapping.Mapper;
import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.UDTMapper;
import com.datastax.driver.mapping.annotations.Accessor;
import com.datastax.driver.mapping.annotations.Query;
import java.util.ArrayList;
@@ -95,8 +93,6 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act
noSqlDb.getMappingManager().mapper(ActionEntity.class);
private static ActionAccessor accessor =
noSqlDb.getMappingManager().createAccessor(ActionAccessor.class);
- private static UDTMapper<Version> versionMapper =
- noSqlDb.getMappingManager().udtMapper(Version.class);
private static VersionInfoDao versionInfoDao =
VersionInfoDaoFactory.getInstance().createInterface();
private static VersionInfoDeletedDao versionInfoDeletedDao =
@@ -159,7 +155,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act
Version activeVersion = activeVersionEntity.getActiveVersion();
Statement getNameFromInvUuId = QueryBuilder.select().column("name").from("dox", "Action")
.where(eq("actioninvariantuuid", actionInvariantUuId))
- .and(in("version", versionMapper.toUDT(activeVersion)));
+ .and(in("version", activeVersion));
ActionUtil
.actionLogPreProcessor(ActionSubOperation.GET_NAME_BY_ACTIONINVID, TARGET_ENTITY_DB);
ResultSet results = getSession().execute(getNameFromInvUuId);
@@ -430,7 +426,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act
@Override
protected Object[] getKeys(ActionEntity entity) {
- return new Object[]{entity.getActionInvariantUuId(), versionMapper.toUDT(entity.getVersion())};
+ return new Object[]{entity.getActionInvariantUuId(), entity.getVersion()};
}
@Override
@@ -438,25 +434,15 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act
return accessor.getAllActions().all();
}
- /**
- *
- * @param actionInvariantUUID.
- * @param versions.
- */
private void updateActionStatusForDelete(String actionInvariantUuId, List<Version> versions) {
log.debug(
"entering updateActionStatusForDelete with actionInvariantUuId = " + actionInvariantUuId
+ " for versions " + versions);
- List<UDTValue> versionUdt = new ArrayList<>();
- for (Version v : versions) {
- versionUdt.add(versionMapper.toUDT(v));
- }
-
ActionUtil.actionLogPreProcessor(ActionSubOperation.UPDATE_ACTION_STATUS, TARGET_ENTITY_DB);
//Update the status column of action table
Statement updateStatusStatement =
QueryBuilder.update("dox", "Action").with(set("status", ActionStatus.Deleted.name()))
- .where(eq("actioninvariantuuid", actionInvariantUuId)).and(in("version", versionUdt));
+ .where(eq("actioninvariantuuid", actionInvariantUuId)).and(in("version", versions));
getSession().execute(updateStatusStatement);
ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
log.metrics("");
@@ -506,7 +492,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act
List<Version> versionList = new ArrayList<>();
for (Row row : results) {
- Version version = versionMapper.fromUDT((UDTValue) row.getObject("version"));
+ Version version = row.get("version",Version.class);
versionList.add(version);
}
log.debug("exit getVersionsByName for Action Name = " + name);
diff --git a/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-api/src/main/java/org/openecomp/sdc/activitylog/dao/type/ActivityLogEntity.java b/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-api/src/main/java/org/openecomp/sdc/activitylog/dao/type/ActivityLogEntity.java
index b277fe1cb5..3c65624c15 100644
--- a/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-api/src/main/java/org/openecomp/sdc/activitylog/dao/type/ActivityLogEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-api/src/main/java/org/openecomp/sdc/activitylog/dao/type/ActivityLogEntity.java
@@ -18,13 +18,13 @@ package org.openecomp.sdc.activitylog.dao.type;
import com.datastax.driver.mapping.annotations.ClusteringColumn;
import com.datastax.driver.mapping.annotations.Column;
-import com.datastax.driver.mapping.annotations.Enumerated;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
import org.openecomp.sdc.versioning.dao.types.Version;
import java.util.Date;
+
@Table(keyspace = "dox", name = "activity_log")
public class ActivityLogEntity {
@PartitionKey
@@ -36,7 +36,6 @@ public class ActivityLogEntity {
@ClusteringColumn
@Column(name = "activity_id")
private String id;
- @Enumerated
private ActivityType type;
private String user;
private Date timestamp;
@@ -55,7 +54,7 @@ public class ActivityLogEntity {
public ActivityLogEntity(String itemId, Version version) {
this.itemId = itemId;
- setVersion(version);
+ this.versionId = version == null ? null : version.getId();
}
public ActivityLogEntity(String itemId, Version version, ActivityType type, String user,
@@ -77,14 +76,6 @@ public class ActivityLogEntity {
this.itemId = itemId;
}
- public Version getVersion() {
- return versionId == null ? null : new Version(versionId);
- }
-
- public void setVersion(Version version) {
- this.versionId = version == null ? null : version.getId();
- }
-
public String getVersionId() {
return versionId;
}
diff --git a/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-core/src/main/java/org/openecomp/sdc/activitylog/dao/impl/ActivityLogDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-core/src/main/java/org/openecomp/sdc/activitylog/dao/impl/ActivityLogDaoCassandraImpl.java
index 85e0afa90f..dc5dd5765d 100644
--- a/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-core/src/main/java/org/openecomp/sdc/activitylog/dao/impl/ActivityLogDaoCassandraImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-core/src/main/java/org/openecomp/sdc/activitylog/dao/impl/ActivityLogDaoCassandraImpl.java
@@ -15,25 +15,33 @@
*/
package org.openecomp.sdc.activitylog.dao.impl;
+import com.datastax.driver.extras.codecs.enums.EnumNameCodec;
import com.datastax.driver.mapping.Mapper;
+import com.datastax.driver.mapping.MappingManager;
import com.datastax.driver.mapping.Result;
import com.datastax.driver.mapping.annotations.Accessor;
import com.datastax.driver.mapping.annotations.Query;
+import java.util.Collection;
import org.openecomp.core.dao.impl.CassandraBaseDao;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
import org.openecomp.sdc.activitylog.dao.ActivityLogDao;
import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
-
-import java.util.Collection;
+import org.openecomp.sdc.activitylog.dao.type.ActivityType;
public class ActivityLogDaoCassandraImpl extends CassandraBaseDao<ActivityLogEntity>
implements ActivityLogDao {
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final Mapper<ActivityLogEntity> mapper =
- noSqlDb.getMappingManager().mapper(ActivityLogEntity.class);
- private static final ActivityLogAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(ActivityLogAccessor.class);
+
+ private static final Mapper<ActivityLogEntity> mapper;
+ private static final ActivityLogAccessor accessor;
+
+ static {
+ MappingManager mappingManager = NoSqlDbFactory.getInstance().createInterface().getMappingManager();
+ mappingManager.getSession().getCluster().getConfiguration().getCodecRegistry()
+ .register(new EnumNameCodec<>(ActivityType.class));
+
+ mapper = mappingManager.mapper(ActivityLogEntity.class);
+ accessor = mappingManager.createAccessor(ActivityLogAccessor.class);
+ }
@Override
protected Mapper<ActivityLogEntity> getMapper() {
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceArtifactDao.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceArtifactDao.java
deleted file mode 100644
index e25845d319..0000000000
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceArtifactDao.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.core.model.dao;
-
-import org.openecomp.core.model.types.ServiceArtifact;
-import org.openecomp.sdc.versioning.dao.types.Version;
-
-public interface EnrichedServiceArtifactDao extends ServiceArtifactDaoInter {
- ServiceArtifact getArtifactInfo(String vspId, Version version, String name);
-}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceArtifactDaoFactory.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceArtifactDaoFactory.java
deleted file mode 100644
index 3852e983e5..0000000000
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceArtifactDaoFactory.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.core.model.dao;
-
-import org.openecomp.core.factory.api.AbstractComponentFactory;
-import org.openecomp.core.factory.api.AbstractFactory;
-
-public abstract class EnrichedServiceArtifactDaoFactory
- extends AbstractComponentFactory<EnrichedServiceArtifactDao> {
-
- public static EnrichedServiceArtifactDaoFactory getInstance() {
- return AbstractFactory.getInstance(EnrichedServiceArtifactDaoFactory.class);
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceTemplateDao.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceTemplateDao.java
deleted file mode 100644
index 631d10a9ee..0000000000
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceTemplateDao.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.core.model.dao;
-
-public interface EnrichedServiceTemplateDao extends ServiceTemplateDaoInter {
-
-}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceTemplateDaoFactory.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceTemplateDaoFactory.java
deleted file mode 100644
index cab3ca6247..0000000000
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceTemplateDaoFactory.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.core.model.dao;
-
-import org.openecomp.core.factory.api.AbstractComponentFactory;
-import org.openecomp.core.factory.api.AbstractFactory;
-
-public abstract class EnrichedServiceTemplateDaoFactory
- extends AbstractComponentFactory<EnrichedServiceTemplateDao> {
-
- public static EnrichedServiceTemplateDaoFactory getInstance() {
- return AbstractFactory.getInstance(EnrichedServiceTemplateDaoFactory.class);
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceArtifactDao.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceArtifactDao.java
deleted file mode 100644
index 48f59d06ae..0000000000
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceArtifactDao.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.core.model.dao;
-
-import org.openecomp.core.model.types.ServiceArtifact;
-import org.openecomp.sdc.versioning.dao.types.Version;
-
-import java.util.Collection;
-
-public interface ServiceArtifactDao extends ServiceArtifactDaoInter {
-
- Collection<ServiceArtifact> list(String vspId, Version version);
-
- void create(ServiceArtifact entity);
-
- void update(ServiceArtifact entity);
-
- ServiceArtifact get(String vspId, Version version);
-
- void delete(String vspId, Version version);
-
- Object[] getKeys(String vspId, Version version);
-
- ServiceArtifact getArtifactInfo(String vspId, Version version, String name);
-
-}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceArtifactDaoFactory.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceArtifactDaoFactory.java
deleted file mode 100644
index 07c2191a7c..0000000000
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceArtifactDaoFactory.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.core.model.dao;
-
-import org.openecomp.core.factory.api.AbstractComponentFactory;
-import org.openecomp.core.factory.api.AbstractFactory;
-
-public abstract class ServiceArtifactDaoFactory
- extends AbstractComponentFactory<ServiceArtifactDao> {
-
- public static ServiceArtifactDaoFactory getInstance() {
- return AbstractFactory.getInstance(ServiceArtifactDaoFactory.class);
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDao.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDao.java
deleted file mode 100644
index c0c919b8a0..0000000000
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDao.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.core.model.dao;
-
-import org.openecomp.core.model.types.ServiceTemplate;
-import org.openecomp.sdc.versioning.dao.types.Version;
-
-import java.util.Collection;
-
-public interface ServiceTemplateDao extends ServiceTemplateDaoInter {
- void create(ServiceTemplate entity);
-
- void update(ServiceTemplate entity);
-
- ServiceTemplate get(String vspId, Version version);
-
- void delete(String vspId, Version version);
-
- Object[] getKeys(String vspId, Version version);
-
- ServiceTemplate getTemplateInfo(String vspId, Version version, String name);
-
- Collection<ServiceTemplate> list(String vspId, Version version);
-
- String getBase(String vspId, Version version);
-}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDaoFactory.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDaoFactory.java
deleted file mode 100644
index 65aad1bb97..0000000000
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDaoFactory.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.core.model.dao;
-
-import org.openecomp.core.factory.api.AbstractComponentFactory;
-import org.openecomp.core.factory.api.AbstractFactory;
-
-public abstract class ServiceTemplateDaoFactory
- extends AbstractComponentFactory<ServiceTemplateDao> {
-
- public static ServiceTemplateDaoFactory getInstance() {
- return AbstractFactory.getInstance(ServiceTemplateDaoFactory.class);
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDaoInter.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDaoInter.java
deleted file mode 100644
index d132a5158b..0000000000
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDaoInter.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.core.model.dao;
-
-import org.openecomp.core.model.types.ServiceTemplate;
-import org.openecomp.sdc.versioning.dao.VersionableDao;
-import org.openecomp.sdc.versioning.dao.types.Version;
-
-import java.util.Collection;
-
-public interface ServiceTemplateDaoInter extends VersionableDao {
- void create(ServiceTemplate entity);
-
- void update(ServiceTemplate entity);
-
- ServiceTemplate get(String vspId, Version version);
-
- void delete(String vspId, Version version);
-
- Object[] getKeys(String vspId, Version version);
-
- ServiceTemplate getTemplateInfo(String vspId, Version version, String name);
-
- Collection<ServiceTemplate> list(String vspId, Version version);
-
- String getBase(String vspId, Version version);
-
- void deleteAll(String vspId, Version version);
-
-}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/src/main/java/org/openecomp/sdc/model/impl/AbstractServiceModelDao.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/src/main/java/org/openecomp/sdc/model/impl/AbstractServiceModelDao.java
deleted file mode 100644
index 938b33b173..0000000000
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/src/main/java/org/openecomp/sdc/model/impl/AbstractServiceModelDao.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Copyright © 2018 European Support Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
-
-package org.openecomp.sdc.model.impl;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-import org.onap.sdc.tosca.datatypes.model.Import;
-
-import org.onap.sdc.tosca.services.ToscaExtensionYamlUtil;
-import org.openecomp.core.model.dao.ServiceArtifactDaoInter;
-import org.openecomp.core.model.dao.ServiceTemplateDaoInter;
-import org.openecomp.core.model.types.ServiceArtifact;
-import org.openecomp.core.model.types.ServiceElement;
-import org.openecomp.core.model.types.ServiceTemplate;
-import org.openecomp.core.utilities.file.FileContentHandler;
-import org.openecomp.core.utilities.file.FileUtils;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
-import org.openecomp.sdc.tosca.datatypes.model.Old1610ServiceTemplate;
-import org.openecomp.sdc.versioning.dao.VersionableDao;
-import org.openecomp.sdc.versioning.dao.types.Version;
-
-public class AbstractServiceModelDao implements VersionableDao {
-
- protected ServiceTemplateDaoInter templateDao;
- protected ServiceArtifactDaoInter artifactDao;
-
- private final Logger log = LoggerFactory.getLogger(this.getClass());
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- templateDao.registerVersioning(versionableEntityType);
- artifactDao.registerVersioning(versionableEntityType);
- }
-
- /**
- * Gets service model.
- *
- * @param vspId the vsp id
- * @param version the version
- * @return the service model
- */
- public ToscaServiceModel getServiceModel(String vspId, Version version) {
- if (vspId == null || version == null) {
- throw new RuntimeException("missing service model key");
- }
-
- FileContentHandler artifactFiles = getArtifacts(vspId, version);
-
- Map<String, org.onap.sdc.tosca.datatypes.model.ServiceTemplate> serviceTemplates =
- getTemplates(vspId,
- version);
- String entryDefinitionServiceTemplate = getServiceBase(vspId, version);
- return new ToscaServiceModel(artifactFiles, serviceTemplates, entryDefinitionServiceTemplate);
- }
-
- public void storeExternalArtifact(ServiceArtifact serviceArtifact) {
- artifactDao.create(serviceArtifact);
- }
-
-
- /**
- * Store service model.
- *
- * @param vspId the vsp id
- * @param version the version
- * @param toscaServiceModel the tosca service model
- */
- public void storeServiceModel(String vspId, Version version,
- ToscaServiceModel toscaServiceModel) {
- ServiceArtifact entityArt;
-
- for (String fileName : toscaServiceModel.getArtifactFiles().getFileList()) {
- entityArt = new ServiceArtifact();
- entityArt.setContentData(
- FileUtils.toByteArray(toscaServiceModel.getArtifactFiles().getFileContent(fileName)));
- entityArt.setVspId(vspId);
- entityArt.setVersion(version);
- entityArt.setName(fileName);
-
- artifactDao.create(entityArt);
- }
-
- ServiceTemplate entityTmp;
- String yaml;
- for (Map.Entry<String, org.onap.sdc.tosca.datatypes.model.ServiceTemplate>
- entryTemplate : toscaServiceModel.getServiceTemplates().entrySet()) {
- entityTmp = new ServiceTemplate();
-
- yaml = new ToscaExtensionYamlUtil().objectToYaml(entryTemplate.getValue());
- entityTmp.setContentData(yaml.getBytes());
- entityTmp.setVspId(vspId);
- entityTmp.setVersion(version);
- entityTmp.setName(entryTemplate.getKey());
- entityTmp.setBaseName(toscaServiceModel.getEntryDefinitionServiceTemplate());
-
- templateDao.create(entityTmp);
- }
- }
-
-
- /**
- * Gets service model info.
- *
- * @param vspId the vsp id
- * @param version the version
- * @param name the name
- * @return the service model info
- */
- public ServiceElement getServiceModelInfo(String vspId, Version version, String name) {
- ServiceElement element = templateDao.getTemplateInfo(vspId, version, name);
- if (element != null) {
- return element;
- }
-
- element = artifactDao.getArtifactInfo(vspId, version, name);
- if (element != null) {
- return element;
- }
- return null;
- }
-
- private String getServiceBase(String vspId, Version version) {
- return templateDao.getBase(vspId, version);
- }
-
- private Map<String, org.onap.sdc.tosca.datatypes.model.ServiceTemplate> getTemplates(
- String vspId,
- Version version) {
-
- Collection<ServiceTemplate> templates = templateDao.list(vspId, version);
- if (templates == null) {
- return null;
- }
- return templates.stream().collect(Collectors.toMap(template -> template.getName(),
- template -> getServiceTemplate(template.getContent())));
- }
-
- private org.onap.sdc.tosca.datatypes.model.ServiceTemplate getServiceTemplate(
- InputStream content) {
- String serviceTemplateContent = new String(FileUtils.toByteArray(content));
-
- try{
- return new ToscaExtensionYamlUtil().yamlToObject(serviceTemplateContent,
- org.onap.sdc.tosca.datatypes.model.ServiceTemplate.class);
- }catch (Exception e){
- log.warn("Found vsp with old-versioned tosca service template", e);
- Old1610ServiceTemplate old1610ServiceTemplate =
- new ToscaExtensionYamlUtil().yamlToObject(serviceTemplateContent,
- Old1610ServiceTemplate.class);
-
- return mapOldSTToCurrentST(old1610ServiceTemplate);
- }
- }
-
- private static org.onap.sdc.tosca.datatypes.model.ServiceTemplate mapOldSTToCurrentST(Old1610ServiceTemplate oldServiceTemplate){
- org.onap.sdc.tosca.datatypes.model.ServiceTemplate
- serviceTemplate = new org.onap.sdc.tosca.datatypes.model.ServiceTemplate();
-
- serviceTemplate.setArtifact_types(oldServiceTemplate.getArtifact_types());
- serviceTemplate.setCapability_types(oldServiceTemplate.getCapability_types());
- serviceTemplate.setData_types(oldServiceTemplate.getData_types());
- serviceTemplate.setDescription(oldServiceTemplate.getDescription());
- serviceTemplate.setGroup_types(oldServiceTemplate.getGroup_types());
- serviceTemplate.setInterface_types(oldServiceTemplate.getInterface_types());
- serviceTemplate.setMetadata(oldServiceTemplate.getMetadata());
- serviceTemplate.setNode_types(oldServiceTemplate.getNode_types());
- serviceTemplate.setPolicy_types(oldServiceTemplate.getPolicy_types());
- serviceTemplate.setRelationship_types(oldServiceTemplate.getRelationship_types());
- serviceTemplate.setTopology_template(oldServiceTemplate.getTopology_template());
-
- List<Map<String, Import>> imports = new ArrayList<>();
- for(Map.Entry<String, Import> importEntry : oldServiceTemplate.getImports().entrySet()){
- Map<String, Import> importMap = new HashMap<>();
- importMap.put(importEntry.getKey(), importEntry.getValue());
- imports.add(importMap);
- }
- serviceTemplate.setImports(imports);
-
- return serviceTemplate;
-
- }
-
- private FileContentHandler getArtifacts(String vspId, Version version) {
- Collection<ServiceArtifact> templates = artifactDao.list(vspId, version);
- if (templates == null) {
- return null;
- }
-
- FileContentHandler fileContentHandler = new FileContentHandler();
- templates.stream().forEach(
- serviceArtifact -> fileContentHandler
- .addFile(serviceArtifact.getName(), serviceArtifact.getContent()));
-
- return fileContentHandler;
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceArtifactDaoCassandraFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceArtifactDaoCassandraFactoryImpl.java
deleted file mode 100644
index 479668ec0c..0000000000
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceArtifactDaoCassandraFactoryImpl.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.model.impl;
-
-import org.openecomp.core.model.dao.EnrichedServiceArtifactDao;
-import org.openecomp.core.model.dao.EnrichedServiceArtifactDaoFactory;
-
-public class EnrichedServiceArtifactDaoCassandraFactoryImpl
- extends EnrichedServiceArtifactDaoFactory {
- private static final EnrichedServiceArtifactDao INSTANCE =
- new EnrichedServiceArtifactDaoCassandraImpl();
-
- @Override
- public EnrichedServiceArtifactDao createInterface() {
- return INSTANCE;
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceArtifactDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceArtifactDaoCassandraImpl.java
deleted file mode 100644
index 4962ae37a2..0000000000
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceArtifactDaoCassandraImpl.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright © 2016-2018 European Support Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.openecomp.sdc.model.impl;
-
-import com.datastax.driver.core.ResultSet;
-import com.datastax.driver.core.UDTValue;
-import com.datastax.driver.mapping.Mapper;
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.UDTMapper;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import java.util.Collection;
-import java.util.List;
-import java.util.stream.Collectors;
-import org.openecomp.core.model.dao.EnrichedServiceArtifactDao;
-import org.openecomp.core.model.types.EnrichedServiceArtifactEntity;
-import org.openecomp.core.model.types.ServiceArtifact;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.versioning.ActionVersioningManagerFactory;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
-
-public class EnrichedServiceArtifactDaoCassandraImpl implements EnrichedServiceArtifactDao {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final Mapper<EnrichedServiceArtifactEntity> mapper =
- noSqlDb.getMappingManager().mapper(
- EnrichedServiceArtifactEntity.class);
- private static final VspServiceArtifactAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(
- VspServiceArtifactAccessor.class);
- private static final UDTMapper<Version> versionMapper =
- noSqlDb.getMappingManager().udtMapper(Version.class);
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- ActionVersioningManagerFactory.getInstance().createInterface().register(versionableEntityType,
- new VersionableEntityMetadata(mapper.getTableMetadata().getName(),
- mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName()));
- }
-
- @Override
- public Collection<ServiceArtifact> list(String vspId, Version version) {
- List<EnrichedServiceArtifactEntity> entityList;
- if (vspId != null && version != null) {
- entityList = accessor.list(vspId, versionMapper.toUDT(version)).all();
- } else {
- entityList = accessor.listAll().all();
- }
-
- return entityList.stream().map(entity -> entity.getServiceArtifact())
- .collect(Collectors.toList());
- }
-
- @Override
- public void create(ServiceArtifact entity) {
- EnrichedServiceArtifactEntity vspEnrichedServiceArtifactEntity =
- new EnrichedServiceArtifactEntity(entity);
- mapper.save(vspEnrichedServiceArtifactEntity);
- }
-
- @Override
- public void update(ServiceArtifact entity) {
- EnrichedServiceArtifactEntity vspEnrichedServiceArtifactEntity =
- new EnrichedServiceArtifactEntity(entity);
- mapper.save(vspEnrichedServiceArtifactEntity);
- }
-
- @Override
- public ServiceArtifact get(String vspId, Version version) {
- return mapper.get(getKeys(vspId, version)).getServiceArtifact();
- }
-
- @Override
- public void delete(String vspId, Version version) {
- accessor.delete(vspId, versionMapper.toUDT(version));
- }
-
- @Override
- public Object[] getKeys(String vspId, Version version) {
- return new Object[]{vspId, versionMapper.toUDT(version)};
- }
-
- @Override
- public ServiceArtifact getArtifactInfo(String vspId, Version version, String name) {
- EnrichedServiceArtifactEntity enrichedServiceArtifactEntity = accessor.getArtifactInfo(vspId,
- versionMapper.toUDT(version), name).one();
- if (enrichedServiceArtifactEntity == null) {
- return null;
- }
-
- return enrichedServiceArtifactEntity.getServiceArtifact();
- }
-
- @Override
- public void deleteAll(String vspId, Version version) {
- accessor.deleteAll(vspId, versionMapper.toUDT(version));
- }
-
- @Accessor
- interface VspServiceArtifactAccessor {
-
- @Query("SELECT vsp_id, version, name ,content_data FROM vsp_enriched_service_artifact")
- Result<EnrichedServiceArtifactEntity> listAll();
-
- @Query(
- "SELECT vsp_id, version, name ,content_data FROM "
- + "vsp_enriched_service_artifact where vsp_id=? and version=? ")
- Result<EnrichedServiceArtifactEntity> list(String vspId, UDTValue version);
-
- @Query(
- "SELECT vsp_id,version,name,content_data FROM "
- + "vsp_enriched_service_artifact where vsp_id=? and version=? and name=?")
- Result<EnrichedServiceArtifactEntity> getArtifactInfo(String vspId, UDTValue version,
- String name);
-
- @Query("DELETE from vsp_enriched_service_artifact where vsp_id=? and version=?")
- ResultSet delete(String vspId, UDTValue version);
-
- @Query("DELETE FROM vsp_enriched_service_artifact where vsp_id=? and version=?")
- ResultSet deleteAll(String vspId, UDTValue version);
- }
-
-}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceModelDaoImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceModelDaoImpl.java
deleted file mode 100644
index 3bf61e5b39..0000000000
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceModelDaoImpl.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.model.impl;
-
-import org.openecomp.core.model.dao.EnrichedServiceArtifactDaoFactory;
-import org.openecomp.core.model.dao.EnrichedServiceModelDao;
-import org.openecomp.core.model.dao.EnrichedServiceTemplateDaoFactory;
-import org.openecomp.core.model.types.ServiceElement;
-import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
-import org.openecomp.sdc.versioning.dao.types.Version;
-
-public class EnrichedServiceModelDaoImpl extends AbstractServiceModelDao
- implements EnrichedServiceModelDao<ToscaServiceModel, ServiceElement> {
- public EnrichedServiceModelDaoImpl() {
- templateDao = EnrichedServiceTemplateDaoFactory.getInstance().createInterface();
- artifactDao = EnrichedServiceArtifactDaoFactory.getInstance().createInterface();
- }
-
- /*@Override
- public List<ServiceArtifact> getExternalArtifacts(String vspId, Version version) {
- return (List<ServiceArtifact>) artifactDao.list(vspId, version);
- }
-*/
-
- @Override
- public void deleteAll(String vspId, Version version) {
- templateDao.deleteAll(vspId, version);
- artifactDao.deleteAll(vspId, version);
- }
-
- @Override
- public void overrideServiceModel(String vspId, Version version, ToscaServiceModel serviceModel) {
- storeServiceModel(vspId, version, serviceModel);
- }
-
-
-}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceTemplateDaoCassandraFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceTemplateDaoCassandraFactoryImpl.java
deleted file mode 100644
index 14aa986bd8..0000000000
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceTemplateDaoCassandraFactoryImpl.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.model.impl;
-
-import org.openecomp.core.model.dao.EnrichedServiceTemplateDao;
-import org.openecomp.core.model.dao.EnrichedServiceTemplateDaoFactory;
-
-public class EnrichedServiceTemplateDaoCassandraFactoryImpl
- extends EnrichedServiceTemplateDaoFactory {
- private static final EnrichedServiceTemplateDao INSTANCE =
- new EnrichedServiceTemplateDaoCassandraImpl();
-
- @Override
- public EnrichedServiceTemplateDao createInterface() {
- return INSTANCE;
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceTemplateDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceTemplateDaoCassandraImpl.java
deleted file mode 100644
index 2e28ac94f8..0000000000
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceTemplateDaoCassandraImpl.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright © 2016-2018 European Support Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.openecomp.sdc.model.impl;
-
-import com.datastax.driver.core.ResultSet;
-import com.datastax.driver.core.UDTValue;
-import com.datastax.driver.mapping.Mapper;
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.UDTMapper;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import java.util.Collection;
-import java.util.List;
-import java.util.stream.Collectors;
-import org.openecomp.core.model.dao.EnrichedServiceTemplateDao;
-import org.openecomp.core.model.types.EnrichedServiceTemplateEntity;
-import org.openecomp.core.model.types.ServiceTemplate;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.versioning.ActionVersioningManagerFactory;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
-
-public class EnrichedServiceTemplateDaoCassandraImpl implements EnrichedServiceTemplateDao {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final Mapper<EnrichedServiceTemplateEntity> mapper =
- noSqlDb.getMappingManager().mapper(
- EnrichedServiceTemplateEntity.class);
- private static final VspServiceTemplateAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(
- VspServiceTemplateAccessor.class);
- private static final UDTMapper<Version> versionMapper =
- noSqlDb.getMappingManager().udtMapper(Version.class);
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- ActionVersioningManagerFactory.getInstance().createInterface().register(versionableEntityType,
- new VersionableEntityMetadata(mapper.getTableMetadata().getName(),
- mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName()));
- }
-
- @Override
- public void create(ServiceTemplate entity) {
- EnrichedServiceTemplateEntity vspEnrichedServiceTemplateEntity =
- new EnrichedServiceTemplateEntity(entity);
- mapper.save(vspEnrichedServiceTemplateEntity);
- }
-
- @Override
- public void update(ServiceTemplate entity) {
- EnrichedServiceTemplateEntity vspEnrichedServiceTemplateEntity =
- new EnrichedServiceTemplateEntity(entity);
- mapper.save(vspEnrichedServiceTemplateEntity);
- }
-
- @Override
- public ServiceTemplate get(String vspId, Version version) {
- return (mapper.get(getKeys(vspId, version))).getServiceTemplate();
- }
-
- @Override
- public void delete(String vspId, Version version) {
- mapper.delete(vspId, version);
- }
-
- @Override
- public Object[] getKeys(String vspId, Version version) {
- return new Object[]{vspId, versionMapper.toUDT(version)};
- }
-
- @Override
- public ServiceTemplate getTemplateInfo(String vspId, Version version, String name) {
- EnrichedServiceTemplateEntity enrichedServiceTemplateEntity = accessor.getTemplateInfo(vspId,
- versionMapper.toUDT(version), name).one();
- if (enrichedServiceTemplateEntity == null) {
- return null;
- }
- return enrichedServiceTemplateEntity.getServiceTemplate();
- }
-
- @Override
- public Collection<ServiceTemplate> list(String vspId, Version version) {
-
- List<EnrichedServiceTemplateEntity> entityList = accessor.list(vspId, version).all();
- return entityList.stream().map(entity -> entity.getServiceTemplate())
- .collect(Collectors.toList());
- }
-
- @Override
- public String getBase(String vspId, Version version) {
- Result<EnrichedServiceTemplateEntity> element =
- accessor.getBase(vspId, versionMapper.toUDT(version));
- if (element != null) {
- EnrichedServiceTemplateEntity vspEnrichedServiceTemplateEntity = element.one();
- if (vspEnrichedServiceTemplateEntity != null) {
- return element.one().getBaseName();
- }
- }
- return null;
- }
-
- @Override
- public void deleteAll(String vspId, Version version) {
- accessor.deleteAll(vspId, versionMapper.toUDT(version));
- }
-
- @Accessor
- interface VspServiceTemplateAccessor {
-
- @Query(
- "SELECT vsp_id, version, name, base_name ,content_data FROM vsp_enriched_service_template")
- Result<EnrichedServiceTemplateEntity> listAll();
-
- @Query(
- "SELECT vsp_id, version, name, base_name ,content_data FROM "
- + "vsp_enriched_service_template where vsp_id=? and version=?")
- Result<EnrichedServiceTemplateEntity> list(String vspId, Version version);
-
- @Query(
- "SELECT vsp_id, version, name, base_name ,content_data FROM "
- + "vsp_enriched_service_template where vsp_id=? and version=? and name=?")
- Result<EnrichedServiceTemplateEntity> getTemplateInfo(String vspId, UDTValue version,
- String name);
-
- @Query(
- "SELECT vsp_id, version, name, base_name FROM "
- + "vsp_enriched_service_template where vsp_id=? and version=?")
- Result<EnrichedServiceTemplateEntity> getBase(String vspId, UDTValue version);
-
- @Query("DELETE FROM vsp_enriched_service_template where vsp_id = ? and version = ?")
- ResultSet deleteAll(String vspId, UDTValue version);
- }
-
-}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceArtifactDaoCassandraFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceArtifactDaoCassandraFactoryImpl.java
deleted file mode 100644
index ee40dad385..0000000000
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceArtifactDaoCassandraFactoryImpl.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.model.impl;
-
-import org.openecomp.core.model.dao.ServiceArtifactDao;
-import org.openecomp.core.model.dao.ServiceArtifactDaoFactory;
-
-public class ServiceArtifactDaoCassandraFactoryImpl extends ServiceArtifactDaoFactory {
- private static final ServiceArtifactDao INSTANCE = new ServiceArtifactDaoCassandraImpl();
-
- @Override
- public ServiceArtifactDao createInterface() {
- return INSTANCE;
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceArtifactDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceArtifactDaoCassandraImpl.java
deleted file mode 100644
index 84972342f8..0000000000
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceArtifactDaoCassandraImpl.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright © 2016-2018 European Support Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.openecomp.sdc.model.impl;
-
-import com.datastax.driver.core.ResultSet;
-import com.datastax.driver.core.UDTValue;
-import com.datastax.driver.mapping.Mapper;
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.UDTMapper;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import java.util.Collection;
-import java.util.List;
-import java.util.stream.Collectors;
-import org.openecomp.core.model.dao.ServiceArtifactDao;
-import org.openecomp.core.model.types.ServiceArtifact;
-import org.openecomp.core.model.types.ServiceArtifactEntity;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.versioning.ActionVersioningManagerFactory;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
-
-public class ServiceArtifactDaoCassandraImpl implements ServiceArtifactDao {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final Mapper<ServiceArtifactEntity> mapper = noSqlDb.getMappingManager().mapper(
- ServiceArtifactEntity.class);
- private static final VspServiceArtifactAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(
- VspServiceArtifactAccessor.class);
- private static final UDTMapper<Version> versionMapper =
- noSqlDb.getMappingManager().udtMapper(Version.class);
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- ActionVersioningManagerFactory.getInstance().createInterface().register(versionableEntityType,
- new VersionableEntityMetadata(mapper.getTableMetadata().getName(),
- mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName()));
- }
-
- @Override
- public Collection<ServiceArtifact> list(String vspId, Version version) {
- List<ServiceArtifactEntity> entityList;
- if (vspId != null && version != null) {
- entityList = accessor.list(vspId, versionMapper.toUDT(version)).all();
- } else {
- entityList = accessor.listAll().all();
- }
-
- return entityList.stream().map(entity -> entity.getServiceArtifact())
- .collect(Collectors.toList());
- }
-
- @Override
- public void create(ServiceArtifact entity) {
- ServiceArtifactEntity vspServiceArtifactEntity = new ServiceArtifactEntity(entity);
- mapper.save(vspServiceArtifactEntity);
- }
-
- @Override
- public void update(ServiceArtifact entity) {
- ServiceArtifactEntity vspServiceArtifactEntity = new ServiceArtifactEntity(entity);
- mapper.save(vspServiceArtifactEntity);
- }
-
- @Override
- public ServiceArtifact get(String vspId, Version version) {
- return mapper.get(getKeys(vspId, version)).getServiceArtifact();
- }
-
- @Override
- public void delete(String vspId, Version version) {
- accessor.delete(vspId, versionMapper.toUDT(version));
- }
-
- // @Override
- // public void deleteArtifacts(String vspId, Version version){
- // accessor.delete(vspId, versionMapper.toUDT(version));
- // }
-
- @Override
- public Object[] getKeys(String vspId, Version version) {
- return new Object[]{vspId, versionMapper.toUDT(version)};
- }
-
- @Override
- public ServiceArtifact getArtifactInfo(String vspId, Version version, String name) {
- ServiceArtifactEntity serviceArtifactEntity =
- accessor.getArtifactInfo(vspId, versionMapper.toUDT(version),
- name).one();
- if (serviceArtifactEntity == null) {
- return null;
- }
-
- return serviceArtifactEntity.getServiceArtifact();
- }
-
- @Override
- public void deleteAll(String vspId, Version version) {
- accessor.deleteAll(vspId, versionMapper.toUDT(version));
- }
-
- @Accessor
- interface VspServiceArtifactAccessor {
-
- @Query("SELECT vsp_id, version, name ,content_data FROM vsp_service_artifact")
- Result<ServiceArtifactEntity> listAll();
-
- @Query(
- "SELECT vsp_id, version, name ,content_data "
- + "FROM vsp_service_artifact where vsp_id=? and version=? ")
- Result<ServiceArtifactEntity> list(String vspId, UDTValue version);
-
- @Query(
- "SELECT vsp_id,version,name,content_data FROM"
- + " vsp_service_artifact where vsp_id=? and version=? and name=?")
- Result<ServiceArtifactEntity> getArtifactInfo(String vspId, UDTValue version, String name);
-
- @Query("DELETE from vsp_service_artifact where vsp_id=? and version=?")
- ResultSet delete(String vspId, UDTValue version);
-
- @Query("DELETE FROM vsp_service_artifact where vsp_id=? and version=?")
- ResultSet deleteAll(String vspId, UDTValue version);
- }
-
-}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceModelDaoImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceModelDaoImpl.java
deleted file mode 100644
index b9a703e96d..0000000000
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceModelDaoImpl.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.model.impl;
-
-import org.openecomp.core.model.dao.ServiceArtifactDaoFactory;
-import org.openecomp.core.model.dao.ServiceModelDao;
-import org.openecomp.core.model.dao.ServiceTemplateDaoFactory;
-import org.openecomp.core.model.types.ServiceElement;
-import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
-import org.openecomp.sdc.versioning.dao.types.Version;
-
-public class ServiceModelDaoImpl extends AbstractServiceModelDao
- implements ServiceModelDao<ToscaServiceModel, ServiceElement> {
-
- public ServiceModelDaoImpl() {
- templateDao = ServiceTemplateDaoFactory.getInstance().createInterface();
- artifactDao = ServiceArtifactDaoFactory.getInstance().createInterface();
- }
-
- @Override
- public void deleteAll(String vspId, Version version) {
-
- }
-
- @Override
- public void overrideServiceModel(String vspId, Version version,
- ToscaServiceModel serviceModel) {
- storeServiceModel(vspId, version, serviceModel);
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceTemplateDaoCassandraFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceTemplateDaoCassandraFactoryImpl.java
deleted file mode 100644
index bc249701f2..0000000000
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceTemplateDaoCassandraFactoryImpl.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.model.impl;
-
-import org.openecomp.core.model.dao.ServiceTemplateDao;
-import org.openecomp.core.model.dao.ServiceTemplateDaoFactory;
-
-public class ServiceTemplateDaoCassandraFactoryImpl extends ServiceTemplateDaoFactory {
- private static final ServiceTemplateDao INSTANCE = new ServiceTemplateDaoCassandraImpl();
-
- @Override
- public ServiceTemplateDao createInterface() {
- return INSTANCE;
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceTemplateDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceTemplateDaoCassandraImpl.java
deleted file mode 100644
index 9db89414d2..0000000000
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceTemplateDaoCassandraImpl.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright © 2016-2018 European Support Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.openecomp.sdc.model.impl;
-
-import com.datastax.driver.core.ResultSet;
-import com.datastax.driver.core.UDTValue;
-import com.datastax.driver.mapping.Mapper;
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.UDTMapper;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import java.util.Collection;
-import java.util.List;
-import java.util.stream.Collectors;
-import org.openecomp.core.model.dao.ServiceTemplateDao;
-import org.openecomp.core.model.types.ServiceTemplate;
-import org.openecomp.core.model.types.ServiceTemplateEntity;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.versioning.ActionVersioningManagerFactory;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
-
-public class ServiceTemplateDaoCassandraImpl implements ServiceTemplateDao {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final Mapper<ServiceTemplateEntity> mapper = noSqlDb.getMappingManager().mapper(
- ServiceTemplateEntity.class);
- private static final VspServiceTemplateAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(
- VspServiceTemplateAccessor.class);
- private static final UDTMapper<Version> versionMapper =
- noSqlDb.getMappingManager().udtMapper(Version.class);
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- ActionVersioningManagerFactory.getInstance().createInterface().register(versionableEntityType,
- new VersionableEntityMetadata(mapper.getTableMetadata().getName(),
- mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName()));
- }
-
- @Override
- public void create(ServiceTemplate entity) {
- ServiceTemplateEntity vspServiceTemplateEntity = new ServiceTemplateEntity(entity);
- mapper.save(vspServiceTemplateEntity);
- }
-
- @Override
- public void update(ServiceTemplate entity) {
- ServiceTemplateEntity vspServiceTemplateEntity = new ServiceTemplateEntity(entity);
- mapper.save(vspServiceTemplateEntity);
- }
-
- @Override
- public ServiceTemplate get(String vspId, Version version) {
- return (mapper.get(getKeys(vspId, version))).getServiceTemplate();
- }
-
- @Override
- public void delete(String vspId, Version version) {
- mapper.delete(vspId, version);
- }
-
- @Override
- public Object[] getKeys(String vspId, Version version) {
- return new Object[]{vspId, versionMapper.toUDT(version)};
- }
-
- @Override
- public ServiceTemplate getTemplateInfo(String vspId, Version version, String name) {
- ServiceTemplateEntity serviceTemplateEntity =
- accessor.getTemplateInfo(vspId, versionMapper.toUDT(version),
- name).one();
- if (serviceTemplateEntity == null) {
- return null;
- }
- return serviceTemplateEntity.getServiceTemplate();
- }
-
- @Override
- public Collection<ServiceTemplate> list(String vspId, Version version) {
-
- List<ServiceTemplateEntity> entityList = accessor.list(vspId, version).all();
- return entityList.stream().map(entity -> entity.getServiceTemplate())
- .collect(Collectors.toList());
- }
-
- @Override
- public String getBase(String vspId, Version version) {
- Result<ServiceTemplateEntity> element = accessor.getBase(vspId, versionMapper.toUDT(version));
- if (element != null) {
- ServiceTemplateEntity vspServiceTemplateEntity = element.one();
- if (vspServiceTemplateEntity != null) {
- return element.one().getBaseName();
- }
- }
- return null;
- }
-
- @Override
- public void deleteAll(String vspId, Version version) {
- accessor.deleteAll(vspId, versionMapper.toUDT(version));
- }
-
- @Accessor
- interface VspServiceTemplateAccessor {
-
- @Query("SELECT vsp_id, version, name, base_name ,content_data FROM vsp_service_template")
- Result<ServiceTemplateEntity> listAll();
-
- @Query(
- "SELECT vsp_id, version, name, base_name ,content_data"
- + " FROM vsp_service_template where vsp_id=? and version=?")
- Result<ServiceTemplateEntity> list(String vspId, Version version);
-
- @Query(
- "SELECT vsp_id, version, name, base_name ,content_data"
- + " FROM vsp_service_template where vsp_id=? and version=? and name=?")
- Result<ServiceTemplateEntity> getTemplateInfo(String vspId, UDTValue version, String name);
-
- @Query(
- "SELECT vsp_id, version, name, base_name"
- + " FROM vsp_service_template where vsp_id=? and version=?")
- Result<ServiceTemplateEntity> getBase(String vspId, UDTValue version);
-
- @Query("DELETE FROM vsp_service_template where vsp_id = ? and version = ?")
- ResultSet deleteAll(String vspId, UDTValue version);
- }
-
-}
diff --git a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-worker/pom.xml b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-worker/pom.xml
index 81f8746b24..d39c5c5cb7 100644
--- a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-worker/pom.xml
+++ b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-worker/pom.xml
@@ -59,7 +59,7 @@
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
- <version>2.0.1</version>
+ <version>3.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java
index d76b434f29..660f46ee0a 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java
@@ -22,7 +22,6 @@ package org.openecomp.sdc.vendorlicense.dao.types;
import com.datastax.driver.mapping.annotations.ClusteringColumn;
import com.datastax.driver.mapping.annotations.Column;
-import com.datastax.driver.mapping.annotations.Enumerated;
import com.datastax.driver.mapping.annotations.Frozen;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
@@ -62,7 +61,6 @@ public class EntitlementPoolEntity implements VersionableEntity {
private Integer thresholdValue;
@Column(name = "threshold_unit")
- @Enumerated
private ThresholdUnit thresholdUnit;
private String increments;
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java
index 3f51a2eeca..06c691293c 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java
@@ -22,7 +22,6 @@ package org.openecomp.sdc.vendorlicense.dao.types;
import com.datastax.driver.mapping.annotations.ClusteringColumn;
import com.datastax.driver.mapping.annotations.Column;
-import com.datastax.driver.mapping.annotations.Enumerated;
import com.datastax.driver.mapping.annotations.Frozen;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
@@ -56,7 +55,6 @@ public class LicenseKeyGroupEntity implements VersionableEntity {
private String id;
private String name;
private String description;
- @Enumerated
private LicenseKeyType type;
@Column(name = "operational_scope")
@Frozen
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/EntitlementPoolCassandraDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/EntitlementPoolCassandraDaoImpl.java
deleted file mode 100644
index ac43ed19fe..0000000000
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/EntitlementPoolCassandraDaoImpl.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright © 2016-2018 European Support Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.openecomp.sdc.vendorlicense.dao.impl;
-
-import com.datastax.driver.core.ResultSet;
-import com.datastax.driver.core.UDTValue;
-import com.datastax.driver.mapping.Mapper;
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.UDTMapper;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Set;
-import org.openecomp.core.dao.impl.CassandraBaseDao;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.core.utilities.CommonMethods;
-import org.openecomp.sdc.vendorlicense.VendorLicenseConstants;
-import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDao;
-import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
-import org.openecomp.sdc.versioning.ActionVersioningManagerFactory;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.UniqueValueMetadata;
-import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
-
-public class EntitlementPoolCassandraDaoImpl extends CassandraBaseDao<EntitlementPoolEntity>
- implements EntitlementPoolDao {
-
- private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static Mapper<EntitlementPoolEntity> mapper =
- noSqlDb.getMappingManager().mapper(EntitlementPoolEntity.class);
- private static EntitlementPoolAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(EntitlementPoolAccessor.class);
- private static UDTMapper<Version> versionMapper =
- noSqlDb.getMappingManager().udtMapper(Version.class);
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- VersionableEntityMetadata metadata = new VersionableEntityMetadata(
- mapper.getTableMetadata().getName(),
- mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName());
-
- metadata.setUniqueValuesMetadata(Collections.singletonList(
- new UniqueValueMetadata(VendorLicenseConstants.UniqueValues.ENTITLEMENT_POOL_NAME,
- Arrays.asList(mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName(), "name"))));
-
- ActionVersioningManagerFactory.getInstance().createInterface()
- .register(versionableEntityType, metadata);
- }
-
- @Override
- protected Mapper<EntitlementPoolEntity> getMapper() {
- return mapper;
- }
-
- @Override
- protected Object[] getKeys(EntitlementPoolEntity entity) {
- return new Object[]{entity.getVendorLicenseModelId(), versionMapper.toUDT(entity.getVersion()),
- entity.getId()};
- }
-
- @Override
- public String getManufacturerReferenceNumber(EntitlementPoolEntity entitlementPoolEntity) {
- return null;
- }
-
- @Override
- public Collection<EntitlementPoolEntity> list(EntitlementPoolEntity entity) {
- return accessor.listByVlmVersion(entity.getVendorLicenseModelId(),
- versionMapper.toUDT(entity.getVersion())).all();
- }
-
- @Override
- public long count(EntitlementPoolEntity entity) {
- return accessor.countByVlmVersion(entity.getVendorLicenseModelId(),
- versionMapper.toUDT(entity.getVersion())).one().getLong("count");
- }
-
- @Override
- public void deleteAll(EntitlementPoolEntity entity) {
- accessor.deleteByVlmVersion(entity.getVendorLicenseModelId(),
- versionMapper.toUDT(entity.getVersion())).all();
- }
-
- @Override
- public void addReferencingFeatureGroup(EntitlementPoolEntity entity,
- String referencingFeatureGroupId) {
- accessor
- .addReferencingFeatureGroups(CommonMethods.toSingleElementSet(referencingFeatureGroupId),
- entity.getVendorLicenseModelId(), versionMapper.toUDT(entity.getVersion()),
- entity.getId());
- }
-
- @Override
- public void removeReferencingFeatureGroup(EntitlementPoolEntity entity,
- String referencingFeatureGroupId) {
- accessor
- .removeReferencingFeatureGroups(CommonMethods.toSingleElementSet(referencingFeatureGroupId),
- entity.getVendorLicenseModelId(), versionMapper.toUDT(entity.getVersion()),
- entity.getId());
- }
-
- @Accessor
- interface EntitlementPoolAccessor {
-
- @Query("select * from entitlement_pool where vlm_id=? AND version=?")
- Result<EntitlementPoolEntity> listByVlmVersion(String vendorLicenseModelId,
- UDTValue vendorLicenseModelVersion);
-
- @Query("delete from entitlement_pool where vlm_id=? AND version=?")
- ResultSet deleteByVlmVersion(String vendorLicenseModelId, UDTValue vendorLicenseModelVersion);
-
- @Query("select count(1) from entitlement_pool where vlm_id=? AND version=?")
- ResultSet countByVlmVersion(String vendorLicenseModelId, UDTValue vendorLicenseModelVersion);
-
- @Query(
- "UPDATE entitlement_pool SET ref_fg_ids = ref_fg_ids + ? WHERE vlm_id=? AND version=? "
- + " AND ep_id=?")
- ResultSet addReferencingFeatureGroups(Set<String> referencingFeatureGroups,
- String vendorLicenseModelId,
- UDTValue vendorLicenseModelVersion, String id);
-
- @Query(
- "UPDATE entitlement_pool SET ref_fg_ids = ref_fg_ids - ? WHERE vlm_id=? AND version=? "
- + "AND ep_id=?")
- ResultSet removeReferencingFeatureGroups(Set<String> referencingFeatureGroups,
- String vendorLicenseModelId,
- UDTValue vendorLicenseModelVersion, String id);
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/FeatureGroupCassandraDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/FeatureGroupCassandraDaoImpl.java
deleted file mode 100644
index 3c804f3bfe..0000000000
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/FeatureGroupCassandraDaoImpl.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright © 2016-2018 European Support Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.openecomp.sdc.vendorlicense.dao.impl;
-
-import static org.openecomp.core.utilities.CommonMethods.toSingleElementSet;
-
-import com.datastax.driver.core.ResultSet;
-import com.datastax.driver.core.UDTValue;
-import com.datastax.driver.mapping.Mapper;
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.UDTMapper;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-import org.openecomp.core.dao.impl.CassandraBaseDao;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.core.utilities.CommonMethods;
-import org.openecomp.sdc.vendorlicense.VendorLicenseConstants;
-import org.openecomp.sdc.vendorlicense.dao.FeatureGroupDao;
-import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
-import org.openecomp.sdc.versioning.ActionVersioningManagerFactory;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.UniqueValueMetadata;
-import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
-
-public class FeatureGroupCassandraDaoImpl extends CassandraBaseDao<FeatureGroupEntity>
- implements FeatureGroupDao {
-
- private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static Mapper<FeatureGroupEntity> mapper =
- noSqlDb.getMappingManager().mapper(FeatureGroupEntity.class);
- private static FeatureGroupAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(FeatureGroupAccessor.class);
- private static UDTMapper<Version> versionMapper =
- noSqlDb.getMappingManager().udtMapper(Version.class);
-
- private static Set<String> emptyIfNull(Set<String> set) {
- return set == null ? new HashSet<>() : set;
- }
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- VersionableEntityMetadata metadata = new VersionableEntityMetadata(
- mapper.getTableMetadata().getName(),
- mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName());
-
- metadata.setUniqueValuesMetadata(Collections.singletonList(
- new UniqueValueMetadata(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME,
- Arrays.asList(mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName(), "name"))));
-
- ActionVersioningManagerFactory.getInstance().createInterface()
- .register(versionableEntityType, metadata);
- }
-
- @Override
- protected Mapper<FeatureGroupEntity> getMapper() {
- return mapper;
- }
-
- @Override
- protected Object[] getKeys(FeatureGroupEntity entity) {
- return new Object[]{entity.getVendorLicenseModelId(), versionMapper.toUDT(entity.getVersion()),
- entity.getId()};
- }
-
- @Override
- public long count(FeatureGroupEntity entity) {
- return accessor.countByVlmVersion(entity.getVendorLicenseModelId(),
- versionMapper.toUDT(entity.getVersion())).one().getLong("count");
- }
-
- @Override
- public void deleteAll(FeatureGroupEntity entity) {
- accessor.deleteByVlmVersion(entity.getVendorLicenseModelId(),
- versionMapper.toUDT(entity.getVersion())).all();
- }
-
- @Override
- public void updateFeatureGroup(FeatureGroupEntity entity,
- Set<String> addedEntitlementPools,
- Set<String> removedEntitlementPools,
- Set<String> addedLicenseKeyGroups,
- Set<String> removedLicenseKeyGroups) {
- accessor.updateColumnsAndDeltaFeatureGroupIds(
- entity.getName(),
- entity.getDescription(),
- entity.getPartNumber(),
- emptyIfNull(addedEntitlementPools),
- emptyIfNull(removedEntitlementPools),
- emptyIfNull(addedLicenseKeyGroups),
- emptyIfNull(removedLicenseKeyGroups),
- entity.getVendorLicenseModelId(),
- versionMapper.toUDT(entity.getVersion()),
- entity.getId()
- );
- }
-
- @Override
- public void addReferencingLicenseAgreement(FeatureGroupEntity entity, String licenseAgreementId) {
- accessor.addReferencingLicenseAgreements(CommonMethods.toSingleElementSet(licenseAgreementId),
- entity.getVendorLicenseModelId(), versionMapper.toUDT(entity.getVersion()), entity.getId());
- }
-
- @Override
- public void removeReferencingLicenseAgreement(FeatureGroupEntity entity,
- String licenseAgreementId) {
- accessor
- .removeReferencingLicenseAgreements(CommonMethods.toSingleElementSet(licenseAgreementId),
- entity.getVendorLicenseModelId(), versionMapper.toUDT(entity.getVersion()),
- entity.getId());
- }
-
- @Override
- public void removeEntitlementPool(FeatureGroupEntity entity, String entitlementPoolId) {
- accessor.removeEntitlementPools(toSingleElementSet(entitlementPoolId),
- entity.getVendorLicenseModelId(), versionMapper.toUDT(entity.getVersion()), entity.getId());
- }
-
- @Override
- public void removeLicenseKeyGroup(FeatureGroupEntity entity, String licenseKeyGroupId) {
- accessor.removeLicenseKeyGroup(toSingleElementSet(licenseKeyGroupId),
- entity.getVendorLicenseModelId(), versionMapper.toUDT(entity.getVersion()), entity.getId());
- }
-
- @Override
- public Collection<FeatureGroupEntity> list(FeatureGroupEntity entity) {
- return accessor.listByVlmVersion(entity.getVendorLicenseModelId(),
- versionMapper.toUDT(entity.getVersion())).all();
- }
-
- @Accessor
- interface FeatureGroupAccessor {
-
- @Query("select * from feature_group where vlm_id=? AND version=?")
- Result<FeatureGroupEntity> listByVlmVersion(String vendorLicenseModelId, UDTValue version);
-
- @Query("select count(1) from feature_group where vlm_id=? AND version=?")
- ResultSet countByVlmVersion(String vendorLicenseModelId, UDTValue vendorLicenseModelVersion);
-
- @Query("delete from feature_group where vlm_id=? AND version=?")
- ResultSet deleteByVlmVersion(String vendorLicenseModelId, UDTValue vendorLicenseModelVersion);
-
- @Query(
- "update feature_group set name=?,description=?, part_num=?, ep_ids=ep_ids+ ?,"
- + "ep_ids=ep_ids-?, lkg_ids=lkg_ids+?,lkg_ids=lkg_ids-? WHERE vlm_id=? AND version=? "
- + "AND fg_id=?")
- ResultSet updateColumnsAndDeltaFeatureGroupIds(String name, String description,
- String partNumber,
- Set<String> addedEntitlementPools,
- Set<String> removedEntitlementPools,
- Set<String> addedLicenseKeyGroups,
- Set<String> removedLicenseKeyGroups,
- String vendorLicenseModelId, UDTValue version,
- String id);
-
- @Query(
- "UPDATE feature_group SET ref_la_ids = ref_la_ids + ? WHERE vlm_id=? AND version=? "
- + "AND fg_id=?")
- ResultSet addReferencingLicenseAgreements(Set<String> licenseAgreementIds,
- String vendorLicenseModelId, UDTValue version,
- String id);
-
- @Query(
- "UPDATE feature_group SET ref_la_ids = ref_la_ids - ? WHERE vlm_id=? AND version=? AND "
- + "fg_id=?")
- ResultSet removeReferencingLicenseAgreements(Set<String> licenseAgreementIds,
- String vendorLicenseModelId, UDTValue version,
- String id);
-
- @Query("UPDATE feature_group SET ep_ids = ep_ids - ? WHERE vlm_id=? AND version=? AND fg_id=?")
- ResultSet removeEntitlementPools(Set<String> entitlementPoolIds, String vendorLicenseModelId,
- UDTValue version, String id);
-
- @Query(
- "UPDATE feature_group SET lkg_ids = lkg_ids - ? WHERE vlm_id=? AND version=? AND fg_id=?")
- ResultSet removeLicenseKeyGroup(Set<String> licenseKeyGroupIds, String vendorLicenseModelId,
- UDTValue version, String id);
-
- }
-}
-
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseAgreementCassandraDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseAgreementCassandraDaoImpl.java
deleted file mode 100644
index 0ba9ca3899..0000000000
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseAgreementCassandraDaoImpl.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright © 2016-2018 European Support Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.openecomp.sdc.vendorlicense.dao.impl;
-
-import com.datastax.driver.core.ResultSet;
-import com.datastax.driver.core.UDTValue;
-import com.datastax.driver.mapping.Mapper;
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.UDTMapper;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-import org.openecomp.core.dao.impl.CassandraBaseDao;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.core.utilities.CommonMethods;
-import org.openecomp.sdc.vendorlicense.VendorLicenseConstants;
-import org.openecomp.sdc.vendorlicense.dao.LicenseAgreementDao;
-import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther;
-import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity;
-import org.openecomp.sdc.versioning.ActionVersioningManagerFactory;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.UniqueValueMetadata;
-import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
-
-
-public class LicenseAgreementCassandraDaoImpl extends CassandraBaseDao<LicenseAgreementEntity>
- implements LicenseAgreementDao {
- private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static Mapper<LicenseAgreementEntity> mapper =
- noSqlDb.getMappingManager().mapper(LicenseAgreementEntity.class);
- private static LicenseAgreementAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(LicenseAgreementAccessor.class);
- private static UDTMapper<ChoiceOrOther> choiceOrOtherMapper =
- noSqlDb.getMappingManager().udtMapper(ChoiceOrOther.class);
- private static UDTMapper<Version> versionMapper =
- noSqlDb.getMappingManager().udtMapper(Version.class);
-
- private static Set<String> emptyIfNull(Set<String> set) {
- return set == null ? new HashSet<>() : set;
- }
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- VersionableEntityMetadata metadata = new VersionableEntityMetadata(
- mapper.getTableMetadata().getName(),
- mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName());
-
- metadata.setUniqueValuesMetadata(Collections.singletonList(
- new UniqueValueMetadata(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME,
- Arrays.asList(mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName(), "name"))));
-
- ActionVersioningManagerFactory.getInstance().createInterface()
- .register(versionableEntityType, metadata);
- }
-
- @Override
- protected Mapper<LicenseAgreementEntity> getMapper() {
- return mapper;
- }
-
- @Override
- protected Object[] getKeys(LicenseAgreementEntity entity) {
- return new Object[]{entity.getVendorLicenseModelId(), versionMapper.toUDT(entity.getVersion()),
- entity.getId()};
- }
-
- @Override
- public Collection<LicenseAgreementEntity> list(LicenseAgreementEntity entity) {
- return accessor.listByVlmVersion(entity.getVendorLicenseModelId(),
- versionMapper.toUDT(entity.getVersion())).all();
- }
-
- @Override
- public long count(LicenseAgreementEntity entity) {
- return accessor.countByVlmVersion(entity.getVendorLicenseModelId(),
- versionMapper.toUDT(entity.getVersion())).one().getLong("count");
- }
-
- @Override
- public void deleteAll(LicenseAgreementEntity entity) {
- accessor.deleteByVlmVersion(entity.getVendorLicenseModelId(),
- versionMapper.toUDT(entity.getVersion())).all();
- }
-
- @Override
- public void removeFeatureGroup(LicenseAgreementEntity licenseAgreement, String featureGroupId) {
- accessor.removeFeatureGroup(CommonMethods.toSingleElementSet(featureGroupId),
- licenseAgreement.getVendorLicenseModelId(),
- versionMapper.toUDT(licenseAgreement.getVersion()), licenseAgreement.getId());
- }
-
- @Override
- public void updateColumnsAndDeltaFeatureGroupIds(LicenseAgreementEntity licenseAgreement,
- Set<String> addedFeatureGroupIds,
- Set<String> removedFeatureGroupIds) {
- accessor.updateColumnsAndDeltaFeatureGroupIds(licenseAgreement.getName(),
- licenseAgreement.getDescription(),
- licenseAgreement.getLicenseTerm() == null ? null
- : choiceOrOtherMapper.toUDT(licenseAgreement.getLicenseTerm()),
- licenseAgreement.getRequirementsAndConstrains(),
- emptyIfNull(addedFeatureGroupIds),
- emptyIfNull(removedFeatureGroupIds),
- licenseAgreement.getVendorLicenseModelId(),
- versionMapper.toUDT(licenseAgreement.getVersion()),
- licenseAgreement.getId());
-
- }
-
- @Accessor
- interface LicenseAgreementAccessor {
-
- @Query("SELECT * FROM license_agreement WHERE vlm_id=? and version=?")
- Result<LicenseAgreementEntity> listByVlmVersion(String vendorLicenseModelId, UDTValue version);
-
- @Query("select count(1) from license_agreement where vlm_id=? AND version=?")
- ResultSet countByVlmVersion(String vendorLicenseModelId, UDTValue vendorLicenseModelVersion);
-
- @Query("delete from license_agreement where vlm_id=? AND version=?")
- ResultSet deleteByVlmVersion(String vendorLicenseModelId, UDTValue vendorLicenseModelVersion);
-
- @Query(
- "UPDATE license_agreement SET name=?, description=?, lic_term=?, req_const=?, "
- + "fg_ids=fg_ids+?, fg_ids=fg_ids-? WHERE vlm_id=? AND version=? AND la_id=?")
- ResultSet updateColumnsAndDeltaFeatureGroupIds(String name, String description,
- UDTValue licenseTerm, String reqAndConst,
- Set<String> addedFeatureGroupIds,
- Set<String> removedFeatureGroupIds,
- String vendorLicenseModelId, UDTValue version,
- String id);
-
- @Query("UPDATE license_agreement SET fg_ids=fg_ids-? WHERE vlm_id=? AND version=? AND la_id=?")
- ResultSet removeFeatureGroup(Set<String> featureGroupIds, String vendorLicenseModelId,
- UDTValue version, String id);
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseKeyGroupCassandraDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseKeyGroupCassandraDaoImpl.java
deleted file mode 100644
index fdd5716472..0000000000
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseKeyGroupCassandraDaoImpl.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright © 2016-2018 European Support Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.openecomp.sdc.vendorlicense.dao.impl;
-
-import com.datastax.driver.core.ResultSet;
-import com.datastax.driver.core.UDTValue;
-import com.datastax.driver.mapping.Mapper;
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.UDTMapper;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Set;
-import org.openecomp.core.dao.impl.CassandraBaseDao;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.core.utilities.CommonMethods;
-import org.openecomp.sdc.vendorlicense.VendorLicenseConstants;
-import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDao;
-import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
-import org.openecomp.sdc.versioning.ActionVersioningManagerFactory;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.UniqueValueMetadata;
-import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
-
-
-public class LicenseKeyGroupCassandraDaoImpl extends CassandraBaseDao<LicenseKeyGroupEntity>
- implements LicenseKeyGroupDao {
- private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static Mapper<LicenseKeyGroupEntity> mapper =
- noSqlDb.getMappingManager().mapper(LicenseKeyGroupEntity.class);
- private static LicenseKeyGroupAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(LicenseKeyGroupAccessor.class);
- private static UDTMapper<Version> versionMapper =
- noSqlDb.getMappingManager().udtMapper(Version.class);
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- VersionableEntityMetadata metadata = new VersionableEntityMetadata(
- mapper.getTableMetadata().getName(),
- mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName());
-
- metadata.setUniqueValuesMetadata(Collections.singletonList(
- new UniqueValueMetadata(VendorLicenseConstants.UniqueValues.LICENSE_KEY_GROUP_NAME,
- Arrays.asList(mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName(), "name"))));
-
- ActionVersioningManagerFactory.getInstance().createInterface()
- .register(versionableEntityType, metadata);
- }
-
- @Override
- protected Mapper<LicenseKeyGroupEntity> getMapper() {
- return mapper;
- }
-
- @Override
- protected Object[] getKeys(LicenseKeyGroupEntity entity) {
- return new Object[]{entity.getVendorLicenseModelId(), versionMapper.toUDT(entity.getVersion()),
- entity.getId()};
- }
-
- @Override
- public Collection<LicenseKeyGroupEntity> list(LicenseKeyGroupEntity entity) {
- return accessor.listByVlmVersion(entity.getVendorLicenseModelId(),
- versionMapper.toUDT(entity.getVersion())).all();
- }
-
- @Override
- public long count(LicenseKeyGroupEntity licenseKeyGroup) {
- return 0;
- }
-
- @Override
- public void deleteAll(LicenseKeyGroupEntity entity) {
- accessor.deleteByVlmVersion(entity.getVendorLicenseModelId(),
- versionMapper.toUDT(entity.getVersion())).all();
- }
-
- @Override
- public void addReferencingFeatureGroup(LicenseKeyGroupEntity entity, String featureGroupId) {
- accessor.addReferencingFeatureGroups(CommonMethods.toSingleElementSet(featureGroupId),
- entity.getVendorLicenseModelId(), versionMapper.toUDT(entity.getVersion()), entity.getId());
- }
-
- @Override
- public void removeReferencingFeatureGroup(LicenseKeyGroupEntity entity, String featureGroupId) {
- accessor.removeReferencingFeatureGroups(CommonMethods.toSingleElementSet(featureGroupId),
- entity.getVendorLicenseModelId(), versionMapper.toUDT(entity.getVersion()), entity.getId());
- }
-
- @Accessor
- interface LicenseKeyGroupAccessor {
- @Query("select * from license_key_group where vlm_id=? and version=?")
- Result<LicenseKeyGroupEntity> listByVlmVersion(String vendorLicenseModelId, UDTValue version);
-
- @Query("delete from license_key_group where vlm_id=? and version=?")
- Result<LicenseKeyGroupEntity> deleteByVlmVersion(String vendorLicenseModelId, UDTValue version);
-
- @Query(
- "UPDATE license_key_group SET ref_fg_ids = ref_fg_ids + ? WHERE vlm_id=? AND version=? "
- + "AND lkg_id=?")
- ResultSet addReferencingFeatureGroups(Set<String> referencingFeatureGroups,
- String vendorLicenseModelId, UDTValue version, String id);
-
- @Query(
- "UPDATE license_key_group SET ref_fg_ids = ref_fg_ids - ? WHERE vlm_id=? AND version=? "
- + "AND lkg_id=?")
- ResultSet removeReferencingFeatureGroups(Set<String> referencingFeatureGroups,
- String vendorLicenseModelId, UDTValue version,
- String id);
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/VendorLicenseModelCassandraDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/VendorLicenseModelCassandraDaoImpl.java
deleted file mode 100644
index 9574dac3d5..0000000000
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/VendorLicenseModelCassandraDaoImpl.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright © 2016-2018 European Support Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.openecomp.sdc.vendorlicense.dao.impl;
-
-import com.datastax.driver.mapping.Mapper;
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.UDTMapper;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import java.util.Collection;
-import org.openecomp.core.dao.impl.CassandraBaseDao;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.vendorlicense.dao.VendorLicenseModelDao;
-import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
-import org.openecomp.sdc.versioning.ActionVersioningManagerFactory;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
-
-public class VendorLicenseModelCassandraDaoImpl extends CassandraBaseDao<VendorLicenseModelEntity>
- implements
- VendorLicenseModelDao {
-
- private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static Mapper<VendorLicenseModelEntity> mapper =
- noSqlDb.getMappingManager().mapper(VendorLicenseModelEntity.class);
- private static VendorLicenseModelAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(VendorLicenseModelAccessor.class);
- private static UDTMapper<Version> versionMapper =
- noSqlDb.getMappingManager().udtMapper(Version.class);
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- ActionVersioningManagerFactory.getInstance().createInterface()
- .register(versionableEntityType, new VersionableEntityMetadata(
- mapper.getTableMetadata().getName(),
- mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName()));
- }
-
- @Override
- protected Mapper<VendorLicenseModelEntity> getMapper() {
- return mapper;
- }
-
- @Override
- protected Object[] getKeys(VendorLicenseModelEntity entity) {
- return new Object[]{entity.getId(), versionMapper.toUDT(entity.getVersion())};
- }
-
- @Override
- public Collection<VendorLicenseModelEntity> list(VendorLicenseModelEntity vendorLicenseModel) {
- return accessor.getAll().all();
- }
-
- @Accessor
- interface VendorLicenseModelAccessor {
-
- @Query("SELECT * FROM vendor_license_model")
- Result<VendorLicenseModelEntity> getAll();
-
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ProcessEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ProcessEntity.java
index 37077a7169..b7d47aa71e 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ProcessEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ProcessEntity.java
@@ -22,7 +22,6 @@ package org.openecomp.sdc.vendorsoftwareproduct.dao.type;
import com.datastax.driver.mapping.annotations.ClusteringColumn;
import com.datastax.driver.mapping.annotations.Column;
-import com.datastax.driver.mapping.annotations.Enumerated;
import com.datastax.driver.mapping.annotations.Frozen;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
@@ -49,7 +48,6 @@ public class ProcessEntity implements VersionableEntity {
private String name;
private String description;
@Column(name = "type")
- @Enumerated
private ProcessType type;
@Column(name = "artifact_name")
private String artifactName;
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoCassandraImpl.java
deleted file mode 100644
index da852a62b4..0000000000
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoCassandraImpl.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright © 2016-2018 European Support Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
-
-import com.datastax.driver.core.ResultSet;
-import com.datastax.driver.core.UDTValue;
-import com.datastax.driver.mapping.Mapper;
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.UDTMapper;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import org.openecomp.core.dao.impl.CassandraBaseDao;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
-import org.openecomp.sdc.versioning.ActionVersioningManagerFactory;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.UniqueValueMetadata;
-import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
-
-public class ComponentDaoCassandraImpl extends CassandraBaseDao<ComponentEntity>
- implements ComponentDao {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final Mapper<ComponentEntity> mapper =
- noSqlDb.getMappingManager().mapper(ComponentEntity.class);
- private static final ComponentAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(ComponentAccessor.class);
- private static final UDTMapper<Version> versionMapper =
- noSqlDb.getMappingManager().udtMapper(Version.class);
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- VersionableEntityMetadata metadata = new VersionableEntityMetadata(
- mapper.getTableMetadata().getName(),
- mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName());
-
-
- metadata.setUniqueValuesMetadata(Collections.singletonList(new UniqueValueMetadata(
- VendorSoftwareProductConstants.UniqueValues.COMPONENT_NAME,
- Arrays.asList(mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName(), "name"))));
-
- ActionVersioningManagerFactory.getInstance().createInterface()
- .register(versionableEntityType, metadata);
- }
-
- @Override
- protected Mapper<ComponentEntity> getMapper() {
- return mapper;
- }
-
- @Override
- protected Object[] getKeys(ComponentEntity entity) {
- return new Object[]{entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
- entity.getId()};
- }
-
- @Override
- public void update(ComponentEntity entity) {
- accessor.updateCompositionData(entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
- entity.getId(), entity.getCompositionData());
- }
-
- @Override
- public Collection<ComponentEntity> list(ComponentEntity entity) {
- return accessor.list(entity.getVspId(), versionMapper.toUDT(entity.getVersion())).all();
- }
-
- @Override
- public ComponentEntity getQuestionnaireData(String vspId, Version version, String componentId) {
- return accessor.getQuestionnaireData(vspId, versionMapper.toUDT(version), componentId);
- }
-
- @Override
- public void updateQuestionnaireData(String vspId, Version version, String componentId,
- String questionnaireData) {
- accessor.updateQuestionnaireData(questionnaireData, vspId, versionMapper.toUDT(version),
- componentId);
- }
-
- @Override
- public Collection<ComponentEntity> listQuestionnaires(String vspId, Version version) {
- return accessor.listQuestionnaires(vspId, versionMapper.toUDT(version)).all();
- }
-
- @Override
- public Collection<ComponentEntity> listCompositionAndQuestionnaire(String vspId,
- Version version) {
- return accessor.listCompositionAndQuestionnaire(vspId, versionMapper.toUDT(version)).all();
- }
-
- @Override
- public void deleteAll(String vspId, Version version) {
- accessor.deleteAll(vspId, version);
- }
-
- @Accessor
- interface ComponentAccessor {
-
- @Query(
- "select vsp_id, version, component_id, composition_data from vsp_component"
- + " where vsp_id=? and version=?")
- Result<ComponentEntity> list(String vspId, UDTValue version);
-
- @Query(
- "select vsp_id, version, component_id, composition_data, questionnaire_data from vsp_component"
- + " where vsp_id=? and version=?")
- Result<ComponentEntity> listCompositionAndQuestionnaire(String vspId, UDTValue version);
-
- @Query(
- "select vsp_id, version, component_id, questionnaire_data from vsp_component"
- + " where vsp_id=? and version=?")
- Result<ComponentEntity> listQuestionnaires(String vspId, UDTValue version);
-
- @Query(
- "select vsp_id, version, component_id, questionnaire_data from vsp_component"
- + " where vsp_id=? and version=? and component_id=?")
- ComponentEntity getQuestionnaireData(String vspId, UDTValue version, String id);
-
- @Query(
- "insert into vsp_component (vsp_id, version, component_id, composition_data)"
- + " values (?,?,?,?)")
- ResultSet updateCompositionData(String vspId, UDTValue version, String id,
- String compositionData);
-
- @Query(
- "update vsp_component set questionnaire_data=? where vsp_id=? and version=?"
- + " and component_id=?")
- ResultSet updateQuestionnaireData(String questionnaireData, String vspId, UDTValue version,
- String id);
-
- @Query("delete from vsp_component where vsp_id=? and version=?")
- ResultSet deleteAll(String vspId, Version version);
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDependencyModelDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDependencyModelDaoCassandraImpl.java
deleted file mode 100644
index 11524ed05f..0000000000
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDependencyModelDaoCassandraImpl.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright © 2016-2018 European Support Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
-
-import com.datastax.driver.core.ResultSet;
-import com.datastax.driver.core.UDTValue;
-import com.datastax.driver.mapping.Mapper;
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.UDTMapper;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import org.openecomp.core.dao.impl.CassandraBaseDao;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDependencyModelDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity;
-import org.openecomp.sdc.versioning.ActionVersioningManagerFactory;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.UniqueValueMetadata;
-import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
-
-public class ComponentDependencyModelDaoCassandraImpl extends
- CassandraBaseDao<ComponentDependencyModelEntity> implements ComponentDependencyModelDao {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final Mapper<ComponentDependencyModelEntity> mapper =
- noSqlDb.getMappingManager().mapper(ComponentDependencyModelEntity.class);
- private static final ComponentDependencyModelDaoCassandraImpl.ComponentDependencyModelAccessor
- accessor = noSqlDb.getMappingManager().createAccessor(
- ComponentDependencyModelDaoCassandraImpl.ComponentDependencyModelAccessor.class);
- private static final UDTMapper<Version> versionMapper =
- noSqlDb.getMappingManager().udtMapper(Version.class);
-
- @Override
- protected Mapper<ComponentDependencyModelEntity> getMapper() {
- return mapper;
- }
-
- @Override
- protected Object[] getKeys(ComponentDependencyModelEntity entity) {
- return new Object[]{entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
- entity.getId()};
- }
-
- @Override
- public Collection<ComponentDependencyModelEntity> list(ComponentDependencyModelEntity entity) {
- return accessor
- .list(entity.getVspId(), versionMapper.toUDT(entity.getVersion())).all();
- }
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- VersionableEntityMetadata metadata = new VersionableEntityMetadata(
- mapper.getTableMetadata().getName(),
- mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName());
-
- metadata.setUniqueValuesMetadata(Collections.singletonList(new UniqueValueMetadata(
- VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME,
- Arrays.asList("vsp_id", "version", "component_id", "name"))));
-
- ActionVersioningManagerFactory.getInstance().createInterface()
- .register(versionableEntityType, metadata);
-
- }
-
- @Accessor
- interface ComponentDependencyModelAccessor {
- @Query("delete from vsp_component_dependency_model where vsp_id=? and version=?")
- ResultSet deleteAll(String vspId, UDTValue version);
-
- @Query(
- "select * from vsp_component_dependency_model where vsp_id=? and version=?")
- Result<ComponentDependencyModelEntity> list(String vspId, UDTValue version);
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComputeDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComputeDaoCassandraImpl.java
deleted file mode 100644
index 4e85ff61c3..0000000000
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComputeDaoCassandraImpl.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright © 2016-2018 European Support Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
-
-import com.datastax.driver.core.ResultSet;
-import com.datastax.driver.core.UDTValue;
-import com.datastax.driver.mapping.Mapper;
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.UDTMapper;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import org.openecomp.core.dao.impl.CassandraBaseDao;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity;
-import org.openecomp.sdc.versioning.ActionVersioningManagerFactory;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.UniqueValueMetadata;
-import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
-
-public class ComputeDaoCassandraImpl extends CassandraBaseDao<ComputeEntity> implements
- ComputeDao {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final Mapper<ComputeEntity> mapper =
- noSqlDb.getMappingManager().mapper(ComputeEntity.class);
- private static final ComputeAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(ComputeDaoCassandraImpl.ComputeAccessor.class);
- private static final UDTMapper<Version> versionMapper =
- noSqlDb.getMappingManager().udtMapper(Version.class);
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- VersionableEntityMetadata metadata = new VersionableEntityMetadata(
- mapper.getTableMetadata().getName(),
- mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName());
-
-
- metadata.setUniqueValuesMetadata(Collections.singletonList(new UniqueValueMetadata(
- VendorSoftwareProductConstants.UniqueValues.COMPUTE_NAME,
- Arrays.asList("vsp_id", "version", "component_id", "name"))));
-
- ActionVersioningManagerFactory.getInstance().createInterface()
- .register(versionableEntityType, metadata);
- }
-
- @Override
- public Collection<ComputeEntity> list(ComputeEntity entity) {
- return accessor.listByComponentId(entity.getVspId(),
- versionMapper.toUDT(entity.getVersion()), entity.getComponentId()).all();
- }
-
- @Override
- protected Mapper<ComputeEntity> getMapper() {
- return mapper;
- }
-
- @Override
- protected Object[] getKeys(ComputeEntity entity) {
- return new Object[]{entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
- entity.getComponentId(), entity.getId()};
- }
-
- @Override
- public Collection<ComputeEntity> listByVsp(String vspId, Version version) {
- return accessor.listByVspId(vspId, versionMapper.toUDT(version)).all();
- }
-
- @Override
- public void update(ComputeEntity entity) {
- accessor.updateCompositionData(entity.getCompositionData(), entity.getVspId(), versionMapper
- .toUDT(entity.getVersion()), entity.getComponentId(), entity.getId());
- }
-
- @Override
- public void updateQuestionnaireData(String vspId, Version version, String componentId,
- String computeId, String questionnaireData) {
- accessor.updateQuestionnaireData(questionnaireData, vspId, versionMapper.toUDT(version),
- componentId, computeId);
- }
-
- @Override
- public void deleteAll(String vspId, Version version) {
- accessor.deleteAll(vspId, version);
- }
-
- @Override
- public ComputeEntity getQuestionnaireData(String vspId, Version version, String componentId,
- String computeId) {
- return null;
- }
-
- @Accessor
- interface ComputeAccessor {
-
- @Query("select * from vsp_component_compute where vsp_id=? and version=? and component_id=?")
- Result<ComputeEntity> listByComponentId(String vspId, UDTValue version, String componentId);
-
- @Query("select * from vsp_component_compute where vsp_id=? and version=?")
- Result<ComputeEntity> listByVspId(String vspId, UDTValue version);
-
- @Query("update vsp_component_compute set composition_data=? where vsp_id=? and version=?"
- + " and component_id=? and compute_id=?")
- ResultSet updateCompositionData(String compositionData, String vspId, UDTValue version,
- String componentId, String computeId);
-
- @Query("update vsp_component_compute set questionnaire_data=? where vsp_id=? and version=?"
- + " and component_id=? and compute_id=?")
- ResultSet updateQuestionnaireData(String questionnaireData, String vspId, UDTValue version,
- String componentId, String computeId);
-
- @Query("delete from vsp_component_compute where vsp_id=? and version=?")
- ResultSet deleteAll(String vspId, Version version);
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/DeploymentFlavorDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/DeploymentFlavorDaoCassandraImpl.java
deleted file mode 100644
index 2a19082005..0000000000
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/DeploymentFlavorDaoCassandraImpl.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright © 2016-2018 European Support Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
-
-import com.datastax.driver.core.ResultSet;
-import com.datastax.driver.core.UDTValue;
-import com.datastax.driver.mapping.Mapper;
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.UDTMapper;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import org.openecomp.core.dao.impl.CassandraBaseDao;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity;
-import org.openecomp.sdc.versioning.ActionVersioningManagerFactory;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.UniqueValueMetadata;
-import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
-
-
-public class DeploymentFlavorDaoCassandraImpl extends CassandraBaseDao<DeploymentFlavorEntity>
- implements DeploymentFlavorDao {
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final Mapper<DeploymentFlavorEntity> mapper =
- noSqlDb.getMappingManager().mapper(DeploymentFlavorEntity.class);
- private static final DeploymentFlavorAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(DeploymentFlavorAccessor.class);
- private static final UDTMapper<Version> versionMapper =
- noSqlDb.getMappingManager().udtMapper(Version.class);
-
- @Override
- protected Mapper<DeploymentFlavorEntity> getMapper() {
- return mapper;
- }
-
- @Override
- protected Object[] getKeys(DeploymentFlavorEntity entity) {
- return new Object[]{entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
- entity.getId()};
- }
-
- @Override
- public Collection<DeploymentFlavorEntity> list(DeploymentFlavorEntity entity) {
- return accessor.list(entity.getVspId(), versionMapper.toUDT(entity.getVersion())).all();
- }
-
- @Override
- public void update(DeploymentFlavorEntity entity) {
- accessor.updateCompositionData(entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
- entity.getId(), entity.getCompositionData());
- }
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- VersionableEntityMetadata metadata = new VersionableEntityMetadata(
- mapper.getTableMetadata().getName(),
- mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName());
-
-
- metadata.setUniqueValuesMetadata(Collections.singletonList(new UniqueValueMetadata(
- VendorSoftwareProductConstants.UniqueValues.DEPLOYMENT_FLAVOR_NAME,
- Arrays.asList(mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName(), "name"))));
-
- ActionVersioningManagerFactory.getInstance().createInterface()
- .register(versionableEntityType, metadata);
- }
-
- @Override
- public void deleteAll(String vspId, Version version) {
- accessor.deleteAll(vspId, version);
- }
-
- @Accessor
- interface DeploymentFlavorAccessor {
- @Query(
- "select vsp_id, version, deployment_flavor_id, composition_data from vsp_deployment_flavor where vsp_id=?"
- + " and version=?")
- Result<DeploymentFlavorEntity> list(String vspId, UDTValue version);
-
- @Query(
- "insert into vsp_deployment_flavor (vsp_id, version, deployment_flavor_id, composition_data) values (?,?,?,?)")
- ResultSet updateCompositionData(String vspId, UDTValue version, String id,
- String compositionData);
-
- @Query("delete from vsp_deployment_flavor where vsp_id=? and version=?")
- ResultSet deleteAll(String vspId, Version version);
-
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ImageDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ImageDaoImpl.java
deleted file mode 100644
index 441f8fbbf9..0000000000
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ImageDaoImpl.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright © 2016-2018 European Support Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
-
-import com.datastax.driver.core.ResultSet;
-import com.datastax.driver.core.UDTValue;
-import com.datastax.driver.mapping.Mapper;
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.UDTMapper;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import org.openecomp.core.dao.impl.CassandraBaseDao;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity;
-import org.openecomp.sdc.versioning.ActionVersioningManagerFactory;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.UniqueValueMetadata;
-import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
-
-public class ImageDaoImpl extends CassandraBaseDao<ImageEntity> implements ImageDao {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final Mapper<ImageEntity> mapper =
- noSqlDb.getMappingManager().mapper(ImageEntity.class);
- private static final ImageAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(ImageAccessor.class);
- private static final UDTMapper<Version> versionMapper =
- noSqlDb.getMappingManager().udtMapper(Version.class);
-
- @Override
- public void registerVersioning(String versionableEntityType) {
-
- VersionableEntityMetadata metadata = new VersionableEntityMetadata(
- mapper.getTableMetadata().getName(),
- mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName());
-
-
- metadata.setUniqueValuesMetadata(Collections.singletonList(new UniqueValueMetadata(
- VendorSoftwareProductConstants.UniqueValues.IMAGE_NAME,
- Arrays.asList("vsp_id", "version", "component_id", "name"))));
-
- ActionVersioningManagerFactory.getInstance().createInterface()
- .register(versionableEntityType, metadata);
- }
-
- @Override
- protected Mapper<ImageEntity> getMapper() {
- return mapper;
- }
-
- @Override
- protected Object[] getKeys(ImageEntity entity) {
- return new Object[]{entity.getVspId(),
- versionMapper.toUDT(entity.getVersion()), entity.getComponentId(), entity.getId() };
- }
-
- @Override
- public Collection<ImageEntity> list(ImageEntity entity) {
- return accessor.list(entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
- entity.getComponentId()).all();
- }
-
- @Override
- public void update(ImageEntity entity) {
- accessor.updateCompositionData(entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
- entity.getComponentId(), entity.getId(), entity.getCompositionData());
- }
-
- @Override
- public void updateQuestionnaireData(String vspId, Version version, String componentId,
- String imageId, String questionnaireData) {
- accessor.updateQuestionnaireData(questionnaireData, vspId, versionMapper.toUDT(version),
- componentId, imageId);
- }
-
- @Override
- public void delete(ImageEntity entity) {
- super.delete(entity);
- }
-
- @Override
- public void deleteByVspId(String vspId, Version version) {
- accessor.deleteByVspId(vspId, versionMapper.toUDT(version));
- }
-
- @Override
- public Collection<ImageEntity> listByVsp(String vspId, Version version) {
- return accessor.listByVspId(vspId, versionMapper.toUDT(version)).all();
- }
-
- @Override
- public ImageEntity getQuestionnaireData(String vspId, Version version, String componentId,
- String computeId) {
- return null;
- }
-
- @Accessor
- interface ImageAccessor {
-
- @Query("select vsp_id, version, component_id, image_id, composition_data from "
- + "vsp_component_image where vsp_id=? and version=? and component_id=?")
- Result<ImageEntity> list(String vspId, UDTValue version, String componentId);
-
- @Query(
- "insert into vsp_component_image (vsp_id, version, component_id, image_id, "
- + "composition_data) values (?,?,?,?,?)")
- ResultSet updateCompositionData(String vspId, UDTValue version, String componentId, String id,
- String compositionData);
-
- @Query("update vsp_component_image set questionnaire_data=? where vsp_id=? and version=?"
- + " and component_id=? and image_id=?")
- ResultSet updateQuestionnaireData(String questionnaireData, String vspId, UDTValue version,
- String componentId, String computeId);
-
- @Query("delete from vsp_component_image where vsp_id=? and version=?")
- ResultSet deleteByVspId(String vspId, UDTValue version);
-
- @Query("select * from vsp_component_image where vsp_id=? and version=?")
- Result<ImageEntity> listByVspId(String vspId, UDTValue version);
-
- }
-
-}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VspMergeDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VspMergeDaoImpl.java
index 3516263fbc..786a2c4ba8 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VspMergeDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VspMergeDaoImpl.java
@@ -8,6 +8,8 @@ import com.amdocs.zusammen.datatypes.item.ElementContext;
import com.amdocs.zusammen.datatypes.item.Resolution;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
+import com.datastax.driver.extras.codecs.enums.EnumNameCodec;
+import com.datastax.driver.mapping.MappingManager;
import com.datastax.driver.mapping.annotations.Accessor;
import com.datastax.driver.mapping.annotations.Query;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
@@ -27,9 +29,14 @@ public class VspMergeDaoImpl implements VspMergeDao {
private static final String VSP_MODEL_NOT_EXIST =
"Vsp model does not exist for Vsp %s, version %s.";
- private static VspMergeHintAccessor accessor =
- NoSqlDbFactory.getInstance().createInterface()
- .getMappingManager().createAccessor(VspMergeHintAccessor.class);
+ private static final VspMergeHintAccessor accessor;
+
+ static {
+ MappingManager mappingManager = NoSqlDbFactory.getInstance().createInterface().getMappingManager();
+ mappingManager.getSession().getCluster().getConfiguration().getCodecRegistry()
+ .register(new EnumNameCodec<>(Resolution.class));
+ accessor = mappingManager.createAccessor(VspMergeHintAccessor.class);
+ }
private ZusammenAdaptor zusammenAdaptor;
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionHistoryDao.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionHistoryDao.java
deleted file mode 100644
index f90265aeb6..0000000000
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionHistoryDao.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.versioning.dao;
-
-import org.openecomp.core.dao.BaseDao;
-import org.openecomp.sdc.versioning.dao.types.VersionHistoryEntity;
-
-public interface VersionHistoryDao extends BaseDao<VersionHistoryEntity> {
-}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionHistoryDaoFactory.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionHistoryDaoFactory.java
deleted file mode 100644
index 9ea8d714b0..0000000000
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionHistoryDaoFactory.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.versioning.dao;
-
-import org.openecomp.core.factory.api.AbstractComponentFactory;
-import org.openecomp.core.factory.api.AbstractFactory;
-
-public abstract class VersionHistoryDaoFactory extends AbstractComponentFactory<VersionHistoryDao> {
- public static VersionHistoryDaoFactory getInstance() {
- return AbstractFactory.getInstance(VersionHistoryDaoFactory.class);
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Version.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Version.java
index 4d4c194972..b822f13c76 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Version.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Version.java
@@ -177,6 +177,7 @@ public class Version {
return new Version(major + 1, 0);
}
+ @Transient
public boolean isFinal() {
return major != 0 && minor == 0;
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoDeletedEntity.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoDeletedEntity.java
index 320c8838f0..fd56b7b50b 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoDeletedEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoDeletedEntity.java
@@ -22,7 +22,6 @@ package org.openecomp.sdc.versioning.dao.types;
import com.datastax.driver.mapping.annotations.ClusteringColumn;
import com.datastax.driver.mapping.annotations.Column;
-import com.datastax.driver.mapping.annotations.Enumerated;
import com.datastax.driver.mapping.annotations.Frozen;
import com.datastax.driver.mapping.annotations.FrozenValue;
import com.datastax.driver.mapping.annotations.PartitionKey;
@@ -46,7 +45,6 @@ public class VersionInfoDeletedEntity {
@Frozen
private Version activeVersion;
- @Enumerated
private VersionStatus status;
@Frozen
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoEntity.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoEntity.java
index 9654c5089e..46baaf461c 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoEntity.java
@@ -22,7 +22,6 @@ package org.openecomp.sdc.versioning.dao.types;
import com.datastax.driver.mapping.annotations.ClusteringColumn;
import com.datastax.driver.mapping.annotations.Column;
-import com.datastax.driver.mapping.annotations.Enumerated;
import com.datastax.driver.mapping.annotations.Frozen;
import com.datastax.driver.mapping.annotations.FrozenValue;
import com.datastax.driver.mapping.annotations.PartitionKey;
@@ -46,7 +45,6 @@ public class VersionInfoEntity {
@Frozen
private Version activeVersion;
- @Enumerated
private VersionStatus status;
@Frozen
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionHistoryCassandraDaoImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionHistoryCassandraDaoImpl.java
deleted file mode 100644
index b364da0772..0000000000
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionHistoryCassandraDaoImpl.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.versioning.dao.impl;
-
-import com.datastax.driver.core.UDTValue;
-import com.datastax.driver.mapping.Mapper;
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.UDTMapper;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import org.openecomp.core.dao.impl.CassandraBaseDao;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.versioning.dao.VersionHistoryDao;
-import org.openecomp.sdc.versioning.dao.types.VersionHistoryEntity;
-import org.openecomp.sdc.versioning.dao.types.VersionableEntityId;
-
-import java.util.Collection;
-
-public class VersionHistoryCassandraDaoImpl extends CassandraBaseDao<VersionHistoryEntity>
- implements
- VersionHistoryDao {
-
- private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static Mapper<VersionHistoryEntity> mapper =
- noSqlDb.getMappingManager().mapper(VersionHistoryEntity.class);
- private static VersionHistoryAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(VersionHistoryAccessor.class);
- private static UDTMapper<VersionableEntityId> versionedEntityIdMapper =
- noSqlDb.getMappingManager().udtMapper(VersionableEntityId.class);
-
- @Override
- protected Mapper<VersionHistoryEntity> getMapper() {
- return mapper;
- }
-
- @Override
- protected Object[] getKeys(VersionHistoryEntity entity) {
- return new Object[]{versionedEntityIdMapper.toUDT(entity.getEntityId())};
- }
-
- @Override
- public Collection<VersionHistoryEntity> list(VersionHistoryEntity entity) {
- return accessor.getAll(versionedEntityIdMapper.toUDT(entity.getEntityId())).all();
- }
-
- @Accessor
- interface VersionHistoryAccessor {
- @Query("select * from version_history where entity_id=?")
- Result<VersionHistoryEntity> getAll(UDTValue entityId);
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionHistoryDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionHistoryDaoFactoryImpl.java
deleted file mode 100644
index ac1c7e9634..0000000000
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionHistoryDaoFactoryImpl.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.versioning.dao.impl;
-
-import org.openecomp.sdc.versioning.dao.VersionHistoryDao;
-import org.openecomp.sdc.versioning.dao.VersionHistoryDaoFactory;
-
-public class VersionHistoryDaoFactoryImpl extends VersionHistoryDaoFactory {
- private static final VersionHistoryDao INSTANCE = new VersionHistoryCassandraDaoImpl();
-
- @Override
- public VersionHistoryDao createInterface() {
- return INSTANCE;
- }
-}
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 0a14c7ae19..19c62ab43c 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
@@ -23,7 +23,6 @@ package org.openecomp.sdc.versioning.dao.impl;
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;
@@ -49,8 +48,6 @@ class VersionableEntityDaoCassandraImpl implements VersionableEntityDao {
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) {
@@ -88,7 +85,7 @@ class VersionableEntityDaoCassandraImpl implements VersionableEntityDao {
for (String columnName : columnNames) {
if (metadata.getVersionIdentifierName().equals(columnName)) {
- columnValues.add(versionMapper.toUDT(newVersion));
+ columnValues.add(newVersion);
columnNameToValue.put(columnName, newVersion.toString());
} else {
Object value = row.getObject(columnName);
@@ -110,7 +107,7 @@ class VersionableEntityDaoCassandraImpl implements VersionableEntityDao {
String deleteCql = String.format("delete from %s where %s=? and %s=?", metadata.getName(),
metadata.getIdentifierName(), metadata.getVersionIdentifierName());
- noSqlDb.execute(deleteCql, entityId, versionMapper.toUDT(versionToDelete));
+ noSqlDb.execute(deleteCql, entityId, versionToDelete);
}
@Override
@@ -127,7 +124,7 @@ class VersionableEntityDaoCassandraImpl implements VersionableEntityDao {
Logger.debug("entityId", entityId);
Logger.debug("version", version);
- return noSqlDb.execute(selectCql, entityId, versionMapper.toUDT(version));
+ return noSqlDb.execute(selectCql, entityId, version);
}
private void initRowUniqueValues(List<UniqueValueMetadata> metadata,