Release patch 2.0.4
[dmaap/dbcapi.git] / src / main / java / org / onap / dmaap / dbcapi / model / DR_Pub.java
index 06598f7..4e64089 100644 (file)
@@ -24,6 +24,8 @@ import javax.xml.bind.annotation.XmlRootElement;
 
 import org.onap.dmaap.dbcapi.util.RandomString;
 
+import java.util.Objects;
+
 @XmlRootElement
 public class DR_Pub extends DmaapObject {
 
@@ -32,6 +34,10 @@ public class DR_Pub extends DmaapObject {
        private String userpwd;
        private String feedId;
        private String pubId;
+       
+       // NOTE: the following fields are optional in the API but not stored in the DB
+       private String  feedName;
+       private String  feedVersion;
 
        
        public DR_Pub() {
@@ -114,6 +120,22 @@ public class DR_Pub extends DmaapObject {
        public void setNextPubId() {
                this.pubId = this.feedId + "." +  DR_Pub.nextKey();
        }
+       
+       public String getFeedName() {
+               return feedName;
+       }
+
+       public void setFeedName(String feedName) {
+               this.feedName = feedName;
+       }
+
+       public String getFeedVersion() {
+               return feedVersion;
+       }
+
+       public void setFeedVersion(String feedVersion) {
+               this.feedVersion = feedVersion;
+       }
 
        public DR_Pub setRandomUserName() {
                RandomString r = new RandomString(15);
@@ -131,5 +153,35 @@ public class DR_Pub extends DmaapObject {
                return ri.nextString();
                
        }
-       
+
+       @Override
+       public boolean equals(Object o) {
+               if (this == o) return true;
+               if (o == null || getClass() != o.getClass()) return false;
+               DR_Pub dr_pub = (DR_Pub) o;
+               return Objects.equals(dcaeLocationName, dr_pub.dcaeLocationName) &&
+                               Objects.equals(username, dr_pub.username) &&
+                               Objects.equals(userpwd, dr_pub.userpwd) &&
+                               Objects.equals(feedId, dr_pub.feedId) &&
+                               Objects.equals(pubId, dr_pub.pubId);
+       }
+
+       @Override
+       public int hashCode() {
+
+               return Objects.hash(dcaeLocationName, username, userpwd, feedId, pubId);
+       }
+
+       @Override
+       public String toString() {
+               return "DR_Pub{" +
+                               "dcaeLocationName='" + dcaeLocationName + '\'' +
+                               ", username='" + username + '\'' +
+                               ", userpwd='" + userpwd + '\'' +
+                               ", feedId='" + feedId + '\'' +
+                               ", pubId='" + pubId + '\'' +
+                               ", feedName='" + feedName + '\'' +
+                               ", feedVersion='" + feedVersion + '\'' +
+                               '}';
+       }
 }