Class BwAlarm
- All Implemented Interfaces:
Serializable,Comparable<BwAlarm>,AttendeesEntity,DescriptionEntity<BwString>,Differable<BwAlarm>,OwnedEntity,SummaryEntity,XpropsEntity,org.bedework.util.logging.Logged
The same alarm entity may be referred to by some or all instances of a recurring event. The alarm entity contains the real time (UTC) at which it will next trigger. This is derived from the event which refers to it.
When an event is triggered we determine if that event is now expired or if it now has a new trigger time based on another instance for that event. We update the entity to reflect that.
Expired events are explicitly flagged as such. We don't use time as the indicator as system down time could lead to alarms never being triggered. This could lead to an alarm storm if there is a long down time.
- Version:
- 1.0
- Author:
- Mike Douglass douglm . rpi.edu
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.bedework.calfacade.base.DumpEntity
DumpEntity.DumpType -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intstatic final intaudiostatic final intdisplaystatic final intemailstatic final intnonestatic final intother - name in x-propsstatic final intprocedurestatic final String[]Names for type of alarmprotected Stringprotected Set<BwAttendee>protected Stringprotected booleanprotected intprotected intprotected Stringprotected DateCalculated on a call to getTriggerDate()protected booleanprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttendee(BwAttendee val) voidaddDescription(String lang, String val) voidaddDescription(BwString val) voidaddRecipient(String val) voidaddSummary(BwString val) voidaddXproperty(BwXproperty val) static BwAlarmaudioAlarm(String owner, BwAlarm.TriggerVal trigger, String duration, int repeat, String attach) Make an audio alarmbooleanAn alarm is equal for same event, owner, action and trigger.clone()Make visibleReturn a clone of the SetintcompareEqFields(BwAlarm that) Compare fields that define equalityintReturn a copy of the SetbooleandiffersFrom(BwAlarm val) Return true if the entity differs in any way.static BwAlarmdisplayAlarm(String owner, BwAlarm.TriggerVal trigger, String duration, int repeat, String description) Make a display alarmstatic BwAlarmemailAlarm(String owner, BwAlarm.TriggerVal trigger, String duration, int repeat, String attach, String description, String summary, Set<BwAttendee> attendees) Make an email alarmfindDescription(String lang) findSummary(String lang) intGet the alarmTypeGet the attachmentGet the attendeesGet the descriptionsGet the duration in rfc formatintbooleanGet the expired flaggetNextTriggerDate(BwDateTime start, Date previousTrigger) Get the next trigger Date value.intintintintintGet the recipientsintGet the repetition countintGet the current repetition countGet the summariesGet the trigger in rfc formatgetTriggerDate(BwDateTime start) Get the trigger Date value.booleanGet the triggerDateTime flagbooleanGet the triggerStart flaggetXicalProperties(String val) Find x-properties storing the value of the named ical propertygetXproperties(String val) inthashCode()booleanHere we attempt to see if an incomplete object matches this one.static BwAlarmnoneAlarm(String owner, BwAlarm.TriggerVal trigger, String duration, int repeat, String description) Make a "ACTION:NONE" alarmstatic BwAlarmotherAlarm(String owner, String action, BwAlarm.TriggerVal trigger, String duration, int repeat, String description) Make an alarm for an unrecognizd actionstatic BwAlarmprocedureAlarm(String owner, BwAlarm.TriggerVal trigger, String duration, int repeat, String attach, String description) Make a procedure alarmbooleanremoveAttendee(BwAttendee val) booleanbooleanremoveRecipient(String val) booleanremoveSummary(BwString val) intremoveXproperties(String val) Remove all instances of the named property.voidvoidsetAlarmType(int val) Set the alarmType for this eventvoidSet the attachmentvoidsetAttendees(Set<BwAttendee> val) Set the attendees SetvoidsetDescription(String val) voidsetDescriptions(Set<BwString> val) Set the descriptions SetvoidsetDuration(String val) Set the duration - rfc formatvoidsetExpired(boolean val) Set the expired flagvoidsetRecipients(Set<String> val) Set the recipients SetvoidsetRepeat(int val) Set the repetition count for this alarm, 0 means no repeat, 1 means 2 alarms will be sent etc.voidsetRepeatCount(int val) Set the current repetition count for this alarm.voidsetSummaries(Set<BwString> val) Set the summaries SetvoidsetSummary(String val) voidsetTrigger(String val) Set the trigger - rfc formatvoidsetTriggerDateTime(boolean val) Set the triggerDateTime flagvoidsetTriggerStart(boolean val) Set the triggerStart flagvoidsetXproperties(List<BwXproperty> val) Set the x-propstoString()protected voidtoStringSegment(org.bedework.util.misc.ToString ts) Add our stuff to the ToString objectvoidupdateDescriptions(String lang, String val) If description with given lang is present updates the value, otherwise adds it.voidupdateSummaries(String lang, String val) If summary with given lang is present updates the value, otherwise adds it.Methods inherited from class org.bedework.calfacade.base.BwOwnedDbentity
copyTo, getOwnerHref, getPublick, setOwnerHref, setPublick, shallowCopyToMethods inherited from class org.bedework.calfacade.base.BwDbentity
addDeletedEntity, afterDeletion, beforeDeletion, beforeSave, beforeUpdate, getByteSize, getDeletedEntities, getSeq, length, setByteSize, setSeqMethods inherited from class org.bedework.calfacade.base.BwUnversionedDbentity
equals, getHref, getId, markUnsaved, setHref, setId, unsavedMethods inherited from class org.bedework.calfacade.base.DumpEntity
dump, dump, getLogger, hasDumpValueMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.bedework.util.logging.Logged
audit, debug, debug, debug, enableAuditLogger, enableErrorLogger, enableMetricsLogger, error, error, error, getLogLevel, info, isAuditLoggerEnabled, isErrorLoggerEnabled, isMetricsDebugEnabled, isMetricsLoggerEnabled, metrics, setLoggerClass, setLoggerClass, trace, trace, trace, warnMethods inherited from interface org.bedework.calfacade.base.XpropsEntity
getXnonskipProperties
-
Field Details
-
alarmTypeAudio
public static final int alarmTypeAudioaudio- See Also:
-
alarmTypeDisplay
public static final int alarmTypeDisplaydisplay- See Also:
-
alarmTypeEmail
public static final int alarmTypeEmailemail- See Also:
-
alarmTypeProcedure
public static final int alarmTypeProcedureprocedure- See Also:
-
alarmTypeNone
public static final int alarmTypeNonenone- See Also:
-
alarmTypeOther
public static final int alarmTypeOtherother - name in x-props- See Also:
-
alarmTypes
Names for type of alarm -
alarmType
protected int alarmType -
trigger
-
triggerStart
protected boolean triggerStart -
triggerDateTime
protected boolean triggerDateTime -
duration
-
repeat
protected int repeat -
repeatCount
protected int repeatCount -
expired
protected boolean expired -
attach
-
attendees
-
triggerDate
Calculated on a call to getTriggerDate()
-
-
Constructor Details
-
BwAlarm
public BwAlarm()Constructor
-
-
Method Details
-
setAlarmType
public void setAlarmType(int val) Set the alarmType for this eventThis corrresponds to the ACTION property but perhaps not close enough
- Parameters:
val- alarmType
-
getAlarmType
public int getAlarmType()Get the alarmType- Returns:
- int alarmType
-
setTrigger
Set the trigger - rfc format- Parameters:
val- String trigger value
-
getTrigger
Get the trigger in rfc format- Returns:
- String trigger value
-
setTriggerStart
public void setTriggerStart(boolean val) Set the triggerStart flag- Parameters:
val- boolean true if we trigger off start
-
getTriggerStart
public boolean getTriggerStart()Get the triggerStart flag- Returns:
- boolean true if we trigger off start
-
setTriggerDateTime
public void setTriggerDateTime(boolean val) Set the triggerDateTime flag- Parameters:
val- boolean true if we trigger off DateTime
-
getTriggerDateTime
public boolean getTriggerDateTime()Get the triggerDateTime flag- Returns:
- boolean true if we trigger off DateTime
-
setDuration
Set the duration - rfc format- Parameters:
val- String duration value
-
getDuration
Get the duration in rfc format- Returns:
- String duration value
-
setRepeat
public void setRepeat(int val) Set the repetition count for this alarm, 0 means no repeat, 1 means 2 alarms will be sent etc.- Parameters:
val- repetition count
-
getRepeat
public int getRepeat()Get the repetition count- Returns:
- int the repetition count
-
setRepeatCount
public void setRepeatCount(int val) Set the current repetition count for this alarm.- Parameters:
val- repetition count
-
getRepeatCount
public int getRepeatCount()Get the current repetition count- Returns:
- int the repetition count
-
setExpired
public void setExpired(boolean val) Set the expired flag- Parameters:
val- boolean true if the alarm has expired
-
getExpired
public boolean getExpired()Get the expired flag- Returns:
- boolean true if expired
-
setAttach
Set the attachment- Parameters:
val- String attachment name
-
getAttach
Get the attachment- Returns:
- String attachment name
-
getEntityType
public int getEntityType()- Returns:
- type of entity
-
setAttendees
Description copied from interface:AttendeesEntitySet the attendees Set- Specified by:
setAttendeesin interfaceAttendeesEntity- Parameters:
val- Set of attendees
-
getAttendees
Description copied from interface:AttendeesEntityGet the attendees- Specified by:
getAttendeesin interfaceAttendeesEntity- Returns:
- Set attendees list
-
getNumAttendees
public int getNumAttendees()- Specified by:
getNumAttendeesin interfaceAttendeesEntity- Returns:
- int number of attendees.
-
addAttendee
- Specified by:
addAttendeein interfaceAttendeesEntity
-
removeAttendee
- Specified by:
removeAttendeein interfaceAttendeesEntity- Returns:
- boolean true if removed.
-
copyAttendees
Description copied from interface:AttendeesEntityReturn a copy of the Set- Specified by:
copyAttendeesin interfaceAttendeesEntity- Returns:
- Set of BwAttendee
-
cloneAttendees
Description copied from interface:AttendeesEntityReturn a clone of the Set- Specified by:
cloneAttendeesin interfaceAttendeesEntity- Returns:
- Set of BwAttendee
-
setRecipients
Description copied from interface:AttendeesEntitySet the recipients Set- Specified by:
setRecipientsin interfaceAttendeesEntity- Parameters:
val- Set of (String)recipients
-
getRecipients
Description copied from interface:AttendeesEntityGet the recipients- Specified by:
getRecipientsin interfaceAttendeesEntity- Returns:
- Set recipients set
-
getNumRecipients
public int getNumRecipients()- Specified by:
getNumRecipientsin interfaceAttendeesEntity- Returns:
- int number of recipients.
-
addRecipient
- Specified by:
addRecipientin interfaceAttendeesEntity
-
removeRecipient
- Specified by:
removeRecipientin interfaceAttendeesEntity- Returns:
- boolean true if removed.
-
setDescriptions
Description copied from interface:DescriptionEntitySet the descriptions Set- Specified by:
setDescriptionsin interfaceDescriptionEntity<BwString>- Parameters:
val- Set of (BwString)descriptions
-
getDescriptions
Description copied from interface:DescriptionEntityGet the descriptions- Specified by:
getDescriptionsin interfaceDescriptionEntity<BwString>- Returns:
- Set descriptions set
-
getNumDescriptions
public int getNumDescriptions()- Specified by:
getNumDescriptionsin interfaceDescriptionEntity<BwString>- Returns:
- int number of descriptions.
-
addDescription
- Specified by:
addDescriptionin interfaceDescriptionEntity<BwString>
-
addDescription
- Specified by:
addDescriptionin interfaceDescriptionEntity<BwString>
-
removeDescription
- Specified by:
removeDescriptionin interfaceDescriptionEntity<BwString>- Returns:
- boolean true if removed.
-
updateDescriptions
Description copied from interface:DescriptionEntityIf description with given lang is present updates the value, otherwise adds it.- Specified by:
updateDescriptionsin interfaceDescriptionEntity<BwString>
-
findDescription
- Specified by:
findDescriptionin interfaceDescriptionEntity<BwString>- Returns:
- BwString with language code or default
-
setDescription
- Specified by:
setDescriptionin interfaceDescriptionEntity<BwString>- Parameters:
val- String default
-
getDescription
- Specified by:
getDescriptionin interfaceDescriptionEntity<BwString>- Returns:
- String default
-
setSummaries
Description copied from interface:SummaryEntitySet the summaries Set- Specified by:
setSummariesin interfaceSummaryEntity- Parameters:
val- Set of (BwString)summaries
-
getSummaries
Description copied from interface:SummaryEntityGet the summaries- Specified by:
getSummariesin interfaceSummaryEntity- Returns:
- Set summaries set
-
getNumSummaries
public int getNumSummaries()- Specified by:
getNumSummariesin interfaceSummaryEntity- Returns:
- int number of summaries.
-
addSummary
- Specified by:
addSummaryin interfaceSummaryEntity
-
removeSummary
- Specified by:
removeSummaryin interfaceSummaryEntity- Returns:
- boolean true if removed.
-
updateSummaries
Description copied from interface:SummaryEntityIf summary with given lang is present updates the value, otherwise adds it.- Specified by:
updateSummariesin interfaceSummaryEntity
-
findSummary
- Specified by:
findSummaryin interfaceSummaryEntity- Returns:
- BwString with language code or default
-
setSummary
- Specified by:
setSummaryin interfaceSummaryEntity- Parameters:
val- String default
-
getSummary
- Specified by:
getSummaryin interfaceSummaryEntity- Returns:
- String default
-
setXproperties
Description copied from interface:XpropsEntitySet the x-props- Specified by:
setXpropertiesin interfaceXpropsEntity- Parameters:
val- list of x-props
-
getXproperties
- Specified by:
getXpropertiesin interfaceXpropsEntity- Returns:
- List
-
getNumXproperties
public int getNumXproperties()- Specified by:
getNumXpropertiesin interfaceXpropsEntity- Returns:
- int
-
getXproperties
- Specified by:
getXpropertiesin interfaceXpropsEntity- Parameters:
val- - name to match- Returns:
- list of matching properties - never null
-
getXicalProperties
Find x-properties storing the value of the named ical property- Specified by:
getXicalPropertiesin interfaceXpropsEntity- Parameters:
val- - name to match- Returns:
- list of matching properties - never null
-
removeXproperties
Remove all instances of the named property.- Specified by:
removeXpropertiesin interfaceXpropsEntity- Parameters:
val- - name to match- Returns:
- number of removed proeprties
-
addXproperty
- Specified by:
addXpropertyin interfaceXpropsEntity- Parameters:
val- an x-prop
-
removeXproperty
- Specified by:
removeXpropertyin interfaceXpropsEntity- Parameters:
val- an x-prop
-
cloneXproperty
- Specified by:
cloneXpropertyin interfaceXpropsEntity- Returns:
- List of x-properties
-
getNextTriggerDate
Get the next trigger Date value. This is the next time for the alarm.This is based on the previous time which will have been set when the alarm was last triggered.
Returns null for no more triggers.
Can be called repeatedly for the same result. To move to the next trigger time, update repeatCount.
- Parameters:
start- for instance to base this onpreviousTrigger- null for first- Returns:
- Date next trigger time as a date object
- Throws:
CalFacadeException- on error
-
getTriggerDate
Get the trigger Date value. This is the earliest time for the alarm.- Returns:
- Date trigger time as a date object
- Throws:
CalFacadeException- on error
-
audioAlarm
public static BwAlarm audioAlarm(String owner, BwAlarm.TriggerVal trigger, String duration, int repeat, String attach) Make an audio alarm- Parameters:
owner- the hreftrigger- a TriggerValduration- String dur valuerepeat- countattach- attachment- Returns:
- BwEventAlarm
-
displayAlarm
public static BwAlarm displayAlarm(String owner, BwAlarm.TriggerVal trigger, String duration, int repeat, String description) Make a display alarm- Parameters:
owner- the hreftrigger- a TriggerValduration- String dur valuerepeat- countdescription- text- Returns:
- BwEventAlarm
-
emailAlarm
public static BwAlarm emailAlarm(String owner, BwAlarm.TriggerVal trigger, String duration, int repeat, String attach, String description, String summary, Set<BwAttendee> attendees) Make an email alarm- Parameters:
owner- the hreftrigger- a TriggerValduration- String dur valuerepeat- countattach- to senddescription- textsummary- textattendees- recipients- Returns:
- BwEventAlarm
-
procedureAlarm
public static BwAlarm procedureAlarm(String owner, BwAlarm.TriggerVal trigger, String duration, int repeat, String attach, String description) Make a procedure alarm- Parameters:
owner- the hreftrigger- a TriggerValduration- String dur valuerepeat- countattach- to senddescription- text- Returns:
- BwEventAlarm
-
noneAlarm
public static BwAlarm noneAlarm(String owner, BwAlarm.TriggerVal trigger, String duration, int repeat, String description) Make a "ACTION:NONE" alarm- Parameters:
owner- the hreftrigger- a TriggerValduration- String dur valuerepeat- countdescription- text- Returns:
- BwEventAlarm
-
otherAlarm
public static BwAlarm otherAlarm(String owner, String action, BwAlarm.TriggerVal trigger, String duration, int repeat, String description) Make an alarm for an unrecognizd action- Parameters:
owner- the hreftrigger- a TriggerValduration- String dur valuerepeat- countdescription- text- Returns:
- BwEventAlarm
-
toStringSegment
protected void toStringSegment(org.bedework.util.misc.ToString ts) Description copied from class:BwOwnedDbentityAdd our stuff to the ToString object- Overrides:
toStringSegmentin classBwOwnedDbentity<BwAlarm>- Parameters:
ts- ToString for result
-
matches
Here we attempt to see if an incomplete object matches this one. We match in order:
action, trigger, duration, repeatThe absence of duration and repeat in the pattern is a problem if there is one in the event set that has no duration/repeat and one that does.
- Parameters:
that- alarm to match- Returns:
- true if it matches.
-
changed
An alarm is equal for same event, owner, action and trigger.However, we also need to know if a particular alarm has been changed.
- Parameters:
that- alarm to check- Returns:
- boolean true if this alarm is changed with respect to that
-
compareEqFields
Compare fields that define equality- Parameters:
that- alarm to compare- Returns:
- int
-
differsFrom
Description copied from interface:DifferableReturn true if the entity differs in any way.- Specified by:
differsFromin interfaceDifferable<BwAlarm>- Returns:
- boolean
-
compareTo
- Specified by:
compareToin interfaceComparable<BwAlarm>- Overrides:
compareToin classBwUnversionedDbentity<BwAlarm>
-
hashCode
public int hashCode()- Overrides:
hashCodein classBwUnversionedDbentity<BwAlarm>
-
toString
-
clone
Description copied from class:BwUnversionedDbentityMake visible- Overrides:
clonein classBwUnversionedDbentity<BwAlarm>- Returns:
- Object of class T
-