Example usage for org.apache.commons.collections Predicate Predicate

List of usage examples for org.apache.commons.collections Predicate Predicate

Introduction

In this page you can find the example usage for org.apache.commons.collections Predicate Predicate.

Prototype

Predicate

Source Link

Usage

From source file:com.perceptive.epm.perkolcentral.action.ajax.EmployeeDetailsAction.java

public String executeEmployeesByTeamAjax() throws ExceptionWrapper {
    try {/*from ww  w.  j  av a2s  . co m*/
        LoggingHelpUtil.printDebug("Page " + getPage() + " Rows " + getRows() + " Sorting Order " + getSord()
                + " Index Row :" + getSidx());
        LoggingHelpUtil.printDebug("Search :" + searchField + " " + searchOper + " " + searchString);

        // Calcalate until rows ware selected
        int to = (rows * page);

        // Calculate the first row to read
        int from = to - rows;
        LinkedHashMap<Long, EmployeeBO> employeeLinkedHashMap = new LinkedHashMap<Long, EmployeeBO>();

        employeeLinkedHashMap = employeeBL.getAllEmployees();

        ArrayList<EmployeeBO> allEmployees = new ArrayList<EmployeeBO>(employeeLinkedHashMap.values());
        CollectionUtils.filter(allEmployees, new Predicate() {
            @Override
            public boolean evaluate(Object o) {
                EmployeeBO emp = (EmployeeBO) o;
                if (CollectionUtils.exists(emp.getGroups(), new Predicate() {
                    @Override
                    public boolean evaluate(Object o) {
                        return ((GroupBO) o).getGroupId().equalsIgnoreCase(selectedGroupId); //To change body of implemented methods use File | Settings | File Templates.
                    }
                }))
                    return true;
                else
                    return false;
            }
        });

        //// Handle Order By
        if (sidx != null && !sidx.equals("")) {

            Collections.sort(allEmployees, new Comparator<EmployeeBO>() {
                public int compare(EmployeeBO e1, EmployeeBO e2) {
                    if (sidx.equalsIgnoreCase("employeeName"))
                        return sord.equalsIgnoreCase("asc")
                                ? e1.getEmployeeName().compareTo(e2.getEmployeeName())
                                : e2.getEmployeeName().compareTo(e1.getEmployeeName());
                    else if (sidx.equalsIgnoreCase("jobTitle"))
                        return sord.equalsIgnoreCase("asc") ? e1.getJobTitle().compareTo(e2.getJobTitle())
                                : e2.getJobTitle().compareTo(e1.getJobTitle());
                    else if (sidx.equalsIgnoreCase("manager"))
                        return sord.equalsIgnoreCase("asc") ? e1.getManager().compareTo(e2.getManager())
                                : e2.getManager().compareTo(e1.getManager());
                    else
                        return sord.equalsIgnoreCase("asc")
                                ? e1.getEmployeeName().compareTo(e2.getEmployeeName())
                                : e2.getEmployeeName().compareTo(e1.getEmployeeName());
                }
            });

        }
        //

        records = allEmployees.size();
        total = (int) Math.ceil((double) records / (double) rows);

        gridModel = new ArrayList<EmployeeBO>();
        to = to > records ? records : to;
        for (int iCounter = from; iCounter < to; iCounter++) {
            EmployeeBO employeeBO = allEmployees.get(iCounter);
            //new EmployeeBO((Employee) employeeLinkedHashMap.values().toArray()[iCounter]);
            gridModel.add(employeeBO);
        }

    } catch (Exception ex) {
        throw new ExceptionWrapper(ex);
    }
    return SUCCESS;
}

From source file:flex2.compiler.mxml.rep.MxmlDocument.java

/**
  *//from   w w  w  .  jav  a 2  s. co  m
  */
public final Iterator<Initializer> getTopLevelInitializerIterator() {
    return new FilterIterator(getTopLevelDeclarationIterator(), new Predicate() {
        public boolean evaluate(Object object) {
            return object instanceof InitializedPropertyDeclaration;
        }
    });
}

From source file:net.sourceforge.fenixedu.domain.candidacyProcess.IndividualCandidacyProcess.java

public List<IndividualCandidacyDocumentFile> getActiveDocumentFiles() {
    List<IndividualCandidacyDocumentFile> documentList = new ArrayList<IndividualCandidacyDocumentFile>();

    CollectionUtils.select(getCandidacy().getDocumentsSet(), new Predicate() {

        @Override/*from   w w w  . j  a  va 2s  . c  om*/
        public boolean evaluate(Object arg0) {
            IndividualCandidacyDocumentFile file = (IndividualCandidacyDocumentFile) arg0;

            return file.getCandidacyFileActive();
        }

    }, documentList);

    return documentList;
}

From source file:net.sf.wickedshell.facade.descriptor.ExtensionShellDescriptor.java

/**
 * @see net.sf.wickedshell.facade.descriptor.IShellDescriptor#getExecutableFiles()
 *//*from w ww . ja  va 2s  . c o  m*/
@SuppressWarnings("unchecked")
public IExecutableFile[] getExecutableFiles(final boolean batchFilesOnly) {
    return (IExecutableFile[]) CollectionUtils.select(Arrays.asList(executableFiles), new Predicate() {
        /**
         * @see org.apache.commons.collections.Predicate#evaluate(java.lang.Object)
         */
        public boolean evaluate(Object object) {
            IExecutableFile executableFile = (IExecutableFile) object;
            return !batchFilesOnly || executableFile.isBatchFile();
        }
    }).toArray(new IExecutableFile[0]);
}

From source file:net.sourceforge.fenixedu.domain.messaging.AnnouncementBoard.java

public List<Announcement> getActiveAnnouncementsAfter(final YearMonthDay date) {
    return filterAnnouncements(getAnnouncementSet(), new Predicate() {
        @Override// w w w.  j a va  2  s.co  m
        public boolean evaluate(Object arg0) {
            Announcement announcement = (Announcement) arg0;
            DateTime announcementDate = announcement.getReferedSubjectBegin();
            return announcement.isActive() && announcement.getVisible() && announcementDate != null
                    && announcementDate.toYearMonthDay().isAfter(date);
        }
    });
}

From source file:gov.nih.nci.firebird.web.action.investigator.registration.RegistrationTabAction.java

/**
 * @return if there are any expired credentials in the profile.
 *//*w  ww.  j av a 2  s  .  c om*/
@SuppressWarnings("ucd")
// called from JSP pages
public boolean profileContainsExpiredCredentials() {
    InvestigatorProfile profile = getRegistration().getProfile();
    return CollectionUtils.exists(profile.getCredentials(), new Predicate() {

        @Override
        public boolean evaluate(Object object) {
            AbstractCredential<?> credential = (AbstractCredential<?>) object;
            return credential.isExpired();
        }
    });
}

From source file:net.sourceforge.fenixedu.domain.TeacherCreditsDocument.java

private String getTeacherCreditsFile(Teacher teacher, ExecutionSemester executionSemester,
        TeacherService teacherService) throws ParseException {
    CreditLineDTO creditLineDTO = ReadAllTeacherCredits.readCreditLineDTO(executionSemester, teacher);
    Unit lastWorkingUnit = teacher.getLastWorkingUnit(executionSemester.getBeginDateYearMonthDay(),
            executionSemester.getEndDateYearMonthDay());

    final StringBuilder htmlText = new StringBuilder();
    htmlText.append("<html><body><div style=\"font-family: Arial, Helvetica, sans-serif;font-size: 100%;\">");
    htmlText.append("<style type=\"text/css\">");
    htmlText.append(".tb01 {width: 100%; border-collapse: collapse;font-size: 65%;}");
    htmlText.append(//from  www . j av  a  2s.c  o  m
            ".tb01 th {background-color: #eee; border: 1pt solid #aaa; height: 1.5em;font-weight: normal; }");
    htmlText.append(".tb01 td { border: 1pt solid #aaa; height: 1.5em;}</style>");

    htmlText.append("<h1 style=\"text-align: center;\">").append(executionSemester.getName()).append(" ")
            .append(executionSemester.getExecutionYear().getYear()).append("</h1>");
    htmlText.append("<table class=\"tb01\"><tr><td><strong>Nome:</strong>")
            .append(teacher.getPerson().getName());
    htmlText.append("</td><td><strong>Username:</strong>").append(teacher.getPerson().getIstUsername());
    htmlText.append("</td></tr><tr><td><strong>Categoria:</strong>");

    ProfessionalCategory categoryByPeriod = teacher.getCategoryByPeriod(executionSemester);
    String category = categoryByPeriod != null ? categoryByPeriod.getName().getContent() : null;
    if (category != null) {
        htmlText.append(category);
    }
    htmlText.append("</td><td><strong>Seco:</strong>");
    if (lastWorkingUnit != null) {
        htmlText.append(lastWorkingUnit.getName());
    }
    htmlText.append("</td></tr><tr><td><strong>Departamento:</strong>");
    if (lastWorkingUnit != null && lastWorkingUnit.getDepartmentUnit() != null
            && lastWorkingUnit.getDepartmentUnit().getDepartment() != null) {
        htmlText.append(lastWorkingUnit.getDepartmentUnit().getDepartment().getRealName());
    }
    htmlText.append("</td><td><strong>Centro de Custo:</strong>");
    if (lastWorkingUnit != null) {
        htmlText.append(lastWorkingUnit.getCostCenterCode());
    }
    htmlText.append("</td></tr></table>");

    htmlText.append("<h3>Resumo de crditos</h3>");
    htmlText.append("<ul style=\"list-style: none; font-size: 65%;\"><li><b>")
            .append(creditLineDTO.getTeachingDegreeCredits())
            .append("</b> (A) - Crditos provenientes de aulas de licenciatura</li>");
    htmlText.append("<li><b>").append(creditLineDTO.getSupportLessonHours())
            .append("</b> (D) - Horas semanais de aulas de dvidas</li>");
    htmlText.append("<li><b>").append(creditLineDTO.getMasterDegreeCredits())
            .append("</b> (M) - Crditos provenientes de aulas de mestrado</li>");
    htmlText.append("<li><b>").append(creditLineDTO.getTfcAdviseCredits())
            .append("</b> (TFC) - Crditos provenientes de alunos de trabalho final de curso</li>");
    htmlText.append("<li><b>").append(creditLineDTO.getThesesCredits())
            .append("</b> (Diss) - Crditos provenientes de Dissertaes</li>");
    htmlText.append("<li><b>").append(creditLineDTO.getInstitutionWorkingHours())
            .append("</b> (P) - Horas semanais de permanncia no " + Unit.getInstitutionAcronym() + "</li>");
    htmlText.append("<li><b>").append(creditLineDTO.getOtherCredits())
            .append("</b> (O) - Crditos enquadrados na categoria outros</li>");
    htmlText.append("<li><b>").append(creditLineDTO.getManagementCredits())
            .append("</b> (CG) - Crditos provenientes de cargos de gesto</li>");
    htmlText.append("<li><b>").append(creditLineDTO.getServiceExemptionCredits())
            .append("</b> (SNE) - Crditos provenientes de situaes em no exerccio</li></ul>");

    htmlText.append("<h3>1) Disciplinas Leccionadas em Graduao</h3>");
    List<Professorship> professorships = teacher.getProfessorships(executionSemester);
    if (professorships.isEmpty()) {
        htmlText.append(
                "<p style=\"font-size: 65%;\">O professor no lecciona nenhuma disciplina neste semestre.</p>");
    } else {
        for (Professorship professorship : professorships) {
            htmlText.append("<p style=\"font-size: 65%;\"><strong>")
                    .append(professorship.getExecutionCourse().getName()).append(" (")
                    .append(professorship.getDegreeSiglas()).append(")</strong></p>");

            htmlText.append("<p style=\"font-size: 65%;\">Aulas:</p>");

            if (professorship.getDegreeTeachingServicesOrderedByShift().isEmpty()) {
                htmlText.append("<p style=\"font-size: 65%;\">No foram encontrados registos de aulas.</p>");
            } else {
                htmlText.append(
                        "<table class=\"tb01\"><tr><th>Turno</th><th>Tipo</th><th>Horas</th><th>% que lecciona</th></tr>");
                for (DegreeTeachingService degreeTeachingService : professorship
                        .getDegreeTeachingServicesOrderedByShift()) {
                    htmlText.append("<tr><td>").append(degreeTeachingService.getShift().getNome())
                            .append("</td>");
                    htmlText.append("<td>").append(degreeTeachingService.getShift().getShiftTypesPrettyPrint())
                            .append("</td>");
                    htmlText.append("<td>").append(degreeTeachingService.getShift().getTotalHours())
                            .append("</td>");
                    htmlText.append("<td>").append(degreeTeachingService.getPercentage()).append("</td></tr>");
                }
                htmlText.append("</table>");
            }

            htmlText.append("<p style=\"font-size: 65%;\">Aulas de dvidas:</p>");

            if (professorship.getSupportLessonsOrderedByStartTimeAndWeekDay().isEmpty()) {
                htmlText.append(
                        "<p style=\"font-size: 65%;\">No foram encontrados registos de aulas de dvidas.</p>");
            } else {

                htmlText.append(
                        "<table class=\"tb01\"><tr><th>Dia da semana</th><th>Incio</th><th>Fim</th><th>Local</th></tr>");
                for (SupportLesson supportLesson : professorship
                        .getSupportLessonsOrderedByStartTimeAndWeekDay()) {
                    htmlText.append("<tr><td>").append(supportLesson.getWeekDay()).append("</td>");
                    htmlText.append("<td>").append(supportLesson.getStartTimeHourMinuteSecond().toString())
                            .append("</td>");
                    htmlText.append("<td>").append(supportLesson.getEndTimeHourMinuteSecond().toString())
                            .append("</td>");
                    htmlText.append("<td>").append(supportLesson.getPlace()).append("</td></tr>");
                }
                htmlText.append("</table>");
            }
        }
    }

    htmlText.append("<h3>2) Disciplinas Leccionadas em Ps-Graduao</h3>");

    if (teacherService == null || teacherService.getMasterDegreeServices().isEmpty()) {
        htmlText.append(
                "<p style=\"font-size: 65%;\">No foram encontrados registos de disciplinas de mestrado.</p>");
    } else {
        htmlText.append(
                "<table class=\"tb01\"><tr><th>Plano(s) curriculare(s)</th><th>Disciplina</th><th>Horas</th><th>Crditos</th></tr>");
        for (TeacherMasterDegreeService teacherMasterDegreeService : teacherService.getMasterDegreeServices()) {
            if (teacherMasterDegreeService.getProfessorship() != null) {
                htmlText.append("<tr><td>")
                        .append(teacherMasterDegreeService.getProfessorship().getDegreePlanNames());
                htmlText.append("</td><td>")
                        .append(teacherMasterDegreeService.getProfessorship().getExecutionCourse().getName());
            } else {
                htmlText.append("<tr><td></td><td>");
            }
            htmlText.append("</td><td>").append(teacherMasterDegreeService.getHours()).append("</td>");
            htmlText.append("<td>").append(teacherMasterDegreeService.getCredits()).append("</td></tr>");
        }
        htmlText.append("</table>");
    }

    if (teacherService != null && teacherService.getTeacherServiceNotes() != null
            && !StringUtils.isEmpty(teacherService.getTeacherServiceNotes().getMasterDegreeTeachingNotes())) {
        htmlText.append("<p style=\"font-size: 65%;\">").append(teacherService.getTeacherServiceNotes()
                .getMasterDegreeTeachingNotes().replaceAll("(\r\n)|(\n)", "<br />")).append("</p>");
    }

    htmlText.append("<h3>3) Trabalhos Finais de Curso (at Ano Lectivo de 2006/2007)</h3>");
    List<TeacherAdviseService> teacherAdviseServices = new ArrayList<TeacherAdviseService>();
    if (teacherService != null) {
        teacherAdviseServices.addAll(teacherService.getTeacherAdviseServices());
    }
    List<TeacherAdviseService> tfcAdvises = (List<TeacherAdviseService>) CollectionUtils
            .select(teacherAdviseServices, new Predicate() {
                @Override
                public boolean evaluate(Object arg0) {
                    TeacherAdviseService teacherAdviseService = (TeacherAdviseService) arg0;
                    return teacherAdviseService.getAdvise().getAdviseType()
                            .equals(AdviseType.FINAL_WORK_DEGREE);
                }
            });

    if (teacherAdviseServices.isEmpty() || tfcAdvises.isEmpty()) {
        htmlText.append(
                "<p style=\"font-size: 65%;\">No foram encontrados registos de alunos de trabalho final de curso.</p>");
    } else {
        Collections.sort(tfcAdvises, new BeanComparator("advise.student.number"));

        htmlText.append(
                "<p style=\"font-size: 65%;\"><strong>Alunos:</strong></p><table class=\"tb01\"><tr><th>Nmero do aluno</th><th>Nome do aluno</th><th>Percentagem</th></tr>");
        for (TeacherAdviseService teacherAdviseService : tfcAdvises) {
            htmlText.append("<tr><td>").append(teacherAdviseService.getAdvise().getStudent().getNumber())
                    .append("</td>");
            htmlText.append("<td>").append(teacherAdviseService.getAdvise().getStudent().getPerson().getName())
                    .append("</td>");
            htmlText.append("<td>").append(teacherAdviseService.getPercentage()).append("</td></tr>");
        }
        htmlText.append("</table>");
    }

    htmlText.append("<h3>4) Dissertaes de Mestrado</h3>");

    Collection<ThesisEvaluationParticipant> thesisEvaluationParticipants = teacher.getPerson()
            .getThesisEvaluationParticipants(executionSemester);

    if (thesisEvaluationParticipants.isEmpty()) {
        htmlText.append("<p style=\"font-size: 65%;\">No foram encontradas Dissertaes de Mestrado.</p>");
    } else {
        htmlText.append(
                "<p style=\"font-size: 65%;\"><strong>Alunos:</strong></p><table class=\"tb01\"><tbody><tr><th style=\"width: 5em;\">Nmero</th><th>Nome</th><th style=\"width: 7em;\">Lecciona (%)</th></tr>");
        for (ThesisEvaluationParticipant participant : thesisEvaluationParticipants) {
            htmlText.append("<tr><td>").append(participant.getThesis().getStudent().getNumber());
            htmlText.append("</td><td>").append(participant.getThesis().getStudent().getPerson().getName());
            htmlText.append("</td><td>").append(participant.getCreditsDistribution()).append("</td></tr>");
        }
        htmlText.append("</tbody></table>");
    }

    if (teacherService != null && teacherService.getTeacherServiceNotes() != null
            && !StringUtils.isEmpty(teacherService.getTeacherServiceNotes().getThesisNote())) {
        htmlText.append("<p style=\"font-size: 65%;\">").append(
                teacherService.getTeacherServiceNotes().getThesisNote().replaceAll("(\r\n)|(\n)", "<br />"))
                .append("</p>");
    }

    htmlText.append("<h3>5) Permanncia no " + Unit.getInstitutionAcronym() + "</h3>");
    ComparatorChain comparatorChain = new ComparatorChain();
    BeanComparator weekDayComparator = new BeanComparator("weekDay");
    BeanComparator startTimeComparator = new BeanComparator("startTime");
    comparatorChain.addComparator(weekDayComparator);
    comparatorChain.addComparator(startTimeComparator);

    List<InstitutionWorkTime> institutionWorkingTimes = new ArrayList<InstitutionWorkTime>();
    if (teacherService != null) {
        institutionWorkingTimes.addAll(teacherService.getInstitutionWorkTimes());
        Collections.sort(institutionWorkingTimes, comparatorChain);
    }

    if (!institutionWorkingTimes.isEmpty()) {
        htmlText.append("<p style=\"font-size: 65%;\">No foram encontrados registos.</p>");
    } else {
        htmlText.append("<table class=\"tb01\"><tr>");

        for (WeekDay weekDay : WeekDay.values()) {
            if (!weekDay.equals(WeekDay.SUNDAY)) {
                htmlText.append("<th style=\"width: 16.5em;\">")
                        .append(BundleUtil.getString(Bundle.ENUMERATION, weekDay.name())).append("</th>");
            }
        }
        htmlText.append("</tr><tr>");
        for (WeekDay weekDay : WeekDay.values()) {
            if (!weekDay.equals(WeekDay.SUNDAY)) {
                htmlText.append("<td style=\"text-align: center;\">");
                for (InstitutionWorkTime institutionWorkTime : institutionWorkingTimes) {
                    if (institutionWorkTime.getWeekDay().equals(weekDay)) {
                        htmlText.append(institutionWorkTime.getStartTimeHourMinuteSecond().toString())
                                .append(" s ")
                                .append(institutionWorkTime.getEndTimeHourMinuteSecond().toString())
                                .append("<br/>");
                    }
                }
                htmlText.append("</td>");
            }
        }
        htmlText.append("</tr></table>");
    }

    htmlText.append("<h3>6) Acumulao de Funes</h3>");
    if (teacherService != null && teacherService.getTeacherServiceNotes() != null
            && !StringUtils.isEmpty(teacherService.getTeacherServiceNotes().getFunctionsAccumulation())) {
        htmlText.append("<p style=\"font-size: 65%;\">").append(teacherService.getTeacherServiceNotes()
                .getFunctionsAccumulation().replaceAll("(\r\n)|(\n)", "<br />")).append("</p>");
    } else {
        htmlText.append(
                "<p style=\"font-size: 65%;\">No foram encontrados registos de acumulao de funes.</p>");
    }

    htmlText.append("<h3>7) Outros</h3>");
    if (teacherService == null || teacherService.getOtherServices().isEmpty()) {
        htmlText.append(
                "<p style=\"font-size: 65%;\">No foram encontrados registos da categoria outros neste semestre.</p>");
    } else {
        htmlText.append("<table class=\"tb01\"><tr><th>Razo</th><th>Crditos</th></tr>");
        for (OtherService otherService : teacherService.getOtherServices()) {
            htmlText.append("<tr><td>").append(otherService.getReason()).append("</td>");
            htmlText.append("<td>").append(otherService.getCredits()).append("</td></tr>");
        }
        htmlText.append("</table>");
    }

    if (teacherService != null && teacherService.getTeacherServiceNotes() != null
            && !StringUtils.isEmpty(teacherService.getTeacherServiceNotes().getOthersNotes())) {
        htmlText.append("<p style=\"font-size: 65%;\">").append(
                teacherService.getTeacherServiceNotes().getOthersNotes().replaceAll("(\r\n)|(\n)", "<br />"))
                .append("</p>");
    }

    htmlText.append("<h3>8) Cargos de Gesto</h3>");
    List<PersonFunction> personFuntions = teacher.getPersonFuntions(
            executionSemester.getBeginDateYearMonthDay(), executionSemester.getEndDateYearMonthDay());

    if (personFuntions.isEmpty()) {
        htmlText.append(
                "<p style=\"font-size: 65%;\">No foram encontrados registos de cargos de gesto.</p>");
    } else {
        Collections.sort(personFuntions, new BeanComparator("beginDate"));
        htmlText.append(
                "<table class=\"tb01\"><tr><th>Cargo</th><th>Unidade</th><th>Crditos</th><th>Incio</th><th>Fim</th></tr>");
        for (PersonFunction personFunction : personFuntions) {
            htmlText.append("<tr><td>").append(personFunction.getFunction().getName());
            htmlText.append("</td><td>").append(personFunction.getParentParty().getName());
            htmlText.append("</td><td>").append(personFunction.getCredits());
            htmlText.append("</td><td>").append(personFunction.getBeginDate());
            htmlText.append("</td><td>").append(personFunction.getEndDate()).append("</td></tr>");
        }
        htmlText.append("</table>");
    }

    if (teacherService != null && teacherService.getTeacherServiceNotes() != null
            && !StringUtils.isEmpty(teacherService.getTeacherServiceNotes().getManagementFunctionNotes())) {
        htmlText.append("<p style=\"font-size: 65%;\">").append(teacherService.getTeacherServiceNotes()
                .getManagementFunctionNotes().replaceAll("(\r\n)|(\n)", "<br />")).append("</p>");
    }

    htmlText.append("<h3>9) Situaes em No Exerccio</h3>");

    Set<PersonContractSituation> serviceExemptions = teacher
            .getValidTeacherServiceExemptions(executionSemester);

    if (serviceExemptions.isEmpty()) {
        htmlText.append(
                "<p style=\"font-size: 65%;\">No foram encontrados registos da categoria situaes em no exerccio.</p>");
    } else {
        htmlText.append(
                "<table class=\"tb01\"><tr><th>Situao</th><th>Organizao</th><th>Incio</th><th>Fim</th></tr>");
        for (PersonContractSituation teacherServiceExemption : serviceExemptions) {
            htmlText.append("<tr><td>")
                    .append(teacherServiceExemption.getContractSituation().getName().getContent());
            htmlText.append("</td><td>").append(teacherServiceExemption.getBeginDate());
            htmlText.append("</td><td>").append(teacherServiceExemption.getServiceExemptionEndDate())
                    .append("</td></tr>");
        }
        htmlText.append("</table>");
    }

    if (teacherService != null && teacherService.getTeacherServiceNotes() != null
            && !StringUtils.isEmpty(teacherService.getTeacherServiceNotes().getServiceExemptionNotes())) {
        htmlText.append("<p style=\"font-size: 65%;\">").append(teacherService.getTeacherServiceNotes()
                .getServiceExemptionNotes().replaceAll("(\r\n)|(\n)", "<br />")).append("</p>");
    }
    htmlText.append("</div></body></html>");

    return htmlText.toString();
}

From source file:module.siadap.domain.Siadap.java

public List<SiadapEvaluationItem> getCurrentEvaluationItems() {

    ArrayList<SiadapEvaluationItem> currentEvaluationItems = new ArrayList<SiadapEvaluationItem>();
    final SiadapEvaluationUniverse evalUniverse = getDefaultSiadapEvaluationUniverse();
    currentEvaluationItems.addAll(evalUniverse.getEvaluations(SiadapEvaluationItem.class, new Predicate() {

        @Override//w  w  w.j a va2  s .  com
        public boolean evaluate(Object arg0) {
            return (arg0 instanceof ObjectiveEvaluation)
                    ? ((ObjectiveEvaluation) arg0).isValidForVersion(evalUniverse.getCurrentObjectiveVersion())
                    : true;
        }
    }, null));
    return currentEvaluationItems;
}

From source file:com.kcs.service.impl.GenerateXmlOtherServiceImpl.java

private List<Datasetopa> filterChildOpa(final Datasetopa main, List<Datasetopa> childList) {
    List<Datasetopa> result = new ArrayList<Datasetopa>();
    final Predicate predicate = new Predicate() {
        @Override//from w w w .ja  v a 2  s .  com
        public boolean evaluate(Object o) {
            if (Utility.isNotNull(o)) {
                Datasetopa child = (Datasetopa) o;
                boolean result = (objEquals(main.getCustCode(), child.getCustCode())
                        && objEquals(main.getSeq(), child.getSeq())
                        && objEquals(main.getSysCode(), child.getSysCode()));
                return result;
            }
            return false;
        }
    };
    result = (List<Datasetopa>) CollectionUtils.select(childList, predicate);
    return result;
}

From source file:net.sourceforge.fenixedu.domain.messaging.AnnouncementBoard.java

public List<Announcement> getActiveAnnouncementsBefore(final YearMonthDay date) {
    return filterAnnouncements(getAnnouncementSet(), new Predicate() {
        @Override//  w w  w . j  a v a2s  . com
        public boolean evaluate(Object arg0) {
            Announcement announcement = (Announcement) arg0;
            DateTime announcementDate = announcement.getReferedSubjectBegin();
            DateTime endDate = announcement.getReferedSubjectEnd();
            return announcement.isActive() && announcement.getVisible() && announcementDate != null
                    && announcementDate.toYearMonthDay().isBefore(date)
                    && (endDate == null || endDate.toYearMonthDay().isBefore(date));
        }
    });
}