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;
+import lombok.ToString;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
@Table(keyspace = "dox", name = "last_notification")
public class LastSeenNotificationEntity {
- public static final String ENTITY_TYPE = "Event Notification";
-
- @PartitionKey
- @Column(name = "owner_id")
- private String ownerId;
-
- @Column(name = "event_id")
- private UUID lastEventId;
-
- /**
- * 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 LastSeenNotificationEntity() {
- // Don't delete! Default constructor is required by DataStax driver
- }
-
- /**
- * Instantiates a new Notification entity.
- *
- * @param ownerId the owner id
- * @param lastEventId the last event id
- */
- public LastSeenNotificationEntity(String ownerId, UUID lastEventId) {
- this.ownerId = ownerId;
- this.lastEventId = lastEventId;
- }
-
- public String getOwnerId() {
- return ownerId;
- }
-
- public void setOwnerId(String ownerId) {
- this.ownerId = ownerId;
- }
-
- public UUID getLastEventId() {
- return lastEventId;
- }
-
- public void setLastEventId(UUID lastEventId) {
- this.lastEventId = lastEventId;
- }
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- LastSeenNotificationEntity that = (LastSeenNotificationEntity) o;
- return Objects.equals(ownerId, that.ownerId) &&
- Objects.equals(lastEventId, that.lastEventId);
- }
+ public static final String ENTITY_TYPE = "Event Notification";
- @Override
- public int hashCode() {
- return Objects.hash(ownerId, lastEventId);
- }
+ @PartitionKey
+ @Column(name = "owner_id")
+ private String ownerId;
- @Override
- public String toString() {
- return "LastSeenNotificationEntity {"
- + "ownerId='" + ownerId + '\''
- + '}';
- }
+ @Column(name = "event_id")
+ private UUID lastEventId;
}
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);
+ }
}
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
-import java.util.Objects;
import java.util.Set;
-import static java.util.Objects.hash;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
@Table(keyspace = "dox", name = "notification_subscribers")
public class SubscribersEntity {
@Column(name = "subscribers")
private Set<String> subscribers;
-
- /**
- * 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 SubscribersEntity() {
- // Don't delete! Default constructor is required by DataStax driver
- }
-
- public SubscribersEntity(String entityId, Set<String> subscribers) {
- this.entityId = entityId;
- this.subscribers = subscribers;
- }
-
- public String getEntityId() {
- return entityId;
- }
-
- public void setEntityId(String entityId) {
- this.entityId = entityId;
- }
-
- public Set<String> getSubscribers() {
- return subscribers;
- }
-
- public void setSubscribers(Set<String> subscribers) {
- this.subscribers = subscribers;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- SubscribersEntity that = (SubscribersEntity) o;
- return Objects.equals(entityId, that.entityId) &&
- Objects.equals(subscribers, that.subscribers);
- }
-
- @Override
- public int hashCode() {
- return hash(entityId, subscribers);
- }
-
- @Override
- public String toString() {
- return "SubscribersEntity{" +
- "entityId='" + entityId + '\'' +
- ", subscribers=" + subscribers +
- '}';
- }
}