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 TypeMethodDescriptionvoidenableLogging(Logger logger) static StringgetCron(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 longGet the default day of frequency (weekly or monthly)static StringGet the default time of frequency (daily, weekly or monthly)static I18nizableTextgetFullLabel(FrequencyHelper.Frequency frequency, List<BroadcastChannelHelper.BroadcastChannel> channels) Get full label with frequency and broadcast channelstatic I18nizableTextgetFullLabel(FrequencyHelper.Frequency frequency, List<BroadcastChannelHelper.BroadcastChannel> channels, SubscriptionType.FrequencyTiming timing) Get full label with frequency and broadcast channelstatic I18nizableTextgetLabel(FrequencyHelper.Frequency frequency) Get the label for the given frequencystatic ZonedDateTimegetNotificationDate(FrequencyHelper.Frequency frequency, SubscriptionType.FrequencyTiming timing) Get the notification date for a given frequency and timingstatic I18nizableTextgetSmartLabel(FrequencyHelper.Frequency frequency) Get the smart label with day and hour of the given frequencystatic I18nizableTextgetSmartLabel(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 subscriptionvoidstatic voidsaxFrequencies(ContentHandler contentHandler) SAX frequenciesvoidservice(ServiceManager manager)
-
Field Details
-
_i18nUtils
The i18n utils
-
-
Constructor Details
-
FrequencyHelper
public FrequencyHelper()
-
-
Method Details
-
enableLogging
- Specified by:
enableLoggingin interfaceLogEnabled
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
initialize
- Specified by:
initializein 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
-