本文整理汇总了Java中net.fortuna.ical4j.model.property.XProperty类的典型用法代码示例。如果您正苦于以下问题:Java XProperty类的具体用法?Java XProperty怎么用?Java XProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XProperty类属于net.fortuna.ical4j.model.property包,在下文中一共展示了XProperty类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: export
import net.fortuna.ical4j.model.property.XProperty; //导入依赖的package包/类
public void export(Calendar calendar) throws IOException, ValidationException, ParseException {
String path = AppSettings.get().get("file.upload.dir");
if (!path.endsWith("/")) {
path += "/";
}
String name = calendar.getName();
if (!name.endsWith(".ics")) {
name += ".ics";
}
FileOutputStream fout = new FileOutputStream(path + name );
Preconditions.checkNotNull(calendar, "calendar can't be null");
Preconditions.checkNotNull(calendar.getEventsCrm(), "can't export empty calendar");
net.fortuna.ical4j.model.Calendar cal = newCalendar();
cal.getProperties().add(new XProperty(X_WR_CALNAME, calendar.getName()));
for (ICalendarEvent item : calendar.getEventsCrm()) {
VEvent event = createVEvent(item);
cal.getComponents().add(event);
}
CalendarOutputter outputter = new CalendarOutputter();
outputter.output(cal, fout);
}
开发者ID:axelor,项目名称:axelor-business-suite,代码行数:25,代码来源:CalendarService.java
示例2: export
import net.fortuna.ical4j.model.property.XProperty; //导入依赖的package包/类
/**
* Export the calendar to the given output writer.
*
* @param calendar
* the source {@link ICalendar}
* @param writer
* the output writer
* @throws IOException
* @throws ValidationException
* @throws ParseException
*/
public void export(ICalendar calendar, Writer writer) throws IOException, ValidationException, ParseException {
Preconditions.checkNotNull(calendar, "calendar can't be null");
Preconditions.checkNotNull(writer, "writer can't be null");
Preconditions.checkNotNull(getICalendarEvents(calendar), "can't export empty calendar");
Calendar cal = newCalendar();
cal.getProperties().add(new XProperty(X_WR_CALNAME, calendar.getName()));
for (ICalendarEvent item : getICalendarEvents(calendar)) {
VEvent event = createVEvent(item);
cal.getComponents().add(event);
}
CalendarOutputter outputter = new CalendarOutputter();
outputter.output(cal, writer);
}
开发者ID:axelor,项目名称:axelor-business-suite,代码行数:28,代码来源:ICalendarService.java
示例3: generateCalendarItemTypeXProperties
import net.fortuna.ical4j.model.property.XProperty; //导入依赖的package包/类
private Collection<XProperty> generateCalendarItemTypeXProperties(CalendarItemType calendarItem){
Collection<XProperty> xprops = new LinkedHashSet<XProperty>();
String timeZone = calendarItem.getTimeZone();
if(StringUtils.isNotBlank(timeZone)){
xprops.add(new ExchangeTimeZoneProperty(timeZone));
}else{
log.warn("unable to generate ExchangeTimeZoneProperty, timeZone is blank");
}
TimeZoneDefinitionType startTimeZone = calendarItem.getStartTimeZone();
if(null != startTimeZone && StringUtils.isNotBlank(startTimeZone.getId())){
xprops.add(new ExchangeStartTimeZoneProperty(startTimeZone.getId()));
}else{
log.debug("unable to generate ExchangeStartTimeZoneProperty, startTimeZone is blank");
}
TimeZoneDefinitionType endTimeZone = calendarItem.getEndTimeZone();
if(null != endTimeZone && StringUtils.isNotBlank(endTimeZone.getId())){
xprops.add(new ExchangeEndTimeZoneProperty(endTimeZone.getId()));
}else{
log.debug("unable to generate ExchangeEndTimeZoneProperty, endTimeZone is blank");
}
return xprops;
}
开发者ID:Bedework,项目名称:exchange-ws-client,代码行数:25,代码来源:ExchangeEventConverterImpl.java
示例4: getFreeBusyCalendar
import net.fortuna.ical4j.model.property.XProperty; //导入依赖的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
示例5: makeCalendar
import net.fortuna.ical4j.model.property.XProperty; //导入依赖的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
示例6: toXProperty
import net.fortuna.ical4j.model.property.XProperty; //导入依赖的package包/类
protected static XProperty toXProperty(String name, String value) {
if (name == null || value == null) {
return null;
}
return new XProperty(name, value);
}
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:7,代码来源:ICalConverter.java
示例7: makeDummyEvent
import net.fortuna.ical4j.model.property.XProperty; //导入依赖的package包/类
/**
* Makes dummy event.
* @return The event.
*/
public VEvent makeDummyEvent() {
String serial = Integer.toString(++eseq);
String summary = "dummy" + serial;
// tomorrow
java.util.Calendar start = java.util.Calendar.getInstance();
start.add(java.util.Calendar.DAY_OF_MONTH, 1);
start.set(java.util.Calendar.HOUR_OF_DAY, 9);
start.set(java.util.Calendar.MINUTE, 30);
// 1 hour duration
Dur duration = new Dur(0, 1, 0, 0);
VEvent event = new VEvent(new Date(start.getTime()), duration, summary);
event.getProperties().add(new Uid(serial));
// add timezone information
VTimeZone tz = TimeZoneRegistryFactory.getInstance().createRegistry().
getTimeZone("America/Los_Angeles").getVTimeZone();
String tzValue =
tz.getProperties().getProperty(Property.TZID).getValue();
net.fortuna.ical4j.model.parameter.TzId tzParam =
new net.fortuna.ical4j.model.parameter.TzId(tzValue);
event.getProperties().getProperty(Property.DTSTART).
getParameters().add(tzParam);
// add an alarm for 5 minutes before the event with an xparam
// on the description
Dur trigger = new Dur(0, 0, -5, 0);
VAlarm alarm = new VAlarm(trigger);
alarm.getProperties().add(Action.DISPLAY);
Description description = new Description("Meeting at 9:30am");
XParameter xparam = new XParameter("X-COSMO-TEST-PARAM", "deadbeef");
description.getParameters().add(xparam);
alarm.getProperties().add(description);
alarm.getProperties().add(new Description("Meeting at 9:30am"));
event.getAlarms().add(alarm);
// add an x-property with an x-param
XProperty xprop = new XProperty("X-COSMO-TEST-PROP", "abc123");
xprop.getParameters().add(xparam);
event.getProperties().add(xprop);
return event;
}
开发者ID:1and1,项目名称:cosmo,代码行数:50,代码来源:TestHelper.java
示例8: generateItemTypeXProperties
import net.fortuna.ical4j.model.property.XProperty; //导入依赖的package包/类
/**
* Return a never null but possibly empty {@link Collection} of {@link XProperty}
*
* Returned {@link XProperty}s may include:
* {@link ItemTypeParentFolderId},
*
* @param item
* @return
*/
private Collection<XProperty> generateItemTypeXProperties(ItemType item){
Collection<XProperty> xprops = new LinkedHashSet<XProperty>();
FolderIdType parentFolderId = item.getParentFolderId();
if(null != parentFolderId){
String p_id = parentFolderId.getId();
String p_ck = parentFolderId.getChangeKey();
if(StringUtils.isNotBlank(p_id)){
xprops.add(new ItemTypeParentFolderId(parentFolderId));
}else{
log.warn("unable to generate X_EWS_PARENT_FOLDER_ID, parentFolderId is blank");
}
if(StringUtils.isNotBlank(p_ck)){
xprops.add(new ItemTypeParentFolderChangeKey(parentFolderId));
}else{
log.warn("unable to generate X_EWS_PARENT_FOLDER_CHANGEKEY, parentFolderChangeKey is blank");
}
}
ItemIdType itemId = item.getItemId();
if(null != itemId){
String i_id = itemId.getId();
String i_ck = itemId.getChangeKey();
if(StringUtils.isNotBlank(i_id)){
xprops.add(new ItemTypeItemId(itemId));
}else{
log.warn("unable to generate X_EWS_ITEM_ID, itemId is blank");
}
if(StringUtils.isNotBlank(i_ck)){
xprops.add(new ItemTypeChangeKey(itemId));
}else{
log.warn("unable to generate X_EWS_ITEM_CHANGEKEY, itemChangeKey is blank");
}
}
if(item instanceof CalendarItemType){
CalendarItemType calendarItem = (CalendarItemType) item;
Collection<XProperty> calendarXProps = generateCalendarItemTypeXProperties(calendarItem);
if(!CollectionUtils.isEmpty(calendarXProps)){
xprops.addAll(calendarXProps);
}
}else {
log.warn("item is not a CalendarItemType, X_EWS...TIMEZONE properties will not be generated.");
}
return xprops;
}
开发者ID:Bedework,项目名称:exchange-ws-client,代码行数:55,代码来源:ExchangeEventConverterImpl.java
示例9: convertExtendedPropertyType
import net.fortuna.ical4j.model.property.XProperty; //导入依赖的package包/类
/**
* return a never null but possibly empty {@link Collection} of {@link XProperty}
*
* if an {@link ExtendedPropertyType} contains multiple values this method will return multiple {@link XProperty}'s.
*
* @param extendedProperty
* @return
*/
private Collection<XProperty> convertExtendedPropertyType(ExtendedPropertyType extendedProperty){
Collection<XProperty> xprops = new LinkedHashSet<XProperty>();
PathToExtendedFieldType extendedFieldURI = extendedProperty.getExtendedFieldURI();
if(null != extendedFieldURI){
String propertyName = extendedFieldURI.getPropertyName();
if(StringUtils.isBlank(propertyName)){
DistinguishedPropertySetType distinguishedPropertySetId = extendedFieldURI.getDistinguishedPropertySetId();
if(null != distinguishedPropertySetId){
propertyName = distinguishedPropertySetId.value();
}
}
ParameterList params = new ParameterList();
String exPropSetId = extendedFieldURI.getPropertySetId();
if(StringUtils.isNotBlank(exPropSetId)){
params.add(new PathToExtendedFieldTypePropertySetId(extendedFieldURI));
}
Integer exPropId = extendedFieldURI.getPropertyId();
if(StringUtils.isNotBlank(exPropId.toString())){
params.add(new PathToExtendedFieldTypePropertyId(extendedFieldURI));
}
MapiPropertyTypeType propertyType = extendedFieldURI.getPropertyType();
if(null != propertyType && StringUtils.isNotBlank(propertyType.value())){
params.add(new PathToExtendedFieldTypePropertyType(extendedFieldURI));
}
String propertyTag = extendedFieldURI.getPropertyTag();
if(StringUtils.isNotBlank(propertyTag)){
params.add(new PathToExtendedFieldTypePropertyTag(extendedFieldURI));
}
Set<String> xPropertyValues = new HashSet<String>();
if(StringUtils.isNotBlank(propertyName)){
NonEmptyArrayOfPropertyValuesType values = extendedProperty.getValues();
if(null != values && !CollectionUtils.isEmpty(values.getValues())){
xPropertyValues.addAll(values.getValues());
}else if(null != extendedProperty.getValue()){
xPropertyValues.add(extendedProperty.getValue());
}
}else{
log.error("Unable to generate XProperty(s). propertyName not found for ExtendedPropertyType="+extendedProperty);
}
if(!CollectionUtils.isEmpty(xPropertyValues)){
Integer count = 0;
for(String xValue: xPropertyValues){
xprops.add(new XProperty(propertyName, params, xValue));
propertyName+="_"+count;
count++;
}
}else{
log.error("Unable to generate XProperty(s). propertyValue(s) not found for ExtendedPropertyType="+extendedProperty);
}
}
return xprops;
}
开发者ID:Bedework,项目名称:exchange-ws-client,代码行数:62,代码来源:ExchangeEventConverterImpl.java
注:本文中的net.fortuna.ical4j.model.property.XProperty类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论