Example usage for org.apache.commons.beanutils BeanComparator BeanComparator

List of usage examples for org.apache.commons.beanutils BeanComparator BeanComparator

Introduction

In this page you can find the example usage for org.apache.commons.beanutils BeanComparator BeanComparator.

Prototype

public BeanComparator(String property) 

Source Link

Document

Constructs a property-based comparator for beans.

Usage

From source file:net.sourceforge.fenixedu.presentationTier.Action.resourceAllocationManager.utils.Util.java

public static List<LabelValueBean> readExistingBuldings(String name, String value)
        throws FenixServiceException {
    List<LabelValueBean> edificios = new ArrayList<LabelValueBean>();

    if (name != null) {
        edificios.add(new LabelValueBean(name, value));
    }// ww w  .  j  a v  a2s.com

    final List<InfoBuilding> infoBuildings = ReadBuildings.run();
    Collections.sort(infoBuildings, new BeanComparator("name"));

    for (InfoBuilding infoBuilding : infoBuildings) {
        edificios.add(new LabelValueBean(infoBuilding.getName(), infoBuilding.getName()));
    }

    return edificios;
}

From source file:com.agiletec.apsadmin.user.role.RoleFinderAction.java

public List<Role> getRoles() {
    List<Role> roles = this.getRoleManager().getRoles();
    BeanComparator comparator = new BeanComparator("description");
    Collections.sort(roles, comparator);
    return roles;
}

From source file:com.agiletec.apsadmin.user.group.GroupFinderAction.java

public List<Group> getGroups() {
    List<Group> groups = this.getGroupManager().getGroups();
    BeanComparator comparator = new BeanComparator("descr");
    Collections.sort(groups, comparator);
    return groups;
}

From source file:com.agiletec.apsadmin.user.UserFinderAction.java

@Override
public List<UserDetails> getUsers() {
    try {// www . j  a v a  2 s  .  c  om
        List<UserDetails> users = this.getUserManager().searchUsers(this.getText());
        BeanComparator comparator = new BeanComparator("username");
        Collections.sort(users, comparator);
        return users;
    } catch (Throwable t) {
        ApsSystemUtils.logThrowable(t, this, "getUsers");
        throw new RuntimeException("Errore in ricerca utenti", t);
    }
}

From source file:com.agiletec.apsadmin.portal.PageFinderAction.java

@Override
public List<IPage> getPagesFound() {
    List<IPage> result = null;
    try {/*ww  w. java 2s.  com*/
        List<String> allowedGroupCodes = this.getAllowedGroupCodes();
        result = this.getPageManager().searchPages(this.getPageCodeToken(), allowedGroupCodes);
        BeanComparator comparator = new BeanComparator("code");
        Collections.sort(result, comparator);
    } catch (Throwable t) {
        _logger.error("Error on searching pages", t);
        //ApsSystemUtils.logThrowable(t, this, "Error on searching pages");
        throw new RuntimeException("Error on searching pages", t);
    }
    return result;
}

From source file:net.sourceforge.fenixedu.presentationTier.renderers.providers.VigilantGroupsProvider.java

@Override
public Object provide(Object source, Object currentValue) {

    VigilantBean bean = (VigilantBean) source;
    List<VigilantGroup> groups = new ArrayList(bean.getVigilantGroups());

    Collections.sort(groups, new BeanComparator("name"));
    return groups;
}

From source file:net.sourceforge.fenixedu.presentationTier.renderers.providers.StudentExecutionYearsProvider.java

@Override
public Object provide(Object source, Object currentValue) {
    List<ExecutionYear> result = new ArrayList(((RegistrationSelectExecutionYearBean) source).getRegistration()
            .getStudent().getEnrolmentsExecutionYears());
    Collections.sort(result, new BeanComparator("year"));
    return result;
}

From source file:net.sourceforge.fenixedu.presentationTier.renderers.providers.ExecutionCoursesForExamCoordinator.java

@Override
public Object provide(Object source, Object currentValue) {
    ConvokeBean bean = (ConvokeBean) source;
    ExamCoordinator coordinator = bean.getExamCoordinator();
    List<ExecutionCourse> courses = coordinator.getAssociatedExecutionCourses();

    Collections.sort(courses, new BeanComparator("nome"));
    return courses;
}

From source file:net.sourceforge.fenixedu.presentationTier.renderers.providers.candidacy.DegreeTypeDegrees.java

@Override
@SuppressWarnings("unchecked")
public Object provide(Object source, Object currentValue) {

    final List<Degree> result = new ArrayList<Degree>();
    for (Degree degree : Degree.readNotEmptyDegrees()) {
        if (degree.getDegreeType() == DegreeType.BOLONHA_DEGREE) {
            result.add(degree);// ww w  .  j  a v  a  2 s .  com
        }
    }
    Collections.sort(result, new BeanComparator("name"));
    return result;
}

From source file:com.agiletec.apsadmin.system.BaseActionHelper.java

/**
 * Returns the list of authorized groups to a user.
 * @param user The user./*from  w  w w.j a  v a 2  s .co m*/
 * @return The list of authorized groups to a user.
 */
protected List<Group> getAllowedGroups(UserDetails user) {
    List<Group> groups = new ArrayList<Group>();
    List<Group> groupsOfUser = this.getAuthorizationManager().getUserGroups(user);
    if (this.getAuthorizationManager().isAuthOnGroup(user, Group.ADMINS_GROUP_NAME)) {
        groups.addAll(this.getGroupManager().getGroups());
    } else {
        groups.addAll(groupsOfUser);
    }
    BeanComparator comparator = new BeanComparator("descr");
    Collections.sort(groups, comparator);
    return groups;
}