779bffa8e768252919cab26a71be9cd91870b39e
[dmaap/datarouter.git] / datarouter-prov / src / main / java / org / onap / dmaap / datarouter / provisioning / beans / FeedLinks.java
1 /*******************************************************************************\r
2  * ============LICENSE_START==================================================\r
3  * * org.onap.dmaap\r
4  * * ===========================================================================\r
5  * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
6  * * ===========================================================================\r
7  * * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * * you may not use this file except in compliance with the License.\r
9  * * You may obtain a copy of the License at\r
10  * *\r
11  *  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  * *\r
13  *  * Unless required by applicable law or agreed to in writing, software\r
14  * * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * * See the License for the specific language governing permissions and\r
17  * * limitations under the License.\r
18  * * ============LICENSE_END====================================================\r
19  * *\r
20  * * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
21  * *\r
22  ******************************************************************************/\r
23 \r
24 \r
25 package org.onap.dmaap.datarouter.provisioning.beans;\r
26 \r
27 import java.io.InvalidObjectException;\r
28 import java.util.Objects;\r
29 \r
30 import org.json.JSONObject;\r
31 \r
32 /**\r
33  * The URLs associated with a Feed.\r
34  *\r
35  * @author Robert Eby\r
36  * @version $Id: FeedLinks.java,v 1.3 2013/07/05 13:48:05 eby Exp $\r
37  */\r
38 \r
39 public class FeedLinks implements JSONable {\r
40     private String self;\r
41     private String publish;\r
42     private String subscribe;\r
43     private String log;\r
44 \r
45     public FeedLinks() {\r
46         self = publish = subscribe = log = null;\r
47     }\r
48 \r
49     /**\r
50      * FeedLinks constructor.\r
51      * @param jo JSONObject\r
52      */\r
53     public FeedLinks(JSONObject jo) {\r
54         this();\r
55         self = jo.getString("self");\r
56         publish = jo.getString("publish");\r
57         subscribe = jo.getString("subscribe");\r
58         log = jo.getString("log");\r
59     }\r
60 \r
61     public String getSelf() {\r
62         return self;\r
63     }\r
64 \r
65     public void setSelf(String self) {\r
66         this.self = self;\r
67     }\r
68 \r
69     public String getPublish() {\r
70         return publish;\r
71     }\r
72 \r
73     public void setPublish(String publish) {\r
74         this.publish = publish;\r
75     }\r
76 \r
77     public String getSubscribe() {\r
78         return subscribe;\r
79     }\r
80 \r
81     public void setSubscribe(String subscribe) {\r
82         this.subscribe = subscribe;\r
83     }\r
84 \r
85     public String getLog() {\r
86         return log;\r
87     }\r
88 \r
89     public void setLog(String log) {\r
90         this.log = log;\r
91     }\r
92 \r
93     @Override\r
94     public JSONObject asJSONObject() {\r
95         JSONObject jo = new JSONObject();\r
96         jo.put("self", self);\r
97         jo.put("publish", publish);\r
98         jo.put("subscribe", subscribe);\r
99         jo.put("log", log);\r
100         return jo;\r
101     }\r
102 \r
103     @Override\r
104     public boolean equals(Object obj) {\r
105         if (!(obj instanceof FeedLinks)) {\r
106             return false;\r
107         }\r
108         FeedLinks of = (FeedLinks) obj;\r
109         if (!self.equals(of.self)) {\r
110             return false;\r
111         }\r
112         if (!publish.equals(of.publish)) {\r
113             return false;\r
114         }\r
115         if (!subscribe.equals(of.subscribe)) {\r
116             return false;\r
117         }\r
118         if (!log.equals(of.log)) {\r
119             return false;\r
120         }\r
121         return true;\r
122     }\r
123 \r
124     @Override\r
125     public int hashCode() {\r
126         return Objects.hash(self, publish, subscribe, log);\r
127     }\r
128 }\r