本文整理汇总了Java中net.fortuna.ical4j.model.component.VToDo类的典型用法代码示例。如果您正苦于以下问题:Java VToDo类的具体用法?Java VToDo怎么用?Java VToDo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VToDo类属于net.fortuna.ical4j.model.component包,在下文中一共展示了VToDo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: evaluate
import net.fortuna.ical4j.model.component.VToDo; //导入依赖的package包/类
/**
* Evaluates.
* @param comps The component list.
* @param filter The time range filter.
* @return the result.
*/
private boolean evaluate(ComponentList comps, TimeRangeFilter filter) {
Component comp = (Component) comps.get(0);
if(comp instanceof VEvent) {
return evaluateVEventTimeRange(comps, filter);
}
else if(comp instanceof VToDo) {
return evaulateVToDoTimeRange(comps, filter);
}
else if(comp instanceof VJournal) {
return evaluateVJournalTimeRange((VJournal) comp, filter);
}
else if(comp instanceof VAlarm) {
return evaluateVAlarmTimeRange(comps, filter);
}
else {
return false;
}
}
示例2: getDisplayAlarm
import net.fortuna.ical4j.model.component.VToDo; //导入依赖的package包/类
/**
* Find and return the first DISPLAY VALARM in a comoponent
* @param component VEVENT or VTODO
* @return first DISPLAY VALARM, null if there is none
*/
public static VAlarm getDisplayAlarm(Component component) {
ComponentList<VAlarm> alarms = null;
if(component instanceof VEvent) {
alarms = ((VEvent) component).getAlarms();
}
else if(component instanceof VToDo) {
alarms = ((VToDo) component).getAlarms();
}
if(alarms==null || alarms.size()==0) {
return null;
}
for(Iterator<VAlarm> it = alarms.iterator();it.hasNext();) {
VAlarm alarm = it.next();
if(Action.DISPLAY.equals(alarm.getAction())) {
return alarm;
}
}
return null;
}
示例3: evaluate
import net.fortuna.ical4j.model.component.VToDo; //导入依赖的package包/类
/**
* Evaluates.
* @param comps The component list.
* @param filter The time range filter.
* @return the result.
*/
private boolean evaluate(ComponentList<? extends Component> comps, TimeRangeFilter filter) {
Component comp = (Component) comps.get(0);
if(comp instanceof VEvent) {
return evaluateVEventTimeRange(comps, filter);
}
else if(comp instanceof VFreeBusy) {
return evaulateVFreeBusyTimeRange((VFreeBusy) comp, filter);
}
else if(comp instanceof VToDo) {
return evaulateVToDoTimeRange(comps, filter);
}
else if(comp instanceof VJournal) {
return evaluateVJournalTimeRange((VJournal) comp, filter);
}
else if(comp instanceof VAlarm) {
return evaluateVAlarmTimeRange(comps, filter);
}
else {
return false;
}
}
示例4: getCalendarFromNote
import net.fortuna.ical4j.model.component.VToDo; //导入依赖的package包/类
/**
* Gets calendar from note.
* @param note The note item.
* @return The calendar.
*/
protected Calendar getCalendarFromNote(NoteItem note) {
// Start with existing calendar if present
Calendar calendar = note.getTaskCalendar();
// otherwise, start with new calendar
if (calendar == null) {
calendar = ICalendarUtils.createBaseCalendar(new VToDo());
}
else {
// use copy when merging calendar with item properties
calendar = CalendarUtils.copyCalendar(calendar);
}
// merge in displayName,body
VToDo task = (VToDo) calendar.getComponent(Component.VTODO);
mergeCalendarProperties(task, note);
return calendar;
}
示例5: getSubComponents
import net.fortuna.ical4j.model.component.VToDo; //导入依赖的package包/类
/**
* Return list of subcomponents for a component. Ica4j doesn't have
* a generic way to do this.
* @param component The component.
* @return list of subcomponents
*/
public static ComponentList getSubComponents(Component component) {
if(component instanceof VEvent) {
return ((VEvent) component).getAlarms();
}
else if(component instanceof VTimeZone) {
return ((VTimeZone) component).getObservances();
}
else if(component instanceof VToDo) {
return ((VToDo) component).getAlarms();
}
return new ComponentList();
}
示例6: getSubComponents
import net.fortuna.ical4j.model.component.VToDo; //导入依赖的package包/类
/**
* Gets subcomponents.
* @param component The component.
* @return The component list.
*/
private ComponentList getSubComponents(Component component) {
if(component instanceof VEvent) {
return ((VEvent) component).getAlarms();
}
else if(component instanceof VTimeZone) {
return ((VTimeZone) component).getObservances();
}
else if(component instanceof VToDo) {
return ((VToDo) component).getAlarms();
}
return new ComponentList();
}
示例7: componentToUTC
import net.fortuna.ical4j.model.component.VToDo; //导入依赖的package包/类
/**
* @param comp The component.
*/
private void componentToUTC(Component comp) {
// Do to each top-level property
for (Property prop : (List<Property>) comp.getProperties()) {
if (prop instanceof DateProperty) {
DateProperty dprop = (DateProperty) prop;
Date date = dprop.getDate();
if (date instanceof DateTime &&
(((DateTime) date).getTimeZone() != null)) {
dprop.setUtc(true);
}
}
}
// Do to each embedded component
ComponentList subcomps = null;
if (comp instanceof VEvent) {
subcomps = ((VEvent)comp).getAlarms();
}
else if (comp instanceof VToDo) {
subcomps = ((VToDo)comp).getAlarms();
}
if (subcomps != null) {
for (Component subcomp : (List<Component>) subcomps) {
componentToUTC(subcomp);
}
}
}
示例8: setStatus
import net.fortuna.ical4j.model.component.VToDo; //导入依赖的package包/类
/**
* Update the STATUS property on a VTODO component.
*
* @param status
* status to set. If null, the STATUS property will be removed
* @param vtodo
* vtodo component to update
*/
public static void setStatus(Status status, VToDo vtodo) {
Status currStatus = vtodo.getStatus();
if (currStatus != null) {
vtodo.getProperties().remove(currStatus);
}
if (status != null) {
vtodo.getProperties().add(status);
}
}
示例9: getSubComponents
import net.fortuna.ical4j.model.component.VToDo; //导入依赖的package包/类
/**
* Return list of subcomponents for a component. Ica4j doesn't have
* a generic way to do this.
* @param component The component.
* @return list of subcomponents
*/
public static ComponentList<?> getSubComponents(Component component) {
if(component instanceof VEvent) {
return ((VEvent) component).getAlarms();
}
else if(component instanceof VTimeZone) {
return ((VTimeZone) component).getObservances();
}
else if(component instanceof VToDo) {
return ((VToDo) component).getAlarms();
}
return new ComponentList<>();
}
示例10: getSubComponents
import net.fortuna.ical4j.model.component.VToDo; //导入依赖的package包/类
/**
* Gets subcomponents.
* @param component The component.
* @return The component list.
*/
private ComponentList<? extends Component> getSubComponents(Component component) {
if(component instanceof VEvent) {
return ((VEvent) component).getAlarms();
}
else if(component instanceof VTimeZone) {
return ((VTimeZone) component).getObservances();
}
else if(component instanceof VToDo) {
return ((VToDo) component).getAlarms();
}
return new ComponentList<>();
}
示例11: componentToUTC
import net.fortuna.ical4j.model.component.VToDo; //导入依赖的package包/类
/**
* @param comp The component.
*/
private void componentToUTC(Component comp) {
// Do to each top-level property
for (Property prop : (List<Property>) comp.getProperties()) {
if (prop instanceof DateProperty) {
DateProperty dprop = (DateProperty) prop;
Date date = dprop.getDate();
if (date instanceof DateTime &&
(((DateTime) date).getTimeZone() != null)) {
dprop.setUtc(true);
}
}
}
// Do to each embedded component
ComponentList<? extends CalendarComponent> subcomps = null;
if (comp instanceof VEvent) {
subcomps = ((VEvent) comp).getAlarms() ;
}
else if (comp instanceof VToDo) {
subcomps = ((VToDo)comp).getAlarms();
}
if (subcomps != null) {
for (CalendarComponent subcomp : subcomps) {
componentToUTC(subcomp);
}
}
}
示例12: testEntityConverterTask
import net.fortuna.ical4j.model.component.VToDo; //导入依赖的package包/类
/**
* Tests entity convertor task.
* @throws Exception - if something is wrong this exception is thrown.
*/
@Test
public void testEntityConverterTask() throws Exception {
Calendar calendar = getCalendar("vtodo.ics");
NoteItem note = converter.convertTaskCalendar(calendar);
Assert.assertTrue(TriageStatus.CODE_NOW==note.getTriageStatus().getCode());
// add COMPLETED
DateTime completeDate = new DateTime("20080122T100000Z");
VToDo vtodo = (VToDo) calendar.getComponents(Component.VTODO).get(0);
ICalendarUtils.setCompleted(completeDate, vtodo);
note = converter.convertTaskCalendar(calendar);
TriageStatus ts = note.getTriageStatus();
Assert.assertTrue(TriageStatus.CODE_DONE==ts.getCode());
Assert.assertTrue(TriageStatusUtil.getDateFromRank(ts.getRank()).getTime()==completeDate.getTime());
note.setTriageStatus(null);
ICalendarUtils.setCompleted(null, vtodo);
Assert.assertNull(vtodo.getDateCompleted());
ICalendarUtils.setStatus(Status.VTODO_COMPLETED, vtodo);
// verify that TriageStatus.rank is set ot current time when
// STATUS:COMPLETED is present and COMPLETED is not present
long begin = (System.currentTimeMillis() / 1000) * 1000;
note = converter.convertTaskCalendar(calendar);
long end = (System.currentTimeMillis() / 1000) * 1000;
ts = note.getTriageStatus();
Assert.assertTrue(TriageStatus.CODE_DONE==ts.getCode());
long rankTime = TriageStatusUtil.getDateFromRank(ts.getRank()).getTime();
Assert.assertTrue(rankTime<=end && rankTime>=begin);
}
示例13: convertTaskType
import net.fortuna.ical4j.model.component.VToDo; //导入依赖的package包/类
protected Pair<VToDo, ArrayList<VTimeZone>> convertTaskType(TaskType taskItem, String upn) {
VToDo task = new VToDo();
ArrayList<VTimeZone> timeZones = new ArrayList<VTimeZone>();
Pair<VToDo, ArrayList<VTimeZone>> pair = Pair.of(task, timeZones);
return pair;
}
示例14: setCalendarAttributes
import net.fortuna.ical4j.model.component.VToDo; //导入依赖的package包/类
/**
* Sets calendar attributes.
* @param note The note item.
* @param task The task vToDo.
*/
private void setCalendarAttributes(NoteItem note, VToDo task) {
// UID
if(task.getUid()!=null) {
note.setIcalUid(task.getUid().getValue());
}
// for now displayName is limited to 1024 chars
if (task.getSummary() != null) {
note.setDisplayName(StringUtils.substring(task.getSummary()
.getValue(), 0, 1024));
}
if (task.getDescription() != null) {
note.setBody(task.getDescription().getValue());
}
// look for DTSTAMP
if (task.getDateStamp() != null) {
note.setClientModifiedDate(task.getDateStamp().getDate());
}
// look for absolute VALARM
VAlarm va = ICalendarUtils.getDisplayAlarm(task);
if (va != null && va.getTrigger()!=null) {
Trigger trigger = va.getTrigger();
Date reminderTime = trigger.getDateTime();
if (reminderTime != null) {
note.setReminderTime(reminderTime);
}
}
// look for COMPLETED or STATUS:COMPLETED
Completed completed = task.getDateCompleted();
Status status = task.getStatus();
TriageStatus ts = note.getTriageStatus();
// Initialize TriageStatus if necessary
if(completed!=null || Status.VTODO_COMPLETED.equals(status)) {
if (ts == null) {
ts = TriageStatusUtil.initialize(entityFactory
.createTriageStatus());
note.setTriageStatus(ts);
}
// TriageStatus.code will be DONE
note.getTriageStatus().setCode(TriageStatus.CODE_DONE);
// TriageStatus.rank will be the COMPLETED date if present
// or currentTime
if(completed!=null) {
note.getTriageStatus().setRank(
TriageStatusUtil.getRank(completed.getDate().getTime()));
}
else {
note.getTriageStatus().setRank(
TriageStatusUtil.getRank(System.currentTimeMillis()));
}
}
// check for X-OSAF-STARRED
if ("TRUE".equals(ICalendarUtils.getXProperty(X_OSAF_STARRED, task))) {
TaskStamp taskStamp = StampUtils.getTaskStamp(note);
if (taskStamp == null) {
note.addStamp(entityFactory.createTaskStamp());
}
}
}
示例15: convertTaskCalendar
import net.fortuna.ical4j.model.component.VToDo; //导入依赖的package包/类
/**
* Convert calendar containing single VTODO into NoteItem
*
* @param note
* note to update
* @param calendar
* calendar containing VTODO
* @return NoteItem representation of VTODO
*/
public NoteItem convertTaskCalendar(NoteItem note, Calendar calendar) {
note.setTaskCalendar(calendar);
VToDo todo = (VToDo) getMasterComponent(calendar.getComponents(Component.VTODO));
setCalendarAttributes(note, todo);
return note;
}