Test coverage : openecomp-sdc-notification-api
[sdc.git] / openecomp-be / lib / openecomp-sdc-notification-lib / openecomp-sdc-notification-api / src / main / java / org / openecomp / sdc / notification / dao / types / NotificationEntity.java
index 85af302..b45a2a0 100644 (file)
@@ -21,149 +21,49 @@ import com.datastax.driver.mapping.annotations.Column;
 import com.datastax.driver.mapping.annotations.PartitionKey;
 import com.datastax.driver.mapping.annotations.Table;
 
-import java.util.Objects;
 import java.util.UUID;
 
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
 @Table(keyspace = "dox", name = "notifications")
 public class NotificationEntity {
 
-  public static final String ENTITY_TYPE = "Event Notification";
-
-  @PartitionKey
-  @Column(name = "owner_id")
-  private String ownerId;
-
-  @Column(name = "read")
-  private boolean read;
-
-  @ClusteringColumn
-  @Column(name = "event_id")
-  private UUID eventId;
-
-  @Column(name = "event_type")
-  private String eventType;
-
-  @Column(name = "event_attributes")
-  private String eventAttributes;
-
-  @Column(name = "originator_id")
-  private String originatorId;
-
-  /**
-   * Every entity class must have a default constructor according to
-   * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
-   * Definition of mapped classes</a>.
-   */
-  public NotificationEntity() {
-    // Don't delete! Default constructor is required by DataStax driver
-  }
-
-  public NotificationEntity(String ownerId) {
-    this.ownerId = ownerId;
-  }
-
-  /**
-   * Instantiates a new Notification entity.
-   *
-   * @param ownerId      the owner id
-   * @param eventId      the event id
-   * @param eventType    the event type
-   * @param originatorId the originator id
-   */
-  public NotificationEntity(String ownerId, UUID eventId, String eventType, String originatorId, boolean read,
-                            String eventAttributes) {
-    this.ownerId = ownerId;
-    this.read = read;
-    this.eventId = eventId;
-    this.eventType = eventType;
-    this.originatorId = originatorId;
-    this.eventAttributes = eventAttributes;
-  }
-
-  public NotificationEntity(String ownerId, UUID eventId, String eventType, String originatorId) {
-               this(ownerId, eventId, eventType, originatorId, false, null);
-  }
-
-  public NotificationEntity(String ownerId, UUID eventId) {
-               this(ownerId, eventId, null, null);
-  }
-
-  public String getOwnerId() {
-    return ownerId;
-  }
-
-  public void setOwnerId(String ownerId) {
-    this.ownerId = ownerId;
-  }
-
-  public boolean isRead() {
-    return read;
-  }
-
-  public void setRead(boolean read) {
-    this.read = read;
-  }
-
-  public UUID getEventId() {
-    return eventId;
-  }
-
-  public void setEventId(UUID eventId) {
-    this.eventId = eventId;
-  }
-
-  public String getEventType() {
-    return eventType;
-  }
+    public static final String ENTITY_TYPE = "Event Notification";
 
-  public void setEventType(String eventType) {
-    this.eventType = eventType;
-  }
+    @PartitionKey
+    @Column(name = "owner_id")
+    private String ownerId;
 
-  public String getEventAttributes() {
-    return eventAttributes;
-  }
+    @Column(name = "read")
+    private boolean read;
 
-  public void setEventAttributes(String eventAttributes) {
-    this.eventAttributes = eventAttributes;
-  }
+    @ClusteringColumn
+    @Column(name = "event_id")
+    private UUID eventId;
 
-  public String getOriginatorId() {
-    return originatorId;
-  }
+    @Column(name = "event_type")
+    private String eventType;
 
-  public void setOriginatorId(String originatorId) {
-    this.originatorId = originatorId;
-  }
+    @Column(name = "event_attributes")
+    private String eventAttributes;
 
+    @Column(name = "originator_id")
+    private String originatorId;
 
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) return true;
-    if (o == null || getClass() != o.getClass()) return false;
-    NotificationEntity that = (NotificationEntity) o;
-    return read == that.read &&
-            Objects.equals(ownerId, that.ownerId) &&
-            Objects.equals(eventId, that.eventId) &&
-            Objects.equals(eventType, that.eventType) &&
-            Objects.equals(eventAttributes, that.eventAttributes) &&
-            Objects.equals(originatorId, that.originatorId);
-  }
+    public NotificationEntity(String ownerId) {
+        this.ownerId = ownerId;
+    }
 
-  @Override
-  public int hashCode() {
-    return Objects.hash(ownerId, read, eventId, eventType, eventAttributes, originatorId);
-  }
+    public NotificationEntity(String ownerId, UUID eventId, String eventType, String originatorId) {
+        this(ownerId, false, eventId, eventType, null, originatorId);
+    }
 
-  @Override
-  public String toString() {
-    return "NotificationEntity {"
-        + "ownerId='" + ownerId + '\''
-        + ", state='" + (read ? "Read" : "Noread") + '\''
-        + ", originatorId='" + originatorId + '\''
-        + ", eventId='" + eventId + '\''
-        + ", eventType='" + eventType + '\''
-        + ", eventAttributes='" + eventAttributes + '\''
-        + '}';
-  }
+    public NotificationEntity(String ownerId, UUID eventId) {
+        this(ownerId, eventId, null, null);
+    }
 }