org.tigris.scarab.util
Class ScarabUtil

java.lang.Object
  extended byorg.tigris.scarab.util.ScarabUtil

public class ScarabUtil
extends java.lang.Object

A Utility class for code that doesn't really go other places.

Version:
$Id: ScarabUtil.java 10284 2006-09-08 15:30:06Z jorgeuriarte $
Author:
Jon Scott Stevens

Constructor Summary
ScarabUtil()
           
 
Method Summary
static boolean contains(java.lang.Object[] array, java.lang.Object obj)
          Check whether Object array contains passed in object.
static java.lang.String filterNonXml(java.lang.String input)
           
static java.lang.String findValue(org.apache.turbine.RunData runData, java.lang.String name)
          Finds the first value for the named request parameter.
static java.lang.String fixEOLs(java.lang.String str)
          Hack to replace the string "\n" with EOL characters...
static void initializeScarab()
          System global initialization.
static java.lang.String linkifyText(java.lang.String input, ScarabLink link, Module module)
          It uses the IssueIdParser to convert all issue id's into links.
static java.lang.String urlEncode(java.lang.String in)
          URL encodes in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScarabUtil

public ScarabUtil()
Method Detail

initializeScarab

public static void initializeScarab()
System global initialization. Useful for random stuff that needs initialization early.


findValue

public static java.lang.String findValue(org.apache.turbine.RunData runData,
                                         java.lang.String name)
Finds the first value for the named request parameter. This is useful to handle the case when there are more than one of the named key fields present on a screen.

Parameters:
runData - Source of the export format information.
name - The name of the request parameter to get a value for.
Returns:
The format type, or null if indeterminate.

linkifyText

public static java.lang.String linkifyText(java.lang.String input,
                                           ScarabLink link,
                                           Module module)
                                    throws java.lang.Exception
It uses the IssueIdParser to convert all issue id's into links. The output is enclosed into a <,pre>...<,/pre> bracket pair so that simple markup (line breaks, white spaces) is preserved.

Throws:
java.lang.Exception

contains

public static final boolean contains(java.lang.Object[] array,
                                     java.lang.Object obj)
Check whether Object array contains passed in object.


fixEOLs

public static java.lang.String fixEOLs(java.lang.String str)
Hack to replace the string "\n" with EOL characters... string.replaceAll("\\n","\n") does not work. Originally part of SimpleHandler but useful as utility method.


urlEncode

public static final java.lang.String urlEncode(java.lang.String in)
URL encodes in. If the string is null, nothing will be written. This method is faster than urlEncodeSlow if the string to encode does not contain any characters needing encoding. It adds some penalty for strings which actually need to be encoded. for short strings ~20 characters the upside is a 75% decrease. while the penalty is a 10% increase. As many query parameters do not need encoding even in i18n applications it should be much better to delay the byte conversion.

Parameters:
in - the String to encode.
Returns:
the url-encoded string.

filterNonXml

public static java.lang.String filterNonXml(java.lang.String input)


Copyright © 2000-2004 Tigris.org. All Rights Reserved.