You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by rw...@apache.org on 2009/09/02 02:13:17 UTC

svn commit: r810318 - /portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/TransientJetspeedPrincipal.java

Author: rwatler
Date: Wed Sep  2 00:13:17 2009
New Revision: 810318

URL: http://svn.apache.org/viewvc?rev=810318&view=rev
Log:
add equals() and hashCode() for principals

Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/TransientJetspeedPrincipal.java

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/TransientJetspeedPrincipal.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/TransientJetspeedPrincipal.java?rev=810318&r1=810317&r2=810318&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/TransientJetspeedPrincipal.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/TransientJetspeedPrincipal.java Wed Sep  2 00:13:17 2009
@@ -176,4 +176,31 @@
     public void setDomainId(Long domainId){
         this.domainId=domainId;
     }
+    
+    /* (non-Javadoc)
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals(Object o)
+    {
+        if (o == this)
+        {
+            return true;
+        }
+        if (o instanceof JetspeedPrincipal)
+        {
+            JetspeedPrincipal other = (JetspeedPrincipal)o;
+            return (getName().equals(other.getName()) &&
+                    getType().equals(other.getType()) &&
+                    (((getDomainId() != null) ? getDomainId().longValue() : 0L) == ((other.getDomainId() != null) ? other.getDomainId().longValue() : 0L)));
+        }
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#hashCode()
+     */
+    public int hashCode()
+    {
+        return getName().hashCode()^getType().hashCode()^((getDomainId() != null) ? getDomainId().intValue() : 0);
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org