use of ietf.params.xml.ns.icalendar_2.BaseComponentType in project bw-calendar-engine by Bedework.
the class ToXEvent method doRecurring.
/**
* Build recurring properties from event.
*
* @param pattern
* @param compCl - component class for pattern matching
* @param val
* @param pl
* @throws CalFacadeException
*/
public static void doRecurring(final BaseComponentType pattern, final Class compCl, final BwEvent val, final List<JAXBElement<? extends BasePropertyType>> pl) throws CalFacadeException {
try {
if (emit(pattern, compCl, RrulePropType.class) && val.hasRrules()) {
for (String s : val.getRrules()) {
RRule rule = new RRule();
rule.setValue(s);
Recur r = rule.getRecur();
RecurType rt = new RecurType();
rt.setFreq(FreqRecurType.fromValue(r.getFrequency()));
if (r.getCount() > 0) {
rt.setCount(BigInteger.valueOf(r.getCount()));
}
Date until = r.getUntil();
if (until != null) {
UntilRecurType u = new UntilRecurType();
/*
if (until instanceof DateTime) {
u.setDateTime(until.toString());
} else {
u.setDate(until.toString());
}
*/
XcalUtil.initUntilRecur(u, until.toString());
}
if (r.getInterval() > 0) {
rt.setInterval(String.valueOf(r.getInterval()));
}
listFromNumberList(rt.getBysecond(), r.getSecondList());
listFromNumberList(rt.getByminute(), r.getMinuteList());
listFromNumberList(rt.getByhour(), r.getHourList());
if (r.getDayList() != null) {
List<String> l = rt.getByday();
for (WeekDay wd : r.getDayList()) {
l.add(wd.getDay().name());
}
}
listFromNumberList(rt.getByyearday(), r.getYearDayList());
intlistFromNumberList(rt.getBymonthday(), r.getMonthDayList());
listFromNumberList(rt.getByweekno(), r.getWeekNoList());
intlistFromNumberList(rt.getBymonth(), r.getMonthList());
bigintlistFromNumberList(rt.getBysetpos(), r.getSetPosList());
RrulePropType rrp = new RrulePropType();
rrp.setRecur(rt);
pl.add(of.createRrule(rrp));
}
}
/*
if (emit(pattern, compCl, ExrulePropType.class) &&
val.hasExrules()) {
for(String s: val.getExrules()) {
ExRule rule = new ExRule();
rule.setValue(s);
pl.add(rule);
}
}
if (emit(pattern, compCl, RdatePropType.class) {
makeDlp(false, val.getRdates(), pl);
}
if (emit(pattern, compCl, ExdatePropType.class) {
makeDlp(true, val.getExdates(), pl);
}
*/
// } catch (CalFacadeException cfe) {
// throw cfe;
} catch (Throwable t) {
throw new CalFacadeException(t);
}
}
use of ietf.params.xml.ns.icalendar_2.BaseComponentType in project bw-calendar-engine by Bedework.
the class ToXEvent method processEventAlarm.
/**
* Process any alarms.
*
* @param ev
* @param comp
* @param pattern
* @param masterClass
* @throws CalFacadeException
*/
public static void processEventAlarm(final BwEvent ev, final BaseComponentType comp, final BaseComponentType pattern, final Class masterClass) throws CalFacadeException {
if (!emit(pattern, masterClass, ValarmType.class)) {
return;
}
Set<BwAlarm> als = ev.getAlarms();
if ((als == null) || als.isEmpty()) {
return;
}
if (!(comp instanceof VeventType) && !(comp instanceof VtodoType)) {
warn("Entity of class " + ev.getClass() + " has alarms but not allowed by entity of type " + comp.getClass());
}
ArrayOfComponents aoc = comp.getComponents();
if (aoc == null) {
aoc = new ArrayOfComponents();
comp.setComponents(aoc);
}
for (BwAlarm alarm : als) {
ValarmType va = Xalarms.toXAlarm(ev, alarm, pattern, masterClass);
aoc.getBaseComponent().add(of.createValarm(va));
}
}
use of ietf.params.xml.ns.icalendar_2.BaseComponentType in project bw-calendar-engine by Bedework.
the class ToXEvent method toComponent.
/**
* Make a BaseComponentType component from a BwEvent object. This may produce a
* VEvent, VTodo or VJournal.
*
* @param val
* @param isOverride - true if event object is an override
* @param pattern - if non-null limit returned components and values to those
* supplied in the pattern.
* @return JAXBElement<? extends BaseComponentType>
* @throws CalFacadeException
*/
public static JAXBElement<? extends BaseComponentType> toComponent(final BwEvent val, final boolean isOverride, final boolean wrapXprops, final BaseComponentType pattern) throws CalFacadeException {
if (val == null) {
return null;
}
boolean isInstance = false;
try {
JAXBElement<? extends BaseComponentType> el;
boolean freeBusy = false;
boolean todo = false;
int entityType = val.getEntityType();
if (entityType == IcalDefs.entityTypeEvent) {
el = of.createVevent(new VeventType());
} else if (entityType == IcalDefs.entityTypeTodo) {
el = of.createVtodo(new VtodoType());
todo = true;
} else if (entityType == IcalDefs.entityTypeJournal) {
el = of.createVjournal(new VjournalType());
} else if (entityType == IcalDefs.entityTypeFreeAndBusy) {
el = of.createVfreebusy(new VfreebusyType());
freeBusy = true;
} else {
throw new CalFacadeException("org.bedework.invalid.entity.type", String.valueOf(entityType));
}
BaseComponentType comp = el.getValue();
Class masterClass = comp.getClass();
comp.setProperties(new ArrayOfProperties());
List<JAXBElement<? extends BasePropertyType>> pl = comp.getProperties().getBasePropertyOrTzid();
if (emit(pattern, masterClass, RecurrenceIdPropType.class)) {
String strval = val.getRecurrenceId();
if ((strval != null) && (strval.length() > 0)) {
isInstance = true;
// DORECUR - we should be restoring to original form.
/* Try using timezone from dtstart so we can more often be in same form
* as original.
*/
BwDateTime dts = val.getDtstart();
RecurrenceIdPropType ri = new RecurrenceIdPropType();
String tzid = null;
if (dts.getDateType()) {
// RECUR - fix all day recurrences sometime
if (strval.length() > 8) {
// Try to fix up bad all day recurrence ids. - assume a local timezone
strval = strval.substring(0, 8);
}
ri.setDate(XcalUtil.fromDtval(strval));
} else {
if (!val.getForceUTC()) {
if ((dts != null) && !dts.isUTC()) {
tzid = dts.getTzid();
}
}
XcalUtil.initDt(ri, strval, tzid);
}
pl.add(of.createRecurrenceId(ri));
}
}
/* ------------------- Alarms -------------------- */
processEventAlarm(val, comp, pattern, masterClass);
/* ------------------- Attachments -------------------- */
if (emit(pattern, masterClass, AttachPropType.class)) {
if (val.getNumAttachments() > 0) {
for (BwAttachment att : val.getAttachments()) {
// pl.add(setAttachment(att));
}
}
}
/* ------------------- Attendees -------------------- */
if (emit(pattern, masterClass, AttendeePropType.class)) {
if (val.getNumAttendees() > 0) {
for (BwAttendee att : val.getAttendees()) {
pl.add(of.createAttendee(makeAttendee(att)));
}
}
}
if (emit(pattern, masterClass, CategoriesPropType.class)) {
if (val.getNumCategories() > 0) {
// LANG - filter on language - group language in one cat list?
for (BwCategory cat : val.getCategories()) {
CategoriesPropType c = new CategoriesPropType();
c.getText().add(cat.getWord().getValue());
pl.add(of.createCategories((CategoriesPropType) langProp(c, cat.getWord())));
}
}
}
if (emit(pattern, masterClass, ClassPropType.class)) {
String pval = val.getClassification();
if (pval != null) {
ClassPropType c = new ClassPropType();
c.setText(pval);
pl.add(of.createClass(c));
}
}
if (emit(pattern, masterClass, CommentPropType.class)) {
if (val.getNumComments() > 0) {
for (BwString str : val.getComments()) {
CommentPropType c = new CommentPropType();
c.setText(str.getValue());
pl.add(of.createComment((CommentPropType) langProp(c, str)));
}
}
}
if (emit(pattern, masterClass, CompletedPropType.class)) {
if ((entityType == IcalDefs.entityTypeTodo) && (val.getCompleted() != null)) {
CompletedPropType c = new CompletedPropType();
c.setUtcDateTime(XcalUtil.getXMlUTCCal(val.getCompleted()));
pl.add(of.createCompleted(c));
}
}
if (emit(pattern, masterClass, ContactPropType.class)) {
if (val.getNumContacts() > 0) {
for (BwContact ctct : val.getContacts()) {
// LANG
ContactPropType c = new ContactPropType();
c.setText(ctct.getCn().getValue());
pl.add(of.createContact((ContactPropType) langProp(uidProp(altrepProp(c, ctct.getLink()), ctct.getUid()), ctct.getCn())));
}
}
}
if (emit(pattern, masterClass, CreatedPropType.class)) {
CreatedPropType created = new CreatedPropType();
created.setUtcDateTime(XcalUtil.getXMlUTCCal(val.getCreated()));
pl.add(of.createCreated(created));
}
if (emit(pattern, masterClass, DescriptionPropType.class)) {
BwStringBase bwstr = val.findDescription(null);
if (bwstr != null) {
DescriptionPropType desc = new DescriptionPropType();
if (bwstr.getValue().contains("Â")) {
warn("Odd character  in description: " + bwstr.getValue());
}
desc.setText(bwstr.getValue());
pl.add(of.createDescription((DescriptionPropType) langProp(desc, bwstr)));
}
}
if ((todo && emit(pattern, masterClass, DuePropType.class)) || (!todo && emit(pattern, masterClass, DtendPropType.class))) {
if (val.getEndType() == BwEvent.endTypeDate) {
if (todo) {
DuePropType due = (DuePropType) makeDateDatetime(new DuePropType(), val.getDtend(), freeBusy | val.getForceUTC());
pl.add(of.createDue(due));
} else {
DtendPropType dtend = (DtendPropType) makeDateDatetime(new DtendPropType(), val.getDtend(), freeBusy | val.getForceUTC());
pl.add(of.createDtend(dtend));
}
} else if (val.getEndType() == BwEvent.endTypeDuration) {
DurationPropType dur = new DurationPropType();
dur.setDuration(val.getDuration());
pl.add(of.createDuration(dur));
}
}
if (emit(pattern, masterClass, DtstampPropType.class)) {
DtstampPropType dtstamp = new DtstampPropType();
dtstamp.setUtcDateTime(XcalUtil.getXMlUTCCal(val.getDtstamp()));
pl.add(of.createDtstamp(dtstamp));
}
if (emit(pattern, masterClass, DtstartPropType.class)) {
if ((val.getNoStart() == null) || !val.getNoStart()) {
DtstartPropType dtstart = (DtstartPropType) makeDateDatetime(new DtstartPropType(), val.getDtstart(), freeBusy | val.getForceUTC());
pl.add(of.createDtstart(dtstart));
}
}
if (emit(pattern, masterClass, FreebusyPropType.class)) {
if (entityType == IcalDefs.entityTypeFreeAndBusy) {
Collection<BwFreeBusyComponent> fbps = val.getFreeBusyPeriods();
if (fbps != null) {
for (BwFreeBusyComponent fbc : fbps) {
FreebusyPropType fb = new FreebusyPropType();
/*
int type = fbc.getType();
FbtypeValueType fbtype;
if (type == BwFreeBusyComponent.typeBusy) {
fbtype = FbtypeValueType.BUSY;
} else if (type == BwFreeBusyComponent.typeFree) {
fbtype = FbtypeValueType.FREE;
} else if (type == BwFreeBusyComponent.typeBusyUnavailable) {
fbtype = FbtypeValueType.BUSY_UNAVAILABLE;
} else if (type == BwFreeBusyComponent.typeBusyTentative) {
fbtype = FbtypeValueType.BUSY_TENTATIVE;
} else {
fbtype = FbtypeValueType.BUSY;
// throw new CalFacadeException("Bad free-busy type " + type);
}
ArrayOfParameters pars = getAop(fb);
FbtypeParamType f = new FbtypeParamType();
f.setText(fbtype.name());
*/
ArrayOfParameters pars = getAop(fb);
FbtypeParamType f = new FbtypeParamType();
f.setText(BwFreeBusyComponent.fbtypes[fbc.getType()]);
JAXBElement<FbtypeParamType> param = of.createFbtype(f);
pars.getBaseParameter().add(param);
List<PeriodType> pdl = fb.getPeriod();
for (Period p : fbc.getPeriods()) {
PeriodType np = new PeriodType();
np.setStart(XcalUtil.getXMlUTCCal(p.getStart().toString()));
np.setEnd(XcalUtil.getXMlUTCCal(p.getEnd().toString()));
pdl.add(np);
}
pl.add(of.createFreebusy(fb));
}
}
}
}
if (emit(pattern, masterClass, GeoPropType.class)) {
BwGeo geo = val.getGeo();
if (geo != null) {
GeoPropType g = new GeoPropType();
g.setLatitude(geo.getLatitude().floatValue());
g.setLatitude(geo.getLongitude().floatValue());
pl.add(of.createGeo(g));
}
}
if (emit(pattern, masterClass, LastModifiedPropType.class)) {
LastModifiedPropType lm = new LastModifiedPropType();
lm.setUtcDateTime(XcalUtil.getXMlUTCCal(val.getLastmod()));
pl.add(of.createLastModified(lm));
}
if (emit(pattern, masterClass, LocationPropType.class)) {
BwLocation loc = val.getLocation();
if (loc != null) {
LocationPropType l = new LocationPropType();
l.setText(loc.getAddress().getValue());
pl.add(of.createLocation((LocationPropType) langProp(uidProp(l, loc.getUid()), loc.getAddress())));
}
}
if (emit(pattern, masterClass, OrganizerPropType.class)) {
BwOrganizer org = val.getOrganizer();
if (org != null) {
pl.add(of.createOrganizer(makeOrganizer(org)));
}
}
if (emit(pattern, masterClass, PercentCompletePropType.class)) {
Integer pc = val.getPercentComplete();
if (pc != null) {
PercentCompletePropType p = new PercentCompletePropType();
p.setInteger(BigInteger.valueOf(pc));
pl.add(of.createPercentComplete(p));
}
}
if (emit(pattern, masterClass, PriorityPropType.class)) {
Integer prio = val.getPriority();
if (prio != null) {
PriorityPropType p = new PriorityPropType();
p.setInteger(BigInteger.valueOf(prio));
pl.add(of.createPriority(p));
}
}
if (emit(pattern, masterClass, RelatedToPropType.class)) {
BwRelatedTo relto = val.getRelatedTo();
if (relto != null) {
RelatedToPropType rt = new RelatedToPropType();
rt.setUid(relto.getValue());
if (relto.getRelType() != null) {
ArrayOfParameters pars = getAop(rt);
ReltypeParamType r = new ReltypeParamType();
r.setText(relto.getRelType());
JAXBElement<ReltypeParamType> param = of.createReltype(r);
pars.getBaseParameter().add(param);
}
pl.add(of.createRelatedTo(rt));
}
}
if (emit(pattern, masterClass, ResourcesPropType.class)) {
if (val.getNumResources() > 0) {
/* This event has a resource */
ResourcesPropType r = new ResourcesPropType();
List<String> rl = r.getText();
for (BwString str : val.getResources()) {
// LANG
rl.add(str.getValue());
}
pl.add(of.createResources(r));
}
}
if (emit(pattern, masterClass, SequencePropType.class)) {
if (val.getSequence() > 0) {
SequencePropType s = new SequencePropType();
s.setInteger(BigInteger.valueOf(val.getSequence()));
pl.add(of.createSequence(s));
}
}
if (emit(pattern, masterClass, StatusPropType.class)) {
String status = val.getStatus();
if ((status != null) && !status.equals(BwEvent.statusMasterSuppressed)) {
StatusPropType s = new StatusPropType();
s.setText(status);
pl.add(of.createStatus(s));
}
}
if (emit(pattern, masterClass, SummaryPropType.class)) {
BwString bwstr = val.findSummary(null);
if (bwstr != null) {
SummaryPropType s = new SummaryPropType();
s.setText(bwstr.getValue());
s = (SummaryPropType) langProp(s, bwstr);
pl.add(of.createSummary(s));
}
}
if (emit(pattern, masterClass, TranspPropType.class)) {
String strval = val.getTransparency();
if ((strval != null) && (strval.length() > 0)) {
TranspPropType t = new TranspPropType();
t.setText(strval);
pl.add(of.createTransp(t));
}
}
if (emit(pattern, masterClass, UidPropType.class)) {
UidPropType uid = new UidPropType();
uid.setText(val.getUid());
pl.add(of.createUid(uid));
}
if (emit(pattern, masterClass, UrlPropType.class)) {
String strval = val.getLink();
if (strval != null) {
// Possibly drop this if we do it on input and check all data
strval = strval.trim();
}
if ((strval != null) && (strval.length() > 0)) {
UrlPropType u = new UrlPropType();
u.setUri(strval);
pl.add(of.createUrl(u));
}
}
if (emit(pattern, masterClass, XBedeworkCostPropType.class)) {
if (val.getCost() != null) {
XBedeworkCostPropType c = new XBedeworkCostPropType();
c.setText(val.getCost());
pl.add(of.createXBedeworkCost(c));
}
}
if (val.getNumXproperties() > 0) {
try {
xpropertiesToXcal(pl, val.getXproperties(), pattern, masterClass, wrapXprops);
} catch (Throwable t) {
// XXX For the moment swallow these.
error(t);
}
}
if (!isInstance && !isOverride && val.testRecurring()) {
doRecurring(pattern, masterClass, val, pl);
}
return el;
} catch (final CalFacadeException cfe) {
throw cfe;
} catch (final Throwable t) {
throw new CalFacadeException(t);
}
}
use of ietf.params.xml.ns.icalendar_2.BaseComponentType in project bw-calendar-engine by Bedework.
the class Xutil method xpropertiesToXcal.
/**
* @param pl
* @param xprops
* @param pattern
* @param masterClass
* @param wrapXprops wrap x-properties in bedework object - allows
* us to push them through soap
* @throws Throwable
*/
@SuppressWarnings("deprecation")
public static void xpropertiesToXcal(final List<JAXBElement<? extends BasePropertyType>> pl, final List<BwXproperty> xprops, final BaseComponentType pattern, final Class masterClass, final boolean wrapXprops) throws Throwable {
for (final BwXproperty x : xprops) {
// Skip any timezone we saved in the event.
final String xname = x.getName();
final String val = x.getValue();
if (xname.startsWith(BwXproperty.bedeworkTimezonePrefix)) {
continue;
}
if (xname.equals(BwXproperty.bedeworkExsynchEndtzid)) {
if (!emit(pattern, masterClass, XBedeworkExsynchEndtzidPropType.class)) {
continue;
}
final XBedeworkExsynchEndtzidPropType p = new XBedeworkExsynchEndtzidPropType();
p.setText(val);
pl.add(of.createXBedeworkExsynchEndtzid(p));
continue;
}
if (xname.equals(BwXproperty.bedeworkExsynchLastmod)) {
if (!emit(pattern, masterClass, XBedeworkExsynchLastmodPropType.class)) {
continue;
}
final XBedeworkExsynchLastmodPropType p = new XBedeworkExsynchLastmodPropType();
p.setText(val);
pl.add(of.createXBedeworkExsynchLastmod(p));
continue;
}
if (xname.equals(BwXproperty.bedeworkExsynchOrganizer)) {
continue;
}
if (xname.equals(BwXproperty.bedeworkExsynchStarttzid)) {
if (!emit(pattern, masterClass, XBedeworkExsynchStarttzidPropType.class)) {
continue;
}
final XBedeworkExsynchStarttzidPropType p = new XBedeworkExsynchStarttzidPropType();
p.setText(val);
pl.add(of.createXBedeworkExsynchStarttzid(p));
continue;
}
if (xname.equals(BwXproperty.bedeworkEventRegStart)) {
if (!emit(pattern, masterClass, XBedeworkRegistrationStartPropType.class)) {
continue;
}
final XBedeworkRegistrationStartPropType p = new XBedeworkRegistrationStartPropType();
String tzid = null;
for (final Xpar xp : x.getParameters()) {
if (xp.getName().equalsIgnoreCase("TZID")) {
tzid = xp.getValue();
break;
}
}
XcalUtil.initDt(p, val, tzid);
pl.add(of.createXBedeworkRegistrationStart(p));
continue;
}
if (xname.equals(BwXproperty.bedeworkEventRegEnd)) {
if (!emit(pattern, masterClass, XBedeworkRegistrationEndPropType.class)) {
continue;
}
final XBedeworkRegistrationEndPropType p = new XBedeworkRegistrationEndPropType();
String tzid = null;
for (final Xpar xp : x.getParameters()) {
if (xp.getName().equalsIgnoreCase("TZID")) {
tzid = xp.getValue();
break;
}
}
XcalUtil.initDt(p, val, tzid);
pl.add(of.createXBedeworkRegistrationEnd(p));
continue;
}
if (xname.equals(BwXproperty.bedeworkEventRegMaxTickets)) {
if (!emit(pattern, masterClass, XBedeworkMaxTicketsPropType.class)) {
continue;
}
final XBedeworkMaxTicketsPropType p = new XBedeworkMaxTicketsPropType();
p.setInteger(BigInteger.valueOf(Long.valueOf(val)));
pl.add(of.createXBedeworkMaxTickets(p));
continue;
}
if (xname.equals(BwXproperty.bedeworkEventRegMaxTicketsPerUser)) {
if (!emit(pattern, masterClass, XBedeworkMaxTicketsPerUserPropType.class)) {
continue;
}
final XBedeworkMaxTicketsPerUserPropType p = new XBedeworkMaxTicketsPerUserPropType();
p.setInteger(BigInteger.valueOf(Long.valueOf(val)));
pl.add(of.createXBedeworkMaxTicketsPerUser(p));
continue;
}
if (xname.equals(BwXproperty.bedeworkEventRegWaitListLimit)) {
if (!emit(pattern, masterClass, XBedeworkWaitListLimitPropType.class)) {
continue;
}
final XBedeworkWaitListLimitPropType p = new XBedeworkWaitListLimitPropType();
p.setText(val);
pl.add(of.createXBedeworkWaitListLimit(p));
continue;
}
if (xname.equals(BwXproperty.xBedeworkCategories)) {
if (!emit(pattern, masterClass, XBwCategoriesPropType.class)) {
continue;
}
final XBwCategoriesPropType p = new XBwCategoriesPropType();
p.getText().add(val);
pl.add(of.createXBedeworkCategories(p));
continue;
}
if (xname.equals(BwXproperty.xBedeworkContact)) {
if (!emit(pattern, masterClass, XBwContactPropType.class)) {
continue;
}
final XBwContactPropType p = new XBwContactPropType();
p.setText(val);
pl.add(of.createXBedeworkContact(p));
continue;
}
if (xname.equals(BwXproperty.xBedeworkLocation)) {
if (!emit(pattern, masterClass, XBwLocationPropType.class)) {
continue;
}
final XBwLocationPropType p = new XBwLocationPropType();
p.setText(val);
pl.add(of.createXBedeworkLocation(p));
continue;
}
if (!wrapXprops) {
if (getLog().isDebugEnabled()) {
warn("Not handing x-property " + xname);
}
continue;
}
final XBedeworkWrapperPropType wrapper = new XBedeworkWrapperPropType();
if (x.getParameters() != null) {
for (final Xpar xp : x.getParameters()) {
xparam(wrapper, xp);
}
}
final XBedeworkWrappedNameParamType wnp = new XBedeworkWrappedNameParamType();
wnp.setText(x.getName());
if (wrapper.getParameters() == null) {
wrapper.setParameters(new ArrayOfParameters());
}
wrapper.getParameters().getBaseParameter().add(of.createXBedeworkWrappedName(wnp));
wrapper.setText(val);
pl.add(of.createXBedeworkWrapper(wrapper));
}
}
use of ietf.params.xml.ns.icalendar_2.BaseComponentType in project bw-calendar-engine by Bedework.
the class IcalTranslator method toXMLIcalendar.
/**
* @param val
* @param methodType
* @param pattern
* @return XML IcalendarType
* @throws CalFacadeException
*/
public IcalendarType toXMLIcalendar(final EventInfo val, final int methodType, final IcalendarType pattern, final boolean wrapXprops) throws CalFacadeException {
IcalendarType ical = new IcalendarType();
VcalendarType vcal = new VcalendarType();
ical.getVcalendar().add(vcal);
vcal.setProperties(new ArrayOfProperties());
List<JAXBElement<? extends BasePropertyType>> pl = vcal.getProperties().getBasePropertyOrTzid();
ProdidPropType prod = new ProdidPropType();
prod.setText(prodId);
pl.add(Xutil.of.createProdid(prod));
VersionPropType vers = new VersionPropType();
vers.setText("2.0");
pl.add(Xutil.of.createVersion(vers));
if ((methodType > ScheduleMethods.methodTypeNone) && (methodType < ScheduleMethods.methodTypeUnknown)) {
MethodPropType m = new MethodPropType();
m.setText(ScheduleMethods.methods[methodType]);
pl.add(Xutil.of.createMethod(m));
}
ArrayOfComponents aoc = vcal.getComponents();
if (aoc == null) {
aoc = new ArrayOfComponents();
vcal.setComponents(aoc);
}
BwEvent ev = val.getEvent();
JAXBElement<? extends BaseComponentType> el = null;
VcalendarType vc = null;
if ((pattern != null) && !pattern.getVcalendar().isEmpty()) {
vc = pattern.getVcalendar().get(0);
}
BaseComponentType bc = matches(vc, ev.getEntityType());
if ((vc != null) && (bc == null)) {
return ical;
}
if (!ev.getSuppressed()) {
if (ev.getEntityType() == IcalDefs.entityTypeFreeAndBusy) {
el = ToXEvent.toComponent(ev, false, wrapXprops, bc);
} else {
el = ToXEvent.toComponent(ev, false, wrapXprops, bc);
}
if (el != null) {
aoc.getBaseComponent().add(el);
}
}
if (val.getNumOverrides() == 0) {
return ical;
}
for (EventInfo oei : val.getOverrides()) {
ev = oei.getEvent();
el = ToXEvent.toComponent(ev, true, wrapXprops, bc);
if (el != null) {
aoc.getBaseComponent().add(el);
}
}
if (val.getNumContainedItems() > 0) {
for (EventInfo aei : val.getContainedItems()) {
ev = aei.getEvent();
el = ToXEvent.toComponent(ev, true, wrapXprops, bc);
if (el != null) {
aoc.getBaseComponent().add(el);
}
}
}
return ical;
}
Aggregations