Package org.cipres.treebase.domain.admin

Examples of org.cipres.treebase.domain.admin.Person


    /*
     * Always provide the user a new form
     */

    return new Person();
  }
View Full Code Here


    }

    // list of original author/editors associated with the citation
    List<Person> currentPersons = getPeople(citation);// citation.getAuthors();

    Person author_editor = (Person) command;

    if (request.getParameter("method") != null) {
      String id = request.getParameter("id");
      if (request.getParameter("method").equals(ACTION_DELETE)) {

        for (Person person : currentPersons) {
          if (person.getId().equals(Long.parseLong((id)))) {
            currentPersons.remove(person);
            break;
          }
        }
        request.getSession().setAttribute(
          "messages",
          getMessageSourceAccessor().getMessage(provideDeleteMessageParameter()));

      } else if (request.getParameter("method").equals(ACTION_INSERT)) {

        currentPersons.add(mPersonService.findByID(Long.parseLong(id)));
        request.getSession().setAttribute(
          "messages",
          getMessageSourceAccessor().getMessage(provideAddMessageParameter()));

      }
      setPeople(citation, currentPersons);// citation.setAuthors(people);
      mCitationService.update(citation); // update the author list in database
      return new ModelAndView("redirect:/user/authorSearchForm.html");

    } else if (request.getParameter(ACTION_SUBMIT) != null) {
      String lastName = author_editor.getLastName().trim();
      if (lastName.length() == 0) {
        request.getSession().setAttribute("messages", "Please provide last name!");
        return new ModelAndView("redirect:/user/authorSearchForm.html");
      } else {
        // Put the last name in session scope an control should go to another page
View Full Code Here

    /*
     * Always provide the user a new form
     */

    return new Person();
  }
View Full Code Here

    HttpServletRequest request,
    HttpServletResponse response,
    Object command,
    BindException bindExp) throws Exception {

    Person author_editor = (Person) command;

    /* Get the existing list of authors for the citation */
    Study study = ControllerUtil.findStudy(request, mStudyService);
    Citation citation = study.getCitation();

    if (citation == null) {
      request.getSession().setAttribute(
        "errors",
        "Please provide the citation for this study first.");
      return showForm(request, response, bindExp);
    }

    // list of original author/editors associated with the citation
    List<Person> currentPersons = getPeople(citation);// citation.getAuthors();

    if (request.getParameter(ACTION_CANCEL) == null) {
      /*
       * update the author list based the user selection
       */
      if (request.getParameter(ACTION_SUBMIT) != null
        || request.getParameter("Submit and Continue") != null) {
        /*
         * look for match in "Person" table
         */
        Person p = mPersonService.findByExactMatch(author_editor);
        if (p == null) { // no match
          mPersonService.createPerson(author_editor); // add "author" to Person table
          currentPersons.add(author_editor); // add "author" to citation_author table
        } else { // match found
          currentPersons.add(p); // just add the found "author" to citation_author table
View Full Code Here

    /*
     * Always provide the user a new form
     */

    return new Person();
  }
View Full Code Here

    if (userproblem) {
      return setAttributeAndShowForm(request, response, bindExp, "errors", problemList);
    }

    Person srcPerson = getPersonService().findByID(Long.valueOf(mSourcePersonId));
    Person targetPerson = getPersonService().findByID(Long.valueOf(mTargetPersonId));
   
    if (srcPerson == null) {
      problemList.add("Source person id: '" + mSourcePersonId + "' does not exist.");
      userproblem = true;
    }
    if (targetPerson == null) {
      problemList.add("Target person id: '" + mTargetPersonId + "' does not exist.");
      userproblem = true;
    }

    if (userproblem) {
      return setAttributeAndShowForm(request, response, bindExp, "errors", problemList);
    }

    if (mSourcePersonId.equals(mTargetPersonId)) {
      problemList.add("Two person records cannot be identical.");
      userproblem = true;
    }

    if (userproblem) {
      return setAttributeAndShowForm(request, response, bindExp, "errors", problemList);
    }

    String srcPersonName = srcPerson.getFirstName() + " " + srcPerson.getLastName() + " (id:" + mSourcePersonId + ")";
    String targetPersonName = targetPerson.getFirstName() + " " + targetPerson.getLastName() + " (id:" + mTargetPersonId + ")";
   
    int movedCount = getPersonService().mergePerson(Long.valueOf(mSourcePersonId), Long.valueOf(mTargetPersonId));

    if (movedCount < 0) {
      return setAttributeAndShowForm(request, response, bindExp, "errors", problemList);
View Full Code Here

TOP

Related Classes of org.cipres.treebase.domain.admin.Person

Copyright © 2018 www.massapicom. 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.