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

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

Introduction

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

Prototype

public EqualsBuilder appendSuper(final boolean superEquals) 

Source Link

Document

Adds the result of super.equals() to this builder.

Usage

From source file:org.sakaiproject.tool.assessment.data.dao.grading.MediaData.java

@Override
public boolean equals(Object obj) {
    if (this == obj)
        return true;
    if (obj == null)
        return false;
    if (getClass() != obj.getClass())
        return false;
    MediaData other = (MediaData) obj;/* w  w w .  jav  a2s  . c  om*/
    EqualsBuilder builder = new EqualsBuilder();
    builder.appendSuper(super.equals(obj));
    builder.append(createdBy, other.createdBy);
    builder.append(createdDate, other.createdDate);
    builder.append(description, other.description);
    builder.append(duration, other.duration);
    builder.append(durationIsOver, other.durationIsOver);
    builder.append(fileSize, other.fileSize);
    builder.append(filename, other.filename);
    builder.append(isHtmlInline, other.isHtmlInline);
    builder.append(isLink, other.isLink);
    builder.append(itemGradingData, other.itemGradingData);
    builder.append(lastModifiedBy, other.lastModifiedBy);
    builder.append(lastModifiedDate, other.lastModifiedDate);
    builder.append(location, other.location);
    builder.append(media, other.media);
    builder.append(mediaId, other.mediaId);
    builder.append(mimeType, other.mimeType);
    builder.append(status, other.status);
    builder.append(timeAllowed, other.timeAllowed);
    return builder.isEquals();
}

From source file:org.silverpeas.admin.web.ComponentEntityMatcher.java

@Override
protected void matches(final EqualsBuilder matcher, final ComponentInstLight expected,
        final ComponentEntity actual) {
    matcher.append("component", actual.getType());
    matcher.appendSuper(expected.getId().endsWith(actual.getId()));
    matcher.append(expected.getName(), actual.getName());
    matcher.append(expected.getLabel(), actual.getLabel());
    matcher.append(expected.getDescription(), actual.getDescription());
    matcher.append(expected.getOrderNum(), actual.getRank());
    matcher.append(expected.getStatus() == null ? "" : expected.getStatus(), actual.getStatus());
    matcher.append(expected.isInheritanceBlocked(), actual.isInheritanceBlocked());
    matcher.append("/R" + expected.getName() + "/" + expected.getId() + "/Main", actual.getUrl());
    // URI//  w ww.ja  v a 2 s . c o m
    matcher.appendSuper(actual.getParentURI().toString()
            .endsWith("/spaces/" + expected.getDomainFatherId().replaceFirst(Admin.SPACE_KEY_PREFIX, "")));
}

From source file:org.silverpeas.admin.web.SpaceEntityMatcher.java

@Override
protected void matches(final EqualsBuilder matcher, final SpaceInstLight expected, final SpaceEntity actual) {
    matcher.append("space", actual.getType());
    matcher.append(expected.getShortId(), actual.getId());
    matcher.append(expected.getName(), actual.getLabel());
    matcher.append(expected.getDescription(), actual.getDescription());
    matcher.append(expected.getOrderNum(), actual.getRank());
    matcher.append(expected.getLevel(), actual.getLevel());
    matcher.append(expected.getStatus() == null ? "" : expected.getStatus(), actual.getStatus());
    matcher.append(expected.isDisplaySpaceFirst(), actual.isSpaceDisplayedAtFirst());
    matcher.append(expected.isInheritanceBlocked(), actual.isInheritanceBlocked());
    // URI/*from   w w w.  j  a  v  a  2  s  .com*/
    if (!expected.isRoot()) {
        matcher.appendSuper(actual.getParentURI().toString().endsWith("/spaces/" + expected.getFatherId()));
    } else {
        matcher.appendSuper(actual.getParentURI() == null || actual.getParentURI().toString().equals(""));
    }
    matcher.append(true, actual.getSpacesURI().toString()
            .endsWith("/" + SPACES_BASE_URI + "/" + expected.getShortId() + "/" + SPACES_SPACES_URI_PART));
    matcher.append(true, actual.getComponentsURI().toString()
            .endsWith("/" + SPACES_BASE_URI + "/" + expected.getShortId() + "/" + SPACES_COMPONENTS_URI_PART));
    matcher.append(true, actual.getContentURI().toString()
            .endsWith("/" + SPACES_BASE_URI + "/" + expected.getShortId() + "/" + SPACES_CONTENT_URI_PART));
    matcher.append(true, actual.getAppearanceURI().toString()
            .endsWith("/" + SPACES_BASE_URI + "/" + expected.getShortId() + "/" + SPACES_APPEARANCE_URI_PART));
}

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