本文整理汇总了Java中javax.xml.datatype.Duration.addTo方法的典型用法代码示例。如果您正苦于以下问题:Java Duration.addTo方法的具体用法?Java Duration.addTo怎么用?Java Duration.addTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.datatype.Duration
的用法示例。
在下文中一共展示了Duration.addTo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: add
import javax.xml.datatype.Duration; //导入方法依赖的package包/类
public Date add(Date date, Duration duration, boolean useBusinessTime) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
if (!useBusinessTime) {
duration.addTo(calendar);
return calendar.getTime();
}
// TODO: tenantId
return workCalendarConnector.add(date, duration, "1");
}
示例2: add
import javax.xml.datatype.Duration; //导入方法依赖的package包/类
private Date add(Date date, Duration duration) {
if (!useBusinessTime) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
duration.addTo(calendar);
return calendar.getTime();
}
return businessCalendar.add(date, duration, useBusinessTime);
}
示例3: onCreate
import javax.xml.datatype.Duration; //导入方法依赖的package包/类
@Override
public void onCreate(TaskInfo taskInfo) {
String taskDefinitionKey = taskInfo.getCode();
String processDefinitionId = taskInfo.getProcessDefinitionId();
List<DeadlineDTO> deadlines = taskDefinitionConnector.findDeadlines(
taskDefinitionKey, processDefinitionId);
for (DeadlineDTO deadline : deadlines) {
try {
String durationText = deadline.getDuration();
Date now = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(now);
DatatypeFactory datatypeFactory = DatatypeFactory.newInstance();
Duration duration = datatypeFactory.newDuration(durationText);
duration.addTo(calendar);
Date deadlineTime = calendar.getTime();
TaskDeadline taskDeadline = new TaskDeadline();
taskDeadline.setTaskInfo(taskInfo);
taskDeadline.setType(deadline.getType());
taskDeadline.setDeadlineTime(deadlineTime);
taskDeadline
.setNotificationType(deadline.getNotificationType());
taskDeadline.setNotificationTemplateCode(deadline
.getNotificationTemplateCode());
taskDeadline.setNotificationReceiver(deadline
.getNotificationReceiver());
taskDeadlineManager.save(taskDeadline);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
}
}
示例4: add
import javax.xml.datatype.Duration; //导入方法依赖的package包/类
public Date add(Date date, Duration duration, String tenantId) {
duration.addTo(date);
return date;
}