2 * Copyright © 2016-2017 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.openecomp.sdc.notification.dao.types;
19 import com.datastax.driver.mapping.annotations.Column;
20 import com.datastax.driver.mapping.annotations.PartitionKey;
21 import com.datastax.driver.mapping.annotations.Table;
23 import java.util.Objects;
26 import static java.util.Objects.hash;
28 @Table(keyspace = "dox", name = "notification_subscribers")
29 public class SubscribersEntity {
32 @Column(name = "entity_id")
33 private String entityId;
35 @Column(name = "subscribers")
36 private Set<String> subscribers;
39 * Every entity class must have a default constructor according to
40 * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
41 * Definition of mapped classes</a>.
43 public SubscribersEntity() {
44 // Don't delete! Default constructor is required by DataStax driver
47 public SubscribersEntity(String entityId, Set<String> subscribers) {
48 this.entityId = entityId;
49 this.subscribers = subscribers;
52 public String getEntityId() {
56 public void setEntityId(String entityId) {
57 this.entityId = entityId;
60 public Set<String> getSubscribers() {
64 public void setSubscribers(Set<String> subscribers) {
65 this.subscribers = subscribers;
69 public boolean equals(Object o) {
70 if (this == o) return true;
71 if (o == null || getClass() != o.getClass()) return false;
72 SubscribersEntity that = (SubscribersEntity) o;
73 return Objects.equals(entityId, that.entityId) &&
74 Objects.equals(subscribers, that.subscribers);
78 public int hashCode() {
79 return hash(entityId, subscribers);
83 public String toString() {
84 return "SubscribersEntity{" +
85 "entityId='" + entityId + '\'' +
86 ", subscribers=" + subscribers +