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:energy.usef.agr.model.SynchronisationConnection.java

License:Apache License

public void setLastModificationTime(LocalDateTime lastModificationTime) {
    if (lastModificationTime == null) {
        this.lastModificationTime = null;
    } else {//www . j  a v  a2 s. c  o m
        this.lastModificationTime = lastModificationTime.toDateTime().toDate();
    }
}

From source file:energy.usef.core.model.Message.java

License:Apache License

public void setCreationTime(LocalDateTime creationTime) {
    if (creationTime == null) {
        this.creationTime = null;
    } else {//from  www  . j av a2 s.c  om
        this.creationTime = creationTime.toDateTime().toDate();
    }
}

From source file:energy.usef.core.model.PlanboardMessage.java

License:Apache License

public void setExpirationDate(LocalDateTime expirationDate) {
    if (expirationDate == null) {
        this.expirationDate = null;
    } else {/* w  w  w  . j  a  va 2s. co m*/
        this.expirationDate = expirationDate.toDateTime().toDate();
    }
}

From source file:energy.usef.core.model.PlanboardMessage.java

License:Apache License

public void setCreationDateTime(LocalDateTime creationDateTime) {
    if (creationDateTime == null) {
        this.creationDateTime = null;
    } else {/*from   w w w . ja  va 2 s .  co m*/
        this.creationDateTime = creationDateTime.toDateTime().toDate();
    }
}

From source file:energy.usef.core.repository.PlanboardMessageRepository.java

License:Apache License

/**
 * This method finds {@link PlanboardMessage} based on {@link DocumentType} and {@link DocumentStatus}.
 *
 * @param localDateTime  The LocalDateTime the message should be before.
 * @param documentType   The type of document, like request, offer or order.
 * @param documentStatus The status of document, like new, submitted or rejected.
 * @return The list of {@link PlanboardMessage} which have a specific {@link DocumentType} and {@link DocumentStatus}.
 *//*w  ww .  j  a v a  2s  .  c  o m*/
@SuppressWarnings("unchecked")
public List<PlanboardMessage> findPlanboardMessagesOlderThan(LocalDateTime localDateTime,
        DocumentType documentType, DocumentStatus documentStatus) {
    Query query = entityManager
            .createQuery("SELECT pbm FROM PlanboardMessage pbm WHERE pbm.documentType = :documentType "
                    + "AND pbm.documentStatus = :documentStatus AND pbm.creationDateTime < :localDateTime");
    query.setParameter("documentStatus", documentStatus);
    query.setParameter("documentType", documentType);
    query.setParameter("localDateTime", localDateTime.toDateTime().toDate());
    return query.getResultList();
}

From source file:energy.usef.dso.model.ConnectionCapacityLimitationPeriod.java

License:Apache License

public void setStartDateTime(LocalDateTime startDateTime) {
    if (startDateTime == null) {
        this.startDateTime = null;
    } else {//w ww  . j a  v  a2s. c om
        this.startDateTime = startDateTime.toDateTime().toDate();
    }
}

From source file:energy.usef.dso.model.ConnectionCapacityLimitationPeriod.java

License:Apache License

public void setEndDateTime(LocalDateTime endDateTime) {
    if (endDateTime == null) {
        this.endDateTime = null;
    } else {/*w  ww  .java2 s  .  c om*/
        this.endDateTime = endDateTime.toDateTime().toDate();
    }
}

From source file:energy.usef.dso.model.ConnectionMeterEvent.java

License:Apache License

public void setDateTime(LocalDateTime dateTime) {
    if (dateTime == null) {
        this.dateTime = null;
    } else {/*ww  w  .  j  a  v a2 s.  c  om*/
        this.dateTime = dateTime.toDateTime().toDate();
    }
}

From source file:es.ucm.fdi.avisos.util.CustomRssViewer.java

License:Open Source License

@Override
protected void buildFeedMetadata(Map<String, Object> model, Channel feed, HttpServletRequest request) {

    feed.setTitle("Feed de la Facultad de Informatica, Universidad Complutense de Madrid");
    feed.setDescription("Noticias acerca de la Fdi-UCM");
    feed.setLink("http://informatica.ucm.es");

    LocalDateTime today = new LocalDateTime();
    feed.setLastBuildDate(today.toDate());

    super.buildFeedMetadata(model, feed, request);
}

From source file:eu.smartenit.unada.sm.MonitorRunner.java

License:Apache License

/**
 * Returns the upload date of a given object.
 *
 * @param upload_date The upload date object.
 * @return The upload date of the given object.
 *///from ww  w. jav  a  2  s .  c o  m
private Date toDate(Object upload_date) {
    String sourceDate = (String) upload_date;
    sourceDate = sourceDate.replaceAll("-", ":");
    sourceDate = sourceDate.replaceAll(" ", ":");
    String[] splitDate = sourceDate.split(":");

    int year = Integer.parseInt(splitDate[0]);
    int month = Integer.parseInt(splitDate[1]);
    int day = Integer.parseInt(splitDate[2]);
    int hour = Integer.parseInt(splitDate[3]);
    int minute = Integer.parseInt(splitDate[4]);
    int second = Integer.parseInt(splitDate[5]);

    LocalDateTime dateTime = new LocalDateTime(year, month, day, hour, minute, second);
    return dateTime.toDate();
}