Package org.exist.xquery.value

Examples of org.exist.xquery.value.DateTimeValue


                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(entry.lastModified())).getStringValue());

            builder.addAttribute(new QName("hidden", null, null),
                    new BooleanValue(entry.isHidden()).getStringValue());

            builder.addAttribute(new QName("canRead", null, null),
View Full Code Here


            MemTreeBuilder builder = context.getDocumentBuilder();
            DocumentBuilderReceiver receiver = new DocumentBuilderReceiver(builder);
            Properties properties = new Properties();
            properties.setProperty("document", doc1.getURI().toString());
            properties.setProperty("revision", "");
            properties.setProperty("date", new DateTimeValue(new Date()).getStringValue());
            properties.setProperty("user", context.getUser().getName());

            int nodeNr = builder.startElement(VersioningTrigger.ELEMENT_VERSION, null);
            VersioningTrigger.writeProperties(receiver, properties);
View Full Code Here

            }
            properties.setProperty( BackupDescriptor.NUMBER_IN_SEQUENCE_PROP_NAME, Integer.toString( seqNr ) );
            properties.setProperty( BackupDescriptor.INCREMENTAL_PROP_NAME, incremental ? "yes" : "no" );

            try {
                properties.setProperty( BackupDescriptor.DATE_PROP_NAME, new DateTimeValue( new Date() ).getStringValue() );
            }
            catch( final XPathException e ) {
            }

            backupFile = directory.createBackup( incremental && ( prevBackup != null ), zip );
View Full Code Here

            final AttributesImpl attr = new AttributesImpl();
            attr.addAttribute( Namespaces.EXIST_NS, "name", "name", "CDATA", uri.toString() );
            attr.addAttribute( Namespaces.EXIST_NS, "version", "version", "CDATA", String.valueOf( currVersion ) );
            Backup.writeUnixStylePermissionAttributes(attr, perm);
            try {
                attr.addAttribute( Namespaces.EXIST_NS, "created", "created", "CDATA", new DateTimeValue( new Date( current.getCreationTime() ) ).getStringValue() );
            }
            catch( final XPathException e ) {
                e.printStackTrace();
            }
           
View Full Code Here

            String created;
            String modified;

            // metadata could be damaged
            if( metadata != null ) {
                created  = new DateTimeValue( new Date( metadata.getCreated() ) ).getStringValue();
                modified = new DateTimeValue( new Date( metadata.getLastModified() ) ).getStringValue();
            } else {
                created  = new DateTimeValue().getStringValue();
                modified = created;
            }
            attr.addAttribute( Namespaces.EXIST_NS, "created", "created", "CDATA", created );
            attr.addAttribute( Namespaces.EXIST_NS, "modified", "modified", "CDATA", modified );
        }
View Full Code Here

        final AttributesImpl attr = new AttributesImpl();

        //The name should have come from an XmldbURI.toString() call
        attr.addAttribute( Namespaces.EXIST_NS, "name", "name", "CDATA", current.getName() );
        writeUnixStylePermissionAttributes(attr, currentPerms);
        attr.addAttribute( Namespaces.EXIST_NS, "created", "created", "CDATA", "" + new DateTimeValue( cur.getCreationTime() ) );
        attr.addAttribute( Namespaces.EXIST_NS, "version", "version", "CDATA", String.valueOf( currVersion ) );
       
        serializer.startElement( Namespaces.EXIST_NS, "collection", "collection", attr );

        if(currentPerms instanceof ACLPermission) {
            writeACLPermission(serializer, (ACLPermission)currentPerms);
        }

        // scan through resources
        Resource       resource;
        OutputStream   os;
        BufferedWriter writer;
        SAXSerializer  contentSerializer;

        for( int i = 0; i < resources.length; i++ ) {

            try {

                if( "__contents__.xml".equals(resources[i]) ) {

                    //Skipping resources[i]
                    continue;
                }
                resource = current.getResource( resources[i] );

                if( dialog != null ) {
                    dialog.setResource( resources[i] );
                    dialog.setProgress( i );
                }
               
                final String name   = resources[i];
                String filename = encode( URIUtils.urlDecodeUtf8( resources[i] ) );
               
                // Check for special resource names which cause problems as filenames, and if so, replace the filename with a generated filename
               
                if( ".".equals(name.trim()) ) {
                  filename = EXIST_GENERATED_FILENAME_DOT_FILENAME + i;
                } else if( "..".equals(name.trim()) ) {
                  filename = EXIST_GENERATED_FILENAME_DOTDOT_FILENAME + i;
                }

                os = output.newEntry( filename );

                if( resource instanceof ExtendedResource ) {
                    ( (ExtendedResource)resource ).getContentIntoAStream( os );
                } else {
                    writer            = new BufferedWriter( new OutputStreamWriter( os, "UTF-8" ) );

                    // write resource to contentSerializer
                    contentSerializer = (SAXSerializer)SerializerPool.getInstance().borrowObject( SAXSerializer.class );
                    contentSerializer.setOutput( writer, defaultOutputProperties );
                    ( (EXistResource)resource ).setLexicalHandler( contentSerializer );
                    ( (XMLResource)resource ).getContentAsSAX( contentSerializer );
                    SerializerPool.getInstance().returnObject( contentSerializer );
                    writer.flush();
                }
                output.closeEntry();
                final EXistResource ris = (EXistResource)resource;

                //store permissions
                attr.clear();
                attr.addAttribute( Namespaces.EXIST_NS, "type", "type", "CDATA", resource.getResourceType() );
                attr.addAttribute( Namespaces.EXIST_NS, "name", "name", "CDATA", name );
                writeUnixStylePermissionAttributes(attr, perms[i]);
                Date date = ris.getCreationTime();

                if( date != null ) {
                    attr.addAttribute( Namespaces.EXIST_NS, "created", "created", "CDATA", "" + new DateTimeValue( date ) );
                }
                date = ris.getLastModificationTime();

                if( date != null ) {
                    attr.addAttribute( Namespaces.EXIST_NS, "modified", "modified", "CDATA", "" + new DateTimeValue( date ) );
                }

                attr.addAttribute( Namespaces.EXIST_NS, "filename", "filename", "CDATA", filename );
                attr.addAttribute( Namespaces.EXIST_NS, "mimetype", "mimetype", "CDATA", encode( ( (EXistResource)resource ).getMimeType() ) );
View Full Code Here

     * @param timeToLive timeout of the token
     * @return a first login token
     * @throws XPathException
     */
    public LoginDetails register(String user, String password, DurationValue timeToLive) throws XPathException {
        DateTimeValue now = new DateTimeValue(new Date());
        DateTimeValue expires = (DateTimeValue) now.plus(timeToLive);
        LoginDetails login = new LoginDetails(user, password, timeToLive, expires.getTimeInMillis());
        seriesMap.put(login.getSeries(), login);
        return login;
    }
View Full Code Here

                    "CONTEXT SEQUENCE", contextSequence);}
            if (contextItem != null)
                {context.getProfiler().message(this, Profiler.START_SEQUENCES,
                    "CONTEXT ITEM", contextItem.toSequence());}
        }
        Sequence result = new DateTimeValue(context.getCalendar());
        if (isCalledAs("current-dateTime")) {
            // do nothing, result already in right form
        } else if (isCalledAs("current-date")) {
            result = result.convertTo(Type.DATE);
        } else if (isCalledAs("current-time")) {
            result = result.convertTo(Type.TIME);
        } else {
            throw new Error("Can't handle function " + mySignature.getName().getLocalName());
        }
        if (context.getProfiler().isEnabled()) {context.getProfiler().end(this, "", result);}
        return result;
View Full Code Here

        //TODO : error check
        innerContext.getWatchDog().setMaxNodes(Integer.valueOf(elem.getAttribute("value")).intValue());
      } else if (child.getNodeType() == Node.ELEMENT_NODE &&  "current-dateTime".equals(child.getLocalName())) {
        final Element elem = (Element) child;
        //TODO : error check
        final DateTimeValue dtv = new DateTimeValue(elem.getAttribute("value"));
            innerContext.setCalendar(dtv.calendar);
      } else if (child.getNodeType() == Node.ELEMENT_NODE &&  "implicit-timezone".equals(child.getLocalName())) {
        final Element elem = (Element) child;
        //TODO : error check
        final Duration duration = TimeUtils.getInstance().newDuration(elem.getAttribute("value"));
View Full Code Here

            final Thread process = jobs[i].getThread();
      final Date startDate = new Date(jobs[i].getStartTime());
            builder.startElement( new QName( "job", NAMESPACE_URI, PREFIX ), null);
            builder.addAttribute( new QName("id", null, null), process.getName());
            builder.addAttribute( new QName("action", null, null), jobs[i].getAction());
      builder.addAttribute( new QName("start", null, null), new DateTimeValue(startDate).getStringValue());
            builder.addAttribute(new QName("info", null, null), jobs[i].getAddInfo().toString());
            builder.endElement();
        }

        builder.endElement();
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.