当前位置: 首页>>代码示例>>Java>>正文


Java DateMidnight.isBefore方法代码示例

本文整理汇总了Java中org.joda.time.DateMidnight.isBefore方法的典型用法代码示例。如果您正苦于以下问题:Java DateMidnight.isBefore方法的具体用法?Java DateMidnight.isBefore怎么用?Java DateMidnight.isBefore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.joda.time.DateMidnight的用法示例。


在下文中一共展示了DateMidnight.isBefore方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validateNotTooFarInThePast

import org.joda.time.DateMidnight; //导入方法依赖的package包/类
private void validateNotTooFarInThePast(DateMidnight date, AbsenceSettings settings, Errors errors) {

        Integer maximumMonths = settings.getMaximumMonthsToApplyForLeaveInAdvance();
        DateMidnight past = DateMidnight.now().minusMonths(maximumMonths);

        if (date.isBefore(past)) {
            errors.reject(ERROR_PAST);
        }
    }
 
开发者ID:synyx,项目名称:urlaubsverwaltung,代码行数:10,代码来源:ApplicationValidator.java

示例2: validatePeriod

import org.joda.time.DateMidnight; //导入方法依赖的package包/类
private void validatePeriod(OvertimeForm overtimeForm, Errors errors) {

        DateMidnight startDate = overtimeForm.getStartDate();
        DateMidnight endDate = overtimeForm.getEndDate();

        validateDateNotNull(startDate, ATTRIBUTE_START_DATE, errors);
        validateDateNotNull(endDate, ATTRIBUTE_END_DATE, errors);

        if (startDate != null && endDate != null && endDate.isBefore(startDate)) {
            errors.rejectValue(ATTRIBUTE_END_DATE, ERROR_INVALID_PERIOD);
        }
    }
 
开发者ID:synyx,项目名称:urlaubsverwaltung,代码行数:13,代码来源:OvertimeValidator.java

示例3: getSickNotes

import org.joda.time.DateMidnight; //导入方法依赖的package包/类
private List<DayAbsence> getSickNotes(DateMidnight start, DateMidnight end, Person person) {

        List<DayAbsence> absences = new ArrayList<>();

        List<SickNote> sickNotes = sickNoteService.getByPersonAndPeriod(person, start, end)
                .stream()
                .filter(SickNote::isActive)
                .collect(Collectors.toList());

        for (SickNote sickNote : sickNotes) {
            DateMidnight startDate = sickNote.getStartDate();
            DateMidnight endDate = sickNote.getEndDate();

            DateMidnight day = startDate;

            while (!day.isAfter(endDate)) {
                if (!day.isBefore(start) && !day.isAfter(end)) {
                    absences.add(new DayAbsence(day, sickNote.getDayLength(), DayAbsence.Type.SICK_NOTE, "ACTIVE",
                            sickNote.getId()));
                }

                day = day.plusDays(1);
            }
        }

        return absences;
    }
 
开发者ID:synyx,项目名称:urlaubsverwaltung,代码行数:28,代码来源:AbsenceController.java

示例4: getListOfGaps

import org.joda.time.DateMidnight; //导入方法依赖的package包/类
/**
 * Get a list of gaps within the given intervals.
 *
 * @param  startDate  defines the start of the period
 * @param  endDate  defines the end of the period
 * @param  listOfOverlaps  list of overlaps
 *
 * @return  {@link List} of gaps
 */
private List<Interval> getListOfGaps(DateMidnight startDate, DateMidnight endDate, List<Interval> listOfOverlaps) {

    List<Interval> listOfGaps = new ArrayList<>();

    // check start and end points

    if (listOfOverlaps.isEmpty()) {
        return listOfGaps;
    }

    DateMidnight firstOverlapStart = listOfOverlaps.get(0).getStart().toDateMidnight();
    DateMidnight lastOverlapEnd = listOfOverlaps.get(listOfOverlaps.size() - 1).getEnd().toDateMidnight();

    if (startDate.isBefore(firstOverlapStart)) {
        Interval gapStart = new Interval(startDate, firstOverlapStart);
        listOfGaps.add(gapStart);
    }

    if (endDate.isAfter(lastOverlapEnd)) {
        Interval gapEnd = new Interval(lastOverlapEnd, endDate);
        listOfGaps.add(gapEnd);
    }

    // check if intervals abut or gap
    for (int i = 0; (i + 1) < listOfOverlaps.size(); i++) {
        // if they don't abut, you can calculate the gap
        // test if end of interval is equals resp. one day plus of start of other interval
        // e.g. if period 1: 16.-18. and period 2: 19.-20 --> they abut
        // e.g. if period 1: 16.-18. and period 2: 20.-22 --> they have a gap
        if (intervalsHaveGap(listOfOverlaps.get(i), listOfOverlaps.get(i + 1))) {
            Interval gap = listOfOverlaps.get(i).gap(listOfOverlaps.get(i + 1));
            listOfGaps.add(gap);
        }
    }

    return listOfGaps;
}
 
开发者ID:synyx,项目名称:urlaubsverwaltung,代码行数:47,代码来源:OverlapService.java

示例5: getUsedDaysBetweenTwoMilestones

import org.joda.time.DateMidnight; //导入方法依赖的package包/类
BigDecimal getUsedDaysBetweenTwoMilestones(Person person, DateMidnight firstMilestone, DateMidnight lastMilestone) {

        // get all applications for leave
        List<Application> allApplicationsForLeave = applicationService.getApplicationsForACertainPeriodAndPerson(
                firstMilestone, lastMilestone, person);

        // filter them since only waiting and allowed applications for leave of type holiday are relevant
        List<Application> applicationsForLeave = allApplicationsForLeave.stream()
                .filter(input ->
                            VacationCategory.HOLIDAY.equals(input.getVacationType().getCategory())
                            && (input.hasStatus(ApplicationStatus.WAITING)
                                || input.hasStatus(ApplicationStatus.ALLOWED)))
                .collect(Collectors.toList());

        BigDecimal usedDays = BigDecimal.ZERO;

        for (Application applicationForLeave : applicationsForLeave) {
            DateMidnight startDate = applicationForLeave.getStartDate();
            DateMidnight endDate = applicationForLeave.getEndDate();

            if (startDate.isBefore(firstMilestone)) {
                startDate = firstMilestone;
            }

            if (endDate.isAfter(lastMilestone)) {
                endDate = lastMilestone;
            }

            usedDays = usedDays.add(calendarService.getWorkDays(applicationForLeave.getDayLength(), startDate, endDate,
                        person));
        }

        return usedDays;
    }
 
开发者ID:synyx,项目名称:urlaubsverwaltung,代码行数:35,代码来源:VacationDaysService.java

示例6: getDadosConsolidados

import org.joda.time.DateMidnight; //导入方法依赖的package包/类
/**
 * Obtém os dados consolidados até o dia de hoje
 * 
 * @param companyId
 * @return
 * @throws SystemException
 */
@Transactional(readOnly = false)
@Override
public Map<Long, DadosConsolidados> getDadosConsolidados(long companyId)
		throws SystemException {
	DateMidnight mes = getMenorMes(companyId);
	DateMidnight atual = getMesAtual();

	LinkedHashMap<Long, DadosConsolidados> totais = new LinkedHashMap<Long, DadosConsolidados>();
	while (mes.isBefore(atual) || mes.isEqual(atual)) {
		Map<Long, DadosConsolidados> dadosMes = getDadosMes(companyId,
				new Date(mes.getMillis()));
		for (Long grupo : dadosMes.keySet()) {
			DadosConsolidados totaisGrupo;
			if (!totais.containsKey(grupo)) {
				totaisGrupo = new DadosConsolidados();
				totais.put(grupo, totaisGrupo);
			} else {
				totaisGrupo = totais.get(grupo);
			}

			// Copia / adiciona as estatisticas
			DadosConsolidados dadosGrupo = dadosMes.get(grupo);
			totaisGrupo.setNumeroMembros(dadosGrupo.getNumeroMembros());
			totaisGrupo.setForumTopicosCriados(totaisGrupo
					.getForumTopicosCriados()
					+ dadosGrupo.getForumTopicosCriados());
			totaisGrupo.setForumTotalPostagens(totaisGrupo
					.getForumTotalPostagens()
					+ dadosGrupo.getForumTotalPostagens());
			totaisGrupo.setForumVisualizacoes(dadosGrupo
					.getForumVisualizacoes());

			totaisGrupo.setBatepapoMensagens(totaisGrupo
					.getBatepapoMensagens()
					+ dadosGrupo.getBatepapoMensagens());
			totaisGrupo.setBibliotecaComentarios(totaisGrupo
					.getBibliotecaComentarios()
					+ dadosGrupo.getBibliotecaComentarios());
			totaisGrupo.setBlogsComentarios(totaisGrupo
					.getBlogsComentarios()
					+ dadosGrupo.getBlogsComentarios());
			totaisGrupo.setWikiComentarios(totaisGrupo.getWikiComentarios()
					+ dadosGrupo.getWikiComentarios());
			totaisGrupo.setWikilegisSugestoes(totaisGrupo
					.getWikilegisSugestoes()
					+ dadosGrupo.getWikilegisSugestoes());
			totaisGrupo.setWikilegisComentarios(totaisGrupo
					.getWikilegisComentarios()
					+ dadosGrupo.getWikilegisComentarios());
		}
		mes = mes.plusMonths(1);
	}
	return totais;
}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:62,代码来源:ContadorAcessoLocalServiceImpl.java


注:本文中的org.joda.time.DateMidnight.isBefore方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。