本文整理汇总了Java中biweekly.component.VEvent类的典型用法代码示例。如果您正苦于以下问题:Java VEvent类的具体用法?Java VEvent怎么用?Java VEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VEvent类属于biweekly.component包,在下文中一共展示了VEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRowEvents
import biweekly.component.VEvent; //导入依赖的package包/类
private List<VEvent> getRowEvents(final WebElement row) throws ParseException {
final List<WebElement> columns = row.findElements(By.tagName("td"));
final Date startDateMidnight = dateFormat.parse(columns.get(1).getText());
final int[] startTime = splitInts(columns.get(3).getText(), ":");
final int[] endTime = splitInts(columns.get(4).getText(), ":");
final List<Integer> weeks = convertRangesToWeeks(columns.get(2).getText());
final List<VEvent> events = new ArrayList<>();
weeks.forEach(week -> {
final VEvent event = new VEvent();
event.setSummary(columns.get(5).getText() + " - " + columns.get(7).getText());
event.setLocation("VU Amsterdam - " + columns.get(8).getText());
event.setDescription("Vakcode: " + columns.get(0).getText()
+ "\nDocent: " + columns.get(9).getText());
event.setDateStart(addTimeDelta(startDateMidnight, 7 * week, startTime[0], startTime[1]));
event.setDateEnd(addTimeDelta(startDateMidnight, 7 * week, endTime[0], endTime[1]));
events.add(event);
});
return events;
}
示例2: printExam
import biweekly.component.VEvent; //导入依赖的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);
}
示例3: createReservationEvent
import biweekly.component.VEvent; //导入依赖的package包/类
private ICalendar createReservationEvent(Lang lang, DateTime start, DateTime end, String address, String... placeInfo) {
List<String> info = Stream.of(placeInfo)
.filter(s -> s != null && !s.isEmpty())
.collect(Collectors.toList());
ICalendar iCal = new ICalendar();
iCal.setVersion(ICalVersion.V2_0);
VEvent event = new VEvent();
Summary summary = event.setSummary(messaging.get(lang, "ical.reservation.summary"));
summary.setLanguage(lang.code());
event.setDateStart(start.toDate());
event.setDateEnd(end.toDate());
event.setLocation(address);
event.setDescription(messaging.get(lang, "ical.reservation.room.info", String.join(", ", info)));
iCal.addEvent(event);
return iCal;
}
示例4: map
import biweekly.component.VEvent; //导入依赖的package包/类
public Event map(VEvent event, TimeZone defaultTimeZone) {
Event result = new Event();
nullSave(() -> {
final DateTime start = new DateTime(event.getDateStart().getValue().getTime(), DateTimeZone.forTimeZone(defaultTimeZone));
result.setStart(start, event.getDateStart().getValue().hasTime());
});
nullSave(() -> {
final DateTime end = new DateTime(event.getDateEnd().getValue().getTime(), DateTimeZone.forTimeZone(defaultTimeZone));
result.setEnd(end, event.getDateStart().getValue().hasTime());
});
nullSave(() -> result.setSummary(event.getSummary().getValue()));
nullSave(() -> result.setDescription(event.getDescription().getValue()));
return result;
}
示例5: map
import biweekly.component.VEvent; //导入依赖的package包/类
@Test
public void map() {
//given
final VEvent event = new VEvent();
event.setDateStart(DateTime.parse("2009-12-15T22:15:00").withZone(DateTimeZone.UTC).toDate(), true);
event.setDateEnd(DateTime.parse("2010-08-13T20:15:00").withZone(DateTimeZone.UTC).toDate(), true);
event.setSummary("<summary>");
event.setDescription("<description>");
final TimeZone tz = TimeZone.getTimeZone("Europe/Berlin");
//when
final Event result = toTest.map(event, tz);
//then
assertEquals(DateTime.parse("2009-12-15T22:15:00").withZone(DateTimeZone.forID("Europe/Berlin")).toString(), result.getStart().toString());
assertEquals(DateTime.parse("2010-08-13T20:15:00").withZone(DateTimeZone.forID("Europe/Berlin")).toString(), result.getEnd().toString());
assertEquals("<summary>", result.getSummary());
assertEquals("<description>", result.getDescription());
}
示例6: map_noTime
import biweekly.component.VEvent; //导入依赖的package包/类
@Test
public void map_noTime() {
//given
final VEvent event = new VEvent();
event.setDateStart(DateTime.parse("2009-12-15T22:15:00").withZone(DateTimeZone.UTC).toDate(), false);
event.setDateEnd(DateTime.parse("2010-08-13T21:15:00").withZone(DateTimeZone.UTC).toDate(), false);
event.setSummary("<summary>");
event.setDescription("<description>");
final TimeZone tz = TimeZone.getTimeZone("Europe/Berlin");
//when
final Event result = toTest.map(event, tz);
//then
assertEquals(DateTime.parse("2009-12-15T00:00:00").withZone(DateTimeZone.forID("Europe/Berlin")).toString(), result.getStart().toString());
assertEquals(DateTime.parse("2010-08-13T00:00:00").withZone(DateTimeZone.forID("Europe/Berlin")).toString(), result.getEnd().toString());
assertEquals("<summary>", result.getSummary());
assertEquals("<description>", result.getDescription());
}
示例7: build
import biweekly.component.VEvent; //导入依赖的package包/类
@Override
public Collection<BookingBeanSer> build() throws IOException {
final Collection<BookingBeanSer> result = new ArrayList<>();
final List<ICalendar> icals = Biweekly.parse(file).all();
for (final ICalendar ical : icals) {
for (final VEvent e : ical.getEvents()) {
try {
result.add(processEvent(e));
} catch (final Exception ex) {
if (logger.isInfoEnabled()) {
logger.info("Failed to process event ", e);
}
// ex.printStackTrace();
}
}
}
return result;
}
示例8: processEvent
import biweekly.component.VEvent; //导入依赖的package包/类
private BookingBeanSer processEvent(final VEvent e) throws IOException {
final LocalDate checkIn = iCalParser.getCheckInDate(e);
final LocalDate checkOut = iCalParser.getCheckOutDate(e);
final String guestName = iCalParser.getGuestName(e);
final String id = iCalParser.getExternalID(e);
final String roomName = iCalParser.getRoomName(e);
if (checkIn == null || checkOut == null || guestName == null || roomName == null) {
throw new NullPointerException();
}
final BookingBeanSer b = new BookingBeanSer();
b.externalId = id;
b.checkInDate = checkIn;
b.checkOutDate = checkOut;
b.guestName = guestName;
b.roomName = roomName;
b.source = "Airbnb";
return b;
}
示例9: getDateIterator_start_date_has_no_time
import biweekly.component.VEvent; //导入依赖的package包/类
@Test
public void getDateIterator_start_date_has_no_time() {
VEvent event = new VEvent();
event.setDateStart(date("2016-03-25"), false);
event.setRecurrenceRule(new Recurrence.Builder(Frequency.DAILY).count(3).build());
//@formatter:off
List<Date> expectedList = Arrays.asList(
date("2016-03-25 00:00:00"),
date("2016-03-26 00:00:00"),
date("2016-03-27 00:00:00")
);
//@formatter:on
assertIteratorEquals(expectedList, Google2445Utils.getDateIterator(event, null));
}
示例10: writeText_until_datetime
import biweekly.component.VEvent; //导入依赖的package包/类
@Test
public void writeText_until_datetime() {
String utc = "FREQ=WEEKLY;UNTIL=20130611T124302Z";
String floating = "FREQ=WEEKLY;UNTIL=20130611T144302";
//no DTSTART sibling
sensei.assertWriteText(withUntilDateTime).run(utc);
sensei.assertWriteText(withUntilDateTime).tz(americaNewYork()).run(utc);
sensei.assertWriteText(withUntilDateTime).tz(floating()).run(utc);
VEvent event = new VEvent();
event.addProperty(withUntilDateTime);
event.setDateStart(datetime);
sensei.assertWriteText(withUntilDateTime).parent(event).run(utc);
sensei.assertWriteText(withUntilDateTime).parent(event).tz(americaNewYork()).run(utc);
sensei.assertWriteText(withUntilDateTime).parent(event).tz(floating()).run(floating);
sensei.assertWriteText(withUntilDateTime).version(ICalVersion.V2_0_DEPRECATED).parent(event).tz(floating()).run(utc);
StandardTime standard = new StandardTime();
standard.addProperty(withUntilDateTime);
sensei.assertWriteText(withUntilDateTime).parent(standard).run(utc);
sensei.assertWriteText(withUntilDateTime).parent(standard).tz(americaNewYork()).run(utc);
sensei.assertWriteText(withUntilDateTime).parent(standard).tz(floating()).run(utc);
}
示例11: writeText_until_date
import biweekly.component.VEvent; //导入依赖的package包/类
@Test
public void writeText_until_date() {
String expected = "FREQ=WEEKLY;UNTIL=" + dateStr;
//no DTSTART sibling
sensei.assertWriteText(withUntilDate).run(expected);
sensei.assertWriteText(withUntilDate).tz(americaNewYork()).run(expected);
sensei.assertWriteText(withUntilDate).tz(floating()).run(expected);
VEvent event = new VEvent();
event.addProperty(withUntilDate);
event.setDateStart(datetime);
sensei.assertWriteText(withUntilDate).parent(event).run(expected);
sensei.assertWriteText(withUntilDate).parent(event).tz(americaNewYork()).run(expected);
sensei.assertWriteText(withUntilDate).parent(event).tz(floating()).run(expected);
sensei.assertWriteText(withUntilDate).version(ICalVersion.V2_0_DEPRECATED).parent(event).tz(floating()).run(expected);
StandardTime standard = new StandardTime();
standard.addProperty(withUntilDate);
standard.setDateStart(datetime);
sensei.assertWriteText(withUntilDate).parent(standard).run(expected);
sensei.assertWriteText(withUntilDate).parent(standard).tz(americaNewYork()).run(expected);
sensei.assertWriteText(withUntilDate).parent(standard).tz(floating()).run(expected);
}
示例12: jcal_draft_example1
import biweekly.component.VEvent; //导入依赖的package包/类
@Test
public void jcal_draft_example1() throws Throwable {
//Note: all whitespace is removed from the expected JSON string it easier to compare it with the actual result
ICalendar ical = new ICalendar();
ical.getProperties().clear();
ical.setCalendarScale(CalendarScale.gregorian());
ical.setProductId("-//ExampleInc.//ExampleCalendar//EN");
{
VEvent event = new VEvent();
event.getProperties().clear();
event.setDateTimeStamp(utc("2008-02-05 19:12:24"));
event.setDateStart(new DateStart(date("2008-10-06"), false));
event.setSummary("Planningmeeting");
event.setUid("4088E990AD89CB3DBB484909");
ical.addEvent(event);
}
assertValidate(ical).versions(V2_0).run();
assertExample(ical, "rfc7265-example1.json");
}
示例13: jcal_draft_example1
import biweekly.component.VEvent; //导入依赖的package包/类
@Test
public void jcal_draft_example1() throws Throwable {
JCalReader reader = read("rfc7265-example1.json");
ICalendar ical = reader.readNext();
assertSize(ical, 1, 2);
assertEquals("-//Example Inc.//Example Calendar//EN", ical.getProductId().getValue());
assertVersion(V2_0, ical);
assertTrue(ical.getCalendarScale().isGregorian());
{
VEvent event = ical.getEvents().get(0);
assertSize(event, 0, 4);
assertEquals(utc("2008-02-05 19:12:24"), event.getDateTimeStamp().getValue());
assertEquals(date("2008-10-06"), event.getDateStart().getValue());
assertFalse(event.getDateStart().getValue().hasTime());
assertEquals("Planning meeting", event.getSummary().getValue());
assertEquals("4088E990AD89CB3DBB484909", event.getUid().getValue());
}
assertValidate(ical).versions(V2_0).run();
assertNull(reader.readNext());
}
示例14: example1
import biweekly.component.VEvent; //导入依赖的package包/类
@Test
public void example1() throws Throwable {
ICalendar ical = new ICalendar();
ical.getProperties().clear();
ical.setProductId("-//xyz Corp//NONSGML PDA Calendar Version 1.0//EN");
{
VEvent event = new VEvent();
event.getProperties().clear();
event.setDateTimeStamp(utc("1996-07-04 12:00:00"));
event.setUid("[email protected]");
event.setOrganizer("[email protected]");
event.setDateStart(utc("1996-09-18 14:30:00"));
event.setDateEnd(utc("1996-09-20 22:00:00"));
event.setStatus(Status.confirmed());
event.addCategories("CONFERENCE");
event.setSummary("Networld+Interop Conference");
event.setDescription("Networld+Interop Conferenceand Exhibit\nAtlanta World Congress Center\nAtlanta, Georgia");
ical.addEvent(event);
}
assertValidate(ical).versions(V2_0_DEPRECATED, V2_0).run();
assertExample(ical, "rfc5545-example1.ics", V2_0);
}
示例15: vcal_example1
import biweekly.component.VEvent; //导入依赖的package包/类
@Test
public void vcal_example1() throws Throwable {
ICalendar ical = new ICalendar();
ical.getProperties().clear();
{
VEvent event = new VEvent();
event.getProperties().clear();
event.addCategories("MEETING");
event.setStatus(Status.tentative());
event.setDateStart(utc("1996-04-01 03:30:00"));
event.setDateEnd(utc("1996-04-01 04:30:00"));
event.setSummary("Your Proposal Review");
event.setDescription("Steve and John to review newest proposal material");
event.setClassification(Classification.private_());
ical.addEvent(event);
}
assertValidate(ical).versions(V1_0).run();
assertExample(ical, "vcal-example1.vcs", V1_0);
}