X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Fdmaap%2Fdbcapi%2Fmodel%2FDR_Sub.java;h=90da95608ac646184022427638c440f55e2a7904;hb=HEAD;hp=9d3002166dbebd40f68c64d08636010aac4de644;hpb=3a647d5a400d5e929b314e10ff99aea9cd779c61;p=dmaap%2Fdbcapi.git diff --git a/src/main/java/org/onap/dmaap/dbcapi/model/DR_Sub.java b/src/main/java/org/onap/dmaap/dbcapi/model/DR_Sub.java index 9d30021..90da956 100644 --- a/src/main/java/org/onap/dmaap/dbcapi/model/DR_Sub.java +++ b/src/main/java/org/onap/dmaap/dbcapi/model/DR_Sub.java @@ -45,7 +45,7 @@ public class DR_Sub extends DmaapObject { private boolean guaranteedDelivery; private boolean guaranteedSequence; private boolean privilegedSubscriber; - private boolean decompressData; + private boolean decompress; // NOTE: the following fields are optional in the API but not stored in the DB @@ -116,9 +116,9 @@ public class DR_Sub extends DmaapObject { this.setPrivilegedSubscriber(false); } try { - this.setDecompressData((boolean) jsonObj.get("decompressData")); + this.setDecompress((boolean) jsonObj.get("decompress")); } catch( NullPointerException npe ) { - this.setDecompressData(false); + this.setDecompress(false); } JSONObject del = (JSONObject) jsonObj.get("delivery"); @@ -239,12 +239,12 @@ public class DR_Sub extends DmaapObject { this.privilegedSubscriber = privilegedSubscriber; } - public boolean isDecompressData() { - return decompressData; + public boolean isDecompress() { + return decompress; } - public void setDecompressData(boolean decompressData) { - this.decompressData = decompressData; + public void setDecompress(boolean decompressData) { + this.decompress = decompressData; } public String getFeedName() { @@ -286,7 +286,7 @@ public class DR_Sub extends DmaapObject { ,"0" ,"true" ,this.isPrivilegedSubscriber() - ,this.isDecompressData() + ,this.isDecompress() ); logger.info( postJSON ); @@ -331,7 +331,7 @@ public class DR_Sub extends DmaapObject { @Override public String toString() { - String rc = String.format ( "DR_Sub: {dcaeLocationName=%s username=%s userpwd=%s feedId=%s deliveryURL=%s logURL=%s subid=%s use100=%s suspended=%s owner=%s}", + return String.format ( "DR_Sub: {dcaeLocationName=%s username=%s userpwd=%s feedId=%s deliveryURL=%s logURL=%s subid=%s use100=%s suspended=%s owner=%s}", dcaeLocationName, username, userpwd, @@ -343,6 +343,49 @@ public class DR_Sub extends DmaapObject { suspended, owner ); - return rc; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + DR_Sub drSub = (DR_Sub) o; + + if (use100 != drSub.use100) { + return false; + } + if (suspended != drSub.suspended) { + return false; + } + if (!dcaeLocationName.equals(drSub.dcaeLocationName)) { + return false; + } + if (!username.equals(drSub.username)) { + return false; + } + if (!userpwd.equals(drSub.userpwd)) { + return false; + } + if (!feedId.equals(drSub.feedId)) { + return false; + } + return subId.equals(drSub.subId); + } + + @Override + public int hashCode() { + int result = dcaeLocationName.hashCode(); + result = 31 * result + username.hashCode(); + result = 31 * result + userpwd.hashCode(); + result = 31 * result + feedId.hashCode(); + result = 31 * result + subId.hashCode(); + result = 31 * result + (use100 ? 1 : 0); + result = 31 * result + (suspended ? 1 : 0); + return result; } }