Example usage for org.joda.time DateTime getDayOfMonth

List of usage examples for org.joda.time DateTime getDayOfMonth

Introduction

In this page you can find the example usage for org.joda.time DateTime getDayOfMonth.

Prototype

public int getDayOfMonth() 

Source Link

Document

Get the day of month field value.

Usage

From source file:net.naijatek.myalumni.modules.admin.presentation.action.MaintainSystemModuleAction.java

License:Open Source License

/**
 * /* ww  w .j a  v  a 2 s  . c o  m*/
 * @param mapping
 * @param form
 * @param request
 * @param response
 * @return
 * @throws Exception
 */
public ActionForward databaseBackup(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    if (!adminSecurityCheck(request)) {
        return mapping.findForward(BaseConstants.FWD_ADMIN_LOGIN);
    }
    ActionMessages msgs = new ActionMessages();
    DateTime dtime = new DateTime(new Date());
    String dateStr = dtime.getMonthOfYear() + "_" + dtime.getDayOfMonth() + "_" + dtime.getYear() + "_"
            + dtime.getHourOfDay() + "_" + dtime.getMinuteOfHour() + "_" + dtime.getSecondOfMinute();

    try {
        sysService.systemDatabaseBackup(getSysProp().getValue("BACKUP.FILEPATH") + dateStr + ".sql");
    } catch (MyAlumniBaseException ex) {
        msgs.add(BaseConstants.ERROR_KEY, new ActionMessage(ex.getMessage()));
        saveMessages(request, msgs);
        return mapping.getInputForward();
    }

    msgs.add(BaseConstants.INFO_KEY, new ActionMessage("message.backupsuccessful", dateStr + ".sql"));
    saveMessages(request, msgs);

    listDatabaseBackupHelper(request);
    return mapping.findForward(BaseConstants.FWD_SUCCESS);
}

From source file:net.naijatek.myalumni.util.taglib.BirthdayListTag.java

License:Open Source License

/**
 * Process the end of this tag.//from w w  w . jav a2s .c  o m
 * 
 * @throws JspException
 *             if a JSP exception has occurred
 * @return int
 */
@Override
public final int doEndTag() throws JspException {

    request = (HttpServletRequest) pageContext.getRequest();
    StringBuffer sb = new StringBuffer();
    Calendar now = new GregorianCalendar();
    String seperator = "/";
    MemberVO user = new MemberVO();
    List<MemberVO> bdays = new ArrayList<MemberVO>();
    int today = now.get(Calendar.DATE);
    String rowCss = new String();
    String rootContext = request.getContextPath();
    String rootContextName = StringUtil.trimRootContext(request.getContextPath());

    try {
        bdays = memService.getBirthdayListOfTheMonth(String.valueOf((now.get(Calendar.MONTH) + 1)));

        sb.append("<table width=\"" + this.getTableWidth()
                + "\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" align=\"center\"  class=\"tborder\">");
        sb.append("<tr>");
        sb.append("<td height=\"30\" class=\"bg0\" colspan=\"3\">Happy Birthday this month of "
                + StringUtil.convertToAlphaMonth(now.get(Calendar.MONTH) + 1)
                + " to the following Alumni's.</td>");
        sb.append("</tr>");
        sb.append("<tr  class=\"portlet-section-body\">");
        sb.append("<td height=\"30\" class=\"bg0\">Alumni Name</td>");
        sb.append("<td height=\"30\" class=\"bg0\">Departure Year</td>");
        sb.append("<td height=\"30\" class=\"bg0\">Birthday</td>");
        sb.append("</tr>");

        int size = bdays.size();
        for (int i = 0; i < size; i++) {
            user = (MemberVO) bdays.get(i);
            DateTime dt = new DateTime(user.getDob());
            if (today == dt.getDayOfMonth()) {
                rowCss = "bgH";
            } else {
                rowCss = "portlet-section-body";
            }
            // sb.append("<tr bgcolor=\" + rowCss + \">");
            sb.append("<tr class=\"");
            sb.append(rowCss);
            sb.append("\">");
            sb.append("<td>");

            if (today == dt.getDayOfMonth()) {
                sb.append("<img src=\"" + rootContext.trim() + seperator
                        + "/images/icon/bday.jpg\" align=\"absmiddle\">");
            }
            sb.append("<a href=\"/");
            sb.append(rootContextName);
            sb.append("/action/member/displayMiniProfile?action=displayMiniProfile&memberUserName="
                    + user.getMemberUserName()
                    + "\" + onclick=\"newPopup(this.href,'name');return false\" title=\"View "
                    + user.getFirstName() + " " + user.getLastName() + " details\">" + user.getFirstName() + " "
                    + user.getLastName() + "</td>");
            sb.append("<td>" + user.getYearOut() + "</td>");
            sb.append("<td> " + StringUtil.dobPostfix(dt.getDayOfMonth()) + " of "
                    + StringUtil.convertToAlphaMonth(now.get(Calendar.MONTH) + 1) + " </td>");
            sb.append("</tr>");
        }
        if (size == 0) {
            rowCss = "portlet-section-body";
            sb.append("<tr class=\"");
            sb.append(rowCss);
            sb.append("\">");
            sb.append("<td class=\"fieldlabel\" colspan=\"3\">None.</td>");
            sb.append("</tr>");
        }
        sb.append("</table>");
    } catch (Exception ex) {
        logger.error(ex.getMessage());
        throw new JspException("IO Problem in BirthdayListTag " + ex.getMessage());
    }

    try {
        pageContext.getOut().print(sb.toString());
    } catch (Exception e) {
        logger.debug(e.getMessage());
        throw new JspException("IO Problem in BirthdayListTag " + e.getMessage());
    }

    return EVAL_PAGE;
}

From source file:net.sourceforge.fenixedu.applicationTier.Servico.person.vigilancy.ChangeConvokeActive.java

License:Open Source License

private static void sendEmailNotification(Boolean bool, Person person, Vigilancy convoke) {

    String replyTo = person.getEmail();

    VigilantGroup group = convoke.getAssociatedVigilantGroup();
    String groupEmail = group.getContactEmail();

    if (groupEmail != null) {
        if (person.isExamCoordinatorForVigilantGroup(group)) {
            replyTo = groupEmail;/*from   w  w  w  .j a v a  2 s  .c  o m*/
        }
    }

    WrittenEvaluation writtenEvaluation = convoke.getWrittenEvaluation();

    String emailMessage = generateMessage(bool, convoke);
    DateTime date = writtenEvaluation.getBeginningDateTime();
    String time = writtenEvaluation.getBeginningDateHourMinuteSecond().toString();
    String beginDateString = date.getDayOfMonth() + "-" + date.getMonthOfYear() + "-" + date.getYear();

    String subject = BundleUtil.getString(Bundle.VIGILANCY, "email.convoke.subject",
            new String[] { writtenEvaluation.getName(), group.getName(), beginDateString, time });

    new Message(PersonSender.newInstance(person), new ConcreteReplyTo(replyTo).asCollection(),
            new Recipient(VigilancyGroup.get(convoke)).asCollection(), Collections.EMPTY_LIST,
            Collections.EMPTY_LIST, subject, emailMessage, convoke.getSitesAndGroupEmails());

}

From source file:net.sourceforge.fenixedu.applicationTier.Servico.person.vigilancy.ChangeConvokeActive.java

License:Open Source License

private static String generateMessage(Boolean bool, Vigilancy convoke) {

    WrittenEvaluation writtenEvaluation = convoke.getWrittenEvaluation();
    DateTime beginDate = writtenEvaluation.getBeginningDateTime();
    String date = beginDate.getDayOfMonth() + "-" + beginDate.getMonthOfYear() + "-" + beginDate.getYear();

    return BundleUtil.getString(Bundle.VIGILANCY, "email.convoke.active.body",
            new String[] { convoke.getVigilantWrapper().getPerson().getName(),
                    (bool) ? BundleUtil.getString(Bundle.VIGILANCY, "email.convoke.convokedAgain")
                            : BundleUtil.getString(Bundle.VIGILANCY, "email.convoke.uncovoked"),
                    writtenEvaluation.getFullName(), date,
                    writtenEvaluation.getBeginningDateHourMinuteSecond().toString() });
}

From source file:net.sourceforge.fenixedu.applicationTier.Servico.person.vigilancy.CreateConvokes.java

License:Open Source License

@Atomic
public static void run(List<VigilantWrapper> vigilants, WrittenEvaluation writtenEvaluation,
        VigilantGroup group, ExamCoordinator coordinator, String emailMessage) {
    group.convokeVigilants(vigilants, writtenEvaluation);

    Set<Person> recievers = new HashSet<Person>();
    Set<String> bccs = new HashSet<String>();

    if (emailMessage.length() != 0) {
        Person person = coordinator.getPerson();
        for (VigilantWrapper vigilant : vigilants) {
            recievers.add(vigilant.getPerson());
        }/*  www .  j  a  va 2s  . c  o  m*/

        String groupEmail = group.getContactEmail();
        String replyTo;

        recievers.addAll(writtenEvaluation.getTeachers());

        if (groupEmail != null) {
            bccs.add(groupEmail);
            replyTo = groupEmail;
        } else {
            replyTo = person.getEmail();
        }

        DateTime date = writtenEvaluation.getBeginningDateTime();
        String beginDateString = date.getDayOfMonth() + "/" + date.getMonthOfYear() + "/" + date.getYear();

        String subject = BundleUtil.getString(Bundle.VIGILANCY, "email.convoke.subject", new String[] {
                group.getEmailSubjectPrefix(), writtenEvaluation.getName(), group.getName(), beginDateString });

        new Message(PersonSender.newInstance(person), new ConcreteReplyTo(replyTo).asCollection(),
                new Recipient(UserGroup.of(Person.convertToUsers(recievers))).asCollection(),
                Collections.EMPTY_LIST, Collections.EMPTY_LIST, subject, emailMessage, bccs);
    }
}

From source file:net.sourceforge.fenixedu.applicationTier.Servico.person.vigilancy.CreateUnavailablePeriod.java

License:Open Source License

private static void sendEmail(Person person, DateTime begin, DateTime end, String justification,
        List<VigilantGroup> groups) {
    for (VigilantGroup group : groups) {
        String bccs = group.getContactEmail();

        String beginDate = begin.getDayOfMonth() + "/" + begin.getMonthOfYear() + "/" + begin.getYear() + " - "
                + String.format("%02d", begin.getHourOfDay()) + ":"
                + String.format("%02d", begin.getMinuteOfHour()) + "h";
        String endDate = end.getDayOfMonth() + "/" + end.getMonthOfYear() + "/" + end.getYear() + " - "
                + String.format("%02d", end.getHourOfDay()) + ":" + String.format("%02d", end.getMinuteOfHour())
                + "h";
        ;//  w  ww .  j  a v a 2 s  .c o m
        String message = BundleUtil.getString(Bundle.VIGILANCY, "email.convoke.unavailablePeriod",
                new String[] { person.getName(), beginDate, endDate, justification });

        String subject = BundleUtil.getString(Bundle.VIGILANCY, "email.convoke.unavailablePeriod.subject",
                new String[] { group.getName() });

        Sender sender = Bennu.getInstance().getSystemSender();
        new Message(sender, new ConcreteReplyTo(group.getContactEmail()).asCollection(), Collections.EMPTY_LIST,
                subject, message, bccs);
    }
}

From source file:net.sourceforge.fenixedu.applicationTier.Servico.resourceAllocationManager.exams.DeleteWrittenEvaluation.java

License:Open Source License

private void notifyVigilants(WrittenEvaluation writtenEvaluation) {

    final Set<Person> tos = new HashSet<Person>();

    for (VigilantGroup group : writtenEvaluation.getAssociatedVigilantGroups()) {
        tos.clear();/*w ww .ja  v  a 2 s . c  o  m*/
        DateTime date = writtenEvaluation.getBeginningDateTime();
        String time = writtenEvaluation.getBeginningDateHourMinuteSecond().toString();
        String beginDateString = date.getDayOfMonth() + "-" + date.getMonthOfYear() + "-" + date.getYear();

        String subject = BundleUtil.getString(Bundle.VIGILANCY, "email.convoke.subject",
                new String[] { writtenEvaluation.getName(), group.getName(), beginDateString, time });
        String body = BundleUtil.getString(Bundle.VIGILANCY, "label.writtenEvaluationDeletedMessage",
                new String[] { writtenEvaluation.getName(), beginDateString, time });
        for (Vigilancy vigilancy : writtenEvaluation.getVigilanciesSet()) {
            Person person = vigilancy.getVigilantWrapper().getPerson();
            tos.add(person);
        }
        Sender sender = Bennu.getInstance().getSystemSender();
        new Message(sender, new ConcreteReplyTo(group.getContactEmail()).asCollection(),
                new Recipient(UserGroup.of(Person.convertToUsers(tos))).asCollection(), subject, body, "");

    }
}

From source file:net.sourceforge.fenixedu.applicationTier.Servico.resourceAllocationManager.exams.EditWrittenEvaluation.java

License:Open Source License

private void notifyVigilants(WrittenEvaluation writtenEvaluation, Date dayDate, Date beginDate) {

    final HashSet<Person> tos = new HashSet<Person>();

    // VigilantGroup group =
    // writtenEvaluation.getAssociatedVigilantGroups().iterator().next();
    for (VigilantGroup group : writtenEvaluation.getAssociatedVigilantGroups()) {
        tos.clear();//w w  w .  j  a v  a  2 s.c om
        DateTime date = writtenEvaluation.getBeginningDateTime();
        String time = writtenEvaluation.getBeginningDateHourMinuteSecond().toString();
        String beginDateString = date.getDayOfMonth() + "-" + date.getMonthOfYear() + "-" + date.getYear();

        String subject = String.format("[ %s - %s - %s %s ]",
                new Object[] { writtenEvaluation.getName(), group.getName(), beginDateString, time });
        String body = String.format(
                "Caro Vigilante,\n\nA prova de avaliao: %1$s %2$s - %3$s foi alterada para  %4$td-%4$tm-%4$tY - %5$tH:%5$tM.",
                new Object[] { writtenEvaluation.getName(), beginDateString, time, dayDate, beginDate });

        for (Vigilancy vigilancy : writtenEvaluation.getVigilanciesSet()) {
            Person person = vigilancy.getVigilantWrapper().getPerson();
            tos.add(person);
        }
        Sender sender = Bennu.getInstance().getSystemSender();
        new Message(sender, new ConcreteReplyTo(group.getContactEmail()).asCollection(),
                new Recipient(UserGroup.of(Person.convertToUsers(tos))).asCollection(), subject, body, "");
    }
}

From source file:net.sourceforge.fenixedu.domain.onlineTests.StudentTestLog.java

License:Open Source License

public static String getChecksum(DistributedTest distributedTest, Registration student, DateTime dateTime) {
    StringBuilder checksumCode = new StringBuilder();
    checksumCode.append(student.getNumber());
    checksumCode.append(distributedTest.getExternalId());
    final DateTime thisDateTime = new DateTime(dateTime.getYear(), dateTime.getMonthOfYear(),
            dateTime.getDayOfMonth(), dateTime.getHourOfDay(), dateTime.getMinuteOfHour(),
            dateTime.getSecondOfMinute(), 0);
    checksumCode.append(thisDateTime.getMillis());
    checksumCode.append(Bennu.getInstance().getTestChecksumsSet().iterator().next().getChecksumCode());
    return (Hashing.sha1().hashString(checksumCode.toString(), Charsets.UTF_8)).toString();
}

From source file:net.sourceforge.fenixedu.domain.reports.RaidesCommonReportFieldsWrapper.java

License:Open Source License

public static Row reportRaidesFields(final Spreadsheet sheet, final Registration registration,
        List<Registration> registrationPath, ExecutionYear executionYear, final CycleType cycleType,
        final boolean concluded, final YearMonthDay conclusionDate, BigDecimal average, boolean graduation) {

    final Row row = sheet.addRow();
    final Person graduate = registration.getPerson();
    //List<Registration> registrationPath = getFullRegistrationPath(registration);
    Registration sourceRegistration = registrationPath.iterator().next();
    final PersonalInformationBean personalInformationBean = registration
            .getPersonalInformationBean(executionYear);
    StudentCurricularPlan lastStudentCurricularPlan = registration.getLastStudentCurricularPlan();

    // Ciclo//from   w w w  .  j a  v a2s  .com
    row.setCell(cycleType.getDescription());

    // Concludo
    row.setCell(String.valueOf(concluded));

    // Mdia do Ciclo
    if (graduation) {
        row.setCell(concluded ? printBigDecimal(average.setScale(0, BigDecimal.ROUND_HALF_EVEN))
                : printBigDecimal(average));
    } else {
        row.setCell(concluded
                ? lastStudentCurricularPlan.getCycle(cycleType).getCurriculum().getAverage().toPlainString()
                : "n/a");
    }

    // Data de Concluso
    row.setCell(conclusionDate != null ? conclusionDate.toString("dd-MM-yyyy") : "");

    // Data de Incio
    row.setCell(registration.getStartDate() != null ? registration.getStartDate().toString("dd-MM-yyyy") : "");

    // N de aluno
    row.setCell(registration.getNumber());

    // Tipo Identificao
    row.setCell(graduate.getIdDocumentType().getLocalizedName());

    // N de Identificao
    row.setCell(graduate.getDocumentIdNumber());

    // Dgitos de Controlo
    row.setCell(graduate.getIdentificationDocumentExtraDigitValue());

    // Verso Doc. Identificao
    row.setCell(graduate.getIdentificationDocumentSeriesNumberValue());

    // Nome
    row.setCell(registration.getName());

    // Sexo
    row.setCell(graduate.getGender().toString());

    // Data de Nascimento
    row.setCell(graduate.getDateOfBirthYearMonthDay() != null
            ? graduate.getDateOfBirthYearMonthDay().toString("dd-MM-yyyy")
            : "n/a");

    // Pas de Nascimento
    row.setCell(graduate.getCountryOfBirth() != null ? graduate.getCountryOfBirth().getName() : "n/a");

    // Pas de Nacionalidade
    row.setCell(graduate.getCountry() != null ? graduate.getCountry().getName() : "n/a");

    // Tipo Curso
    row.setCell(registration.getDegreeType().getLocalizedName());

    // Nome Curso
    row.setCell(registration.getDegree().getNameI18N().getContent());

    // Sigla Curso
    row.setCell(registration.getDegree().getSigla());

    // Ramos do currculo do aluno
    final StringBuilder majorBranches = new StringBuilder();
    final StringBuilder minorBranches = new StringBuilder();
    for (final BranchCurriculumGroup group : lastStudentCurricularPlan.getBranchCurriculumGroups()) {
        if (group.isMajor()) {
            majorBranches.append(group.getName().toString()).append(",");
        } else if (group.isMinor()) {
            minorBranches.append(group.getName().toString()).append(",");
        }
    }

    // Ramo Principal
    if (majorBranches.length() > 0) {
        row.setCell(majorBranches.deleteCharAt(majorBranches.length() - 1).toString());
    } else {
        row.setCell("");
    }

    // Ramo Secundro
    if (minorBranches.length() > 0) {
        row.setCell(minorBranches.deleteCharAt(minorBranches.length() - 1).toString());
    } else {
        row.setCell("");
    }

    // Ano Curricular
    row.setCell(registration.getCurricularYear(executionYear));

    // Ano de Ingresso no Curso Actual
    row.setCell(sourceRegistration.getStartExecutionYear().getName());

    // N de anos lectivos de inscrio no Curso actual
    int numberOfEnrolmentYears = 0;
    for (Registration current : registrationPath) {
        numberOfEnrolmentYears += current.getNumberOfYearsEnrolledUntil(executionYear);
    }
    row.setCell(numberOfEnrolmentYears);

    // ltimo ano em que esteve inscrito
    row.setCell(registration.getLastEnrolmentExecutionYear() != null
            ? registration.getLastEnrolmentExecutionYear().getName()
            : "");

    // Regime de frequncia curso: Tempo integral/Tempo Parcial
    row.setCell(registration.getRegimeType(executionYear) != null
            ? registration.getRegimeType(executionYear).getName()
            : "");

    // Tipo de Aluno (AFA, AM, ERASMUS, etc)
    row.setCell(
            registration.getRegistrationProtocol() != null ? registration.getRegistrationProtocol().getCode()
                    : "");

    // Regime de Ingresso no Curso Actual (cdigo)
    Ingression ingression = sourceRegistration.getIngression();
    if (ingression == null && sourceRegistration.getStudentCandidacy() != null) {
        ingression = sourceRegistration.getStudentCandidacy().getIngression();
    }
    row.setCell(ingression != null ? ingression.getName() : "");

    // Regime de Ingresso no Curso Actual (designao)
    row.setCell(ingression != null ? ingression.getFullDescription() : "");

    // estabelecimento do grau preced.: Instituio onde esteve
    // inscrito mas no obteve grau, (e.g: transferencias, mudanas de
    // curso...)
    row.setCell(personalInformationBean.getPrecedentInstitution() != null
            ? personalInformationBean.getPrecedentInstitution().getName()
            : "");
    // curso grau preced.
    row.setCell(personalInformationBean.getPrecedentDegreeDesignation() != null
            ? personalInformationBean.getPrecedentDegreeDesignation()
            : "");

    // estabelec. curso habl anterior compl (se o aluno ingressou por uma via
    // diferente CNA, e deve ser IST caso o aluno tenha estado matriculado noutro curso do IST)
    row.setCell(personalInformationBean.getInstitution() != null
            ? personalInformationBean.getInstitution().getName()
            : "");

    // curso habl anterior compl (se o aluno ingressou por uma via diferente CNA, e
    // deve ser IST caso o aluno tenha estado matriculado noutro curso do IST)
    row.setCell(personalInformationBean.getDegreeDesignation());

    // n inscries no curso preced. (conta uma por cada ano)
    row.setCell(personalInformationBean.getNumberOfPreviousYearEnrolmentsInPrecedentDegree() != null
            ? personalInformationBean.getNumberOfPreviousYearEnrolmentsInPrecedentDegree().toString()
            : "");

    // Nota de Ingresso
    Double entryGrade = null;
    if (registration.getStudentCandidacy() != null) {
        entryGrade = registration.getStudentCandidacy().getEntryGrade();
    }

    row.setCell(printDouble(entryGrade));

    // Opo de Ingresso
    Integer placingOption = null;
    if (registration.getStudentCandidacy() != null) {
        placingOption = registration.getStudentCandidacy().getPlacingOption();
    }

    row.setCell(placingOption);

    // Estado Civil
    row.setCell(personalInformationBean.getMaritalStatus() != null
            ? personalInformationBean.getMaritalStatus().toString()
            : registration.getPerson().getMaritalStatus().toString());

    // Pas de Residncia Permanente
    if (personalInformationBean.getCountryOfResidence() != null) {
        row.setCell(personalInformationBean.getCountryOfResidence().getName());
    } else {
        row.setCell(registration.getStudent().getPerson().getCountryOfResidence() != null
                ? registration.getStudent().getPerson().getCountryOfResidence().getName()
                : "");
    }

    // Distrito de Residncia Permanente
    if (personalInformationBean.getDistrictSubdivisionOfResidence() != null) {
        row.setCell(personalInformationBean.getDistrictSubdivisionOfResidence().getDistrict().getName());
    } else {
        row.setCell(registration.getStudent().getPerson().getDistrictOfResidence());
    }

    // Concelho de Residncia Permanente
    if (personalInformationBean.getDistrictSubdivisionOfResidence() != null) {
        row.setCell(personalInformationBean.getDistrictSubdivisionOfResidence().getName());
    } else {
        row.setCell(registration.getStudent().getPerson().getDistrictSubdivisionOfResidence());
    }

    // Deslocado da Residncia Permanente
    if (personalInformationBean.getDislocatedFromPermanentResidence() != null) {
        row.setCell(personalInformationBean.getDislocatedFromPermanentResidence().toString());
    } else {
        row.setCell("");
    }

    // Nvel de Escolaridade do Pai
    if (personalInformationBean.getFatherSchoolLevel() != null) {
        row.setCell(personalInformationBean.getFatherSchoolLevel().getName());
    } else {
        row.setCell("");
    }

    // Nvel de Escolaridade da Me
    if (personalInformationBean.getMotherSchoolLevel() != null) {
        row.setCell(personalInformationBean.getMotherSchoolLevel().getName());
    } else {
        row.setCell("");
    }

    // Condio perante a situao na profisso/Ocupao do
    // Pai
    if (personalInformationBean.getFatherProfessionalCondition() != null) {
        row.setCell(personalInformationBean.getFatherProfessionalCondition().getName());
    } else {
        row.setCell("");
    }

    // Condio perante a situao na profisso/Ocupao da
    // Me
    if (personalInformationBean.getMotherProfessionalCondition() != null) {
        row.setCell(personalInformationBean.getMotherProfessionalCondition().getName());
    } else {
        row.setCell("");
    }

    // Profisso do Pai
    if (personalInformationBean.getFatherProfessionType() != null) {
        row.setCell(personalInformationBean.getFatherProfessionType().getName());
    } else {
        row.setCell("");
    }

    // Profisso da Me
    if (personalInformationBean.getMotherProfessionType() != null) {
        row.setCell(personalInformationBean.getMotherProfessionType().getName());
    } else {
        row.setCell("");
    }

    // Profisso do Aluno
    if (personalInformationBean.getProfessionType() != null) {
        row.setCell(personalInformationBean.getProfessionType().getName());
    } else {
        row.setCell("");
    }

    // Data preenchimento dados RAIDES
    if (personalInformationBean.getLastModifiedDate() != null) {
        DateTime dateTime = personalInformationBean.getLastModifiedDate();
        row.setCell(dateTime.getYear() + "-" + dateTime.getMonthOfYear() + "-" + dateTime.getDayOfMonth());
    } else {
        row.setCell("");
    }

    // Estatuto de Trabalhador Estudante introduzido pelo aluno
    if (personalInformationBean.getProfessionalCondition() != null) {
        row.setCell(personalInformationBean.getProfessionalCondition().getName());
    } else {
        row.setCell("");
    }

    // Estatuto de Trabalhador Estudante 1 semestre do ano a que se
    // referem
    // os dados
    boolean working1Found = false;
    for (StudentStatute statute : registration.getStudent().getStudentStatutesSet()) {
        if (statute.getStatuteType() == StudentStatuteType.WORKING_STUDENT
                && statute.isValidInExecutionPeriod(executionYear.getFirstExecutionPeriod())) {
            working1Found = true;
            break;
        }
    }
    row.setCell(String.valueOf(working1Found));

    // Estatuto de Trabalhador Estudante 1 semestre do ano a que se
    // referem
    // os dados
    boolean working2Found = false;
    for (StudentStatute statute : registration.getStudent().getStudentStatutesSet()) {
        if (statute.getStatuteType() == StudentStatuteType.WORKING_STUDENT
                && statute.isValidInExecutionPeriod(executionYear.getLastExecutionPeriod())) {
            working2Found = true;
            break;
        }
    }
    row.setCell(String.valueOf(working2Found));

    // Bolseiro (info. RAIDES)
    if (personalInformationBean.getGrantOwnerType() != null) {
        row.setCell(personalInformationBean.getGrantOwnerType().getName());
    } else {
        row.setCell("");
    }

    // Instituio que atribuiu a bolsa
    if (personalInformationBean.getGrantOwnerType() != null && personalInformationBean.getGrantOwnerType()
            .equals(GrantOwnerType.OTHER_INSTITUTION_GRANT_OWNER)) {
        row.setCell(personalInformationBean.getGrantOwnerProviderName());
    } else {
        row.setCell("");
    }

    // Bolseiro (info. oficial)
    boolean sasFound = false;
    for (StudentStatute statute : registration.getStudent().getStudentStatutesSet()) {
        if (statute.getStatuteType() == StudentStatuteType.SAS_GRANT_OWNER
                && statute.isValidInExecutionPeriod(executionYear.getFirstExecutionPeriod())) {
            sasFound = true;
            break;
        }
    }
    row.setCell(String.valueOf(sasFound));

    // Grau Precedente
    row.setCell(personalInformationBean.getPrecedentSchoolLevel() != null
            ? personalInformationBean.getPrecedentSchoolLevel().getName()
            : "");

    // Outro Grau Precedente
    row.setCell(personalInformationBean.getOtherPrecedentSchoolLevel());

    // grau da habl anterior compl
    row.setCell(personalInformationBean.getSchoolLevel() != null
            ? personalInformationBean.getSchoolLevel().getName()
            : "");

    // Codigo do grau habl anterior
    DegreeDesignation designation = DegreeDesignation.readByNameAndSchoolLevel(
            personalInformationBean.getDegreeDesignation(), personalInformationBean.getPrecedentSchoolLevel());
    row.setCell(designation != null ? designation.getDegreeClassification().getCode() : "");

    // Outro grau da habl anterior compl
    row.setCell(personalInformationBean.getOtherSchoolLevel());

    // Pas de Habilitao Anterior ao Curso Actual
    row.setCell(personalInformationBean.getCountryWhereFinishedPreviousCompleteDegree() != null
            ? personalInformationBean.getCountryWhereFinishedPreviousCompleteDegree().getName()
            : "");

    // Pas de Habilitao do 12 ano ou equivalente
    row.setCell(personalInformationBean.getCountryWhereFinishedHighSchoolLevel() != null
            ? personalInformationBean.getCountryWhereFinishedHighSchoolLevel().getName()
            : "");

    // Ano de concluso da habilitao anterior
    row.setCell(personalInformationBean.getConclusionYear());

    // Nota de concluso da habilitao anterior
    row.setCell(
            personalInformationBean.getConclusionGrade() != null ? personalInformationBean.getConclusionGrade()
                    : "");

    MobilityAgreement mobilityAgreement = null;
    ExecutionInterval chosenCandidacyInterval = null;
    //getting the last mobility program done
    for (OutboundMobilityCandidacySubmission outboundCandidacySubmission : registration
            .getOutboundMobilityCandidacySubmissionSet()) {
        if (outboundCandidacySubmission.getSelectedCandidacy() != null
                && outboundCandidacySubmission.getSelectedCandidacy().getSelected()) {
            ExecutionInterval candidacyInterval = outboundCandidacySubmission
                    .getOutboundMobilityCandidacyPeriod().getExecutionInterval();
            //the candidacies are made in the previous year
            if (candidacyInterval.getAcademicInterval().isBefore(executionYear.getAcademicInterval())) {
                if (mobilityAgreement != null) {
                    if (!candidacyInterval.getAcademicInterval()
                            .isAfter(chosenCandidacyInterval.getAcademicInterval())) {
                        continue;
                    }
                }
                mobilityAgreement = outboundCandidacySubmission.getSelectedCandidacy()
                        .getOutboundMobilityCandidacyContest().getMobilityAgreement();
                chosenCandidacyInterval = candidacyInterval;
            }
        }
    }
    // Programa de mobilidade
    row.setCell(mobilityAgreement != null ? mobilityAgreement.getMobilityProgram().getName().getContent() : "");

    // Pas de mobilidade
    row.setCell(mobilityAgreement != null ? mobilityAgreement.getUniversityUnit().getCountry().getName() : "");

    // Durao do programa de mobilidade
    row.setCell(personalInformationBean.getMobilityProgramDuration() != null ? BundleUtil
            .getString(Bundle.ENUMERATION, personalInformationBean.getMobilityProgramDuration().name()) : "");

    // Tipo de Estabelecimento Frequentado no Ensino Secundrio
    if (personalInformationBean.getHighSchoolType() != null) {
        row.setCell(personalInformationBean.getHighSchoolType().getName());
    } else {
        row.setCell("");
    }

    int totalEnrolmentsInPreviousYear = 0;
    int totalEnrolmentsApprovedInPreviousYear = 0;
    //int totalEnrolmentsInFirstSemester = 0;
    double totalEctsConcludedUntilPreviousYear = 0d;
    for (final CycleCurriculumGroup cycleCurriculumGroup : lastStudentCurricularPlan
            .getInternalCycleCurriculumGrops()) {

        totalEctsConcludedUntilPreviousYear += cycleCurriculumGroup
                .getCreditsConcluded(executionYear.getPreviousExecutionYear());

        totalEnrolmentsInPreviousYear += cycleCurriculumGroup
                .getEnrolmentsBy(executionYear.getPreviousExecutionYear()).size();

        for (final Enrolment enrolment : cycleCurriculumGroup
                .getEnrolmentsBy(executionYear.getPreviousExecutionYear())) {
            if (enrolment.isApproved()) {
                totalEnrolmentsApprovedInPreviousYear++;
            }
        }

        //       totalEnrolmentsInFirstSemester += cycleCurriculumGroup.getEnrolmentsBy(executionYear.getFirstExecutionPeriod())
        //          .size();
    }

    // Total de ECTS inscritos no total do ano
    double totalCreditsEnrolled = 0d;
    for (Enrolment enrollment : lastStudentCurricularPlan.getEnrolmentsByExecutionYear(executionYear)) {
        totalCreditsEnrolled += enrollment.getEctsCredits();
    }
    row.setCell(printDouble(totalCreditsEnrolled));

    // Total de ECTS concludos at ao fim do ano lectivo anterior ao
    // que se
    // referem os dados (neste caso at ao fim de 2007/08) no curso actual
    double totalCreditsDismissed = 0d;
    for (Credits credits : lastStudentCurricularPlan.getCreditsSet()) {
        if (credits.isEquivalence()) {
            totalCreditsDismissed += credits.getEnrolmentsEcts();
        }
    }
    row.setCell(printDouble(totalEctsConcludedUntilPreviousYear));

    // N de Disciplinas Inscritos no ano lectivo anterior ao que se
    // referem
    // os dados
    row.setCell(totalEnrolmentsInPreviousYear);

    // N de Disciplinas Aprovadas no ano lectivo anterior ao que se
    // referem
    // os dados
    row.setCell(totalEnrolmentsApprovedInPreviousYear);

    // N de Inscries Externas no ano a que se referem os dados
    ExtraCurriculumGroup extraCurriculumGroup = lastStudentCurricularPlan.getExtraCurriculumGroup();
    int extraCurricularEnrolmentsCount = extraCurriculumGroup != null
            ? extraCurriculumGroup.getEnrolmentsBy(executionYear).size()
            : 0;

    for (final CycleCurriculumGroup cycleCurriculumGroup : lastStudentCurricularPlan
            .getExternalCurriculumGroups()) {
        extraCurricularEnrolmentsCount += cycleCurriculumGroup.getEnrolmentsBy(executionYear).size();
    }

    if (lastStudentCurricularPlan.hasPropaedeuticsCurriculumGroup()) {
        extraCurricularEnrolmentsCount += lastStudentCurricularPlan.getPropaedeuticCurriculumGroup()
                .getEnrolmentsBy(executionYear).size();
    }

    row.setCell(extraCurricularEnrolmentsCount);

    // Estados de matrcula
    SortedSet<RegistrationState> states = new TreeSet<RegistrationState>(RegistrationState.DATE_COMPARATOR);
    for (Registration current : registrationPath) {
        states.addAll(current.getRegistrationStatesSet());
    }
    RegistrationState previousYearState = null;
    RegistrationState currentYearState = null;
    for (RegistrationState state : states) {
        if (!state.getStateDate().isAfter(
                executionYear.getPreviousExecutionYear().getEndDateYearMonthDay().toDateTimeAtMidnight())) {
            previousYearState = state;
        }
        if (!state.getStateDate().isAfter(executionYear.getEndDateYearMonthDay().toDateTimeAtMidnight())) {
            currentYearState = state;
        }
    }

    // Estado da matrcula no ano lectivo anterior ao que se referem os
    // dados
    row.setCell(previousYearState != null ? previousYearState.getStateType().getDescription() : "n/a");

    // Estado (da matrcula) no ano a que se referem os dados
    row.setCell(currentYearState != null ? currentYearState.getStateType().getDescription() : "n/a");

    // Data do estado de matrcula
    row.setCell(currentYearState != null ? currentYearState.getStateDate().toString("dd-MM-yyyy") : "n/a");

    // N ECTS do 1 Ciclo concludos at ao fim do ano lectivo
    // anterior ao que se referem os dados
    final CycleCurriculumGroup firstCycleCurriculumGroup = lastStudentCurricularPlan.getRoot()
            .getCycleCurriculumGroup(CycleType.FIRST_CYCLE);
    row.setCell(firstCycleCurriculumGroup != null
            ? printBigDecimal(firstCycleCurriculumGroup.getCurriculum(executionYear).getSumEctsCredits())
            : "");

    // N ECTS do 2 Ciclo concludos at ao fim do ano lectivo
    // anterior ao que se referem os dados
    final CycleCurriculumGroup secondCycleCurriculumGroup = lastStudentCurricularPlan.getRoot()
            .getCycleCurriculumGroup(CycleType.SECOND_CYCLE);
    row.setCell(secondCycleCurriculumGroup != null && !secondCycleCurriculumGroup.isExternal()
            ? printBigDecimal(secondCycleCurriculumGroup.getCurriculum(executionYear).getSumEctsCredits())
            : "");

    // N ECTS do 2 Ciclo Extra primeiro ciclo concludos at ao fim do ano
    // lectivo anterior ao que se referem os dados
    Double extraFirstCycleEcts = 0d;
    for (final CycleCurriculumGroup cycleCurriculumGroup : lastStudentCurricularPlan
            .getExternalCurriculumGroups()) {
        for (final CurriculumLine curriculumLine : cycleCurriculumGroup.getAllCurriculumLines()) {
            if (!curriculumLine.getExecutionYear().isAfter(executionYear.getPreviousExecutionYear())) {
                extraFirstCycleEcts += curriculumLine
                        .getCreditsConcluded(executionYear.getPreviousExecutionYear());
            }
        }
    }
    row.setCell(printDouble(extraFirstCycleEcts));

    // N ECTS Extracurriculares concludos at ao fim do ano lectivo
    // anterior que ao se referem os dados
    Double extraCurricularEcts = 0d;
    Double allExtraCurricularEcts = 0d;
    if (extraCurriculumGroup != null) {
        for (final CurriculumLine curriculumLine : extraCurriculumGroup.getAllCurriculumLines()) {
            if (curriculumLine.isApproved() && curriculumLine.hasExecutionPeriod()
                    && !curriculumLine.getExecutionYear().isAfter(executionYear.getPreviousExecutionYear())) {
                extraCurricularEcts += curriculumLine.getEctsCreditsForCurriculum().doubleValue();
            }
            if (curriculumLine.hasExecutionPeriod() && curriculumLine.getExecutionYear() == executionYear) {
                allExtraCurricularEcts += curriculumLine.getEctsCreditsForCurriculum().doubleValue();
            }
        }
    }
    row.setCell(printDouble(extraCurricularEcts));

    // N ECTS Propedeutic concludos at ao fim do ano lectivo
    // anterior que ao se referem os dados
    Double propaedeuticEcts = 0d;
    Double allPropaedeuticEcts = 0d;
    if (lastStudentCurricularPlan.getPropaedeuticCurriculumGroup() != null) {
        for (final CurriculumLine curriculumLine : lastStudentCurricularPlan.getPropaedeuticCurriculumGroup()
                .getAllCurriculumLines()) {
            if (curriculumLine.isApproved() && curriculumLine.hasExecutionPeriod()
                    && !curriculumLine.getExecutionYear().isAfter(executionYear.getPreviousExecutionYear())) {
                propaedeuticEcts += curriculumLine.getEctsCreditsForCurriculum().doubleValue();
            }
            if (curriculumLine.hasExecutionPeriod() && curriculumLine.getExecutionYear() == executionYear) {
                allPropaedeuticEcts += curriculumLine.getEctsCreditsForCurriculum().doubleValue();
            }
        }
    }
    row.setCell(printDouble(propaedeuticEcts));

    // N ECTS inscritos em unidades curriculares propeduticas e em
    // extra-curriculares
    row.setCell(printDouble(allPropaedeuticEcts + allExtraCurricularEcts));

    // N ECTS equivalncia/substituio/dispensa
    row.setCell(printDouble(totalCreditsDismissed));

    // Tem situao de propinas no lectivo dos dados
    row.setCell(String.valueOf(lastStudentCurricularPlan.hasAnyGratuityEventFor(executionYear)));

    return row;
}