www.element4solution.com

e4s.application
Class E4ApplObjBasic

java.lang.Object
  extended by e4s.util.E4Object
      extended by e4s.application.E4ApplObjBasic
All Implemented Interfaces:
E4ApplObj_Intf
Direct Known Subclasses:
E4ApplObj, E4ApplObjSimple, E4DBApplObjectTemporary, E4ModuleLogin.E4TempApplObj

public abstract class E4ApplObjBasic
extends E4Object
implements E4ApplObj_Intf

Basic functionality for application objects (e.g. E4ApplObj) such as Language, Login-Time and E4Permission handling.

See Also:
E4ApplObj

Field Summary
protected  long m_created
           
protected  Language m_language
           
protected  java.util.Hashtable m_permissions
           
static java.lang.String PERMISSION_REASON_ADDED
          Used as return value for #canDo_Reason(e4s.db.systabledef.E4Permission) , indicating that this was a permission added by the application using grantPermission(e4s.db.systabledef.E4Permission).
static java.lang.String PERMISSION_REASON_AND
           
static java.lang.String PERMISSION_REASON_COMPANY
          Used as return value for #canDo_Reason(e4s.db.systabledef.E4Permission) , indicating that this was a group permission.
static java.lang.String PERMISSION_REASON_GROUP
          Used as return value for #canDo_Reason(e4s.db.systabledef.E4Permission) , indicating that this was a group permission.
static java.lang.String PERMISSION_REASON_INITIALIZED
          Used as return value for #canDo_Reason(e4s.db.systabledef.E4Permission) , indicating that the permissions have not been initialized (all permission tables are empty).
static java.lang.String PERMISSION_REASON_OR
           
static java.lang.String PERMISSION_REASON_USER
          Used as return value for #canDo_Reason(e4s.db.systabledef.E4Permission) , indicating that this was a group permission.
 
Fields inherited from class e4s.util.E4Object
CRLF, E4S_CORE_SYSTEM_LANGUAGE, NBSP, NULLSTR, URL_ENCODING_CHARSET
 
Fields inherited from interface e4s.application.E4ApplObj_Intf
SESSION_OBJ_ID
 
Constructor Summary
E4ApplObjBasic()
           
 
Method Summary
static java.lang.String _getSVNVersionString()
          Get version info string from subversion.
 java.lang.String canDo_Reason(E4Permission_Intf permission)
          Get the reason for the permission.
static java.lang.String canDo_Reason(E4Permission_Intf permission, java.util.Hashtable pHash)
           
 boolean canDo(E4Permission_Intf permission)
          Checks, if the user is allowed on the specified permission.
 java.lang.String getClient_Name()
          Get the name of the client.
 java.lang.String getClient_RootPath(boolean absolute)
          Get the root path for the current E4Client.
 java.lang.String getClient_URL()
          Get the URL related to the client.
abstract  E4Client getClient()
          Get the E4Client of the user running the application.
 java.lang.String getCompany_Name()
          Get the name of the company.
 CountryCode getCountryCode()
          Get the country-code which depends on the client.
 java.text.SimpleDateFormat getDateFormat()
          Get the date format.
 E4DecimalSign getDecimalSign()
          Use the comma as default decimal sign.
 Language getLanguage()
          Get the language which depends on the client (user).
 java.util.Date getLoginTime()
          Get the login time (the time this object was instanciated)
 E4Permission[] getPermissions()
          Get all valid permissions for that user.
 int getScreenHeight()
          Get Screen Height (if supported by login method)
 int getScreenWidth()
          Get Screen Width (if supported by login method)
 java.lang.String getSession()
           
 java.text.SimpleDateFormat getTimeFormat()
          Get the time format.
 TimeZone getTimeZone()
          Get the time zone for the current logged in user.
 java.lang.String getUser_Name()
          Get the name of the user.
abstract  E4User getUser()
           
 void grantPermission(E4Permission perm)
           
 void readPermission(E4Permission p)
           
 void readPermission(E4Permission p, E4ApplObj_Intf applobj)
           
 void readPermissions()
          Reads the group, company and user permissions into an internal structure (Hashtable) to make them available when the canDo(e4s.db.systabledef.E4Permission_Intf) function will be called.
static java.util.Hashtable readPermissions(E4User user, E4ApplObj_Intf applobj)
           
 void setLanguage(Language language)
          Set the language which depends on the client (user).
 void setScreenHeight(int height)
           
 void setScreenWidth(int width)
           
 void setSession(java.lang.String sessionId)
           
 
Methods inherited from class e4s.util.E4Object
Calendar, CName, CName, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelNone, E4LabelNone, E4LabelNone, E4LabelNone, E4LabelSys, E4LabelSys, e4sCopyright, e4sVersion, encode, encode, encode, encodeHtml, encodeHtml, encodeHtml, encodeURL, encodeURL, encodeURL, finalize, getLINE, getTRACE, getTRACE, getTRACE, getTRACE, getTRACE, getTRACE, getTraceMemory, HtmlEncode, HtmlEncode, HtmlEncode, isdecimal, isdigit, isnotok, isnotok, isnumeric, isok, isok, isok, isok, lastCallingFunction, lastCallingFunction, lastCallingFunction, lastCallingFunction, lastCallingStack, mkdirs, null2nbsp, null2nbsp, null2nbsp, ok, ok, ok, ok, outPrintln, setLogFile4Trace, setTraceMemory, STACKTRACE, toDebug, toDouble, toFloat, toFloat, toString, TRACE_CALLS, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, wait
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface e4s.application.E4ApplObj_Intf
canBeUsedForSystemLogin
 

Field Detail

m_permissions

protected java.util.Hashtable m_permissions

m_language

protected Language m_language

m_created

protected long m_created

PERMISSION_REASON_GROUP

public static final java.lang.String PERMISSION_REASON_GROUP
Used as return value for #canDo_Reason(e4s.db.systabledef.E4Permission) , indicating that this was a group permission.

See Also:
PERMISSION_REASON_COMPANY, PERMISSION_REASON_USER, #canDo_Reason(e4s.db.systabledef.E4Permission), readPermissions(), Constant Field Values

PERMISSION_REASON_COMPANY

public static final java.lang.String PERMISSION_REASON_COMPANY
Used as return value for #canDo_Reason(e4s.db.systabledef.E4Permission) , indicating that this was a group permission.

See Also:
PERMISSION_REASON_GROUP, PERMISSION_REASON_USER, #canDo_Reason(e4s.db.systabledef.E4Permission), readPermissions(), Constant Field Values

PERMISSION_REASON_USER

public static final java.lang.String PERMISSION_REASON_USER
Used as return value for #canDo_Reason(e4s.db.systabledef.E4Permission) , indicating that this was a group permission.

See Also:
PERMISSION_REASON_GROUP, PERMISSION_REASON_COMPANY, #canDo_Reason(e4s.db.systabledef.E4Permission), readPermissions(), Constant Field Values

PERMISSION_REASON_AND

public static final java.lang.String PERMISSION_REASON_AND
See Also:
Constant Field Values

PERMISSION_REASON_OR

public static final java.lang.String PERMISSION_REASON_OR
See Also:
Constant Field Values

PERMISSION_REASON_ADDED

public static final java.lang.String PERMISSION_REASON_ADDED
Used as return value for #canDo_Reason(e4s.db.systabledef.E4Permission) , indicating that this was a permission added by the application using grantPermission(e4s.db.systabledef.E4Permission).

See Also:
PERMISSION_REASON_GROUP, PERMISSION_REASON_COMPANY, #canDo_Reason(e4s.db.systabledef.E4Permission), readPermissions(), Constant Field Values

PERMISSION_REASON_INITIALIZED

public static final java.lang.String PERMISSION_REASON_INITIALIZED
Used as return value for #canDo_Reason(e4s.db.systabledef.E4Permission) , indicating that the permissions have not been initialized (all permission tables are empty).

See Also:
PERMISSION_REASON_GROUP, PERMISSION_REASON_COMPANY, PERMISSION_REASON_USER, #canDo_Reason(e4s.db.systabledef.E4Permission), Constant Field Values
Constructor Detail

E4ApplObjBasic

public E4ApplObjBasic()
Method Detail

getClient

public abstract E4Client getClient()
Get the E4Client of the user running the application.

Specified by:
getClient in interface E4ApplObj_Intf
Returns:
the E4Client

getUser

public abstract E4User getUser()
Specified by:
getUser in interface E4ApplObj_Intf

getClient_RootPath

public java.lang.String getClient_RootPath(boolean absolute)
Get the root path for the current E4Client. The root path of the client identifies the area where client specific files to be stored. It is based on the entry E4Settings.getHttpRoot().

Specified by:
getClient_RootPath in interface E4ApplObj_Intf
Parameters:
absolute - construct an absolute path using the E4Settings.getHttpRoot()
See Also:
E4Settings.getHttpRoot(), e4s.application.E4Client#getRootPath(boolean), E4Client.RELATIVE_ROOT_PATH

getClient_URL

public java.lang.String getClient_URL()
Get the URL related to the client.

Specified by:
getClient_URL in interface E4ApplObj_Intf
See Also:
#getClient_RootPath(), E4Settings.DOCBASE, e4s.application.E4Client#getClient_URL(boolean), E4Client.RELATIVE_ROOT_PATH

setLanguage

public void setLanguage(Language language)
                 throws java.lang.Exception
Set the language which depends on the client (user).

Specified by:
setLanguage in interface E4ApplObj_Intf
Parameters:
language - the language, using ISO abbreviations
Throws:
java.lang.Exception
See Also:
getLanguage()

getLanguage

public Language getLanguage()
Get the language which depends on the client (user).

Specified by:
getLanguage in interface E4ApplObj_Intf
Returns:
language-code, using ISO abbreviations
See Also:
setLanguage(e4s.application.Language)

getLoginTime

public java.util.Date getLoginTime()
Get the login time (the time this object was instanciated)

Specified by:
getLoginTime in interface E4ApplObj_Intf
Returns:
the login time

canDo

public boolean canDo(E4Permission_Intf permission)
Checks, if the user is allowed on the specified permission. The group permission stands above the company permission which stands above the user permission. A group permission can deny (-1), grant (+1) or delegate (0) a permission. If delegated, then the company permission becames relevant, which also can deny, grant or delegate. Again, if delegated on company level then the user permission becomes relevant.

Specified by:
canDo in interface E4ApplObj_Intf
Parameters:
permission - the permission to be tested
Returns:
true if permission is null or if the permission is granted on Group, Company or E4User level
Throws:
java.lang.Exception
See Also:
E4ModuleEditPermissions, E4PermissionRegistry, E4ModuleImplementation.getApplication_Permissions(), E4ModuleImplementation.getE4S_Permissions(), #canDo_Reason(e4s.db.systabledef.E4Permission), readPermissions()

getPermissions

public E4Permission[] getPermissions()
Get all valid permissions for that user.

Specified by:
getPermissions in interface E4ApplObj_Intf
Returns:
null if no permissions are defined

canDo_Reason

public java.lang.String canDo_Reason(E4Permission_Intf permission)
                              throws E4PermissionException
Get the reason for the permission.

Returns:
Return null if no permission - or the reason can be either a group permission, returning a value of PERMISSION_REASON_GROUP indicates that, or a company permission which is indicated by PERMISSION_REASON_COMPANY or a user based permission incicated by PERMISSION_REASON_USER.
Throws:
E4PermissionException
See Also:
#canDo(e4s.db.systabledef.E4Permission), readPermissions()

canDo_Reason

public static java.lang.String canDo_Reason(E4Permission_Intf permission,
                                            java.util.Hashtable pHash)

readPermissions

public void readPermissions()
                     throws E4DBException
Reads the group, company and user permissions into an internal structure (Hashtable) to make them available when the canDo(e4s.db.systabledef.E4Permission_Intf) function will be called.

Throws:
E4DBException
See Also:
canDo(e4s.db.systabledef.E4Permission_Intf), #canDo_Reason(e4s.db.systabledef.E4Permission)

readPermission

public void readPermission(E4Permission p)
                    throws E4DBException
Throws:
E4DBException

readPermission

public void readPermission(E4Permission p,
                           E4ApplObj_Intf applobj)
                    throws E4DBException
Throws:
E4DBException

grantPermission

public void grantPermission(E4Permission perm)

readPermissions

public static java.util.Hashtable readPermissions(E4User user,
                                                  E4ApplObj_Intf applobj)
                                           throws E4DBException
Throws:
E4DBException

getDecimalSign

public E4DecimalSign getDecimalSign()
Use the comma as default decimal sign.

Specified by:
getDecimalSign in interface E4ApplObj_Intf
Returns:
E4DecimalSign.C_COMMA

getDateFormat

public java.text.SimpleDateFormat getDateFormat()
Get the date format.

Specified by:
getDateFormat in interface E4ApplObj_Intf
Returns:
the dateformat
See Also:
getTimeFormat(), E4ServletImplementation_Intf.getDateFormat(), T_E4S_COMPANY_USER_Sel.CI_DATEFORMAT

getTimeFormat

public java.text.SimpleDateFormat getTimeFormat()
Get the time format.

Specified by:
getTimeFormat in interface E4ApplObj_Intf
Returns:
"HH:mm:ss" by default
See Also:
getDateFormat(), E4ServletImplementation_Intf.getTimeFormat(), T_E4S_COMPANY_USER_Sel.CI_TIMEFORMAT

getTimeZone

public TimeZone getTimeZone()
Get the time zone for the current logged in user.

Specified by:
getTimeZone in interface E4ApplObj_Intf
Returns:
the timezone, 0 means GMT

getCountryCode

public CountryCode getCountryCode()
Description copied from interface: E4ApplObj_Intf
Get the country-code which depends on the client. Note, that this is not the user's countrycode as it is necessary to have a E4Client dependent value, e.g. for a calendar.

Specified by:
getCountryCode in interface E4ApplObj_Intf
Returns:
"US"

getClient_Name

public java.lang.String getClient_Name()
Description copied from interface: E4ApplObj_Intf
Get the name of the client.

Specified by:
getClient_Name in interface E4ApplObj_Intf
See Also:
E4ApplObj_Intf.getClient()

getCompany_Name

public java.lang.String getCompany_Name()
Description copied from interface: E4ApplObj_Intf
Get the name of the company.

Specified by:
getCompany_Name in interface E4ApplObj_Intf
See Also:
E4ApplObj_Intf.getUser()

getUser_Name

public java.lang.String getUser_Name()
Description copied from interface: E4ApplObj_Intf
Get the name of the user.

Specified by:
getUser_Name in interface E4ApplObj_Intf
See Also:
E4ApplObj_Intf.getUser()

setScreenWidth

public void setScreenWidth(int width)

setScreenHeight

public void setScreenHeight(int height)

getScreenWidth

public int getScreenWidth()
Description copied from interface: E4ApplObj_Intf
Get Screen Width (if supported by login method)

Specified by:
getScreenWidth in interface E4ApplObj_Intf
See Also:
E4ApplObj_Intf.getScreenHeight()

getScreenHeight

public int getScreenHeight()
Description copied from interface: E4ApplObj_Intf
Get Screen Height (if supported by login method)

Specified by:
getScreenHeight in interface E4ApplObj_Intf
See Also:
E4ApplObj_Intf.getScreenWidth()

getSession

public java.lang.String getSession()
Specified by:
getSession in interface E4ApplObj_Intf

setSession

public void setSession(java.lang.String sessionId)

_getSVNVersionString

public static java.lang.String _getSVNVersionString()
Get version info string from subversion.

Returns:
the version info string.
See Also:
E4Util.getRevisionCodeFromSVN(Class)

www.element4solution.com