Package org.openbravo.base.secureApp
Class VariablesSecureApp
- java.lang.Object
-
- org.openbravo.base.VariablesBase
-
- org.openbravo.base.secureApp.VariablesSecureApp
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
VariablesSecureAppMock
public class VariablesSecureApp extends VariablesBase implements Serializable
This class is used to provide the coder with friendly methods to retrieve certain environment, session and servlet call variables.- Author:
- Openbravo
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.openbravo.base.VariablesBase
isMultipart
-
-
Constructor Summary
Constructors Constructor Description VariablesSecureApp(String strUser, String strClient, String strOrganization)
Constructor used to make an empty/manual instance of this class.VariablesSecureApp(String strUser, String strClient, String strOrganization, String strRole)
Constructor used to make an empty/manual instance of this class.VariablesSecureApp(String strUser, String strClient, String strOrganization, String strRole, String strLanguage)
Constructor used to make an empty/manual instance of this class.VariablesSecureApp(javax.servlet.http.HttpServletRequest request)
Constructor that parses the session variables to initialize the class' internal variables.VariablesSecureApp(javax.servlet.http.HttpServletRequest request, boolean f)
Constructor that parses the session variables to initialize the class' internal variables for multipart requests.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
commandIn(String... commands)
Returns true if the Command parameter of the HTTP POST/GET request to the servlet is one of the specified values, false if not.String
getAccessLevel()
String
getClient()
Returns the ID of the client (AD_CLIENT_ID) as defined by the role of the user's current session.String
getCommand()
Returns the command that was passed to the servlet through the Command parameter of the HTTP POST/GET.String
getDBSession()
Returns the ID of the session stored within the AD_SESSION database table.FieldProvider
getEditionData(String AD_Tab_ID)
String
getJavaDataTimeFormat()
String
getJavaDateFormat()
Returns the date format used in Java formatting as defined by the dateFormat.java variable within the config/Openbravo.properties configuration file.String
getJsDateFormat()
Returns the date format used in Javascript formatting as defined by the dateFormat.java variable within the config/Openbravo.properties configuration file.String
getLanguage()
Returns the code of the language currently selected by the authenticated user according to the RFC 4646 format LANG_REGION, e.g.OBError
getMessage(String AD_Tab_ID)
Returns a deserialized OBError object retrieved from the session data that might contain the error information for the specified tab.String
getOrg()
Returns the ID of the organization (AD_ORG_ID) selected by the user among the ones available within the role of the current session.String
getRole()
Returns the primary key (AD_ROLE_ID) of the role of the authenticated user deriving as entered in the AD_ROLE table.String
getSqlDateFormat()
Returns the date format used in SQL formatting as defined by the dateFormat.sql variable within the config/Openbravo.properties configuration file.String
getTheme()
Returns the unique name of the theme currently selected for the session.String
getUser()
Returns the primary key (AD_USER_ID) of the authenticated user deriving from the AD_USER table.String
getUserClient()
String
getUserOrg()
String
getWarehouse()
Returns the ID of the current default warehouse that will be used with transactions that require a warehouse selected.void
removeEditionData(String AD_Tab_ID)
void
removeMessage(String AD_Tab_ID)
Removes the error object for the specified tab from the session data.void
setEditionData(String AD_Tab_ID, FieldProvider data)
void
setMessage(String AD_Tab_ID, OBError error)
Serializes and saves the error object to a session variable, specific to the tab which ID is being passed.-
Methods inherited from class org.openbravo.base.VariablesBase
clearSession, clearSession, getGlobalVariable, getGlobalVariable, getGlobalVariable, getGlobalVariable, getGlobalVariable, getGlobalVariable, getInGlobalVariable, getInGlobalVariable, getInGlobalVariable, getInGlobalVariable, getInGlobalVariable, getInGlobalVariable, getInParameter, getInParameter, getInParameter, getInParameter, getInParameter, getInParameter, getInStringParameter, getInStringParameter, getInStringParameter, getInStringParameter, getInStringParameter, getInStringParameter, getListFromInString, getMultiFile, getMultiParameter, getMultiParameter, getMultiParameters, getMultiParameters, getMultiValueStringParameter, getNumericGlobalVariable, getNumericParameter, getNumericParameter, getNumericRequestGlobalVariable, getParameterNames, getPostDataHash, getRequestGlobalVariable, getRequestGlobalVariable, getRequestInGlobalVariable, getRequestInGlobalVariable, getRequiredGlobalVariable, getRequiredGlobalVariable, getRequiredInGlobalVariable, getRequiredInGlobalVariable, getRequiredInParameter, getRequiredInParameter, getRequiredInputGlobalVariable, getRequiredInputGlobalVariable, getRequiredInStringParameter, getRequiredInStringParameter, getRequiredNumericParameter, getRequiredNumericParameter, getRequiredStringParameter, getRequiredStringParameter, getSessionObject, getSessionValue, getSessionValue, getStringParameter, getStringParameter, getStringParameter, getStringParameter, getStringParameter, getStringParameter, hasParameter, removeSessionValue, setSessionObject, setSessionObject, setSessionValue
-
-
-
-
Constructor Detail
-
VariablesSecureApp
public VariablesSecureApp(String strUser, String strClient, String strOrganization)
Constructor used to make an empty/manual instance of this class.- Parameters:
strUser
- ID of the user as specified by the AD_USER_ID column within the AD_USER database table.strClient
- ID of the client as specified by the AD_CLIENT_ID column within the AD_CLIENT database table.strOrganization
- ID of the organization as specified by the AD_ORG_ID column within the AD_ORG database table.
-
VariablesSecureApp
public VariablesSecureApp(String strUser, String strClient, String strOrganization, String strRole)
Constructor used to make an empty/manual instance of this class.- Parameters:
strUser
- ID of the user as specified by the AD_USER_ID column within the AD_USER database table.strClient
- ID of the client as specified by the AD_CLIENT_ID column within the AD_CLIENT database table.strOrganization
- ID of the organization as specified by the AD_ORG_ID column within the AD_ORG database table.strRole
- ID of the role as specified by the AD_ROLE_ID column within the AD_ROLE database table.
-
VariablesSecureApp
public VariablesSecureApp(String strUser, String strClient, String strOrganization, String strRole, String strLanguage)
Constructor used to make an empty/manual instance of this class.- Parameters:
strUser
- ID of the user as specified by the AD_USER_ID column within the AD_USER database table.strClient
- ID of the client as specified by the AD_CLIENT_ID column within the AD_CLIENT database table.strOrganization
- ID of the organization as specified by the AD_ORG_ID column within the AD_ORG database table.strLanguage
- Language
-
VariablesSecureApp
public VariablesSecureApp(javax.servlet.http.HttpServletRequest request)
Constructor that parses the session variables to initialize the class' internal variables.- Parameters:
request
- HttpServletRequest object originating from the user request.
-
VariablesSecureApp
public VariablesSecureApp(javax.servlet.http.HttpServletRequest request, boolean f)
Constructor that parses the session variables to initialize the class' internal variables for multipart requests.- Parameters:
request
- HttpServletRequest object originating from the user request.
-
-
Method Detail
-
getUser
public String getUser()
Returns the primary key (AD_USER_ID) of the authenticated user deriving from the AD_USER table.- Returns:
- AD_USER_ID primary key number formatted as string
-
getRole
public String getRole()
Returns the primary key (AD_ROLE_ID) of the role of the authenticated user deriving as entered in the AD_ROLE table.- Returns:
- AD_ROLE_ID primary key number formatted as string
-
getLanguage
public String getLanguage()
Returns the code of the language currently selected by the authenticated user according to the RFC 4646 format LANG_REGION, e.g. es_ES for Spanish language from Spain or en_GB for English language from Great Britain.- Returns:
- The language code formatted as a string according to RFC 4646.
-
getTheme
public String getTheme()
Returns the unique name of the theme currently selected for the session. This usually corresponds to the theme's folder name in the web/skins. Default theme's value is 'Default'.- Returns:
- String with the unique name of the theme.
-
getClient
public String getClient()
Returns the ID of the client (AD_CLIENT_ID) as defined by the role of the user's current session.- Returns:
- String with the AD_CLIENT_ID primary key value.
-
getOrg
public String getOrg()
Returns the ID of the organization (AD_ORG_ID) selected by the user among the ones available within the role of the current session.- Returns:
- String with the AD_ORG_ID primary key value.
-
getUserClient
public String getUserClient()
-
getUserOrg
public String getUserOrg()
-
getWarehouse
public String getWarehouse()
Returns the ID of the current default warehouse that will be used with transactions that require a warehouse selected. This is selected using the Role change window and the user can only select warehouses he or she has access to.- Returns:
- String with the M_WAREHOUSE primary key value.
-
getDBSession
public String getDBSession()
Returns the ID of the session stored within the AD_SESSION database table.- Returns:
- String with the AD_SESSION primary key value.
-
getCommand
public String getCommand()
Returns the command that was passed to the servlet through the Command parameter of the HTTP POST/GET. Normally used by the java controllers so that one controller can support various actions/functions.- Returns:
- String containing the value of the Command parameter.
-
getAccessLevel
public String getAccessLevel()
-
commandIn
public boolean commandIn(String... commands)
Returns true if the Command parameter of the HTTP POST/GET request to the servlet is one of the specified values, false if not.- Parameters:
commands
- The list of strings to compare Command parameter to.- Returns:
true
in case current command is any of the ones passed as parameter- See Also:
getCommand()
-
getJavaDateFormat
public String getJavaDateFormat()
Returns the date format used in Java formatting as defined by the dateFormat.java variable within the config/Openbravo.properties configuration file.- Returns:
- Formatting string, for example 'dd-MM-yyyy'.
-
getJavaDataTimeFormat
public String getJavaDataTimeFormat()
- Returns:
- the javaDataTimeFormat
-
getJsDateFormat
public String getJsDateFormat()
Returns the date format used in Javascript formatting as defined by the dateFormat.java variable within the config/Openbravo.properties configuration file.- Returns:
- Formatting string, for example '%d-%m-%Y'.
-
getSqlDateFormat
public String getSqlDateFormat()
Returns the date format used in SQL formatting as defined by the dateFormat.sql variable within the config/Openbravo.properties configuration file.- Returns:
- Formatting string, for example 'DD-MM-YYYY'.
-
getMessage
public OBError getMessage(String AD_Tab_ID)
Returns a deserialized OBError object retrieved from the session data that might contain the error information for the specified tab. This error would normally be generated by the controller servlet of that tab.- Parameters:
AD_Tab_ID
- String with the primary key (ID) of the tab as entered within the AD_TAB database table.- Returns:
- Deserialized OBError object retrieved from the session. Null if no error message exists for this tab.
- See Also:
setMessage(String, OBError)
,removeMessage(String)
-
setMessage
public void setMessage(String AD_Tab_ID, OBError error)
Serializes and saves the error object to a session variable, specific to the tab which ID is being passed.- Parameters:
AD_Tab_ID
- String with the primary key (ID) of the tab as entered within the AD_TAB database table.error
- The OBError object that needs to be set.- See Also:
setMessage(String, OBError)
,removeMessage(String)
-
removeMessage
public void removeMessage(String AD_Tab_ID)
Removes the error object for the specified tab from the session data. This needs to be done in order for the message not to appear every time the tab is reloaded.- Parameters:
AD_Tab_ID
- String with the primary key (ID) of the tab as entered within the AD_TAB database table.- See Also:
setMessage(String, OBError)
,getMessage(String)
-
getEditionData
public FieldProvider getEditionData(String AD_Tab_ID)
-
setEditionData
public void setEditionData(String AD_Tab_ID, FieldProvider data)
-
removeEditionData
public void removeEditionData(String AD_Tab_ID)
-
-