X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Fdmaap%2Fdbcapi%2Fmodel%2FTopic.java;h=c143db8e15e41c29546d810c82dda4c2a4145685;hb=5eeb7b8e6f7c4bbe5da8d08a8145109e2f05329f;hp=7eea5f156c6a3ad572ed45b343016627bf41d70e;hpb=036eaca9ccd55f5c568dff6347da1bcf07e5c61b;p=dmaap%2Fdbcapi.git diff --git a/src/main/java/org/onap/dmaap/dbcapi/model/Topic.java b/src/main/java/org/onap/dmaap/dbcapi/model/Topic.java index 7eea5f1..c143db8 100644 --- a/src/main/java/org/onap/dmaap/dbcapi/model/Topic.java +++ b/src/main/java/org/onap/dmaap/dbcapi/model/Topic.java @@ -20,9 +20,12 @@ package org.onap.dmaap.dbcapi.model; +import com.google.common.base.Objects; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Date; +import java.util.List; + import org.json.simple.*; import org.json.simple.parser.*; import javax.xml.bind.annotation.XmlRootElement; @@ -69,7 +72,7 @@ public class Topic extends DmaapObject { private String subscriberRole; @ApiModelProperty( value="an array of `MR_Client` objects associated to this `Topic`") - private ArrayList clients; + private List clients; @@ -128,7 +131,7 @@ public class Topic extends DmaapObject { public Topic() { super(); - this.clients = new ArrayList(); + this.clients = new ArrayList<>(); this.lastMod = new Date(); this.replicationCase = ReplicationType.Validator("none"); this.setLastMod(); @@ -140,7 +143,6 @@ public class Topic extends DmaapObject { this.fqtn = fqtn; this.topicName = topicName; this.topicDescription = topicDescription; - //this.dcaeLocationName = dcaeLocationName; this.tnxEnabled = tnxEnabled; this.owner = owner; this.init(); @@ -178,7 +180,6 @@ public class Topic extends DmaapObject { this.setTopicName( (String) jsonObj.get( "topicName" ) ); this.setTopicDescription( (String) jsonObj.get( "topicDescription" )); this.setOwner( (String) jsonObj.get( "owner" ) ); - //this.setLastMod(); this.setStatus( (String) jsonObj.get( "status" ) ); this.setReplicationCase( ReplicationType.Validator( (String) jsonObj.get( "replicationCase" ) )); this.setFqtnStyle( FqtnType.Validator( (String) jsonObj.get( "fqtnStyle" ) ) ); @@ -230,11 +231,11 @@ public class Topic extends DmaapObject { } - public void setClients(ArrayList clients) { + public void setClients(List clients) { this.clients = clients; } - public ArrayList getClients() { + public List getClients() { return clients; } @@ -332,4 +333,25 @@ public class Topic extends DmaapObject { public byte[] getBytes() { return toProvJSON().getBytes(StandardCharsets.UTF_8); } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Topic topic = (Topic) o; + return Objects.equal(fqtn, topic.fqtn) && + Objects.equal(topicName, topic.topicName) && + Objects.equal(tnxEnabled, topic.tnxEnabled) && + Objects.equal(owner, topic.owner); + } + + @Override + public int hashCode() { + return Objects.hashCode(fqtn, topicName, tnxEnabled, owner); + } }