Java Code Examples for org.joda.time.DateTime#getMillisOfSecond()

The following examples show how to use org.joda.time.DateTime#getMillisOfSecond() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ResponseObjectMapper.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
public PutTherapeuticLinkResponse mapXMLToPutTherapeuticLinkResponse(String xml) throws TechnicalConnectorException {
   be.fgov.ehealth.hubservices.core.v2.PutTherapeuticLinkResponse jaxbResponse = (be.fgov.ehealth.hubservices.core.v2.PutTherapeuticLinkResponse)this.generateJAXB(xml, be.fgov.ehealth.hubservices.core.v2.PutTherapeuticLinkResponse.class);
   ResponseType jaxbResponseType = jaxbResponse.getResponse();
   DateTime date = jaxbResponseType.getDate();
   DateTime time = jaxbResponseType.getTime();
   DateTime dateTime = new DateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond(), DateTimeZone.getDefault());
   PutTherapeuticLinkResponse response = new PutTherapeuticLinkResponse(dateTime, this.mapAuthor(jaxbResponseType.getAuthor()), jaxbResponseType.getId().getValue(), this.mapOriginalPutTherapeuticLinkRequest(jaxbResponseType.getRequest()), this.mapAcknowledge(jaxbResponse.getAcknowledge()));
   LOG.info("Output request object :" + response.toString());
   return response;
}
 
Example 2
Source File: ResponseObjectMapper.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
public RevokeTherapeuticLinkResponse mapXMLToRevokeTherapeuticLinkResponse(String xml) throws TechnicalConnectorException {
   be.fgov.ehealth.hubservices.core.v2.RevokeTherapeuticLinkResponse jaxbResponse = (be.fgov.ehealth.hubservices.core.v2.RevokeTherapeuticLinkResponse)this.generateJAXB(xml, be.fgov.ehealth.hubservices.core.v2.RevokeTherapeuticLinkResponse.class);
   ResponseType jaxbResponseType = jaxbResponse.getResponse();
   DateTime date = jaxbResponseType.getDate();
   DateTime time = jaxbResponseType.getTime();
   DateTime dateTime = new DateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond());
   RevokeTherapeuticLinkResponse response = new RevokeTherapeuticLinkResponse(dateTime, this.mapAuthor(jaxbResponseType.getAuthor()), jaxbResponseType.getId().getValue(), this.mapOriginalRevokeTherapeuticLinkRequest(jaxbResponseType.getRequest()), this.mapAcknowledge(jaxbResponse.getAcknowledge()));
   LOG.info("Output request object :" + response.toString());
   return response;
}
 
Example 3
Source File: ResponseObjectMapper.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
public GetTherapeuticLinkResponse mapXMLToGetTherapeuticLinkResponse(String xml) throws TechnicalConnectorException {
   be.fgov.ehealth.hubservices.core.v2.GetTherapeuticLinkResponse jaxbResponse = (be.fgov.ehealth.hubservices.core.v2.GetTherapeuticLinkResponse)this.generateJAXB(xml, be.fgov.ehealth.hubservices.core.v2.GetTherapeuticLinkResponse.class);
   ResponseType jaxbResponseType = jaxbResponse.getResponse();
   DateTime date = jaxbResponseType.getDate();
   DateTime time = jaxbResponseType.getTime();
   DateTime dateTime = new DateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond());
   GetTherapeuticLinkResponse response = new GetTherapeuticLinkResponse(dateTime, this.mapAuthor(jaxbResponseType.getAuthor()), jaxbResponseType.getId().getValue(), this.mapOriginalGetTherapeuticLinkRequest(jaxbResponseType.getRequest()), this.mapListOfTherapeuticLinks(jaxbResponse.getTherapeuticlinklist()), this.mapAcknowledge(jaxbResponse.getAcknowledge()));
   LOG.info("Output request object :" + response.toString());
   return response;
}
 
Example 4
Source File: ResponseObjectMapper.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
public HasTherapeuticLinkResponse mapXMLToHasTherapeuticLinkResponse(String xml) throws TechnicalConnectorException {
   be.fgov.ehealth.hubservices.core.v2.HasTherapeuticLinkResponse jaxbResponse = (be.fgov.ehealth.hubservices.core.v2.HasTherapeuticLinkResponse)this.generateJAXB(xml, be.fgov.ehealth.hubservices.core.v2.HasTherapeuticLinkResponse.class);
   ResponseType jaxbResponseType = jaxbResponse.getResponse();
   DateTime date = jaxbResponseType.getDate();
   DateTime time = jaxbResponseType.getTime();
   DateTime dateTime = new DateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond());
   HasTherapeuticLinkResponse response = new HasTherapeuticLinkResponse(dateTime, this.mapAuthor(jaxbResponseType.getAuthor()), jaxbResponseType.getId().getValue(), this.mapOriginalHasTherapeuticLinkRequest(jaxbResponseType.getRequest()), this.mapAcknowledge(jaxbResponse.getAcknowledge()));
   LOG.info("Output request object :" + response.toString());
   return response;
}
 
Example 5
Source File: TimeUtil.java    From beam with Apache License 2.0 5 votes vote down vote up
/** Converts a {@link ReadableInstant} into a Dateflow API time value. */
public static String toCloudTime(ReadableInstant instant) {
  // Note that since Joda objects use millisecond resolution, we always
  // produce either no fractional seconds or fractional seconds with
  // millisecond resolution.

  // Translate the ReadableInstant to a DateTime with ISOChronology.
  DateTime time = new DateTime(instant);

  int millis = time.getMillisOfSecond();
  if (millis == 0) {
    return String.format(
        "%04d-%02d-%02dT%02d:%02d:%02dZ",
        time.getYear(),
        time.getMonthOfYear(),
        time.getDayOfMonth(),
        time.getHourOfDay(),
        time.getMinuteOfHour(),
        time.getSecondOfMinute());
  } else {
    return String.format(
        "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ",
        time.getYear(),
        time.getMonthOfYear(),
        time.getDayOfMonth(),
        time.getHourOfDay(),
        time.getMinuteOfHour(),
        time.getSecondOfMinute(),
        millis);
  }
}
 
Example 6
Source File: ResponseObjectMapper.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
public RevokeTherapeuticLinkResponse mapXMLToRevokeTherapeuticLinkResponse(String xml) throws TechnicalConnectorException {
   be.fgov.ehealth.hubservices.core.v2.RevokeTherapeuticLinkResponse jaxbResponse = (be.fgov.ehealth.hubservices.core.v2.RevokeTherapeuticLinkResponse)this.generateJAXB(xml, be.fgov.ehealth.hubservices.core.v2.RevokeTherapeuticLinkResponse.class);
   ResponseType jaxbResponseType = jaxbResponse.getResponse();
   DateTime date = jaxbResponseType.getDate();
   DateTime time = jaxbResponseType.getTime();
   DateTime dateTime = new DateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond());
   RevokeTherapeuticLinkResponse response = new RevokeTherapeuticLinkResponse(dateTime, this.mapAuthor(jaxbResponseType.getAuthor()), jaxbResponseType.getId().getValue(), this.mapOriginalRevokeTherapeuticLinkRequest(jaxbResponseType.getRequest()), this.mapAcknowledge(jaxbResponse.getAcknowledge()));
   LOG.info("Output request object :" + response.toString());
   return response;
}
 
Example 7
Source File: ResponseObjectMapper.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
public PutTherapeuticLinkResponse mapXMLToPutTherapeuticLinkResponse(String xml) throws TechnicalConnectorException {
   be.fgov.ehealth.hubservices.core.v2.PutTherapeuticLinkResponse jaxbResponse = (be.fgov.ehealth.hubservices.core.v2.PutTherapeuticLinkResponse)this.generateJAXB(xml, be.fgov.ehealth.hubservices.core.v2.PutTherapeuticLinkResponse.class);
   ResponseType jaxbResponseType = jaxbResponse.getResponse();
   DateTime date = jaxbResponseType.getDate();
   DateTime time = jaxbResponseType.getTime();
   DateTime dateTime = new DateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond(), DateTimeZone.getDefault());
   PutTherapeuticLinkResponse response = new PutTherapeuticLinkResponse(dateTime, this.mapAuthor(jaxbResponseType.getAuthor()), jaxbResponseType.getId().getValue(), this.mapOriginalPutTherapeuticLinkRequest(jaxbResponseType.getRequest()), this.mapAcknowledge(jaxbResponse.getAcknowledge()));
   LOG.info("Output request object :" + response.toString());
   return response;
}
 
Example 8
Source File: VideoUtil.java    From arcusplatform with Apache License 2.0 5 votes vote down vote up
public static Date getPurgeTimestamp(long startTime, long delay, TimeUnit unit) {
   long ms = TimeUnit.MILLISECONDS.convert(delay, unit);

   DateTime purgeTime = new DateTime(startTime + ms);
   if (purgeTime.getMinuteOfHour() != 0 || purgeTime.getSecondOfMinute() != 0 || purgeTime.getMillisOfSecond() != 0) {
      purgeTime = purgeTime.plusHours(1);
   }

   return purgeTime.withTime(purgeTime.getHourOfDay(), 0, 0, 0).toDate();
}
 
Example 9
Source File: ResponseObjectMapper.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
public HasTherapeuticLinkResponse mapXMLToHasTherapeuticLinkResponse(String xml) throws TechnicalConnectorException {
   be.fgov.ehealth.hubservices.core.v2.HasTherapeuticLinkResponse jaxbResponse = (be.fgov.ehealth.hubservices.core.v2.HasTherapeuticLinkResponse)this.generateJAXB(xml, be.fgov.ehealth.hubservices.core.v2.HasTherapeuticLinkResponse.class);
   ResponseType jaxbResponseType = jaxbResponse.getResponse();
   DateTime date = jaxbResponseType.getDate();
   DateTime time = jaxbResponseType.getTime();
   DateTime dateTime = new DateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond());
   HasTherapeuticLinkResponse response = new HasTherapeuticLinkResponse(dateTime, this.mapAuthor(jaxbResponseType.getAuthor()), jaxbResponseType.getId().getValue(), this.mapOriginalHasTherapeuticLinkRequest(jaxbResponseType.getRequest()), this.mapAcknowledge(jaxbResponse.getAcknowledge()));
   LOG.info("Output request object :" + response.toString());
   return response;
}
 
Example 10
Source File: ResponseObjectMapper.java    From freehealth-connector with GNU Affero General Public License v3.0 4 votes vote down vote up
private TherapeuticLinkRequestType mapOriginalPutTherapeuticLinkRequest(RequestType request) {
   DateTime date = request.getDate();
   DateTime time = request.getTime();
   DateTime dateTime = new DateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond());
   return new PutTherapeuticLinkRequest(dateTime, request.getId().getValue(), this.mapAuthor(request.getAuthor()));
}
 
Example 11
Source File: ResponseObjectMapper.java    From freehealth-connector with GNU Affero General Public License v3.0 4 votes vote down vote up
private TherapeuticLinkRequestType mapOriginalHasTherapeuticLinkRequest(RequestType request) {
   DateTime date = request.getDate();
   DateTime time = request.getTime();
   DateTime dateTime = new DateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond());
   return new HasTherapeuticLinkRequest(dateTime, request.getId().getValue(), this.mapAuthor((AuthorType)request.getAuthor()), (TherapeuticLink)null);
}
 
Example 12
Source File: ResponseObjectMapper.java    From freehealth-connector with GNU Affero General Public License v3.0 4 votes vote down vote up
private DateTime mapDateTime(DateTime date, DateTime time) {
   return new DateTime(date != null ? date.getYear() : 0, date != null ? date.getMonthOfYear() : 1, date != null ? date.getDayOfMonth() : 1, time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond(), DateTimeZone.getDefault());
}
 
Example 13
Source File: ResponseObjectMapper.java    From freehealth-connector with GNU Affero General Public License v3.0 4 votes vote down vote up
private TherapeuticLinkRequestType mapOriginalGetTherapeuticLinkRequest(RequestType request) {
   DateTime date = request.getDate();
   DateTime time = request.getTime();
   DateTime dateTime = new DateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond());
   return new GetTherapeuticLinkRequest(dateTime, request.getId().getValue(), this.mapAuthor(request.getAuthor()), (TherapeuticLink)null, 999, (Proof[])null);
}
 
Example 14
Source File: ResponseObjectMapper.java    From freehealth-connector with GNU Affero General Public License v3.0 4 votes vote down vote up
private TherapeuticLinkRequestType mapOriginalPutTherapeuticLinkRequest(RequestType request) {
   DateTime date = request.getDate();
   DateTime time = request.getTime();
   DateTime dateTime = new DateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond());
   return new PutTherapeuticLinkRequest(dateTime, request.getId().getValue(), this.mapAuthor((AuthorType)request.getAuthor()));
}
 
Example 15
Source File: ResponseObjectMapper.java    From freehealth-connector with GNU Affero General Public License v3.0 4 votes vote down vote up
private DateTime mapDateTime(DateTime date, DateTime time) {
   return new DateTime(date != null ? date.getYear() : 0, date != null ? date.getMonthOfYear() : 1, date != null ? date.getDayOfMonth() : 1, time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond(), DateTimeZone.getDefault());
}
 
Example 16
Source File: AugmentBaseDataVisitor.java    From spork with Apache License 2.0 4 votes vote down vote up
Object GetLargerValue(Object v) {
    byte type = DataType.findType(v);

    if (type == DataType.BAG || type == DataType.TUPLE
            || type == DataType.MAP)
        return null;

    switch (type) {
    case DataType.CHARARRAY:
        return (String) v + "0";
    case DataType.BYTEARRAY:
        String str = ((DataByteArray) v).toString();
        str = str + "0";
        return new DataByteArray(str);
    case DataType.INTEGER:
        return Integer.valueOf((Integer) v + 1);
    case DataType.LONG:
        return Long.valueOf((Long) v + 1);
    case DataType.FLOAT:
        return Float.valueOf((Float) v + 1);
    case DataType.DOUBLE:
        return Double.valueOf((Double) v + 1);
    case DataType.BIGINTEGER:
        return ((BigInteger)v).add(BigInteger.ONE);
    case DataType.BIGDECIMAL:
        return ((BigDecimal)v).add(BigDecimal.ONE);
    case DataType.DATETIME:
        DateTime dt = (DateTime) v;
        if (dt.getMillisOfSecond() != 0) {
            return dt.plusMillis(1);
        } else if (dt.getSecondOfMinute() != 0) {
            return dt.plusSeconds(1);
        } else if (dt.getMinuteOfHour() != 0) {
            return dt.plusMinutes(1);
        } else if (dt.getHourOfDay() != 0) {
            return dt.plusHours(1);
        } else {
            return dt.plusDays(1);
        }
    default:
        return null;
    }
}
 
Example 17
Source File: ResponseObjectMapper.java    From freehealth-connector with GNU Affero General Public License v3.0 4 votes vote down vote up
private DateTime mapDateTime(DateTime date, DateTime time) {
   return new DateTime(date != null ? date.getYear() : 0, date != null ? date.getMonthOfYear() : 1, date != null ? date.getDayOfMonth() : 1, time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond(), DateTimeZone.getDefault());
}
 
Example 18
Source File: ResponseObjectMapper.java    From freehealth-connector with GNU Affero General Public License v3.0 4 votes vote down vote up
private TherapeuticLinkRequestType mapOriginalRevokeTherapeuticLinkRequest(RequestType request) {
   DateTime date = request.getDate();
   DateTime time = request.getTime();
   DateTime dateTime = new DateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond());
   return new RevokeTherapeuticLinkRequest(dateTime, request.getId().getValue(), this.mapAuthor(request.getAuthor()), (TherapeuticLink)null, (Proof[])null);
}
 
Example 19
Source File: DateUtil.java    From dble with GNU General Public License v2.0 2 votes vote down vote up
/**
 * getMicroSecond
 *
 * @param date
 * @return
 */
public static int getMicroSecond(Date date) {
    DateTime dt = new DateTime(date);
    return dt.getMillisOfSecond();
}
 
Example 20
Source File: DateUtil.java    From Mycat2 with GNU General Public License v3.0 2 votes vote down vote up
/**
 * 获取date对象毫秒数
 * @param date
 * @return
 */
public static int getMicroSecond(Date date) {
	DateTime dt = new DateTime(date);
	return dt.getMillisOfSecond();
}