Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Provided Web Service

This Web Service allows other web applications to retrieve holidays based on different criteria.  Below outlines what holidays are considered and what web methods are provided.

...

  • We handle all holidays defined by DHRD (http://hawaii.gov/hrd) plus bank holidays(https://www.boh.com/customer-service/1035.asp)
    • New Year’s Day (Federal, UH, Bank)
    • Martin Luther King Jr. Day (Federal, UH, Bank)
    • President’s Day (Federal, UH, Bank)
    • Prince Kuhio Day (State, UH)
    • Good Friday (UH)
    • Memorial Day (Federal, UH, Bank)
    • King Kamehameha Day (State, UH)
    • Independence Day (Federal, UH, Bank)
    • Statehood Day (State, UH)
    • Labor Day (Federal, UH, Bank)Columbus Day
    • Discoverer's Day (Federal, Bank)
    • Veteran’s Day (Federal, UH, Bank)
    • Thanksgiving (Federal, UH, Bank)
    • Christmas (Federal, UH, Bank)
    • Election Day (Federal, UH, Bank)
  • All holidays are one day in length (since we ignore admin holidays and student breaks).
  • Changes to the holiday dates do not need to be tracked/logged.
  • All holidays will be categorized to these types: state/federal/bank/UH.
  • A holiday can be multiple types (e.g. all Federal holidays are also Bank UH holidays).
  • State Holidays are defined as those that are unique to the State of Hawaii, so State and Federal never overlap.

public class Holiday {
    private Date observedDate;
    private Date officialDate;
    private String description;
    private List<String> holidayTypes; // tells if it’s state/federal/bank/uhUH

    // basic getters/setters for above fields
    get/setObservedDate, get/setOfficialDate, get/setDescription, get/setHolidayTypes, isUHHoliday, isBankHoliday, isFederalHoliday, isStateHoliday,
    isHolidayOfType

...

  • boolean isObserved - Used to indicate if the user is referring to the date the holiday is observed (true), or the official date (false).
  • String type - An optional parameter through which the user can select which type of Holiday should be returned.  If it’s omitted, all Holiday types are returned.  TODO: determine if it would be worth anything to make this parameter a list so the user could select multiple types at once.  Don’t do this unless we have someone who would definitely use it.

List<String> getHolidayTypes() - returns a list of all holiday types so user can see which to use in the following methods.

boolean isHoliday(Date date, boolean isObserved, Optional String type) - tells whether a given date is a holiday or not of the given .

boolean isHoliday1(Date date, boolean isObserved, String type) - Same as isHoliday except with additional filter for holiday type.

Holiday getClosestHoliday(Date date, boolean searchForward, boolean isObserved, Optional String type) - if searchForward is true, it returns the first holiday of the given type that occurs after the given date, if false, it returns the nearest holiday of the given type that occurred before the given date.  If the given date is itself a holiday, return the nearest Holiday holiday other than itself.

Holiday getClosestHoliday1(Date date, boolean searchForward, boolean isObserved, String type) - same as getClosestHoliday except will only find the closest holiday of a specific type.

List<Holiday> getHolidaysInMonth(Date month, boolean isObserved, Optional String type) - gets all holidays in the given month and year, note the month argument must include a year.

List<Holiday> getHolidaysInYeargetHolidaysInMonth1(Date yearmonth, boolean isObserved, Optional String type) - same as getHolidaysInMonth except will only return holidays of the given type.

List<Holiday> getHolidaysInYear(Date year, boolean isObserved) - gets all holidays in the given year.

List<Holiday> getHolidaysInYear1(Date year, boolean isObserved, String type) - same as getHolidaysInYear except will only return holidays of the given type.

List<Holiday> getHolidaysInRange(Date startDate, Date endDate, boolean includeStartAndEnd, boolean isObserved, Optional String type) - gets all holidays within the given time frame, using the includeStartAndEnd param to determine whether or not to include the start and end dates among the return values.

List<Holiday> getHolidaysInRange1(Date startDate, Date endDate, boolean includeStartAndEnd, boolean isObserved, Optional String type) - same as getHolidaysInRange except will only return holidays of the given type.

Grails

This web service was developed in a Grails application.  This was a fairly straightforward process, only requiring a couple of things in order to get the service running after installation of Grails:

  1. Installation of the cxf plugin
    • This plugin is installed by using the line "compile ':cxf:0.9.0'" in the grails-app/conf/BuildConfig.groovy file
  2. Creation of the Web Service class edu.hawaii.its.holidayWebService.HolidayService.groovy in the grails-app/services directory.
  3. Adding the line "static expose=['cxf']" at the beginning of the class.  This allows each method to be treated as a web method.