aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-core/src/main/java
diff options
context:
space:
mode:
authortalig <talig@amdocs.com>2017-12-20 14:30:43 +0200
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2017-12-21 11:12:33 +0000
commit8e9c0653dd6c6862123c9609ae34e1206d86456e (patch)
tree5eeef00ec0677133baa439ca8d7ffd7aca4804b6 /openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-core/src/main/java
parent785ebcc95de3e064e843bec04ba7a209d854fc7c (diff)
Add collaboration feature
Issue-ID: SDC-767 Change-Id: I14fb4c1f54086ed03a56a7ff7fab9ecd40381795 Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-core/src/main/java')
-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.java82
-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/ActivityLogDaoFactoryImpl.java10
2 files changed, 34 insertions, 58 deletions
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 5772cc16b7..85e0afa90f 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
@@ -26,58 +26,34 @@ import org.openecomp.sdc.activitylog.dao.ActivityLogDao;
import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
import java.util.Collection;
-import java.util.Date;
-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);
-
- @Override
- protected Mapper<ActivityLogEntity> getMapper() {
- return mapper;
- }
-
- @Override
- protected Object[] getKeys(ActivityLogEntity entity) {
- return new Object[0];
- }
-
- @Override
- public Collection<ActivityLogEntity> list(ActivityLogEntity entity) {
- return accessor.list().all();
- }
-
- @Override
- public void create(ActivityLogEntity activityLogEntity) {
- accessor.create(activityLogEntity.getItemId(), activityLogEntity.getVersionId(),activityLogEntity.getId(),
- activityLogEntity.getType(),activityLogEntity.getUser(), activityLogEntity.getTimestamp(), activityLogEntity.isSuccess(),
- activityLogEntity.getMessage(), activityLogEntity.getComment());
- }
-
- @Override
- public Collection<ActivityLogEntity> getActivityLogListForItem(String itemId, String versionId) {
- return accessor.getForItem(itemId, versionId).all();
- }
-
-
- @Accessor
- interface ActivityLogAccessor {
- @Query("select item_id, version_id, activity_id, type, user, timestamp, success, message, comment"
- + " from activity_log")
- Result<ActivityLogEntity> list();
-
- @Query("select item_id, version_id, activity_id, type, user, timestamp, success, message, comment"
- + " from activity_log where item_id=? and version_id=?")
- Result<ActivityLogEntity> getForItem(String itemId, String versionId);
-
- @Query("insert into activity_log " +
- " (item_id, version_id, activity_id, type, user, timestamp, success, message, comment)" +
- " values (?,?,?,?,?,?,?,?,?)")
- Result<ActivityLogEntity> create(String itemId, String versionId, String id, String type,
- String user, Date timestamp, boolean success,
- String message, String comment);
- }
+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);
+
+ @Override
+ protected Mapper<ActivityLogEntity> getMapper() {
+ return mapper;
+ }
+
+ @Override
+ protected Object[] getKeys(ActivityLogEntity entity) {
+ return new Object[]{entity.getItemId(), entity.getVersionId(), entity.getId()};
+ }
+
+ @Override
+ public Collection<ActivityLogEntity> list(ActivityLogEntity entity) {
+ return accessor.listByItemVersion(entity.getItemId(), entity.getVersionId()).all();
+ }
+
+ @Accessor
+ interface ActivityLogAccessor {
+
+ @Query("select * from activity_log where item_id=? and version_id=?")
+ Result<ActivityLogEntity> listByItemVersion(String itemId, String 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/ActivityLogDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-core/src/main/java/org/openecomp/sdc/activitylog/dao/impl/ActivityLogDaoFactoryImpl.java
index 98e4cc2ed2..02c8a71b0e 100644
--- a/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-core/src/main/java/org/openecomp/sdc/activitylog/dao/impl/ActivityLogDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-core/src/main/java/org/openecomp/sdc/activitylog/dao/impl/ActivityLogDaoFactoryImpl.java
@@ -19,10 +19,10 @@ import org.openecomp.sdc.activitylog.dao.ActivityLogDao;
import org.openecomp.sdc.activitylog.dao.ActivityLogDaoFactory;
public class ActivityLogDaoFactoryImpl extends ActivityLogDaoFactory {
- private static final ActivityLogDao INSTANCE = new ActivityLogDaoCassandraImpl();
+ private static final ActivityLogDao INSTANCE = new ActivityLogDaoCassandraImpl();
- @Override
- public ActivityLogDao createInterface() {
- return INSTANCE;
- }
+ @Override
+ public ActivityLogDao createInterface() {
+ return INSTANCE;
+ }
}