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_FILE_DATASET_SIZE
           
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.lang.String getCountry(java.lang.String language)
           
static java.util.Locale getCurrentLocale(it.eng.spago.base.RequestContainer requestContainer)
           
static int getDataSetFileMaxSize()
           
static int getDatasetMaxResults()
           
static java.util.Locale getDefaultLocale()
          Gets the default locale.
static java.lang.String getLocaleDateFormat(java.util.Locale 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.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.Locale getStartingDefaultLocale()
          Gets the default locale from SpagoBI configuraiton file, the behaviours is the same of getDefaultLocale() function, with difference that if not finds returns null TODO : merge its behaviour with GetDefaultLocale (not done know cause today is release date).
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 boolean isSSOEnabled()
          Returns true if the SSO is enabled (SPAGOBI_SSO.ACTIVE in spagobi_SSO.xml equals true ignoring the case), false otherwise
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, 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

MAX_DEFAULT_FILE_DATASET_SIZE

public static final int MAX_DEFAULT_FILE_DATASET_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

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

isSSOEnabled

public static boolean isSSOEnabled()
Returns true if the SSO is enabled (SPAGOBI_SSO.ACTIVE in spagobi_SSO.xml equals true ignoring the case), false otherwise

Returns:
true if the SSO is enabled (SPAGOBI_SSO.ACTIVE in spagobi_SSO.xml equals true ignoring the case), false otherwise

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

getStartingDefaultLocale

public static java.util.Locale getStartingDefaultLocale()
Gets the default locale from SpagoBI configuraiton file, the behaviours is the same of getDefaultLocale() function, with difference that if not finds returns null TODO : merge its behaviour with GetDefaultLocale (not done know cause today is release date). Gets the default locale.

Returns:
the default locale

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()

getCountry

public static java.lang.String getCountry(java.lang.String language)

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)

getLocaleDateFormat

public static java.lang.String getLocaleDateFormat(java.util.Locale locale)

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()

getDataSetFileMaxSize

public static int getDataSetFileMaxSize()

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

getDatasetMaxResults

public static int getDatasetMaxResults()