Example usage for org.joda.time DateTime toString

List of usage examples for org.joda.time DateTime toString

Introduction

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

Prototype

@ToString
public String toString() 

Source Link

Document

Output the date time in ISO8601 format (yyyy-MM-ddTHH:mm:ss.SSSZZ).

Usage

From source file:de.weltraumschaf.citer.domain.NodeEntity.java

License:BEER-WARE LICENSE

public void setDateUpdated(DateTime date) {
    setProperty(DATE_UPDATED, date.toString());
}

From source file:de.weltraumschaf.citer.domain.OriginatorRepository.java

License:BEER-WARE LICENSE

@Override
public Originator create(Map<String, Object> params) throws Exception {
    Transaction tx = graphDb.beginTx();/*from ww  w.java2s .  c o m*/
    String name = (String) params.get(Originator.NAME);

    try {
        if (findByName(name) != null) {
            tx.failure();
            throw new Exception(String.format("Originator with name '%s' already exists! %s", name,
                    findByName(name).toString()));
        }

        Node newOriginatorNode = graphDb.createNode();
        referenceNode.createRelationshipTo(newOriginatorNode, A_ORIGINATOR);

        for (String paramName : params.keySet()) {
            newOriginatorNode.setProperty(paramName, params.get(paramName));
        }

        String id = UUID.randomUUID().toString();
        DateTime now = new DateTime();
        newOriginatorNode.setProperty(Originator.ID, id);
        newOriginatorNode.setProperty(Originator.DATE_CREATED, now.toString());
        newOriginatorNode.setProperty(Originator.DATE_UPDATED, now.toString());
        indexById.add(newOriginatorNode, Originator.ID, id);
        indexByName.add(newOriginatorNode, Originator.NAME, name);
        tx.success();
        return new Originator(newOriginatorNode);
    } finally {
        tx.finish();
    }
}

From source file:de.zib.gndms.model.gorfx.types.TimeConstraint.java

License:Apache License

public void setMinTime(DateTime minTime) {
    this.minTime = minTime.toString();
}

From source file:de.zib.gndms.model.gorfx.types.TimeConstraint.java

License:Apache License

public void setMaxTime(DateTime maxTime) {
    this.maxTime = maxTime.toString();
}

From source file:de.zib.gndms.taskflows.staging.client.model.TimeConstraint.java

License:Apache License

/**
 * Sets the value of minTime form the given time object.
 * @param minTime A dateTime object representing the minTime.
 *//*from w w  w .ja v  a2 s .c  o m*/
public void setMinTime(DateTime minTime) {
    this.minTime = minTime.toString();
}

From source file:de.zib.gndms.taskflows.staging.client.model.TimeConstraint.java

License:Apache License

/**
 * Sets the value of maxTime form the given time object.
 * @param maxTime A dateTime object representing the maxTime.
 *///from www.j  a va 2 s.  c  o m
public void setMaxTime(DateTime maxTime) {
    this.maxTime = maxTime.toString();
}

From source file:divconq.log.Logger.java

License:Open Source License

static protected void write(String taskid, String indicator, String message, String... tags) {
    if (taskid == null)
        taskid = "00000_19700101T000000000Z_000000000000000";

    DateTime occur = new DateTime(DateTimeZone.UTC);
    String tagvalue = "";

    if ((tags != null) && tags.length > 0) {
        tagvalue = "|";

        for (String tag : tags)
            tagvalue += tag + "|";
    }//w  ww .ja va2  s.c o m

    if (Logger.handler != null)
        Logger.handler.write(occur.toString(), taskid, indicator, tagvalue, message);

    if (tagvalue.length() > 0)
        tagvalue += " ";

    Logger.write(occur + " " + taskid + " " + indicator + " " + tagvalue + message);
}

From source file:dk.dma.enav.ais.web.AISWebService.java

License:Apache License

@RequestMapping(method = RequestMethod.GET, path = "/last24Hours", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity getLast24Hours(@RequestParam(name = "mmsi") int mmsi) {
    DateTime now = DateTime.now(DateTimeZone.UTC);
    DateTime yesterDay = now.minusDays(1);

    List<JsonObject> messages = couchDbClient.view("funcs/by_userIdAndDate").includeDocs(true)
            .startKey(mmsi, yesterDay.toString()).endKey(mmsi, now.toString()).reduce(false)
            .query(JsonObject.class);
    return ResponseEntity.ok(couchDbClient.getGson().toJson(messages));
}

From source file:dk.dma.enav.ais.web.AISWebService.java

License:Apache License

@RequestMapping(method = RequestMethod.GET, path = "/latest", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity getLatestMessage(@RequestParam(name = "mmsi") int mmsi) {
    DateTime now = DateTime.now(DateTimeZone.UTC);

    List<JsonObject> messages = couchDbClient.view("funcs/by_userIdAndDate").includeDocs(true).endKey(mmsi, "")
            .startKey(mmsi, now.toString()).reduce(false).descending(true).query(JsonObject.class);

    if (messages.isEmpty() || messages == null) {
        return ResponseEntity.notFound().build();
    }//w w w . j a  va2 s  .  c om
    JsonObject latest = messages.get(0);

    return ResponseEntity.ok(couchDbClient.getGson().toJson(latest));
}

From source file:eds.entity.file.DefaultFilenameListener.java

@PrePersist
@PreUpdate/*w  ww.j  a  va 2 s  .c  om*/
public void defaultFilename(SecaFileEntity file) {
    //If filename is not set, empty or contains only whitespaces, give it the 
    //default filename
    if (file.getFILENAME() == null || file.getFILENAME().isEmpty() || file.getFILENAME().trim().length() > 0) {
        DateTime dt = new DateTime();
        file.setFILENAME(DEFAULT_FILENAME.concat(dt.toString()));
    }

}