Example usage for org.apache.commons.lang3.builder EqualsBuilder isEquals

List of usage examples for org.apache.commons.lang3.builder EqualsBuilder isEquals

Introduction

In this page you can find the example usage for org.apache.commons.lang3.builder EqualsBuilder isEquals.

Prototype

boolean isEquals

To view the source code for org.apache.commons.lang3.builder EqualsBuilder isEquals.

Click Source Link

Document

If the fields tested are equals.

Usage

From source file:org.silverpeas.components.suggestionbox.model.SuggestionMatcher.java

@Override
public boolean matches(final Object item) {
    boolean match = false;
    if (item instanceof Suggestion) {
        final Suggestion actual = (Suggestion) item;
        final EqualsBuilder matcher = new EqualsBuilder();

        if (expected.containsKey(PROPERTY.ID)) {
            matcher.append(actual.getId(), expected.get(PROPERTY.ID));
        }//w ww.  j  a v a2 s  . c  o  m

        if (expected.containsKey(PROPERTY.TITLE)) {
            matcher.append(actual.getTitle(), expected.get(PROPERTY.TITLE));
        }

        if (expected.containsKey(PROPERTY.STATUS)) {
            matcher.append(actual.getValidation().getStatus(), expected.get(PROPERTY.STATUS));
        }

        if (expected.containsKey(PROPERTY.LAST_UPDATE_DATE)) {
            if (expected.get(PROPERTY.LAST_UPDATE_DATE) == null) {
                matcher.appendSuper(actual.getLastUpdateDate() == null);
            } else {
                matcher.appendSuper(actual.getLastUpdateDate() != null && actual.getLastUpdateDate()
                        .compareTo((Date) expected.get(PROPERTY.LAST_UPDATE_DATE)) == 0);
            }
        }

        match = matcher.isEquals();
    }
    return match;
}

From source file:org.silverpeas.components.suggestionbox.web.SuggestionMatcher.java

@Override
protected boolean matchesSafely(SuggestionEntity actual) {
    final EqualsBuilder matcher = new EqualsBuilder();
    matcher.append(actual.getId(), expected.getId());
    matcher.append(actual.getTitle(), expected.getTitle());
    matcher.append(actual.getContent(), expected.getContent());
    matcher.append(actual.getValidation().getStatus(), expected.getValidation().getStatus());
    return matcher.isEquals();
}

From source file:org.silverpeas.core.io.media.Definition.java

@Override
public boolean equals(final Object obj) {
    if (obj == null) {
        return false;
    }//from w w w  .j a  v a  2 s.c  o  m
    if (super.equals(obj)) {
        return true;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final Definition other = (Definition) obj;
    EqualsBuilder matcher = new EqualsBuilder();
    matcher.append(getWidth(), other.getWidth());
    matcher.append(getHeight(), other.getHeight());
    return matcher.isEquals();
}

From source file:org.silverpeas.core.notification.message.AbstractMessage.java

@Override
public boolean equals(final Object obj) {
    if (obj == null) {
        return false;
    }//from ww w .j a v a 2s.co m
    if (getClass() != obj.getClass()) {
        return false;
    }
    final Message other = (Message) obj;
    EqualsBuilder matcher = new EqualsBuilder();
    matcher.append(getType(), other.getType());
    matcher.append(getContent(), other.getContent());
    matcher.append(getDisplayLiveTime(), other.getDisplayLiveTime());
    return matcher.isEquals();
}

From source file:org.silverpeas.core.persistence.datasource.model.AbstractEntity.java

@SuppressWarnings("unchecked")
@Override//from   w  w w . j a v  a 2s  .com
public final boolean equals(Object obj) {
    if (obj == null) {
        return false;
    }
    if (super.equals(obj)) {
        return true;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final ENTITY other = (ENTITY) obj;
    if (getId() != null && other.getId() != null) {
        EqualsBuilder matcher = new EqualsBuilder();
        matcher.append(getId(), other.getId());
        return matcher.isEquals();
    }
    return false;
}

From source file:org.silverpeas.core.persistence.datasource.model.jpa.AbstractJpaEntity.java

@SuppressWarnings("unchecked")
@Override/*from w  w  w.j a v  a2  s .  c  o m*/
public boolean equals(Object obj) {
    if (obj == null) {
        return false;
    }
    if (super.equals(obj)) {
        return true;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final T other = (T) obj;
    if (getId() != null && other.getId() != null) {
        EqualsBuilder matcher = new EqualsBuilder();
        matcher.append(getId(), other.getId());
        return matcher.isEquals();
    }
    return false;
}

From source file:org.silverpeas.core.persistence.datasource.model.jpa.SilverpeasJpaEntity.java

@SuppressWarnings("unchecked")
@Override/*www  .j  a va  2s .  c om*/
public boolean equals(Object obj) {
    if (obj == null) {
        return false;
    }
    if (super.equals(obj)) {
        return true;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final E other = (E) obj;
    if (getId() != null && other.getId() != null) {
        EqualsBuilder matcher = new EqualsBuilder();
        matcher.append(getId(), other.getId());
        return matcher.isEquals();
    }
    return false;
}

From source file:org.silverpeas.core.personalization.dao.PersonalizationMatcher.java

@Override
public boolean matches(Object item) {
    boolean match = false;
    if (item instanceof UserPreferences) {
        UserPreferences actual = (UserPreferences) item;
        EqualsBuilder matcher = new EqualsBuilder();
        matcher.append(expected.getId(), actual.getId());
        matcher.append(expected.getLanguage(), actual.getLanguage());
        matcher.append(expected.getZoneId(), actual.getZoneId());
        matcher.append(expected.getLook(), actual.getLook());
        matcher.append(expected.getPersonalWorkSpaceId(), actual.getPersonalWorkSpaceId());
        matcher.append(expected.isThesaurusEnabled(), actual.isThesaurusEnabled());
        matcher.append(expected.isDragAndDropEnabled(), actual.isDragAndDropEnabled());
        matcher.append(expected.isWebdavEditionEnabled(), actual.isWebdavEditionEnabled());
        matcher.append(expected.getDisplay(), actual.getDisplay());
        match = matcher.isEquals();
    }/* w  ww .ja v  a 2  s  .  c o  m*/
    return match;
}

From source file:org.silverpeas.core.process.io.file.AbstractDummyHandledFile.java

@Override
public boolean equals(final Object obj) {
    if (obj == null) {
        return false;
    }/*w ww. j  av a  2 s .co  m*/
    if (getClass() != obj.getClass()) {
        return false;
    }
    final DummyHandledFile other = (DummyHandledFile) obj;
    EqualsBuilder matcher = new EqualsBuilder();
    matcher.append(getComponentInstanceId(), other.getComponentInstanceId());
    matcher.append(getPath(), other.getPath());
    matcher.append(getName(), other.getName());
    matcher.append(isDeleted(), other.isDeleted());
    return matcher.isEquals();
}

From source file:org.silverpeas.core.subscription.service.AbstractSubscription.java

@Override
public boolean equals(Object o) {
    if (this == o) {
        return true;
    }/*from   w w  w  .  j  av  a2  s.  c o  m*/
    if (o == null || getClass() != o.getClass()) {
        return false;
    }

    AbstractSubscription that = (AbstractSubscription) o;

    final EqualsBuilder builder = new EqualsBuilder();
    builder.append(subscriber, that.subscriber);
    builder.append(resource, that.resource);
    builder.append(subscriptionMethod, that.subscriptionMethod);
    return builder.isEquals();
}