本文整理汇总了Java中net.fortuna.ical4j.model.property.ProdId类的典型用法代码示例。如果您正苦于以下问题:Java ProdId类的具体用法?Java ProdId怎么用?Java ProdId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProdId类属于net.fortuna.ical4j.model.property包,在下文中一共展示了ProdId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: icalResponse
import net.fortuna.ical4j.model.property.ProdId; //导入依赖的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.ProdId; //导入依赖的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.ProdId; //导入依赖的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.ProdId; //导入依赖的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: generateCalendar
import net.fortuna.ical4j.model.property.ProdId; //导入依赖的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;
}
}
示例6: createCalendar
import net.fortuna.ical4j.model.property.ProdId; //导入依赖的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;
}
示例7: IcalHandler
import net.fortuna.ical4j.model.property.ProdId; //导入依赖的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);
}
示例8: setupCalendar
import net.fortuna.ical4j.model.property.ProdId; //导入依赖的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;
}
示例9: adaptTimezoneCalendarComponent
import net.fortuna.ical4j.model.property.ProdId; //导入依赖的package包/类
public static void adaptTimezoneCalendarComponent(Calendar calendar) {
//ios 7 doesn't send product id on create calendar method
if(calendar.getProductId() == null){
calendar.getProperties().add(new ProdId("UNKNOWN_PRODID"));
}
}
示例10: getFreeBusyCalendar
import net.fortuna.ical4j.model.property.ProdId; //导入依赖的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;
}
示例11: getCalendarFromCollection
import net.fortuna.ical4j.model.property.ProdId; //导入依赖的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;
}
示例12: testICalendarAttribute
import net.fortuna.ical4j.model.property.ProdId; //导入依赖的package包/类
/**
* Test ICalendar attribute.
* @throws Exception - if something is wrong this exception is thrown.
*/
@Test
public void testICalendarAttribute() throws Exception {
User user = getUser(userDao, "testuser");
CollectionItem root = (CollectionItem) contentDao.getRootItem(user);
ContentItem item = generateTestContent();
ICalendarAttribute icalAttr = new HibICalendarAttribute();
icalAttr.setQName(new HibQName("icalattribute"));
icalAttr.setValue(helper.getInputStream("vjournal.ics"));
item.addAttribute(icalAttr);
ContentItem newItem = contentDao.createContent(root, item);
clearSession();
ContentItem queryItem = (ContentItem) contentDao.findItemByUid(newItem.getUid());
Attribute attr = queryItem.getAttribute(new HibQName("icalattribute"));
Assert.assertNotNull(attr);
Assert.assertTrue(attr instanceof ICalendarAttribute);
net.fortuna.ical4j.model.Calendar calendar = (net.fortuna.ical4j.model.Calendar) attr.getValue();
Assert.assertNotNull(calendar);
net.fortuna.ical4j.model.Calendar expected = CalendarUtils.parseCalendar(helper.getInputStream("vjournal.ics"));
Assert.assertEquals(expected.toString(),calendar.toString());
calendar.getProperties().add(new ProdId("blah"));
contentDao.updateContent(queryItem);
clearSession();
queryItem = (ContentItem) contentDao.findItemByUid(newItem.getUid());
ICalendarAttribute ica = (ICalendarAttribute) queryItem.getAttribute(new HibQName("icalattribute"));
Assert.assertEquals(calendar, ica.getValue());
}
示例13: makeDummyCalendar
import net.fortuna.ical4j.model.property.ProdId; //导入依赖的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: buildCalendar
import net.fortuna.ical4j.model.property.ProdId; //导入依赖的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;
}
示例15: getCalDavCalendar
import net.fortuna.ical4j.model.property.ProdId; //导入依赖的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;
}