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.core.subscription.web.SubscriberEntityMatcher.java

@Override
public boolean matches(Object item) {
    if (item instanceof SubscriberEntity) {
        SubscriberEntity actual = (SubscriberEntity) item;
        EqualsBuilder match = new EqualsBuilder();
        match.append(subscriber.getId(), actual.getId());
        switch (subscriber.getType()) {
        case GROUP:
            match.appendSuper(actual.isGroup());
            match.appendSuper(!actual.isUser());
            break;
        case USER:
            match.appendSuper(!actual.isGroup());
            match.appendSuper(actual.isUser());
            break;
        default://from w  w w.j  ava2s.c o m
            match.appendSuper(false);
            break;
        }
        return match.isEquals();
    }
    return false;
}

From source file:org.silverpeas.core.subscription.web.SubscriptionEntityMatcher.java

@Override
public boolean matches(Object item) {
    if (item instanceof SubscriptionEntity) {
        SubscriptionEntity actual = (SubscriptionEntity) item;
        EqualsBuilder match = new EqualsBuilder();

        // Resource
        match.append(subscription.getResource().getId(), actual.getResource().getId());
        match.append(subscription.getResource().getInstanceId(), actual.getResource().getInstanceId());
        switch (subscription.getResource().getType()) {
        case NODE:
            match.appendSuper(!actual.getResource().isComponent());
            match.appendSuper(actual.getResource().isNode());
            break;
        case COMPONENT:
            match.appendSuper(actual.getResource().isComponent());
            match.appendSuper(!actual.getResource().isNode());
            break;
        default://from w  ww. ja  va2  s . co m
            match.appendSuper(false);
            break;
        }

        // Subscriber
        match.append(subscription.getSubscriber().getId(), actual.getSubscriber().getId());
        switch (subscription.getSubscriber().getType()) {
        case USER:
            match.appendSuper(!actual.getSubscriber().isGroup());
            match.appendSuper(actual.getSubscriber().isUser());
            break;
        case GROUP:
            match.appendSuper(actual.getSubscriber().isGroup());
            match.appendSuper(!actual.getSubscriber().isUser());
            break;
        default:
            match.appendSuper(false);
            break;
        }

        // Method
        switch (subscription.getSubscriptionMethod()) {
        case FORCED:
            match.appendSuper(actual.isForced());
            match.appendSuper(!actual.isSelfCreation());
            break;
        case SELF_CREATION:
            match.appendSuper(!actual.isForced());
            match.appendSuper(actual.isSelfCreation());
            break;
        default:
            match.appendSuper(false);
            break;
        }

        return match.isEquals();
    }
    return false;
}

From source file:org.silverpeas.core.util.time.DurationConversionBoardKey.java

@Override
public boolean equals(final Object obj) {
    if (obj == null) {
        return false;
    }/*from w  w w .ja  va 2 s. c o m*/
    if (getClass() != obj.getClass()) {
        return false;
    }
    final DurationConversionBoardKey other = (DurationConversionBoardKey) obj;
    EqualsBuilder matcher = new EqualsBuilder();
    matcher.append(smallestUnit, other.smallestUnit);
    matcher.append(largestUnit, other.largestUnit);
    return matcher.isEquals();
}

From source file:org.silverpeas.core.util.time.TimeConversionBoardKey.java

@Override
public boolean equals(final Object obj) {
    if (obj == null) {
        return false;
    }/*from   w ww  .ja  va 2  s  . c  o  m*/
    if (getClass() != obj.getClass()) {
        return false;
    }
    final TimeConversionBoardKey other = (TimeConversionBoardKey) obj;
    EqualsBuilder matcher = new EqualsBuilder();
    matcher.append(smallestUnit, other.smallestUnit);
    matcher.append(largestUnit, other.largestUnit);
    return matcher.isEquals();
}

From source file:org.silverpeas.notification.web.MessageContainerEntityMatcher.java

@Override
public boolean matches(final Object item) {
    EqualsBuilder match = new EqualsBuilder();
    if (item instanceof MessageContainerEntity) {
        final MessageContainerEntity actual = (MessageContainerEntity) item;
        match.append(actual.getMessages().size(), expected.getMessages().size());
        Iterator<Message> expectedMessageIt = expected.getMessages().iterator();
        for (MessageEntity actualMessage : actual.getMessages()) {
            Message expectedMessage = expectedMessageIt.next();
            match.append(actualMessage.getType(), expectedMessage.getType());
            match.append(actualMessage.getContent(), expectedMessage.getContent());
            match.append(actualMessage.getDisplayLiveTime(), expectedMessage.getDisplayLiveTime());
        }/*w  ww .  j a  va 2 s .  c  o  m*/
    }
    return match.isEquals();
}

From source file:org.silverpeas.resourcesmanager.web.CategoryEntityMatcher.java

@Override
public boolean matches(final Object item) {
    boolean match = false;
    if (item instanceof ResourceCategoryEntity) {
        final ResourceCategoryEntity actual = (ResourceCategoryEntity) item;
        final EqualsBuilder matcher = new EqualsBuilder();
        matcher.appendSuper(actual.getURI().toString()
                .endsWith("/resourceManager/componentName5/resources/categories/" + expected.getId()));
        matcher.append(expected.getId(), actual.getId());
        matcher.append(expected.getName(), actual.getName());
        matcher.append(expected.getDescription(), actual.getDescription());
        match = matcher.isEquals();
    }/*from   ww w  .  j  ava 2  s.c  om*/
    return match;
}

From source file:org.silverpeas.resourcesmanager.web.ReservationEntityMatcher.java

@Override
public boolean matches(final Object item) {
    boolean match = false;
    if (item instanceof ReservationEntity) {
        final ReservationEntity actual = (ReservationEntity) item;
        final EqualsBuilder matcher = new EqualsBuilder();
        matcher.appendSuper(actual.getURI().toString()
                .endsWith("/resourceManager/componentName5/reservations/" + expected.getIdAsString()));
        matcher.appendSuper(actual.getResourceURI().toString().endsWith(
                "/resourceManager/componentName5/reservations/" + expected.getIdAsString() + "/resources"));
        matcher.append("reservation", actual.getType());
        matcher.append(String.valueOf(expected.getId()), actual.getId());
        matcher.append(expected.getEvent(), actual.getTitle());
        matcher.append(expected.getPlace(), actual.getPlace());
        matcher.append(expected.getReason(), actual.getReason());
        matcher.append(expected.getStatus(), actual.getStatus());
        matcher.append(new DateTime(expected.getBeginDate()).toShortISO8601(), actual.getStart());
        matcher.append(new DateTime(expected.getEndDate()).toShortISO8601(), actual.getEnd());
        matcher.append(false, actual.isAllDay());
        match = matcher.isEquals();
    }//from w  ww .ja  v a2  s .com
    return match;
}

From source file:org.silverpeas.resourcesmanager.web.ReservedResourceEntityMatcher.java

@Override
public boolean matches(final Object item) {
    boolean match = false;
    if (item instanceof ReservedResourceEntity) {
        final ReservedResourceEntity actual = (ReservedResourceEntity) item;
        final EqualsBuilder matcher = new EqualsBuilder();
        matcher.appendSuper(actual.getReservationURI().toString()
                .endsWith("/resourceManager/componentName5/reservations/" + reservationId));
        matcher.append(null, actual.getURI());
        matcher.appendSuper(actual.getResourceURI().toString()
                .endsWith("/resourceManager/componentName5/resources/" + expected.getId()));
        matcher.appendSuper(actual.getCategoryURI().toString().endsWith(
                "/resourceManager/componentName5/resources/categories/" + expected.getCategory().getId()));
        matcher.append(expected.getId(), actual.getId());
        matcher.append(expected.getName(), actual.getName());
        matcher.append(expected.getDescription(), actual.getDescription());
        matcher.append(expected.getStatus(), actual.getStatus());
        match = matcher.isEquals();
    }/*from  w  w w  .  j  a  v a 2s  .c om*/
    return match;
}

From source file:org.silverpeas.resourcesmanager.web.ResourceEntityMatcher.java

@Override
public boolean matches(final Object item) {
    boolean match = false;
    if (item instanceof ResourceEntity) {
        final ResourceEntity actual = (ResourceEntity) item;
        final EqualsBuilder matcher = new EqualsBuilder();
        matcher.appendSuper(actual.getURI().toString()
                .endsWith("/resourceManager/componentName5/resources/" + expected.getId()));
        matcher.appendSuper(actual.getCategoryURI().toString().endsWith(
                "/resourceManager/componentName5/resources/categories/" + expected.getCategory().getId()));
        matcher.append(expected.getId(), actual.getId());
        matcher.append(expected.getName(), actual.getName());
        matcher.append(expected.getDescription(), actual.getDescription());
        match = matcher.isEquals();
    }/*w w w . j  av a  2s .  c  om*/
    return match;
}

From source file:org.silverpeas.viewer.web.PreviewEntityMatcher.java

@Override
public boolean matches(final Object item) {
    boolean match = false;
    if (item instanceof PreviewEntity) {
        final PreviewEntity actual = (PreviewEntity) item;
        final EqualsBuilder matcher = new EqualsBuilder();
        matcher.appendSuper(actual.getURI().toString().endsWith("/preview/componentName5/attachment/7"));
        matcher.appendSuper(actual.getURL().toString().endsWith("/URL/physicalName7"));
        matcher.append("originalFileName7", actual.getOriginalFileName());
        match = matcher.isEquals();
    }/*w  w  w  . ja  va  2  s . c om*/
    return match;
}