net.fortuna.ical4j.model.component

Class VAlarm


public class VAlarm
extends CalendarComponent

$Id: VAlarm.java,v 1.21 2009/01/08 14:18:32 fortuna Exp $ [Apr 5, 2004] Defines an iCalendar VALARM component.
    4.6.6 Alarm Component

       Component Name: VALARM

       Purpose: Provide a grouping of component properties that define an
       alarm.

       Formal Definition: A "VALARM" calendar component is defined by the
       following notation:

              alarmc     = "BEGIN" ":" "VALARM" CRLF
                           (audioprop / dispprop / emailprop / procprop)
                           "END" ":" "VALARM" CRLF

         audioprop  = 2*(

                    ; 'action' and 'trigger' are both REQUIRED,
                    ; but MUST NOT occur more than once

                    action / trigger /

                    ; 'duration' and 'repeat' are both optional,
                    ; and MUST NOT occur more than once each,
                    ; but if one occurs, so MUST the other

                    duration / repeat /

                    ; the following is optional,
                    ; but MUST NOT occur more than once

                    attach /

                    ; the following is optional,
                    ; and MAY occur more than once

                    x-prop

                    )



         dispprop   = 3*(

                    ; the following are all REQUIRED,
                    ; but MUST NOT occur more than once

                    action / description / trigger /

                    ; 'duration' and 'repeat' are both optional,
                    ; and MUST NOT occur more than once each,
                    ; but if one occurs, so MUST the other

                    duration / repeat /

                    ; the following is optional,
                    ; and MAY occur more than once

                    *x-prop

                    )



         emailprop  = 5*(

                    ; the following are all REQUIRED,
                    ; but MUST NOT occur more than once

                    action / description / trigger / summary

                    ; the following is REQUIRED,
                    ; and MAY occur more than once

                    attendee /

                    ; 'duration' and 'repeat' are both optional,
                    ; and MUST NOT occur more than once each,
                    ; but if one occurs, so MUST the other

                    duration / repeat /

                    ; the following are optional,
                    ; and MAY occur more than once

                    attach / x-prop

                    )



         procprop   = 3*(

                    ; the following are all REQUIRED,
                    ; but MUST NOT occur more than once

                    action / attach / trigger /

                    ; 'duration' and 'repeat' are both optional,
                    ; and MUST NOT occur more than once each,
                    ; but if one occurs, so MUST the other

                    duration / repeat /

                    ; 'description' is optional,
                    ; and MUST NOT occur more than once

                    description /

                    ; the following is optional,
                    ; and MAY occur more than once

                    x-prop

                    )
 
Example 1 - Creating an alarm to trigger at a specific time:

 java.util.Calendar cal = java.util.Calendar.getInstance();
 cal.set(java.util.Calendar.MONTH, java.util.Calendar.DECEMBER);
 cal.set(java.util.Calendar.DAY_OF_MONTH, 25);

 VAlarm christmas = new VAlarm(cal.getTime());
 
Example 2 - Creating an alarm to trigger one (1) hour before the scheduled start of the parent event/the parent todo is due:

 VAlarm reminder = new VAlarm(-1000 * 60 * 60);

 // repeat reminder four (4) more times every fifteen (15) minutes..
 reminder.getProperties().add(new Repeat(4));
 reminder.getProperties().add(new Duration(1000 * 60 * 15));

 // display a message..
 reminder.getProperties().add(Action.DISPLAY);
 reminder.getProperties().add(new Description("Progress Meeting at 9:30am"));
 

Constructor Summary

VAlarm()
Default constructor.
VAlarm(DateTime trigger)
Constructs a new VALARM instance that will trigger at the specified time.
VAlarm(Dur trigger)
Constructs a new VALARM instance that will trigger at the specified time relative to the event/todo component.
VAlarm(PropertyList properties)
Constructor.

Method Summary

Action
getAction()
Returns the mandatory action property.
Attach
getAttachment()
Returns the optional attachment property.
Description
getDescription()
Returns the optional description property.
Duration
getDuration()
Returns the optional duration property.
Repeat
getRepeat()
Returns the optional repeat property.
Summary
getSummary()
Returns the optional summary property.
Trigger
getTrigger()
Returns the mandatory trigger property.
void
validate(boolean recurse)
void
validateAdd()
void
validateCancel()
void
validateCounter()
void
validateDeclineCounter()
void
validatePublish()
void
validateRefresh()
void
validateReply()
void
validateRequest()

Constructor Details

VAlarm

public VAlarm()
Default constructor.

VAlarm

public VAlarm(DateTime trigger)
Constructs a new VALARM instance that will trigger at the specified time.
Parameters:
trigger - the time the alarm will trigger

VAlarm

public VAlarm(Dur trigger)
Constructs a new VALARM instance that will trigger at the specified time relative to the event/todo component.
Parameters:
trigger - a duration of time relative to the parent component that the alarm will trigger at

VAlarm

public VAlarm(PropertyList properties)
Constructor.
Parameters:
properties - a list of properties

Method Details

getAction

public final Action getAction()
Returns the mandatory action property.
Returns:

getAttachment

public final Attach getAttachment()
Returns the optional attachment property.
Returns:

getDescription

public final Description getDescription()
Returns the optional description property.
Returns:

getDuration

public final Duration getDuration()
Returns the optional duration property.
Returns:

getRepeat

public final Repeat getRepeat()
Returns the optional repeat property.
Returns:

getSummary

public final Summary getSummary()
Returns the optional summary property.
Returns:

getTrigger

public final Trigger getTrigger()
Returns the mandatory trigger property.
Returns:

validate

public final void validate(boolean recurse)
            throws ValidationException

validateAdd

public void validateAdd()
            throws ValidationException

validateCancel

public void validateCancel()
            throws ValidationException

validateCounter

public void validateCounter()
            throws ValidationException

validateDeclineCounter

public void validateDeclineCounter()
            throws ValidationException

validatePublish

public void validatePublish()
            throws ValidationException

validateRefresh

public void validateRefresh()
            throws ValidationException

validateReply

public void validateReply()
            throws ValidationException

validateRequest

public void validateRequest()
            throws ValidationException