Example usage for org.joda.time DateTimeZone UTC

List of usage examples for org.joda.time DateTimeZone UTC

Introduction

In this page you can find the example usage for org.joda.time DateTimeZone UTC.

Prototype

DateTimeZone UTC

To view the source code for org.joda.time DateTimeZone UTC.

Click Source Link

Document

The time zone for Universal Coordinated Time

Usage

From source file:com.messagemedia.restapi.client.v1.messaging.deliveryreports.DeliveryReport.java

License:Apache License

private DateTime validatedDateReceived(DateTime dateReceived) {
    if (dateReceived == null) {
        throw new IllegalArgumentException("Property 'date_received' cannot be null.");
    }//from   w ww .  ja v a 2  s.co  m
    return new DateTime(dateReceived.getMillis(), DateTimeZone.UTC);
}

From source file:com.messagemedia.restapi.client.v1.messaging.messages.Message.java

License:Apache License

Message(String callbackUrl, String content, Boolean deliveryReport, String destinationNumber,
        MessageFormat format, DateTime scheduled, String sourceNumber, AddressType sourceNumberType,
        DateTime messageExpiryTimestamp, Map<String, String> metadata) {

    this.content = validatedContent(content);
    this.destinationNumber = validatedDestinationNumber(destinationNumber);

    this.callbackUrl = callbackUrl;
    this.deliveryReport = deliveryReport == null ? false : deliveryReport;
    this.format = format == null ? MessageFormat.SMS : format;
    this.messageId = null;
    this.scheduled = scheduled == null ? null : new DateTime(scheduled.getMillis(), DateTimeZone.UTC);
    this.sourceNumber = sourceNumber;
    this.status = null;
    this.statusReason = null;
    this.messageExpiryTimestamp = messageExpiryTimestamp == null ? null
            : new DateTime(messageExpiryTimestamp.getMillis(), DateTimeZone.UTC);
    this.metadata = Collections
            .unmodifiableMap(metadata != null ? metadata : Collections.<String, String>emptyMap());
    this.sourceNumberType = sourceNumberType;
}

From source file:com.messagemedia.restapi.client.v1.messaging.messages.Message.java

License:Apache License

@JsonCreator
Message(@JsonProperty(value = "callback_url", required = false) String callbackUrl,
        @JsonProperty(value = "content") String content,
        @JsonProperty(value = "delivery_report", required = false) Boolean deliveryReport,
        @JsonProperty(value = "destination_number") String destinationNumber,
        @JsonProperty(value = "format", required = false) MessageFormat format,
        @JsonProperty(value = "message_id") String messageId,
        @JsonProperty(value = "scheduled", required = false) DateTime scheduled,
        @JsonProperty(value = "source_number", required = false) String sourceNumber,
        @JsonProperty(value = "source_number_type", required = false) AddressType sourceNumberType,
        @JsonProperty(value = "status") MessageStatus status,
        @JsonProperty(value = "status_reason", required = false) String statusReason,
        @JsonProperty(value = "message_expiry_timestamp") DateTime messageExpiryTimestamp,
        @JsonProperty(value = "metadata") Map<String, String> metadata) {

    this.content = validatedContent(content);
    this.destinationNumber = validatedDestinationNumber(destinationNumber);

    // When de-serialising a message from JSON format, the message must
    // have a message ID
    this.messageId = validatedMessageId(messageId);

    // When de-serialising a message from JSON format, the message must
    // have a status
    this.status = validatedStatus(status);

    this.callbackUrl = callbackUrl;
    this.deliveryReport = deliveryReport == null ? false : deliveryReport;
    this.format = format == null ? MessageFormat.SMS : format;
    this.scheduled = scheduled == null ? null : new DateTime(scheduled.getMillis(), DateTimeZone.UTC);
    this.sourceNumber = sourceNumber;
    this.sourceNumberType = sourceNumberType;
    this.statusReason = statusReason;
    this.messageExpiryTimestamp = messageExpiryTimestamp == null ? null
            : new DateTime(messageExpiryTimestamp.getMillis(), DateTimeZone.UTC);
    this.metadata = Collections
            .unmodifiableMap(metadata != null ? metadata : Collections.<String, String>emptyMap());
}

From source file:com.messagemedia.restapi.client.v1.messaging.messages.Message.java

License:Apache License

/**
 * Gets the date that the message will be sent.
 *
 * @return the scheduled date or null if none was specified.
 *///  w w  w .ja v a 2s.  co  m
public DateTime getScheduled() {
    if (scheduled == null) {
        return null;
    } else {
        return new DateTime(scheduled.getMillis(), DateTimeZone.UTC);
    }
}

From source file:com.messagemedia.restapi.client.v1.messaging.messages.Message.java

License:Apache License

/**
 * Gets the expiry timestamp for the message.
 *
 * @return the expiry timestamp or null if none was specified.
 *//*from   ww  w  .  jav  a 2s.  com*/
public DateTime getMessageExpiryTimestamp() {
    if (messageExpiryTimestamp == null) {
        return null;
    } else {
        return new DateTime(messageExpiryTimestamp.getMillis(), DateTimeZone.UTC);
    }
}

From source file:com.metamx.druid.BaseQueryGranularity.java

License:Open Source License

public DateTime toDateTime(long offset) {
    return new DateTime(offset, DateTimeZone.UTC);
}

From source file:com.metamx.druid.PeriodGranularity.java

License:Open Source License

@JsonCreator
public PeriodGranularity(@JsonProperty("period") Period period, @JsonProperty("origin") DateTime origin,
        @JsonProperty("timeZone") DateTimeZone tz) {
    this.period = period;
    this.chronology = tz == null ? ISOChronology.getInstanceUTC() : ISOChronology.getInstance(tz);
    if (origin == null) {
        // default to origin in given time zone when aligning multi-period granularities
        this.origin = new DateTime(0, DateTimeZone.UTC).withZoneRetainFields(chronology.getZone()).getMillis();
        this.hasOrigin = false;
    } else {/*w w  w  . ja  va2 s  .c o  m*/
        this.origin = origin.getMillis();
        this.hasOrigin = true;
    }
    this.isCompound = isCompoundPeriod(period);
}

From source file:com.metinkale.prayerapp.utils.AndroidTimeZoneProvider.java

License:Apache License

@Override
public DateTimeZone getZone(@NonNull String id) {
    if (id.equals("UTC"))
        return DateTimeZone.UTC;
    WeakReference<DateTimeZone> wr = cache.get(id);
    if (wr != null) {
        DateTimeZone dtz = wr.get();//  ww  w . ja v  a 2 s .com
        if (dtz != null)
            return dtz;
    }
    TimeZone tz = TimeZone.getTimeZone(id);
    DateTimeZone dtz = new MyDateTimeZone(id, tz);
    cache.put(id, new WeakReference<>(dtz));
    return dtz;
}

From source file:com.mfizz.binlog.DefaultTestBinlogFactory.java

License:Apache License

@Override
public void createBinlogFileHeader(WritableBinlogFileHeader header) {
    header.setName("test-name");
    header.setContentType("test-content-type");
    header.setCreateDateTime(new DateTime(2011, 6, 1, 4, 4, 0, 0, DateTimeZone.UTC));
}

From source file:com.mfizz.binlog.EmptyTestBinlogFactory.java

License:Apache License

@Override
public void createBinlogFileHeader(WritableBinlogFileHeader header) {
    header.setName("");
    header.setContentType("");
    header.setCreateDateTime(new DateTime(2011, 6, 1, 4, 4, 0, 0, DateTimeZone.UTC));
}