Examples of newXMLGregorianCalendar()


Examples of javax.xml.datatype.DatatypeFactory.newXMLGregorianCalendar()

  @Test
  public void testGregorianCalendar() throws Exception{

    DateObjectSource source = new DateObjectSource();
    DatatypeFactory datatypeFactory = DatatypeFactory.newInstance();
    XMLGregorianCalendar xmlGregorianCalendar = datatypeFactory.newXMLGregorianCalendar();
    xmlGregorianCalendar.setTimezone(2 * 60);
    source.setRecalledDate(xmlGregorianCalendar);

    DateObjectDest dest = mapper.map(source, DateObjectDest.class);

View Full Code Here

Examples of javax.xml.datatype.DatatypeFactory.newXMLGregorianCalendar()

      try {
        dataTypeFactory = DatatypeFactory.newInstance();
      } catch (DatatypeConfigurationException e) {
        throw new MappingException(e);
      }
      return dataTypeFactory.newXMLGregorianCalendar();
    }

  }

}
View Full Code Here

Examples of javax.xml.datatype.DatatypeFactory.newXMLGregorianCalendar()

  }

  @Test
  public void testConvert_XmlGregorianCalendar() throws Exception {
    DatatypeFactory instance = DatatypeFactory.newInstance();
    XMLGregorianCalendar calendar = instance.newXMLGregorianCalendar(new GregorianCalendar(YEAR, MONTH, DAY));

    Object result = converter.convert(XMLGregorianCalendar.class, calendar);
    XMLGregorianCalendar xmlCalendar = (XMLGregorianCalendar) result;

    assertEquals(YEAR, xmlCalendar.getYear());
View Full Code Here

Examples of javax.xml.datatype.DatatypeFactory.newXMLGregorianCalendar()

  @Override
  protected void setUp()
    throws Exception
  {
    DatatypeFactory factory = DatatypeFactory.newInstance();
    XMLGregorianCalendar mar = factory.newXMLGregorianCalendar("2000-03-04T20:00:00Z");
    XMLGregorianCalendar oct = factory.newXMLGregorianCalendar("2002-10-10T12:00:00-05:00");
    date1 = vf.createLiteral(mar);
    date2 = vf.createLiteral(oct);
  }
}
View Full Code Here

Examples of javax.xml.datatype.DatatypeFactory.newXMLGregorianCalendar()

  protected void setUp()
    throws Exception
  {
    DatatypeFactory factory = DatatypeFactory.newInstance();
    XMLGregorianCalendar mar = factory.newXMLGregorianCalendar("2000-03-04T20:00:00Z");
    XMLGregorianCalendar oct = factory.newXMLGregorianCalendar("2002-10-10T12:00:00-05:00");
    date1 = vf.createLiteral(mar);
    date2 = vf.createLiteral(oct);
  }
}
View Full Code Here

Examples of javax.xml.datatype.DatatypeFactory.newXMLGregorianCalendar()

    int OFFSET = TimeZone.getDefault().getOffset(new Date(2007, Calendar.NOVEMBER, 6).getTime()) / 1000 / 60;
    String SELECT_BY_DATE = "SELECT ?s ?d WHERE { ?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> ?d . FILTER (?d <= ?date) }";
    DatatypeFactory data = DatatypeFactory.newInstance();
    for (int i = 1; i < 5; i++) {
      URI uri = vf.createURI(NS, "date" + i);
      XMLGregorianCalendar xcal = data.newXMLGregorianCalendar();
      xcal.setYear(2000);
      xcal.setMonth(11);
      xcal.setDay(i * 2);
      testCon.add(uri, RDF.VALUE, vf.createLiteral(xcal));
      URI uriz = vf.createURI(NS, "dateZ" + i);
View Full Code Here

Examples of javax.xml.datatype.DatatypeFactory.newXMLGregorianCalendar()

      xcal.setYear(2000);
      xcal.setMonth(11);
      xcal.setDay(i * 2);
      testCon.add(uri, RDF.VALUE, vf.createLiteral(xcal));
      URI uriz = vf.createURI(NS, "dateZ" + i);
      xcal = data.newXMLGregorianCalendar();
      xcal.setYear(2007);
      xcal.setMonth(11);
      xcal.setDay(i * 2);
      xcal.setTimezone(OFFSET);
      testCon.add(uriz, RDF.VALUE, vf.createLiteral(xcal));
View Full Code Here

Examples of javax.xml.datatype.DatatypeFactory.newXMLGregorianCalendar()

      xcal.setMonth(11);
      xcal.setDay(i * 2);
      xcal.setTimezone(OFFSET);
      testCon.add(uriz, RDF.VALUE, vf.createLiteral(xcal));
    }
    XMLGregorianCalendar xcal = data.newXMLGregorianCalendar();
    xcal.setYear(2007);
    xcal.setMonth(11);
    xcal.setDay(6);
    xcal.setTimezone(OFFSET);
    TupleQuery query = testCon.prepareTupleQuery(QueryLanguage.SPARQL, SELECT_BY_DATE);
View Full Code Here

Examples of javax.xml.datatype.DatatypeFactory.newXMLGregorianCalendar()

            } else if (d == Double.POSITIVE_INFINITY) {
                return "Infinity";
            }
            GregorianCalendar gc = new GregorianCalendar();
            gc.setTimeInMillis((long) d);
            return dateFactory.newXMLGregorianCalendar(gc).toXMLFormat().substring(0, 23);
        } catch (DatatypeConfigurationException ex) {
            Exceptions.printStackTrace(ex);
            return "";
        }
    }
View Full Code Here

Examples of javax.xml.datatype.DatatypeFactory.newXMLGregorianCalendar()

     * @throws NullPointerException     if {@code str} is null.
     */
    public static double getDoubleFromXMLDateString(String str) {
        try {
            DatatypeFactory dateFactory = DatatypeFactory.newInstance();
            return dateFactory.newXMLGregorianCalendar(str.length() > 23 ? str.substring(0, 23) : str).
                    toGregorianCalendar().getTimeInMillis();
        } catch (DatatypeConfigurationException ex) {
            Exceptions.printStackTrace(ex);
            return 0.0;
        }
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.