com.arsdigita.acs.calendar
Class CalendarProcs

java.lang.Object
  |
  +--com.arsdigita.acs.calendar.CalendarProcs

public class CalendarProcs
extends Object

This is the first pass at the Java version of the Calendar package. Right now, this is pretty much a straight port. Near term future plans:

  1. Finish up the few areas that are not finished (some groups/portals stuff, repeating events stuff, attachments)
  2. Break the index.jsp page up into several littler pages that include each other as needed
  3. Move the hairier SQL into views and PL/SQL
  4. Build good Java classes to provide a simple interface for adding items, loading items, etc via Java.
In short, the data model should stay the same. Everything else will be moved around, and some parts will be totally gutted. Diffs from TCL API: TODO:


Constructor Summary
CalendarProcs()
           
 
Method Summary
static String[] buildWeekMap(String forDate, String dayDateTarget, String dayDateHREFAppend, Integer groupId, boolean noLinkForCurrentDate)
          Assigns days to days of the week in a given month.
static String calendarDayView(CalendarInfo calendarInfo, String currentDate, Integer loggedInUserId, Integer groupId, String compressDayViewP, Integer beginCalHour, Integer endCalHour)
          Generates the HTML for a day view.
static String calendarDayView(CalendarInfo calendarInfo, String currentDate, Integer loggedInUserId, Integer groupId, String compressDayViewP, Integer beginCalHour, Integer endCalHour, String viewMode)
           
static String calendarDayView(CalendarInfo calendarInfo, String currentDate, Integer loggedInUserId, Integer groupId, String compressDayViewP, Integer beginCalHour, Integer endCalHour, String viewMode, String addLink)
           
static Integer calendarFolderId(Integer userId, Integer groupId)
          Gets id of calendar's file-storage folder for specified group.
static String calendarMonthEmptyDays(CalendarInfo calendarInfo, String month, Vector monthList, int baseJulianDate, int startJulianDate, int endJulianDate)
          Generate HTML for calendar month days containing no items.
static String calendarViewTitle(HttpServletRequest request)
          Returns view title bar (a small table with title & left & right linked arrows).
static String calendarWeekEmptyDays(CalendarInfo calendarInfo, Vector weekDays, int baseJulianDate, int startJulianDate, int endJulianDate)
          Generate HTML for calendar week days containing no items.
static String calMiniCalendarWidget(String baseURL)
           
static String calMiniCalendarWidget(String baseURL, String currentView)
           
static String calMiniCalendarWidget(String baseURL, String currentView, String currentDate)
           
static String calMiniCalendarWidget(String baseURL, String currentView, String currentDate, Integer groupId)
          This proc creates a mini calendar useful for navigating various calendar views.
static String calMiniMonthCalendar(String currentYear, String month)
           
static String calMiniMonthCalendar(String currentYear, String month, Integer groupId)
           
static String calMiniMonthCalendar(String currentYear, String month, Integer groupId, String viewMode)
          This proc creates a mini month calendar useful for navigating on a month calendar.
static String calPrettyCurrentDate(String current_date, Database db)
          Yet another pretty date function.
static String calRelatedURLHtml(String title, String name, String url, String text)
          Builds HREF string for related URLs.
static String calYearCalendar(Integer groupId, String viewMode, String currentYear, String currentDate)
          Generates the HTML for 12 mini calendar widgets, 3 across and 4 down.
static String displayMonthItem(CalendarInfo calendarInfo, String startDate)
          Displays calendar items for a particular day of the month for user or group.
static String displayNew(CalendarInfo calendarInfo, Integer newItemsAge)
           
static String displayNew(CalendarInfo calendarInfo, Integer newItemsAge, String orderBy)
          Display items added in the last new_items_age days.
static String displayUpcoming(CalendarInfo calendarInfo, Integer upcomingItemsDays, Integer pastItemsDays, String upcomingItemsLength, String orderby)
          Displays list of calendar items for the next upcoming_items_days and in to the past for past_items_day.
static String formatDateTimeString(String value, String granularity)
           
static String formatDateTimeString(String value, String granularity, boolean useAmPm)
           
static String formatDateTimeString(String value, String granularity, boolean useAmPm, boolean showDate)
           
static String formatDateTimeString(String value, String granularity, boolean useAmPm, boolean showDate, String dateTimeSep)
          Formats date/time See description of getWidgetDatetime
static String getCategoriesWidget()
           
static String getCategoriesWidget(String scope, Integer id)
           
static String getCategoriesWidget(String scope, Integer id, Vector defaultCategoryIdList)
           
static String getCategoriesWidget(String scope, Integer id, Vector defaultCategoryIdList, String defaultReturn)
           
static String getCategoriesWidget(String scope, Integer id, Vector defaultCategoryIdList, String defaultReturn, int selectSize)
           
static String getCategoriesWidget(String scope, Integer id, Vector defaultCategoryIdList, String defaultReturn, int selectSize, String varName)
           
static String getLeadingZeros(Integer number, int nDesiredDigits)
          Adds leading zeros to a String to give it the desired number of digits.
static String getLeadingZeros(int number, int nDesiredDigits)
          Adds leading zeros to an int to give it the desired number of digits.
static String[] getMonthNames()
          Non-internationalized version of calendar_util_month_names_by_locale.
static String getWidgetDatetime(String name, String value, String granularity)
           
static String getWidgetDatetime(String name, String value, String granularity, boolean useAmPm)
           
static String getWidgetDatetime(String name, String value, String granularity, boolean useAmPm, boolean showDate)
           
static String getWidgetDatetime(String name, String value, String granularity, boolean useAmPm, boolean showDate, String dateTimeSep)
          Yet another date/time widget! You'd think we'd have a super-duper canonical version somewhere in the ACS.
static String getWidgetMaybeRange(boolean askForValue, String name, int startRange, int endRange, String defaultValue)
           
static String getWidgetMaybeRange(boolean askForValue, String name, int startRange, int endRange, String defaultValue, int interval)
           
static String getWidgetMaybeRange(boolean askForValue, String name, int startRange, int endRange, String defaultValue, int interval, boolean withLeadingZeros)
           
static String getWidgetMaybeRange(boolean askForValue, String name, int startRange, int endRange, String defaultValue, int interval, boolean withLeadingZeros, String hiddenValue)
          Taken from templating system.
static String getWidgetMonth(String name, int defVal)
          Builds a picklist of months of the year.
static String getWidgetNumericRange(String name, int begin, int end)
           
static String getWidgetNumericRange(String name, int begin, int end, String defVal)
           
static String getWidgetNumericRange(String name, int begin, int end, String defVal, int interval)
           
static String getWidgetNumericRange(String name, int begin, int end, String defVal, int interval, boolean withLeadingZeros)
          Taken (unmodified, for once!) from First Tuesday's templating system
static CalendarInfo initializeCalendarParameters(HttpServletRequest request, Integer viewedUserId, UserInfo loggedInUser, Integer groupId, String currentView, String currentDate, String compressDayViewP, String viewMode, String action)
          Initializes calinfo variable and populates it with information used on calendar pages.
static Integer insertItem(Integer item_id, Integer instance_id, String title, SqlStatement startDate, SqlStatement endDate, Integer user_id, Integer group_id, String description, Integer creation_user_id)
          same as insertItem, defaults editable_p to true.
static Integer insertItem(Integer item_id, Integer instance_id, String title, SqlStatement startDate, SqlStatement endDate, Integer user_id, Integer group_id, String description, Integer creation_user_id, Boolean editable_p)
          Inserts a new calendar item into the appropriate calendar.
static boolean isWriteAccessAllowed(UserInfo user, Integer itemId)
           
static boolean isWriteAccessAllowed(UserInfo user, Integer itemId, Integer groupId)
          Replaces calendar_item_write_access_p.
static int[] parseDateTimeString(String dateTimeString)
          Parses the passed in string into a list of year, month, day, hour, minutes, seconds.
protected static String parseOracleErrorForNullConstraintViolation(String errorMessage)
          This function parses an oracle error message looking for a violation of a null constraint.
static String parseOracleErrorForUniqueConstraintViolation(String errorMessage)
          Parses Oracle error message looking for a violation of a unique constraint.
static int roundToPrecision(int number, int precision)
          Rounds the given number to the given precision.
static String transformDatetime(AdSet date, boolean truncate)
           
static String transformDatetime(AdSet date, boolean truncate, AdSet fallbackDate)
          Stolen and slightly modified from templating system fallbackDate is a quick hack added to let end_date pull some of its data from start_date if date wasn't displayed.
static String trimLeadingZeros(String str)
          Returns a string w/ leading zeros trimmed.
static Integer userCalendarFolderId(Integer userId)
          Gets id of calendar's file-storage folder for specified user.
static void utilAddToSQLBuffer(StringBuffer buf, String str)
          Simple stupid utility macro for building up a sequence of selects in a string.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CalendarProcs

public CalendarProcs()
Method Detail

parseOracleErrorForNullConstraintViolation

protected static String parseOracleErrorForNullConstraintViolation(String errorMessage)
This function parses an oracle error message looking for a violation of a null constraint. Needs to be moved somewhere else.
Parameters:
errorMessage - Oracle error message.
Returns:
Name of first violating column, or null if no null constraint violation found.

parseOracleErrorForUniqueConstraintViolation

public static String parseOracleErrorForUniqueConstraintViolation(String errorMessage)
Parses Oracle error message looking for a violation of a unique constraint.
Parameters:
errorMessage - Oracle error message.
Returns:
Name of unique constraint violated, or null if no unique constraint violation found.

buildWeekMap

public static String[] buildWeekMap(String forDate,
                                    String dayDateTarget,
                                    String dayDateHREFAppend,
                                    Integer groupId,
                                    boolean noLinkForCurrentDate)
                             throws SQLException,
                                    IOException,
                                    DataSourceException
Assigns days to days of the week in a given month. get all the sundays then all the mondays, etc and puts
tags between the dates
Parameters:
forDate - Date to build map for.
dayDateTarget - base URL to link days to (i.e. baseURL or "").
dayDateHREFAppend - extra info to append to day link URL (i.e. &var="value" or ""). Should be URL encoded and begin with &.
groupId - group Id #, 0 if not viewing a group calendar.
bool - noLinkForCurrentDate flags if "forDate" day should not be linked.
Returns:
HTML representing a month; 7 arrays of Strings, where each column contains a day of the week.

calMiniCalendarWidget

public static String calMiniCalendarWidget(String baseURL)
                                    throws SQLException,
                                           ACSException,
                                           DataSourceException,
                                           IOException
See Also:
#calMiniCalendarWidget(String, String, String, int)

calMiniCalendarWidget

public static String calMiniCalendarWidget(String baseURL,
                                           String currentView)
                                    throws SQLException,
                                           ACSException,
                                           DataSourceException,
                                           IOException
See Also:
#calMiniCalendarWidget(String, String, String, int)

calMiniCalendarWidget

public static String calMiniCalendarWidget(String baseURL,
                                           String currentView,
                                           String currentDate)
                                    throws SQLException,
                                           ACSException,
                                           DataSourceException,
                                           IOException
See Also:
#calMiniCalendarWidget(String, String, String, int)

calMiniCalendarWidget

public static String calMiniCalendarWidget(String baseURL,
                                           String currentView,
                                           String currentDate,
                                           Integer groupId)
                                    throws SQLException,
                                           ACSException,
                                           IOException,
                                           DataSourceException
This proc creates a mini calendar useful for navigating various calendar views. This proc will set 2 variables in the base url's environment: the current view and the current date. TODO: This proc should really be changed over to a template-based creation. It's especially ugly to do this much HTML in Java. TODO: Consider switching currentDate to Date. Would help reduce confusing on parameter order.
Parameters:
baseURL - Base URL to which this mini calendar will navigate.
currentView - list, day, week, month, or year.
currentDate - YYYY-MM-DD format.
groupId - Non-zero if viewing group calendar, zero otherwise.

calMiniMonthCalendar

public static String calMiniMonthCalendar(String currentYear,
                                          String month)
                                   throws SQLException,
                                          ACSException,
                                          DataSourceException,
                                          IOException
See Also:
#calMiniMonthCalendar(String, String, int, String).

calMiniMonthCalendar

public static String calMiniMonthCalendar(String currentYear,
                                          String month,
                                          Integer groupId)
                                   throws SQLException,
                                          ACSException,
                                          DataSourceException,
                                          IOException
See Also:
#calMiniMonthCalendar(String, String, int, String).

calMiniMonthCalendar

public static String calMiniMonthCalendar(String currentYear,
                                          String month,
                                          Integer groupId,
                                          String viewMode)
                                   throws SQLException,
                                          ACSException,
                                          DataSourceException,
                                          IOException
This proc creates a mini month calendar useful for navigating on a month calendar. TODO: This proc should really be changed over to a template-based creation. It's especially ugly to do this much HTML in Java.
Parameters:
currentYear - Year currently being displayed.
month - Month currently being displayed.
groupId - If viewing group calendar.
viewMode - "full" or "modular".

calYearCalendar

public static String calYearCalendar(Integer groupId,
                                     String viewMode,
                                     String currentYear,
                                     String currentDate)
                              throws SQLException,
                                     ACSException,
                                     IOException,
                                     DataSourceException
Generates the HTML for 12 mini calendar widgets, 3 across and 4 down.
Parameters:
groupId - Just for pass-through.
viewMode - Flag for portals to adjust the display with. Defaults to "full".
currentYear - The current year.
currendDate - Date to hilite.
Returns:
HTML for 12 mini calendar widgets.

calRelatedURLHtml

public static String calRelatedURLHtml(String title,
                                       String name,
                                       String url,
                                       String text)
Builds HREF string for related URLs.
Parameters:
title - Title (only used if text is empty, then displayed before " - Name").
name - Name.
url - URL.
text - Text of link, displayed before " - Name"

calendarDayView

public static String calendarDayView(CalendarInfo calendarInfo,
                                     String currentDate,
                                     Integer loggedInUserId,
                                     Integer groupId,
                                     String compressDayViewP,
                                     Integer beginCalHour,
                                     Integer endCalHour)
                              throws SQLException,
                                     ACSException
Generates the HTML for a day view. Should probably be moved into the template.

calendarDayView

public static String calendarDayView(CalendarInfo calendarInfo,
                                     String currentDate,
                                     Integer loggedInUserId,
                                     Integer groupId,
                                     String compressDayViewP,
                                     Integer beginCalHour,
                                     Integer endCalHour,
                                     String viewMode)
                              throws SQLException,
                                     ACSException

calendarDayView

public static String calendarDayView(CalendarInfo calendarInfo,
                                     String currentDate,
                                     Integer loggedInUserId,
                                     Integer groupId,
                                     String compressDayViewP,
                                     Integer beginCalHour,
                                     Integer endCalHour,
                                     String viewMode,
                                     String addLink)
                              throws SQLException,
                                     ACSException

calendarWeekEmptyDays

public static String calendarWeekEmptyDays(CalendarInfo calendarInfo,
                                           Vector weekDays,
                                           int baseJulianDate,
                                           int startJulianDate,
                                           int endJulianDate)
Generate HTML for calendar week days containing no items.

userCalendarFolderId

public static Integer userCalendarFolderId(Integer userId)
                                    throws SQLException,
                                           ACSException
Gets id of calendar's file-storage folder for specified user. folder with name equal to FileAttachmentsFolder from parameters file will be created in the user's personal tree if it doesn't already exist.
Parameters:
userId - User Id.
Returns:
file_id of the folder in the file-storage where calendar items are kept for the specified user.

calendarFolderId

public static Integer calendarFolderId(Integer userId,
                                       Integer groupId)
                                throws SQLException,
                                       ACSException
Gets id of calendar's file-storage folder for specified group. folder with name equal to FileAttachmentsFolder from parameters file and owned by userId will be created if it doesn't already exist.
Parameters:
userId - User Id.
groupId - Group Id (will lookup user calendar if null or 0).
Returns:
file_id of the folder in the file-storage where calendar items are kept for the specified group.

initializeCalendarParameters

public static CalendarInfo initializeCalendarParameters(HttpServletRequest request,
                                                        Integer viewedUserId,
                                                        UserInfo loggedInUser,
                                                        Integer groupId,
                                                        String currentView,
                                                        String currentDate,
                                                        String compressDayViewP,
                                                        String viewMode,
                                                        String action)
                                                 throws SQLException,
                                                        ACSException
Initializes calinfo variable and populates it with information used on calendar pages.
Parameters:
request - Servlet request object, used to short circuit all this evaluation and just return the previously calculated calendarInfo object (if it exists).
viewMode - "full" or "modular": view page with the minicalendar for navigation (full) or view page in isolation.

calendarViewTitle

public static String calendarViewTitle(HttpServletRequest request)
                                throws SQLException,
                                       ACSException
Returns view title bar (a small table with title & left & right linked arrows). Arrows link to different current dates depending on the present view mode.
Parameters:
request - Used for CalendarInfo object and request's db.
Returns:
Title bar.

calPrettyCurrentDate

public static String calPrettyCurrentDate(String current_date,
                                          Database db)
                                   throws SQLException,
                                          ACSException
Yet another pretty date function.
Parameters:
current_date - Date in Oracle YYYY-MM-DD format.
Returns:
Date in 'Month DD, YYYY' format.

displayMonthItem

public static String displayMonthItem(CalendarInfo calendarInfo,
                                      String startDate)
                               throws SQLException
Displays calendar items for a particular day of the month for user or group.

calendarMonthEmptyDays

public static String calendarMonthEmptyDays(CalendarInfo calendarInfo,
                                            String month,
                                            Vector monthList,
                                            int baseJulianDate,
                                            int startJulianDate,
                                            int endJulianDate)
Generate HTML for calendar month days containing no items.

displayUpcoming

public static String displayUpcoming(CalendarInfo calendarInfo,
                                     Integer upcomingItemsDays,
                                     Integer pastItemsDays,
                                     String upcomingItemsLength,
                                     String orderby)
                              throws SQLException
Displays list of calendar items for the next upcoming_items_days and in to the past for past_items_day. Displays the first upcoming_items_length number of items.

displayNew

public static String displayNew(CalendarInfo calendarInfo,
                                Integer newItemsAge)
                         throws SQLException

displayNew

public static String displayNew(CalendarInfo calendarInfo,
                                Integer newItemsAge,
                                String orderBy)
                         throws SQLException
Display items added in the last new_items_age days. upcoming_items_length and past_items_days were dropped because it was not used. orderBy is currently ignored.

isWriteAccessAllowed

public static boolean isWriteAccessAllowed(UserInfo user,
                                           Integer itemId)
                                    throws SQLException,
                                           ACSException

isWriteAccessAllowed

public static boolean isWriteAccessAllowed(UserInfo user,
                                           Integer itemId,
                                           Integer groupId)
                                    throws SQLException,
                                           ACSException
Replaces calendar_item_write_access_p. Checks write access for the given user on the given item.

trimLeadingZeros

public static String trimLeadingZeros(String str)
Returns a string w/ leading zeros trimmed. Used for compatibility with TCL versions; TCL interprets leading zeros as octal.

parseDateTimeString

public static int[] parseDateTimeString(String dateTimeString)
Parses the passed in string into a list of year, month, day, hour, minutes, seconds. Assumes AD standard "YYYY-MM-DD HH24:MI:SS", allows specifying single-digit values and leaving off information to the right side of the string (i.e. you can leave off the seconds). Values default to 1 for MM/DD and 0 for HH/MI/SS if not found in string. Leading zeroes will be stripped to stay compatible w/ TCL version (TCL interprets these in Octal). NOTE that no validation is done - it's entirely possible to enter an invalid date such as Feb 31. Oracle will check for this sort of stupidity on insert and throw an error if it happens. This is a parser, not a validator.

utilAddToSQLBuffer

public static void utilAddToSQLBuffer(StringBuffer buf,
                                      String str)
Simple stupid utility macro for building up a sequence of selects in a string.

getWidgetDatetime

public static String getWidgetDatetime(String name,
                                       String value,
                                       String granularity)
                                throws SQLException,
                                       ACSException

getWidgetDatetime

public static String getWidgetDatetime(String name,
                                       String value,
                                       String granularity,
                                       boolean useAmPm)
                                throws SQLException,
                                       ACSException

getWidgetDatetime

public static String getWidgetDatetime(String name,
                                       String value,
                                       String granularity,
                                       boolean useAmPm,
                                       boolean showDate)
                                throws SQLException,
                                       ACSException

getWidgetDatetime

public static String getWidgetDatetime(String name,
                                       String value,
                                       String granularity,
                                       boolean useAmPm,
                                       boolean showDate,
                                       String dateTimeSep)
                                throws SQLException,
                                       ACSException
Yet another date/time widget! You'd think we'd have a super-duper canonical version somewhere in the ACS. Based on First Tuesday's ad_form_widget_datetime (/web/ftdev/tcl/template/ad-form-widget.tcl on dev0103-001 as of 6/29/00) which is the templating system's standard datetime but with granularity control. granularity can be "months" "days" "hours" "halves" "quarters" "fives" "minutes" or "seconds" You cannot ask for granularity less fine than months (presently) Presently no support for timezones - all times are just taken and spewed directly, do any TZ conversion on the other side of this proc. Parameters other than granularity are obvious. End result is a text string containing HTML widgets with names "$name.year", "$name.month", "$name.day", "$name.hours", "$name.minutes", "$name.seconds", and "$name.ampm". These will be numeric ("ampm" is 0 for am, 1 for pm) All HTML widgets will always be output *except* if show_date is 0; they will be hidden with if not needed to satisfy the current granularity level. Values default to 1 for MM/DD and 0 for HH/MI/SS/AM if not found in input string or if below granularity threshold. This means you can pass the results straight to a stupid processor and it can readily convert to the proper Oracle date string just by stringing everything together. TODO: This really begs to be its own little class.

roundToPrecision

public static int roundToPrecision(int number,
                                   int precision)
Rounds the given number to the given precision. i.e. calendar_round_to_precision 44 5 will round to the nearest 5 and return 45, while calendar_round_to_precision 32.678 .1 will round to 32.7.

getWidgetMonth

public static String getWidgetMonth(String name,
                                    int defVal)
                             throws SQLException,
                                    ACSException
Builds a picklist of months of the year. Taken from First Tuesday's ad_widget_month. Presently hard-wired to just use English - more time should be spent to figure out ad_locale.

getMonthNames

public static String[] getMonthNames()
                              throws SQLException,
                                     ACSException
Non-internationalized version of calendar_util_month_names_by_locale. Hopefully this will work on more systems than the internationalized version (which didn't seem to be configured right on many systems) Returns a list of month names from Oracle.

getWidgetMaybeRange

public static String getWidgetMaybeRange(boolean askForValue,
                                         String name,
                                         int startRange,
                                         int endRange,
                                         String defaultValue)

getWidgetMaybeRange

public static String getWidgetMaybeRange(boolean askForValue,
                                         String name,
                                         int startRange,
                                         int endRange,
                                         String defaultValue,
                                         int interval)

getWidgetMaybeRange

public static String getWidgetMaybeRange(boolean askForValue,
                                         String name,
                                         int startRange,
                                         int endRange,
                                         String defaultValue,
                                         int interval,
                                         boolean withLeadingZeros)

getWidgetMaybeRange

public static String getWidgetMaybeRange(boolean askForValue,
                                         String name,
                                         int startRange,
                                         int endRange,
                                         String defaultValue,
                                         int interval,
                                         boolean withLeadingZeros,
                                         String hiddenValue)
Taken from templating system. Returns form numeric range, or hidden 00 if ask_for_value is false.

getWidgetNumericRange

public static String getWidgetNumericRange(String name,
                                           int begin,
                                           int end)

getWidgetNumericRange

public static String getWidgetNumericRange(String name,
                                           int begin,
                                           int end,
                                           String defVal)

getWidgetNumericRange

public static String getWidgetNumericRange(String name,
                                           int begin,
                                           int end,
                                           String defVal,
                                           int interval)

getWidgetNumericRange

public static String getWidgetNumericRange(String name,
                                           int begin,
                                           int end,
                                           String defVal,
                                           int interval,
                                           boolean withLeadingZeros)
Taken (unmodified, for once!) from First Tuesday's templating system

getLeadingZeros

public static String getLeadingZeros(int number,
                                     int nDesiredDigits)
Adds leading zeros to an int to give it the desired number of digits.

getLeadingZeros

public static String getLeadingZeros(Integer number,
                                     int nDesiredDigits)
Adds leading zeros to a String to give it the desired number of digits.

formatDateTimeString

public static String formatDateTimeString(String value,
                                          String granularity)
                                   throws SQLException,
                                          ACSException

formatDateTimeString

public static String formatDateTimeString(String value,
                                          String granularity,
                                          boolean useAmPm)
                                   throws SQLException,
                                          ACSException

formatDateTimeString

public static String formatDateTimeString(String value,
                                          String granularity,
                                          boolean useAmPm,
                                          boolean showDate)
                                   throws SQLException,
                                          ACSException

formatDateTimeString

public static String formatDateTimeString(String value,
                                          String granularity,
                                          boolean useAmPm,
                                          boolean showDate,
                                          String dateTimeSep)
                                   throws SQLException,
                                          ACSException
Formats date/time See description of getWidgetDatetime
See Also:
getWidgetDatetime(java.lang.String, java.lang.String, java.lang.String)

getCategoriesWidget

public static String getCategoriesWidget()
                                  throws SQLException,
                                         ACSException

getCategoriesWidget

public static String getCategoriesWidget(String scope,
                                         Integer id)
                                  throws SQLException,
                                         ACSException

getCategoriesWidget

public static String getCategoriesWidget(String scope,
                                         Integer id,
                                         Vector defaultCategoryIdList)
                                  throws SQLException,
                                         ACSException

getCategoriesWidget

public static String getCategoriesWidget(String scope,
                                         Integer id,
                                         Vector defaultCategoryIdList,
                                         String defaultReturn)
                                  throws SQLException,
                                         ACSException

getCategoriesWidget

public static String getCategoriesWidget(String scope,
                                         Integer id,
                                         Vector defaultCategoryIdList,
                                         String defaultReturn,
                                         int selectSize)
                                  throws SQLException,
                                         ACSException

getCategoriesWidget

public static String getCategoriesWidget(String scope,
                                         Integer id,
                                         Vector defaultCategoryIdList,
                                         String defaultReturn,
                                         int selectSize,
                                         String varName)
                                  throws SQLException,
                                         ACSException

transformDatetime

public static String transformDatetime(AdSet date,
                                       boolean truncate)
                                throws ACSException

transformDatetime

public static String transformDatetime(AdSet date,
                                       boolean truncate,
                                       AdSet fallbackDate)
                                throws ACSException
Stolen and slightly modified from templating system fallbackDate is a quick hack added to let end_date pull some of its data from start_date if date wasn't displayed. Throws an error if year, month, or day are not specified (could default to current_day, but that would be dangerous if it did so silently since the user wouldn't know what was happening). Different from the TCL version in that it does not return to_date... because that would require returning a string + bind variables and would be more confusing. TODO: This should be a class.
Returns:
A string representing this date. This string has validated that all of the fields are integers, and is safe to pass to Oracle, but no further validation has been performed.

insertItem

public static Integer insertItem(Integer item_id,
                                 Integer instance_id,
                                 String title,
                                 SqlStatement startDate,
                                 SqlStatement endDate,
                                 Integer user_id,
                                 Integer group_id,
                                 String description,
                                 Integer creation_user_id)
                          throws SQLException,
                                 ACSException
same as insertItem, defaults editable_p to true.

insertItem

public static Integer insertItem(Integer item_id,
                                 Integer instance_id,
                                 String title,
                                 SqlStatement startDate,
                                 SqlStatement endDate,
                                 Integer user_id,
                                 Integer group_id,
                                 String description,
                                 Integer creation_user_id,
                                 Boolean editable_p)
                          throws SQLException,
                                 ACSException
Inserts a new calendar item into the appropriate calendar. Does not do validation of arguments.
Parameters:
-item_id - and @param -instance_id support passing in an item_id and instance_id for double-click protection. If @param -item_id isn't passed in, then both will be generated. Specifying @param -item_id without @param -instance_id is an error.
-title -  
-start_date_sql - and @param -end_date_sql are used to directly specify the start_date and end_date to be inserted into the DB. These parameters override the following parameters. These parameters are used to calculate start_date and end_date based on a combination of date, time and duration:
-date - assumes 'YYYY-MM-DD'.
-start_time - and @param -end_time assume 'HH24:MI'. If
-start_time - is not specified, then a No Time item will be created and the value of @param -end_time will be ignored. If @param -end_time is not specified, then the value of @param -duration will be used. At a bare minimum, either @param -start_date_sql or @param -date must be specified.
-user_id - indicates a personal item.
-group_id - indicates a group item. Specifying neither or both is currently undefined but will not cause an error.
-description -  
-html_p - indicates whether or not description has html tags; default is 'f'
-related_url - if not specified, then no link will appear in the item details.
-related_url_text - if not specified, then the value of -related_url will be displayed as the link text.
-related_url_p - if 'f' then @param title will be displayed for the item on the various views as a link to details about the items.
related_url - and @param related_url_text will be used to display a link on the details page. if 't' then @param related_url and @param related_url_text will be used to form the link that appears in the various views. The default is 'f'.
-creation_user - is required. Generally it will be the logged in user.
-on_what_id - and @param -on_which_table throws an error if one but not both are specified. If both are specified, then a row will be added to the mapping table.
-editable_p - indicates whether or not the item can be edited by anyone or only deleted. Throws error if insert fails. Returns instance_id (from whence item_id can be derived) on success.