Example usage for org.joda.time LocalDateTime toDate

List of usage examples for org.joda.time LocalDateTime toDate

Introduction

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

Prototype

@SuppressWarnings("deprecation")
public Date toDate() 

Source Link

Document

Get the date time as a java.util.Date.

Usage

From source file:ca.ualberta.physics.cssdp.dao.type.PersistentLocalDateTime.java

License:Apache License

@Override
public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session)
        throws HibernateException, SQLException {
    if (value != null) {
        LocalDateTime localDateTime = (LocalDateTime) value;
        Timestamp timestamp = new Timestamp(localDateTime.toDate().getTime());
        st.setTimestamp(index, timestamp);
    } else {//from  w  ww  . jav  a 2 s  . c  om
        st.setObject(index, null);
    }
}

From source file:cherry.foundation.type.mybatis.JodaLocalDateTimeTypeHandler.java

License:Apache License

@Override
public void setNonNullParameter(PreparedStatement ps, int i, LocalDateTime parameter, JdbcType jdbcType)
        throws SQLException {
    ps.setTimestamp(i, new Timestamp(parameter.toDate().getTime()));
}

From source file:cherry.foundation.type.querydsl.LocalDateTimeType.java

License:Apache License

@Override
public void setValue(PreparedStatement st, int startIndex, LocalDateTime value) throws SQLException {
    st.setTimestamp(startIndex, new Timestamp(value.toDate().getTime()));
}

From source file:com.axelor.apps.base.ical.ICalendarService.java

License:Open Source License

protected Date toDate(LocalDateTime dt, boolean allDay) {
    if (dt == null)
        return null;
    if (allDay)/*from   ww  w . ja v a 2s  .  co  m*/
        return new Date(dt.toDate());
    return new DateTime(dt.toDate());
}

From source file:com.effektif.mongo.MongoHelper.java

License:Apache License

public static void writeTimeOpt(Map<String, Object> o, String fieldName, LocalDateTime value) {
    if (value != null) {
        o.put(fieldName, value.toDate());
    }//from w w  w  .  java  2 s  .  c  om
}

From source file:com.effektif.mongo.MongoWriterHelper.java

License:Apache License

public static void putOptTime(BasicDBObject o, String fieldName, LocalDateTime value) {
    if (fieldName != null && value != null) {
        o.put(fieldName, value.toDate());
    }/* ww  w .ja  v a 2 s. co m*/
}

From source file:com.effektif.workflow.impl.json.types.DateStreamMapper.java

License:Apache License

@Override
public Date read(Object jsonValue, JsonReader jsonReader) {
    if (!String.class.isAssignableFrom(jsonValue.getClass())) {
        throw new InvalidValueException(String.format("Invalid ISO format date %s (%s)", jsonValue,
                jsonValue.getClass().getName()));
    }/* www  . j a v a  2 s  .  co  m*/
    LocalDateTime localDateTime = LocalDateTimeStreamMapper.PARSER.parseLocalDateTime((String) jsonValue);
    return localDateTime.toDate();
}

From source file:com.effektif.workflow.impl.json.types.LocalDateTimeDateMapper.java

License:Apache License

@Override
public void write(LocalDateTime objectValue, JsonWriter jsonWriter) {
    JsonObjectWriter jsonObjectWriter = (JsonObjectWriter) jsonWriter;
    jsonObjectWriter.writeValue(objectValue.toDate());
}

From source file:com.effektif.workflow.impl.workflowinstance.ActivityInstanceImpl.java

License:Apache License

public void setEnd(LocalDateTime end) {
    this.end = end;
    if (start != null && end != null) {
        this.duration = end.toDate().getTime() - start.toDate().getTime();
    }/*  w ww . j a  va 2s .c  om*/
    if (updates != null) {
        updates.isEndChanged = true;
        if (parent != null) {
            parent.propagateActivityInstanceChange();
        }
    }
}

From source file:com.effektif.workflow.impl.workflowinstance.WorkflowInstanceImpl.java

License:Apache License

public void setEnd(LocalDateTime end) {
    this.end = end;
    if (start != null && end != null) {
        this.duration = end.toDate().getTime() - start.toDate().getTime();
    }/*from   w  ww . j  a v a2  s . com*/
    if (updates != null) {
        getUpdates().isEndChanged = true;
    }
}