Bug 6209 - define equivalence relation on SAMLAttribute
: define equivalence relation on SAMLAttribute
Status: RESOLVED FIXED
: GridShib
Globus Java SAML
: 0.4.2
: All All
: P3 enhancement
: beta
Assigned To:
:
:
:
: 6198
  Show dependency treegraph
 
Reported: 2008-07-07 09:09 by
Modified: 2008-07-07 20:58 (History)


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2008-07-07 09:09:01
Define an equivalence relation on the SAMLAttribute type, which allows a
developer to use the equals method on two SAMLAttribute instances:

import org.globus.opensaml11.saml.SAMLAttribute;
...
SAMLAttribute attribute1, attribute2;
...
if (attribute1.equals(attribute2)) { ... }
------- Comment #1 From 2008-07-07 09:54:26 -------
See Bug 4757 for details how this was done for the SAMLNameIdentifier class.
------- Comment #2 From 2008-07-07 12:35:29 -------
Do attribute values take part in the equivalence relation?

protected boolean localEquals(Object obj) {

    if (this == obj) return true;
    if (!(obj instanceof SAMLAttribute)) return false;

    // type checking occurs in the calling method:
    SAMLAttribute attribute = (SAMLAttribute)obj;

    if (!XML.safeCompare(attribute.name, this.name) ||
        !XML.safeCompare(attribute.namespace, this.namespace)) {
        return false;
    }

    // do the values play any part in the equivalence relation?

    return true;
}
------- Comment #3 From 2008-07-07 17:07:43 -------
Added the following method to the SAMLAttribute API:

/**
 * Compares the values of this object with the values of the
 * given object.  This method returns true if and only if
 * the two objects have the same values.
 *
 * @param obj the object whose values will be compared
 *        to the values of this object
 * @return true if and only if the values associated
 *         with the two objects are equal
 */
public boolean hasEqualValues(Object obj);
------- Comment #4 From 2008-07-07 18:16:44 -------
Committed SAMLAttribute.java to CVS HEAD.  Keeping this bug until
SAMLAttributeTest has been updated and a new globus-opensaml-1.1.jar is
uploaded.