use of ietf.params.xml.ns.icalendar_2.ArrayOfParameters 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.ArrayOfParameters in project bw-calendar-engine by Bedework.
the class Xutil method uidProp.
protected static BasePropertyType uidProp(final BasePropertyType prop, final String uid) {
if (uid == null) {
return prop;
}
ArrayOfParameters pars = getAop(prop);
XBedeworkUidParamType x = new XBedeworkUidParamType();
x.setText(uid);
JAXBElement<XBedeworkUidParamType> param = of.createXBedeworkUid(x);
pars.getBaseParameter().add(param);
return prop;
}
use of ietf.params.xml.ns.icalendar_2.ArrayOfParameters in project bw-calendar-engine by Bedework.
the class Xalarms method toXAlarm.
/**
* @param ev
* @param val
* @param pattern
* @param masterClass
* @return ValarmType
* @throws CalFacadeException
*/
public static ValarmType toXAlarm(final BwEvent ev, final BwAlarm val, final BaseComponentType pattern, final Class masterClass) throws CalFacadeException {
try {
ValarmType alarm = new ValarmType();
int atype = val.getAlarmType();
alarm.setProperties(new ArrayOfProperties());
List<JAXBElement<? extends BasePropertyType>> pl = alarm.getProperties().getBasePropertyOrTzid();
if (emit(pattern, masterClass, ValarmType.class, ActionPropType.class)) {
ActionPropType a = new ActionPropType();
a.setText(BwAlarm.alarmTypes[val.getAlarmType()]);
pl.add(of.createAction(a));
}
if (emit(pattern, masterClass, ValarmType.class, TriggerPropType.class)) {
TriggerPropType t = new TriggerPropType();
if (val.getTriggerDateTime()) {
// t.setDateTime(val.getTrigger());
t.setDateTime(XcalUtil.getXMlUTCCal(val.getTrigger()));
} else {
t.setDuration(val.getTrigger());
if (!val.getTriggerStart()) {
ArrayOfParameters pars = getAop(t);
RelatedParamType r = new RelatedParamType();
r.setText(IcalDefs.alarmTriggerRelatedEnd);
JAXBElement<RelatedParamType> param = of.createRelated(r);
pars.getBaseParameter().add(param);
}
}
pl.add(of.createTrigger(t));
}
if (emit(pattern, masterClass, ValarmType.class, DurationPropType.class)) {
if (val.getDuration() != null) {
DurationPropType dur = new DurationPropType();
dur.setDuration(val.getDuration());
pl.add(of.createDuration(dur));
RepeatPropType rep = new RepeatPropType();
rep.setInteger(BigInteger.valueOf(val.getRepeat()));
pl.add(of.createRepeat(rep));
}
}
/* Description */
if ((atype == BwAlarm.alarmTypeDisplay) || (atype == BwAlarm.alarmTypeEmail) || (atype == BwAlarm.alarmTypeProcedure)) {
// Both require description
String desc = val.getDescription();
if (desc == null) {
if (ev != null) {
if (ev.getDescription() != null) {
desc = ev.getDescription();
} else {
desc = ev.getSummary();
}
}
}
if (desc == null) {
desc = " ";
}
DescriptionPropType d = new DescriptionPropType();
d.setText(desc);
pl.add(of.createDescription(d));
}
/* Summary */
if (atype == BwAlarm.alarmTypeEmail) {
SummaryPropType s = new SummaryPropType();
s.setText(val.getSummary());
pl.add(of.createSummary(s));
}
if ((atype == BwAlarm.alarmTypeAudio) || (atype == BwAlarm.alarmTypeEmail) || (atype == BwAlarm.alarmTypeProcedure)) {
if (val.getAttach() != null) {
AttachPropType a = new AttachPropType();
a.setUri(val.getAttach());
pl.add(of.createAttach(a));
}
}
/* Attendees */
if (atype == BwAlarm.alarmTypeEmail) {
if (val.getNumAttendees() > 0) {
for (BwAttendee att : val.getAttendees()) {
pl.add(of.createAttendee(ToXEvent.makeAttendee(att)));
}
}
}
if (val.getNumXproperties() > 0) {
/* This alarm has x-props */
}
return alarm;
} catch (Throwable t) {
throw new CalFacadeException(t);
}
}
use of ietf.params.xml.ns.icalendar_2.ArrayOfParameters in project bw-calendar-engine by Bedework.
the class Xutil method altrepProp.
protected static BasePropertyType altrepProp(final BasePropertyType prop, final String val) {
if (val == null) {
return prop;
}
final ArrayOfParameters pars = getAop(prop);
final AltrepParamType a = new AltrepParamType();
a.setUri(val);
final JAXBElement<AltrepParamType> param = of.createAltrep(a);
pars.getBaseParameter().add(param);
return prop;
}
use of ietf.params.xml.ns.icalendar_2.ArrayOfParameters in project bw-calendar-engine by Bedework.
the class Xutil method langProp.
protected static BasePropertyType langProp(final BasePropertyType prop, final BwStringBase s) {
String lang = s.getLang();
if (lang == null) {
return prop;
}
ArrayOfParameters pars = getAop(prop);
LanguageParamType l = new LanguageParamType();
l.setText(lang);
JAXBElement<LanguageParamType> param = of.createLanguage(l);
pars.getBaseParameter().add(param);
return prop;
}
Aggregations