org.bibalex.daf.entities
Class User

java.lang.Object
  extended by org.bibalex.daf.entities.AdminModuleBase
      extended by org.bibalex.daf.entities.User

public class User
extends AdminModuleBase


Field Summary
private  int canRedirectJob
           
private  int canSelectJob
           
private  DBConnection conn
           
private  int id
           
private  java.util.HashMap permissionMap
           
private  int Role_ID
           
private  boolean userAnyPhase
           
private  boolean userIsActive
           
private  boolean userisLDAP
           
private  int userMaxJobs
           
private  java.lang.String userName
           
private  java.lang.String userPassword
           
 
Constructor Summary
User()
          Class Constructor
User(DataTable table)
           
User(int userID)
           
 
Method Summary
 OperationInfo add()
          Add new User
static OperationInfo DBAuthenticate(java.lang.String userName, java.lang.String password)
          Authenticate Users over DB
 OperationInfo delete()
          delete User
 OperationInfo deleteCascade()
          delete User in cascade
static OperationInfo getAnyPhaseUsers()
          select Users can works in any phase
 OperationInfo getAssignedJobs()
          get assigned jobs to this user
static OperationInfo getByID(int recID)
          select User
static OperationInfo getByName(java.lang.String userName)
          select User by name
 OperationInfo getCollections()
          select User's collections
 OperationInfo getHistory()
          select Users history
 int getID()
          Gets the User ID.
 OperationInfo getJobs()
           
 OperationInfo getPermissions()
          select Users Permissions
 OperationInfo getPhases()
          select User's phases
 OperationInfo getPhasesSpecial()
           
 OperationInfo getRates(int jobType, int[] usersIDs, java.util.Date fromDate, java.util.Date toDate, int booksLevel)
           
 OperationInfo getRatesAllJobs(int jobType, int userID, java.util.Date fromDate, java.util.Date toDate)
          Return the user rates for all jobs done by the user in all phases
 OperationInfo getRatesRedoJobs(int jobType, int userID, java.util.Date fromDate, java.util.Date toDate)
          Return number of jobs that is re-done(the user did this job before) by the user in each phase
 OperationInfo getRole()
          Gets the roles associated with the user.
 OperationInfo getStartedJobs()
          Load All started jobs for User
 boolean getUserAnyPhase()
          get User Any phase value
 boolean getUserIsActive()
          get User IsActive value
 boolean getUserIsLDAP()
          Gets user IsLDAP value
 int getUserMaxJobs()
          get User Max Jobs
 java.lang.String getUserName()
          get User Name
 java.lang.String getUserPassword()
          get User PWD
 OperationInfo getUserRateJobs(int jobType, int phaseID, java.util.Date fromDate, java.util.Date toDate, int booksLevel)
           
 int getUserRole_ID()
          get User Role
 OperationInfo hasAdminAccess()
          check if user has a admin access
 OperationInfo hasArchiveAccess()
          check if user has a Archive access
 OperationInfo hasCheckInAccess()
          check if user has a CheckIn access
static OperationInfo hasPermission(int userID, int permissionID)
          check if user has a specific permission
 boolean hasPermission(java.lang.String permission)
          Used to check if the user has the specified permission string
static OperationInfo hasPermissionString(int userID, java.lang.String permission)
          check if user has a specific permission
 OperationInfo hasPhaseManagerAccess()
          check if user has a Phase Manager access
 OperationInfo hasReportAccess()
          check if user has a Report access
static boolean LDAPAuthenticate(java.lang.String Uname, java.lang.String UPWD)
          Authenticate user over LDAP
static OperationInfo loadAll()
          Load all Users
static OperationInfo loadAllActive()
          Load Active Users
static OperationInfo loadAllGUI()
          Load Users for GUI
 void loadPermissions()
          Load the permissions of the authenticated user from the DB
static OperationInfo NameDBAuthenticate(java.lang.String userName)
          Authenticate Users over DB using UserName
 void setFieldsFromDataTable(DataTable table)
           
 void setID(int userID)
          Sets the user ID.
 void setUserAnyPhase(boolean Value)
          set User AnyPhase Value
 void setUserIsActive(boolean Value)
          set User Max jobs Value
 void setUserIsLDAP(boolean Value)
          set User IsLDAP value
 void setUserMaxjobs(int Value)
          set User IsActive Value
 void setUserName(java.lang.String Value)
          set User Name
 void setUserPassWord(java.lang.String Value)
          set User PWD
 void setUserRole(int Value)
          set User Role
 java.lang.String toString()
          Returns the string representation of this object.
 OperationInfo update()
          update User
 OperationInfo updatePhases(java.lang.Object[] phasesIDs)
          Updates current User allowed phases.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

conn

private DBConnection conn

id

private int id

userName

private java.lang.String userName

userPassword

private java.lang.String userPassword

userAnyPhase

private boolean userAnyPhase

userisLDAP

private boolean userisLDAP

userMaxJobs

private int userMaxJobs

userIsActive

private boolean userIsActive

Role_ID

private int Role_ID

canSelectJob

private int canSelectJob

canRedirectJob

private int canRedirectJob

permissionMap

private java.util.HashMap permissionMap
Constructor Detail

User

public User()
Class Constructor


User

public User(int userID)
     throws java.lang.Exception
Throws:
java.lang.Exception

User

public User(DataTable table)
     throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

setFieldsFromDataTable

public void setFieldsFromDataTable(DataTable table)

loadAll

public static OperationInfo loadAll()
Load all Users

Returns:
OperationInfo (bool, DataTable)

loadAllActive

public static OperationInfo loadAllActive()
Load Active Users

Returns:
OperationInfo (bool, DataTable)

getStartedJobs

public OperationInfo getStartedJobs()
Load All started jobs for User

Returns:
OperationInfo (bool, DataTable)

getByID

public static OperationInfo getByID(int recID)
select User

Parameters:
recID - is the record to be selected
Returns:
OperationInfo (bool, DataTable) for the selected record

loadAllGUI

public static OperationInfo loadAllGUI()
Load Users for GUI

Returns:
OperationInfo (bool, DataTable)

getByName

public static OperationInfo getByName(java.lang.String userName)
select User by name

Parameters:
userName - is the user name
Returns:
OperationInfo (bool, DataTable) for the selected record

getAnyPhaseUsers

public static OperationInfo getAnyPhaseUsers()
select Users can works in any phase

Returns:
OperationInfo (bool, DataTable) for the selected users

DBAuthenticate

public static OperationInfo DBAuthenticate(java.lang.String userName,
                                           java.lang.String password)
Authenticate Users over DB

Parameters:
userName - is User Name
password - is User Password
Returns:
OperationInfo (bool, DataTable) (1 for success, 0 otherwise)

NameDBAuthenticate

public static OperationInfo NameDBAuthenticate(java.lang.String userName)
Authenticate Users over DB using UserName

Parameters:
userName - is User Name
Returns:
OperationInfo (bool, DataTable) (1 for success, 0 otherwise)

LDAPAuthenticate

public static boolean LDAPAuthenticate(java.lang.String Uname,
                                       java.lang.String UPWD)
Authenticate user over LDAP

Parameters:
Uname - is the User name
UPWD - is the User password
Returns:
true in success, false otherwise

hasPermission

public static OperationInfo hasPermission(int userID,
                                          int permissionID)
check if user has a specific permission

Parameters:
userID - is User ID
permissionID - is Permission ID
Returns:
OperationInfo (bool, DataTable) (1 for success, 0 otherwise)

hasPermissionString

public static OperationInfo hasPermissionString(int userID,
                                                java.lang.String permission)
check if user has a specific permission

Parameters:
userID - is User ID
permission - is Permission name
Returns:
OperationInfo (bool, DataTable) (1 for success, 0 otherwise)

add

public OperationInfo add()
Add new User

Specified by:
add in class AdminModuleBase
Returns:
OperationInfo (bool, DataTable) for the added record

getAssignedJobs

public OperationInfo getAssignedJobs()
get assigned jobs to this user

Returns:
OperationInfo (bool, DataTable)

getJobs

public OperationInfo getJobs()

delete

public OperationInfo delete()
delete User

Specified by:
delete in class AdminModuleBase
Returns:
OperationInfo (bool, DataTable)

deleteCascade

public OperationInfo deleteCascade()
delete User in cascade

Returns:
OperationInfo (bool, DataTable)

update

public OperationInfo update()
update User

Specified by:
update in class AdminModuleBase
Returns:
OperationInfo (bool, DataTable) for the updated record

getRole

public OperationInfo getRole()
Gets the roles associated with the user.

Returns:
OperationInfo containing a Role record.

getHistory

public OperationInfo getHistory()
select Users history

Returns:
OperationInfo (bool, DataTable) for user's history

getPermissions

public OperationInfo getPermissions()
select Users Permissions

Returns:
OperationInfo (bool, DataTable) for user's Permissions

hasAdminAccess

public OperationInfo hasAdminAccess()
check if user has a admin access

Returns:
OperationInfo (bool, DataTable) (1 for success, 0 otherwise)

hasCheckInAccess

public OperationInfo hasCheckInAccess()
check if user has a CheckIn access

Returns:
OperationInfo (bool, DataTable) (1 for success, 0 otherwise)

hasPhaseManagerAccess

public OperationInfo hasPhaseManagerAccess()
check if user has a Phase Manager access

Returns:
OperationInfo (bool, DataTable) (1 for success, 0 otherwise)

hasReportAccess

public OperationInfo hasReportAccess()
check if user has a Report access

Returns:
OperationInfo (bool, DataTable) (1 for success, 0 otherwise)

hasArchiveAccess

public OperationInfo hasArchiveAccess()
check if user has a Archive access

Returns:
OperationInfo (bool, DataTable) (1 for success, 0 otherwise)

getPhases

public OperationInfo getPhases()
select User's phases

Returns:
OperationInfo (bool, DataTable) for user's phases

getPhasesSpecial

public OperationInfo getPhasesSpecial()

updatePhases

public OperationInfo updatePhases(java.lang.Object[] phasesIDs)
Updates current User allowed phases.

Parameters:
phasesIDs - Phase IDs to be attached to the current User int[] casted as Object[]
Returns:
OperationInfo object indicating if the operation was successfull or not.

getRates

public OperationInfo getRates(int jobType,
                              int[] usersIDs,
                              java.util.Date fromDate,
                              java.util.Date toDate,
                              int booksLevel)

getRatesAllJobs

public OperationInfo getRatesAllJobs(int jobType,
                                     int userID,
                                     java.util.Date fromDate,
                                     java.util.Date toDate)
Return the user rates for all jobs done by the user in all phases

Parameters:
jobType -
userID -
fromDate -
toDate -
booksLevel -
Returns:
opInfo

getRatesRedoJobs

public OperationInfo getRatesRedoJobs(int jobType,
                                      int userID,
                                      java.util.Date fromDate,
                                      java.util.Date toDate)
Return number of jobs that is re-done(the user did this job before) by the user in each phase

Parameters:
jobType -
userID -
fromDate -
toDate -
booksLevel -
Returns:
opInfo

getCollections

public OperationInfo getCollections()
select User's collections

Returns:
OperationInfo (bool, DataTable) for user's phases

getUserRateJobs

public OperationInfo getUserRateJobs(int jobType,
                                     int phaseID,
                                     java.util.Date fromDate,
                                     java.util.Date toDate,
                                     int booksLevel)

setID

public void setID(int userID)
Sets the user ID.

Parameters:
userID - The ID of the user

setUserName

public void setUserName(java.lang.String Value)
set User Name

Parameters:
Value - is the User Name

setUserPassWord

public void setUserPassWord(java.lang.String Value)
set User PWD

Parameters:
Value - is the User PWD

setUserAnyPhase

public void setUserAnyPhase(boolean Value)
set User AnyPhase Value

Parameters:
Value - is the AnyPhase Value (1 if user work in any phase, 0 otherwise)

setUserIsLDAP

public void setUserIsLDAP(boolean Value)
set User IsLDAP value

Parameters:
Value - The IsLDAP value

setUserMaxjobs

public void setUserMaxjobs(int Value)
set User IsActive Value

Parameters:
Value - is the IsActive Value (1 for active user, 0 otherwise)

setUserIsActive

public void setUserIsActive(boolean Value)
set User Max jobs Value

Parameters:
Value - is the Max jobs Value

setUserRole

public void setUserRole(int Value)
set User Role

Parameters:
Value - is the Role Value

getID

public int getID()
Gets the User ID.


getUserName

public java.lang.String getUserName()
get User Name

Returns:
User Name

getUserPassword

public java.lang.String getUserPassword()
get User PWD

Returns:
User Password

getUserAnyPhase

public boolean getUserAnyPhase()
get User Any phase value

Returns:
User Any phase value

getUserIsLDAP

public boolean getUserIsLDAP()
Gets user IsLDAP value

Returns:
user IsLDAP value

getUserMaxJobs

public int getUserMaxJobs()
get User Max Jobs

Returns:
User Max Jobs

getUserIsActive

public boolean getUserIsActive()
get User IsActive value

Returns:
User IsActive value

getUserRole_ID

public int getUserRole_ID()
get User Role

Returns:
User Role

toString

public java.lang.String toString()
Returns the string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
The string representation of this object.

loadPermissions

public void loadPermissions()
                     throws java.lang.Exception
Load the permissions of the authenticated user from the DB

Throws:
java.lang.Exception

hasPermission

public boolean hasPermission(java.lang.String permission)
Used to check if the user has the specified permission string

Parameters:
permission -
Returns: