本文整理汇总了Java中biweekly.component.VEvent.setLocation方法的典型用法代码示例。如果您正苦于以下问题:Java VEvent.setLocation方法的具体用法?Java VEvent.setLocation怎么用?Java VEvent.setLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类biweekly.component.VEvent
的用法示例。
在下文中一共展示了VEvent.setLocation方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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;
}
示例3: getIcalForEvent
import biweekly.component.VEvent; //导入方法依赖的package包/类
public static Optional<byte[]> getIcalForEvent(Event event, TicketCategory ticketCategory, String description) {
ICalendar ical = new ICalendar();
VEvent vEvent = new VEvent();
vEvent.setSummary(event.getDisplayName());
vEvent.setDescription(description);
vEvent.setLocation(StringUtils.replacePattern(event.getLocation(), "[\n\r\t]+", " "));
ZonedDateTime begin = Optional.ofNullable(ticketCategory).map(tc -> tc.getTicketValidityStart(event.getZoneId())).orElse(event.getBegin());
ZonedDateTime end = Optional.ofNullable(ticketCategory).map(tc -> tc.getTicketValidityEnd(event.getZoneId())).orElse(event.getEnd());
vEvent.setDateStart(Date.from(begin.toInstant()));
vEvent.setDateEnd(Date.from(end.toInstant()));
vEvent.setUrl(event.getWebsiteUrl());
ical.addEvent(vEvent);
StringWriter strWriter = new StringWriter();
try (ICalWriter writer = new ICalWriter(strWriter, ICalVersion.V2_0)) {
writer.write(ical);
return Optional.of(strWriter.toString().getBytes(StandardCharsets.UTF_8));
} catch (IOException e) {
log.warn("was not able to generate iCal for event " + event.getShortName(), e);
return Optional.empty();
}
}
示例4: example3
import biweekly.component.VEvent; //导入方法依赖的package包/类
@Test
public void example3() throws Throwable {
ICalendar ical = new ICalendar();
ical.getProperties().clear();
ical.setMethod("xyz");
ical.setProductId("-//ABC Corporation//NONSGML My Product//EN");
{
VEvent event = new VEvent();
event.getProperties().clear();
event.setDateTimeStamp(utc("1997-03-24 12:00:00"));
event.setSequence(0);
event.setUid("[email protected]");
event.setOrganizer("[email protected]");
Attendee attendee = new Attendee(null, "[email protected]");
attendee.setRsvp(true);
event.addAttendee(attendee);
event.setDateStart(utc("1997-03-24 12:30:00"));
event.setDateEnd(utc("1997-03-24 21:00:00"));
event.addCategories("MEETING", "PROJECT");
event.setClassification(Classification.public_());
event.setSummary("Calendaring Interoperability Planning Meeting");
event.setDescription("Discuss how we can test c&s interoperability\nusing iCalendar and other IETF standards.");
event.setLocation("LDB Lobby");
Attachment attach = new Attachment("application/postscript", "ftp://example.com/pub/conf/bkgrnd.ps");
event.addAttachment(attach);
ical.addEvent(event);
}
assertValidate(ical).versions(V2_0_DEPRECATED, V2_0).run();
assertExample(ical, "rfc5545-example3.ics", V2_0);
}
示例5: example2
import biweekly.component.VEvent; //导入方法依赖的package包/类
@Test
public void example2() throws Throwable {
TimeZone eastern = TimeZone.getTimeZone("America/New_York");
ICalendar ical = new ICalendar();
ical.getProperties().clear();
ical.setProductId("-//RDU Software//NONSGML HandCal//EN");
{
VEvent event = new VEvent();
event.setDateTimeStamp(utc("1998-03-09 23:10:00"));
event.setUid("guid-1.example.com");
event.setOrganizer("[email protected]");
Attendee attendee = new Attendee(null, "[email protected]");
attendee.setRsvp(true);
attendee.setParticipationLevel(ParticipationLevel.REQUIRED);
attendee.setCalendarUserType(CalendarUserType.GROUP);
event.addAttendee(attendee);
event.setDescription("Project XYZ Review Meeting");
event.addCategories("MEETING");
event.setClassification(Classification.public_());
event.setCreated(utc("1998-03-09 13:00:00"));
event.setSummary("XYZ Project Review");
event.setDateStart(date("1998-03-12 08:30:00", eastern));
event.setDateEnd(date("1998-03-12 09:30:00", eastern));
event.setLocation("1CP Conference Room 4350");
ical.addEvent(event);
}
assertValidate(ical).versions(V2_0_DEPRECATED, V2_0).run();
TimezoneInfo tzinfo = ical.getTimezoneInfo();
VTimezone usEasternTz;
{
usEasternTz = new VTimezone("America/New_York");
{
StandardTime standard = new StandardTime();
standard.setDateStart(new DateTimeComponents(1998, 10, 25, 2, 0, 0, false));
standard.setTimezoneOffsetFrom(new UtcOffset(false, 4, 0));
standard.setTimezoneOffsetTo(new UtcOffset(false, 5, 0));
standard.addTimezoneName("EST");
usEasternTz.addStandardTime(standard);
}
{
DaylightSavingsTime daylight = new DaylightSavingsTime();
daylight.setDateStart(new DateTimeComponents(1999, 4, 4, 2, 0, 0, false));
daylight.setTimezoneOffsetFrom(new UtcOffset(false, 5, 0));
daylight.setTimezoneOffsetTo(new UtcOffset(false, 4, 0));
daylight.addTimezoneName("EDT");
usEasternTz.addDaylightSavingsTime(daylight);
}
}
tzinfo.setDefaultTimezone(new TimezoneAssignment(eastern, usEasternTz));
assertExample(ical, "rfc5545-example2.ics", V2_0);
}
示例6: toVEventObject
import biweekly.component.VEvent; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public VEvent toVEventObject() {
VEvent event = new VEvent();
if (uid != null)
event.setUid(uid);
event.setDateStart(dtStart);
if (dtEnd != null)
event.setDateEnd(dtEnd);
if (duration != null)
event.setDuration(duration);
if (rrule != null)
event.setRecurrenceRule(rrule);
if (rdate != null && !rdate.isEmpty()) {
for (RecurrenceDates rd : rdate) {
event.addRecurrenceDates(rd);
}
}
if (exrule != null && !exrule.isEmpty()) {
for (ExceptionRule exr : exrule) {
event.addExceptionRule(exr);
}
}
if (exdate != null && !exdate.isEmpty()) {
for (ExceptionDates exd: exdate) {
event.addExceptionDates(exd);
}
}
if (summary != null && !summary.isEmpty())
event.setSummary(summary);
if (location != null && !location.isEmpty())
event.setLocation(location);
if (description != null && !description.isEmpty())
event.setDescription(description);
if (status != null)
event.setStatus(status);
if (!opaque)
event.setTransparency(true);
if (organizer != null)
event.setOrganizer(organizer);
for (Attendee attendee: attendees) {
event.addAttendee(attendee);
}
if (forPublic != null)
event.setClassification(forPublic ? "public" : "private");
for (VAlarm alarm: alarms) {
event.addAlarm(alarm);
}
event.setLastModified(new Date());
return event;
}