Package org.fenixedu.academic.domain.candidacyProcess.over23

Examples of org.fenixedu.academic.domain.candidacyProcess.over23.Over23IndividualCandidacyProcess$BindPersonToCandidacy


        return forwardTo(mapping, request);
    }

    public ActionForward removeSelectedDegreesEntry(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) {
        Over23IndividualCandidacyProcessBean bean = (Over23IndividualCandidacyProcessBean) getIndividualCandidacyProcessBean();
        Integer index = getIntegerFromRequest(request, "removeIndex");
        bean.removeDegree(bean.getSelectedDegrees().get(index));

        request.setAttribute(getIndividualCandidacyProcessBeanName(), bean);
        invalidateDocumentFileRelatedViewStates();

        return forwardTo(mapping, request);
View Full Code Here


            ActionForward actionForwardError = verifySubmissionPreconditions(mapping);
            if (actionForwardError != null) {
                return actionForwardError;
            }

            Over23IndividualCandidacyProcessBean bean =
                    (Over23IndividualCandidacyProcessBean) getIndividualCandidacyProcessBean();
            bean.setInternalPersonCandidacy(Boolean.TRUE);

            boolean isValid = validateOver23IndividualCandidacy(request, bean) && hasInvalidViewState();
            if (!isValid) {
                invalidateDocumentFileRelatedViewStates();
                request.setAttribute(getIndividualCandidacyProcessBeanName(), getIndividualCandidacyProcessBean());
                return mapping.findForward("candidacy-continue-creation");
            }

            if (candidacyIndividualProcessExistsForThisEmail(bean.getPersonBean().getEmail(), bean.getSelectedDegrees())) {
                addActionMessage("error", request, "error.candidacy.hash.code.already.bounded");
                invalidateDocumentFileRelatedViewStates();
                request.setAttribute(getIndividualCandidacyProcessBeanName(), getIndividualCandidacyProcessBean());
                return mapping.findForward("candidacy-continue-creation");
            }

            if (!bean.getHonorAgreement()) {
                addActionMessage("error", request, "error.must.agree.on.declaration.of.honor");
                invalidateDocumentFileRelatedViewStates();
                request.setAttribute(getIndividualCandidacyProcessBeanName(), getIndividualCandidacyProcessBean());
                return mapping.findForward("candidacy-continue-creation");
            }
View Full Code Here

        return isValid;
    }

    public ActionForward editCandidacyProcess(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) throws FenixServiceException {
        Over23IndividualCandidacyProcessBean bean = (Over23IndividualCandidacyProcessBean) getIndividualCandidacyProcessBean();
        PersonBean personBean = bean.getPersonBean();

        try {
            ActionForward actionForwardError = verifySubmissionPreconditions(mapping);
            if (actionForwardError != null) {
                return actionForwardError;
            }

            if (!isApplicationSubmissionPeriodValid()) {
                return beginCandidacyProcessIntro(mapping, form, request, response);
            }

            final Set<Person> persons = new HashSet<Person>(Person.readByDocumentIdNumber(personBean.getDocumentIdNumber()));

            if (persons.size() > 1) {
                addActionMessage("individualCandidacyMessages", request, getProcessType().getSimpleName()
                        + ".error.public.candidacies.fill.personal.information.and.institution.id.person.already.exist");
                return prepareEditCandidacyProcess(mapping, form, request, response);
            }

            final Person person = persons.size() == 1 ? persons.iterator().next() : null;

            // check if person already exists
            if (person != null) {
                if (isPersonStudentAndNumberIsCorrect(person, bean.getPersonNumber())) {
                    if (!person.getDateOfBirthYearMonthDay().equals(personBean.getDateOfBirth())) {
                        // found person with diff date
                        addActionMessage("individualCandidacyMessages", request, getProcessType().getSimpleName()
                                + ".error.public.candidacies.fill.personal.information.and.institution.id.birth");
                        return prepareEditCandidacyProcess(mapping, form, request, response);
                    } else if (!StringUtils.isEmpty(personBean.getSocialSecurityNumber())
                            && !StringUtils.isEmpty(person.getSocialSecurityNumber())
                            && !person.getSocialSecurityNumber().equals(personBean.getSocialSecurityNumber())) {
                        // found person with diff social security number
                        addActionMessage("individualCandidacyMessages", request, getProcessType().getSimpleName()
                                + ".error.public.candidacies.fill.personal.information.and.institution.id.contributorNumber");
                        return prepareEditCandidacyProcess(mapping, form, request, response);
                    } else {
                        personBean.setPerson(person);
                    }
                } else {
                    // found person with diff ist userid
                    addActionMessage("individualCandidacyMessages", request, getProcessType().getSimpleName()
                            + ".error.public.candidacies.fill.personal.information.and.institution.id.userId");
                    return prepareEditCandidacyProcess(mapping, form, request, response);
                }
            } else {
                if (Person.readByContributorNumber(personBean.getSocialSecurityNumber()) != null) {
                    // found person with same contributor number
                    addActionMessage("individualCandidacyMessages", request, getProcessType().getSimpleName()
                            + ".error.public.candidacies.fill.personal.information.and.institution.id.contributorNumber");
                    return prepareEditCandidacyProcess(mapping, form, request, response);
                }
            }

            executeActivity(bean.getIndividualCandidacyProcess(), "EditPublicCandidacyPersonalInformation",
                    getIndividualCandidacyProcessBean());
        } catch (final DomainException e) {
            addActionMessage(request, e.getMessage(), e.getArgs());
            request.setAttribute(getIndividualCandidacyProcessBeanName(), getIndividualCandidacyProcessBean());
            return mapping.findForward("edit-candidacy");
        }

        request.setAttribute("individualCandidacyProcess", bean.getIndividualCandidacyProcess());
        return backToViewCandidacyInternal(mapping, form, request, response);
    }
View Full Code Here

        return backToViewCandidacyInternal(mapping, form, request, response);
    }

    public ActionForward editCandidacyHabilitations(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) throws FenixServiceException {
        Over23IndividualCandidacyProcessBean bean = (Over23IndividualCandidacyProcessBean) getIndividualCandidacyProcessBean();
        try {
            boolean isValid = validateOver23IndividualCandidacy(request, bean) && hasInvalidViewState();
            if (!isValid) {
                request.setAttribute(getIndividualCandidacyProcessBeanName(), getIndividualCandidacyProcessBean());
                return mapping.findForward("edit-candidacy-habilitations");
            }

            if (!isApplicationSubmissionPeriodValid()) {
                return beginCandidacyProcessIntro(mapping, form, request, response);
            }

            executeActivity(bean.getIndividualCandidacyProcess(), "EditPublicCandidacyHabilitations",
                    getIndividualCandidacyProcessBean());
        } catch (final DomainException e) {
            addActionMessage(request, e.getMessage(), e.getArgs());
            request.setAttribute(getIndividualCandidacyProcessBeanName(), getIndividualCandidacyProcessBean());
            return mapping.findForward("edit-candidacy-habilitations");
        }

        request.setAttribute("individualCandidacyProcess", bean.getIndividualCandidacyProcess());
        return backToViewCandidacyInternal(mapping, form, request, response);
    }
View Full Code Here

    @Override
    public ActionForward viewCandidacy(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) {
        Over23IndividualCandidacyProcess individualCandidacyProcess =
                (Over23IndividualCandidacyProcess) request.getAttribute("individualCandidacyProcess");
        Over23IndividualCandidacyProcessBean bean = new Over23IndividualCandidacyProcessBean(individualCandidacyProcess);

        bean.setPersonBean(new PersonBean(individualCandidacyProcess.getPersonalDetails()));
        request.setAttribute("individualCandidacyProcessBean", bean);

        return mapping.findForward("show-candidacy-details");
    }
View Full Code Here

        } else if (candidacyHashCode.getIndividualCandidacyProcess() != null
                && candidacyHashCode.getIndividualCandidacyProcess().getCandidacyProcess() != candidacyProcess) {
            return mapping.findForward("open-candidacy-processes-not-found");
        }

        Over23IndividualCandidacyProcessBean bean = new Over23IndividualCandidacyProcessBean();
        bean.setPersonBean(new PersonBean());
        bean.setCandidacyProcess(candidacyProcess);
        bean.setPublicCandidacyHashCode(candidacyHashCode);

        request.setAttribute(getIndividualCandidacyProcessBeanName(), bean);
        bean.getPersonBean().setEmail(candidacyHashCode.getEmail());
        return mapping.findForward("show-candidacy-creation-page");

    }
View Full Code Here

        return forwardTo(mapping, request);
    }

    public ActionForward addSelectedDegreesEntry(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) {
        Over23IndividualCandidacyProcessBean bean = (Over23IndividualCandidacyProcessBean) getIndividualCandidacyProcessBean();

        if (bean.hasDegreeToAdd() && !bean.containsDegree(bean.getDegreeToAdd())) {
            bean.addDegree(bean.getDegreeToAdd());
            bean.setDegreeToAdd(null);
        }

        request.setAttribute(getIndividualCandidacyProcessBeanName(), bean);
        invalidateDocumentFileRelatedViewStates();
View Full Code Here

        return pdi;
    }

    private static PrecedentDegreeInformation createForOver23(IndividualCandidacyProcessBean processBean) {
        Over23IndividualCandidacyProcessBean over23Bean = (Over23IndividualCandidacyProcessBean) processBean;

        if (!over23Bean.getFormationConcludedBeanList().isEmpty()) {
            PrecedentDegreeInformation pid = new PrecedentDegreeInformation();
            pid.setCandidacyInternal(false);
            FormationBean formationBean = over23Bean.getFormationConcludedBeanList().iterator().next();

            pid.setDegreeDesignation(formationBean.getDesignation());
            pid.setInstitution(getOrCreateInstitution(formationBean.getInstitutionName()));
            pid.setConclusionYear(formationBean.getConclusionExecutionYear().getEndCivilYear());

            return pid;
        } else if (!over23Bean.getFormationNonConcludedBeanList().isEmpty()) {
            PrecedentDegreeInformation pdi = new PrecedentDegreeInformation();
            pdi.setCandidacyInternal(false);
            FormationBean formationBean = over23Bean.getFormationNonConcludedBeanList().iterator().next();

            pdi.setDegreeDesignation(formationBean.getDesignation());
            pdi.setInstitution(getOrCreateInstitution(formationBean.getInstitutionName()));

            return pdi;
View Full Code Here

            pid.setConclusionYear(erasmusStudentDataBean.getDiplomaConclusionYear());
        }
    }

    private static void editForOver23(IndividualCandidacyProcessBean processBean) {
        Over23IndividualCandidacyProcessBean over23Bean = (Over23IndividualCandidacyProcessBean) processBean;

        IndividualCandidacyProcess individualCandidacyProcess = processBean.getIndividualCandidacyProcess();
        IndividualCandidacy candidacy = individualCandidacyProcess.getCandidacy();
        PrecedentDegreeInformation pid = candidacy.getRefactoredPrecedentDegreeInformation();

        if (!over23Bean.getFormationConcludedBeanList().isEmpty()) {
            FormationBean formationBean = over23Bean.getFormationConcludedBeanList().iterator().next();

            pid.setDegreeDesignation(formationBean.getDesignation());
            pid.setInstitution(getOrCreateInstitution(formationBean.getInstitutionName()));
            pid.setConclusionYear(formationBean.getConclusionExecutionYear().getEndCivilYear());
        } else if (over23Bean.getFormationNonConcludedBeanList().isEmpty()) {
            FormationBean formationBean = over23Bean.getFormationNonConcludedBeanList().iterator().next();

            pid.setDegreeDesignation(formationBean.getDesignation());
            pid.setInstitution(getOrCreateInstitution(formationBean.getInstitutionName()));
        }
View Full Code Here

        return (Over23IndividualCandidacyProcessBean) super.getIndividualCandidacyProcessBean();
    }

    @Override
    protected void setStartInformation(ActionForm form, HttpServletRequest request, HttpServletResponse response) {
        final IndividualCandidacyProcessBean bean = new Over23IndividualCandidacyProcessBean();
        bean.setCandidacyProcess(getParentProcess(request));
        bean.setChoosePersonBean(new ChoosePersonBean());

        /*
         * 06/05/2009 - Due to Public Candidacies, a candidacy created in admin
         * office is external So we dont require ChoosePersonBean because a
         * Person will not be associated or created at individual candidacy
         * creation stage. Instead we bind with an empty PersonBean.
         *
         * bean.setChoosePersonBean(new ChoosePersonBean());
         */
        bean.setPersonBean(new PersonBean());

        /*
         * 06/05/2009 - Also we mark the bean as an external candidacy.
         */
        bean.setInternalPersonCandidacy(Boolean.FALSE);
        request.setAttribute(getIndividualCandidacyProcessBeanName(), bean);
    }
View Full Code Here

TOP

Related Classes of org.fenixedu.academic.domain.candidacyProcess.over23.Over23IndividualCandidacyProcess$BindPersonToCandidacy

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.