當前位置: 首頁>>代碼示例>>Java>>正文


Java Duration.addTo方法代碼示例

本文整理匯總了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");
}
 
開發者ID:zhaojunfei,項目名稱:lemon,代碼行數:14,代碼來源:AdvancedBusinessCalendar.java

示例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);
}
 
開發者ID:zhaojunfei,項目名稱:lemon,代碼行數:12,代碼來源:DurationUtil.java

示例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);
        }
    }
}
 
開發者ID:zhaojunfei,項目名稱:lemon,代碼行數:38,代碼來源:DeadlineHumanTaskListener.java

示例4: add

import javax.xml.datatype.Duration; //導入方法依賴的package包/類
public Date add(Date date, Duration duration, String tenantId) {
    duration.addTo(date);

    return date;
}
 
開發者ID:zhaojunfei,項目名稱:lemon,代碼行數:6,代碼來源:MockWorkCalendarConnector.java


注:本文中的javax.xml.datatype.Duration.addTo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。