use of net.fortuna.ical4j.model.ParameterList in project bw-calendar-engine by Bedework.
the class BwDateTime method initDateProp.
/* Init a date property for makeDtEnd, makeDue
*/
private void initDateProp(final DateProperty dt, final TimeZoneRegistry tzreg) throws CalFacadeException {
try {
String tzid = getTzid();
ParameterList pl = dt.getParameters();
if (getDateType()) {
pl.add(Value.DATE);
}
if (tzid != null) {
dt.setTimeZone(tzreg.getTimeZone(tzid));
}
dt.setValue(getDtval());
} catch (Throwable t) {
throw new CalFacadeException(t);
}
}
use of net.fortuna.ical4j.model.ParameterList in project bw-calendar-engine by Bedework.
the class BwDateTime method makeDtStart.
/**
* Make a DtStart from this object
*
* @param tzreg
* @return DtStart
* @throws CalFacadeException
*/
public DtStart makeDtStart(final TimeZoneRegistry tzreg) throws CalFacadeException {
try {
/*
String tzid = null;
ParameterList pl = new ParameterList();
if (getDateType()) {
pl.add(Value.DATE);
} else if (!isUTC()) {
tzid = getTzid();
if (tzid != null) {
pl.add(new TzId(tzid));
}
}
return new DtStart(pl, getDtval());*/
String tzid = getTzid();
DtStart dt = new DtStart();
ParameterList pl = dt.getParameters();
if (getDateType()) {
pl.add(Value.DATE);
} else if (tzid != null) {
dt.setTimeZone(tzreg.getTimeZone(tzid));
}
dt.setValue(getDtval());
return dt;
} catch (Throwable t) {
throw new CalFacadeException(t);
}
}
use of net.fortuna.ical4j.model.ParameterList in project bw-calendar-engine by Bedework.
the class BwDateTime method makeDateTime.
/**
* Make a new date time value based on the dtStart value + the duration.
*
* @param dtStart
* @param dateOnly
* @param dur
* @return BwDateTime
* @throws CalFacadeException
*/
public static BwDateTime makeDateTime(final DateProperty dtStart, final boolean dateOnly, final Dur dur) throws CalFacadeException {
DtEnd dtEnd;
java.util.Date endDt = dur.getTime(dtStart.getDate());
Parameter tzid = getIcalParameter(dtStart, "TZID");
if (dateOnly) {
// dtEnd = new DtEnd(new Date(endDt));
ParameterList parl = new ParameterList();
parl.add(Value.DATE);
dtEnd = new DtEnd(parl, new Date(endDt));
// addIcalParameter(dtEnd, Value.DATE);
// if (tzid != null) {
// addIcalParameter(dtEnd, tzid);
// }
} else {
DateTime d = new DateTime(endDt);
if (tzid != null) {
DateTime sd = (DateTime) dtStart.getDate();
d.setTimeZone(sd.getTimeZone());
}
// dtEnd = new DtEnd(d, dtStart.isUtc());
dtEnd = new DtEnd(d);
if (tzid != null) {
addIcalParameter(dtEnd, tzid);
} else if (dtStart.isUtc()) {
dtEnd.setUtc(true);
}
}
return makeBwDateTime(dtEnd);
}
use of net.fortuna.ical4j.model.ParameterList in project bw-calendar-engine by Bedework.
the class IcalUtil method getTypedUrl.
/**
* @param p
* @return TypedUrl
*/
public static TypedUrl getTypedUrl(final Property p) {
TypedUrl tu = new TypedUrl();
ParameterList pars = p.getParameters();
Parameter par = pars.getParameter(Parameter.TYPE);
if (par != null) {
tu.setType(par.getValue());
}
tu.setValue(p.getValue());
return tu;
}
use of net.fortuna.ical4j.model.ParameterList in project bw-calendar-engine by Bedework.
the class IcalUtil method getParameterVal.
/**
* @param prop
* @param name
* @return Parameter value
*/
public static String getParameterVal(final Property prop, final String name) {
ParameterList parl = prop.getParameters();
if (parl == null) {
return null;
}
Parameter par = parl.getParameter(name);
if (par == null) {
return null;
}
return par.getValue();
}
Aggregations