supports multiple Kafka clusters and DBs
[dcaegen2/services.git] / components / datalake-handler / feeder / src / main / java / org / onap / datalake / feeder / domain / TopicName.java
1 /*
2 * ============LICENSE_START=======================================================
3 * ONAP : DataLake
4 * ================================================================================
5 * Copyright 2019 China Mobile
6 *=================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 *     http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
19 */
20 package org.onap.datalake.feeder.domain;
21
22
23 import java.util.Set;
24
25 import javax.persistence.Column;
26 import javax.persistence.Entity;
27 import javax.persistence.FetchType;
28 import javax.persistence.Id;
29 import javax.persistence.OneToMany;
30 import javax.persistence.Table;
31
32 import lombok.Getter;
33 import lombok.Setter;
34
35 /**
36  * Domain class representing unique topic names
37  * 
38  * @author Guobiao Mo
39  *
40  */
41 @Setter
42 @Getter
43 @Entity
44 @Table(name = "topic_name")
45 public class TopicName {
46         @Id     
47         @Column(name = "`id`")
48         private String id;//topic name 
49
50
51         @OneToMany(fetch = FetchType.LAZY, mappedBy = "topicName")
52         protected Set<PortalDesign> designs;
53         
54
55         @OneToMany(fetch = FetchType.LAZY, mappedBy = "topicName")
56         protected Set<Topic> topics;
57         
58         public TopicName() {
59         }
60
61         public TopicName(String name) {
62                 id = name;
63         }
64
65         @Override
66         public String toString() {
67                 return "TopicName "+ id;
68         }
69
70         @Override
71         public boolean equals(Object obj) {
72                 if (obj == null)
73                         return false;
74
75                 if (this.getClass() != obj.getClass())
76                         return false;
77
78                 return id.equals(((TopicName) obj).getId());
79         }
80
81         @Override
82         public int hashCode() {
83                 return id.hashCode();
84         }
85
86 }