本文整理汇总了Java中biweekly.property.DateEnd类的典型用法代码示例。如果您正苦于以下问题:Java DateEnd类的具体用法?Java DateEnd怎么用?Java DateEnd使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DateEnd类属于biweekly.property包,在下文中一共展示了DateEnd类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: printExam
import biweekly.property.DateEnd; //导入依赖的package包/类
private void printExam(Exam exam, ICalendar ical) throws IOException {
if (exam.getAssignedPeriod() == null) return;
VEvent vevent = new VEvent();
vevent.setSequence(0);
vevent.setUid(exam.getUniqueId().toString());
DateStart dstart = new DateStart(exam.getAssignedPeriod().getStartTime(), true);
vevent.setDateStart(dstart);
Calendar endTime = Calendar.getInstance(); endTime.setTime(exam.getAssignedPeriod().getStartTime());
endTime.add(Calendar.MINUTE, exam.getLength());
DateEnd dend = new DateEnd(endTime.getTime(), true);
vevent.setDateEnd(dend);
vevent.setSummary(exam.getLabel()+" ("+exam.getExamType().getLabel()+" Exam)");
if (!exam.getAssignedRooms().isEmpty()) {
String rooms = "";
for (Iterator i=new TreeSet(exam.getAssignedRooms()).iterator();i.hasNext();) {
Location location = (Location)i.next();
if (rooms.length()>0) rooms+=", ";
rooms+=location.getLabel();
}
vevent.setLocation(rooms);
}
vevent.setStatus(Status.confirmed());
ical.addEvent(vevent);
}
开发者ID:Jenner4S,项目名称:unitimes,代码行数:26,代码来源:CalendarServlet.java
示例2: validate_time_in_rrule
import biweekly.property.DateEnd; //导入依赖的package包/类
@Test
public void validate_time_in_rrule() {
TestComponent parent = new TestComponent();
//@formatter:off
Recurrence[] recurrences = {
new Recurrence.Builder(Frequency.DAILY).byHour(1).build(),
new Recurrence.Builder(Frequency.DAILY).byMinute(1).build(),
new Recurrence.Builder(Frequency.DAILY).bySecond(1).build()
};
//@formatter:on
for (Recurrence recurrence : recurrences) {
VEvent component = new VEvent();
component.setDateStart(new DateStart(date("2000-01-01"), false));
component.setDateEnd(new DateEnd(date("2000-01-10"), false));
component.setRecurrenceRule(recurrence);
assertValidate(component).parents(parent).run(5);
}
}
开发者ID:mangstadt,项目名称:biweekly,代码行数:20,代码来源:VEventTest.java
示例3: validate_cardinality_optional
import biweekly.property.DateEnd; //导入依赖的package包/类
@Test
public void validate_cardinality_optional() {
VFreeBusy component = new VFreeBusy();
component.addProperty(new Contact(""));
component.addProperty(new DateStart(date("2000-01-01")));
component.addProperty(new DateEnd(date("2000-01-10")));
component.addProperty(new Organizer(null, null));
component.addProperty(new Url(""));
assertValidate(component).versions(V1_0).run(48);
assertValidate(component).versions(V2_0_DEPRECATED, V2_0).run();
component.addProperty(new Contact(""));
component.addProperty(new DateStart(date("2000-01-01")));
component.addProperty(new DateEnd(date("2000-01-10")));
component.addProperty(new Organizer("", ""));
component.addProperty(new Url(""));
assertValidate(component).versions(V1_0).run(48, 3, 3, 3, 3, 3);
assertValidate(component).versions(V2_0_DEPRECATED, V2_0).run(3, 3, 3, 3, 3);
}
开发者ID:mangstadt,项目名称:biweekly,代码行数:20,代码来源:VFreeBusyTest.java
示例4: validate
import biweekly.property.DateEnd; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void validate(List<ICalComponent> components, ICalVersion version, List<ValidationWarning> warnings) {
if (version == ICalVersion.V1_0) {
warnings.add(new ValidationWarning(48, version));
}
checkRequiredCardinality(warnings, Uid.class, DateTimeStamp.class);
checkOptionalCardinality(warnings, Contact.class, DateStart.class, DateEnd.class, Organizer.class, Url.class);
ICalDate dateStart = getValue(getDateStart());
ICalDate dateEnd = getValue(getDateEnd());
//DTSTART is required if DTEND exists
if (dateEnd != null && dateStart == null) {
warnings.add(new ValidationWarning(15));
}
//DTSTART and DTEND must contain a time component
if (dateStart != null && !dateStart.hasTime()) {
warnings.add(new ValidationWarning(20, DateStart.class.getSimpleName()));
}
if (dateEnd != null && !dateEnd.hasTime()) {
warnings.add(new ValidationWarning(20, DateEnd.class.getSimpleName()));
}
//DTSTART must come before DTEND
if (dateStart != null && dateEnd != null && dateStart.compareTo(dateEnd) >= 0) {
warnings.add(new ValidationWarning(16));
}
}
开发者ID:mangstadt,项目名称:biweekly,代码行数:32,代码来源:VFreeBusy.java
示例5: determineStartDate
import biweekly.property.DateEnd; //导入依赖的package包/类
/**
* Determines what the alarm property's start date should be.
* @param valarm the component that is being converted to a vCal alarm
* property
* @param parent the component's parent
* @return the start date or null if it cannot be determined
*/
private static Date determineStartDate(VAlarm valarm, ICalComponent parent) {
Trigger trigger = valarm.getTrigger();
if (trigger == null) {
return null;
}
Date triggerStart = trigger.getDate();
if (triggerStart != null) {
return triggerStart;
}
Duration triggerDuration = trigger.getDuration();
if (triggerDuration == null) {
return null;
}
if (parent == null) {
return null;
}
Related related = trigger.getRelated();
Date date = null;
if (related == Related.START) {
date = ValuedProperty.getValue(parent.getProperty(DateStart.class));
} else if (related == Related.END) {
date = ValuedProperty.getValue(parent.getProperty(DateEnd.class));
if (date == null) {
Date dateStart = ValuedProperty.getValue(parent.getProperty(DateStart.class));
Duration duration = ValuedProperty.getValue(parent.getProperty(DurationProperty.class));
if (duration != null && dateStart != null) {
date = duration.add(dateStart);
}
}
}
return (date == null) ? null : triggerDuration.add(date);
}
开发者ID:mangstadt,项目名称:biweekly,代码行数:45,代码来源:VAlarmScribe.java
示例6: validate_different_date_datatypes
import biweekly.property.DateEnd; //导入依赖的package包/类
@Test
public void validate_different_date_datatypes() {
TestComponent parent = new TestComponent();
VEvent component = new VEvent();
component.setDateStart(new DateStart(date("2000-01-01"), false));
component.setDateEnd(new DateEnd(date("2000-01-10"), true));
assertValidate(component).parents(parent).run(17);
parent = new TestComponent();
component = new VEvent();
component.setDateStart(new DateStart(date("2000-01-01"), false));
component.setDateEnd(new DateEnd(date("2000-01-10"), false));
component.setRecurrenceId(new RecurrenceId(date("2000-01-01"), true));
assertValidate(component).parents(parent).run(19);
}
开发者ID:mangstadt,项目名称:biweekly,代码行数:16,代码来源:VEventTest.java
示例7: validate_multiple_rrules
import biweekly.property.DateEnd; //导入依赖的package包/类
@Test
public void validate_multiple_rrules() {
TestComponent parent = new TestComponent();
VEvent component = new VEvent();
component.setDateStart(new DateStart(date("2000-01-01"), false));
component.setDateEnd(new DateEnd(date("2000-01-10"), false));
component.addProperty(new RecurrenceRule(new Recurrence.Builder(Frequency.DAILY).build()));
component.addProperty(new RecurrenceRule(new Recurrence.Builder(Frequency.DAILY).build()));
assertValidate(component).parents(parent).run(6);
}
开发者ID:mangstadt,项目名称:biweekly,代码行数:11,代码来源:VEventTest.java
示例8: validate_no_startDate
import biweekly.property.DateEnd; //导入依赖的package包/类
@Test
public void validate_no_startDate() {
VFreeBusy component = new VFreeBusy();
component.setDateEnd(new DateEnd(date("2000-01-10"), true));
assertValidate(component).versions(V1_0).run(48, 15);
assertValidate(component).versions(V2_0_DEPRECATED, V2_0).run(15);
}
开发者ID:mangstadt,项目名称:biweekly,代码行数:8,代码来源:VFreeBusyTest.java
示例9: validate_dates_do_not_have_times
import biweekly.property.DateEnd; //导入依赖的package包/类
@Test
public void validate_dates_do_not_have_times() {
VFreeBusy component = new VFreeBusy();
component.setDateStart(new DateStart(date("2000-01-01"), false));
component.setDateEnd(new DateEnd(date("2000-01-10"), false));
assertValidate(component).versions(V1_0).run(48, 20, 20);
assertValidate(component).versions(V2_0_DEPRECATED, V2_0).run(20, 20);
}
开发者ID:mangstadt,项目名称:biweekly,代码行数:9,代码来源:VFreeBusyTest.java
示例10: validate_startDate_before_endDate
import biweekly.property.DateEnd; //导入依赖的package包/类
@Test
public void validate_startDate_before_endDate() {
VFreeBusy component = new VFreeBusy();
component.setDateStart(new DateStart(date("2000-01-10"), true));
component.setDateEnd(new DateEnd(date("2000-01-01"), true));
assertValidate(component).versions(V1_0).run(48, 16);
assertValidate(component).versions(V2_0_DEPRECATED, V2_0).run(16);
}
开发者ID:mangstadt,项目名称:biweekly,代码行数:9,代码来源:VFreeBusyTest.java
示例11: parse
import biweekly.property.DateEnd; //导入依赖的package包/类
public static FBEvent parse(VEvent vevent) {
FBEvent fbEvent = new FBEvent();
ContentValues values = fbEvent.mValues;
String uid = vevent.getUid().getValue();
boolean isBirthday = true;
if (uid.startsWith("e")) { // events
uid = uid.substring(1, uid.indexOf("@"));
isBirthday = false;
}
values.put(CalendarContract.Events.UID_2445, uid);
values.put(CalendarContract.Events.TITLE, vevent.getSummary().getValue());
Description desc = vevent.getDescription();
if (desc != null) {
values.put(CalendarContract.Events.DESCRIPTION, desc.getValue());
}
Organizer organizer = vevent.getOrganizer();
if (organizer != null) {
values.put(CalendarContract.Events.ORGANIZER, organizer.getCommonName());
}
Location location = vevent.getLocation();
if (location != null) {
values.put(CalendarContract.Events.EVENT_LOCATION, location.getValue());
}
values.put(CalendarContract.Events.EVENT_TIMEZONE, TimeZone.getDefault().getID());
if (isBirthday) {
ICalDate date = vevent.getDateStart().getValue();
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
// HACK: Facebook only lists the "next" birthdays, which means birthdays disappear from
// the listing the day after it they pass. Many users dislike that (and I understand why)
// so we hack around by always setting the year as current year - 1 and setting yearly
// recurrence so that they don't disappear from the calendar
calendar.set(calendar.get(Calendar.YEAR) - 1, date.getMonth(), date.getDate(), 0, 0, 0);
calendar.set(Calendar.MILLISECOND, 0);
values.put(CalendarContract.Events.DTSTART, calendar.getTimeInMillis());
// Those are identical for all birthdays, so we hardcode them
values.put(CalendarContract.Events.ALL_DAY, 1);
values.put(CalendarContract.Events.RRULE, "FREQ=YEARLY");
values.put(CalendarContract.Events.DURATION, "P1D");
fbEvent.mRSVP = FBCalendar.CalendarType.TYPE_BIRTHDAY;
} else {
DateStart start = vevent.getDateStart();
values.put(CalendarContract.Events.DTSTART, start.getValue().getTime());
DateEnd end = vevent.getDateEnd();
if (end != null) {
values.put(CalendarContract.Events.DTEND, end.getValue().getTime());
}
RawProperty prop = vevent.getExperimentalProperty("PARTSTAT");
if (prop != null) {
switch (prop.getValue()) {
case "ACCEPTED":
fbEvent.mRSVP = FBCalendar.CalendarType.TYPE_ATTENDING;
break;
case "TENTATIVE":
fbEvent.mRSVP = FBCalendar.CalendarType.TYPE_MAYBE;
break;
case "DECLINED":
fbEvent.mRSVP = FBCalendar.CalendarType.TYPE_DECLINED;
break;
case "NEEDS-ACTION":
fbEvent.mRSVP = FBCalendar.CalendarType.TYPE_NOT_REPLIED;
break;
}
}
}
return fbEvent;
}
开发者ID:danvratil,项目名称:FBEventSync,代码行数:73,代码来源:FBEvent.java
示例12: getDateEnd
import biweekly.property.DateEnd; //导入依赖的package包/类
public DateEnd getDateEnd() {
DateEnd de = new DateEnd(iEnd.toDate(), true);
return de;
}
开发者ID:Jenner4S,项目名称:unitimes,代码行数:5,代码来源:CalendarServlet.java
示例13: validate
import biweekly.property.DateEnd; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void validate(List<ICalComponent> components, ICalVersion version, List<ValidationWarning> warnings) {
checkRequiredCardinality(warnings, Action.class, Trigger.class);
Action action = getAction();
if (action != null) {
//AUDIO alarms should not have more than 1 attachment
if (action.isAudio()) {
if (getAttachments().size() > 1) {
warnings.add(new ValidationWarning(7));
}
}
//DESCRIPTION is required for DISPLAY alarms
if (action.isDisplay()) {
checkRequiredCardinality(warnings, Description.class);
}
if (action.isEmail()) {
//SUMMARY and DESCRIPTION is required for EMAIL alarms
checkRequiredCardinality(warnings, Summary.class, Description.class);
//EMAIL alarms must have at least 1 ATTENDEE
if (getAttendees().isEmpty()) {
warnings.add(new ValidationWarning(8));
}
} else {
//only EMAIL alarms can have ATTENDEEs
if (!getAttendees().isEmpty()) {
warnings.add(new ValidationWarning(9));
}
}
if (action.isProcedure()) {
checkRequiredCardinality(warnings, Description.class);
}
}
Trigger trigger = getTrigger();
if (trigger != null) {
Related related = trigger.getRelated();
if (related != null) {
ICalComponent parent = components.get(components.size() - 1);
//if the TRIGGER is relative to DTSTART, confirm that DTSTART exists
if (related == Related.START && parent.getProperty(DateStart.class) == null) {
warnings.add(new ValidationWarning(11));
}
//if the TRIGGER is relative to DTEND, confirm that DTEND (or DUE) exists
if (related == Related.END) {
boolean noEndDate = false;
if (parent instanceof VEvent) {
noEndDate = (parent.getProperty(DateEnd.class) == null && (parent.getProperty(DateStart.class) == null || parent.getProperty(DurationProperty.class) == null));
} else if (parent instanceof VTodo) {
noEndDate = (parent.getProperty(DateDue.class) == null && (parent.getProperty(DateStart.class) == null || parent.getProperty(DurationProperty.class) == null));
}
if (noEndDate) {
warnings.add(new ValidationWarning(12));
}
}
}
}
}
开发者ID:mangstadt,项目名称:biweekly,代码行数:68,代码来源:VAlarm.java
示例14: DateEndScribe
import biweekly.property.DateEnd; //导入依赖的package包/类
public DateEndScribe() {
super(DateEnd.class, "DTEND");
}
开发者ID:mangstadt,项目名称:biweekly,代码行数:4,代码来源:DateEndScribe.java
示例15: newInstance
import biweekly.property.DateEnd; //导入依赖的package包/类
@Override
protected DateEnd newInstance(ICalDate date) {
return new DateEnd(date);
}
开发者ID:mangstadt,项目名称:biweekly,代码行数:5,代码来源:DateEndScribe.java
示例16: run
import biweekly.property.DateEnd; //导入依赖的package包/类
public void run() throws Exception {
final EvernoteAuth evernoteAuth = new EvernoteAuth(EvernoteService.PRODUCTION, conf.getDevToken());
evernoteAuth.setNoteStoreUrl(conf.getNoteStore());
final ClientFactory clientFactory = new ClientFactory(evernoteAuth);
final NoteStoreClient noteStoreClient;
noteStoreClient = clientFactory.createNoteStoreClient();
final ICalendar ical = new ICalendar();
ical.setProductId("org.tario.enki");
final Pattern eventDatePattern = conf.getEventDatePattern();
final List<Notebook> notebooks = noteStoreClient.listNotebooks();
for (final Notebook notebook : notebooks) {
if (conf.getEventNotebook().equals(notebook.getName())) {
final NoteFilter filter = new NoteFilter();
filter.setNotebookGuid(notebook.getGuid());
final NoteList notes = noteStoreClient.findNotes(filter, 0, 9000);
for (final Note note : notes.getNotes()) {
final VEvent event = new VEvent();
final String title = note.getTitle();
final Matcher matcher = eventDatePattern.matcher(title);
if (matcher.matches()) {
final String day = matcher.group("day");
final String month = matcher.group("month");
final String year = matcher.group("year");
final String fromHour = matcher.group("fromHour");
final String fromMinute = matcher.group("fromMinute");
final String toHour = matcher.group("toHour");
final String toMinute = matcher.group("toMinute");
final LocalDate fromDate = new LocalDate(Integer.parseInt(year), Integer.parseInt(month),
Integer.parseInt(day));
if (fromHour != null && fromMinute != null) {
final LocalTime fromTime = new LocalTime(Integer.parseInt(fromHour),
Integer.parseInt(fromMinute));
final DateStart dateStart = new DateStart(fromDate.toLocalDateTime(fromTime).toDate());
dateStart.setTimezoneId(conf.getEventTimeZone());
event.setDateStart(dateStart);
if (toHour != null && toMinute != null) {
final LocalTime toTime = new LocalTime(Integer.parseInt(toHour),
Integer.parseInt(toMinute));
final DateEnd dateEnd = new DateEnd(fromDate.toLocalDateTime(toTime).toDate());
dateEnd.setTimezoneId(conf.getEventTimeZone());
event.setDateEnd(dateEnd);
} else {
event.setDuration(Duration.builder().hours(1).build());
}
} else {
event.setDateStart(new DateStart(fromDate.toDate(), false));
event.setDuration(Duration.builder().days(1).build());
}
event.setSummary(title);
ical.addEvent(event);
}
}
}
}
Biweekly.write(ical).go(conf.getEventFile());
}
开发者ID:tarioch,项目名称:enki,代码行数:68,代码来源:Enki.java
示例17: getDateEnd
import biweekly.property.DateEnd; //导入依赖的package包/类
/**
* Gets the date that the free/busy entry ends.
* @return the end date or null if not set
* @see <a href="http://tools.ietf.org/html/rfc5545#page-95">RFC 5545
* p.95-6</a>
* @see <a href="http://tools.ietf.org/html/rfc2445#page-91">RFC 2445
* p.91-2</a>
*/
public DateEnd getDateEnd() {
return getProperty(DateEnd.class);
}
开发者ID:mangstadt,项目名称:biweekly,代码行数:12,代码来源:VFreeBusy.java
示例18: setDateEnd
import biweekly.property.DateEnd; //导入依赖的package包/类
/**
* Sets the date that the free/busy entry ends.
* @param dateEnd the end date or null to remove
* @see <a href="http://tools.ietf.org/html/rfc5545#page-95">RFC 5545
* p.95-6</a>
* @see <a href="http://tools.ietf.org/html/rfc2445#page-91">RFC 2445
* p.91-2</a>
*/
public void setDateEnd(DateEnd dateEnd) {
setProperty(DateEnd.class, dateEnd);
}
开发者ID:mangstadt,项目名称:biweekly,代码行数:12,代码来源:VFreeBusy.java
示例19: getDateEnd
import biweekly.property.DateEnd; //导入依赖的package包/类
/**
* Gets the date that the event ends.
* @return the end date or null if not set
* @see <a href="http://tools.ietf.org/html/rfc5545#page-95">RFC 5545
* p.95-6</a>
* @see <a href="http://tools.ietf.org/html/rfc2445#page-91">RFC 2445
* p.91-2</a>
* @see <a href="http://www.imc.org/pdi/vcal-10.doc">vCal 1.0 p.31</a>
*/
public DateEnd getDateEnd() {
return getProperty(DateEnd.class);
}
开发者ID:mangstadt,项目名称:biweekly,代码行数:13,代码来源:VEvent.java
示例20: setDateEnd
import biweekly.property.DateEnd; //导入依赖的package包/类
/**
* Sets the date that the event ends. This must NOT be set if a
* {@link DurationProperty} is defined.
* @param dateEnd the end date or null to remove
* @see <a href="http://tools.ietf.org/html/rfc5545#page-95">RFC 5545
* p.95-6</a>
* @see <a href="http://tools.ietf.org/html/rfc2445#page-91">RFC 2445
* p.91-2</a>
* @see <a href="http://www.imc.org/pdi/vcal-10.doc">vCal 1.0 p.31</a>
*/
public void setDateEnd(DateEnd dateEnd) {
setProperty(DateEnd.class, dateEnd);
}
开发者ID:mangstadt,项目名称:biweekly,代码行数:14,代码来源:VEvent.java
注:本文中的biweekly.property.DateEnd类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论