本文整理汇总了Java中net.fortuna.ical4j.model.component.VToDo类的典型用法代码示例。如果您正苦于以下问题:Java VToDo类的具体用法?Java VToDo怎么用?Java VToDo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VToDo类属于net.fortuna.ical4j.model.component包,在下文中一共展示了VToDo类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
}
开发者ID:ksokol,项目名称:carldav,代码行数:27,代码来源:CalendarFilterEvaluater.java
示例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;
}
开发者ID:1and1,项目名称:cosmo,代码行数:29,代码来源:ICalendarUtils.java
示例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;
}
}
开发者ID:1and1,项目名称:cosmo,代码行数:30,代码来源:CalendarFilterEvaluater.java
示例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;
}
开发者ID:1and1,项目名称:cosmo,代码行数:25,代码来源:EntityConverter.java
示例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();
}
开发者ID:ksokol,项目名称:carldav,代码行数:20,代码来源:ICalendarUtils.java
示例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();
}
开发者ID:ksokol,项目名称:carldav,代码行数:19,代码来源:CalendarFilterEvaluater.java
示例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);
}
}
}
开发者ID:ksokol,项目名称:carldav,代码行数:32,代码来源:OutputFilter.java
示例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);
}
}
开发者ID:1and1,项目名称:cosmo,代码行数:19,代码来源:ICalendarUtils.java
示例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<>();
}
开发者ID:1and1,项目名称:cosmo,代码行数:20,代码来源:ICalendarUtils.java
示例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<>();
}
开发者ID:1and1,项目名称:cosmo,代码行数:19,代码来源:CalendarFilterEvaluater.java
示例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);
}
}
}
开发者ID:1and1,项目名称:cosmo,代码行数:32,代码来源:OutputFilter.java
示例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);
}
开发者ID:1and1,项目名称:cosmo,代码行数:39,代码来源:EntityConverterTest.java
示例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;
}
开发者ID:Bedework,项目名称:exchange-ws-client,代码行数:9,代码来源:ExchangeEventConverterImpl.java
示例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());
}
}
}
开发者ID:1and1,项目名称:cosmo,代码行数:74,代码来源:EntityConverter.java
示例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;
}
开发者ID:1and1,项目名称:cosmo,代码行数:19,代码来源:EntityConverter.java
示例16: setCalendar
import net.fortuna.ical4j.model.component.VToDo; //导入依赖的package包/类
/**
* <p>
* Imports a calendar object containing a VTODO. Sets the
* following properties:
* </p>
* <ul>
* <li>display name: the VTODO's SUMMARY (or the item's name, if the
* SUMMARY is blank)</li>
* <li>icalUid: the VTODO's UID</li>
* <li>body: the VTODO's DESCRIPTION</li>
* <li>reminderTime: if the VTODO has a DISPLAY VALARM
* the reminderTime will be set to the trigger time</li>
* </ul>
* @param cal The calendar imported.
* @throws CosmoDavException - if something is wrong this exception is thrown.
*/
public void setCalendar(Calendar cal)
throws CosmoDavException {
NoteItem note = (NoteItem) getItem();
ComponentList<VToDo> vtodos = cal.getComponents(Component.VTODO);
if (vtodos.isEmpty()) {
throw new UnprocessableEntityException("VCALENDAR does not contain any VTODOS");
}
EntityConverter converter = new EntityConverter(getEntityFactory());
converter.convertTaskCalendar(note, cal);
}
开发者ID:1and1,项目名称:cosmo,代码行数:29,代码来源:DavTask.java
注:本文中的net.fortuna.ical4j.model.component.VToDo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论