本文整理汇总了Java中biweekly.component.VEvent.setDescription方法的典型用法代码示例。如果您正苦于以下问题:Java VEvent.setDescription方法的具体用法?Java VEvent.setDescription怎么用?Java VEvent.setDescription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类biweekly.component.VEvent
的用法示例。
在下文中一共展示了VEvent.setDescription方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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());
}
示例3: 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());
}
示例4: 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);
}
示例5: 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);
}
示例6: 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();
}
}
示例7: 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);
}
示例8: write_single
import biweekly.component.VEvent; //导入方法依赖的package包/类
@Test
public void write_single() throws Exception {
ical.setProductId("value").setParameter("x-foo", "bar");
VEvent event = new VEvent();
event.getProperties().clear();
event.setDescription("value");
ical.addEvent(event);
writer.write(ical);
writer.close();
//@formatter:off
String expected =
"<icalendar xmlns=\"" + XCAL_NS + "\">" + NEWLINE +
"<vcalendar>" +
"<properties>" +
"<version><text>2.0</text></version>" +
"<prodid>" +
"<parameters>" +
"<x-foo><unknown>bar</unknown></x-foo>" +
"</parameters>" +
"<text>value</text>" +
"</prodid>" +
"</properties>" +
"<components>" +
"<vevent>" +
"<properties>" +
"<description>" +
"<text>value</text>" +
"</description>" +
"</properties>" +
"</vevent>" +
"</components>" +
"</vcalendar>" +
"</icalendar>";
//@formatter:on
assertOutput(expected);
}
示例9: 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);
}
示例10: write_multiple
import biweekly.component.VEvent; //导入方法依赖的package包/类
@Test
public void write_multiple() throws Exception {
ical.setProductId("value").setParameter("x-foo", "bar");
VEvent event = new VEvent();
event.getProperties().clear();
event.setDescription("value");
ical.addEvent(event);
writer.write(ical);
ical = new ICalendar();
ical.getProperties().clear();
ical.setProductId("value");
writer.write(ical);
writer.close();
//@formatter:off
String expected =
"<icalendar xmlns=\"" + XCAL_NS + "\">" + NEWLINE +
"<vcalendar>" +
"<properties>" +
"<version><text>2.0</text></version>" +
"<prodid>" +
"<parameters>" +
"<x-foo><unknown>bar</unknown></x-foo>" +
"</parameters>" +
"<text>value</text>" +
"</prodid>" +
"</properties>" +
"<components>" +
"<vevent>" +
"<properties>" +
"<description>" +
"<text>value</text>" +
"</description>" +
"</properties>" +
"</vevent>" +
"</components>" +
"</vcalendar>" +
"<vcalendar>" +
"<properties>" +
"<version><text>2.0</text></version>" +
"<prodid>" +
"<text>value</text>" +
"</prodid>" +
"</properties>" +
"</vcalendar>" +
"</icalendar>";
//@formatter:on
assertOutput(expected);
}
示例11: write_pretty_print
import biweekly.component.VEvent; //导入方法依赖的package包/类
@Test
public void write_pretty_print() throws Exception {
writer = new XCalWriter(sw, 2);
ProductId prodId = ical.setProductId("value");
prodId.setParameter("x-foo", "bar");
VEvent event = new VEvent();
event.getProperties().clear();
event.setDescription("description");
ical.addEvent(event);
writer.write(ical);
writer.close();
String actual = sw.toString();
String nl = "(\r\n|\n|\r)";
//@formatter:off
String expectedRegex =
"<\\?xml version=\"1.0\" encoding=\"(utf|UTF)-8\"\\?><icalendar xmlns=\"" + XCAL_NS + "\">" + nl +
" <vcalendar>" + nl +
" <properties>" + nl +
" <version>" + nl +
" <text>2\\.0</text>" + nl +
" </version>" + nl +
" <prodid>" + nl +
" <parameters>" + nl +
" <x-foo>" + nl +
" <unknown>bar</unknown>" + nl +
" </x-foo>" + nl +
" </parameters>" + nl +
" <text>value</text>" + nl +
" </prodid>" + nl +
" </properties>" + nl +
" <components>" + nl +
" <vevent>" + nl +
" <properties>" + nl +
" <description>" + nl +
" <text>description</text>" + nl +
" </description>" + nl +
" </properties>" + nl +
" </vevent>" + nl +
" </components>" + nl +
" </vcalendar>" + nl +
"</icalendar>" + nl;
//@formatter:on
assertTrue(actual.matches(expectedRegex));
}
示例12: 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;
}