aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-activity-log-lib
diff options
context:
space:
mode:
authortalig <talig@amdocs.com>2018-06-11 12:28:33 +0300
committertalig <talig@amdocs.com>2018-06-11 12:28:43 +0300
commit4dc878ccce1219a78cd64c3bdaee78421c68d11d (patch)
treef03b35d0c3ed9ed87c38de66f2ed4ed459044ba9 /openecomp-be/lib/openecomp-sdc-activity-log-lib
parent907753f90f876574efdc4c4153ef7516e0bcf8b3 (diff)
Upgrade datastax cassandra driver to 3.4.0
Upgrage zusammen to 1.0.0 which uses datastax cassandra driver 3.4.0 Change-Id: Ie7217986b67cd95de015daedd0f7106c2d0a972d Issue-ID: SDC-1416 Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-activity-log-lib')
-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
2 files changed, 18 insertions, 19 deletions
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() {