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

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

Introduction

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

Prototype

public EqualsBuilder append(final boolean[] lhs, final boolean[] rhs) 

Source Link

Document

Deep comparison of array of boolean.

Usage

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   ww  w . j a  v  a 2s  .c o  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 .j  ava2  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 .j a v a 2 s. c  om
    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());
        }/*from w w  w . ja  v a2 s.  com*/
    }
    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();/*w w w. ja  v  a 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  www .  j  a va2  s . c o m*/
    }
    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();//  w w w  .  java  2s .  c  o m
    }
    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();//from   www  .  ja va2  s. c  o  m
    }
    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();//from ww  w.  java 2 s  . c  om
    }
    return match;
}

From source file:org.smurn.jply.Element.java

@Override
public boolean equals(final Object obj) {
    if (obj == null) {
        return false;
    }/*w w  w .  j  ava 2  s.co m*/
    if (obj == this) {
        return true;
    }
    if (obj.getClass() != getClass()) {
        return false;
    }
    Element rhs = (Element) obj;
    EqualsBuilder builder = new EqualsBuilder();
    builder.append(type, rhs.type);
    builder.append(data, rhs.data);
    return builder.isEquals();
}