Class RecurrenceRule

java.lang.Object
org.apache.ofbiz.service.calendar.RecurrenceRule

public class RecurrenceRule extends Object
Recurrence Rule Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Frequency DAILY
    static final int
    Frequency HOURLY
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
    Frequency MINUTELY
    static final int
    Frequency MONTHLY
    static final int
    Frequency SECONDLY
    static final int
    Frequency WEEKLY
    static final int
    Frequency YEARLY
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new RecurrenceRule object from a RecurrenceInfo entity.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Get the number of times this recurrence will run (-1 until end time).
    long
    Gets the end time of the recurrence rule or 0 if none.
    int
    Returns the frequency of this recurrence.
    Returns the frequency name of the recurrence.
    long
    Returns the interval of the frequency.
    int
    Returns the interval of the frequency as an int.
    void
    Initializes the rules for this RecurrenceInfo object.
    boolean
    isValid(long startTime, long dateTime)
    Tests the date to see if it falls within the rules
    boolean
    isValid(Date startDate, Date date)
    Tests the date to see if it falls within the rules
    makeRule(Delegator delegator, int frequency, int interval, int count)
     
    makeRule(Delegator delegator, int frequency, int interval, int count, long endTime)
     
    makeRule(Delegator delegator, int frequency, int interval, long endTime)
     
    long
    next(long startTime, long fromTime, long currentCount)
    Returns the next recurrence of this rule.
    Primary key string.
    void
    Removes this rule from the persistant store.
    long
    validCurrent(long startTime, long checkTime, long currentCount)
    Gets the current recurrence (current for the checkTime) of this rule and returns it if it is valid.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • init

      public void init() throws RecurrenceRuleException
      Initializes the rules for this RecurrenceInfo object.
      Throws:
      RecurrenceRuleException
    • getEndTime

      public long getEndTime()
      Gets the end time of the recurrence rule or 0 if none.
      Returns:
      long The timestamp of the end time for this rule or 0 for none.
    • getCount

      public long getCount()
      Get the number of times this recurrence will run (-1 until end time).
      Returns:
      long The number of time this recurrence will run.
    • getFrequencyName

      public String getFrequencyName()
      Returns the frequency name of the recurrence.
      Returns:
      String The name of this frequency.
    • getFrequency

      public int getFrequency()
      Returns the frequency of this recurrence.
      Returns:
      int The reference value for the frequency
    • getInterval

      public long getInterval()
      Returns the interval of the frequency.
      Returns:
      long Interval value
    • getIntervalInt

      public int getIntervalInt()
      Returns the interval of the frequency as an int.
      Returns:
      The interval of this frequency as an integer.
    • next

      public long next(long startTime, long fromTime, long currentCount)
      Returns the next recurrence of this rule.
      Parameters:
      startTime - The time this recurrence first began.
      fromTime - The time to base the next recurrence on.
      currentCount - The total number of times the recurrence has run.
      Returns:
      long The next recurrence as a long.
    • validCurrent

      public long validCurrent(long startTime, long checkTime, long currentCount)
      Gets the current recurrence (current for the checkTime) of this rule and returns it if it is valid. If the current recurrence is not valid, doesn't try to find a valid one, instead returns 0.
      Parameters:
      startTime - The time this recurrence first began.
      checkTime - The time to base the current recurrence on.
      currentCount - The total number of times the recurrence has run.
      Returns:
      long The current recurrence as long if valid. If next recurrence is not valid, returns 0.
    • isValid

      public boolean isValid(Date startDate, Date date)
      Tests the date to see if it falls within the rules
      Parameters:
      startDate - date object to test
      Returns:
      True if the date is within the rules
    • isValid

      public boolean isValid(long startTime, long dateTime)
      Tests the date to see if it falls within the rules
      Parameters:
      startTime - date object to test
      Returns:
      True if the date is within the rules
    • remove

      public void remove() throws RecurrenceRuleException
      Removes this rule from the persistant store.
      Throws:
      RecurrenceRuleException
    • primaryKey

      public String primaryKey()
      Primary key string.
      Returns:
      the string
    • makeRule

      public static RecurrenceRule makeRule(Delegator delegator, int frequency, int interval, int count) throws RecurrenceRuleException
      Throws:
      RecurrenceRuleException
    • makeRule

      public static RecurrenceRule makeRule(Delegator delegator, int frequency, int interval, long endTime) throws RecurrenceRuleException
      Throws:
      RecurrenceRuleException
    • makeRule

      public static RecurrenceRule makeRule(Delegator delegator, int frequency, int interval, int count, long endTime) throws RecurrenceRuleException
      Throws:
      RecurrenceRuleException