Example usage for org.joda.time LocalDate LocalDate

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

Introduction

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

Prototype

public LocalDate() 

Source Link

Document

Constructs an instance set to the current local time evaluated using ISO chronology in the default zone.

Usage

From source file:ch.ralscha.extdirectspring.provider.RemoteProviderStoreModify.java

License:Apache License

@ExtDirectMethod(value = ExtDirectMethodType.STORE_MODIFY, group = "group2")
public List<Row> update4(@RequestParam(value = "id", required = false) Integer id,
        @RequestParam(required = false) @DateTimeFormat(iso = ISO.DATE) LocalDate yesterday,
        final List<Row> rows) {

    if (id == null) {
        assertThat(id).isNull();//ww w .  j a v a  2 s . co  m
        assertThat(yesterday).isNull();
    } else {
        assertThat(yesterday).isNotNull();
        assertThat(yesterday).isEqualTo(new LocalDate().minusDays(1));
        assertThat(id).isEqualTo(Integer.valueOf(11));
    }
    return rows;
}

From source file:ch.ralscha.extdirectspring.provider.RemoteProviderStoreModifyArray.java

License:Apache License

@ExtDirectMethod(value = ExtDirectMethodType.STORE_MODIFY, group = "group2")
public Row[] update4(@RequestParam(value = "id", required = false) Integer id,
        @RequestParam(required = false) @DateTimeFormat(iso = ISO.DATE) LocalDate yesterday,
        final List<Row> rows) {

    if (id == null) {
        assertThat(id).isNull();//from  w ww  .  j a  va 2 s  .c  o m
        assertThat(yesterday).isNull();
    } else {
        assertThat(yesterday).isNotNull();
        assertThat(yesterday).isEqualTo(new LocalDate().minusDays(1));
        assertThat(id).isEqualTo(Integer.valueOf(11));
    }
    return rows.toArray(new Row[rows.size()]);
}

From source file:ch.ralscha.extdirectspring.provider.RemoteProviderStoreModifyInterface.java

License:Apache License

@ExtDirectMethod(value = ExtDirectMethodType.STORE_MODIFY, group = "group2", entryClass = Row.class)
public List<RowInterface> update4(@RequestParam(value = "id", required = false) Integer id,
        @RequestParam(required = false) @DateTimeFormat(iso = ISO.DATE) LocalDate yesterday,
        final List<RowInterface> rows) {

    if (id == null) {
        assertThat(id).isNull();/*  w  w w. j  a  v a  2 s . c  om*/
        assertThat(yesterday).isNull();
    } else {
        assertThat(yesterday).isNotNull();
        assertThat(yesterday).isEqualTo(new LocalDate().minusDays(1));
        assertThat(id).isEqualTo(Integer.valueOf(11));
    }
    return rows;
}

From source file:ch.ralscha.extdirectspring.provider.RemoteProviderStoreModifySingle.java

License:Apache License

@ExtDirectMethod(value = ExtDirectMethodType.STORE_MODIFY, group = "group2")
public Row update4(@RequestParam(value = "aParam", required = false) Integer aParam,
        @RequestParam(required = false) @DateTimeFormat(iso = ISO.DATE) LocalDate yesterday, Row row) {

    if (aParam == null) {
        assertThat(aParam).isNull();//from  w  w w  .j  a v a 2 s . com
        assertThat(yesterday).isNull();
    } else {
        assertThat(yesterday).isNotNull();
        assertThat(yesterday).isEqualTo(new LocalDate().minusDays(1));
        assertThat(aParam).isEqualTo(Integer.valueOf(11));
    }
    return row;
}

From source file:com.actimem.blog.jackson.datesjoda.JodaDemo.java

License:Apache License

public static void main(String[] args) throws IOException {
    Company company = new Company();
    company.setName("Actimem");
    company.setFounded(new LocalDate());
    company.setUpdatedTS(new DateTime());

    ObjectMapper mapper = new ObjectMapper();
    mapper.registerModule(new JodaModule());
    mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);

    String json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(company);
    System.out.println(json);/*from   w ww  . j a va2s.co  m*/

    Company company2 = mapper.readValue(json, Company.class);
    System.out.println(company2.toString());
}

From source file:com.app.gpo.services.OrderItemAutoChangeStatus.java

License:Open Source License

@Scheduled(cron = "0 30 * * * ?")
public void scheduleChangeStatus() {
    // something that should execute on weekdays only
    logger.info("Searching for order items to change status");

    LocalDate today = new LocalDate();
    LocalDate threDaysAgo = today.minusDays(3);

    OrderStatus orderStatus = orderStatusService.findIdByName("W toku");
    OrderStatus orderStatusNew = orderStatusService.findIdByName("Zakoczone");

    List<OrderItem> orderItemList = orderItemService.findByOrderStatus(orderStatus);
    Iterator<OrderItem> orderItem = orderItemList.iterator();
    while (orderItem.hasNext()) {
        OrderItem oI = orderItem.next();
        LocalDate orderStatusDate = new LocalDate(oI.getorderStatusDate());
        boolean olderThen3 = threDaysAgo.isAfter(orderStatusDate);
        //logger.info("Order item "+oI.getorderNumber()+" has status change date: "+oI.getorderStatusDate());
        if (olderThen3) {
            logger.info("Order item " + oI.getorderNumber() + " status has been changed to 'Zakoczone'.");
            oI.setorderStatus(orderStatusNew);
            orderItemService.update(oI);
        }/*  w  w  w . j a va 2 s  .com*/
    }
}

From source file:com.axelor.apps.account.service.debtrecovery.ReminderService.java

License:Open Source License

/**
 * Fonction qui rcupre la plus ancienne date d'chance d'une liste de lignes d'criture
 * @param moveLineList//from  w  w  w.j  av a2 s.  c o  m
 *          Une liste de lignes d'criture
 * @return
 *          la plus ancienne date d'chance
 */
public LocalDate getOldDateMoveLine(List<MoveLine> moveLineList) {
    LocalDate minMoveLineDate = new LocalDate();

    if (moveLineList != null && !moveLineList.isEmpty()) {
        for (MoveLine moveLine : moveLineList) {
            if (minMoveLineDate.isAfter(moveLine.getDueDate())) {
                minMoveLineDate = moveLine.getDueDate();
            }
        }
    } else {
        minMoveLineDate = null;
    }
    return minMoveLineDate;
}

From source file:com.axelor.apps.account.service.debtrecovery.ReminderService.java

License:Open Source License

/**
 * Fonction qui rcupre la plus rcente date entre deux date
 * @param date1/*from   ww w .j av a2s.c o m*/
 *          Une date
 * @param date2
 *          Une date
 * @return minDate
 *          La plus ancienne date
 */
public LocalDate getLastDate(LocalDate date1, LocalDate date2) {
    LocalDate minDate = new LocalDate();
    if (date1 != null && date2 != null) {
        if (date1.isAfter(date2)) {
            minDate = date1;
        } else {
            minDate = date2;
        }
    } else if (date1 != null) {
        minDate = date1;
    } else if (date2 != null) {
        minDate = date2;
    } else {
        minDate = null;
    }
    return minDate;
}

From source file:com.axelor.apps.account.service.PaymentScheduleService.java

License:Open Source License

public LocalDate getMostOldDatePaymentScheduleLine(List<PaymentScheduleLine> paymentScheduleLineList) {
    LocalDate minPaymentScheduleLineDate = new LocalDate();

    if (paymentScheduleLineList != null && !paymentScheduleLineList.isEmpty()) {
        for (PaymentScheduleLine paymentScheduleLine : paymentScheduleLineList) {
            if (minPaymentScheduleLineDate.isAfter(paymentScheduleLine.getScheduleDate())) {
                minPaymentScheduleLineDate = paymentScheduleLine.getScheduleDate();
            }//www. ja  v a  2  s. c om
        }
    } else {
        minPaymentScheduleLineDate = null;
    }
    return minPaymentScheduleLineDate;
}

From source file:com.axelor.apps.account.service.PaymentScheduleService.java

License:Open Source License

public LocalDate getMostRecentDatePaymentScheduleLine(List<PaymentScheduleLine> paymentScheduleLineList) {
    LocalDate minPaymentScheduleLineDate = new LocalDate();

    if (paymentScheduleLineList != null && !paymentScheduleLineList.isEmpty()) {
        for (PaymentScheduleLine paymentScheduleLine : paymentScheduleLineList) {
            if (minPaymentScheduleLineDate.isBefore(paymentScheduleLine.getScheduleDate())) {
                minPaymentScheduleLineDate = paymentScheduleLine.getScheduleDate();
            }/*from   w  w  w  .j ava  2  s  . c  o  m*/
        }
    } else {
        minPaymentScheduleLineDate = null;
    }
    return minPaymentScheduleLineDate;
}