本文整理汇总了Java中net.fortuna.ical4j.model.property.Version类的典型用法代码示例。如果您正苦于以下问题:Java Version类的具体用法?Java Version怎么用?Java Version使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Version类属于net.fortuna.ical4j.model.property包,在下文中一共展示了Version类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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());
}
开发者ID:adrobisch,项目名称:putput,代码行数:26,代码来源:EventsResource.java
示例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;
}
开发者ID:openhab,项目名称:openhab1-addons,代码行数:25,代码来源:Util.java
示例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;
}
开发者ID:apache,项目名称:openmeetings,代码行数:31,代码来源:IcalUtils.java
示例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;
}
开发者ID:apache,项目名称:openmeetings,代码行数:33,代码来源:IcalUtils.java
示例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());
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:27,代码来源:ExternalCalendaringServiceTest.java
示例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;
}
}
开发者ID:trackplus,项目名称:Genji,代码行数:27,代码来源:ICalendarSynchronizeAction.java
示例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;
}
开发者ID:FenixEdu,项目名称:fenixedu-academic,代码行数:18,代码来源:CalendarFactory.java
示例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);
}
开发者ID:apache,项目名称:openmeetings,代码行数:16,代码来源:IcalHandler.java
示例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;
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:19,代码来源:ExternalCalendaringServiceImpl.java
示例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
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:30,代码来源:ExternalCalendaringServiceTest.java
示例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;
}
开发者ID:1and1,项目名称:cosmo,代码行数:26,代码来源:FreeBusyUtil.java
示例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;
}
开发者ID:1and1,项目名称:cosmo,代码行数:35,代码来源:CalendarCollectionProvider.java
示例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;
}
开发者ID:1and1,项目名称:cosmo,代码行数:13,代码来源:TestHelper.java
示例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;
}
开发者ID:1and1,项目名称:cosmo,代码行数:36,代码来源:ContextServiceExtensionsAdviceTest.java
示例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;
}
开发者ID:huihoo,项目名称:olat,代码行数:14,代码来源:CalendarDaoICalFileImpl.java
示例16: getCalDavCalendar
import net.fortuna.ical4j.model.property.Version; //导入依赖的package包/类
public Calendar getCalDavCalendar(String userToken) throws URISyntaxException, ParseException {
UserWithPermission user;
try {
user = findUserFromCalendarToken(userToken);
} catch (EmptyResultDataAccessException ex) {
throw new SecurityException("Invalid token");
}
if (userRepository.isCalendarFeedDisabled(user)) {
throw new SecurityException("Calendar feed disabled");
}
final Calendar calendar = new Calendar();
calendar.getProperties().add(new ProdId("-//Lavagna//iCal4j 1.0//EN"));
calendar.getProperties().add(Version.VERSION_2_0);
calendar.getProperties().add(CalScale.GREGORIAN);
calendar.getProperties().add(Method.PUBLISH);
final List<VEvent> events = new ArrayList<>();
final String applicationUrl = StringUtils
.appendIfMissing(configurationRepository.getValue(Key.BASE_APPLICATION_URL), "/");
final CalendarEventHandler handler = new CalendarVEventHandler(applicationUrl, cardDataService, userRepository,
events);
// Milestones
addMilestoneEvents(handler, user);
// Cards
addCardEvents(handler, user);
calendar.getComponents().addAll(events);
return calendar;
}
开发者ID:digitalfondue,项目名称:lavagna,代码行数:36,代码来源:CalendarService.java
示例17: makeCalendar
import net.fortuna.ical4j.model.property.Version; //导入依赖的package包/类
protected static Calendar makeCalendar(GenericValue workEffort, Map<String, Object> context) throws GenericEntityException {
String iCalData = null;
GenericValue iCalValue = workEffort.getRelatedOne("WorkEffortIcalData", false);
if (iCalValue != null) {
iCalData = iCalValue.getString("icalData");
}
boolean newCalendar = true;
Calendar calendar = null;
if (iCalData == null) {
Debug.logVerbose("iCalendar Data not found, creating new Calendar", module);
calendar = new Calendar();
} else {
Debug.logVerbose("iCalendar Data found, using saved Calendar", module);
StringReader reader = new StringReader(iCalData);
CalendarBuilder builder = new CalendarBuilder();
try {
calendar = builder.build(reader);
newCalendar = false;
} catch (Exception e) {
Debug.logError(e, "Error while parsing saved iCalendar, creating new iCalendar: ", module);
calendar = new Calendar();
}
}
PropertyList propList = calendar.getProperties();
replaceProperty(propList, prodId);
replaceProperty(propList, new XProperty(workEffortIdXPropName, workEffort.getString("workEffortId")));
if (newCalendar) {
propList.add(Version.VERSION_2_0);
propList.add(CalScale.GREGORIAN);
// TODO: Get time zone from publish properties value
java.util.TimeZone tz = java.util.TimeZone.getDefault();
TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
net.fortuna.ical4j.model.TimeZone timezone = registry.getTimeZone(tz.getID());
calendar.getComponents().add(timezone.getVTimeZone());
}
return calendar;
}
开发者ID:jamesyong,项目名称:o3erp,代码行数:38,代码来源:ICalConverter.java
示例18: newCalendar
import net.fortuna.ical4j.model.property.Version; //导入依赖的package包/类
public static Calendar newCalendar() {
final Calendar cal = new Calendar();
cal.getProperties().add(new ProdId(PRODUCT_ID));
cal.getProperties().add(Version.VERSION_2_0);
cal.getProperties().add(CalScale.GREGORIAN);
return cal;
}
开发者ID:axelor,项目名称:axelor-business-suite,代码行数:8,代码来源:ICalendarService.java
示例19: convertedCalendarHasVersion2
import net.fortuna.ical4j.model.property.Version; //导入依赖的package包/类
@Test
public void convertedCalendarHasVersion2(){
Calendar calendar = eventConverter.convertToCalendar(null, null);
Version version = calendar.getVersion();
assertNotNull(version);
assertEquals(ExchangeEventConverter.VERSION, version);
log.info("version="+version);
}
开发者ID:Bedework,项目名称:exchange-ws-client,代码行数:9,代码来源:ExchangeEventConverterImplTest.java
示例20: createTestCalendar
import net.fortuna.ical4j.model.property.Version; //导入依赖的package包/类
/**
* Creates test calendar instance.
*
* @return ICal calendar object.
*/
protected Calendar createTestCalendar() throws ParseException {
// Create a TimeZone
TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
TimeZone timezone = registry.getTimeZone("America/New_York");
VTimeZone tz = timezone.getVTimeZone();
// Start Date is on: April 1, 2013, 9:00 am
java.util.Calendar startDate = new GregorianCalendar();
startDate.setTimeZone(timezone);
startDate.set(java.util.Calendar.MONTH, java.util.Calendar.APRIL);
startDate.set(java.util.Calendar.DAY_OF_MONTH, 1);
startDate.set(java.util.Calendar.YEAR, 2013);
startDate.set(java.util.Calendar.HOUR_OF_DAY, 17);
startDate.set(java.util.Calendar.MINUTE, 0);
startDate.set(java.util.Calendar.SECOND, 0);
// End Date is on: April 1, 2013, 13:00
java.util.Calendar endDate = new GregorianCalendar();
endDate.setTimeZone(timezone);
endDate.set(java.util.Calendar.MONTH, java.util.Calendar.APRIL);
endDate.set(java.util.Calendar.DAY_OF_MONTH, 1);
endDate.set(java.util.Calendar.YEAR, 2013);
endDate.set(java.util.Calendar.HOUR_OF_DAY, 21);
endDate.set(java.util.Calendar.MINUTE, 0);
endDate.set(java.util.Calendar.SECOND, 0);
// Create the event
PropertyList propertyList = new PropertyList();
propertyList.add(new DtStamp("20130324T180000Z"));
propertyList.add(new DtStart(new DateTime(startDate.getTime())));
propertyList.add(new DtEnd(new DateTime(endDate.getTime())));
propertyList.add(new Summary("Progress Meeting"));
VEvent meeting = new VEvent(propertyList);
// add timezone info..
meeting.getProperties().add(tz.getTimeZoneId());
// generate unique identifier..
meeting.getProperties().add(new Uid("00000000"));
// add attendees..
Attendee dev1 = new Attendee(URI.create("mailto:[email protected]ycompany.com"));
dev1.getParameters().add(Role.REQ_PARTICIPANT);
dev1.getParameters().add(new Cn("Developer 1"));
meeting.getProperties().add(dev1);
Attendee dev2 = new Attendee(URI.create("mailto:[email protected]"));
dev2.getParameters().add(Role.OPT_PARTICIPANT);
dev2.getParameters().add(new Cn("Developer 2"));
meeting.getProperties().add(dev2);
// Create a calendar
net.fortuna.ical4j.model.Calendar icsCalendar = new net.fortuna.ical4j.model.Calendar();
icsCalendar.getProperties().add(Version.VERSION_2_0);
icsCalendar.getProperties().add(new ProdId("-//Events Calendar//iCal4j 1.0//EN"));
icsCalendar.getProperties().add(CalScale.GREGORIAN);
// Add the event and print
icsCalendar.getComponents().add(meeting);
return icsCalendar;
}
开发者ID:HydAu,项目名称:Camel,代码行数:67,代码来源:ICalDataFormatTest.java
注:本文中的net.fortuna.ical4j.model.property.Version类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论