Example usage for org.apache.commons.collections15 CollectionUtils isSubCollection

List of usage examples for org.apache.commons.collections15 CollectionUtils isSubCollection

Introduction

In this page you can find the example usage for org.apache.commons.collections15 CollectionUtils isSubCollection.

Prototype

public static <E> boolean isSubCollection(final Iterable<? extends E> a, final Iterable<? extends E> b) 

Source Link

Document

Returns true iff a is a sub-collection of b, that is, iff the cardinality of e in a is less than or equal to the cardinality of e in b, for each element e in a.

Usage

From source file:edu.northwestern.bioinformatics.studycalendar.web.dashboard.DashboardCommand.java

public boolean getHasHiddenInformation() {
    if (!isColleagueDashboard()) {
        return false;
    } else if (dashboardUser.getMembership(STUDY_SUBJECT_CALENDAR_MANAGER) == null) {
        return false;
    } else if (loggedInUser.getMembership(STUDY_SUBJECT_CALENDAR_MANAGER) == null) {
        return true;
    }//from w  w  w.ja v a  2 s  . c  o m

    Collection<Integer> possibleDashboardStudies = studyDao
            .getVisibleStudyIds(getUser().getVisibleStudyParameters(STUDY_SUBJECT_CALENDAR_MANAGER));
    Collection<Integer> visibleStudies = studyDao
            .getVisibleStudyIds(loggedInUser.getVisibleStudyParameters(STUDY_SUBJECT_CALENDAR_MANAGER));
    if (!CollectionUtils.isSubCollection(possibleDashboardStudies, visibleStudies)) {
        return true;
    }

    Collection<Integer> possibleDashboardAssignments = pscUserService.getVisibleAssignmentIds(getUser(),
            STUDY_SUBJECT_CALENDAR_MANAGER);
    Collection<Integer> visibleAssignments = pscUserService.getVisibleAssignmentIds(loggedInUser,
            STUDY_SUBJECT_CALENDAR_MANAGER);

    return !CollectionUtils.isSubCollection(possibleDashboardAssignments, visibleAssignments);
}