Class FrequencyHelper
java.lang.Object
org.ametys.plugins.pagesubscription.FrequencyHelper
- All Implemented Interfaces:
Initializable
,Component
,LogEnabled
,Serviceable
public class FrequencyHelper
extends Object
implements Component, Serviceable, Initializable, LogEnabled
Helper for frequency
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
enableLogging
(Logger logger) static String
getCron
(FrequencyHelper.Frequency frequency, SubscriptionType.FrequencyTiming frequencyTiming) Get cron from frequency and timingstatic List<Expression>
getDateExpressions
(FrequencyHelper.Frequency frequency, ZonedDateTime notificationDate) Get the date expressions for a given frequency to get activities before the notification datestatic long
Get the default day of frequency (weekly or monthly)static String
Get the default time of frequency (daily, weekly or monthly)static I18nizableText
getFullLabel
(FrequencyHelper.Frequency frequency, List<BroadcastChannelHelper.BroadcastChannel> channels) Get full label with frequency and broadcast channelstatic I18nizableText
getFullLabel
(FrequencyHelper.Frequency frequency, List<BroadcastChannelHelper.BroadcastChannel> channels, SubscriptionType.FrequencyTiming timing) Get full label with frequency and broadcast channelstatic I18nizableText
getLabel
(FrequencyHelper.Frequency frequency) Get the label for the given frequencystatic ZonedDateTime
getNotificationDate
(FrequencyHelper.Frequency frequency, SubscriptionType.FrequencyTiming timing) Get the notification date for a given frequency and timingstatic I18nizableText
getSmartLabel
(FrequencyHelper.Frequency frequency) Get the smart label with day and hour of the given frequencystatic I18nizableText
getSmartLabel
(FrequencyHelper.Frequency frequency, SubscriptionType.FrequencyTiming timing) Get the smart label with day and hour of the given frequencygetTiming
(Subscription subscription) Get the frequency timing of the subscriptionvoid
static void
saxFrequencies
(ContentHandler contentHandler) SAX frequenciesvoid
service
(ServiceManager manager)
-
Field Details
-
_i18nUtils
The i18n utils
-
-
Constructor Details
-
FrequencyHelper
public FrequencyHelper()
-
-
Method Details
-
enableLogging
- Specified by:
enableLogging
in interfaceLogEnabled
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
getDefaultFrequencyDay
Get the default day of frequency (weekly or monthly)- Returns:
- the default day of frequency
-
getDefaultFrequencyTime
Get the default time of frequency (daily, weekly or monthly)- Returns:
- the default time of frequency
-
saxFrequencies
SAX frequencies- Parameters:
contentHandler
- the content handler to sax intos- Throws:
SAXException
- if an error occured while saxing
-
getLabel
Get the label for the given frequency- Parameters:
frequency
- the frequency- Returns:
- the label
-
getSmartLabel
Get the smart label with day and hour of the given frequency- Parameters:
frequency
- the frequency- Returns:
- the smart label
-
getSmartLabel
public static I18nizableText getSmartLabel(FrequencyHelper.Frequency frequency, SubscriptionType.FrequencyTiming timing) Get the smart label with day and hour of the given frequency- Parameters:
frequency
- the frequencytiming
- the frequency timing. Can be null to get the default config param- Returns:
- the smart label
-
getFullLabel
public static I18nizableText getFullLabel(FrequencyHelper.Frequency frequency, List<BroadcastChannelHelper.BroadcastChannel> channels) Get full label with frequency and broadcast channel- Parameters:
frequency
- the frequencychannels
- the broadcast channels- Returns:
- the frequency and broadcast channel label
-
getFullLabel
public static I18nizableText getFullLabel(FrequencyHelper.Frequency frequency, List<BroadcastChannelHelper.BroadcastChannel> channels, SubscriptionType.FrequencyTiming timing) Get full label with frequency and broadcast channel- Parameters:
frequency
- the frequencychannels
- the broadcast channelstiming
- the frequency timing of the full label. Can be null to get the default config param- Returns:
- the frequency and broadcast channel label
-
getTiming
Get the frequency timing of the subscription- Parameters:
subscription
- the subscription- Returns:
- the frequency timing
-
getCron
public static String getCron(FrequencyHelper.Frequency frequency, SubscriptionType.FrequencyTiming frequencyTiming) Get cron from frequency and timing- Parameters:
frequency
- the frequencyfrequencyTiming
- the timing- Returns:
- the cron expression
-
getDateExpressions
public static List<Expression> getDateExpressions(FrequencyHelper.Frequency frequency, ZonedDateTime notificationDate) Get the date expressions for a given frequency to get activities before the notification date- Parameters:
frequency
- the frequencynotificationDate
- the notification date- Returns:
- date expressions
-
getNotificationDate
public static ZonedDateTime getNotificationDate(FrequencyHelper.Frequency frequency, SubscriptionType.FrequencyTiming timing) Get the notification date for a given frequency and timing- Parameters:
frequency
- the frequencytiming
- the timing- Returns:
- the notification date
-