it.eng.spagobi.commons.utilities
Class GeneralUtilities

java.lang.Object
  extended by it.eng.spagobi.commons.utilities.SpagoBIUtilities
      extended by it.eng.spagobi.commons.utilities.GeneralUtilities

public class GeneralUtilities
extends it.eng.spagobi.commons.utilities.SpagoBIUtilities

Contains some SpagoBI's general utilities.


Field Summary
static int MAX_DEFAULT_TEMPLATE_SIZE
           
 
Constructor Summary
GeneralUtilities()
           
 
Method Summary
static it.eng.spago.security.IEngUserProfile createNewUserProfile(java.lang.String userId)
          Creates a new user profile, given his identifier.
static java.util.Locale getCurrentLocale(it.eng.spago.base.RequestContainer requestContainer)
           
static java.util.Locale getDefaultLocale()
          Gets the default locale.
static java.lang.String getLocaleDateFormat(it.eng.spago.base.SessionContainer permSess)
           
static java.lang.String getLocaleDateFormatForExtJs(it.eng.spago.base.SessionContainer permSess)
           
static java.lang.String getLovMapResult(java.util.Map lovs)
          Gets the lov map result.
static java.lang.String getLovResult(java.lang.String lovLabel)
          Gets the lov result.
static java.lang.String getLovResult(java.lang.String lovLabel, it.eng.spago.security.IEngUserProfile profile)
          Gets the lov result.
static java.util.Map getParametersFromURL(java.lang.String urlString)
          getParametersFromURL: takes an url and return a Map containing URL parameters
static java.lang.String getServerDateFormat()
           
static java.lang.String getServerDateFormatExtJs()
           
static java.lang.String getServerTimeStampFormat()
           
static java.lang.String getServerTimestampFormatExtJs()
           
static java.lang.String getSessionExpiredURL()
           
static java.lang.String getSpagoAdapterHttpUrl()
          Gets the spago adapter http url.
static java.lang.String getSpagoBiContext()
           
static java.lang.String getSpagoBiDashboardServlet()
          Gets the spagoBI's dashboards servlet information as a string.
static java.lang.String getSpagoBiHost()
           
static java.lang.String getSpagoBIProfileBaseUrl(java.lang.String userId)
          Returns the complete HTTP URL and puts it into a string.
static java.util.List<java.util.Locale> getSupportedLocales()
           
static org.json.JSONArray getSupportedLocalesAsJSONArray()
           
static int getTemplateMaxSize()
           
static java.lang.String getUrl(java.lang.String baseUrl, java.util.Map mapPars)
          Returns an url starting with the given base url and adding parameters retrieved by the input parameters map.
static java.lang.String replaceInternationalizedMessages(java.lang.String message)
          Substitutes the substrings with sintax "${code,bundle}" or "${code}" (in the second case bundle is assumed to be the default value "messages") with the correspondent internationalized messages in the input String.
static void subsituteBIObjectParametersLovProfileAttributes(BIObject obj, it.eng.spago.base.SessionContainer session)
          Subsitute bi object parameters lov profile attributes.
 
Methods inherited from class it.eng.spagobi.commons.utilities.SpagoBIUtilities
checkForSystemProperty, cleanString, decode, deleteContentDir, deleteDir, encode, findAttributeValues, flushFromInputStreamToOutputStream, fromListToString, getAllProfileAttributes, getByteArrayFromInputStream, getLocalIPAddressAsString, getRelativeFileNames, isErrorHandlerContainingOnlyValidationError, main, quote, readJndiResource, replace, substituteQuotesIntoString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_DEFAULT_TEMPLATE_SIZE

public static final int MAX_DEFAULT_TEMPLATE_SIZE
See Also:
Constant Field Values
Constructor Detail

GeneralUtilities

public GeneralUtilities()
Method Detail

replaceInternationalizedMessages

public static java.lang.String replaceInternationalizedMessages(java.lang.String message)
Substitutes the substrings with sintax "${code,bundle}" or "${code}" (in the second case bundle is assumed to be the default value "messages") with the correspondent internationalized messages in the input String. This method calls PortletUtilities.getMessage(key, bundle).

Parameters:
message - The string to be modified
Returns:
The message with the internationalized substrings replaced.

subsituteBIObjectParametersLovProfileAttributes

public static void subsituteBIObjectParametersLovProfileAttributes(BIObject obj,
                                                                   it.eng.spago.base.SessionContainer session)
                                                            throws java.lang.Exception,
                                                                   it.eng.spago.error.EMFInternalError
Subsitute bi object parameters lov profile attributes.

Parameters:
obj - the obj
session - the session
Throws:
java.lang.Exception - the exception
it.eng.spago.error.EMFInternalError - the EMF internal error

getLovMapResult

public static java.lang.String getLovMapResult(java.util.Map lovs)
Gets the lov map result.

Parameters:
lovs - the lovs
Returns:
the lov map result

getLovResult

public static java.lang.String getLovResult(java.lang.String lovLabel)
                                     throws java.lang.Exception
Gets the lov result.

Parameters:
lovLabel - the lov label
Returns:
the lov result
Throws:
java.lang.Exception - the exception

getLovResult

public static java.lang.String getLovResult(java.lang.String lovLabel,
                                            it.eng.spago.security.IEngUserProfile profile)
                                     throws java.lang.Exception
Gets the lov result.

Parameters:
lovLabel - the lov label
profile - the profile
Returns:
the lov result
Throws:
java.lang.Exception - the exception

createNewUserProfile

public static it.eng.spago.security.IEngUserProfile createNewUserProfile(java.lang.String userId)
                                                                  throws java.lang.Exception
Creates a new user profile, given his identifier.

Parameters:
userId - The user identifier
Returns:
The newly created user profile
Throws:
java.lang.Exception - the exception

getSpagoBIProfileBaseUrl

public static java.lang.String getSpagoBIProfileBaseUrl(java.lang.String userId)
Returns the complete HTTP URL and puts it into a string.

Parameters:
userId - the user id
Returns:
A String with complete HTTP Url

getSpagoBiDashboardServlet

public static java.lang.String getSpagoBiDashboardServlet()
Gets the spagoBI's dashboards servlet information as a string.

Returns:
A string containing spagoBI's dashboards servlet information

getSpagoBiHost

public static java.lang.String getSpagoBiHost()

getSpagoAdapterHttpUrl

public static java.lang.String getSpagoAdapterHttpUrl()
Gets the spago adapter http url.

Returns:
the spago adapter http url

getDefaultLocale

public static java.util.Locale getDefaultLocale()
Gets the default locale.

Returns:
the default locale

getSupportedLocales

public static java.util.List<java.util.Locale> getSupportedLocales()

getSupportedLocalesAsJSONArray

public static org.json.JSONArray getSupportedLocalesAsJSONArray()

getCurrentLocale

public static java.util.Locale getCurrentLocale(it.eng.spago.base.RequestContainer requestContainer)

getLocaleDateFormat

public static java.lang.String getLocaleDateFormat(it.eng.spago.base.SessionContainer permSess)

getLocaleDateFormatForExtJs

public static java.lang.String getLocaleDateFormatForExtJs(it.eng.spago.base.SessionContainer permSess)

getServerDateFormat

public static java.lang.String getServerDateFormat()

getServerTimeStampFormat

public static java.lang.String getServerTimeStampFormat()

getServerDateFormatExtJs

public static java.lang.String getServerDateFormatExtJs()

getServerTimestampFormatExtJs

public static java.lang.String getServerTimestampFormatExtJs()

getTemplateMaxSize

public static int getTemplateMaxSize()

getSpagoBiContext

public static java.lang.String getSpagoBiContext()

getSessionExpiredURL

public static java.lang.String getSessionExpiredURL()

getUrl

public static java.lang.String getUrl(java.lang.String baseUrl,
                                      java.util.Map mapPars)
Returns an url starting with the given base url and adding parameters retrieved by the input parameters map. Each parameter value is encoded using URLEncoder.encode(value, "UTF-8");

Parameters:
baseUrl - The base url
mapPars - The parameters map; those parameters will be added to the base url (values will be encoded using UTF-8 encoding)
Returns:
an url starting with the given base url and adding parameters retrieved by the input parameters map

getParametersFromURL

public static java.util.Map getParametersFromURL(java.lang.String urlString)
getParametersFromURL: takes an url and return a Map containing URL parameters

Parameters:
urlString -
Returns:
map containing url parameters