it.eng.spagobi.commons.utilities
Class StringUtilities

java.lang.Object
  extended by it.eng.spagobi.commons.utilities.StringUtilities

public class StringUtilities
extends java.lang.Object

Author:
Andrea Gioia (andrea.gioia@eng.it)

Constructor Summary
StringUtilities()
           
 
Method Summary
static java.lang.String[] findAttributeValues(java.lang.String attributeValue)
          Find the attribute values in case of multi value attribute.
static java.lang.String quote(java.lang.String s)
          Quote.
static java.lang.String substituteParametersInString(java.lang.String statement, java.util.Map valuesMap, boolean surroundWithQuotes)
          Substitutes parameters with sintax "$P{parameter_name}" whose value is set in the map.
static java.lang.String substituteProfileAttributesInString(java.lang.String statement, it.eng.spago.security.IEngUserProfile profile)
          Substitutes the profile attributes with sintax "${attribute_name}" with the correspondent value in the string passed at input.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtilities

public StringUtilities()
Method Detail

substituteProfileAttributesInString

public static java.lang.String substituteProfileAttributesInString(java.lang.String statement,
                                                                   it.eng.spago.security.IEngUserProfile profile)
                                                            throws java.lang.Exception
Substitutes the profile attributes with sintax "${attribute_name}" with the correspondent value in the string passed at input.

Parameters:
statement - The string to be modified (tipically a query)
profile - The IEngUserProfile object
Returns:
The statement with profile attributes replaced by their values.
Throws:
java.lang.Exception - the exception

findAttributeValues

public static java.lang.String[] findAttributeValues(java.lang.String attributeValue)
                                              throws java.lang.Exception
Find the attribute values in case of multi value attribute. The sintax is: {splitter character{list of values separated by the splitter}}. Examples: {;{value1;value2;value3....}} {|{value1|value2|value3....}}

Parameters:
attributeValue - The String representing the list of attribute values
Returns:
The array of attribute values
Throws:
java.lang.Exception - in case of sintax error

quote

public static java.lang.String quote(java.lang.String s)
Quote.

Parameters:
s - the s
Returns:
the string

substituteParametersInString

public static java.lang.String substituteParametersInString(java.lang.String statement,
                                                            java.util.Map valuesMap,
                                                            boolean surroundWithQuotes)
                                                     throws java.lang.Exception
Substitutes parameters with sintax "$P{parameter_name}" whose value is set in the map.

Parameters:
statement - The string to be modified (tipically a query)
valuesMap - Map name-value
surroundWithQuotes - flag: if true, the replacement will be surrounded by quotes if they are missing
Returns:
The statement with profile attributes replaced by their values.
Throws:
java.lang.Exception - the exception