Search in sources :

Example 26 with ParameterList

use of net.fortuna.ical4j.model.ParameterList in project bw-calendar-engine by Bedework.

the class IcalUtil method getVoter.

/**
 * @param cb          IcalCallback object
 * @param vProp
 * @return BwAttendee
 * @throws Throwable
 */
public static BwAttendee getVoter(final IcalCallback cb, final Voter vProp) throws Throwable {
    ParameterList pars = vProp.getParameters();
    BwAttendee att = initAttendeeVoter(cb, vProp.getValue(), pars);
    att.setType(BwAttendee.typeVoter);
    Parameter par = pars.getParameter("STAY-INFORMED");
    if (par != null) {
        att.setStayInformed(((StayInformed) par).getStayInformed().booleanValue());
    }
    return att;
}
Also used : StayInformed(net.fortuna.ical4j.model.parameter.StayInformed) ParameterList(net.fortuna.ical4j.model.ParameterList) Parameter(net.fortuna.ical4j.model.Parameter) BwAttendee(org.bedework.calfacade.BwAttendee)

Example 27 with ParameterList

use of net.fortuna.ical4j.model.ParameterList in project bw-calendar-engine by Bedework.

the class IcalUtil method getTrigger.

/**
 * @param pl
 * @param absentOk - if true and absent returns an empty result.
 * @return TriggerVal
 * @throws Throwable
 */
public static TriggerVal getTrigger(final PropertyList pl, final boolean absentOk) throws Throwable {
    Trigger prop = (Trigger) pl.getProperty(Property.TRIGGER);
    TriggerVal tr = new TriggerVal();
    if (prop == null) {
        if (!absentOk) {
            throw new IcalMalformedException("Invalid alarm - no trigger");
        }
        return tr;
    }
    tr.trigger = prop.getValue();
    if (prop.getDateTime() != null) {
        tr.triggerDateTime = true;
        return tr;
    }
    ParameterList pars = prop.getParameters();
    if (pars == null) {
        tr.triggerStart = true;
        return tr;
    }
    Parameter par = pars.getParameter("RELATED");
    if (par == null) {
        tr.triggerStart = true;
        return tr;
    }
    tr.triggerStart = "START".equals(par.getValue());
    return tr;
}
Also used : Trigger(net.fortuna.ical4j.model.property.Trigger) ParameterList(net.fortuna.ical4j.model.ParameterList) Parameter(net.fortuna.ical4j.model.Parameter) TriggerVal(org.bedework.calfacade.BwAlarm.TriggerVal)

Example 28 with ParameterList

use of net.fortuna.ical4j.model.ParameterList in project bw-calendar-engine by Bedework.

the class IcalUtil method getAbbrevVal.

/**
 * @param p
 * @return AbbreviatedValue
 */
public static AbbreviatedValue getAbbrevVal(final Property p) {
    ParameterList pars = p.getParameters();
    ParameterList abbrevPars = pars.getParameters(Parameter.ABBREV);
    Collection<String> abbrevs = new ArrayList<String>();
    Iterator it = abbrevPars.iterator();
    while (it.hasNext()) {
        Parameter par = (Parameter) it.next();
        abbrevs.add(par.getValue());
    }
    return new AbbreviatedValue(abbrevs, p.getValue());
}
Also used : ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ParameterList(net.fortuna.ical4j.model.ParameterList) Parameter(net.fortuna.ical4j.model.Parameter) AbbreviatedValue(org.bedework.calfacade.base.AbbreviatedValue)

Example 29 with ParameterList

use of net.fortuna.ical4j.model.ParameterList in project bw-calendar-engine by Bedework.

the class IcalUtil method setAttachment.

/**
 * make an attachment
 *
 * @param val
 * @return Attendee
 * @throws Throwable
 */
public static Attach setAttachment(final BwAttachment val) throws Throwable {
    ParameterList pars = new ParameterList();
    String temp = val.getFmtType();
    if (temp != null) {
        pars.add(new FmtType(temp));
    }
    temp = val.getEncoding();
    if (temp == null) {
        return new Attach(pars, val.getUri());
    } else {
        pars.add(new Encoding(temp));
        temp = val.getValueType();
        if (temp != null) {
            pars.add(new Value(temp));
        }
        return new Attach(pars, val.getValue());
    }
}
Also used : Attach(net.fortuna.ical4j.model.property.Attach) FmtType(net.fortuna.ical4j.model.parameter.FmtType) AbbreviatedValue(org.bedework.calfacade.base.AbbreviatedValue) Value(net.fortuna.ical4j.model.parameter.Value) ParameterList(net.fortuna.ical4j.model.ParameterList) Encoding(net.fortuna.ical4j.model.parameter.Encoding)

Example 30 with ParameterList

use of net.fortuna.ical4j.model.ParameterList in project bw-calendar-engine by Bedework.

the class IcalUtil method addParameter.

/**
 * @param prop
 * @param val
 */
public static void addParameter(final Property prop, final Parameter val) {
    ParameterList parl = prop.getParameters();
    parl.add(val);
}
Also used : ParameterList(net.fortuna.ical4j.model.ParameterList)

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