use of ietf.params.xml.ns.icalendar_2.TzidParamType in project bw-calendar-engine by Bedework.
the class Xutil method tzidProp.
protected static BasePropertyType tzidProp(final BasePropertyType prop, final String val) {
if (val == null) {
return prop;
}
final ArrayOfParameters pars = getAop(prop);
final TzidParamType tzid = new TzidParamType();
tzid.setText(val);
final JAXBElement<TzidParamType> t = of.createTzid(tzid);
pars.getBaseParameter().add(t);
return prop;
}
use of ietf.params.xml.ns.icalendar_2.TzidParamType in project bw-calendar-engine by Bedework.
the class DateDatetimePropUpdater method makeDt.
protected UpdateResult makeDt(final BwDateTime evdt, final Holder<BwDateTime> resdt, final UpdateInfo ui) throws WebdavException {
try {
String tzid = evdt.getTzid();
String dtval = evdt.getDtval();
boolean dateOnly = evdt.getDateType();
BwDateTime newdt = null;
/* New or changed tzid? */
for (ParameterUpdater.UpdateInfo parui : ui.getParamUpdates()) {
if (parui.getParam() instanceof TzidParamType) {
if (parui.isRemove()) {
tzid = null;
break;
}
if (parui.isAdd()) {
if (tzid != null) {
return new UpdateResult(ui.getPropName().toString() + " already has tzid");
}
tzid = ((TzidParamType) parui.getParam()).getText();
break;
}
if (tzid == null) {
return new UpdateResult(ui.getPropName().toString() + " has no tzid to change");
}
tzid = ((TzidParamType) parui.getUpdparam()).getText();
break;
}
}
if (ui.getUpdprop() != null) {
// Has new value
DateDatetimePropertyType newdts = (DateDatetimePropertyType) ui.getUpdprop();
dateOnly = newdts.getDate() != null;
newdt = BwDateTime.makeBwDateTime(newdts, tzid);
}
if ((newdt == null) && (!Util.equalsString(tzid, evdt.getTzid()))) {
// Tzid changed
newdt = BwDateTime.makeBwDateTime(dateOnly, dtval, tzid);
}
if (newdt != null) {
// Validate
int res = newdt.validate();
if (res == BwDateTime.dtBadDtval) {
return new UpdateResult("Bad date value for " + ui.getPropName());
}
if (res == BwDateTime.dtBadTz) {
return new UpdateResult("Bad tzid for " + ui.getPropName());
}
}
resdt.value = newdt;
return UpdateResult.getOkResult();
} catch (CalFacadeException cfe) {
throw new WebdavException(cfe);
}
}
use of ietf.params.xml.ns.icalendar_2.TzidParamType in project bw-calendar-engine by Bedework.
the class Xutil method xparam.
/**
* Convert a parameter
* @param prop - parameters go here
* @param xp - a parameter
* @throws Throwable
*/
protected static void xparam(final BasePropertyType prop, final Xpar xp) throws Throwable {
ArrayOfParameters aop = prop.getParameters();
if (aop == null) {
aop = new ArrayOfParameters();
prop.setParameters(aop);
}
if (xp.getName().equalsIgnoreCase("tzid")) {
final TzidParamType tz = new TzidParamType();
tz.setText(xp.getValue());
aop.getBaseParameter().add(of.createTzid(tz));
return;
}
}
Aggregations