Example usage for java.util Date before

List of usage examples for java.util Date before

Introduction

In this page you can find the example usage for java.util Date before.

Prototype

public boolean before(Date when) 

Source Link

Document

Tests if this date is before the specified date.

Usage

From source file:eu.ggnet.dwoss.report.entity.Report.java

/**
 * Returns all Lines of the Report for Category Invoiced, split by mfgDate - startOfReport < 1 year and the rest.
 * This consists of:/*from w w  w.j  a v  a  2s .  c  o  m*/
 * <ul>
 * <li>Position of Type Invoice, with no References</li>
 * <li>Position of Type UNIT_ANNEX in DocumentType CREDIT_MEMO/ANNULATIION_INVOICE and a Referencing Invoice in the same report.</li>
 * </ul>
 * <p>
 * @return all Lines of the Report for Category Invoiced.
 */
public YearSplit filterInvoicedSplit() {
    NavigableSet<ReportLine> pastSplit = filterInvoiced();
    NavigableSet<ReportLine> preSplit = new TreeSet<>();
    Date splitter = DateUtils.addYears(startingDate, -1);
    for (ReportLine line : pastSplit) {
        if (splitter.before(line.getMfgDate()))
            preSplit.add(line);
    }
    pastSplit.removeAll(preSplit);
    return new YearSplit(startingDate, preSplit, pastSplit);
}

From source file:com.acc.fulfilmentprocess.actions.order.ScheduleForCleanUpAction.java

@Override
public Transition executeAction(final OrderProcessModel process) {
    ServicesUtil.validateParameterNotNull(process, "process cannot be null");
    final OrderModel order = process.getOrder();
    ServicesUtil.validateParameterNotNull(order, "order cannot be null");
    if (Boolean.FALSE.equals(order.getFraudulent())) {
        return Transition.NOK;
    }//from   w  ww . j av a2 s. c  o m
    final FraudReportModel lastReport = getLastFraudReportModelWithFraudStatus(order.getFraudReports());
    if (lastReport == null) {
        return Transition.NOK;
    }
    final Date lastModification = lastReport.getTimestamp();
    final Date currentDate = getTimeService().getCurrentTime();
    final Calendar threshold = Calendar.getInstance();
    threshold.setTime(currentDate);
    threshold.add(Calendar.SECOND, -getMinPeriodWaitingForCleanUpInSeconds().intValue());
    if (lastModification.before(threshold.getTime())) {
        return Transition.OK;
    } else {
        return Transition.NOK;
    }
}

From source file:com.feilong.commons.core.date.DateUtil.java

/**
 * ??,?Date, date_before ?date_after<br>
 * ://  w  ww .  j  ava 2 s.co m
 * 
 * <pre>
 * isBefore("2011-05-01","2011-04-01",DateUtil.pattern_onlyDate)
 * return true
 * </pre>
 * 
 * @param before
 *            before
 * @param dateAfter
 *            dateAfter
 * @param datePattern
 *            pattern {@link DatePattern}
 * @return before  dateAfter true
 * @see #string2Date(String, String)
 * @see #isBefore(String, String, String)
 * @see Date#before(Date)
 */
public static final boolean isBefore(Date before, String dateAfter, String datePattern) {
    Date after = string2Date(dateAfter, datePattern);
    return before.before(after);
}

From source file:cn.ccrise.spimp.web.LoginController.java

@RequestMapping(value = "/auth", method = RequestMethod.POST)
@ResponseBody//www.ja v a2 s .com
public Response auth(String principal, String credential, HttpSession httpSession,
        HttpServletRequest httpServletRequest) {
    // ????
    boolean isPrincipalBlank = StringUtils.isBlank(principal);
    boolean isCredentialBlank = StringUtils.isBlank(credential);
    Map<String, String> errors = Maps.newHashMap();
    if (isPrincipalBlank) {
        errors.put("principal", PRINCIPAL_BLANK);
    }
    if (isCredentialBlank) {
        errors.put("credential", CREDENTIAL_BLANK);
    }

    // ?
    String license = PropertiesUtils.getString("app.license");
    if (Strings.isNullOrEmpty(license)) {
        errors.put("message", UNRFGISTERED);
        return new Response(errors);
    }
    Date expireDay = null;
    try {
        expireDay = new SimpleDateFormat("yyyy-MM-dd").parse(AES.decodeAes128(KEY, license));
    } catch (ParseException e) {
        errors.put("message", UNRFGISTERED);
        return new Response(errors);
    }
    if (expireDay.before(new Date())) {
        errors.put("message", EXPIRE);
        return new Response(errors);
    }

    // ????
    if (!isPrincipalBlank && !isCredentialBlank) {
        if (accountService.auth(principal, credential)) {
            // ?session
            Account loginAccount = accountService.get(principal);

            // ??
            if (loginAccount.isLocked()) {
                errors.put("message", PRINCIPAL_LOCKED);
            } else {
                httpSession.setAttribute(PropertiesUtils.getString(PropertiesUtils.SESSION_KEY_PROPERTY),
                        loginAccount);
                httpSession.setMaxInactiveInterval(MAX_INACTIVE_INTERVAL);

                // 
                logEntityServiceImpl.info(LogEntityServiceImpl.DEFAULT_USER_NAME,
                        "[" + principal + "]", httpServletRequest.getRemoteAddr());
            }
        } else {
            errors.put("message", PRINCIPAL_OR_CREDENTIAL_WRONG);

            // 
            logEntityServiceImpl.info(LogEntityServiceImpl.DEFAULT_USER_NAME,
                    "[" + principal + "]??", httpServletRequest.getRemoteAddr());
        }
    }

    return new Response(errors);
}

From source file:com.discovery.darchrow.date.DateUtil.java

/**
 * Checks if is before.//from   ww w.j  a  va  2s  .  c  om
 *
 * @param before
 *            the before
 * @param when
 *            the after
 * @return true, if checks if is before
 * @see java.util.Date#before(Date)
 * @since 1.2.2
 */
public static boolean isBefore(Date before, Date when) {
    return before.before(when);
}

From source file:de.iteratec.iteraplan.presentation.dialog.GraphicalReporting.Line.JFreeChartLineGraphicCreator.java

private int getIndexLastElementBeforeFromDate(List<TimeseriesEntry> entries) {
    int idx = -1;
    for (TimeseriesEntry entry : entries) {
        Date date = entry.getDate();
        if (date.before(fromDate)) {
            int idxDate = entries.indexOf(entry);
            if (idx < 0) {
                idx = idxDate;/* www  .  j ava  2 s  .  co m*/
            } else {
                if (date.after(entries.get(idx).getDate())) {
                    idx = idxDate;
                }
            }
        }
    }
    return idx;
}

From source file:com.github.dbourdette.glass.web.controller.IndexController.java

private boolean isHanged(Trigger trigger, List<JobExecutionContext> runningJobs) throws SchedulerException {
    Date nextFireTime = trigger.getNextFireTime();

    if (nextFireTime == null) {
        return false;
    }/*from w  ww .  j  av a2 s  .  c om*/

    if (isRunning(trigger, runningJobs)) {
        return false;
    }

    Date oneMinuteAgo = new DateTime().minusMinutes(1).toDate();

    return nextFireTime.before(oneMinuteAgo);
}

From source file:com.esofthead.mycollab.module.project.domain.SimpleTaskList.java

public Date getEndDate() {
    Date result = null;
    for (SimpleTask task : subTasks) {
        if (task.getEnddate() != null) {
            if (result == null) {
                result = task.getEnddate();
            } else {
                if (result.before(task.getEnddate())) {
                    result = task.getEnddate();
                }/*from  w w w.  j  a  va 2s .  c  o m*/
            }
        }
    }
    return result;
}

From source file:com.runwaysdk.business.email.EmailKey.java

/**
 * Checks if this EmailKey is valid by comparing the value
 * of the issue date with the given date. If the difference
 * between those two dates is greater than the number of days
 * specified by the value of keyExpire in email.properties then
 * the EmailKey is invalid. If this EmailKey is invalid, it is up
 * to the developer to delete it and re-issue a new one.
 * //from w  w  w .  j  av a2 s .  co  m
 * @return
 */
public boolean isDateValid(Date date) {
    Date issued = getIssuedOnDate();
    int expireDays = EmailProperties.getKeyExpire();
    Date expireDate = DateUtils.addDays(issued, expireDays);

    return date.before(expireDate);
}

From source file:com.pureinfo.srm.project.ProjectToFinishRemindJob.java

private int getMonthAhead(Project _sPrj) {
    Date dFin = _sPrj.getFinishDate();
    //        logger.debug(dFin);
    int nLog = _sPrj.getIntProperty("finishRemindLog", 0);
    boolean in1Month = dFin.before(m_1MonthLater);
    int nMonth = -1;
    if (in1Month && (nLog & REMIND_STATUS_1MON) == 0) {
        nMonth = 1;//from   w ww .  j  a va2s  . co m
    } else {
        boolean in3Month = dFin.before(m_3MonthLater);
        if (in3Month && (nLog & REMIND_STATUS_3MON) == 0) {
            nMonth = 3;
        }
    }
    return nMonth;
}