Class JspFunctions

java.lang.Object
org.dlese.dpc.schemedit.JspFunctions

public class JspFunctions extends Object
Provides functionality used by jsp function calls.
Author:
ostwald
  • Constructor Details

    • JspFunctions

      public JspFunctions()
  • Method Details

    • hasRole

      public static boolean hasRole(User user, String role)
      NOT YET DOCUMENTED
      Parameters:
      user - NOT YET DOCUMENTED
      role - NOT YET DOCUMENTED
      Returns:
      NOT YET DOCUMENTED
    • hasCollectionRole

      public static boolean hasCollectionRole(User user, String role, String collection)
      Returns true if user has specified permission for specified collectino
      Parameters:
      user - the user oject
      role - role represented as a string (e.g., "manager")
      Returns:
      true if user has at least specified role
    • isAuthorized

      public static boolean isAuthorized(String operation, SessionBean sessionBean)
      Gets the authorized attribute of the JspFunctions class
      Parameters:
      operation - NOT YET DOCUMENTED
      sessionBean - NOT YET DOCUMENTED
      Returns:
      The authorized value
    • getNamedXPath

      public static String getNamedXPath(String pathName, String xmlFormat, FrameworkRegistry reg)
      Returns the xpath for the provided named schema path (pathName) as configured for the specified framework (xmlFormat). Used on the "create collection page" to give background information about some optional information associated with some frameworks.
      Parameters:
      pathName - configured path name (from framework config)
      xmlFormat - speicified metadata framework (e.g., "adn")
      reg - the FrameworkRegistry
      Returns:
      The bestPracticesLink value
    • isAuthorized

      public static boolean isAuthorized(String operation, SessionBean sessionBean, String collection)
      Gets the authorized attribute of the JspFunctions class
      Parameters:
      operation - NOT YET DOCUMENTED
      sessionBean - NOT YET DOCUMENTED
      collection - NOT YET DOCUMENTED
      Returns:
      The authorized value
    • fileExists

      public static boolean fileExists(String relativePath, HttpServletRequest request)
      Test for existence of file relative to the jsp page in which the function is called.
      Parameters:
      relativePath - NOT YET DOCUMENTED
      request - NOT YET DOCUMENTED
      Returns:
      NOT YET DOCUMENTED
    • getDcsDataDocReader

      public static DcsDataDocReader getDcsDataDocReader(DocReader docReader)
      Gets the dcsDataDocReader attribute of the JspFunctions class
      Parameters:
      docReader - Description of the Parameter
      Returns:
      The dcsDataDocReader value
    • truncate

      public static String truncate(String s, int length)
      Truncate provided string to specified length.
      Parameters:
      s - string to truncate
      length - truncation length
      Returns:
      truncated string
    • getFullName

      public static String getFullName(String username, UserManager userManager)
      Gets the fullName attribute of the JspFunctions class
      Parameters:
      username - a username
      userManager - the UserManager
      Returns:
      the fullName of specified user
    • getStatusLabel

      public static String getStatusLabel(String rawLabel, String collection, SessionBean sessionBean)
      Gets the statusLabel for the specified collection, converting rawLabel to it's human-readable form if it is a "finalStatus".
      Parameters:
      rawLabel - NOT YET DOCUMENTED
      collection - NOT YET DOCUMENTED
      sessionBean - NOT YET DOCUMENTED
      Returns:
      The statusLabel value
    • getSetLabel

      public static String getSetLabel(SetInfo setInfo)
      Gets the setLabel attribute of the JspFunctions class
      Parameters:
      setInfo - NOT YET DOCUMENTED
      Returns:
      The setLabel value
    • listContains

      public static boolean listContains(List items, String item)
      NOT YET DOCUMENTED
      Parameters:
      items - NOT YET DOCUMENTED
      item - NOT YET DOCUMENTED
      Returns:
      NOT YET DOCUMENTED
    • arrayContains

      public static boolean arrayContains(String[] items, String item)
      NOT YET DOCUMENTED
      Parameters:
      items - NOT YET DOCUMENTED
      item - NOT YET DOCUMENTED
      Returns:
      NOT YET DOCUMENTED
    • toCommaDelimited

      public static String toCommaDelimited(Object o)
      Converts either a list or a iterable to a comma-delmited string, which can then be converted into a list for use by Javascript (and in particular Prototype.Array),

      Used when we want to convert a jsp object (List or Array) into a javascript variable.

      Parameters:
      o - NOT YET DOCUMENTED
      Returns:
      NOT YET DOCUMENTED
    • getDcsField

      public static String getDcsField(String fieldName, DocReader docReader)
      Gets the dcsField attribute of the JspFunctions class
      Parameters:
      fieldName - Description of the Parameter
      docReader - Description of the Parameter
      Returns:
      The dcsField value
    • decodePath

      public static String decodePath(String s)
      Removes jsp-encoded xpath indexing from a string

      e.g., /itemRecord/foo_1_/farb_4_ becomes /itemRecord/foo/farb

      Parameters:
      s - Description of the Parameter
      Returns:
      Description of the Return Value
    • getLocalizedSchemaXML

      public static String getLocalizedSchemaXML(String url)
      Gets the localizedSchemaXML attribute of the JspFunctions class
      Parameters:
      url - NOT YET DOCUMENTED
      Returns:
      The localizedSchemaXML value
    • getPrompts

      public static List getPrompts(String xpath, MetaDataFramework framework)
      Gets the prompts defined in the fieldFile for the current xpath and framework.
      Parameters:
      xpath - xpath for prompt
      framework - the framework
      Returns:
      a list of prompt strings, or null
    • getAsnStandard

      public static AsnStandardsNode getAsnStandard(String asnId, CATServiceHelper helper)
    • main

      public static void main(String[] args)
      The main program for the JspFunctions class
      Parameters:
      args - The command line arguments
    • prtln

      public static void prtln(String s)
      NOT YET DOCUMENTED
      Parameters:
      s - NOT YET DOCUMENTED