SAP CC 1.0
API 4.2 (Core)

com.highdeal.calendar.hci
Class HolidayModel

java.lang.Object
  extended by com.highdeal.calendar.hci.HolidayModel
All Implemented Interfaces:
XMLMarshallable

public class HolidayModel
extends java.lang.Object
implements XMLMarshallable

This class represents the scheme of a holiday that is contained into a PublicHolidaysModel.


XML Schema Fragment
<xs:element name="holiday">
   <xs:complexType>
     <xs:sequence>
       <xs:element name="description" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="lang" type="xs:string" use="required"/>
          <xs:attribute name="label" type="xs:string" use="required"/>
        </xs:complexType>
      </xs:element>
      <xs:element name="group" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="code" type="xs:string" use="required"/>
        </xs:complexType>
      </xs:element>
      <xs:choice minOccurs="1" maxOccurs="1">
        <xs:element name="fixedDay" minOccurs="1" maxOccurs="1">
          <xs:complexType>
              <xs:attribute name="month" type="MonthType" use="required"/>
              <xs:attribute name="day" type="xs:integer" use="required"/>
          </xs:complexType>
        </xs:element>
        <xs:element name="relativeDay" minOccurs="1" maxOccurs="1">
          <xs:complexType>
              <xs:attribute name="month" type="MonthType" use="required"/>
              <xs:attribute name="weekday" type="WeekdayType" use="required"/>
              <xs:attribute name="position" type="PositionType" use="required"/>
          </xs:complexType>
        </xs:element>
        <xs:element name="easterRelativeDay" minOccurs="1" maxOccurs="1">
          <xs:complexType>
              <xs:attribute name="offset" type="xs:integer" use="required"/>
          </xs:complexType>
        </xs:element>
        <xs:element name="enumeratedDay" minOccurs="1" maxOccurs="1">
          <xs:complexType>
            <xs:sequence>
            <xs:element name="date" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:attribute name="value" type="xs:date"/>
              </xs:complexType>
            </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:choice>
     </xs:sequence>
     <xs:attribute name="code" type="xs:string" use="required"/>
   </xs:complexType>
 </xs:element>
<xs:simpleType name="MonthType">
   <xs:restriction base="xs:string">
      <xs:enumeration value="January"/>
      <xs:enumeration value="February"/>
      <xs:enumeration value="March"/>
      <xs:enumeration value="April"/>
      <xs:enumeration value="May"/>
      <xs:enumeration value="June"/>
      <xs:enumeration value="July"/>
      <xs:enumeration value="August"/>
      <xs:enumeration value="September"/>
      <xs:enumeration value="October"/>
      <xs:enumeration value="November"/>
      <xs:enumeration value="December"/>
   </xs:restriction>
 </xs:simpleType>
<xs:simpleType name="WeekdayType">
   <xs:restriction base="xs:string">
      <xs:enumeration value="Sunday"/>
      <xs:enumeration value="Monday"/>
      <xs:enumeration value="Tuesday"/>
      <xs:enumeration value="Wednesday"/>
      <xs:enumeration value="Thursday"/>
      <xs:enumeration value="Friday"/>
      <xs:enumeration value="Saturday"/>
   </xs:restriction>
 </xs:simpleType>
<xs:simpleType name="PositionType">
   <xs:restriction base="xs:string">
      <xs:enumeration value="last"/>
      <xs:enumeration value="first"/>
      <xs:enumeration value="second"/>
      <xs:enumeration value="third"/>
      <xs:enumeration value="fourth"/>
      <xs:enumeration value="fifth"/>
   </xs:restriction>
 </xs:simpleType>

Nested Class Summary
static interface HolidayModel.DayDefinition
          This interface is implemented by classes that define a day.
static class HolidayModel.EasterRelativeDay
          This class enables to define day which is relative to Easter Sunday.
static class HolidayModel.EnumeratedDay
          This class enables to define a enumerated day, that is to say a day given by an enumeration of precise date (including year).
static class HolidayModel.FixedDay
          This class enables to define a fixed day, that is to say a day given by a fixed date, same date each year (such as New Year Day, for instance).
static class HolidayModel.RelativeDay
          This class enables to define a relative day, that is to say a day given by a week day position in a month (e.g.
 
Field Summary
static int EASTER_RELATIVE_TYPE
          Constant used for type of HolidayModel.EasterRelativeDay.
static int ENUM_TYPE
          Constant used for type of HolidayModel.EnumeratedDay.
static int FIX_TYPE
          Constant used for type of HolidayModel.FixedDay.
static java.lang.String[] MONTHS
          An array containing the valid months names, defined as: MONTHS[0] is "January" MONTHS[1] is "February" MONTHS[2] is "March" MONTHS[3] is "April" MONTHS[4] is "May" MONTHS[5] is "June" MONTHS[6] is "July" MONTHS[7] is "August" MONTHS[8] is "September" MONTHS[9] is "October" MONTHS[10] is "November" MONTHS[11] is "December"
static java.lang.String[] POSITIONS
          An array containing the valid position names, defined as: POSITIONS[0] is "last" POSITIONS[1] is "first" POSITIONS[2] is "second" POSITIONS[3] is "third" POSITIONS[4] is "fourth" POSITIONS[5] is "fifth"
static int RELATIVE_TYPE
          Constant used for type of HolidayModel.RelativeDay.
static java.lang.String[] WEEKDAYS
          An array containing the valid weekday names, defined as: WEEKDAYS[0] is "Sunday" WEEKDAYS[1] is "Monday" WEEKDAYS[2] is "Tuesday" WEEKDAYS[3] is "Wednesday" WEEKDAYS[4] is "Thursday" WEEKDAYS[5] is "Friday" WEEKDAYS[6] is "Saturday"
 
Constructor Summary
HolidayModel()
          Builds a new empty model.
 
Method Summary
 void addCharacterData(java.lang.String cData)
          Adds character data to the content element.
 void addChild(java.lang.String tagName, XMLMarshallable child)
          Adds a child to the objects, the child represents the marshallable object to be added into the content tree.
 void checkValidity()
          Verifies this HolidayModel is valid.
 java.lang.String getCode()
          Gets the code of this HolidayModel.
 HolidayModel.DayDefinition getDayDefinition()
          Returns the DayDefinition of this.
 java.lang.String getDescription(java.lang.String language)
          Gets the description associated with the given language, if exists.
 java.util.Properties getDescriptions()
          Returns all set descriptions, as a Properties with languages as key and descriptions as values.
 java.util.Vector<java.lang.String> getGroups()
          Returns the list of the codes of groups to which this HolidayModel belongs.
 boolean isInGroup(java.lang.String group)
          Tests is this belongs to the given group
 void marshal(XMLOutputter output)
          Gives an XML representation of this object, and of its children.
 void setAttributes(XMLAttributes atts)
          Sets the attributes of the XML representation of the tag beeing processed.
 void setCode(java.lang.String code)
          Sets the code of this HolidayModel.
 void setDayDefinition(HolidayModel.DayDefinition dayDefinition)
          Sets the DayDefinition of this.
 void setDescription(java.lang.String language, java.lang.String label)
          Sets a description associated with a language.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIX_TYPE

public static final int FIX_TYPE
Constant used for type of HolidayModel.FixedDay.

See Also:
Constant Field Values

RELATIVE_TYPE

public static final int RELATIVE_TYPE
Constant used for type of HolidayModel.RelativeDay. Internal use only.

See Also:
Constant Field Values

EASTER_RELATIVE_TYPE

public static final int EASTER_RELATIVE_TYPE
Constant used for type of HolidayModel.EasterRelativeDay. Internal use only.

See Also:
Constant Field Values

ENUM_TYPE

public static final int ENUM_TYPE
Constant used for type of HolidayModel.EnumeratedDay. Internal use only.

See Also:
Constant Field Values

MONTHS

public static final java.lang.String[] MONTHS
An array containing the valid months names, defined as:


WEEKDAYS

public static final java.lang.String[] WEEKDAYS
An array containing the valid weekday names, defined as:


POSITIONS

public static final java.lang.String[] POSITIONS
An array containing the valid position names, defined as:

Constructor Detail

HolidayModel

public HolidayModel()
Builds a new empty model.

Method Detail

getCode

public java.lang.String getCode()
Gets the code of this HolidayModel.

Returns:
the code of this HolidayModel.

setCode

public void setCode(java.lang.String code)
Sets the code of this HolidayModel.

Parameters:
code - the code of this HolidayModel.

getGroups

public java.util.Vector<java.lang.String> getGroups()
Returns the list of the codes of groups to which this HolidayModel belongs.

Returns:
the list of the codes of groups to which this HolidayModel belongs.

setDescription

public void setDescription(java.lang.String language,
                           java.lang.String label)
Sets a description associated with a language.

Parameters:
language - the language of the label, should be given as ISO-639 code.
label - the label associated with the given language.

getDescription

public java.lang.String getDescription(java.lang.String language)
Gets the description associated with the given language, if exists.

Parameters:
language -
Returns:
the description associated with the given language, if exists, null otherwise.

getDescriptions

public java.util.Properties getDescriptions()
Returns all set descriptions, as a Properties with languages as key and descriptions as values.

Returns:
a Properties with languages as key and descriptions as values.

getDayDefinition

public HolidayModel.DayDefinition getDayDefinition()
Returns the DayDefinition of this.

Returns:
the DayDefinition of this.

setDayDefinition

public void setDayDefinition(HolidayModel.DayDefinition dayDefinition)
Sets the DayDefinition of this.

Parameters:
dayDefinition - the DayDefinition of this.

isInGroup

public boolean isInGroup(java.lang.String group)
Tests is this belongs to the given group

Parameters:
group - the code of the group to test
Returns:
true if this belongs to the given group, false otherwise.

setAttributes

public void setAttributes(XMLAttributes atts)
Description copied from interface: XMLMarshallable
Sets the attributes of the XML representation of the tag beeing processed.

Specified by:
setAttributes in interface XMLMarshallable
Parameters:
atts - the XML attributes of the current tag.

addChild

public void addChild(java.lang.String tagName,
                     XMLMarshallable child)
Description copied from interface: XMLMarshallable
Adds a child to the objects, the child represents the marshallable object to be added into the content tree.

Specified by:
addChild in interface XMLMarshallable
Parameters:
tagName - the name of tag for the child.
child - the child to be added.

addCharacterData

public void addCharacterData(java.lang.String cData)
Description copied from interface: XMLMarshallable
Adds character data to the content element.

Specified by:
addCharacterData in interface XMLMarshallable
Parameters:
cData - the character data to be added.

marshal

public void marshal(XMLOutputter output)
Description copied from interface: XMLMarshallable
Gives an XML representation of this object, and of its children.

Specified by:
marshal in interface XMLMarshallable
Parameters:
output - the XML output to marshall the object into.

checkValidity

public void checkValidity()
                   throws InvalidHolidayException
Verifies this HolidayModel is valid. An InvalidHolidayException is thrown in the following cases:

Throws:
InvalidHolidayException
See Also:
HolidayModel.DayDefinition.checkValidity()

SAP CC 1.0
API 4.2 (Core)


API Reference - July 2009

SAP Convergent Charging 1.0 (build R4.2.1.35.0.0)
CONVERGENT CHARGING 4.2

(c) Copyright 2009 SAP AG. All rights reserved.