okapi.tools
Class OkapiToolUtilities

java.lang.Object
  extended by okapi.tools.OkapiToolUtilities

public class OkapiToolUtilities
extends java.lang.Object

Collection of static methods providing common services to tools

Version:
$Revision: 31635 $, $Date: 2009-01-08 18:40:46 -0500 (Thu, 08 Jan 2009) $
Author:
MIT Stellar team

Field Summary
static java.lang.String[] hours
           
static java.util.Hashtable kindFormattedTable
           
static java.util.Hashtable mimeTypesReverseSuffixTable
           
static java.util.Hashtable mimeTypesSuffixTable
           
static java.util.Hashtable mimeTypesTable
           
static java.lang.String[] monthNames
           
static java.lang.String[] monthShortNames
           
static java.lang.String[] weekdayShortNames
           
 
Constructor Summary
OkapiToolUtilities()
           
 
Method Summary
static void addArc(OkapiXMLDocument xml, OkapiArc arc, boolean includeContent, java.lang.String pathToParent, java.lang.String pathSegment, OkapiUser user, boolean includeBody)
          Same as addArc(xml, arc, pathToParent, pathSegment, user, includeBody); but adds option to exclude content.
static void addArc(OkapiXMLDocument xml, OkapiArc arc, boolean includeContent, java.lang.String pathToParent, java.lang.String pathSegment, OkapiUser user, boolean includeBody, boolean includeBodyEscapedXml, boolean includeCreationDate, java.util.List timezones, java.util.Date firstDateWithContent, java.util.Date lastDateWithContent)
          Same as addArc(xml, arc, true, pathToParent, pathSegment, user, includeBody, includeBodyEscapedXml, false, timezones, firstDateWithContent, lastDateWithContent) but also adds includeCreationDate if creation date of Arc and Content should be included.
static void addArc(OkapiXMLDocument xml, OkapiArc arc, boolean includeContent, java.lang.String pathToParent, java.lang.String pathSegment, OkapiUser user, boolean includeBody, boolean includeBodyEscapedXml, boolean includeCreationDate, java.util.List timezones, java.util.Date firstDateWithContent, java.util.Date lastDateWithContent, java.util.SortedSet allDatesWithContent)
          Same as addArc(xml, arc, true, pathToParent, pathSegment, user, includeBody, includeBodyEscapedXml, includeCreationDate, false, timezones, firstDateWithContent, lastDateWithContent) but also adds allDatesWithContent set.
static void addArc(OkapiXMLDocument xml, OkapiArc arc, boolean includeContent, java.lang.String pathToParent, java.lang.String pathSegment, OkapiUser user, boolean includeBody, boolean includeBodyEscapedXml, java.util.List timezones, java.util.Date firstDateWithContent, java.util.Date lastDateWithContent)
          Same as addArc(xml, arc, includeContent, pathToParent, pathSegment, user, includeBody, includeBodyEscapedXml) but also adds onDateZoned elements for each arc based on the list of timezones and sets firstDateWithContent and lastDateWithContent to the first and last start dates of the arc and its children, for use in calendar tools.
static void addArc(OkapiXMLDocument xml, OkapiArc arc, java.lang.String pathToParent, java.lang.String pathSegment, OkapiUser user, boolean includeBody)
          Adds an arc and all of its content and arc children to the xml document.
static void addArc(OkapiXMLDocument xml, OkapiArc arc, java.lang.String pathToParent, java.lang.String pathSegment, OkapiUser user, boolean includeBody, boolean includeBodyEscapedXml)
          Same as addArc(xml, arc, pathToParent, pathSegment, user, includeBody) but also adds the body of content atoms as escaped XML even if the body is XML, to facilitate editing of the content atom body.
static void addArc(OkapiXMLDocument xml, OkapiArc arc, java.lang.String pathToParent, java.lang.String pathSegment, OkapiUser user, boolean includeBody, boolean includeBodyEscapedXml, java.util.List timezones, java.util.Date firstDateWithContent, java.util.Date lastDateWithContent)
          Same as addArc(xml, arc, pathToParent, pathSegment, user, includeBody, includeBodyEscapedXml) but also adds onDateZoned elements for each arc based on the list of timezones and sets firstDateWithContent and lastDateWithContent to the first and last start dates of the arc and its children, for use in calendar tools.
static void addArc(OkapiXMLDocument xml, OkapiArc arc, java.lang.String pathToParent, java.lang.String pathSegment, OkapiUser user, boolean includeBody, java.util.List timezones, java.util.Date firstDateWithContent, java.util.Date lastDateWithContent)
          Same as addArc(xml, arc, pathToParent, pathSegment, user, includeBody) but also adds onDateZoned elements for each arc based on the list of timezones and sets firstDateWithContent and lastDateWithContent to the first and last start dates of the arc and its children, for use in calendar tools.
static void addBackInfo(OkapiXMLDocument xml, javax.servlet.http.HttpServletRequest request)
          Adds the href of the refering page, based on the backURL parameter of the referer head if the parameter is not set.
static void addBasicSubjectInfo(OkapiXMLDocument xml, OkapiNexus nexus)
          Adds basic subject info with no enclosing tags to the xml document, to be used when additional elements are needed so addSubjectInfo() cannot be used.
static void addBasicSubjectInfo(OkapiXMLDocument xml, OkapiNexus nexus, boolean omitDescription)
          Adds basic subject info with no enclosing tags to the xml document, to be used when additional elements are needed so addSubjectInfo() cannot be used.
static void addBasicUserInfo(OkapiXMLDocument xml, OkapiUser user)
          Adds basic user info with no enclosing tags to the xml dcoument, to be used when additional elements are needed so addUserInfo() cannot be used.
static void addContent(OkapiXMLDocument xml, OkapiContent content, java.lang.String pathToParent, java.lang.String pathSegment, OkapiUser user, boolean includeBody, boolean includeBodyEscapedXml, boolean includeCreationDate)
          Adds a content and its children and atoms to the xml document.
static void addCrumbsAndNexusHref(OkapiXMLDocument xml, javax.servlet.http.HttpServletRequest request, java.util.List nexusHistory, java.lang.String toolName)
          Adds a full breadCrumbTrail element and a nexusHref element to the xml document.
static void addCrumbsAndNexusHrefWithSublist(OkapiXMLDocument xml, javax.servlet.http.HttpServletRequest request, java.util.List nexusHistory, java.util.List toolHistory, java.lang.String toolName)
          Adds a full breadCrumbTrail element and a nexusHref element to the xml document.
static void addDateTag(OkapiXMLDocument xml, java.util.Date date)
          Adds a date tag to the xml document for the specified date.
static java.lang.String addNexusCrumbs(OkapiXMLDocument xml, javax.servlet.http.HttpServletRequest request, java.util.List nexusHistory)
          Adds crumbs elements for all the nexuses in the nexusHistory with no enclosing tag, to be used when addCrumbsAndNexusHref() does not provide the necessary complete breadcrumb trail.
static void addPageIntroText(OkapiXMLDocument xml, OkapiNexus thisNexus, java.lang.String pageName)
          Method addPageIntroText
static void addRequestParameters(OkapiXMLDocument xml, javax.servlet.http.HttpServletRequest request)
          Also adds all request parameters to the XML.
static void addSubjectInfo(OkapiXMLDocument xml, OkapiNexus nexus)
          Adds a subject tag to the xml document containing basic subject data provided by addBasicSubjectInfo().
static void addSubjectInfoAndSections(OkapiXMLDocument xml, OkapiNexus nexus)
          Adds a subject tag to the xml document containing all the data from addSubjectInfo() with additional elements for the sections in this nexus and its children.
static void addSubjectInfoAndSections(OkapiXMLDocument xml, OkapiNexus nexus, boolean includeDecativatedSections)
          Adds a subject tag to the xml document containing all the data from addSubjectInfo() with additional elements for the sections in this nexus and its children.
static void addUserEReservesAccess(OkapiXMLDocument xml, OkapiUser user, OkapiNexus thisNexus)
          Add EReserves, or generally third-party, fair-use copyright material access tags.
static void addUserInfo(OkapiXMLDocument xml, OkapiUser user)
          Adds a user tag to the xml document containing basic user data provided by addBasicUserInfo().
static void addUserInfo(OkapiXMLDocument xml, OkapiUser user, boolean canModify, boolean showToolset)
          Same as addUserInfo(xml, user) but adds additional canModify and showToolset elements.
static void addUserInfo(OkapiXMLDocument xml, OkapiUser user, boolean canModify, boolean hasModify, boolean showToolset)
          Same as addUserInfo(xml, user) but adds additional canModify, hasModify, and showToolset elements.
static boolean canModify(OkapiUser user, OkapiNexus nexus)
          Determines whether the user should be allowed to modify the nexus by checking the users authorization and overriding if the nexus is read only.
static java.util.Date convertToDate(java.lang.Object year, java.lang.Object month, java.lang.Object day, java.lang.Object hour, java.lang.Object minute)
          return date given year, month, day, hour, and minute as strings.
static java.lang.String errorHtml()
          Method errorHtml
static java.lang.String errorHtml(java.lang.String header, java.lang.String addBody)
          Method errorHtml
static java.lang.String fixFileName(java.lang.String filepath)
          Generates a sql safe filename from a filepath by attempting to find the last path segment in the filepath, removing unsafe characters, and shortening to under 50 characters.
static OkapiArc getArc(OkapiNexus nexus, java.lang.String[] path)
          Returns the arc at the specified path within the specified nexus, or null if there is no such arc.
static OkapiContent getContent(java.util.List pathVector, java.lang.String pathSegment, javax.servlet.http.HttpServletRequest request, OkapiNexus thisNexus)
          Finds the content located in the last nexus in this nexusHistory at the arc indicated by pathSegment at the path indicated by pathVector.
static int getHourNumber(java.lang.String hourString)
          Returns the int value for hour expressed as 12am, 1am, etc.
static int getMonthNumber(java.lang.String monthName)
          Returns the java.util.Calendar constant for the given month name.
static java.lang.String getPath(java.util.List pathVector)
          Creates a path string from a vector of path segments by joining each segment with a forward slash.
static java.lang.String getPath(OkapiNexus nexus)
          Reconstruct parentage of nexus, with no preceding or following /.
static java.util.Vector getPathVector(java.lang.String path)
          Creates a vector of path segments from a path by tokenizing on forward slash.
static OkapiStore getStore(java.util.List pathVector, java.lang.String pathSegment, OkapiNexus thisNexus)
          Finds the store located in the last nexus in this nexusHistory at the arc indicated by pathSegment at the path indicated by pathVector.
static java.lang.String getStoreAsString(OkapiStore store)
          Returns the text of a store as a String.
static boolean hasModify(OkapiUser user, OkapiNexus nexus)
          Determines whether the user should be allowed to modify the nexus by checking the users authorization, but not overriding if the nexus is read only.
static java.lang.String tidy(java.io.BufferedInputStream in)
          Returns a 'tidy' version of the characters read from the input stream or null if tidy finds any errors.
static java.lang.String tidy(java.io.BufferedInputStream in, boolean notEncloseText)
          Returns a 'tidy' version of the characters read from the input stream, or null if tidy find any errors.
static java.lang.String tidy(java.lang.String s)
          Returns a 'tidy' version of the String, or null if tidy finds any errors.
static java.lang.String tidy(java.lang.String s, boolean notEncloseText)
          Returns a 'tidy' version of the String, or null if tidy finds any errors.
static java.lang.String tidy(java.lang.String s, boolean notEncloseText, boolean notConvertNewlines)
          Returns a 'tidy' version of the String, or null if tidy finds any errors.
static java.lang.String tidy(java.lang.String s, boolean notEncloseText, boolean notConvertNewlines, boolean autoConvertUrls)
          Returns a 'tidy' version of the String, or null if tidy finds any errors.
static java.lang.String turnHttpToLink(java.lang.String raw)
          Method turnHttpToLink replace lone http, mailto, news, or ftp to link
static boolean updateToolsetStatus(javax.servlet.http.HttpServletRequest request)
          Updates the status of the toolset by looking for a current status stored in the session and a new value in the request.
static java.lang.String urlDecode(java.lang.String uri)
          Decode URL using java.net.URLDecoder.decode Convenience method which catches a java.io.UnsupportedEncodingException
static java.lang.String urlEncode(java.lang.String uri)
          Encode URL using java.net.URLEncoder.encode Convenience method which catches a java.io.UnsupportedEncodingException
static boolean userHasGraderRole(OkapiUser user, OkapiNexus nexus)
          Return true if user has role of GRADER in this nexus.
static boolean userHasManagerRole(OkapiUser user, OkapiNexus nexus)
          Return true if user has role of MANAGER in this nexus.
static boolean userIsClassStaff(OkapiUser user, OkapiNexus nexus)
          Return true if user has role of COURSE_ADMIN or better in this nexus.
static boolean userIsStudentOrLearner(OkapiUser user, OkapiNexus nexus)
          Return true if one of the user's role is as a STUDENT or LEARNER in this nexus.
static OkapiToolUserNexusRoleInfo userNexusRoleInfo(OkapiUser user, OkapiNexus nexus)
          Return OkapiToolUserNexusRoleInfo object for user in this nexus; provides highest role info, etc.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

monthNames

public static final java.lang.String[] monthNames

monthShortNames

public static final java.lang.String[] monthShortNames

hours

public static final java.lang.String[] hours

weekdayShortNames

public static final java.lang.String[] weekdayShortNames

mimeTypesTable

public static final java.util.Hashtable mimeTypesTable

mimeTypesSuffixTable

public static java.util.Hashtable mimeTypesSuffixTable

mimeTypesReverseSuffixTable

public static java.util.Hashtable mimeTypesReverseSuffixTable

kindFormattedTable

public static final java.util.Hashtable kindFormattedTable
Constructor Detail

OkapiToolUtilities

public OkapiToolUtilities()
Method Detail

updateToolsetStatus

public static boolean updateToolsetStatus(javax.servlet.http.HttpServletRequest request)
Updates the status of the toolset by looking for a current status stored in the session and a new value in the request. If a new value has been been requested, the new value is stored in the session for future use. Returns a boolean indicating whether the toolset should be shown.


canModify

public static boolean canModify(OkapiUser user,
                                OkapiNexus nexus)
Determines whether the user should be allowed to modify the nexus by checking the users authorization and overriding if the nexus is read only.


hasModify

public static boolean hasModify(OkapiUser user,
                                OkapiNexus nexus)
Determines whether the user should be allowed to modify the nexus by checking the users authorization, but not overriding if the nexus is read only.


userNexusRoleInfo

public static OkapiToolUserNexusRoleInfo userNexusRoleInfo(OkapiUser user,
                                                           OkapiNexus nexus)
Return OkapiToolUserNexusRoleInfo object for user in this nexus; provides highest role info, etc.


userIsStudentOrLearner

public static boolean userIsStudentOrLearner(OkapiUser user,
                                             OkapiNexus nexus)
Return true if one of the user's role is as a STUDENT or LEARNER in this nexus.


userIsClassStaff

public static boolean userIsClassStaff(OkapiUser user,
                                       OkapiNexus nexus)
Return true if user has role of COURSE_ADMIN or better in this nexus.


userHasGraderRole

public static boolean userHasGraderRole(OkapiUser user,
                                        OkapiNexus nexus)
Return true if user has role of GRADER in this nexus.


userHasManagerRole

public static boolean userHasManagerRole(OkapiUser user,
                                         OkapiNexus nexus)
Return true if user has role of MANAGER in this nexus.


addSubjectInfoAndSections

public static void addSubjectInfoAndSections(OkapiXMLDocument xml,
                                             OkapiNexus nexus)
Adds a subject tag to the xml document containing all the data from addSubjectInfo() with additional elements for the sections in this nexus and its children.


addSubjectInfoAndSections

public static void addSubjectInfoAndSections(OkapiXMLDocument xml,
                                             OkapiNexus nexus,
                                             boolean includeDecativatedSections)
Adds a subject tag to the xml document containing all the data from addSubjectInfo() with additional elements for the sections in this nexus and its children. if includeDeactivatedSections is true, include sections which were deactivated


addSubjectInfo

public static void addSubjectInfo(OkapiXMLDocument xml,
                                  OkapiNexus nexus)
Adds a subject tag to the xml document containing basic subject data provided by addBasicSubjectInfo(). Use addBasicSubjectInfo() when additional elements are needed.


addBasicSubjectInfo

public static void addBasicSubjectInfo(OkapiXMLDocument xml,
                                       OkapiNexus nexus)
Adds basic subject info with no enclosing tags to the xml document, to be used when additional elements are needed so addSubjectInfo() cannot be used.


addBasicSubjectInfo

public static void addBasicSubjectInfo(OkapiXMLDocument xml,
                                       OkapiNexus nexus,
                                       boolean omitDescription)
Adds basic subject info with no enclosing tags to the xml document, to be used when additional elements are needed so addSubjectInfo() cannot be used. Include the description unless omitDescription is true.


addUserInfo

public static void addUserInfo(OkapiXMLDocument xml,
                               OkapiUser user)
Adds a user tag to the xml document containing basic user data provided by addBasicUserInfo(). Use addBasicUserInfo() when additional elements are needed.


addUserInfo

public static void addUserInfo(OkapiXMLDocument xml,
                               OkapiUser user,
                               boolean canModify,
                               boolean showToolset)
Same as addUserInfo(xml, user) but adds additional canModify and showToolset elements.


addUserInfo

public static void addUserInfo(OkapiXMLDocument xml,
                               OkapiUser user,
                               boolean canModify,
                               boolean hasModify,
                               boolean showToolset)
Same as addUserInfo(xml, user) but adds additional canModify, hasModify, and showToolset elements.


addBasicUserInfo

public static void addBasicUserInfo(OkapiXMLDocument xml,
                                    OkapiUser user)
Adds basic user info with no enclosing tags to the xml dcoument, to be used when additional elements are needed so addUserInfo() cannot be used.


addUserEReservesAccess

public static void addUserEReservesAccess(OkapiXMLDocument xml,
                                          OkapiUser user,
                                          OkapiNexus thisNexus)
Add EReserves, or generally third-party, fair-use copyright material access tags.


getPath

public static java.lang.String getPath(OkapiNexus nexus)
Reconstruct parentage of nexus, with no preceding or following /.


getPath

public static java.lang.String getPath(java.util.List pathVector)
Creates a path string from a vector of path segments by joining each segment with a forward slash.


getPathVector

public static java.util.Vector getPathVector(java.lang.String path)
Creates a vector of path segments from a path by tokenizing on forward slash.


getArc

public static OkapiArc getArc(OkapiNexus nexus,
                              java.lang.String[] path)
Returns the arc at the specified path within the specified nexus, or null if there is no such arc. Arc names within the path should be seperated with forward slashes, and the path should not begin or end with a forward slash.


addArc

public static void addArc(OkapiXMLDocument xml,
                          OkapiArc arc,
                          java.lang.String pathToParent,
                          java.lang.String pathSegment,
                          OkapiUser user,
                          boolean includeBody)
Adds an arc and all of its content and arc children to the xml document. pathToParent provides the href of the parent arc or nexus, and pathSegment provides the pathSegment of the arc within that parent -- the two are concatenated to form the href element of the arc, so the initial call can contain a null pathToParent and the full href (with no leading or trailing slashes) as the pathSegment. Arc and contents which the user does not have read permission on are skipped, and the body of short text content atoms can be included by setting includeBody true.


addArc

public static void addArc(OkapiXMLDocument xml,
                          OkapiArc arc,
                          boolean includeContent,
                          java.lang.String pathToParent,
                          java.lang.String pathSegment,
                          OkapiUser user,
                          boolean includeBody)
Same as addArc(xml, arc, pathToParent, pathSegment, user, includeBody); but adds option to exclude content.


addArc

public static void addArc(OkapiXMLDocument xml,
                          OkapiArc arc,
                          java.lang.String pathToParent,
                          java.lang.String pathSegment,
                          OkapiUser user,
                          boolean includeBody,
                          boolean includeBodyEscapedXml)
Same as addArc(xml, arc, pathToParent, pathSegment, user, includeBody) but also adds the body of content atoms as escaped XML even if the body is XML, to facilitate editing of the content atom body.


addArc

public static void addArc(OkapiXMLDocument xml,
                          OkapiArc arc,
                          java.lang.String pathToParent,
                          java.lang.String pathSegment,
                          OkapiUser user,
                          boolean includeBody,
                          java.util.List timezones,
                          java.util.Date firstDateWithContent,
                          java.util.Date lastDateWithContent)
Same as addArc(xml, arc, pathToParent, pathSegment, user, includeBody) but also adds onDateZoned elements for each arc based on the list of timezones and sets firstDateWithContent and lastDateWithContent to the first and last start dates of the arc and its children, for use in calendar tools.


addArc

public static void addArc(OkapiXMLDocument xml,
                          OkapiArc arc,
                          java.lang.String pathToParent,
                          java.lang.String pathSegment,
                          OkapiUser user,
                          boolean includeBody,
                          boolean includeBodyEscapedXml,
                          java.util.List timezones,
                          java.util.Date firstDateWithContent,
                          java.util.Date lastDateWithContent)
Same as addArc(xml, arc, pathToParent, pathSegment, user, includeBody, includeBodyEscapedXml) but also adds onDateZoned elements for each arc based on the list of timezones and sets firstDateWithContent and lastDateWithContent to the first and last start dates of the arc and its children, for use in calendar tools.


addArc

public static void addArc(OkapiXMLDocument xml,
                          OkapiArc arc,
                          boolean includeContent,
                          java.lang.String pathToParent,
                          java.lang.String pathSegment,
                          OkapiUser user,
                          boolean includeBody,
                          boolean includeBodyEscapedXml,
                          java.util.List timezones,
                          java.util.Date firstDateWithContent,
                          java.util.Date lastDateWithContent)
Same as addArc(xml, arc, includeContent, pathToParent, pathSegment, user, includeBody, includeBodyEscapedXml) but also adds onDateZoned elements for each arc based on the list of timezones and sets firstDateWithContent and lastDateWithContent to the first and last start dates of the arc and its children, for use in calendar tools.


addArc

public static void addArc(OkapiXMLDocument xml,
                          OkapiArc arc,
                          boolean includeContent,
                          java.lang.String pathToParent,
                          java.lang.String pathSegment,
                          OkapiUser user,
                          boolean includeBody,
                          boolean includeBodyEscapedXml,
                          boolean includeCreationDate,
                          java.util.List timezones,
                          java.util.Date firstDateWithContent,
                          java.util.Date lastDateWithContent)
Same as addArc(xml, arc, true, pathToParent, pathSegment, user, includeBody, includeBodyEscapedXml, false, timezones, firstDateWithContent, lastDateWithContent) but also adds includeCreationDate if creation date of Arc and Content should be included.


addArc

public static void addArc(OkapiXMLDocument xml,
                          OkapiArc arc,
                          boolean includeContent,
                          java.lang.String pathToParent,
                          java.lang.String pathSegment,
                          OkapiUser user,
                          boolean includeBody,
                          boolean includeBodyEscapedXml,
                          boolean includeCreationDate,
                          java.util.List timezones,
                          java.util.Date firstDateWithContent,
                          java.util.Date lastDateWithContent,
                          java.util.SortedSet allDatesWithContent)
Same as addArc(xml, arc, true, pathToParent, pathSegment, user, includeBody, includeBodyEscapedXml, includeCreationDate, false, timezones, firstDateWithContent, lastDateWithContent) but also adds allDatesWithContent set.


addContent

public static void addContent(OkapiXMLDocument xml,
                              OkapiContent content,
                              java.lang.String pathToParent,
                              java.lang.String pathSegment,
                              OkapiUser user,
                              boolean includeBody,
                              boolean includeBodyEscapedXml,
                              boolean includeCreationDate)
Adds a content and its children and atoms to the xml document. See addArc() for an explanation of the additional arguments.


addBackInfo

public static void addBackInfo(OkapiXMLDocument xml,
                               javax.servlet.http.HttpServletRequest request)
Adds the href of the refering page, based on the backURL parameter of the referer head if the parameter is not set. Also adds a backName element with a text name for the refering page.


addRequestParameters

public static void addRequestParameters(OkapiXMLDocument xml,
                                        javax.servlet.http.HttpServletRequest request)
Also adds all request parameters to the XML.


addNexusCrumbs

public static java.lang.String addNexusCrumbs(OkapiXMLDocument xml,
                                              javax.servlet.http.HttpServletRequest request,
                                              java.util.List nexusHistory)
Adds crumbs elements for all the nexuses in the nexusHistory with no enclosing tag, to be used when addCrumbsAndNexusHref() does not provide the necessary complete breadcrumb trail. Returns the href of the most recent nexus.


addCrumbsAndNexusHref

public static void addCrumbsAndNexusHref(OkapiXMLDocument xml,
                                         javax.servlet.http.HttpServletRequest request,
                                         java.util.List nexusHistory,
                                         java.lang.String toolName)
Adds a full breadCrumbTrail element and a nexusHref element to the xml document. The bread crumb trail is created by calling addNexusCrumbs() and adding an additional crumb with the toolname and the full request uri as href.


addCrumbsAndNexusHrefWithSublist

public static void addCrumbsAndNexusHrefWithSublist(OkapiXMLDocument xml,
                                                    javax.servlet.http.HttpServletRequest request,
                                                    java.util.List nexusHistory,
                                                    java.util.List toolHistory,
                                                    java.lang.String toolName)
Adds a full breadCrumbTrail element and a nexusHref element to the xml document. The bread crumb trail is created by calling addNexusCrumbs() and adding an additional crumb with the toolname and the full request uri as href.


addDateTag

public static void addDateTag(OkapiXMLDocument xml,
                              java.util.Date date)
Adds a date tag to the xml document for the specified date.


addPageIntroText

public static void addPageIntroText(OkapiXMLDocument xml,
                                    OkapiNexus thisNexus,
                                    java.lang.String pageName)
Method addPageIntroText

Parameters:
xml -
thisNexus -
pageName -

getContent

public static OkapiContent getContent(java.util.List pathVector,
                                      java.lang.String pathSegment,
                                      javax.servlet.http.HttpServletRequest request,
                                      OkapiNexus thisNexus)
                               throws OkapiPermissionDeniedException,
                                      OkapiAuthenticationRequiredException
Finds the content located in the last nexus in this nexusHistory at the arc indicated by pathSegment at the path indicated by pathVector.

Throws:
OkapiPermissionDeniedException
OkapiAuthenticationRequiredException

getStore

public static OkapiStore getStore(java.util.List pathVector,
                                  java.lang.String pathSegment,
                                  OkapiNexus thisNexus)
Finds the store located in the last nexus in this nexusHistory at the arc indicated by pathSegment at the path indicated by pathVector.


getStoreAsString

public static java.lang.String getStoreAsString(OkapiStore store)
Returns the text of a store as a String. Before calling this method, a tool should ensure that the the store contains character data and is a reasonable length. Returns null if there any errors.


fixFileName

public static java.lang.String fixFileName(java.lang.String filepath)
Generates a sql safe filename from a filepath by attempting to find the last path segment in the filepath, removing unsafe characters, and shortening to under 50 characters.


errorHtml

public static java.lang.String errorHtml()
Method errorHtml

Returns:
String

errorHtml

public static java.lang.String errorHtml(java.lang.String header,
                                         java.lang.String addBody)
Method errorHtml

Parameters:
header -
addBody -
Returns:
String

turnHttpToLink

public static java.lang.String turnHttpToLink(java.lang.String raw)
Method turnHttpToLink replace lone http, mailto, news, or ftp to link

Parameters:
raw -
Returns:
String

tidy

public static java.lang.String tidy(java.lang.String s)
Returns a 'tidy' version of the String, or null if tidy finds any errors. Converts \n and \n\n to <br>. and <p> respectively. http: string fragments are converted to <a href="...">. links.


tidy

public static java.lang.String tidy(java.lang.String s,
                                    boolean notEncloseText)
Returns a 'tidy' version of the String, or null if tidy finds any errors. If notEncloseText is true, blocks and text are not automatically wrapped in <p>. If notConvertNewlines is true, \n and \n\n are not converted to <br>. and <p> respectively. http: string fragments are converted to <a href="...">. links.


tidy

public static java.lang.String tidy(java.lang.String s,
                                    boolean notEncloseText,
                                    boolean notConvertNewlines)
Returns a 'tidy' version of the String, or null if tidy finds any errors. If notEncloseText is true, blocks and text are not automatically wrapped in <p>. If notConvertNewlines is true, \n and \n\n are not converted to <br>. and <p> respectively. Note that the default for other tidy methods is to convert newlines. http: string fragments are converted to <a href="...">. links.


tidy

public static java.lang.String tidy(java.lang.String s,
                                    boolean notEncloseText,
                                    boolean notConvertNewlines,
                                    boolean autoConvertUrls)
Returns a 'tidy' version of the String, or null if tidy finds any errors. If notEncloseText is true, blocks and text are not automatically wrapped in <p>. If notConvertNewlines is true, \n and \n\n are not converted to <br>. and <p> respectively If autoConvertUrls is true, http: string fragments are converted to <a href="...">. links. note that the default for other tidy methods is to autoConvert URLs


tidy

public static java.lang.String tidy(java.io.BufferedInputStream in)
Returns a 'tidy' version of the characters read from the input stream or null if tidy finds any errors.


tidy

public static java.lang.String tidy(java.io.BufferedInputStream in,
                                    boolean notEncloseText)
Returns a 'tidy' version of the characters read from the input stream, or null if tidy find any errors. If notEncloseText is true, blocks and text are not automatically wrapped in <p>.


getHourNumber

public static int getHourNumber(java.lang.String hourString)
Returns the int value for hour expressed as 12am, 1am, etc.


getMonthNumber

public static int getMonthNumber(java.lang.String monthName)
Returns the java.util.Calendar constant for the given month name.


convertToDate

public static java.util.Date convertToDate(java.lang.Object year,
                                           java.lang.Object month,
                                           java.lang.Object day,
                                           java.lang.Object hour,
                                           java.lang.Object minute)
                                    throws OkapiToolException
return date given year, month, day, hour, and minute as strings. throws exception if date was not a valid date (e.g. February 31)

Throws:
OkapiToolException

urlEncode

public static java.lang.String urlEncode(java.lang.String uri)
Encode URL using java.net.URLEncoder.encode Convenience method which catches a java.io.UnsupportedEncodingException


urlDecode

public static java.lang.String urlDecode(java.lang.String uri)
Decode URL using java.net.URLDecoder.decode Convenience method which catches a java.io.UnsupportedEncodingException



Copyright ? 2001-2009 MIT. All Rights Reserved.