Package com.uc4.api.objects
Class YearlyCalendarKeyword
- java.lang.Object
-
- com.uc4.api.objects.CalendarKeyword
-
- com.uc4.api.objects.YearlyCalendarKeyword
-
public class YearlyCalendarKeyword extends CalendarKeyword
This class represents a yearly Calendar Keyword.
-
-
Constructor Summary
Constructors Modifier Constructor Description YearlyCalendarKeyword(UC4ObjectName name)
Constructs a newYearlyCalendarKeyword
.YearlyCalendarKeyword(UC4ObjectName name, int nYear, int startWithYear)
Constructs a newYearlyCalendarKeyword
.protected
YearlyCalendarKeyword(org.w3c.dom.Element keyword, java.lang.String string)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDate(DateTime date)
Adds a date to the selected dates.DateTime
getIntervalEndDate()
Returns the end date of the interval.int
getIntervalEveryDay()
Returns the interval in days.DateTime
getIntervalStartDate()
Returns the start date of the interval.int
getNYear()
Returns the interval in years.int
getStartYear()
Returns the start year for the interval.boolean
hasDefinedInterval()
Returnstrue
if this yearly keyword has a defined interval.void
inDefinedInterval(int everyNday, boolean beginOfYear, DateTime start, DateTime end)
Defines an interval for this yearly keyword.boolean
isGroup()
Returnstrue
if this is a group keyword.boolean
isIntervalBeginOfYear()
Returnstrue
if the beginning of the year is set for the interval.boolean
isMonthly()
Returnstrue
if this is a monthly keyword.boolean
isOnDefinedCalendarDays()
Returnstrue
if the definition of calendar days is selected.boolean
isRoll()
Returnstrue
if this is a roll keyword.boolean
isStatic()
Returnstrue
if this is a static keyword.boolean
isWeekly()
Returnstrue
if this is a weekly keyword.boolean
isYearly()
Returnstrue
if this is a yearly keyword.void
removeAllDates()
Removes all selected dates.boolean
removeDate(DateTime date)
Removes the specified date from the selected dates.protected void
save(com.uc4.util.XMLDocument doc, org.w3c.dom.Element parent)
Saves the keyword under the specified parent elementjava.util.Iterator<DateTime>
selectedDates()
Returns an iterator overDateTime
.void
selectOnDefinedCalendarDays()
If this method is called the selected calendar days are used.void
setNYear(int nYear)
Sets the interval in years.void
setStartYear(int startYear)
Sets the start year for the interval.-
Methods inherited from class com.uc4.api.objects.CalendarKeyword
containsDate, equals, getCalendarName, getErrorMessageInsert, getErrorMessageNumber, getErrorText, getName, getPreCalculatedDates, hashCode, invalidateCalculatedDates, loadCalculatedDays, setCalendarName, setErrorMessageInsert, setErrorMessageNumber, setErrorText, setName, toString
-
-
-
-
Constructor Detail
-
YearlyCalendarKeyword
protected YearlyCalendarKeyword(org.w3c.dom.Element keyword, java.lang.String string)
-
YearlyCalendarKeyword
public YearlyCalendarKeyword(UC4ObjectName name, int nYear, int startWithYear)
Constructs a newYearlyCalendarKeyword
.- Parameters:
name
- Name of the calendar keywordnYear
- Every n year, integer between 1 and 1000startWithYear
- Year to start with, integer between 1 and 3000
-
YearlyCalendarKeyword
public YearlyCalendarKeyword(UC4ObjectName name)
Constructs a newYearlyCalendarKeyword
. The interval is set to 1 starting with the current year.- Parameters:
name
- Name of the calendar keyword
-
-
Method Detail
-
selectOnDefinedCalendarDays
public void selectOnDefinedCalendarDays()
If this method is called the selected calendar days are used. The definition of calendar days is the default this method should only be called if an interval was set (inDefinedInterval
).
-
isOnDefinedCalendarDays
public boolean isOnDefinedCalendarDays()
Returnstrue
if the definition of calendar days is selected.- Returns:
- Boolean which is set to false if an interval is selected
-
selectedDates
public java.util.Iterator<DateTime> selectedDates()
Returns an iterator overDateTime
. This iterator can be used to read the selected dates and remove dates using the remove method of theIterator
.- Returns:
- Iterator over DateTime
-
addDate
public void addDate(DateTime date)
Adds a date to the selected dates.- Parameters:
date
- Date
-
removeDate
public boolean removeDate(DateTime date)
Removes the specified date from the selected dates.- Parameters:
date
- Date- Returns:
- True if and only if the date was successfully removed
-
removeAllDates
public void removeAllDates()
Removes all selected dates.
-
inDefinedInterval
public void inDefinedInterval(int everyNday, boolean beginOfYear, DateTime start, DateTime end)
Defines an interval for this yearly keyword.- Parameters:
everyNday
- Every n day, integer between 1 and 365beginOfYear
- Direction for day counting, true means that every n day from the beginning of the year is countedstart
- Start dateend
- End date
-
isIntervalBeginOfYear
public boolean isIntervalBeginOfYear()
Returnstrue
if the beginning of the year is set for the interval.- Returns:
- Boolean which contains false if the counting starts at the end of the year
-
getIntervalEndDate
public DateTime getIntervalEndDate()
Returns the end date of the interval.- Returns:
- End date of the interval
-
getIntervalEveryDay
public int getIntervalEveryDay()
Returns the interval in days.- Returns:
- Interval in days
-
getIntervalStartDate
public DateTime getIntervalStartDate()
Returns the start date of the interval.- Returns:
- Start date of the interval
-
hasDefinedInterval
public boolean hasDefinedInterval()
Returnstrue
if this yearly keyword has a defined interval. If this method returnsfalse
single dates are selected for this yearly keyword.- Returns:
- Boolean which is set to true if an interval is defined
-
getNYear
public int getNYear()
Returns the interval in years.- Returns:
- Integer containg the inverval in years
-
setNYear
public void setNYear(int nYear)
Sets the interval in years.- Parameters:
nYear
- Integer containg the inverval in years
-
getStartYear
public int getStartYear()
Returns the start year for the interval.- Returns:
- Integer containg the start year
-
setStartYear
public void setStartYear(int startYear)
Sets the start year for the interval.- Parameters:
startYear
- Integer containg the start year
-
isStatic
public boolean isStatic()
Description copied from class:CalendarKeyword
Returnstrue
if this is a static keyword.- Specified by:
isStatic
in classCalendarKeyword
- Returns:
- Boolean containing true in case of a static keyword
-
isWeekly
public boolean isWeekly()
Description copied from class:CalendarKeyword
Returnstrue
if this is a weekly keyword.- Specified by:
isWeekly
in classCalendarKeyword
- Returns:
- Boolean containing true in case of a weekly keyword
-
isMonthly
public boolean isMonthly()
Description copied from class:CalendarKeyword
Returnstrue
if this is a monthly keyword.- Specified by:
isMonthly
in classCalendarKeyword
- Returns:
- Boolean containing true in case of a monthly keyword
-
isYearly
public boolean isYearly()
Description copied from class:CalendarKeyword
Returnstrue
if this is a yearly keyword.- Specified by:
isYearly
in classCalendarKeyword
- Returns:
- Boolean containing true in case of a yearly keyword
-
isGroup
public boolean isGroup()
Description copied from class:CalendarKeyword
Returnstrue
if this is a group keyword.- Specified by:
isGroup
in classCalendarKeyword
- Returns:
- Boolean containing true in case of a group keyword
-
isRoll
public boolean isRoll()
Description copied from class:CalendarKeyword
Returnstrue
if this is a roll keyword.- Specified by:
isRoll
in classCalendarKeyword
- Returns:
- Boolean containing true in case of a roll keyword
-
save
protected void save(com.uc4.util.XMLDocument doc, org.w3c.dom.Element parent)
Description copied from class:CalendarKeyword
Saves the keyword under the specified parent element- Specified by:
save
in classCalendarKeyword
- Parameters:
doc
- XML Documentparent
- Parent element
-
-