当前位置: 首页>>代码示例>>Java>>正文


Java VEvent.setDateEnd方法代码示例

本文整理汇总了Java中biweekly.component.VEvent.setDateEnd方法的典型用法代码示例。如果您正苦于以下问题:Java VEvent.setDateEnd方法的具体用法?Java VEvent.setDateEnd怎么用?Java VEvent.setDateEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在biweekly.component.VEvent的用法示例。


在下文中一共展示了VEvent.setDateEnd方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:26,代码来源:CalendarServlet.java

示例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;
}
 
开发者ID:CSCfi,项目名称:exam,代码行数:17,代码来源:EmailComposerImpl.java

示例3: 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());
}
 
开发者ID:rainu,项目名称:alexa-skill,代码行数:21,代码来源:EventMapperTest.java

示例4: 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());
}
 
开发者ID:rainu,项目名称:alexa-skill,代码行数:21,代码来源:EventMapperTest.java

示例5: 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);
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:24,代码来源:ICalWriterTest.java

示例6: 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);
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:22,代码来源:ICalWriterTest.java

示例7: 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();
    }
}
 
开发者ID:alfio-event,项目名称:alf.io,代码行数:22,代码来源:EventUtil.java

示例8: 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);
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:36,代码来源:ICalWriterTest.java

示例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);
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:57,代码来源:ICalWriterTest.java

示例10: 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;
}
 
开发者ID:eXfio,项目名称:CucumberSync,代码行数:63,代码来源:Event.java

示例11: run

import biweekly.component.VEvent; //导入方法依赖的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


注:本文中的biweekly.component.VEvent.setDateEnd方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。