Package javax.xml.datatype

Examples of javax.xml.datatype.XMLGregorianCalendar.normalize()


            int diffInMinutes = offsetInMinutes - origTimeZoneInMinutes;
            long diffInMills = diffInMinutes * 60000;
            cal.add(XsDatatypeFactory.createDuration(diffInMills));
            cal.setMillisecond(origMillis); // workaround           
            cal.setTimezone(offsetInMinutes);
            cal.normalize();
        }
        return arg;
    }

    /**
 
View Full Code Here


    GregorianCalendar utcCalendar = new GregorianCalendar(TimeZone
        .getTimeZone("UTC"));
    utcCalendar.setTimeInMillis(cal.getTimeInMillis());

    XMLGregorianCalendar xmlCalendar = dtFactory.newXMLGregorianCalendar(utcCalendar);
    xmlCalendar = xmlCalendar.normalize();
    return xmlCalendar.toXMLFormat();
   
//    // TODO get rid of Jena dependency
//    XSDDateTime x = new XSDDateTime(utcCalendar);
//
View Full Code Here

  public static Calendar parseXSDDateTime_toCalendar(String s)
      throws RDFDataException {
    log.debug("Trying to parse '" + s + "' as an xsd:dateTime");

    XMLGregorianCalendar xmlCalendar = dtFactory.newXMLGregorianCalendar(s);
    xmlCalendar = xmlCalendar.normalize();
    return xmlCalendar.toGregorianCalendar();

    // // TODO get rid of Jena dependency
    // XSDDateTime xsddate = (XSDDateTime) XSDDatatype.XSDdateTime.parse(s);
    //
View Full Code Here

      ValidityIntervalType valitityIntervalType = xkmsFactory.createValidityIntervalType();
    try {     
      GregorianCalendar notBeforeGregorianCalendar = new GregorianCalendar();
      notBeforeGregorianCalendar.setTime(cert.getNotBefore());
        XMLGregorianCalendar notBeforeXMLGregorianCalendar = javax.xml.datatype.DatatypeFactory.newInstance().newXMLGregorianCalendar(notBeforeGregorianCalendar);
        notBeforeXMLGregorianCalendar.normalize();
        valitityIntervalType.setNotBefore(notBeforeXMLGregorianCalendar);
     
      GregorianCalendar notAfterGregorianCalendar = new GregorianCalendar();
      notAfterGregorianCalendar.setTime(cert.getNotAfter());
        XMLGregorianCalendar notAfterXMLGregorianCalendar = javax.xml.datatype.DatatypeFactory.newInstance().newXMLGregorianCalendar(notAfterGregorianCalendar);
View Full Code Here

        valitityIntervalType.setNotBefore(notBeforeXMLGregorianCalendar);
     
      GregorianCalendar notAfterGregorianCalendar = new GregorianCalendar();
      notAfterGregorianCalendar.setTime(cert.getNotAfter());
        XMLGregorianCalendar notAfterXMLGregorianCalendar = javax.xml.datatype.DatatypeFactory.newInstance().newXMLGregorianCalendar(notAfterGregorianCalendar);
        notAfterXMLGregorianCalendar.normalize();
        valitityIntervalType.setNotOnOrAfter(notAfterXMLGregorianCalendar);     
     
    } catch (DatatypeConfigurationException e) {
      log.error(intres.getLocalizedMessage("xkms.errorsetvalidityinterval"),e);     
    }   
View Full Code Here

        QueryKeyBindingType queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        TimeInstantType timeInstantType = xKMSObjectFactory.createTimeInstantType();
        GregorianCalendar caledar = new GregorianCalendar();
        XMLGregorianCalendar xMLGregorianCalendar = javax.xml.datatype.DatatypeFactory.newInstance().newXMLGregorianCalendar(caledar);
        xMLGregorianCalendar.normalize();
        timeInstantType.setTime(xMLGregorianCalendar);
        queryKeyBindingType.setTimeInstant(timeInstantType);
        localteRequestType.setQueryKeyBinding(queryKeyBindingType);

        LocateResultType abstractResultType = xKMSInvoker.locate(localteRequestType, null, null);
View Full Code Here

                Q.getTimezone() != DatatypeConstants.FIELD_UNDEFINED) {

            // Both instances have different timezones.
            // Normalize to UTC time and compare.
            P = (XMLGregorianCalendarImpl) P.normalize();
            Q = (XMLGregorianCalendarImpl) Q.normalize();
            return internalCompare(P, Q);
        }
        else if (P.getTimezone() != DatatypeConstants.FIELD_UNDEFINED) {

            if (P.getTimezone() != 0) {
View Full Code Here

       Q.getTimezone() != DatatypeConstants.FIELD_UNDEFINED) {

      // Both instances have different timezones.
      // Normalize to UTC time and compare.
      P = (XMLGregorianCalendarImpl) P.normalize();
      Q = (XMLGregorianCalendarImpl) Q.normalize();
      return internalCompare(P, Q);
  } else if (P.getTimezone() != DatatypeConstants.FIELD_UNDEFINED) {
     
      if (P.getTimezone() != 0) {
    P = (XMLGregorianCalendarImpl) P.normalize();
View Full Code Here

  private static XMLGregorianCalendar dateToXMLGregorianCalendar(Date date) {
    final GregorianCalendar gc = new GregorianCalendar();
    gc.setTime(date);
    final XMLGregorianCalendar xgc = TimeUtils.getInstance().newXMLGregorianCalendar(gc);
    xgc.normalize();
    return xgc;
  }
 
  private static XMLGregorianCalendar fillCalendar(XMLGregorianCalendar calendar) {
    if (calendar.getHour() == DatatypeConstants.FIELD_UNDEFINED) {calendar.setHour(0);}
View Full Code Here

    if (offset == null) {offset = new DayTimeDurationValue(TimeUtils.getInstance().getLocalTimezoneOffsetMillis());}
    validateTimezone(offset);
    XMLGregorianCalendar xgc = (XMLGregorianCalendar) calendar.clone();
    if (xgc.getTimezone() != DatatypeConstants.FIELD_UNDEFINED) {
      if (getType() == Type.DATE) {xgc.setTime(0,0,0);// set the fields so we don't lose precision when shifting timezones
      xgc = xgc.normalize();
      xgc.add(offset.duration);
    }
    try {
      xgc.setTimezone((int) (offset.getValue()/60));
    } catch (final IllegalArgumentException e) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.