javax.xml.datatype.XMLGregorianCalendar.add()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中javax.xml.datatype.XMLGregorianCalendar.add()方法的一些代码示例,展示了XMLGregorianCalendar.add()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLGregorianCalendar.add()方法的具体详情如下:
包路径:javax.xml.datatype.XMLGregorianCalendar
类名称:XMLGregorianCalendar
方法名:add

XMLGregorianCalendar.add介绍

[英]Add duration to this instance.

The computation is specified in XML Schema 1.0 Part 2, Appendix E, Adding durations to dateTimes>. date/time field mapping table defines the mapping from XML Schema 1.0 dateTime fields to this class' representation of those fields.
[中]将duration添加到此实例。
计算在XML Schema 1.0 Part 2, Appendix E, Adding durations to dateTimes>中指定。date/time field mapping table定义了从XMLSchema 1.0dateTime字段到这些字段的此类表示的映射。

代码示例

代码示例来源:origin: org.eclipse.emf/org.eclipse.emf.ecore

@Override
public void add(Duration duration)
{
 xmlGregorianCalendar.add(duration);
 date = null;
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.emf.ecore

@Override
public void add(Duration duration)
{
 xmlGregorianCalendar.add(duration);
 date = null;
}

代码示例来源:origin: apache/jena

private static XMLGregorianCalendar xsd_add(XMLGregorianCalendar cal, Duration duration)
{
  //if ( ! isYearMonth(duration) && ! isDayTime(duration) )
  XMLGregorianCalendar result = (XMLGregorianCalendar)cal.clone() ;
  result.add(duration) ;
  return result ;
}

代码示例来源:origin: Evolveum/midpoint

public static XMLGregorianCalendar fromNow(Duration duration) {
  XMLGregorianCalendar rv = createXMLGregorianCalendar(System.currentTimeMillis());
  rv.add(duration);
  return rv;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

private static XMLGregorianCalendar xsd_add(XMLGregorianCalendar cal, Duration duration)
{
  //if ( ! isYearMonth(duration) && ! isDayTime(duration) )
  XMLGregorianCalendar result = (XMLGregorianCalendar)cal.clone() ;
  result.add(duration) ;
  return result ;
}

代码示例来源:origin: com.redhat.rhevm.api/rhevm-api-powershell-jaxrs

public static XMLGregorianCalendar getDate(int secondsAgo) {
  if (secondsAgo == 0) {
    return null;
  }
  XMLGregorianCalendar ret =
    getDatatypeFactory().newXMLGregorianCalendar(new GregorianCalendar(TimeZone.getTimeZone("UTC")));
  ret.add(getDatatypeFactory().newDuration(false, 0, 0, 0, 0, 0, secondsAgo));
  return ret;
}

代码示例来源:origin: com.goldmansachs.jdmn/jdmn-core

private XMLGregorianCalendar normalizeToTimezone(int timezone) {
  int seconds = timezone;
  XMLGregorianCalendar result = (XMLGregorianCalendar) this.clone();
  // normalizing to UTC time negates the timezone offset before addition.
  seconds = - seconds;
  Duration d = DefaultFEELLib.DATA_TYPE_FACTORY.newDuration(seconds >= 0, 0, 0, 0, 0, 0, seconds < 0 ? - seconds : seconds);
  result.add(d);
  // set to zulu UTC time.
  result.setTimezone(0);
  return result;
}

代码示例来源:origin: goldmansachs/jdmn

private XMLGregorianCalendar normalizeToTimezone(int timezone) {
  int seconds = timezone;
  XMLGregorianCalendar result = (XMLGregorianCalendar) this.clone();
  // normalizing to UTC time negates the timezone offset before addition.
  seconds = - seconds;
  Duration d = DefaultFEELLib.DATA_TYPE_FACTORY.newDuration(seconds >= 0, 0, 0, 0, 0, 0, seconds < 0 ? - seconds : seconds);
  result.add(d);
  // set to zulu UTC time.
  result.setTimezone(0);
  return result;
}

代码示例来源:origin: Evolveum/midpoint

public static XMLGregorianCalendar addDuration(XMLGregorianCalendar now, Duration duration) {
  XMLGregorianCalendar later = createXMLGregorianCalendar(toMillis(now));
  later.add(duration);
  return later;
}

代码示例来源:origin: Evolveum/midpoint

private Date setNewDuration(String workItemId, @NotNull Duration newDuration, TaskService taskService) {
  XMLGregorianCalendar newDeadline = XmlTypeConverter.createXMLGregorianCalendar(new Date());
  newDeadline.add(newDuration);
  Date dueDate = XmlTypeConverter.toDate(newDeadline);
  taskService.setDueDate(workItemId, dueDate);
  return dueDate;
}

代码示例来源:origin: Evolveum/midpoint

static void setTaskDeadline(DelegateTask delegateTask, Duration duration) {
  XMLGregorianCalendar deadline = XmlTypeConverter.createXMLGregorianCalendar(new Date());
  deadline.add(duration);
  delegateTask.setDueDate(XmlTypeConverter.toDate(deadline));
}

代码示例来源:origin: org.ow2.authzforce/authzforce-ce-core-pdp-api

/** {@inheritDoc} */
@Override
public TimeValue add(final DurationValue<?> durationVal)
{
  final XMLGregorianCalendar cal = (XMLGregorianCalendar) value.clone();
  cal.add(durationVal.getUnderlyingValue());
  return new TimeValue(cal);
}

代码示例来源:origin: Evolveum/midpoint

public static XMLGregorianCalendar addDuration(XMLGregorianCalendar now, String duration) {
  XMLGregorianCalendar later = createXMLGregorianCalendar(toMillis(now));
  later.add(createDuration(duration));
  return later;
}

代码示例来源:origin: org.ow2.authzforce/authzforce-ce-core-pdp-api

/** {@inheritDoc} */
@Override
public DateValue add(final DurationValue<?> durationVal)
{
  final XMLGregorianCalendar cal = (XMLGregorianCalendar) value.clone();
  cal.add(durationVal.getUnderlyingValue());
  return new DateValue(cal);
}

代码示例来源:origin: org.ow2.authzforce/authzforce-ce-core-pdp-api

/** {@inheritDoc} */
  @Override
  public DateTimeValue subtract(final DurationValue<?> durationVal)
  {
    final XMLGregorianCalendar cal = (XMLGregorianCalendar) value.clone();
    cal.add(durationVal.getUnderlyingValue().negate());
    return new DateTimeValue(cal);
  }
}

代码示例来源:origin: org.ow2.authzforce/authzforce-ce-core-pdp-api

/** {@inheritDoc} */
  @Override
  public DateValue subtract(final DurationValue<?> durationVal)
  {
    final XMLGregorianCalendar cal = (XMLGregorianCalendar) value.clone();
    cal.add(durationVal.getUnderlyingValue().negate());
    return new DateValue(cal);
  }
}

代码示例来源:origin: org.ow2.authzforce/authzforce-ce-core-pdp-api

/** {@inheritDoc} */
@Override
public TimeValue subtract(final DurationValue<?> durationVal)
{
  final XMLGregorianCalendar cal = (XMLGregorianCalendar) value.clone();
  cal.add(durationVal.getUnderlyingValue().negate());
  return new TimeValue(cal);
}

代码示例来源:origin: Evolveum/midpoint

public static void assertDuration(String message, String durationString, long start, XMLGregorianCalendar end, Long precision) {
  assertNotNull("expected duration is null", durationString);
  assertNotNull("end time is null", end);
  XMLGregorianCalendar startGC = XmlTypeConverter.createXMLGregorianCalendar(start);
  startGC.add(XmlTypeConverter.createDuration(durationString));
  long difference = Math.abs(XmlTypeConverter.toMillis(startGC) - XmlTypeConverter.toMillis(end));
  long threshold = precision != null ? precision : 60000L;
  if (difference > threshold) {
    fail(message + ": Wrong time interval between " + new Date(start) + " and " + end + ": expected " + durationString
        + " (precision of " + threshold + "); real difference with the expected value is " + difference);
  }
}

代码示例来源:origin: Evolveum/midpoint

/**
 * Extends offset on top of existing offset.
 */
public void overrideDuration(Duration duration) {
  long millis = currentTimeMillis();
  XMLGregorianCalendar time = XmlTypeConverter.createXMLGregorianCalendar(millis);
  time.add(duration);
  long offset = XmlTypeConverter.toMillis(time) - millis;
  overrideDuration(offset);
}

代码示例来源:origin: Evolveum/midpoint

@Override
protected void finish(AbstractScannerResultHandler<FocusType> handler, TaskRunResult runResult, Task coordinatorTask, OperationResult opResult)
    throws SchemaException {
  TimeValidityPolicyConstraintType validityConstraintType = getValidityPolicyConstraint(coordinatorTask);
  Duration activateOn = getActivateOn(validityConstraintType);
  if (activateOn != null) {
    handler.getThisScanTimestamp().add(activateOn);
  }
  super.finish(handler, runResult, coordinatorTask, opResult);
  cleanupProcessedOids(coordinatorTask);
}

相关文章