Example usage for org.joda.time LocalDate toDateTimeAtStartOfDay

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

Introduction

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

Prototype

public DateTime toDateTimeAtStartOfDay() 

Source Link

Document

Converts this LocalDate to a full datetime at the earliest valid time for the date using the default time zone.

Usage

From source file:org.incodehq.amberg.vshcolab.modules.work.dom.impl.execution.Durchfuehrung.java

License:Apache License

@Programmatic
@Override/*from  ww  w  . j a  v a2 s  . c om*/
public ImmutableMap<String, CalendarEventable> getCalendarEvents() {
    final LocalDate whenElseProjected = getPlannedOrActual();

    String calendarName = calendarName();
    return ImmutableMap.of(calendarName, new CalendarEventable() {
        @Override
        public String getCalendarName() {
            return calendarName;
        }

        @Override
        public CalendarEvent toCalendarEvent() {
            return whenElseProjected != null
                    ? new CalendarEvent(whenElseProjected.toDateTimeAtStartOfDay(), getCalendarName(),
                            titleService.titleOf(Durchfuehrung.this))
                    : null;
        }
    });
}

From source file:org.isisaddons.module.audit.dom.AuditingServiceRepository.java

License:Apache License

private static Timestamp toTimestampStartOfDayWithOffset(final LocalDate dt, final int daysOffset) {
    return dt != null ? new java.sql.Timestamp(dt.toDateTimeAtStartOfDay().plusDays(daysOffset).getMillis())
            : null;// w  w  w. ja v a2 s . c  om
}

From source file:org.isisaddons.module.publishmq.dom.jdo.status.StatusMessageRepository.java

License:Apache License

private static Timestamp toTimestampStartOfDayWithOffset(final LocalDate dt, int daysOffset) {
    return dt != null ? new Timestamp(dt.toDateTimeAtStartOfDay().plusDays(daysOffset).getMillis()) : null;
}

From source file:org.isisaddons.module.sessionlogger.dom.SessionLogEntryRepository.java

License:Apache License

private static Timestamp toTimestampStartOfDayWithOffset(final LocalDate dt, final int daysOffset) {
    return dt != null ? new Timestamp(dt.toDateTimeAtStartOfDay().plusDays(daysOffset).getMillis()) : null;
}

From source file:org.jadira.usertype.dateandtime.joda.columnmapper.DateColumnLocalDateMapper.java

License:Apache License

@Override
public Date toNonNullValue(LocalDate value) {

    if (databaseZone == null) {
        return Date.valueOf(LOCAL_DATE_FORMATTER.print((LocalDate) value));
    }/*from www  .  ja v  a  2  s.  c om*/

    DateTime zonedValue = value.toDateTime(value.toDateTimeAtStartOfDay());

    final Date date = new Date(zonedValue.getMillis());
    return date;
}

From source file:org.jbpm.console.ng.ht.backend.server.TaskCalendarServiceImpl.java

License:Apache License

private Day transformLocalDateToDay(LocalDate localDate) {
    SimpleDateFormat dayFormat = new SimpleDateFormat("EEEE dd");
    Date dayDate = localDate.toDateTimeAtStartOfDay().toDate();
    return new Day(dayDate, dayFormat.format(dayDate));
}

From source file:org.jpmml.evaluator.FieldValue.java

License:Open Source License

public DateTime asDateTime() {
    Object value = getValue();/*  w w w . ja v  a 2  s  .com*/

    if (value instanceof LocalDate) {
        LocalDate instant = (LocalDate) value;

        return instant.toDateTimeAtStartOfDay();
    } else

    if (value instanceof LocalTime) {
        LocalTime instant = (LocalTime) value;

        return instant.toDateTimeToday();
    } else

    if (value instanceof LocalDateTime) {
        LocalDateTime instant = (LocalDateTime) value;

        return instant.toDateTime();
    }

    throw new TypeCheckException(DataType.DATE_TIME, value);
}

From source file:org.killbill.billing.plugin.analytics.dao.factory.BusinessFactoryBase.java

License:Apache License

protected PlanPhase getPlanPhaseFromInvoiceItem(final InvoiceItem invoiceItem,
        final LocalDate subscriptionStartDate, final TenantContext context) throws AnalyticsRefreshException {
    try {// www.j  a v  a2  s. c o  m
        final Catalog catalog = getCatalog(context);
        // TODO - Inaccurate timing
        return catalog.findPhase(invoiceItem.getPhaseName(),
                invoiceItem.getStartDate().toDateTimeAtStartOfDay(),
                subscriptionStartDate.toDateTimeAtStartOfDay());
    } catch (CatalogApiException e) {
        logService.log(LogService.LOG_INFO, "Unable to retrieve phase for invoice item " + invoiceItem.getId(),
                e);
        return null;
    }
}

From source file:org.killbill.billing.plugin.api.PluginApi.java

License:Apache License

protected PlanPhase getPlanPhaseFromInvoiceItem(final InvoiceItem invoiceItem,
        final LocalDate subscriptionStartDate, final TenantContext context) throws OSGIServiceNotAvailable {
    try {//from www.  j a  va 2s.c o  m
        final Catalog catalog = getCatalog(context);
        // TODO - Inaccurate timing
        return catalog.findPhase(invoiceItem.getPhaseName(),
                invoiceItem.getStartDate().toDateTimeAtStartOfDay(),
                subscriptionStartDate.toDateTimeAtStartOfDay());
    } catch (final CatalogApiException e) {
        logService.log(LogService.LOG_INFO, "Unable to retrieve phase for invoice item " + invoiceItem.getId(),
                e);
        return null;
    }
}

From source file:org.kuali.kpme.core.calendar.entry.CalendarEntry.java

License:Educational Community License

public void setBeginPeriodTime(Time beginPeriodTime) {
    LocalDate localDate = beginPeriodDateTime != null ? LocalDate.fromDateFields(beginPeriodDateTime)
            : LocalDate.now();/*from  ww w.j  a va2s .c o  m*/
    LocalTime localTime = beginPeriodTime != null ? LocalTime.fromDateFields(beginPeriodTime) : null;
    beginPeriodDateTime = localTime != null ? localTime.toDateTime(localDate.toDateTimeAtStartOfDay()).toDate()
            : null;
}