Example usage for org.joda.time LocalDate now

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

Introduction

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

Prototype

public static LocalDate now() 

Source Link

Document

Obtains a LocalDate set to the current system millisecond time using ISOChronology in the default time zone.

Usage

From source file:ch.eitchnet.android.mabea.model.Today.java

License:Open Source License

/**
 * Default constructor/* ww  w .j  av  a  2 s  . com*/
 * 
 * @param requiredWorkPerDay
 * @param initialBooking
 */
public Today(Duration requiredWorkPerDay, Booking initialBooking) {

    if (requiredWorkPerDay == null)
        throw new IllegalArgumentException("requiredWorkPerDay must not be null");
    if (initialBooking == null)
        throw new IllegalArgumentException("Initial booking must not be null!");
    if (initialBooking.getState() != State.LOGGED_OUT)
        throw new IllegalArgumentException(
                "Initial booking must be " + MabeaState.State.LOGGED_OUT + " not " + initialBooking.getState());
    if (initialBooking.getTimestamp().compareTo(LocalDate.now().toLocalDateTime(LocalTime.MIDNIGHT)) > 0)
        throw new IllegalArgumentException("The initial booking must be at midnight of today!");

    this.dateCreated = LocalDate.now();
    this.requiredWorkPerDay = requiredWorkPerDay;
    this.startBalance = initialBooking.getBalance();
    this.workToday = new Duration(0L);
    this.bookings = new ArrayList<Booking>();
    this.bookings.add(initialBooking);
}

From source file:cherry.chart.app.LineChartBatch.java

License:Apache License

private CategoryDataset createDataset() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    LocalDate now = LocalDate.now();
    for (int i = 0; i <= 12; i++) {
        String date = now.plusMonths(i).toString();
        for (String s : series) {
            dataset.addValue(random.nextInt(100), s, date);
        }//  ww  w  .j a  v a  2  s .c  om
    }
    return dataset;
}

From source file:cherry.common.foundation.impl.BizDateTimeImpl.java

License:Apache License

@Transactional
@Override/*  ww  w.j  a  v  a 2s  . co  m*/
public LocalDate today() {
    SQLQuery query = createSqlQuery(bm);
    LocalDate ldt = query.uniqueResult(bm.bizdate);
    if (ldt == null) {
        return LocalDate.now();
    }
    return ldt;
}

From source file:cherry.example.common.foundation.impl.BizDateTimeImpl.java

License:Apache License

@Transactional
@Override// www  . j a  v a  2 s  .c  om
public LocalDate today() {
    LocalDate ldt = baseQuery(bm).singleResult(bm.bizdate);
    if (ldt == null) {
        return LocalDate.now();
    }
    return ldt;
}

From source file:cherry.foundation.bizdtm.SimpleBizDateTime.java

License:Apache License

@Override
public LocalDate today() {
    return LocalDate.now();
}

From source file:cherry.spring.common.foundation.impl.BizDateTimeImpl.java

License:Apache License

@Override
public LocalDate today() {
    QBizdatetimeMaster a = new QBizdatetimeMaster("a");
    SQLQuery query = createSqlQuery(a);/*from  w  w w .j ava 2 s  .c  om*/
    LocalDate ldt = queryDslJdbcOperations.queryForObject(query, a.bizdate);
    if (ldt == null) {
        return LocalDate.now();
    }
    return ldt;
}

From source file:com.alliander.osgp.domain.core.valueobjects.smartmetering.CosemDate.java

License:Open Source License

public CosemDate() {
    this(LocalDate.now());
}

From source file:com.alliander.osgp.dto.valueobjects.smartmetering.CosemDateDto.java

License:Open Source License

public CosemDateDto() {
    this(LocalDate.now());
}

From source file:com.axelor.apps.purchase.service.PurchaseOrderServiceImpl.java

License:Open Source License

@Override
@Transactional/* w ww.ja  v a 2s .c  om*/
public PurchaseOrder mergePurchaseOrders(List<PurchaseOrder> purchaseOrderList, Currency currency,
        Partner supplierPartner, Company company, Partner contactPartner, PriceList priceList)
        throws AxelorException {

    String numSeq = "";
    String externalRef = "";
    for (PurchaseOrder purchaseOrderLocal : purchaseOrderList) {
        if (!numSeq.isEmpty()) {
            numSeq += "-";
        }
        numSeq += purchaseOrderLocal.getPurchaseOrderSeq();

        if (!externalRef.isEmpty()) {
            externalRef += "|";
        }
        if (purchaseOrderLocal.getExternalReference() != null) {
            externalRef += purchaseOrderLocal.getExternalReference();
        }
    }

    PurchaseOrder purchaseOrderMerged = this.createPurchaseOrder(AuthUtils.getUser(), company, contactPartner,
            currency, null, numSeq, externalRef, LocalDate.now(), priceList, supplierPartner);

    //Attachment of all purchase order lines to new purchase order
    for (PurchaseOrder purchaseOrder : purchaseOrderList) {
        int countLine = 1;
        for (PurchaseOrderLine purchaseOrderLine : purchaseOrder.getPurchaseOrderLineList()) {
            purchaseOrderLine.setSequence(countLine * 10);
            purchaseOrderMerged.addPurchaseOrderLineListItem(purchaseOrderLine);
            countLine++;
        }
    }

    this.computePurchaseOrder(purchaseOrderMerged);

    purchaseOrderRepo.save(purchaseOrderMerged);

    //Remove old purchase orders
    for (PurchaseOrder purchaseOrder : purchaseOrderList) {
        purchaseOrderRepo.remove(purchaseOrder);
    }

    return purchaseOrderMerged;
}

From source file:com.axelor.auth.AuthUtils.java

License:Open Source License

public static boolean isActive(final User user) {
    if (user.getArchived() == Boolean.TRUE || user.getBlocked() == Boolean.TRUE) {
        return false;
    }//www  . java2  s  .co m

    final LocalDate from = user.getActivateOn();
    final LocalDate till = user.getExpiresOn();
    final LocalDate now = LocalDate.now();

    if ((from != null && from.isAfter(now)) || (till != null && till.isBefore(now))) {
        return false;
    }

    return true;
}