Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8F17D109DE for ; Wed, 12 Feb 2014 23:10:41 +0000 (UTC) Received: (qmail 80685 invoked by uid 500); 12 Feb 2014 23:10:41 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 80662 invoked by uid 500); 12 Feb 2014 23:10:41 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 80655 invoked by uid 99); 12 Feb 2014 23:10:39 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Feb 2014 23:10:39 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 5E07989D29C; Wed, 12 Feb 2014 23:10:39 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mlsorensen@apache.org To: commits@cloudstack.apache.org Message-Id: <0d997ee546064c05a08a4b24cca92333@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/4.2 to 864d148 Date: Wed, 12 Feb 2014 23:10:39 +0000 (UTC) Updated Branches: refs/heads/4.2 12a013798 -> 864d14857 CLOUDSTACK-6089: Implement equals() method for ResourceTagResponse so that the java Set can properly determine if a ResourceTagResponse is unique. This ensures we don't get duplicate resource tags showing up any time a UserVmResponse is crafted (which can be quite often due to the way the responses are crafted). Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/864d1485 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/864d1485 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/864d1485 Branch: refs/heads/4.2 Commit: 864d148573b58820e9182c1196d0d605a16945d1 Parents: 12a0137 Author: Marcus Sorensen Authored: Wed Feb 12 16:07:34 2014 -0700 Committer: Marcus Sorensen Committed: Wed Feb 12 16:10:27 2014 -0700 ---------------------------------------------------------------------- .../api/response/ResourceTagResponse.java | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/864d1485/api/src/org/apache/cloudstack/api/response/ResourceTagResponse.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/response/ResourceTagResponse.java b/api/src/org/apache/cloudstack/api/response/ResourceTagResponse.java index 47b0625..8044376 100644 --- a/api/src/org/apache/cloudstack/api/response/ResourceTagResponse.java +++ b/api/src/org/apache/cloudstack/api/response/ResourceTagResponse.java @@ -101,4 +101,34 @@ public class ResourceTagResponse extends BaseResponse implements ControlledViewE public void setCustomer(String customer) { this.customer = customer; } + + public String getResourceId() { + return this.resourceId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + String rId = this.getResourceId(); + result = prime * result + ((rId== null) ? 0 : rId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (this.getClass() != obj.getClass()) + return false; + ResourceTagResponse other = (ResourceTagResponse) obj; + String rId = this.getResourceId(); + if (rId == null && other.getResourceId() != null) { + return false; + } else if (!rId.equals(other.getResourceId())) + return false; + return true; + } }