Package javax.xml.datatype

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


             }else{
                 throw XMLConversionException.incorrectTimestampDateTimeFormat(sourceString);
             }
        }

        GregorianCalendar cal = xmlGregorianCalender.toGregorianCalendar();
        if(xmlGregorianCalender.getTimezone() == DatatypeConstants.FIELD_UNDEFINED) {
            cal.setTimeZone(getTimeZone());
        }
        QName  calendarQName = xmlGregorianCalender.getXMLSchemaType();
        if(!calendarQName.equals(schemaType)){
View Full Code Here


             }else{
                 throw XMLConversionException.incorrectTimestampDateTimeFormat(sourceString);
             }
        }

        GregorianCalendar cal = xmlGregorianCalender.toGregorianCalendar();
        cal.setTimeZone(getTimeZone());

        QName  calendarQName = xmlGregorianCalender.getXMLSchemaType();
        if(!calendarQName.equals(schemaType)){
            if (XMLConstants.DATE_QNAME.equals(schemaType)){
View Full Code Here

             }else{
                 throw XMLConversionException.incorrectTimestampDateTimeFormat(sourceString);
             }
        }

        GregorianCalendar cal = xmlGregorianCalender.toGregorianCalendar();
        if(xmlGregorianCalender.getTimezone() == DatatypeConstants.FIELD_UNDEFINED) {
            cal.setTimeZone(getTimeZone());
        }
        QName  calendarQName = xmlGregorianCalender.getXMLSchemaType();
        if(!calendarQName.equals(schemaType)){
View Full Code Here

        }
        // An XMLGregorianCalendar will be used to parse the date string
        XMLGregorianCalendar xgc = getXMLConversionManager().convertStringToXMLGregorianCalendar(dateString);
        Calendar cal;
        if (xgc.getTimezone() == DatatypeConstants.FIELD_UNDEFINED) {
            cal = xgc.toGregorianCalendar(getXMLConversionManager().getTimeZone(), locale, null);
            cal.clear(Calendar.ZONE_OFFSET);
        } else {
            cal = xgc.toGregorianCalendar(xgc.getTimeZone(xgc.getTimezone()), locale, null);
        }
        return cal;
View Full Code Here

        Calendar cal;
        if (xgc.getTimezone() == DatatypeConstants.FIELD_UNDEFINED) {
            cal = xgc.toGregorianCalendar(getXMLConversionManager().getTimeZone(), locale, null);
            cal.clear(Calendar.ZONE_OFFSET);
        } else {
            cal = xgc.toGregorianCalendar(xgc.getTimeZone(xgc.getTimezone()), locale, null);
        }
        return cal;
    }

    /**
 
View Full Code Here

    public Date toDateValue(final RippleValue v) throws RippleException {
        Literal l = castToLiteral(v.toRDF(this).sesameValue());

        XMLGregorianCalendar c = l.calendarValue();
        return c.toGregorianCalendar().getTime();
    }

    // TODO: this method is incomplete
    public String toString(final RippleValue v) throws RippleException {
        if (v instanceof RDFValue) {
View Full Code Here

    @Override
    public Date dateTimeValue(Value node) {
        try {
            XMLGregorianCalendar cal = ((Literal)node).calendarValue();
            //TODO: check if we need to deal with timezone and Local here
            return cal.toGregorianCalendar().getTime();
        } catch (ClassCastException e) {
            throw new IllegalArgumentException("Value "+node.stringValue()+" is not a literal" +
                    "but of type "+debugType(node));
        }
    }
View Full Code Here

                        WSSecurityException.ErrorCode.INVALID_SECURITY_TOKEN,
                        "badUsernameToken", e,
                        "Error parsing UsernameToken Created value"
                    );
                }
                createdDate = createdCalendar.toGregorianCalendar().getTime();
            }
        }
    }

    /**
 
View Full Code Here

    factory.getConverterFactory().registerConverter(new DateToXmlGregorianCalendarConverter());
    MapperFacade mapper = factory.getMapperFacade();
   
    Date now = new Date();
    XMLGregorianCalendar xml = mapper.map(now, XMLGregorianCalendar.class);
    Assert.assertEquals(now, xml.toGregorianCalendar().getTime());
   
    Date reverse = mapper.map(xml, Date.class);
    Assert.assertEquals(now, reverse);
  }
 
View Full Code Here

    factory.getConverterFactory().registerConverter(new CalendarToXmlGregorianCalendarConverter());
    MapperFacade mapper = factory.getMapperFacade();
   
    Calendar cal = Calendar.getInstance();
    XMLGregorianCalendar xml = mapper.map(cal, XMLGregorianCalendar.class);
    Assert.assertEquals(cal.getTime(), xml.toGregorianCalendar().getTime());
   
    Calendar reverse = mapper.map(xml, Calendar.class);
    Assert.assertEquals(cal, reverse);
  }
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.