X-Git-Url: https://gerrit.onap.org/r/gitweb?p=dmaap%2Fdatarouter.git;a=blobdiff_plain;f=datarouter-prov%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fdmaap%2Fdatarouter%2Fprovisioning%2Fbeans%2FFeedAuthorization.java;h=fad6a33f7f974e6f3b5970496f7c9148ebb6f88e;hp=49578b86814c78108412eb6f2da0e61300bbc4c5;hb=6c78b3e6a0a67c73f931337356a172cc69cee0e8;hpb=e4b20cc6f7c31f48ddd0de5bcd054b09a35cd510 diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/FeedAuthorization.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/FeedAuthorization.java index 49578b86..fad6a33f 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/FeedAuthorization.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/FeedAuthorization.java @@ -7,9 +7,9 @@ * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at - * * + * * * * http://www.apache.org/licenses/LICENSE-2.0 - * * + * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,6 +25,7 @@ package org.onap.dmaap.datarouter.provisioning.beans; import java.util.HashSet; +import java.util.Objects; import java.util.Set; import org.json.JSONArray; @@ -32,65 +33,86 @@ import org.json.JSONObject; /** * The representation of a Feed authorization. This encapsulates the authorization information about a feed. + * * @author Robert Eby * @version $Id: FeedAuthorization.java,v 1.2 2013/06/20 14:11:05 eby Exp $ */ public class FeedAuthorization implements JSONable { - private String classification; - private Set endpoint_ids; - private Set endpoint_addrs; - - public FeedAuthorization() { - this.classification = ""; - this.endpoint_ids = new HashSet(); - this.endpoint_addrs = new HashSet(); - } - public String getClassification() { - return classification; - } - public void setClassification(String classification) { - this.classification = classification; - } - public Set getEndpoint_ids() { - return endpoint_ids; - } - public void setEndpoint_ids(Set endpoint_ids) { - this.endpoint_ids = endpoint_ids; - } - public Set getEndpoint_addrs() { - return endpoint_addrs; - } - public void setEndpoint_addrs(Set endpoint_addrs) { - this.endpoint_addrs = endpoint_addrs; - } - - @Override - public JSONObject asJSONObject() { - JSONObject jo = new JSONObject(); - jo.put("classification", classification); - JSONArray ja = new JSONArray(); - for (FeedEndpointID eid : endpoint_ids) { - ja.put(eid.asJSONObject()); - } - jo.put("endpoint_ids", ja); - ja = new JSONArray(); - for (String t : endpoint_addrs) { - ja.put(t); - } - jo.put("endpoint_addrs", ja); - return jo; - } - @Override - public boolean equals(Object obj) { - if (!(obj instanceof FeedAuthorization)) - return false; - FeedAuthorization of = (FeedAuthorization) obj; - if (!classification.equals(of.classification)) - return false; - if (!endpoint_ids.equals(of.endpoint_ids)) - return false; - if (!endpoint_addrs.equals(of.endpoint_addrs)) - return false; - return true; - } + + private String classification; + private Set endpointIds; + private Set endpointAddrs; + + /** + * FeedAuthoization constructor. + */ + public FeedAuthorization() { + this.classification = ""; + this.endpointIds = new HashSet<>(); + this.endpointAddrs = new HashSet<>(); + } + + public String getClassification() { + return classification; + } + + public void setClassification(String classification) { + this.classification = classification; + } + + public Set getEndpointIDS() { + return endpointIds; + } + + public void setEndpointIDS(Set endpointIds) { + this.endpointIds = endpointIds; + } + + public Set getEndpointAddrs() { + return endpointAddrs; + } + + public void setEndpointAddrs(Set endpointAddrs) { + this.endpointAddrs = endpointAddrs; + } + + @Override + public JSONObject asJSONObject() { + JSONObject jo = new JSONObject(); + jo.put("classification", classification); + JSONArray ja = new JSONArray(); + for (FeedEndpointID eid : endpointIds) { + ja.put(eid.asJSONObject()); + } + jo.put("endpoint_ids", ja); + ja = new JSONArray(); + for (String t : endpointAddrs) { + ja.put(t); + } + jo.put("endpoint_addrs", ja); + return jo; + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof FeedAuthorization)) { + return false; + } + FeedAuthorization of = (FeedAuthorization) obj; + if (!classification.equals(of.classification)) { + return false; + } + if (!endpointIds.equals(of.endpointIds)) { + return false; + } + if (!endpointAddrs.equals(of.endpointAddrs)) { + return false; + } + return true; + } + + @Override + public int hashCode() { + return Objects.hash(classification, endpointIds, endpointAddrs); + } }