本文整理汇总了Java中net.fortuna.ical4j.model.Dur.getHours方法的典型用法代码示例。如果您正苦于以下问题:Java Dur.getHours方法的具体用法?Java Dur.getHours怎么用?Java Dur.getHours使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.fortuna.ical4j.model.Dur
的用法示例。
在下文中一共展示了Dur.getHours方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromDuration
import net.fortuna.ical4j.model.Dur; //导入方法依赖的package包/类
protected static Double fromDuration(PropertyList propertyList) {
Duration iCalObj = (Duration) propertyList.getProperty(Duration.DURATION);
if (iCalObj == null) {
return null;
}
Dur dur = iCalObj.getDuration();
TimeDuration td = new TimeDuration(0, 0, (dur.getWeeks() * 7) + dur.getDays(), dur.getHours(), dur.getMinutes(), dur.getSeconds(), 0);
return new Double(TimeDuration.toLong(td));
}
示例2: createTeamEventDO
import net.fortuna.ical4j.model.Dur; //导入方法依赖的package包/类
public static TeamEventDO createTeamEventDO(final VEvent event)
{
final TeamEventDO teamEvent = new TeamEventDO();
final DtStart dtStart = event.getStartDate();
final String value = dtStart.toString();
if (value.indexOf("VALUE=DATE") >= 0) {
teamEvent.setAllDay(true);
}
Timestamp timestamp = ICal4JUtils.getSqlTimestamp(dtStart.getDate());
teamEvent.setStartDate(timestamp);
if (teamEvent.isAllDay() == true) {
final org.joda.time.DateTime jodaTime = new org.joda.time.DateTime(event.getEndDate().getDate());
final net.fortuna.ical4j.model.Date fortunaEndDate = new net.fortuna.ical4j.model.Date(jodaTime.plusDays(-1).toDate());
timestamp = new Timestamp(fortunaEndDate.getTime());
} else {
timestamp = ICal4JUtils.getSqlTimestamp(event.getEndDate().getDate());
}
teamEvent.setEndDate(timestamp);
if (event.getUid() != null) {
teamEvent.setExternalUid(event.getUid().getValue());
}
if (event.getLocation() != null) {
teamEvent.setLocation(event.getLocation().getValue());
}
if (event.getDescription() != null) {
teamEvent.setNote(event.getDescription().getValue());
}
if (event.getSummary() != null) {
teamEvent.setSubject(event.getSummary().getValue());
} else {
teamEvent.setSubject("");
}
if (event.getOrganizer() != null) {
teamEvent.setOrganizer(event.getOrganizer().getValue());
}
@SuppressWarnings("unchecked")
final List<VAlarm> alarms = event.getAlarms();
if (alarms != null && alarms.size() >= 1) {
final Dur dur = alarms.get(0).getTrigger().getDuration();
if (dur != null) { // Might be null.
// consider weeks
int weeksToDays = 0;
if (dur.getWeeks() != 0) {
weeksToDays = dur.getWeeks() * DURATION_OF_WEEK;
}
if (dur.getDays() != 0) {
teamEvent.setReminderDuration(dur.getDays() + weeksToDays);
teamEvent.setReminderDurationUnit(ReminderDurationUnit.DAYS);
} else if (dur.getHours() != 0) {
teamEvent.setReminderDuration(dur.getHours());
teamEvent.setReminderDurationUnit(ReminderDurationUnit.HOURS);
} else if (dur.getMinutes() != 0) {
teamEvent.setReminderDuration(dur.getMinutes());
teamEvent.setReminderDurationUnit(ReminderDurationUnit.MINUTES);
}
}
}
final RRule rule = (RRule) event.getProperty(Property.RRULE);
if (rule != null) {
teamEvent.setRecurrenceRule(rule.getValue());
}
final ExDate exDate = (ExDate) event.getProperty(Property.EXDATE);
if (exDate != null) {
teamEvent.setRecurrenceExDate(exDate.getValue());
}
return teamEvent;
}