Package org.silverpeas.core.reminder
Class DateTimeReminder
- java.lang.Object
-
- org.silverpeas.core.persistence.datasource.model.jpa.AbstractJpaEntity<E,I>
-
- org.silverpeas.core.persistence.datasource.model.jpa.BasicJpaEntity<Reminder,ReminderIdentifier>
-
- org.silverpeas.core.reminder.Reminder
-
- org.silverpeas.core.reminder.DateTimeReminder
-
- All Implemented Interfaces:
Serializable
,IdentifiableEntity
@Entity public class DateTimeReminder extends Reminder
A reminder about any contribution that is triggered at a specified date time.- Author:
- mmoquillon
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.silverpeas.core.reminder.Reminder
Reminder.ReminderBuilder
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DateTimeReminder()
Empty constructors for the persistence engine.DateTimeReminder(ContributionIdentifier contributionId, User user, ReminderProcessName processName)
Constructs a new reminder about the specified contribution and for the given user.DateTimeReminder(ContributionIdentifier contributionId, ReminderProcessName processName)
Constructs a new reminder about the given contribution for the system.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected OffsetDateTime
computeTriggeringDate()
Computes the date time at which this reminder will be triggered.Reminder
copy()
Copies this reminder to another one.boolean
equals(Object o)
OffsetDateTime
getDateTime()
Gets the datetime at which the trigger of this reminder is set.int
hashCode()
DateTimeReminder
triggerAt(OffsetDateTime dateTime)
Triggers this reminder at the specified date time.DateTimeReminder
triggerFrom(String temporalProperty)
Triggers this reminder from the temporal property of the contribution.DateTimeReminder
withText(String text)
Sets a text with this reminder.-
Methods inherited from class org.silverpeas.core.reminder.Reminder
getByContribution, getByContributionAndUser, getById, getByUser, getContribution, getContributionId, getContributionProperty, getProcessName, getScheduledDateTime, getText, getUserId, isSchedulable, isScheduled, isSystemUser, isTriggered, make, schedule, triggered, unschedule
-
Methods inherited from class org.silverpeas.core.persistence.datasource.model.jpa.BasicJpaEntity
performBeforePersist, performBeforeRemove, performBeforeUpdate
-
Methods inherited from class org.silverpeas.core.persistence.datasource.model.jpa.AbstractJpaEntity
getId, getNativeId, isPersisted, setId
-
-
-
-
Constructor Detail
-
DateTimeReminder
public DateTimeReminder(ContributionIdentifier contributionId, ReminderProcessName processName)
Constructs a new reminder about the given contribution for the system.- Parameters:
contributionId
- the unique identifier of a contribution.processName
- the name of the process the reminder MUST perform when triggered.
-
DateTimeReminder
public DateTimeReminder(ContributionIdentifier contributionId, User user, ReminderProcessName processName)
Constructs a new reminder about the specified contribution and for the given user.- Parameters:
contributionId
- the unique identifier of the contribution.user
- the user aimed by this reminder.processName
- the name of the process the reminder MUST perform when triggered.
-
DateTimeReminder
protected DateTimeReminder()
Empty constructors for the persistence engine.
-
-
Method Detail
-
copy
public Reminder copy()
Description copied from class:Reminder
Copies this reminder to another one. This method expects the concrete class extending theReminder
abstract one implements a default constructor as it is used to constructs an emptyReminder
instance before setting the attributes. Any concrete reminders should override this method in order to set their specifics attributes.
-
withText
public final DateTimeReminder withText(String text)
Description copied from class:Reminder
Sets a text with this reminder. The text will be sent with the notification to the user.
-
triggerAt
public DateTimeReminder triggerAt(OffsetDateTime dateTime)
Triggers this reminder at the specified date time. The timezone of the specified date time will be set in the timezone of the user behind this reminder.- Parameters:
dateTime
- the date time at which this reminder will be triggered once scheduled.- Returns:
- itself.
-
triggerFrom
public DateTimeReminder triggerFrom(String temporalProperty)
Triggers this reminder from the temporal property of the contribution. The timezone of the computed date time will be set in the timezone of the user behind this reminder.- Parameters:
temporalProperty
- the temporal property of the contribution.- Returns:
- itself.
-
getDateTime
public OffsetDateTime getDateTime()
Gets the datetime at which the trigger of this reminder is set. The returned datetime is based upon the timezone of the user behind this reminder.- Returns:
- the datetime of this reminder's trigger.
-
computeTriggeringDate
protected OffsetDateTime computeTriggeringDate()
Description copied from class:Reminder
Computes the date time at which this reminder will be triggered. This method is invoked inReminder.schedule()
in order to plan the trigger of this reminder in the timeline. The triggering datetime is computed from the triggering rule that is specific to the concrete type of this reminder. The timezone of the returned triggering date has to be set with the timezone of the user behind the reminder.- Overrides:
computeTriggeringDate
in classReminder
- Returns:
- an
OffsetDateTime
value.
-
-