it.eng.spagobi.utilities
Class GeneralUtilities

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

public class GeneralUtilities
extends java.lang.Object

Contains some SpagoBI's general utilities.

Author:
zoppello

Constructor Summary
GeneralUtilities()
           
 
Method Summary
static groovy.lang.Binding fillBinding(java.util.HashMap attrs)
           
static groovy.lang.Binding fillBinding(it.eng.spago.security.IEngUserProfile profile)
           
static java.util.HashMap getAllProfileAttributes()
          Get all the possible profile attributes of the users.
static byte[] getByteArrayFromInputStream(java.io.InputStream is)
          Given an InputStream as input, gets the correspondent bytes array.
static java.lang.String getLocalIPAddressAsString()
          Returns a string containing the localhost IP address.
static java.lang.String getRelativeFileNames(java.lang.String completeFileName)
          From a String identifying the complete name for a file, gets the relative file names, which are substrings of the starting String, according to the java separator "/".
static java.lang.String getSpagoBiContentRepositoryServlet()
          Gets the spagoBI's content repository servlet information as a string.
static java.lang.String getSpagoBiContextAddress()
          Returns the context address for SpagoBI as an URL and puts it into a string.
static void main(java.lang.String[] args)
          The Main method
static java.lang.String testScript(java.lang.String script, groovy.lang.Binding bind)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeneralUtilities

public GeneralUtilities()
Method Detail

main

public static void main(java.lang.String[] args)
The Main method

Parameters:
args - String for command line arguments

getByteArrayFromInputStream

public static byte[] getByteArrayFromInputStream(java.io.InputStream is)
Given an InputStream as input, gets the correspondent bytes array.

Parameters:
is - The input straeam
Returns:
An array of bytes obtained from the input stream.

getRelativeFileNames

public static java.lang.String getRelativeFileNames(java.lang.String completeFileName)
From a String identifying the complete name for a file, gets the relative file names, which are substrings of the starting String, according to the java separator "/".

Parameters:
completeFileName - The string representing the file name
Returns:
relative names substring

getLocalIPAddressAsString

public static java.lang.String getLocalIPAddressAsString()
Returns a string containing the localhost IP address.

Returns:
The IP address String

getSpagoBiContextAddress

public static java.lang.String getSpagoBiContextAddress()
Returns the context address for SpagoBI as an URL and puts it into a string. The information contained are the Srever name and port. Before saving, both them are written into the output console.

Returns:
A String with SpagoBI's context adderss

getSpagoBiContentRepositoryServlet

public static java.lang.String getSpagoBiContentRepositoryServlet()
Gets the spagoBI's content repository servlet information as a string.

Returns:
A string containing spagoBI's content repository servlet information

getAllProfileAttributes

public static java.util.HashMap getAllProfileAttributes()
Get all the possible profile attributes of the users. The attributes are contained into a configuration file which contains the name of the attribute and the test value of the attribute. The test value is used during the test of a script that use the attribute.

Returns:
HashMap of the attributes. HashMap keys are profile attribute. HashMap values are test values.

fillBinding

public static groovy.lang.Binding fillBinding(java.util.HashMap attrs)

fillBinding

public static groovy.lang.Binding fillBinding(it.eng.spago.security.IEngUserProfile profile)

testScript

public static java.lang.String testScript(java.lang.String script,
                                          groovy.lang.Binding bind)
                                   throws java.lang.Exception
Throws:
java.lang.Exception