Package javax.xml.datatype

Examples of javax.xml.datatype.Duration


        expectLastCall().andReturn(sid);
       
        dest.getDestinationPolicies();
        expectLastCall().andReturn(dp);
       
        Duration d = null;
        if (null != supportedDuration) {
            d = DatatypeFactory.newInstance().newDuration(supportedDuration);
        }
        dp.getSequenceExpiration();
        expectLastCall().andReturn(d);
           
        Expires ex = null;
        if (null != requestedDuration) {
            Duration rd = DatatypeFactory.newInstance().newDuration(requestedDuration);
            ex = RMUtils.getWSRMFactory().createExpires();
            ex.setValue(rd);
        }
        cs.getExpires();
        expectLastCall().andReturn(ex);       
View Full Code Here


        } else {
            acksTo = defaultAcksTo;
        }
        cs.setAcksTo(acksTo);

        Duration d = sourcePolicies.getSequenceExpiration();
        if (null != d) {
            Expires expires = RMUtils.getWSRMFactory().createExpires();
            expires.setValue(d)
            cs.setExpires(expires);
        }
View Full Code Here

    boolean isExpired() {
        return expires == null ? false : new Date().after(expires);
    }
   
    void setExpires(Expires ex) {
        Duration d = null;
        if (null != ex) {
            d = ex.getValue();
        }

        if (null != d && (null == PT0S || !PT0S.equals(d))) {
View Full Code Here

       
        CreateSequenceResponseType csr = RMUtils.getWSRMFactory().createCreateSequenceResponseType();
        csr.setIdentifier(destination.generateSequenceIdentifier());

        DestinationPolicyType dp = destination.getDestinationPolicies();
        Duration supportedDuration = dp.getSequenceExpiration();
        if (null == supportedDuration) {
            supportedDuration = SourceSequence.PT0S;
        }
        Expires ex = cs.getExpires();
        LOG.info("supported duration: "  + supportedDuration);

        if (null != ex || supportedDuration.isShorterThan(SourceSequence.PT0S)) {
            Duration effectiveDuration = supportedDuration;
            if (null != ex && supportedDuration.isLongerThan(ex.getValue()))  {
                effectiveDuration = supportedDuration;
            }
            ex = RMUtils.getWSRMFactory().createExpires();
            ex.setValue(effectiveDuration);
View Full Code Here

  public void testYearMonth()
    throws Exception
  {
    ValueFactory vf = new ValueFactoryImpl();
    Literal lit = vf.createLiteral("P1Y", DURATION_YEARMONTH);
    Duration duration = lit.durationValue();
    assertEquals(lit, vf.createLiteral(duration));
  }
View Full Code Here

  public void testDayTime()
    throws Exception
  {
    ValueFactory vf = new ValueFactoryImpl();
    Literal lit = vf.createLiteral("P1D", DURATION_DAYTIME);
    Duration duration = lit.durationValue();
    assertEquals(lit, vf.createLiteral(duration));
  }
View Full Code Here

  public void testFullDuration()
    throws Exception
  {
    ValueFactory vf = new ValueFactoryImpl();
    Literal lit = vf.createLiteral("P1Y1M1D", DURATION);
    Duration duration = lit.durationValue();
    assertEquals(lit, vf.createLiteral(duration));
  }
View Full Code Here

        XMLGregorianCalendar max = schema.getCalendar(this.value);
        XMLGregorianCalendar val = schema.getCalendar(value);     
        return max.compare(val)==DatatypeConstants.GREATER;
      }
      else if (type.equals(schema.XSD_URI+"#duration")) {
        Duration max = schema.getDuration(this.value);
        Duration val = schema.getDuration(value);
        return max.isLongerThan(val);
      }
      else if (type.equals(schema.XSD_URI+"#integer")
          || type.equals(schema.XSD_URI+"#negativeInteger")
          || type.equals(schema.XSD_URI+"#positiveInteger")
View Full Code Here

          type.endsWith("#QName")) {
          e.appendChild(doc.createTextNode(xs.toXMLValue(e, rdf, type, ctx)));
        }
        else if (type.endsWith("#duration") && !rdf.isLiteral()) {
          // sum of all durations
          Duration duration = null;
          Resource r = (Resource) rdf;
          for (StmtIterator si = r.listProperties(RDF.value); si.hasNext(); ) {
            Duration d = schema.getDuration(si.nextStatement().getString());
            duration = duration==null?d:duration.add(d);
          }
          if (duration!=null)
            e.appendChild(doc.createTextNode(duration.toString()));
        }
View Full Code Here

        XMLGregorianCalendar val = schema.getCalendar(value);     
        return max.compare(val)==DatatypeConstants.GREATER ||
          max.compare(val)==DatatypeConstants.EQUAL;
      }
      else if (type.equals(schema.XSD_URI+"#duration")) {
        Duration max = schema.getDuration(this.value);
        Duration val = schema.getDuration(value);
        return max.isLongerThan(val) || max.equals(val);
      }
      else if (type.equals(schema.XSD_URI+"#integer")
          || type.equals(schema.XSD_URI+"#negativeInteger")
          || type.equals(schema.XSD_URI+"#positiveInteger")
View Full Code Here

TOP

Related Classes of javax.xml.datatype.Duration

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.