本文整理汇总了Java中org.joda.time.DateMidnight.isEqual方法的典型用法代码示例。如果您正苦于以下问题:Java DateMidnight.isEqual方法的具体用法?Java DateMidnight.isEqual怎么用?Java DateMidnight.isEqual使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.joda.time.DateMidnight
的用法示例。
在下文中一共展示了DateMidnight.isEqual方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: remind
import org.joda.time.DateMidnight; //导入方法依赖的package包/类
@Override
public Application remind(Application application) throws RemindAlreadySentException,
ImpatientAboutApplicationForLeaveProcessException {
DateMidnight remindDate = application.getRemindDate();
if (remindDate == null) {
DateMidnight minDateForNotification = application.getApplicationDate()
.plusDays(MIN_DAYS_LEFT_BEFORE_REMINDING_IS_POSSIBLE);
if (minDateForNotification.isAfterNow()) {
throw new ImpatientAboutApplicationForLeaveProcessException("It's too early to remind the bosses!");
}
}
if (remindDate != null && remindDate.isEqual(DateMidnight.now())) {
throw new RemindAlreadySentException("Reminding is possible maximum one time per day!");
}
mailService.sendRemindBossNotification(application);
application.setRemindDate(DateMidnight.now());
applicationService.save(application);
return application;
}
示例2: isLongWaitingApplications
import org.joda.time.DateMidnight; //导入方法依赖的package包/类
private Predicate<Application> isLongWaitingApplications() {
return application -> {
DateMidnight remindDate = application.getRemindDate();
if (remindDate == null) {
Integer daysBeforeRemindForWaitingApplications =
settingsService.getSettings().getAbsenceSettings().getDaysBeforeRemindForWaitingApplications();
// never reminded before
DateMidnight minDateForNotification = application.getApplicationDate()
.plusDays(daysBeforeRemindForWaitingApplications);
// true -> remind!
// false -> to early for notification
return minDateForNotification.isBeforeNow();
} else {
// true -> not reminded today
// false -> already reminded today
return !remindDate.isEqual(DateMidnight.now());
}
};
}
示例3: Period
import org.joda.time.DateMidnight; //导入方法依赖的package包/类
public Period(DateMidnight startDate, DateMidnight endDate, DayLength dayLength) {
Assert.notNull(startDate, "Start date must be given");
Assert.notNull(endDate, "End date must be given");
Assert.notNull(dayLength, "Day length must be given");
Assert.isTrue(!dayLength.equals(DayLength.ZERO), "Day length may not be zero");
boolean isFullDay = dayLength.equals(DayLength.FULL);
if (isFullDay && startDate.isAfter(endDate)) {
throw new IllegalArgumentException("Start date must be before end date");
}
boolean isHalfDay = dayLength.equals(DayLength.MORNING) || dayLength.equals(DayLength.NOON);
if (isHalfDay && !startDate.isEqual(endDate)) {
throw new IllegalArgumentException("Start and end date must be same for half day length");
}
this.startDate = startDate;
this.endDate = endDate;
this.dayLength = dayLength;
}
示例4: validateSameDayIfHalfDayPeriod
import org.joda.time.DateMidnight; //导入方法依赖的package包/类
private void validateSameDayIfHalfDayPeriod(DateMidnight startDate, DateMidnight endDate, DayLength dayLength,
Errors errors) {
boolean isHalfDay = dayLength == DayLength.MORNING || dayLength == DayLength.NOON;
if (isHalfDay && !startDate.isEqual(endDate)) {
errors.reject(ERROR_HALF_DAY_PERIOD);
}
}
示例5: validatePeriod
import org.joda.time.DateMidnight; //导入方法依赖的package包/类
/**
* Validate that the given start date is not after the given end date.
*
* @param startDate
* @param endDate
* @param field
* @param errors
*/
private void validatePeriod(DateMidnight startDate, DateMidnight endDate, DayLength dayLength, String field,
Errors errors) {
if (startDate.isAfter(endDate)) {
errors.rejectValue(field, ERROR_PERIOD);
} else {
boolean isHalfDay = dayLength == DayLength.MORNING || dayLength == DayLength.NOON;
if (isHalfDay && !startDate.isEqual(endDate)) {
errors.rejectValue(field, ERROR_HALF_DAY_PERIOD_SICK_NOTE);
}
}
}
示例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;
}