Search in sources :

Example 26 with EqualsBuilder

use of org.apache.commons.lang3.builder.EqualsBuilder in project cas by apereo.

the class GoogleAccountsServiceResponseBuilder method equals.

@Override
public boolean equals(final Object obj) {
    if (obj == null) {
        return false;
    }
    if (obj == this) {
        return true;
    }
    if (obj.getClass() != getClass()) {
        return false;
    }
    final GoogleAccountsServiceResponseBuilder rhs = (GoogleAccountsServiceResponseBuilder) obj;
    final EqualsBuilder builder = new EqualsBuilder();
    return builder.appendSuper(super.equals(obj)).append(this.publicKeyLocation, rhs.publicKeyLocation).append(this.privateKeyLocation, rhs.privateKeyLocation).append(this.keyAlgorithm, rhs.keyAlgorithm).append(this.samlObjectBuilder, rhs.samlObjectBuilder).append(this.skewAllowance, rhs.skewAllowance).isEquals();
}
Also used : EqualsBuilder(org.apache.commons.lang3.builder.EqualsBuilder)

Example 27 with EqualsBuilder

use of org.apache.commons.lang3.builder.EqualsBuilder in project cas by apereo.

the class U2FTokenCredential method equals.

@Override
public boolean equals(final Object obj) {
    if (!(obj instanceof U2FTokenCredential)) {
        return false;
    }
    if (obj == this) {
        return true;
    }
    final U2FTokenCredential other = (U2FTokenCredential) obj;
    final EqualsBuilder builder = new EqualsBuilder();
    builder.append(this.token, other.token);
    return builder.isEquals();
}
Also used : EqualsBuilder(org.apache.commons.lang3.builder.EqualsBuilder)

Example 28 with EqualsBuilder

use of org.apache.commons.lang3.builder.EqualsBuilder in project cas by apereo.

the class AbstractCasWebflowEventResolver method areAuthenticationsEssentiallyEqual.

private boolean areAuthenticationsEssentiallyEqual(final Authentication auth1, final Authentication auth2) {
    if ((auth1 == null && auth2 != null) || (auth1 != null && auth2 == null)) {
        return false;
    }
    final EqualsBuilder builder = new EqualsBuilder();
    builder.append(auth1.getPrincipal(), auth2.getPrincipal());
    builder.append(auth1.getCredentials(), auth2.getCredentials());
    builder.append(auth1.getSuccesses(), auth2.getSuccesses());
    builder.append(auth1.getAttributes(), auth2.getAttributes());
    return builder.isEquals();
}
Also used : EqualsBuilder(org.apache.commons.lang3.builder.EqualsBuilder)

Example 29 with EqualsBuilder

use of org.apache.commons.lang3.builder.EqualsBuilder in project knime-core by knime.

the class SubnodeViewValue method equals.

/**
 * {@inheritDoc}
 */
@Override
public boolean equals(final Object obj) {
    if (obj == null) {
        return false;
    }
    if (obj == this) {
        return true;
    }
    if (obj.getClass() != getClass()) {
        return false;
    }
    SubnodeViewValue other = (SubnodeViewValue) obj;
    if (!m_viewValues.keySet().equals(other.m_viewValues.keySet())) {
        return false;
    }
    EqualsBuilder builder = new EqualsBuilder();
    ObjectMapper mapper = new ObjectMapper();
    for (String key : m_viewValues.keySet()) {
        try {
            // try deserializing and comparing generic JSON objects
            JsonNode first = mapper.readTree(m_viewValues.get(key));
            JsonNode second = mapper.readTree(other.m_viewValues.get(key));
            // the following would be better but concrete view classes might not be visible here
            /*JSONViewContent first = mapper.readValue(m_viewValues.get(key), JSONViewContent.class);
                JSONViewContent second = mapper.readValue(other.m_viewValues.get(key), JSONViewContent.class);*/
            builder.append(first, second);
        } catch (Exception e) {
            LOGGER.debug("Can't compare JsonNode in #equals", e);
            // compare strings on exception
            builder.append(m_viewValues.get(key), other.m_viewValues.get(key));
        }
    }
    return builder.isEquals();
}
Also used : EqualsBuilder(org.apache.commons.lang3.builder.EqualsBuilder) JsonNode(com.fasterxml.jackson.databind.JsonNode) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException)

Example 30 with EqualsBuilder

use of org.apache.commons.lang3.builder.EqualsBuilder in project CzechIdMng by bcvsolutions.

the class AbstractEntity method equals.

/**
 * Based on entity identifier
 */
public boolean equals(final Object o) {
    if (!(o instanceof AbstractEntity)) {
        return false;
    }
    AbstractEntity that = (AbstractEntity) o;
    EqualsBuilder builder = new EqualsBuilder();
    if (id == null && that.id == null) {
        builder.appendSuper(super.equals(o));
    }
    return builder.append(id, that.id).isEquals();
}
Also used : EqualsBuilder(org.apache.commons.lang3.builder.EqualsBuilder)

Aggregations

EqualsBuilder (org.apache.commons.lang3.builder.EqualsBuilder)34 lombok.val (lombok.val)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Credential (org.apereo.cas.authentication.Credential)1 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)1