Example usage for org.apache.commons.collections CollectionUtils find

List of usage examples for org.apache.commons.collections CollectionUtils find

Introduction

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

Prototype

public static Object find(Collection collection, Predicate predicate) 

Source Link

Document

Finds the first element in the given collection which matches the given predicate.

Usage

From source file:org.fenixedu.academic.ui.struts.action.department.ReadTeacherProfessorshipsByExecutionYearAction.java

private void prepareConstants(User userView, InfoTeacher infoTeacher, HttpServletRequest request)
        throws FenixServiceException {

    List executionYears = ReadNotClosedExecutionYears.run();

    InfoExecutionYear infoExecutionYear = (InfoExecutionYear) CollectionUtils.find(executionYears,
            new Predicate() {
                @Override//from w  w w.j  a  va 2 s  .  c  o m
                public boolean evaluate(Object arg0) {
                    InfoExecutionYear infoExecutionYearElem = (InfoExecutionYear) arg0;
                    if (infoExecutionYearElem.getState().equals(PeriodState.CURRENT)) {
                        return true;
                    }
                    return false;
                }
            });

    Department department = infoTeacher.getTeacher().getDepartment();
    InfoDepartment teacherDepartment = InfoDepartment.newInfoFromDomain(department);

    final Collection<Department> departmentList = userView.getPerson().getManageableDepartmentCreditsSet();
    request.setAttribute("isDepartmentManager", Boolean.valueOf(departmentList.contains(department)));

    request.setAttribute("teacherDepartment", teacherDepartment);
    request.setAttribute("executionYear", infoExecutionYear);
    request.setAttribute("executionYears", executionYears);
}

From source file:org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.java

private static DefaultNativePlatform findDefaultPlatform(final OperatingSystem os,
        final ArchitectureInternal architecture) {
    if (os != null) {
        DefaultNativePlatform matchingPlatform = (DefaultNativePlatform) CollectionUtils.find(defaults,
                new Predicate() {
                    public boolean evaluate(Object object) {
                        DefaultNativePlatform platform = (DefaultNativePlatform) object;
                        return platform.architecture.equals(architecture)
                                && platform.operatingSystem.getInternalOs().equals(os);
                    }/*  w  w  w  . ja v a 2  s.  c o m*/
                });
        return matchingPlatform;
    } else {
        return null;
    }
}

From source file:org.isatools.isatab.mapping.ISATABIntegrationTest.java

/**
 * Tests that a (almost) complete ISATAB is correctly loaded and mapped into BII. Additionally produces graphs of the
 * mapped experimental pipelines. The latter may be visualize by means of GraphViz, and it's stored in
 * target//*from w  w  w. ja  v  a2  s . com*/
 */
@SuppressWarnings("static-access")
@Test
public void testLoadingAndMapping() throws Exception {
    out.println("\n\n__________ ISATAB Mapping Test __________\n\n");

    String baseDir = System.getProperty("basedir");
    String filesPath = baseDir + "/target/test-classes/test-data/isatab/isatab/example";
    ISATABLoader loader = new ISATABLoader(filesPath);
    FormatSetInstance isatabInstance = loader.load();

    BIIObjectStore store = new BIIObjectStore();
    ISATABMapper isatabMapper = new ISATABMapper(store, isatabInstance);

    isatabMapper.map();
    assertTrue("Oh no! No mapped object! ", store.size() > 0);

    Study study = store.getType(Study.class, "bii:study:1");
    assertNotNull("Oh no! Study lsid:bii:study:19239 not found in the results!", study);
    Collection<Assay> assays = study.getAssays();
    Assay assay = (Assay) CollectionUtils.find(assays, new Predicate() {
        public boolean evaluate(Object assay) {
            return StringUtils.trimToEmpty(((Assay) assay).getAcc())
                    .startsWith("bii:study:1:assay:Study1.animal6.liver.extract1.le1.hyb1");
        }
    });
    assertNotNull("Gulp! Assay ...le1.hyb1.11 not found!", assay);

    Collection<AssayResult> ars = study.getAssayResults();
    out.println("__ ASSAY RESULTS: __  ");
    for (AssayResult ar : ars) {
        out.println(ar);
    }
    assertEquals("Oh no! Wrong no. of AssayResult(s)", 24, ars.size());

    ars = ProcessingUtils.findAssayResultsFromAssay(assay);
    assertEquals("Urp! Wrong no. of AssayResult(s) for assay test case", 1, ars.size());
    AssayResult ar = ars.iterator().next();

    out.println("__ CASCADED VALUES ON THE TEST CASE: __  ");
    Collection<PropertyValue> arProps = ar.filterRepeatedPropertyValues(ar.getCascadedPropertyValues());
    for (PropertyValue<?> v : arProps) {
        out.println("    " + v);
    }
    assertEquals("Urp! Wrong number of cascaded properties returned by mapped assay!", 11, arProps.size());

    out.println("\n\n__ RESULTS: __  ");
    out.println(store.toStringVerbose());

    Collection<Identifiable> objects = new ArrayList<Identifiable>();
    objects.addAll(store.values(Processing.class));
    DotGraphGenerator dotter = new DotGraphGenerator(objects);
    String dotFileName = baseDir + "/target/isatab.dot";
    dotter.createGraph(dotFileName);
    out.println("\n\nExperimental Graph written in " + dotFileName);

    out.println("\n\n__________ /end: ISATAB Mapping Test __________\n\n\n\n");

}

From source file:org.isatools.isatab_v1.ISATABMappingIntegrationTest.java

/**
 * Tests that a (almost) complete ISATAB is correctly loaded and mapped into BII. Additionally produces graphs of the
 * mapped experimental pipelines. The latter may be visualize by means of GraphViz, and it's stored in
 * target///from   w  w w.  ja  va  2s  .  c o  m
 */
@Test
@SuppressWarnings("static-access")
public void testLoadingAndMapping() throws Exception {
    out.println("\n\n__________ ISATAB Mapping Test __________\n\n");

    String baseDir = System.getProperty("basedir");
    String filesPath = baseDir
            + "/target/test-classes/test-data/isatab/isatab_v1_200810/griffin_gauguier_200810";

    ISATABLoader loader = new ISATABLoader(filesPath);
    FormatSetInstance isatabInstance = loader.load();

    BIIObjectStore store = new BIIObjectStore();
    ISATABMapper isatabMapper = new ISATABMapper(store, isatabInstance);

    isatabMapper.map();
    assertTrue("Oh no! No mapped object! ", store.size() > 0);

    Study study1 = store.getType(Study.class, "S:GG200810:1");
    assertNotNull("Oh no! Study S:GG200810:1 not found in the results!", study1);

    Collection<Design> designs = study1.getDesigns();
    assertNotNull("Oh no! Study has no designs!", designs);
    assertEquals("Oh no! Study has bad no. of designs!", 1, designs.size());

    Study study2 = store.getType(Study.class, "S:GG200810:2");
    assertNotNull("Oh no! Study S:GG200810:2 not found in the results!", study2);

    Collection<Protocol> protos = study2.getProtocols();
    assertNotNull("Oh no! No protocol mapped to the study!", protos);
    assertEquals("Oh no! Wrong no. of protocols mapped to the study!", 13, protos.size());

    {
        final String pname = "standard procedure 1";
        Protocol proto = (Protocol) CollectionUtils.find(protos, new Predicate() {
            public boolean evaluate(Object proto) {
                return pname.equals(((Protocol) proto).getName());
            }
        });
        assertNotNull("Argh! Protocol '" + pname + "' not found!", proto);
        //      assertEquals ( "Ops! Wrong version for the protocol '" + pname + "'", "v1.0", proto.getVersion () );

        ProtocolType ptype = proto.getType();
        assertNotNull("Urp! Protocol type for '" + pname + "' should not be null!", ptype);
        assertEquals("Argh! Wrong protocol type for '" + pname + "'!", "animal procedure", ptype.getName());
        ReferenceSource ptypeSrc = ptype.getSource();
        assertNotNull("Argh No protocol type source for '" + pname + "' / " + ptype + " !", ptypeSrc);
        assertEquals("Argh! Protocol type source is wrong for '" + pname + "' / " + ptype + " !",
                "BII:NULL-SOURCE", ptypeSrc.getAcc());
    }

    {
        final String pname = "P-BMAP-2";
        Protocol proto = (Protocol) CollectionUtils.find(protos, new Predicate() {
            public boolean evaluate(Object proto) {
                return pname.equals(((Protocol) proto).getName());
            }
        });
        assertNotNull("Argh! Protocol '" + pname + "' not found!", proto);
        //      assertEquals ( "Ops! Wrong version for the protocol '" + pname + "'", "v1.0", proto.getVersion () );

        ProtocolType ptype = proto.getType();
        assertNotNull("Urp! Protocol type for '" + pname + "' should not be null!", ptype);
        assertEquals("Argh! Wrong protocol type for '" + pname + "'!", "nucleic_acid_extraction",
                ptype.getName());
        ReferenceSource ptypeSrc = ptype.getSource();
        assertNotNull("Argh No protocol type source for '" + pname + "' / " + ptype + " !", ptypeSrc);
        assertEquals("Argh! Protocol type source is wrong for '" + pname + "' / " + ptype + " !", "OBI",
                ptypeSrc.getAcc());
    }

    Collection<Assay> assays = study1.getAssays();
    out.println("__ ASSAYS: __  ");
    for (Assay assay : assays) {
        out.println(assay);
    }

    final String assayAcc = "S:GG200810:1:assay:Study1.animal3.sample1.extract1.le1.hyb1";
    Assay assay = (Assay) CollectionUtils.find(assays, new Predicate() {
        public boolean evaluate(Object assay) {
            return StringUtils.trimToEmpty(((Assay) assay).getAcc()).startsWith(assayAcc);
        }
    });
    assertNotNull("Gulp! Assay '" + assayAcc + "' not found!", assay);

    Collection<AssayResult> ars = study1.getAssayResults();
    out.println("\n__ ASSAY RESULTS: __  ");
    for (AssayResult ar : ars) {
        out.println(ar);
    }
    assertEquals("Oh no! Wrong no. of AssayResult(s)", 48, ars.size());

    ars = ProcessingUtils.findAssayResultsFromAssay(assay);
    assertEquals("Urp! Wrong no. of AssayResult(s) for assay test case", 1, ars.size());
    AssayResult ar = ars.iterator().next();

    out.println("__ CASCADED VALUES ON THE TEST CASE: __  ");
    Collection<PropertyValue> arProps = ar.filterRepeatedPropertyValues(ar.getCascadedPropertyValues());
    for (PropertyValue<?> v : arProps) {
        out.println("    " + v);
    }
    assertEquals("Urp! Wrong number of cascaded properties returned by mapped assay!", 12, arProps.size());

    {
        final String protoName = "Affymetrix Hybridization SOP";
        Collection<ProtocolApplication> papps = ProcessingUtils
                .findBackwardProtocolApplications(ar.getData().getProcessingNode(), null, protoName, false);
        assertTrue("Argh! No node using the protocol '" + protoName + "' found!", !papps.isEmpty());
        ProtocolApplication papp = papps.iterator().next();
        Collection<ParameterValue> pvals = papp.getParameterValuesByType("Date");
        assertEquals("Argh! Wrong no of 'Date' parameter values in '" + protoName + "'!", 1, pvals.size());
        assertEquals("Argh! Wrong Date for '" + protoName + "'!", "10/11/2008",
                pvals.iterator().next().getValue());
    }

    {
        final String protoName = "RNA Extraction SOP";
        Collection<ProtocolApplication> papps = ProcessingUtils
                .findBackwardProtocolApplications(ar.getData().getProcessingNode(), null, protoName, false);
        assertTrue("Argh! No node using the protocol '" + protoName + "' found!", !papps.isEmpty());
        ProtocolApplication papp = papps.iterator().next();
        Collection<ParameterValue> pvals = papp.getParameterValuesByType("Performer");
        assertEquals("Argh! Wrong no of 'Performer' parameter values in '" + protoName + "'!", 1, pvals.size());
        assertEquals("Argh! Wrong Performer for '" + protoName + "'!", "Mister Lab Technician",
                pvals.iterator().next().getValue());
    }

    Collection<MaterialNode> mnodes = ProcessingUtils
            .findBackwardMaterialNodes(ar.getData().getProcessingNode(), "source", false);
    assertTrue("Ops! No Source Material found!", !mnodes.isEmpty());
    Material src = mnodes.iterator().next().getMaterial();
    assertEquals("Argh! Wrong provider for source material!", "Charles River",
            src.getSingleAnnotationValue("provider"));

    out.println("\n\n__ RESULTS: __  ");
    out.println(store.toStringVerbose());

    Collection<Identifiable> objects = new ArrayList<Identifiable>();
    objects.addAll(store.values(Processing.class));
    DotGraphGenerator dotter = new DotGraphGenerator(objects);
    String dotFileName = baseDir + "/target/isatab.dot";
    dotter.createGraph(dotFileName);
    out.println("\n\nExperimental Graph written in " + dotFileName);

    out.println("\n\n__________ /end: ISATAB Mapping Test __________\n\n\n\n");
}

From source file:org.isatools.isatab_v1.ISATABMappingIntegrationTest.java

/**
 * Tests that factor values in the study file are correctly reported into the corresponding assay results
 *//*from   w w  w . ja  va 2  s.  c o  m*/
@Test
@Ignore
// TODO?
@SuppressWarnings("static-access")
public void testFactorsInStudyFile() throws Exception {
    out.println("\n\n__________ ISATAB Mapping Test __________\n\n");

    String baseDir = System.getProperty("basedir");
    String filesPath = baseDir
            + "/target/test-classes/test-data/isatab/isatab_v1rc1/griffin_gauguier_sample_fv";
    ISATABLoader loader = new ISATABLoader(filesPath);
    FormatSetInstance isatabInstance = loader.load();

    BIIObjectStore store = new BIIObjectStore();
    ISATABMapper isatabMapper = new ISATABMapper(store, isatabInstance);

    isatabMapper.map();
    assertTrue("Oh no! No mapped object! ", store.size() > 0);

    Study study = store.getType(Study.class, "bii:study:1");
    assertNotNull("Oh no! Study bii:study:1 not found in the results!", study);

    Collection<Design> designs = study.getDesigns();
    assertNotNull("Oh no! Study has no designs!", designs);
    assertEquals("Oh no! Study has bad no. of designs!", 2, designs.size());

    Collection<Protocol> protos = study.getProtocols();
    assertNotNull("Oh no! No protocol mapped to the study!", protos);
    assertEquals("Oh no! Wrong no. of protocols mapped to the study!", 16, protos.size());

    final String pname = "standard procedure 1";
    Protocol proto = (Protocol) CollectionUtils.find(protos, new Predicate() {
        public boolean evaluate(Object proto) {
            return pname.equals(((Protocol) proto).getName());
        }
    });
    assertNotNull("Argh! Protocol '" + pname + "' not found!", proto);
    assertEquals("Ops! Wrong version for the protocol '" + pname + "'", "v1.0", proto.getVersion());

    ProtocolType ptype = proto.getType();
    assertNotNull("Urp! Protocol type for '" + pname + "' should not be null!", ptype);
    assertEquals("Argh! Wrong protocol type for '" + pname + "'!", "animal procedure", ptype.getName());
    ReferenceSource ptypeSrc = ptype.getSource();
    assertNotNull("Argh No protocol type source for '" + pname + "' / " + ptype + " !", ptypeSrc);
    assertEquals("Argh! Protocol type source is wrong for '" + pname + "' / " + ptype + " !", "OBI",
            ptypeSrc.getAcc());

    Collection<Assay> assays = study.getAssays();
    Assay assay = (Assay) CollectionUtils.find(assays, new Predicate() {
        public boolean evaluate(Object assay) {
            return StringUtils.trimToEmpty(((Assay) assay).getAcc())
                    .startsWith("bii:study:1:assay:Study1.animal6.liver.extract1.le1.hyb1");
        }
    });
    assertNotNull("Gulp! Assay ...le1.hyb1.11 not found!", assay);

    Collection<AssayResult> ars = study.getAssayResults();
    out.println("__ ASSAY RESULTS: __  ");
    for (AssayResult ar : ars) {
        out.println(ar);
    }
    assertEquals("Oh no! Wrong no. of AssayResult(s)", 24, ars.size());

    ars = ProcessingUtils.findAssayResultsFromAssay(assay);
    assertEquals("Urp! Wrong no. of AssayResult(s) for assay test case", 1, ars.size());
    AssayResult ar = ars.iterator().next();

    out.println("__ CASCADED VALUES ON THE TEST CASE: __  ");
    Collection<PropertyValue> arProps = ar.filterRepeatedPropertyValues(ar.getCascadedPropertyValues());
    boolean myFactorFound = false;
    for (PropertyValue<?> v : arProps) {
        out.println("    " + v);

        if (!(v instanceof FactorValue)) {
            continue;
        }
        FactorValue fv = (FactorValue) v;
        if (!"Operator".equals(fv.getType().getValue())) {
            continue;
        }
        assertFalse("Ouch! The factor value " + fv + " appears twice in the assay-result test case",
                myFactorFound);
        myFactorFound = true;
    }
    assertEquals("Urp! Wrong number of cascaded properties returned by mapped assay!", 12, arProps.size());
    assertTrue("Ouch! Factor value 'Operator' not found in the assay-result test case", myFactorFound);

    out.println("\n\n__ RESULTS: __  ");
    out.println(store.toStringVerbose());

    Collection<Identifiable> objects = new ArrayList<Identifiable>();
    objects.addAll(store.values(Processing.class));
    DotGraphGenerator dotter = new DotGraphGenerator(objects);
    String dotFileName = baseDir + "/target/isatab_sample_fv.dot";
    dotter.createGraph(dotFileName);
    out.println("\n\nExperimental Graph written in " + dotFileName);

    out.println("\n\n__________ /end: ISATAB Mapping Test __________\n\n\n\n");
}

From source file:org.kuali.mobility.academics.controllers.AcademicsAuthControllerImpl.java

@SuppressWarnings("unchecked")
@RequestMapping(value = "/mySections", method = RequestMethod.GET)
public String getMySections(HttpServletRequest request, Model uiModel,
        @RequestParam(required = false) final String termId,
        @RequestParam(required = false) final String careerId) {
    HttpSession session = request.getSession();
    if (termId.equalsIgnoreCase((String) session.getAttribute(AcademicsConstants.TERM_ID))
            && careerId.equalsIgnoreCase((String) session.getAttribute(AcademicsConstants.CAREER_ID))) {
        Term term = (Term) session.getAttribute("currentTerm");
        uiModel.addAttribute("title", term.getShortDescription());
    } else {//w w w.ja  va  2 s.c o m
        List<? extends Section> sections = getService().getClassSchedule(request, termId, careerId);
        if (sections.isEmpty()) {
            LOG.debug("No sections found for user [" + request.getRemoteUser() + "]");
        } else {
            Term term = (Term) CollectionUtils.find((List<Term>) session.getAttribute(AcademicsConstants.TERM),
                    new TermPredicate(termId));
            if (term != null) {
                session.setAttribute("currentTerm", term);
                session.setAttribute("currentCareer", term.getCareers().get(0));
                uiModel.addAttribute("title", term.getShortDescription());
            } else {
                uiModel.addAttribute("title", "My Schedule");
            }
            uiModel.addAttribute("detailsections", sections);
            session.setAttribute(AcademicsConstants.SECTIONS, sections);
            session.setAttribute(AcademicsConstants.TERM_ID, termId);
            session.setAttribute(AcademicsConstants.CAREER_ID, careerId);
        }
    }
    uiModel.addAttribute("catalogDescription", null);
    uiModel.addAttribute("toolContext", "myAcademics");
    //uiModel.addAttribute(AcademicsConstants.BACKBUTTON_URL, request.getContextPath() + "/myAcademics/");
    return "academics/sections";
}

From source file:org.kuali.mobility.academics.controllers.AcademicsControllerImpl.java

@RequestMapping(value = "/subjects")
public String getCareers(HttpServletRequest request, Model uiModel,
        @RequestParam(required = true) final String termId,
        @RequestParam(required = true) final String careerId) {
    HttpSession session = request.getSession();
    if (termId.equalsIgnoreCase((String) session.getAttribute(AcademicsConstants.TERM_ID))
            && careerId.equalsIgnoreCase((String) session.getAttribute(AcademicsConstants.CAREER_ID))) {
        // Use cached data.
        //         uiModel.addAttribute(AcademicsConstants.TITLE, ((Career)session.getAttribute("currentCareer")).getShortDescription());
        uiModel.addAttribute(AcademicsConstants.TITLE, "Subjects");
    } else {//from w  w w  .  java 2s  . co  m
        Term term = getService().getTerm(termId);
        session.setAttribute(AcademicsConstants.TERM_ID, term.getId());
        session.setAttribute("currentTerm", term);

        session.setAttribute(AcademicsConstants.CAREER_ID, careerId);
        Career career = (Career) CollectionUtils.find(
                (List<Career>) session.getAttribute(AcademicsConstants.CAREER), new CareerPredicate(careerId));
        session.setAttribute("currentCareer", career);

        List<? extends Subject> lSubjects = getService().getSubjects(termId, careerId);
        session.setAttribute(AcademicsConstants.SUBJECT, lSubjects);
        //         uiModel.addAttribute(AcademicsConstants.TITLE, ((Career)session.getAttribute("currentCareer")).getShortDescription());
        uiModel.addAttribute(AcademicsConstants.TITLE, "Subjects");
    }
    //uiModel.addAttribute(AcademicsConstants.BACKBUTTON_URL, request.getContextPath() + "/academics/careers?termId=" + session.getAttribute(AcademicsConstants.TERM_ID));
    return "academics/subjects";
}

From source file:org.kuali.mobility.academics.controllers.AcademicsControllerImpl.java

@RequestMapping(value = "/catalogNumbers")
public String getCareers(HttpServletRequest request, Model uiModel,
        @RequestParam(required = true) final String termId,
        @RequestParam(required = true) final String careerId,
        @RequestParam(required = true) final String subjectId) {
    HttpSession session = request.getSession();
    if (termId.equalsIgnoreCase((String) session.getAttribute(AcademicsConstants.TERM_ID))
            && careerId.equalsIgnoreCase((String) session.getAttribute(AcademicsConstants.CAREER_ID))
            && subjectId.equalsIgnoreCase((String) session.getAttribute(AcademicsConstants.SUBJECT_ID))) {
        // Use cached data.
        uiModel.addAttribute(AcademicsConstants.TITLE,
                ((Subject) session.getAttribute("currentSubject")).getDescription());
    } else {//from w ww  .  j  av  a 2  s. c  o  m
        Term term = getService().getTerm(termId);
        session.setAttribute(AcademicsConstants.TERM_ID, term.getId());
        session.setAttribute("currentTerm", term);
        session.setAttribute(AcademicsConstants.CAREER_ID, careerId);
        Career career = (Career) CollectionUtils.find(
                (List<Career>) session.getAttribute(AcademicsConstants.CAREER), new CareerPredicate(careerId));
        session.setAttribute("currentCareer", career);
        session.setAttribute(AcademicsConstants.SUBJECT_ID, subjectId);
        Subject subject = (Subject) CollectionUtils.find(
                (List<Subject>) session.getAttribute(AcademicsConstants.SUBJECT),
                new SubjectPredicate(subjectId));
        session.setAttribute("currentSubject", subject);
        List<? extends CatalogNumber> lCatalogNumbers = getService().getCatalogNumbers(termId, subjectId);
        session.setAttribute("catalogNumbers", lCatalogNumbers);

        uiModel.addAttribute(AcademicsConstants.TITLE,
                ((Subject) session.getAttribute("currentSubject")).getDescription());
    }
    //uiModel.addAttribute(AcademicsConstants.BACKBUTTON_URL, request.getContextPath() + "/academics/subjects?termId=" + session.getAttribute(AcademicsConstants.TERM_ID) + "&careerId=" + session.getAttribute(AcademicsConstants.CAREER_ID));
    return "academics/catalogNumbers";
}

From source file:org.kuali.mobility.academics.controllers.AcademicsControllerImpl.java

@RequestMapping(value = "/sections")
public String getSections(HttpServletRequest request, Model uiModel,
        @RequestParam(required = false) final String termId,
        @RequestParam(required = false) final String subjectId,
        @RequestParam(required = false) final String catalogNumber,
        @RequestParam(required = false) final String careerId) {
    HttpSession session = request.getSession();
    if (termId.equalsIgnoreCase((String) session.getAttribute(AcademicsConstants.TERM_ID))
            && careerId.equalsIgnoreCase((String) session.getAttribute(AcademicsConstants.CAREER_ID))
            && subjectId.equalsIgnoreCase((String) session.getAttribute(AcademicsConstants.CAREER_ID))
            && catalogNumber/*w  w w .jav  a 2s  .  c o m*/
                    .equalsIgnoreCase((String) session.getAttribute(AcademicsConstants.CATALOG_NUMBER))) {
        uiModel.addAttribute(AcademicsConstants.TITLE, session.getAttribute(AcademicsConstants.SUBJECT_ID) + " "
                + session.getAttribute(AcademicsConstants.CATALOG_NUMBER));
    } else {
        List<Section> lSections = (List<Section>) getService().getSections(termId, subjectId, catalogNumber,
                careerId);
        CatalogNumber number = (CatalogNumber) CollectionUtils.find(
                (List<CatalogNumber>) session.getAttribute("catalogNumbers"),
                new CatalogNumberPredicate(catalogNumber));
        for (Section s : lSections) {
            if (null == s.getCourseTitle() || s.getCourseTitle().trim().isEmpty()) {
                s.setCourseTitle(number.getDescription());
            }
        }

        session.setAttribute("sectionsAll", lSections);
        session.setAttribute(AcademicsConstants.CATALOG_NUMBER, catalogNumber);
        session.setAttribute(AcademicsConstants.SUBJECT_ID, subjectId);
        uiModel.addAttribute("sectionsAll", lSections);
        uiModel.addAttribute(AcademicsConstants.TITLE, session.getAttribute(AcademicsConstants.SUBJECT_ID) + " "
                + session.getAttribute(AcademicsConstants.CATALOG_NUMBER));
    }
    uiModel.addAttribute("toolContext", "academics");
    //uiModel.addAttribute(AcademicsConstants.BACKBUTTON_URL, request.getContextPath() + "/academics/catalogNumbers?termId=" + termId + "&careerId=" + careerId + "&subjectId=" + subjectId);
    return "academics/sections";
}

From source file:org.kuali.mobility.academics.dao.AcademicsDaoImpl.java

/**
 * @return the careers//from  ww  w . ja  v a  2s .  c o  m
 */
public List<Career> getCareers(final Map<String, String> query) {
    List<Career> tCareers = new ArrayList<Career>();
    if (null != query && query.containsKey(AcademicsConstants.TERM_ID)) {
        Term term = (Term) CollectionUtils.find(terms,
                new TermPredicate(query.get(AcademicsConstants.TERM_ID)));
        if (term != null) {
            tCareers = term.getCareers();
        }
    } else {
        tCareers = careers;
    }
    return tCareers;
}