* * Licensed under the Apache License, Version 2.0 (the "License");\r
* * you may not use this file except in compliance with the License.\r
* * You may obtain a copy of the License at\r
- * * \r
+ * *\r
* * http://www.apache.org/licenses/LICENSE-2.0\r
- * * \r
+ * *\r
* * Unless required by applicable law or agreed to in writing, software\r
* * distributed under the License is distributed on an "AS IS" BASIS,\r
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
package org.onap.dmaap.datarouter.provisioning.beans;\r
\r
import java.util.HashSet;\r
+import java.util.Objects;\r
import java.util.Set;\r
\r
import org.json.JSONArray;\r
\r
/**\r
* The representation of a Feed authorization. This encapsulates the authorization information about a feed.\r
+ *\r
* @author Robert Eby\r
* @version $Id: FeedAuthorization.java,v 1.2 2013/06/20 14:11:05 eby Exp $\r
*/\r
public class FeedAuthorization implements JSONable {\r
- private String classification;\r
- private Set<FeedEndpointID> endpoint_ids;\r
- private Set<String> endpoint_addrs;\r
+ private String classification;\r
+ private Set<FeedEndpointID> endpoint_ids;\r
+ private Set<String> endpoint_addrs;\r
+\r
+ public FeedAuthorization() {\r
+ this.classification = "";\r
+ this.endpoint_ids = new HashSet<FeedEndpointID>();\r
+ this.endpoint_addrs = new HashSet<String>();\r
+ }\r
+\r
+ public String getClassification() {\r
+ return classification;\r
+ }\r
+\r
+ public void setClassification(String classification) {\r
+ this.classification = classification;\r
+ }\r
+\r
+ public Set<FeedEndpointID> getEndpoint_ids() {\r
+ return endpoint_ids;\r
+ }\r
+\r
+ public void setEndpoint_ids(Set<FeedEndpointID> endpoint_ids) {\r
+ this.endpoint_ids = endpoint_ids;\r
+ }\r
+\r
+ public Set<String> getEndpoint_addrs() {\r
+ return endpoint_addrs;\r
+ }\r
+\r
+ public void setEndpoint_addrs(Set<String> endpoint_addrs) {\r
+ this.endpoint_addrs = endpoint_addrs;\r
+ }\r
+\r
+ @Override\r
+ public JSONObject asJSONObject() {\r
+ JSONObject jo = new JSONObject();\r
+ jo.put("classification", classification);\r
+ JSONArray ja = new JSONArray();\r
+ for (FeedEndpointID eid : endpoint_ids) {\r
+ ja.put(eid.asJSONObject());\r
+ }\r
+ jo.put("endpoint_ids", ja);\r
+ ja = new JSONArray();\r
+ for (String t : endpoint_addrs) {\r
+ ja.put(t);\r
+ }\r
+ jo.put("endpoint_addrs", ja);\r
+ return jo;\r
+ }\r
\r
- public FeedAuthorization() {\r
- this.classification = "";\r
- this.endpoint_ids = new HashSet<FeedEndpointID>();\r
- this.endpoint_addrs = new HashSet<String>();\r
- }\r
- public String getClassification() {\r
- return classification;\r
- }\r
- public void setClassification(String classification) {\r
- this.classification = classification;\r
- }\r
- public Set<FeedEndpointID> getEndpoint_ids() {\r
- return endpoint_ids;\r
- }\r
- public void setEndpoint_ids(Set<FeedEndpointID> endpoint_ids) {\r
- this.endpoint_ids = endpoint_ids;\r
- }\r
- public Set<String> getEndpoint_addrs() {\r
- return endpoint_addrs;\r
- }\r
- public void setEndpoint_addrs(Set<String> endpoint_addrs) {\r
- this.endpoint_addrs = endpoint_addrs;\r
- }\r
+ @Override\r
+ public boolean equals(Object obj) {\r
+ if (!(obj instanceof FeedAuthorization))\r
+ return false;\r
+ FeedAuthorization of = (FeedAuthorization) obj;\r
+ if (!classification.equals(of.classification))\r
+ return false;\r
+ if (!endpoint_ids.equals(of.endpoint_ids))\r
+ return false;\r
+ if (!endpoint_addrs.equals(of.endpoint_addrs))\r
+ return false;\r
+ return true;\r
+ }\r
\r
- @Override\r
- public JSONObject asJSONObject() {\r
- JSONObject jo = new JSONObject();\r
- jo.put("classification", classification);\r
- JSONArray ja = new JSONArray();\r
- for (FeedEndpointID eid : endpoint_ids) {\r
- ja.put(eid.asJSONObject());\r
- }\r
- jo.put("endpoint_ids", ja);\r
- ja = new JSONArray();\r
- for (String t : endpoint_addrs) {\r
- ja.put(t);\r
- }\r
- jo.put("endpoint_addrs", ja);\r
- return jo;\r
- }\r
- @Override\r
- public boolean equals(Object obj) {\r
- if (!(obj instanceof FeedAuthorization))\r
- return false;\r
- FeedAuthorization of = (FeedAuthorization) obj;\r
- if (!classification.equals(of.classification))\r
- return false;\r
- if (!endpoint_ids.equals(of.endpoint_ids))\r
- return false;\r
- if (!endpoint_addrs.equals(of.endpoint_addrs))\r
- return false;\r
- return true;\r
- }\r
+ @Override\r
+ public int hashCode() {\r
+ return Objects.hash(classification, endpoint_ids, endpoint_addrs);\r
+ }\r
}\r