Example usage for java.util Date after

List of usage examples for java.util Date after

Introduction

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

Prototype

public boolean after(Date when) 

Source Link

Document

Tests if this date is after the specified date.

Usage

From source file:com.mvdb.etl.actions.InitCustomerData.java

public static void main(String[] args) {
    ActionUtils.assertEnvironmentSetupOk();
    ActionUtils.assertFileExists("~/.mvdb", "~/.mvdb missing. Existing.");
    ActionUtils.assertFileExists("~/.mvdb/status.InitDB.complete", "200initdb.sh not executed yet. Exiting");
    ActionUtils.assertFileDoesNotExist("~/.mvdb/status.InitCustomerData.complete",
            "InitCustomerData already done. Start with 100init.sh if required. Exiting");
    ActionUtils.setUpInitFileProperty();
    ActionUtils.createMarkerFile("~/.mvdb/status.InitCustomerData.start");

    Date startDate = null;/*  ww  w . ja  v  a2  s  . c  om*/
    Date endDate = null;
    String customerName = null;
    int batchCountF = 0;
    int batchSizeF = 0;
    final CommandLineParser cmdLinePosixParser = new PosixParser();
    final Options posixOptions = constructPosixOptions();
    CommandLine commandLine;
    try {
        commandLine = cmdLinePosixParser.parse(posixOptions, args);
        if (commandLine.hasOption("customer")) {
            customerName = commandLine.getOptionValue("customer");
        }
        if (commandLine.hasOption("batchSize")) {
            String batchSizeStr = commandLine.getOptionValue("batchSize");
            batchSizeF = Integer.parseInt(batchSizeStr);
        }
        if (commandLine.hasOption("batchCount")) {
            String batchCountStr = commandLine.getOptionValue("batchCount");
            batchCountF = Integer.parseInt(batchCountStr);
        }
        if (commandLine.hasOption("startDate")) {
            String startDateStr = commandLine.getOptionValue("startDate");
            startDate = ActionUtils.getDate(startDateStr);
        }
        if (commandLine.hasOption("endDate")) {
            String endDateStr = commandLine.getOptionValue("endDate");
            endDate = ActionUtils.getDate(endDateStr);
        }
    } catch (ParseException parseException) // checked exception
    {
        System.err.println(
                "Encountered exception while parsing using PosixParser:\n" + parseException.getMessage());
    }

    if (startDate == null) {
        System.err.println(
                "startDate has not been specified with the correct format YYYYMMddHHmmss.  Aborting...");
        System.exit(1);
    }

    if (endDate == null) {
        System.err
                .println("endDate has not been specified with the correct format YYYYMMddHHmmss.  Aborting...");
        System.exit(1);
    }

    if (endDate.after(startDate) == false) {
        System.err.println("endDate must be after startDate.  Aborting...");
        System.exit(1);
    }

    // if you have time,
    // it's better to create an unit test rather than testing like this :)

    ApplicationContext context = Top.getContext();

    final OrderDAO orderDAO = (OrderDAO) context.getBean("orderDAO");
    final ConfigurationDAO configurationDAO = (ConfigurationDAO) context.getBean("configurationDAO");

    initData(orderDAO, batchCountF, batchSizeF, startDate, endDate);
    initConfiguration(configurationDAO, customerName, endDate);

    int total = orderDAO.findTotalOrders();
    System.out.println("Total : " + total);

    long max = orderDAO.findMaxId();
    System.out.println("maxid : " + max);

    ActionUtils.createMarkerFile("~/.mvdb/status.InitCustomerData.complete");

}

From source file:Main.java

public static boolean isAfter(Date src, Date dst) {
    return src.after(dst);
}

From source file:Main.java

public static int compareDate(Date date, Date oldDate) {
    if (oldDate.after(date)) {
        return 1;
    } else if (oldDate.equals(date)) {
        return 0;
    } else {//from   www.java 2 s  .c  o  m
        return -1;
    }
}

From source file:Main.java

public static boolean between(Date beginDate, Date endDate, Date src) {
    return beginDate.before(src) && endDate.after(src);
}

From source file:Main.java

public static boolean isDateAfter(String curdate, String dob) {
    try {/*from  w ww.  j  a va 2 s.  c  o  m*/
        SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy");
        Date date1 = df.parse(curdate);
        Date startingDate = df.parse(dob);

        if (startingDate.after(date1))

            return true;
        else
            return false;
    } catch (Exception e) {

        return false;
    }
}

From source file:Main.java

public static boolean isWithinRange(Date toCheck, Date start, Date end) {
    return !(toCheck.before(start) || toCheck.after(end));
}

From source file:Main.java

public static boolean compareDate(String startDate, String endDate) {
    if (TextUtils.isEmpty(startDate) || TextUtils.isEmpty(endDate)) {
        return false;
    }/* w  ww.  ja  v a 2  s  .co  m*/
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHH");
    try {
        Date dt1 = sdf.parse(startDate);
        Date dt2 = sdf.parse(endDate);
        return dt1.after(dt2);
    } catch (Exception e) {
        return false;
    }
}

From source file:org.jasig.cas.adaptors.x509.util.CertUtils.java

/**
 * Determines whether the given CRL is expired by comparing the nextUpdate field
 * with a given date./*from ww  w. j a  v a  2 s.c  om*/
 *
 * @param crl CRL to examine.
 * @param reference Reference date for comparison.
 *
 * @return True if reference date is after CRL next update, false otherwise.
 */
public static boolean isExpired(final X509CRL crl, final Date reference) {
    return reference.after(crl.getNextUpdate());
}

From source file:Main.java

/**
 * Returns the latest of the two given dates.
 *
 * @param date1 the first date./*w w w .j  ava 2  s  .c  o  m*/
 * @param date2 the second date.
 * @return the latest of the two given dates.
 */
public static Date max(Date date1, Date date2) {
    if (date1 == null) {
        return date2 != null ? date2 : null;
    }

    return date2 != null ? (date1.after(date2) ? date1 : date2) : date1;
}

From source file:common.util.DateUtil.java

public static boolean isCurrentWeek(Date fechainicio, Date fechafin, Date date) {
    return DateUtils.isSameDay(date, fechainicio) || DateUtils.isSameDay(date, fechafin)
            || (date.after(fechainicio) && date.before(fechafin));
}