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


Java VEvent.setDateStart方法代码示例

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


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

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

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

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

示例9: 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

示例10: 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

示例11: write_example1

import biweekly.component.VEvent; //导入方法依赖的package包/类
@Test
public void write_example1() throws Throwable {
	ICalendar ical = new ICalendar();
	ical.getProperties().clear();
	ical.setCalendarScale(CalendarScale.gregorian());
	ical.setProductId("-//Example Inc.//Example Calendar//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("Planning meeting");
		event.setUid("4088E990AD89CB3DBB484909");
		ical.addEvent(event);
	}

	assertValidate(ical).versions(V2_0).run();
	assertExample(ical, "rfc6321-example1.xml");
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:20,代码来源:XCalDocumentTest.java

示例12: write_example1

import biweekly.component.VEvent; //导入方法依赖的package包/类
@Test
public void write_example1() throws Throwable {
	ical.setCalendarScale(CalendarScale.gregorian());
	ical.setProductId("-//Example Inc.//Example Calendar//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("Planning meeting");
		event.setUid("4088E990AD89CB3DBB484909");
		ical.addEvent(event);
	}

	assertValidate(ical).versions(V2_0).run();
	assertExample(ical, "rfc6321-example1.xml");
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:18,代码来源:XCalWriterTest.java

示例13: 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

示例14: getDateIterator_start_date_only

import biweekly.component.VEvent; //导入方法依赖的package包/类
@Test
public void getDateIterator_start_date_only() {
	VEvent event = new VEvent();
	event.setDateStart(date("2016-03-25 14:00:00"));

	//@formatter:off
	List<Date> expectedList = Arrays.asList(
		date("2016-03-25 14:00:00")
	);
	//@formatter:on

	assertIteratorEquals(expectedList, Google2445Utils.getDateIterator(event, TimeZone.getTimeZone("UTC")));
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:14,代码来源:Google2445UtilsTest.java

示例15: getDateIterator

import biweekly.component.VEvent; //导入方法依赖的package包/类
@Test
public void getDateIterator() {
	TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");

	VEvent event = new VEvent();

	event.setDateStart(date("2016-03-25 14:00:00", tz));

	event.setRecurrenceRule(new Recurrence.Builder(Frequency.DAILY).count(10).build());

	RecurrenceDates rdate = new RecurrenceDates();
	rdate.getDates().add(new ICalDate(date("2016-03-26 20:00:00", tz)));
	rdate.getDates().add(new ICalDate(date("2016-03-27 20:00:00", tz)));
	event.addRecurrenceDates(rdate);

	ExceptionDates exdate = new ExceptionDates();
	exdate.getValues().add(new ICalDate(date("2016-03-27 14:00:00", tz)));
	event.addExceptionDates(exdate);

	ExceptionRule exrule = new ExceptionRule(new Recurrence.Builder(Frequency.WEEKLY).count(2).build());
	event.addProperty(exrule);

	//@formatter:off
	List<Date> expectedList = Arrays.asList(
		date("2016-03-26 14:00:00", tz),
		date("2016-03-26 20:00:00", tz),
		date("2016-03-27 20:00:00", tz),
		date("2016-03-28 14:00:00", tz),
		date("2016-03-29 14:00:00", tz),
		date("2016-03-30 14:00:00", tz),
		date("2016-03-31 14:00:00", tz),
		date("2016-04-02 14:00:00", tz),
		date("2016-04-03 14:00:00", tz)
	);
	//@formatter:on

	assertIteratorEquals(expectedList, Google2445Utils.getDateIterator(event, TimeZone.getTimeZone("UTC")));
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:39,代码来源:Google2445UtilsTest.java


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