Package org.exist.xquery.value

Examples of org.exist.xquery.value.DateTimeValue


                Date date_created = null;
                Date date_modified = null;

                if(created != null) {
                    try {
                        date_created = (new DateTimeValue(created)).getDate();
                    } catch(final XPathException xpe) {
                        listener.warn("Illegal creation date. Ignoring date...");
                    }
                }
                if(modified != null) {
                    try {
                        date_modified = (Date) (new DateTimeValue(modified)).getDate();
                    } catch(final XPathException xpe) {
                        listener.warn("Illegal modification date. Ignoring date...");
                    }
                }
View Full Code Here


    private Date getDateFromXSDateTimeStringForItem(final String strXSDateTime, final String itemName) {
        Date date_created = null;

        if(strXSDateTime != null) {
            try {
                date_created = new DateTimeValue(strXSDateTime).getDate();
            } catch(final XPathException e2) {
            }
        }

        if(date_created == null) {
View Full Code Here

            try {
                final Properties properties = getProperties();
                final String     dateStr    = properties.getProperty( "date" );

                if( dateStr != null ) {
                    final DateTimeValue dtv = new DateTimeValue( dateStr );
                    date = dtv.getDate();
                }
            }
            catch( final IOException e ) {
            }
            catch( final XPathException e ) {
View Full Code Here

     * @throws XPathException
     */
    private void storeRepoXML(DocumentImpl repoXML, XmldbURI targetCollection)
            throws PackageException, XPathException {
        // Store repo.xml
        final DateTimeValue time = new DateTimeValue(new Date());
        final MemTreeBuilder builder = new MemTreeBuilder();
        builder.startDocument();
        final UpdatingDocumentReceiver receiver = new UpdatingDocumentReceiver(builder, time.getStringValue());
        try {
            repoXML.copyTo(broker, receiver);
        } catch (final SAXException e) {
            throw new PackageException("Error while updating repo.xml: " + e.getMessage());
        }
View Full Code Here

        Date date_created = null;
        Date date_modified = null;

        if(created != null) {
            try {
                date_created = (new DateTimeValue(created)).getDate();
            } catch(final XPathException xpe) {
                listener.warn("Illegal creation date. Ignoring date...");
            }
        }
        if(modified != null) {
            try {
                date_modified = (Date) (new DateTimeValue(modified)).getDate();
            } catch(final XPathException xpe) {
                listener.warn("Illegal modification date. Ignoring date...");
            }
        }
View Full Code Here

    private Date getDateFromXSDateTimeStringForItem(String strXSDateTime, String itemName) {
        Date date_created = null;

        if(strXSDateTime != null) {
            try {
                date_created = new DateTimeValue(strXSDateTime).getDate();
            } catch(final XPathException e2) {
            }
        }

        if(date_created == null) {
View Full Code Here

            }
            String dtv = ((DateTimeValue)dv.convertTo(Type.DATE_TIME)).getTrimmedCalendar().toXMLFormat();
           
            if (dv.getTimezone().isEmpty()) {
                dtv = dtv.substring(0, dtv.length() - 8);
                result = new DateTimeValue(dtv + tv.getStringValue());
           
            } else if ("PT0S".equals(((DayTimeDurationValue)dv.getTimezone().itemAt(0)).getStringValue())) {
                dtv = dtv.substring(0, dtv.length() - 9);
                if (tv.getTimezone().isEmpty()) {
                    result = new DateTimeValue(dtv + tv.getStringValue() + "Z");
                } else {
                    result = new DateTimeValue(dtv + tv.getStringValue());
                }
           
            } else {
                if (tv.getTimezone().isEmpty()) {
                    final String tz = dtv.substring(19);
                    dtv = dtv.substring(0, dtv.length() - 14);
                    result = new DateTimeValue(dtv + tv.getStringValue() + tz);

                } else {
                    dtv = dtv.substring(0, dtv.length() - 14);
                    result = new DateTimeValue(dtv + tv.getStringValue());
                }
            }
        }
        if (context.getProfiler().isEnabled())
            {context.getProfiler().end(this, "", result);}
View Full Code Here

                //}
                context.setTimeZone(implicitTimeZone);
            } else if (group.equals("ContextCurrentDatetimeFunc") ||
                    group.equals("ContextCurrentDateFunc") ||
                    group.equals("ContextCurrentTimeFunc")) {
                DateTimeValue dt = null;
                if (test.equals("fn-current-time-4"))
                    dt = new DateTimeValue("2005-12-05T13:38:03.455-05:00");
                else if (test.equals("fn-current-time-6"))
                    dt = new DateTimeValue("2005-12-05T13:38:18.059-05:00");
                else if (test.equals("fn-current-time-7"))
                    dt = new DateTimeValue("2005-12-05T13:38:18.059-05:00");
                else if (test.equals("fn-current-time-10"))
                    dt = new DateTimeValue("2005-12-05T13:38:18.09-05:00");
                else if (test.startsWith("fn-current-time-"))
                    dt = new DateTimeValue("2005-12-05T10:15:03.408-05:00");
                else if (test.equals("fn-current-dateTime-6"))
                    dt = new DateTimeValue("2005-12-05T17:10:00.312-05:00");
                else if (test.equals("fn-current-datetime-7"))
                    dt = new DateTimeValue("2005-12-05T17:10:00.312-05:00");
                else if (test.equals("fn-current-dateTime-10"))
                    dt = new DateTimeValue("2005-12-05T17:10:00.344-05:00");
                else if (test.equals("fn-current-dateTime-21"))
                    dt = new DateTimeValue("2005-12-05T17:10:00.453-05:00");
                else if (test.equals("fn-current-dateTime-24"))
                    dt = new DateTimeValue("2005-12-05T17:10:00.469-05:00");
                else
                    dt = new DateTimeValue("2005-12-05T17:10:00.203-05:00");
                //if (dt != null)
                    context.setCalendar(dt.calendar);
            }
        } catch (XPathException e) {
            //
View Full Code Here

    }

    @Override
    public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException
    {
        DateTimeValue dt = (DateTimeValue)args[0].itemAt(0);
        String dateTimeFormat = args[1].itemAt(0).toString();

        SimpleDateFormat sdf = new SimpleDateFormat(dateTimeFormat);

        GregorianCalendar cal = dt.calendar.toGregorianCalendar();
View Full Code Here

            Date date = sdf.parse(strDateTime);

            GregorianCalendar cal = new GregorianCalendar();
            cal.setTime(date);

            return new DateTimeValue(TimeUtils.getInstance().newXMLGregorianCalendar(cal));
        }
        catch(ParseException pe)
        {
            throw new XPathException(this, "Could not parse dateTime string '" + strDateTime + "' for format '" + dateFormat + "': " + pe.getMessage(), pe);
        }
View Full Code Here

TOP

Related Classes of org.exist.xquery.value.DateTimeValue

Copyright © 2018 www.massapicom. 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.