本文整理汇总了Java中net.fortuna.ical4j.model.property.Version类的典型用法代码示例。如果您正苦于以下问题:Java Version类的具体用法?Java Version怎么用?Java Version使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Version类属于net.fortuna.ical4j.model.property包,在下文中一共展示了Version类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: icalResponse
import net.fortuna.ical4j.model.property.Version; //导入依赖的package包/类
private GetEventsResponse icalResponse(Page<EventEntity> eventPage) {
Calendar calendar = new Calendar();
calendar.getProperties().add(new ProdId("-//PutPut//iCal4j 1.0//EN"));
calendar.getProperties().add(Version.VERSION_2_0);
calendar.getProperties().add(CalScale.GREGORIAN);
eventPage
.getContent()
.stream()
.forEach(event -> {
TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
net.fortuna.ical4j.model.TimeZone timezone = registry.getTimeZone(event.getTimezone());
VEvent vEvent = createVEvent(event, timezone);
vEvent.getProperties().add(new Uid(event.getId()));
vEvent.getProperties().add(new Description(event.getDescription()));
vEvent.getProperties().add(new Location(event.getLocation()));
vEvent.getProperties().add(timezone.getVTimeZone().getTimeZoneId());
calendar.getComponents().add(vEvent);
});
return GetEventsResponse.withCalendarOK(calendar.toString());
}
示例2: createCalendar
import net.fortuna.ical4j.model.property.Version; //导入依赖的package包/类
public static Calendar createCalendar(CalDavEvent calDavEvent, DateTimeZone timeZone) {
TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
TimeZone timezone = registry.getTimeZone(timeZone.getID());
Calendar calendar = new Calendar();
calendar.getProperties().add(Version.VERSION_2_0);
calendar.getProperties().add(new ProdId("openHAB"));
VEvent vEvent = new VEvent();
vEvent.getProperties().add(new Summary(calDavEvent.getName()));
vEvent.getProperties().add(new Description(calDavEvent.getContent()));
final DtStart dtStart = new DtStart(new net.fortuna.ical4j.model.DateTime(calDavEvent.getStart().toDate()));
dtStart.setTimeZone(timezone);
vEvent.getProperties().add(dtStart);
final DtEnd dtEnd = new DtEnd(new net.fortuna.ical4j.model.DateTime(calDavEvent.getEnd().toDate()));
dtEnd.setTimeZone(timezone);
vEvent.getProperties().add(dtEnd);
vEvent.getProperties().add(new Uid(calDavEvent.getId()));
vEvent.getProperties().add(Clazz.PUBLIC);
vEvent.getProperties()
.add(new LastModified(new net.fortuna.ical4j.model.DateTime(calDavEvent.getLastChanged().toDate())));
calendar.getComponents().add(vEvent);
return calendar;
}
示例3: parseAppointmenttoCalendar
import net.fortuna.ical4j.model.property.Version; //导入依赖的package包/类
/**
* Methods to parse Appointment to iCalendar according RFC 2445
*
* @param appointment to be converted to iCalendar
* @return iCalendar representation of the Appointment
*/
public Calendar parseAppointmenttoCalendar(Appointment appointment) {
String tzid = parseTimeZone(null, appointment.getOwner()).getID();
TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
net.fortuna.ical4j.model.TimeZone timeZone = registry.getTimeZone(tzid);
if (timeZone == null) {
throw new NoSuchElementException("Unable to get time zone by id provided: " + tzid);
}
Calendar icsCalendar = new Calendar();
icsCalendar.getProperties().add(new ProdId("-//Events Calendar//Apache Openmeetings//EN"));
icsCalendar.getProperties().add(Version.VERSION_2_0);
icsCalendar.getProperties().add(CalScale.GREGORIAN);
icsCalendar.getComponents().add(timeZone.getVTimeZone());
DateTime start = new DateTime(appointment.getStart()), end = new DateTime(appointment.getEnd());
VEvent meeting = new VEvent(start, end, appointment.getTitle());
meeting = addVEventpropsfromAppointment(appointment, meeting);
icsCalendar.getComponents().add(meeting);
return icsCalendar;
}
示例4: parseAppointmentstoCalendar
import net.fortuna.ical4j.model.property.Version; //导入依赖的package包/类
/**
* Parses a List of Appointments into a VCALENDAR component.
*
* @param appointments List of Appointments for the Calendar
* @param ownerId Owner of the Appointments
* @return VCALENDAR representation of the Appointments
*/
public Calendar parseAppointmentstoCalendar(List<Appointment> appointments, Long ownerId) {
String tzid = parseTimeZone(null, userDao.get(ownerId)).getID();
TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
net.fortuna.ical4j.model.TimeZone timeZone = registry.getTimeZone(tzid);
if (timeZone == null) {
throw new NoSuchElementException("Unable to get time zone by id provided: " + tzid);
}
Calendar icsCalendar = new Calendar();
icsCalendar.getProperties().add(new ProdId(PROD_ID));
icsCalendar.getProperties().add(Version.VERSION_2_0);
icsCalendar.getProperties().add(CalScale.GREGORIAN);
icsCalendar.getComponents().add(timeZone.getVTimeZone());
for (Appointment appointment : appointments) {
DateTime start = new DateTime(appointment.getStart()), end = new DateTime(appointment.getEnd());
VEvent meeting = new VEvent(start, end, appointment.getTitle());
meeting = addVEventpropsfromAppointment(appointment, meeting);
icsCalendar.getComponents().add(meeting);
}
return icsCalendar;
}
示例5: testGeneratingCalendar
import net.fortuna.ical4j.model.property.Version; //导入依赖的package包/类
/**
* Ensure we can get a ical4j Calendar from the generated event.
*/
@Test
public void testGeneratingCalendar() {
//generate new event
CalendarEvent event = generateEvent();
//create vevent
net.fortuna.ical4j.model.component.VEvent vevent = service.createEvent(event);
//create calendar from vevent
net.fortuna.ical4j.model.Calendar calendar = service.createCalendar(Collections.singletonList(vevent));
log.debug("testGeneratingCalendar");
log.debug("######################");
log.debug("{}", calendar);
Assert.assertNotNull(calendar);
//check attributes of the ical4j calendar are what we expect and match those in the event
Assert.assertEquals(Version.VERSION_2_0, calendar.getVersion());
Assert.assertEquals(CalScale.GREGORIAN, calendar.getCalendarScale());
}
示例6: generateCalendar
import net.fortuna.ical4j.model.property.Version; //导入依赖的package包/类
/**
* Generates a Calendar Object
* @param user
* @param project
* @return Calendar of the user
* null if the calendar has not got events
* @throws TooManyItemsToLoadException
*/
private Calendar generateCalendar(TPersonBean user, String project) throws IOException, TooManyItemsToLoadException {
Calendar calendar = new Calendar();
calendar.getProperties().add(new ProdId("Calendar of Projects: "+ project));
calendar.getProperties().add(Version.VERSION_2_0);
calendar.getProperties().add(CalScale.GREGORIAN);
calendar.getProperties().add(Method.PUBLISH);
List<TWorkItemBean> workItemList = obtainIssues(user, project);
if (workItemList!=null&&workItemList.size()!=0){
addEventsFromWorkItemList(workItemList, calendar, user.getLocale());
return calendar;
}
else {
return calendar;
}
}
示例7: createCalendar
import net.fortuna.ical4j.model.property.Version; //导入依赖的package包/类
public static Calendar createCalendar(List<EventBean> events) {
final String prodIdCompany = Unit.getInstitutionName().getContent();
Calendar calendar = new Calendar();
calendar.getProperties().add(new ProdId("-//" + prodIdCompany + "//" + PROD_ID_APPLICATION + "//PT"));
calendar.getProperties().add(Version.VERSION_2_0);
calendar.getProperties().add(CalScale.GREGORIAN);
VTimeZone tz = TIMEZONE.getVTimeZone();
calendar.getComponents().add(tz);
for (EventBean eventBean : events) {
calendar.getComponents().add(convertEventBean(eventBean));
}
return calendar;
}
示例8: IcalHandler
import net.fortuna.ical4j.model.property.Version; //导入依赖的package包/类
/**
* Constructor
*
* @param method
* (@see IcalHandler) constants
*/
public IcalHandler(Method method) {
log.debug("Icalhandler method type : " + method);
icsCalendar = new Calendar();
icsCalendar.getProperties().add(new ProdId("-//Events Calendar//iCal4j 1.0//EN"));
icsCalendar.getProperties().add(Version.VERSION_2_0);
icsCalendar.getProperties().add(CalScale.GREGORIAN);
icsCalendar.getProperties().add(method);
}
示例9: setupCalendar
import net.fortuna.ical4j.model.property.Version; //导入依赖的package包/类
/**
* Helper method to setup the standard parts of the calendar
* @return
*/
private Calendar setupCalendar(String method) {
String serverName = sakaiProxy.getServerName();
//setup calendar
Calendar calendar = new Calendar();
calendar.getProperties().add(new ProdId("-//"+serverName+"//Sakai External Calendaring Service//EN"));
calendar.getProperties().add(Version.VERSION_2_0);
calendar.getProperties().add(CalScale.GREGORIAN);
if (method != null) {
calendar.getProperties().add(new Method(method));
}
return calendar;
}
示例10: testGeneratingCalendarWithMultipleVEvents
import net.fortuna.ical4j.model.property.Version; //导入依赖的package包/类
/**
* Ensure we can get a ical4j Calendar from the list of vevents.
*/
@Test
public void testGeneratingCalendarWithMultipleVEvents() {
//create list of vevents
List<net.fortuna.ical4j.model.component.VEvent> vevents = new ArrayList<net.fortuna.ical4j.model.component.VEvent>();
for(int i=0;i<10;i++) {
vevents.add(service.createEvent(generateEvent()));
}
//create calendar from vevent
net.fortuna.ical4j.model.Calendar calendar = service.createCalendar(vevents);
log.debug("testGeneratingCalendarWithMultipleVEvents");
log.debug("#########################################");
log.debug("{}", calendar);
Assert.assertNotNull(calendar);
//check attributes of the ical4j calendar are what we expect and match those in the event
Assert.assertEquals(Version.VERSION_2_0, calendar.getVersion());
Assert.assertEquals(CalScale.GREGORIAN, calendar.getCalendarScale());
//TODO check count of vevents
}
示例11: getFreeBusyCalendar
import net.fortuna.ical4j.model.property.Version; //导入依赖的package包/类
/**
* Obfuscates the specified calendar by removing unnecessary properties and replacing text fields with specified
* text.
*
* @param original
* calendar to be obfuscated
* @param productId
* productId to be set for the copy calendar.
* @param freeBusyText
* @return obfuscated calendar.
*/
public static Calendar getFreeBusyCalendar(Calendar original, String productId, String freeBusyText) {
// Make a copy of the original calendar
Calendar copy = new Calendar();
copy.getProperties().add(new ProdId(productId));
copy.getProperties().add(Version.VERSION_2_0);
copy.getProperties().add(CalScale.GREGORIAN);
copy.getProperties().add(new XProperty(FREE_BUSY_X_PROPERTY, Boolean.TRUE.toString()));
ComponentList<CalendarComponent> events = original.getComponents(Component.VEVENT);
for (Component event : events) {
copy.getComponents().add(getFreeBusyEvent((VEvent) event, freeBusyText));
}
return copy;
}
示例12: getCalendarFromCollection
import net.fortuna.ical4j.model.property.Version; //导入依赖的package包/类
/**
* @param collectionItem
* @return
*/
private Calendar getCalendarFromCollection(DavRequest req, CollectionItem collectionItem) {
Calendar result = new Calendar();
if (productId == null) {
synchronized (this) {
if (productId == null) {
Environment environment = WebApplicationContextUtils
.findWebApplicationContext(req.getServletContext()).getEnvironment();
productId = environment.getProperty(PRODUCT_ID_KEY);
}
}
}
result.getProperties().add(new ProdId(productId));
result.getProperties().add(Version.VERSION_2_0);
result.getProperties().add(CalScale.GREGORIAN);
for (Item item : collectionItem.getChildren()) {
if (!NoteItem.class.isInstance(item)) {
continue;
}
for (Stamp s : item.getStamps()) {
if (BaseEventStamp.class.isInstance(s)) {
BaseEventStamp baseEventStamp = BaseEventStamp.class.cast(s);
result.getComponents().add(baseEventStamp.getEvent());
}
}
}
return result;
}
示例13: makeDummyCalendar
import net.fortuna.ical4j.model.property.Version; //导入依赖的package包/类
/**
* Makes dummy calendar.
* @return The dummy calendar.
*/
public Calendar makeDummyCalendar() {
Calendar cal =new Calendar();
cal.getProperties().add(new ProdId(CosmoConstants.PRODUCT_ID));
cal.getProperties().add(Version.VERSION_2_0);
return cal;
}
示例14: createSimpleContentItem
import net.fortuna.ical4j.model.property.Version; //导入依赖的package包/类
/**
* Creates a simple item which will be checked with simpleCheckCallExpectedHandler.
*
* @param user
* @return
* @throws URISyntaxException
*/
private ContentItem createSimpleContentItem(User user) throws URISyntaxException {
//call service
ContentItem contentItem = testHelper.makeDummyContent(user);
HibEventStamp eventStamp = new HibEventStamp();
VEvent vEvent = new VEvent();
vEvent.getProperties().add(Method.REQUEST);
vEvent.getProperties().add(Version.VERSION_2_0);
Attendee dev1 = new Attendee(URI.create("MAILTO:" + ATTENDEE_1));
dev1.getParameters().add(Role.REQ_PARTICIPANT);
dev1.getParameters().add(PartStat.NEEDS_ACTION);
dev1.getParameters().add(Rsvp.TRUE);
vEvent.getProperties().add(dev1);
Organizer organizer = new Organizer("MAILTO:" + ORGANIZER);
vEvent.getProperties().add(organizer);
vEvent.getProperties().add(Status.VEVENT_CONFIRMED);
vEvent.getProperties().add(Transp.OPAQUE);
Calendar calendar = new Calendar();
calendar.getComponents().add(vEvent);
eventStamp.setEventCalendar(calendar);
contentItem.addStamp(eventStamp);
return contentItem;
}
示例15: buildCalendar
import net.fortuna.ical4j.model.property.Version; //导入依赖的package包/类
private Calendar buildCalendar(final OlatCalendar olatCalendar) {
final Calendar calendar = new Calendar();
// add standard propeties
calendar.getProperties().add(new ProdId("-//Ben Fortuna//iCal4j 1.0//EN"));
calendar.getProperties().add(Version.VERSION_2_0);
calendar.getProperties().add(CalScale.GREGORIAN);
for (final Iterator<CalendarEntry> iter = olatCalendar.getAllCalendarEntries().iterator(); iter.hasNext();) {
final CalendarEntry kEvent = iter.next();
final VEvent vEvent = getVEvent(kEvent);
calendar.getComponents().add(vEvent);
}
return calendar;
}