本文整理匯總了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;
}