Example usage for org.joda.time LocalDate getYear

List of usage examples for org.joda.time LocalDate getYear

Introduction

In this page you can find the example usage for org.joda.time LocalDate getYear.

Prototype

public int getYear() 

Source Link

Document

Get the year field value.

Usage

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

License:Open Source License

@Override
public void renderReport(Spreadsheet spreadsheet) throws Exception {

    ExecutionYear executionYear = getExecutionYear();
    int civilYear = executionYear.getBeginCivilYear();
    fillSpreadsheet(spreadsheet);/*from  w w  w . ja v  a2s  .  c om*/

    logger.info("BEGIN report for " + getDegreeType().name());

    List<PhdIndividualProgramProcess> retrieveProcesses = retrieveProcesses(executionYear);

    for (PhdIndividualProgramProcess phdIndividualProgramProcess : retrieveProcesses) {
        if (phdIndividualProgramProcess.isConcluded()) {
            LocalDate conclusionDate = phdIndividualProgramProcess.getThesisProcess().getConclusionDate();

            if (conclusionDate == null
                    || (conclusionDate.getYear() != civilYear && conclusionDate.getYear() != civilYear - 1
                            && conclusionDate.getYear() != civilYear + 1)) {
                continue;
            }
        }
        if (phdIndividualProgramProcess.isConcluded() || phdIndividualProgramProcess.getHasStartedStudies()) {

            reportRaidesGraduate(spreadsheet, phdIndividualProgramProcess, executionYear);
        }
    }
}

From source file:net.sourceforge.fenixedu.domain.Tutorship.java

License:Open Source License

public static int getLastPossibleTutorshipYear() {
    LocalDate currentDate = new LocalDate();
    return currentDate.getYear() + TUTORSHIP_MAX_PERIOD;
}

From source file:net.sourceforge.fenixedu.presentationTier.docs.academicAdministrativeOffice.RegistryDiploma.java

License:Open Source License

private String getFormatedCurrentDate(String universityName) {
    final StringBuilder result = new StringBuilder();
    LocalDate date = new LocalDate();
    String day = Integer.toString(date.getDayOfMonth());
    String month = date.toString("MMMM", getLocale());
    if (getDocumentRequest().getLanguage().getLanguage().equals(Locale.getDefault().getLanguage())) {
        month = month.toLowerCase();//  ww  w .  jav a 2 s  .co  m
    }
    result.append(universityName).append(", ");
    result.append(day + " ");
    result.append(BundleUtil.getString(Bundle.APPLICATION, getLocale(), "label.of"));
    result.append(" " + month + " ");
    result.append(BundleUtil.getString(Bundle.APPLICATION, getLocale(), "label.of"));
    result.append(" ").append(date.getYear()).append(".");
    return result.toString();
}

From source file:net.sourceforge.fenixedu.presentationTier.docs.academicAdministrativeOffice.RegistryDiploma.java

License:Open Source License

protected String[] getDateByWords(LocalDate date) {

    String day = Integer.toString(date.getDayOfMonth());
    String month = date.toString("MMMM", getLocale());
    if (getDocumentRequest().getLanguage().getLanguage().equals(Locale.getDefault().getLanguage())) {
        month = month.toLowerCase();/*from   w  w w. j  a va2  s.com*/
    }
    String year = Integer.toString(date.getYear());
    String finalDate[] = new String[] { day, month, year };
    return finalDate;

}

From source file:net.sourceforge.fenixedu.presentationTier.docs.FenixReport.java

License:Open Source License

protected String verboseDate(LocalDate date) {
    return "dia " + DateI18NUtil.verboseNumber(date.getDayOfMonth()) + " do ms de "
            + date.toString("MMMM", new Locale("pt")) + " de " + DateI18NUtil.verboseNumber(date.getYear());
}

From source file:op.allowance.PnlAllowance.java

License:Open Source License

private JPanel createContentPanel4(final Resident resident) {
    JPanel pnlContent = new JPanel(new VerticalLayout());

    final JidePopup popupTX = new JidePopup();
    popupTX.setMovable(false);//from   w  ww. ja v  a  2 s  . c o m

    PnlTX pnlTX = getPnlTX(resident, null);

    popupTX.setContentPane(pnlTX);
    popupTX.removeExcludedComponent(pnlTX);
    popupTX.setDefaultFocusComponent(pnlTX);

    final JideButton btnNewTX = GUITools.createHyperlinkButton(SYSTools.xx("admin.residents.cash.enterTXs"),
            SYSConst.icon22add, null);
    btnNewTX.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            popupTX.setOwner(btnNewTX);
            GUITools.showPopup(popupTX, SwingConstants.NORTH);
        }
    });
    btnNewTX.setBackground(getBG(resident, 9));
    btnNewTX.setOpaque(true);
    pnlContent.add(btnNewTX);

    if (!minmax.containsKey(resident)) {
        minmax.put(resident, AllowanceTools.getMinMax(resident));
    }

    if (minmax.get(resident) != null) {

        LocalDate start = SYSCalendar.bom(minmax.get(resident).getFirst());
        LocalDate end = resident.isActive() ? new LocalDate()
                : SYSCalendar.eom(minmax.get(resident).getSecond());

        CollapsiblePane cpArchive = new CollapsiblePane(SYSTools.xx("admin.residents.cash.archive"));
        try {
            cpArchive.setCollapsed(true);
        } catch (PropertyVetoException e) {
            //bah!
        }
        cpArchive.setBackground(getBG(resident, 7));
        JPanel pnlArchive = new JPanel(new VerticalLayout());
        cpArchive.setContentPane(pnlArchive);
        for (int year = end.getYear(); year >= start.getYear(); year--) {
            if (year >= new LocalDate().getYear() - 1) {
                pnlContent.add(createCP4(resident, year));
            } else if (OPDE.getAppInfo().isAllowedTo(InternalClassACL.ARCHIVE, internalClassID)) {
                pnlArchive.add(createCP4(resident, year));
            }
        }
        if (pnlArchive.getComponentCount() > 0) {
            pnlContent.add(cpArchive);
        }
    }
    return pnlContent;
}

From source file:op.allowance.PnlAllowance.java

License:Open Source License

private String getKey(Resident resident, LocalDate month) {
    return resident.getRID() + "-" + month.getYear() + "-" + month.getMonthOfYear();
}

From source file:op.care.reports.PnlReport.java

License:Open Source License

private void reloadDisplay(final boolean lockmessageAfterwards) {
    /***/*from   w w w . j a  v a2  s  . co m*/
     *               _                 _ ____  _           _
     *      _ __ ___| | ___   __ _  __| |  _ \(_)___ _ __ | | __ _ _   _
     *     | '__/ _ \ |/ _ \ / _` |/ _` | | | | / __| '_ \| |/ _` | | | |
     *     | | |  __/ | (_) | (_| | (_| | |_| | \__ \ |_) | | (_| | |_| |
     *     |_|  \___|_|\___/ \__,_|\__,_|____/|_|___/ .__/|_|\__,_|\__, |
     *                                              |_|            |___/
     */

    synchronized (contentmap) {
        SYSTools.clear(contentmap);
    }
    synchronized (cpMap) {
        SYSTools.clear(cpMap);
    }

    synchronized (linemap) {
        SYSTools.clear(linemap);
    }
    synchronized (valuecache) {
        SYSTools.clear(valuecache);
    }

    initPhase = true;

    OPDE.getMainframe().setBlocked(true);
    OPDE.getDisplayManager().setProgressBarMessage(new DisplayMessage(SYSTools.xx("misc.msg.wait"), -1, 100));
    final long time = System.currentTimeMillis();

    SwingWorker worker = new SwingWorker() {
        Date max = null;

        @Override
        protected Object doInBackground() throws Exception {

            GUITools.setResidentDisplay(resident);

            if (minmax == null) {
                minmax = NReportTools.getMinMax(resident);
            }

            holidays = Collections.synchronizedMap(
                    SYSCalendar.getHolidays(minmax.getStart().getYear(), minmax.getEnd().getYear()));

            if (minmax != null) {
                max = minmax.getEnd().toDate();
                LocalDate start = SYSCalendar.bom(minmax.getStart()).toLocalDate();
                LocalDate end = resident.isActive() ? new LocalDate()
                        : SYSCalendar.bom(minmax.getEnd()).toLocalDate();

                int maxYears = Years.yearsBetween(start.toDateTimeAtStartOfDay(), end.toDateTimeAtStartOfDay())
                        .getYears();

                int i = 0;
                for (int year = end.getYear(); year >= start.getYear(); year--) {
                    OPDE.debug((System.currentTimeMillis() - time) + " ms");
                    i++;
                    OPDE.getDisplayManager().setProgressBarMessage(
                            new DisplayMessage(SYSTools.xx("misc.msg.wait"), i, maxYears));
                    createCP4Year(year, start, end);
                }

                OPDE.debug((System.currentTimeMillis() - time) + " ms1");
            }

            return null;
        }

        @Override
        protected void done() {
            OPDE.debug((System.currentTimeMillis() - time) + " ms2");
            expandTheLast2Weeks();

            OPDE.debug((System.currentTimeMillis() - time) + " ms3");
            buildPanel();
            OPDE.debug((System.currentTimeMillis() - time) + " ms4");
            initPhase = false;
            OPDE.getDisplayManager().setProgressBarMessage(null);
            OPDE.getMainframe().setBlocked(false);
            if (lockmessageAfterwards)
                OPDE.getDisplayManager().addSubMessage(DisplayManager.getLockMessage());
            if (max != null) {
                OPDE.getDisplayManager().addSubMessage(new DisplayMessage(
                        SYSTools.xx("misc.msg.lastEntry") + ": " + DateFormat.getDateInstance().format(max),
                        5));
            } else {
                OPDE.getDisplayManager()
                        .addSubMessage(new DisplayMessage(SYSTools.xx("misc.msg.noentryyet"), 5));
            }
        }
    };
    worker.execute();
}

From source file:op.care.reports.PnlReport.java

License:Open Source License

private void buildPanel() {
    cpsReports.removeAll();//  www  .  j  ava2  s  . com
    cpsReports.setLayout(new JideBoxLayout(cpsReports, JideBoxLayout.Y_AXIS));

    synchronized (cpMap) {
        //            Pair<DateTime, DateTime> minmax = NReportTools.getMinMax(resident);
        if (minmax != null) {
            LocalDate start = SYSCalendar.bom(minmax.getStart()).toLocalDate();
            LocalDate end = resident.isActive() ? new LocalDate()
                    : SYSCalendar.eom(minmax.getEnd()).toLocalDate();
            for (int year = end.getYear(); year >= start.getYear(); year--) {
                final String keyYear = Integer.toString(year) + ".year";

                // todo: to track down the NPEs.
                if (cpMap.get(keyYear) == null) {
                    reload();
                    break;
                }

                cpsReports.add(cpMap.get(keyYear));
            }
        }
    }
    cpsReports.addExpansion();
}

From source file:op.care.reports.PnlReport.java

License:Open Source License

private void expandDay(LocalDate day) {
    final String keyYear = Integer.toString(day.getYear()) + ".year";
    if (cpMap.containsKey(keyYear) && cpMap.get(keyYear).isCollapsed()) {
        try {//w ww  .j  a v  a2s.  c o  m
            cpMap.get(keyYear).setCollapsed(false);
        } catch (PropertyVetoException e) {
            // bah!
        }
    }
    final String keyMonth = monthFormatter.format(day.toDate()) + ".month";
    if (cpMap.containsKey(keyMonth) && cpMap.get(keyMonth).isCollapsed()) {
        try {
            cpMap.get(keyMonth).setCollapsed(false);
        } catch (PropertyVetoException e) {
            // bah!
        }
    }
    final String keyThisWeek = weekFormater.format(day.toDate()) + ".week";
    if (cpMap.containsKey(keyThisWeek) && cpMap.get(keyThisWeek).isCollapsed()) {
        try {
            cpMap.get(keyThisWeek).setCollapsed(false);
        } catch (PropertyVetoException e) {
            // bah!
        }
    }
    final String keyDay = DateFormat.getDateInstance().format(day.toDate());
    if (cpMap.containsKey(keyDay) && cpMap.get(keyDay).isCollapsed()) {
        try {
            cpMap.get(keyDay).setCollapsed(false);
        } catch (PropertyVetoException e) {
            // bah!
        }
    }
}