Package org.exist.xquery.value

Examples of org.exist.xquery.value.DateTimeValue


  public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException {

    IntegerValue value = (IntegerValue) args[0].itemAt(0);
    Date date = new Date(value.getLong());
   
    return new DateTimeValue( date );
  }
View Full Code Here


            AttributesImpl attribs = new AttributesImpl();
            attribs.addAttribute("", "rev", "rev", "CDATA", Long.toString(entry.getRevision()));
            attribs.addAttribute("", "author", "author", "CDATA", entry.getAuthor());
            String date = null;
            try {
                date = new DateTimeValue(entry.getDate()).getStringValue();
            } catch (XPathException e) {
            }
            attribs.addAttribute("", "date", "date", "CDATA", date);
            builder.startElement(ENTRY_ELEMENT, attribs);
            builder.startElement(MESSAGE_ELEMENT, EMPTY_ATTRIBS);
View Full Code Here

                        xmlBuf.append( "</expression>" );
                        xmlBuf.append( "<state>" );
                        xmlBuf.append( scheduledJobs.get(j).getTriggerState() );
                        xmlBuf.append( "</state>" );
                        xmlBuf.append( "<start>" );
                        xmlBuf.append( new DateTimeValue( scheduledJobs.get(j).getStartTime() ) );
                        xmlBuf.append( "</start>" );
                        xmlBuf.append( "<end>" );

                        Date endTime = scheduledJobs.get(j).getEndTime();

                        if( endTime != null ) {
                            xmlBuf.append( new DateTimeValue( endTime ) );
                        }

                        xmlBuf.append( "</end>" );
                        xmlBuf.append( "<previous>" );

                        Date previousTime = scheduledJobs.get(j).getPreviousFireTime();

                        if( previousTime != null ) {
                            xmlBuf.append( new DateTimeValue( scheduledJobs.get(j).getPreviousFireTime() ) );
                        }

                        xmlBuf.append( "</previous>" );
                        xmlBuf.append( "<next>" );

                        Date nextTime = scheduledJobs.get(j).getNextFireTime();

                        if( nextTime != null ) {
                            xmlBuf.append( new DateTimeValue() );
                        }

                        xmlBuf.append( "</next>" );
                        xmlBuf.append( "<final>" );

                        Date finalTime = scheduledJobs.get(j).getFinalFireTime();

                        if( ( endTime != null ) && ( finalTime != null ) ) {
                            xmlBuf.append( new DateTimeValue() );
                        }

                        xmlBuf.append( "</final>" );
                        xmlBuf.append( "</" + SchedulerModule.PREFIX + ":trigger>" );
                        xmlBuf.append( "</" + SchedulerModule.PREFIX + ":job>" );
View Full Code Here

        if (args[0].isEmpty())
            return Sequence.EMPTY_SEQUENCE;

        try {
            DateTimeValue value = (DateTimeValue)args[0].itemAt(0);
            String picture = FormatFunctionConstants.translate(args[1].itemAt(0).getStringValue());
            String language = (args.length <= 2 || args[2].isEmpty()) ? null : args[2].itemAt(0).getStringValue();
            String calendar = (args.length <= 2 || args[3].isEmpty()) ? null : args[3].itemAt(0).getStringValue();
            String country = (args.length <= 2 || args[4].isEmpty()) ? null : args[4].itemAt(0).getStringValue();
            SimpleDateFormat format = null;

            if (language != null || country != null) {
                Locale locale = (country == null) ? new Locale(language) : new Locale(language, country);
                format = new SimpleDateFormat(picture, locale);
            } else {
                format = new SimpleDateFormat(picture);
            }
            return new StringValue(format.format(value.toJavaObject(java.util.Date.class)));
        } catch (java.lang.IllegalArgumentException e) {
            throw new XPathException(e.getMessage());
        }
  }
View Full Code Here

                    final String value = child.getNodeValue();
                    final String type = param.getAttributeNS(SQLModule.NAMESPACE_URI, TYPE_ATTRIBUTE_NAME);
                    final int sqlType = SQLUtils.sqlTypeFromString(type);

                    if (sqlType == Types.TIMESTAMP) {
                        final DateTimeValue dv = new DateTimeValue(value);
                        final Timestamp timestampValue = new Timestamp(dv.getDate().getTime());
                        ((PreparedStatement) stmt).setTimestamp(i + 1, timestampValue);
                       
                    } else {
                        ((PreparedStatement) stmt).setObject(i + 1, value, sqlType);
                    }
View Full Code Here

      throw new XPathException(this, "Function file:sync is only available to the DBA role");
   
    String collectionPath = args[0].getStringValue();
    Date startDate = null;
    if (args[2].hasOne()) {
      DateTimeValue dtv = (DateTimeValue) args[2].itemAt(0);
      startDate = dtv.getDate();
    }
       
    String target = args[1].getStringValue();
        File targetDir = FileModuleHelper.getFile(target);
       
View Full Code Here

      output.startElement(new QName("update", FileModule.NAMESPACE_URI), null);
      output.addAttribute(new QName("file"), targetFile.getAbsolutePath());
      output.addAttribute(new QName("name"), doc.getFileURI().toString());
      output.addAttribute(new QName("collection"), doc.getCollection().getURI().toString());
      output.addAttribute(new QName("type"), "xml");
      output.addAttribute(new QName("modified"), new DateTimeValue(new Date(doc.getMetadata().getLastModified())).getStringValue());
            if (isRepoXML) {
                processRepoDesc(targetFile, doc, sax, output);
            } else {
                OutputStream os = new FileOutputStream(targetFile);
                            try (Writer writer = new OutputStreamWriter(os, "UTF-8")) {
View Full Code Here

      output.addAttribute(new QName("file"), targetFile.getAbsolutePath());
      output.addAttribute(new QName("name"), binary.getFileURI().toString());
      output.addAttribute(new QName("collection"), binary.getCollection().getURI().toString());
      output.addAttribute(new QName("type"), "binary");
      output.addAttribute(new QName("modified"),
          new DateTimeValue(new Date(binary.getMetadata().getLastModified())).getStringValue());
     
                        InputStream is;
                    try (OutputStream os = new FileOutputStream(targetFile)) {
                        is = context.getBroker().getBinaryResource(binary);
                        int c;
View Full Code Here

                String sizeString = Long.toString(sizeLong);
                String humanSize = getHumanSize(sizeLong, sizeString);

                builder.addAttribute(new QName("size", null, null), sizeString);
                builder.addAttribute(new QName("human-size", null, null), humanSize);
                builder.addAttribute(new QName("modified", null, null), new DateTimeValue(new Date(file.lastModified())).getStringValue());

                if (relDir != null && relDir.length() > 0) {
                    builder.addAttribute(new QName("subdir", null, null), relDir);
                }
View Full Code Here

    throws XPathException {
        Properties properties = new Properties();

        properties.setProperty("document", documentPath.toString());
        properties.setProperty("revision", Long.toString(revision));
        properties.setProperty("date", new DateTimeValue(new Date()).getStringValue());
        properties.setProperty("user", commitAccount.getName());
        if (documentKey != null) {
            properties.setProperty("key", documentKey);
        }
       
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.