Search in sources :

Example 21 with ParameterList

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);
    }
}
Also used : ParameterList(net.fortuna.ical4j.model.ParameterList) CalFacadeException(org.bedework.calfacade.exc.CalFacadeException)

Example 22 with ParameterList

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);
    }
}
Also used : DtStart(net.fortuna.ical4j.model.property.DtStart) ParameterList(net.fortuna.ical4j.model.ParameterList) CalFacadeException(org.bedework.calfacade.exc.CalFacadeException)

Example 23 with ParameterList

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);
}
Also used : Parameter(net.fortuna.ical4j.model.Parameter) ParameterList(net.fortuna.ical4j.model.ParameterList) Date(net.fortuna.ical4j.model.Date) DateTime(net.fortuna.ical4j.model.DateTime) DtEnd(net.fortuna.ical4j.model.property.DtEnd)

Example 24 with ParameterList

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;
}
Also used : TypedUrl(org.bedework.calfacade.base.TypedUrl) ParameterList(net.fortuna.ical4j.model.ParameterList) Parameter(net.fortuna.ical4j.model.Parameter)

Example 25 with ParameterList

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();
}
Also used : ParameterList(net.fortuna.ical4j.model.ParameterList) Parameter(net.fortuna.ical4j.model.Parameter)

Aggregations

ParameterList (net.fortuna.ical4j.model.ParameterList)31 Parameter (net.fortuna.ical4j.model.Parameter)13 Iterator (java.util.Iterator)5 CalFacadeException (org.bedework.calfacade.exc.CalFacadeException)5 DateTime (net.fortuna.ical4j.model.DateTime)4 XParameter (net.fortuna.ical4j.model.parameter.XParameter)4 PropertyList (net.fortuna.ical4j.model.PropertyList)3 Cn (net.fortuna.ical4j.model.parameter.Cn)3 Value (net.fortuna.ical4j.model.parameter.Value)3 BwAttendee (org.bedework.calfacade.BwAttendee)3 IOException (java.io.IOException)2 URI (java.net.URI)2 Property (net.fortuna.ical4j.model.Property)2 VEvent (net.fortuna.ical4j.model.component.VEvent)2 VVoter (net.fortuna.ical4j.model.component.VVoter)2 FmtType (net.fortuna.ical4j.model.parameter.FmtType)2 PartStat (net.fortuna.ical4j.model.parameter.PartStat)2 Attach (net.fortuna.ical4j.model.property.Attach)2 DateListProperty (net.fortuna.ical4j.model.property.DateListProperty)2 BwAttachment (org.bedework.calfacade.BwAttachment)2