public class VAlarm extends ICalComponent
Defines a reminder for an event or to-do task. This class contains static factory methods to aid in the construction of valid alarms.
Examples:
//audio alarm Trigger trigger = ... Attachment sound = ... VAlarm audio = VAlarm.audio(trigger, sound); //display alarm Trigger trigger = ... String message = "Meeting at 1pm"; VAlarm display = VAlarm.display(trigger, message); //email alarm Trigger trigger = ... String subject = "Reminder: Meeting at 1pm"; String body = "Team,\n\nThe team meeting scheduled for 1pm is about to start. Snacks will be served!\n\nThanks,\nJohn"; List<String> to = Arrays.asList("janedoe@example.com", "bobsmith@example.com"); VAlarm email = VAlarm.email(trigger, subject, body, to);
components, properties
Constructor and Description |
---|
VAlarm(Action action,
Trigger trigger)
Creates a new alarm.
|
Modifier and Type | Method and Description |
---|---|
void |
addAttachment(Attachment attachment)
Adds an attachment to the alarm.
|
void |
addAttendee(Attendee attendee)
Adds a person who will be emailed when the alarm fires (only applicable
for EMAIL alarms).
|
static VAlarm |
audio(Trigger trigger)
Creates an audio alarm.
|
static VAlarm |
audio(Trigger trigger,
Attachment sound)
Creates an audio alarm.
|
static VAlarm |
display(Trigger trigger,
String displayText)
Creates a display alarm.
|
static VAlarm |
email(Trigger trigger,
String subject,
String body,
List<String> recipients)
Creates an email alarm.
|
static VAlarm |
email(Trigger trigger,
String subject,
String body,
String... recipients)
Creates an email alarm.
|
Action |
getAction()
Gets the type of action to invoke when the alarm is triggered.
|
List<Attachment> |
getAttachments()
Gets any attachments that are associated with the alarm.
|
List<Attendee> |
getAttendees()
Gets the people who will be emailed when the alarm fires (only applicable
for EMAIL alarms).
|
Description |
getDescription()
Gets a detailed description of the alarm.
|
DurationProperty |
getDuration()
Gets the length of the pause between alarm repetitions.
|
Repeat |
getRepeat()
Gets the number of times an alarm should be repeated after its initial
trigger.
|
Summary |
getSummary()
Gets the summary of the alarm.
|
Trigger |
getTrigger()
Gets when the alarm will be triggered.
|
static VAlarm |
procedure(Trigger trigger,
String path)
Creates a procedure alarm (vCal 1.0 only).
|
void |
setAction(Action action)
Sets the type of action to invoke when the alarm is triggered.
|
void |
setDescription(Description description)
Sets a detailed description of the alarm.
|
Description |
setDescription(String description)
Sets a detailed description of the alarm.
|
DurationProperty |
setDuration(Duration duration)
Sets the length of the pause between alarm repetitions.
|
void |
setDuration(DurationProperty duration)
Sets the length of the pause between alarm repetitions.
|
void |
setRepeat(int count,
Duration pauseDuration)
Sets the repetition information for the alarm.
|
Repeat |
setRepeat(Integer count)
Sets the number of times an alarm should be repeated after its initial
trigger.
|
void |
setRepeat(Repeat repeat)
Sets the number of times an alarm should be repeated after its initial
trigger.
|
Summary |
setSummary(String summary)
Sets the summary of the alarm.
|
void |
setSummary(Summary summary)
Sets the summary of the alarm.
|
void |
setTrigger(Trigger trigger)
Sets when the alarm will be triggered.
|
protected void |
validate(List<ICalComponent> components,
ICalVersion version,
List<Warning> warnings)
Checks the component for data consistency problems or deviations from the
spec.
|
addComponent, addExperimentalComponent, addExperimentalProperty, addExperimentalProperty, addProperty, checkOptionalCardinality, checkRequiredCardinality, checkStatus, getComponent, getComponents, getComponents, getExperimentalComponent, getExperimentalComponents, getExperimentalComponents, getExperimentalProperties, getExperimentalProperties, getExperimentalProperty, getProperties, getProperties, getProperty, removeComponents, removeExperimentalComponents, removeExperimentalProperty, removeProperties, setComponent, setComponent, setExperimentalComponents, setExperimentalProperty, setExperimentalProperty, setProperty, setProperty, validate
public static VAlarm audio(Trigger trigger)
trigger
- the triggerpublic static VAlarm audio(Trigger trigger, Attachment sound)
trigger
- the triggersound
- a sound to play when the alarm triggerspublic static VAlarm display(Trigger trigger, String displayText)
trigger
- the triggerdisplayText
- the display textpublic static VAlarm email(Trigger trigger, String subject, String body, String... recipients)
trigger
- the triggersubject
- the email subjectbody
- the email bodyrecipients
- the email address(es) to send the alert topublic static VAlarm procedure(Trigger trigger, String path)
trigger
- the triggerpath
- the path or name of the procedurepublic static VAlarm email(Trigger trigger, String subject, String body, List<String> recipients)
trigger
- the triggersubject
- the email subjectbody
- the email bodyrecipients
- the email address(es) to send the alert topublic List<Attachment> getAttachments()
public void addAttachment(Attachment attachment)
attachment
- the attachment to addpublic Description getDescription()
Gets a detailed description of the alarm. The description should be more
detailed than the one provided by the Summary
property.
This property has different meanings, depending on the alarm action:
public void setDescription(Description description)
Sets a detailed description of the alarm. The description should be more
detailed than the one provided by the Summary
property.
This property has different meanings, depending on the alarm action:
description
- the description or null to removepublic Description setDescription(String description)
Sets a detailed description of the alarm. The description should be more
detailed than the one provided by the Summary
property.
This property has different meanings, depending on the alarm action:
description
- the description or null to removepublic Summary getSummary()
Gets the summary of the alarm.
This property has different meanings, depending on the alarm action:
public void setSummary(Summary summary)
Sets the summary of the alarm.
This property has different meanings, depending on the alarm action:
summary
- the summary or null to removepublic Summary setSummary(String summary)
Sets the summary of the alarm.
This property has different meanings, depending on the alarm action:
summary
- the summary or null to removepublic List<Attendee> getAttendees()
public void addAttendee(Attendee attendee)
attendee
- the email recipientpublic Action getAction()
public void setAction(Action action)
action
- the action or null to removepublic DurationProperty getDuration()
public void setDuration(DurationProperty duration)
duration
- the duration or null to removepublic DurationProperty setDuration(Duration duration)
duration
- the duration or null to removepublic Repeat getRepeat()
public void setRepeat(Repeat repeat)
repeat
- the repeat count or null to removepublic Repeat setRepeat(Integer count)
count
- the repeat count (e.g. "2" to repeat it two more times after
it was initially triggered, for a total of three times) or null to removepublic void setRepeat(int count, Duration pauseDuration)
count
- the repeat count (e.g. "2" to repeat it two more times after
it was initially triggered, for a total of three times)pauseDuration
- the length of the pause between repeatspublic Trigger getTrigger()
public void setTrigger(Trigger trigger)
trigger
- the trigger time or null to removeprotected void validate(List<ICalComponent> components, ICalVersion version, List<Warning> warnings)
ICalComponent
Checks the component for data consistency problems or deviations from the spec.
This method should be overridden by child classes that wish to provide validation logic. The default implementation of this method does nothing.
validate
in class ICalComponent
components
- the hierarchy of components that the component belongs
toversion
- the version to validate againstwarnings
- the list to add the warnings toCopyright © 2013-2015 Michael Angstadt. All Rights Reserved.