Search in sources :

Example 1 with Trigger

use of net.fortuna.ical4j.model.property.Trigger in project zm-mailbox by Zimbra.

the class DefaultTnefToICalendar method addAlarmComponent.

/**
     * 
     * @param icalOutput
     * @param reminderDelta number of minutes before Start
     * @throws ParserException
     * @throws URISyntaxException
     * @throws IOException
     * @throws ParseException
     */
private void addAlarmComponent(ContentHandler icalOutput, Integer reminderDelta) throws ParserException, URISyntaxException, IOException, ParseException {
    if (reminderDelta == null) {
        return;
    }
    icalOutput.startComponent(Component.VALARM);
    IcalUtil.addProperty(icalOutput, Action.DISPLAY);
    IcalUtil.addProperty(icalOutput, Property.DESCRIPTION, "Reminder", false);
    String trigStr;
    if (reminderDelta % 60 == 0) {
        reminderDelta = reminderDelta / 60;
        if (reminderDelta % 24 == 0) {
            reminderDelta = reminderDelta / 24;
            trigStr = String.format("-PT%dD", reminderDelta);
        } else {
            trigStr = String.format("-PT%dH", reminderDelta);
        }
    } else {
        trigStr = String.format("-PT%dM", reminderDelta);
    }
    ParameterList trigParams = new ParameterList();
    trigParams.add(Related.START);
    Trigger trigger = new Trigger(trigParams, trigStr);
    IcalUtil.addProperty(icalOutput, trigger);
    icalOutput.endComponent(Component.VALARM);
}
Also used : Trigger(net.fortuna.ical4j.model.property.Trigger) ParameterList(net.fortuna.ical4j.model.ParameterList)

Aggregations

ParameterList (net.fortuna.ical4j.model.ParameterList)1 Trigger (net.fortuna.ical4j.model.property.Trigger)1