diff options
author | vasraz <vasyl.razinkov@est.tech> | 2021-03-22 15:33:06 +0000 |
---|---|---|
committer | Christophe Closset <christophe.closset@intl.att.com> | 2021-03-24 06:59:47 +0000 |
commit | d378c37fbd1ecec7b43394926f1ca32a695e07de (patch) | |
tree | 5c8a085f8732f980d871d966ac49361644efa698 /openecomp-be/lib/openecomp-sdc-activity-log-lib | |
parent | a6ae7294ecd336d7e88f915710b08e2658eaee00 (diff) |
Reformat openecomp-be
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Issue-ID: SDC-3449
Change-Id: I13e02322f8e00820cc5a1d85752caaeda9bf10d1
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-activity-log-lib')
6 files changed, 67 insertions, 74 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/ActivityLogDao.java b/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-api/src/main/java/org/openecomp/sdc/activitylog/dao/ActivityLogDao.java index 6ca1010a2d..26b2abb794 100644 --- a/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-api/src/main/java/org/openecomp/sdc/activitylog/dao/ActivityLogDao.java +++ b/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-api/src/main/java/org/openecomp/sdc/activitylog/dao/ActivityLogDao.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.openecomp.sdc.activitylog.dao; import org.openecomp.core.dao.BaseDao; import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity; public interface ActivityLogDao extends BaseDao<ActivityLogEntity> { + } diff --git a/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-api/src/main/java/org/openecomp/sdc/activitylog/dao/ActivityLogDaoFactory.java b/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-api/src/main/java/org/openecomp/sdc/activitylog/dao/ActivityLogDaoFactory.java index 1fc7de7cbc..9b8ea62d7d 100644 --- a/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-api/src/main/java/org/openecomp/sdc/activitylog/dao/ActivityLogDaoFactory.java +++ b/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-api/src/main/java/org/openecomp/sdc/activitylog/dao/ActivityLogDaoFactory.java @@ -18,8 +18,8 @@ package org.openecomp.sdc.activitylog.dao; import org.openecomp.core.factory.api.AbstractComponentFactory; import org.openecomp.core.factory.api.AbstractFactory; - public abstract class ActivityLogDaoFactory extends AbstractComponentFactory<ActivityLogDao> { + public static ActivityLogDaoFactory getInstance() { return AbstractFactory.getInstance(ActivityLogDaoFactory.class); } 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 f878bea2df..6b4ece08db 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 @@ -13,54 +13,52 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - 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.PartitionKey; import com.datastax.driver.mapping.annotations.Table; +import java.util.Date; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import org.openecomp.sdc.versioning.dao.types.Version; -import java.util.Date; - @Getter @Setter @NoArgsConstructor @Table(keyspace = "dox", name = "activity_log") public class ActivityLogEntity { - @PartitionKey - @Column(name = "item_id") - private String itemId; - @ClusteringColumn(value = 1) - @Column(name = "version_id") - private String versionId; - @ClusteringColumn - @Column(name = "activity_id") - private String id; - private ActivityType type; - private String user; - private Date timestamp; - private boolean success; - private String message; - private String comment; - public ActivityLogEntity(String itemId, Version version) { - this.itemId = itemId; - this.versionId = version == null ? null : version.getId(); - } + @PartitionKey + @Column(name = "item_id") + private String itemId; + @ClusteringColumn(value = 1) + @Column(name = "version_id") + private String versionId; + @ClusteringColumn + @Column(name = "activity_id") + private String id; + private ActivityType type; + private String user; + private Date timestamp; + private boolean success; + private String message; + private String comment; + + public ActivityLogEntity(String itemId, Version version) { + this.itemId = itemId; + this.versionId = version == null ? null : version.getId(); + } - public ActivityLogEntity(String itemId, Version version, ActivityType type, String user, - boolean success, String message, String comment) { - this(itemId, version); - this.type = type; - this.user = user; - this.success = success; - this.message = message; - this.comment = comment; - this.timestamp = new Date(); - } + public ActivityLogEntity(String itemId, Version version, ActivityType type, String user, boolean success, String message, String comment) { + this(itemId, version); + this.type = type; + this.user = user; + this.success = success; + this.message = message; + this.comment = comment; + this.timestamp = new Date(); + } } 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/ActivityType.java b/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-api/src/main/java/org/openecomp/sdc/activitylog/dao/type/ActivityType.java index 7b2cd9ff54..5566d2b788 100644 --- a/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-api/src/main/java/org/openecomp/sdc/activitylog/dao/type/ActivityType.java +++ b/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-api/src/main/java/org/openecomp/sdc/activitylog/dao/type/ActivityType.java @@ -7,9 +7,9 @@ * 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. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.activitylog.dao.type; public enum ActivityType { @@ -31,5 +30,4 @@ public enum ActivityType { Upload_Network_Package, Revert, Reset - } 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 e6dd5a6d3b..0eae247869 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 @@ -21,48 +21,44 @@ 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.factory.NoSqlDbFactory; import org.openecomp.sdc.activitylog.dao.ActivityLogDao; import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity; import org.openecomp.sdc.activitylog.dao.type.ActivityType; -import java.util.Collection; - -public class ActivityLogDaoCassandraImpl extends CassandraBaseDao<ActivityLogEntity> - implements ActivityLogDao { - - private static final Mapper<ActivityLogEntity> mapper; - private static final ActivityLogAccessor accessor; +public class ActivityLogDaoCassandraImpl extends CassandraBaseDao<ActivityLogEntity> implements ActivityLogDao { - static { - MappingManager mappingManager = NoSqlDbFactory.getInstance().createInterface().getMappingManager(); - mappingManager.getSession().getCluster().getConfiguration().getCodecRegistry() - .register(new EnumNameCodec<>(ActivityType.class)); + private static final Mapper<ActivityLogEntity> mapper; + private static final ActivityLogAccessor accessor; - mapper = mappingManager.mapper(ActivityLogEntity.class); - accessor = mappingManager.createAccessor(ActivityLogAccessor.class); - } + 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() { - return mapper; - } + @Override + protected Mapper<ActivityLogEntity> getMapper() { + return mapper; + } - @Override - protected Object[] getKeys(ActivityLogEntity entity) { - return new Object[]{entity.getItemId(), entity.getVersionId(), entity.getId()}; - } + @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(); - } + @Override + public Collection<ActivityLogEntity> list(ActivityLogEntity entity) { + return accessor.listByItemVersion(entity.getItemId(), entity.getVersionId()).all(); + } - @Accessor - interface ActivityLogAccessor { + @Accessor + interface ActivityLogAccessor { - @Query("select * from activity_log where item_id=? and version_id=?") - Result<ActivityLogEntity> listByItemVersion(String itemId, String versionId); - } + @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 02c8a71b0e..0da29828e2 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,11 @@ 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(); - @Override - public ActivityLogDao createInterface() { - return INSTANCE; - } + private static final ActivityLogDao INSTANCE = new ActivityLogDaoCassandraImpl(); + + @Override + public ActivityLogDao createInterface() { + return INSTANCE; + } } |