Package org.exist.xquery.value

Examples of org.exist.xquery.value.DateTimeValue


        }
        final JavaObjectValue response = (JavaObjectValue)var.getValue().itemAt( 0 );

        //get parameters
        final String          name     = getArgument( 0 ).eval( contextSequence, contextItem ).getStringValue();
        final long            value    = new DateTimeValue( getArgument( 1 ).eval( contextSequence, contextItem ).getStringValue() ).getDate().getTime();

        //set response header
        if( response.getObject() instanceof ResponseWrapper ) {
            ( (ResponseWrapper)response.getObject() ).setDateHeader( name, value );
        } else {
View Full Code Here


      if( contextItem != null ) {
        context.getProfiler().message( this, Profiler.START_SEQUENCES, "CONTEXT ITEM", contextItem.toSequence() );
      }
    }       

    Sequence result = new DateTimeValue( new Date() );
   
    if( isCalledAs("system-dateTime" ) ) {
      // do nothing, result already in right form
    } else if( isCalledAs("system-date" ) ) {
      result = result.convertTo( Type.DATE );
    } else if( isCalledAs("system-time" ) ) {
      result = result.convertTo( Type.TIME );
    } else {
      throw( new Error( "can't handle function " + mySignature.getName().getLocalName() ) );
    }

    if( context.getProfiler().isEnabled() ) {
View Full Code Here

        {date = ((EXistResource)resource).getLastModificationTime();}
                else
        {date = ((EXistResource)resource).getCreationTime();}
            }

      return new DateTimeValue(date);

  } catch(final XMLDBException e) {
      logger.error("Failed to retrieve creation date or modification time of specified resource or creation date of collection");

      throw new XPathException(this, "Failed to retrieve creation date: " + e.getMessage(), e);
View Full Code Here

  {
    builder.startElement( new QName( "xquery", NAMESPACE_URI, PREFIX ), null );
   
    builder.addAttribute( new QName( "id", null, null ), "" + context.hashCode() );
    builder.addAttribute( new QName( "sourceType", null, null ), context.getXacmlSource().getType() );
                builder.addAttribute( new QName( "started", null, null), new DateTimeValue(new Date(watchdog.getStartTime())).getStringValue());
    builder.addAttribute( new QName( "terminating", null, null ), ( watchdog.isTerminating() ? "true" : "false" ) );
   
    builder.startElement( new QName( "sourceKey", NAMESPACE_URI, PREFIX ), null );
    builder.characters( context.getXacmlSource().getKey() );
    builder.endElement();
View Full Code Here

    final NodeSet nodes = args[0].toNodeSet();
    if (nodes.isEmpty())
      {return Sequence.EMPTY_SEQUENCE;}
   
    final NodeSet result = new NewArrayNodeSet();
    final DateTimeValue dtv = (DateTimeValue) args[1].itemAt(0);
    final long lastModified = dtv.getDate().getTime();
   
    for (final NodeSetIterator i = nodes.iterator(); i.hasNext(); ) {
      final NodeProxy proxy = i.next();
      final DocumentImpl doc = proxy.getDocument();
      final long modified = doc.getMetadata().getLastModified();
View Full Code Here

    final JavaObjectValue session = (JavaObjectValue)var.getValue().itemAt( 0 );
   
    if( session.getObject() instanceof SessionWrapper ) {
      try {
        final long creationTime = ( (SessionWrapper)session.getObject() ).getCreationTime();
        return new DateTimeValue(new Date(creationTime));
      }
      catch( final IllegalStateException ise ) {
        return new DateTimeValue(new Date(0));
      }
    } else {
      throw( new XPathException( this, "Type error: variable $session is not bound to a session object" ) );
    }
  }
View Full Code Here

    final JavaObjectValue session = (JavaObjectValue)var.getValue().itemAt( 0 );
   
    if( session.getObject() instanceof SessionWrapper ) {
      try {
        final long lastAccessedTime = ( (SessionWrapper)session.getObject() ).getLastAccessedTime();
        return new DateTimeValue(new Date(lastAccessedTime));
      }
      catch( final IllegalStateException ise ) {
        return new DateTimeValue(new Date(0));
      }
    } else {
      throw( new XPathException( this, "Type error: variable $session is not bound to a session object" ) );
    }
  }
View Full Code Here

            {return;}
        // construct the destination path
        final XmldbURI path = rootPath.append(doc.getURI());
        try {
            //construct the destination document name
            String dtValue = new DateTimeValue(new Date(doc.getMetadata()
                .getLastModified())).getStringValue();
            dtValue = dtValue.replaceAll(":", "-"); // multiple ':' are not allowed in URI so use '-'
            dtValue = dtValue.replaceAll("\\.", "-"); // as we are using '-' instead of ':' do the same for '.'
            final XmldbURI name = XmldbURI.create(dtValue);
            // create the destination document
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.