Examples of StudyCriteria


Examples of org.cipres.treebase.domain.study.StudyCriteria

   */
  public ModelAndView handleRequest(HttpServletRequest request,
      HttpServletResponse response) throws Exception {
   
    SearchCommand searchCommand = (SearchCommand) request.getSession().getAttribute(Constants.SEARCH_COMMAND);
    StudyCriteria studyCriteria = new StudyCriteria();
    List<SearchCriteriaCommand> criterias = searchCommand.getCriterias();
   
    Collection<Study> studyList = new ArrayList<Study>();
    // no longer needed
    request.getSession().removeAttribute(Constants.SEARCH_COMMAND);
    if (searchCommand == null) {
      return new ModelAndView("studyList", Constants.STUDY_LIST, studyList);
    }
   
    //  TODO:
    // need a better way to handle this - hardcode it for now
    List<String> authors = new ArrayList<String>();
    List<String> citationTitles = new ArrayList<String>();
    for (SearchCriteriaCommand criteria : criterias) {
      String attribute = criteria.getAttribute();
      String value = criteria.getValue();
      if (attribute == null || value == null) continue;
      // treat all search as equal to
      if (attribute.equals(Constants.SEARCH_AUTHOR)) {
        authors.add(value);
      else if (attribute.equals(Constants.SEARCH_CITATION_TITLE)) {
        citationTitles.add(Constants.SEARCH_CITATION_TITLE);
      } else if (attribute.equals(Constants.SEARCH_ALGORITHM)) {
        studyCriteria.setAlgorithm(value);
      } else if (attribute.equals(Constants.SEARCH_SOFTWARE)) {
        studyCriteria.setSoftware(value);
      }
      // end if
    } // end for
    studyCriteria.setAuthorLastNames(authors);
    studyCriteria.setCitationTitles(citationTitles);
    studyList = mStudyService.findByCriteria(studyCriteria);
   
    return new ModelAndView("studyList", Constants.STUDY_LIST, studyList);
  }
View Full Code Here

Examples of org.cipres.treebase.domain.study.StudyCriteria

    if (logger.isInfoEnabled()) {
      logger.info("\n\t\tRunning Test: " + testName);
    }

    // 1. construct a criteria:
    StudyCriteria criteria = new StudyCriteria();

    List<String> authorLastNames = new ArrayList<String>();
    authorLastNames.add("lavin");
    // authorLastNames.add("nu");
    // criteria.setAuthorLastNames(authorLastNames);

    List<String> citationTitles = new ArrayList<String>();
    citationTitles.add("phylogeny");
    // authorLastNames.add("nu");
    criteria.setCitationTitles(citationTitles);

    criteria.setSoftware("paup");
    criteria.setAlgorithm("maximal likelihood");

    // 2. search
    Collection<Study> result = getFixture().findByCriteria(criteria);

    // 3. verify:
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.