Package javax.xml.datatype

Examples of javax.xml.datatype.Duration


        Expires expires = factory.createExpires();
        seq.setExpires(expires);
           
        assertTrue(!seq.isExpired());
       
        Duration d = DatatypeFactory.PT0S;         
        expires.setValue(d);
        seq.setExpires(expires);
        try {
            Thread.sleep(1000);
        } catch (InterruptedException ex) {
View Full Code Here


        RMManager manager = control.createMock(RMManager.class);
        EasyMock.expect(rme.getManager()).andReturn(manager).anyTimes();
        SourcePolicyType sp = control.createMock(SourcePolicyType.class);
        EasyMock.expect(manager.getSourcePolicy()).andReturn(sp).anyTimes();
        EasyMock.expect(sp.getAcksTo()).andReturn(null).anyTimes();
        Duration d = DatatypeFactory.createDuration("PT12H");
        EasyMock.expect(sp.getSequenceExpiration()).andReturn(d).anyTimes();
        EasyMock.expect(sp.isIncludeOffer()).andReturn(Boolean.TRUE).anyTimes();
        Duration dOffered = DatatypeFactory.createDuration("PT24H");
        EasyMock.expect(sp.getOfferedSequenceExpiration()).andReturn(dOffered).anyTimes();
        Source source = control.createMock(Source.class);
        EasyMock.expect(rme.getSource()).andReturn(source).anyTimes();
        Identifier offeredId = control.createMock(Identifier.class);
        EasyMock.expect(source.generateSequenceIdentifier()).andReturn(offeredId).anyTimes();
View Full Code Here

        return tt;
    }

    protected XMLGregorianCalendar parseTerminationTime(String value) {
        try {
            Duration d = datatypeFactory.newDuration(value);
            XMLGregorianCalendar c = getCurrentTime();
            c.add(d);
            return c;
        } catch (Exception e) {
            // Ignore
        }
        try {
            Duration d = datatypeFactory.newDurationDayTime(value);
            XMLGregorianCalendar c = getCurrentTime();
            c.add(d);
            return c;
        } catch (Exception e) {
            // Ignore
        }
        try {
            Duration d = datatypeFactory.newDurationYearMonth(value);
            XMLGregorianCalendar c = getCurrentTime();
            c.add(d);
            return c;
        } catch (Exception e) {
            // Ignore
View Full Code Here

  @Builtin(Name = "timezone-from-date")
  public static Literal timezone_from_date(final Argument arg) {
    String str = BuiltinHelper
        .stringFromLiteral((TypedLiteral) arg.arguments.get(0));
    XMLGregorianCalendar cal = XMLGregorianCalendarImpl.parse(str);
    Duration dur = BuiltinHelper.getDurationFromCalendar(cal);
    return BuiltinHelper.createXSLiteral(
        dur.toString().substring(0, dur.toString().indexOf("H") + 1),
        "dayTimeDuration");
  }
View Full Code Here

  @Builtin(Name = "timezone-from-time")
  public static Literal timezone_from_time(final Argument arg) {
    String str = BuiltinHelper
        .stringFromLiteral((TypedLiteral) arg.arguments.get(0));
    XMLGregorianCalendar cal = XMLGregorianCalendarImpl.parse(str);
    Duration dur = BuiltinHelper.getDurationFromCalendar(cal);
    return BuiltinHelper.createXSLiteral(
        dur.toString().substring(0, dur.toString().indexOf("H") + 1),
        "dayTimeDuration");
  }
View Full Code Here

  @Builtin(Name = "years-from-duration")
  public static Literal years_from_duration(final Argument arg) {
    String str = BuiltinHelper
        .stringFromLiteral((TypedLiteral) arg.arguments.get(0));
    Duration dur = BuiltinHelper.getYearMonthDurationFromString(str);
    return BuiltinHelper.createXSLiteral(dur.getSign()
        * (dur.getYears() + (dur.getMonths() / 12)), "integer");
  }
View Full Code Here

  @Builtin(Name = "months-from-duration")
  public static Literal months_from_duration(final Argument arg) {
    String str = BuiltinHelper
        .stringFromLiteral((TypedLiteral) arg.arguments.get(0));
    Duration dur = BuiltinHelper.getYearMonthDurationFromString(str);
    return BuiltinHelper.createXSLiteral(dur.getSign()
        * (dur.getMonths() % 12), "integer");
  }
View Full Code Here

  @Builtin(Name = "days-from-duration")
  public static Literal days_from_duration(final Argument arg) {
    String str = BuiltinHelper
        .stringFromLiteral((TypedLiteral) arg.arguments.get(0));
    Duration dur = BuiltinHelper.getDayTimeDurationFromString(str);
    return BuiltinHelper.createXSLiteral(dur.getSign() * (dur.getDays()),
        "integer");
  }
 
View Full Code Here

  @Builtin(Name = "hours-from-duration")
  public static Literal hours_from_duration(final Argument arg) {
    String str = BuiltinHelper
        .stringFromLiteral((TypedLiteral) arg.arguments.get(0));
    Duration dur = BuiltinHelper.getDayTimeDurationFromString(str);
    return BuiltinHelper.createXSLiteral(dur.getSign() * (dur.getHours()),
        "integer");
  }
 
View Full Code Here

  @Builtin(Name = "minutes-from-duration")
  public static Literal minutes_from_duration(final Argument arg) {
    String str = BuiltinHelper
        .stringFromLiteral((TypedLiteral) arg.arguments.get(0));
    Duration dur = BuiltinHelper.getDayTimeDurationFromString(str);
    return BuiltinHelper.createXSLiteral(
        dur.getSign() * (dur.getMinutes()), "integer");
  }
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.