fr.paris.lutece.plugins.mylutece.modules.directory.authentication.business
Class MyluteceDirectoryUserDAO

java.lang.Object
  extended by fr.paris.lutece.plugins.mylutece.modules.directory.authentication.business.MyluteceDirectoryUserDAO
All Implemented Interfaces:
IMyluteceDirectoryUserDAO

public final class MyluteceDirectoryUserDAO
extends Object
implements IMyluteceDirectoryUserDAO

This class provides Data Access methods for directoryUser objects


Constructor Summary
MyluteceDirectoryUserDAO()
           
 
Method Summary
 boolean checkActivated(String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Check if user is activated
 boolean checkPassword(String strLogin, String strPassword, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Check the password for a DirectoryUser
 int countUserPasswordHistoryFromDate(Timestamp minDate, int nUserId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Get the number of password change done by a user since the given date.
 void delete(MyluteceDirectoryUser directoryUser, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Delete a record from the table
 List<Integer> findAllExpiredUserId(fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Get the list of id of user with the expired status.
 int findIdRecordFromLogin(String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Get a user id from his login
 List<Integer> getIdUsersToSendFirstAlert(Timestamp alertMaxDate, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Get the list of id of users that need to receive their first alert
 List<Integer> getIdUsersToSendOtherAlert(Timestamp alertMaxDate, Timestamp timeBetweenAlerts, int maxNumberAlerts, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Get the list of id of users that need to receive their first alert
 List<Integer> getIdUsersWithExpiredLifeTimeList(Timestamp currentTimestamp, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Get the list of id of users that have an expired time life but not the expired status
 List<Integer> getIdUsersWithExpiredPasswordsList(Timestamp currentTimestamp, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Get the list of id of users that have an expired password but not the change password flag
 int getNbAccountLifeTimeNotification(int nIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Get the number of notification send to a user to warn him about the expiration of his account
 void insert(MyluteceDirectoryUser directoryUser, String strPassword, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Insert a new record in the table.
 void insertNewPasswordInHistory(String strPassword, int nUserId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Log a password change in the password history
 MyluteceDirectoryUser load(int nIdRecord, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Load the data of DirectoryUser from the table
 void removeAllPasswordHistoryForUser(int nUserId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Remove every password saved in the password history for a user.
 Collection<MyluteceDirectoryUser> selectDirectoryUserList(fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Load the list of directoryUsers
 Collection<MyluteceDirectoryUser> selectDirectoryUserListForLogin(String strLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Load the list of DirectoryUsers for a login
 String selectPasswordByPrimaryKey(int nIdRecord, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Load the password of the specified user
 List<String> selectUserPasswordHistory(int nUserID, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Gets the history of password of the given user
 void store(MyluteceDirectoryUser directoryUser, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Update the record in the table
 void updateChangePassword(List<Integer> listIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Set the "change password" flag of users to true
 void updateNbAlert(List<Integer> listIdUser, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Increment the number of alert send to users by 1
 void updatePassword(MyluteceDirectoryUser directoryUser, String strNewPassword, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Update the record in the table
 void updateResetPassword(MyluteceDirectoryUser user, boolean bNewValue, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Update of the databaseUser which is specified in parameter
 void updateUserExpirationDate(int nIdUser, Timestamp newExpirationDate, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Update the user expiration date with the new values.
 void updateUserLastLoginDate(String strLogin, Timestamp dateLastLogin, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Update a user last login date
 void updateUserStatus(List<Integer> ndUserList, int nNewStatus, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Update status of a list of user accounts
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MyluteceDirectoryUserDAO

public MyluteceDirectoryUserDAO()
Method Detail

insert

public void insert(MyluteceDirectoryUser directoryUser,
                   String strPassword,
                   fr.paris.lutece.portal.service.plugin.Plugin plugin)
Insert a new record in the table.

Specified by:
insert in interface IMyluteceDirectoryUserDAO
Parameters:
directoryUser - The directoryUser object
strPassword - The user password
plugin - The Plugin using this data access service

load

public MyluteceDirectoryUser load(int nIdRecord,
                                  fr.paris.lutece.portal.service.plugin.Plugin plugin)
Load the data of DirectoryUser from the table

Specified by:
load in interface IMyluteceDirectoryUserDAO
Parameters:
nIdRecord - The identifier of User
plugin - The Plugin using this data access service
Returns:
the instance of the DirectoryUser

delete

public void delete(MyluteceDirectoryUser directoryUser,
                   fr.paris.lutece.portal.service.plugin.Plugin plugin)
Delete a record from the table

Specified by:
delete in interface IMyluteceDirectoryUserDAO
Parameters:
directoryUser - The directoryUser object
plugin - The Plugin using this data access service

store

public void store(MyluteceDirectoryUser directoryUser,
                  fr.paris.lutece.portal.service.plugin.Plugin plugin)
Update the record in the table

Specified by:
store in interface IMyluteceDirectoryUserDAO
Parameters:
directoryUser - The reference of directoryUser
plugin - The Plugin using this data access service

updatePassword

public void updatePassword(MyluteceDirectoryUser directoryUser,
                           String strNewPassword,
                           fr.paris.lutece.portal.service.plugin.Plugin plugin)
Update the record in the table

Specified by:
updatePassword in interface IMyluteceDirectoryUserDAO
Parameters:
directoryUser - The reference of directoryUser
strNewPassword - The new password to store
plugin - The Plugin using this data access service

updateResetPassword

public void updateResetPassword(MyluteceDirectoryUser user,
                                boolean bNewValue,
                                fr.paris.lutece.portal.service.plugin.Plugin plugin)
Update of the databaseUser which is specified in parameter

Specified by:
updateResetPassword in interface IMyluteceDirectoryUserDAO
bNewValue - New value of the reset password property
plugin - The current plugin using this method

selectPasswordByPrimaryKey

public String selectPasswordByPrimaryKey(int nIdRecord,
                                         fr.paris.lutece.portal.service.plugin.Plugin plugin)
Load the password of the specified user

Specified by:
selectPasswordByPrimaryKey in interface IMyluteceDirectoryUserDAO
Parameters:
nIdRecord - The Primary key of the directoryUser
plugin - The current plugin using this method
Returns:
String the user password

selectDirectoryUserList

public Collection<MyluteceDirectoryUser> selectDirectoryUserList(fr.paris.lutece.portal.service.plugin.Plugin plugin)
Load the list of directoryUsers

Specified by:
selectDirectoryUserList in interface IMyluteceDirectoryUserDAO
Parameters:
plugin - The Plugin using this data access service
Returns:
The Collection of the directoryUsers

selectDirectoryUserListForLogin

public Collection<MyluteceDirectoryUser> selectDirectoryUserListForLogin(String strLogin,
                                                                         fr.paris.lutece.portal.service.plugin.Plugin plugin)
Load the list of DirectoryUsers for a login

Specified by:
selectDirectoryUserListForLogin in interface IMyluteceDirectoryUserDAO
Parameters:
strLogin - The login of DirectoryUser
plugin - The Plugin using this data access service
Returns:
The Collection of the DirectoryUsers

checkPassword

public boolean checkPassword(String strLogin,
                             String strPassword,
                             fr.paris.lutece.portal.service.plugin.Plugin plugin)
Check the password for a DirectoryUser

Specified by:
checkPassword in interface IMyluteceDirectoryUserDAO
Parameters:
strLogin - The user login of DirectoryUser
strPassword - The password of DirectoryUser
plugin - The Plugin using this data access service
Returns:
true if password is ok

checkActivated

public boolean checkActivated(String strLogin,
                              fr.paris.lutece.portal.service.plugin.Plugin plugin)
Check if user is activated

Specified by:
checkActivated in interface IMyluteceDirectoryUserDAO
Parameters:
strLogin - The user login of DirectoryUser
plugin - The Plugin using this data access service
Returns:
true if user is activated

findIdRecordFromLogin

public int findIdRecordFromLogin(String strLogin,
                                 fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get a user id from his login

Specified by:
findIdRecordFromLogin in interface IMyluteceDirectoryUserDAO
Parameters:
strLogin - The login of the user
plugin - The Plugin
Returns:
The user id, or 0 if no user has this login.

selectUserPasswordHistory

public List<String> selectUserPasswordHistory(int nUserID,
                                              fr.paris.lutece.portal.service.plugin.Plugin plugin)
Gets the history of password of the given user

Specified by:
selectUserPasswordHistory in interface IMyluteceDirectoryUserDAO
Parameters:
nUserID - Id of the user
plugin - The Plugin
Returns:
The collection of recent passwords used by the user.

countUserPasswordHistoryFromDate

public int countUserPasswordHistoryFromDate(Timestamp minDate,
                                            int nUserId,
                                            fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get the number of password change done by a user since the given date.

Specified by:
countUserPasswordHistoryFromDate in interface IMyluteceDirectoryUserDAO
Parameters:
minDate - Minimum date to consider.
nUserId - Id of the user
plugin - The Plugin
Returns:
The number of password change done by the user since the given date.

insertNewPasswordInHistory

public void insertNewPasswordInHistory(String strPassword,
                                       int nUserId,
                                       fr.paris.lutece.portal.service.plugin.Plugin plugin)
Log a password change in the password history

Specified by:
insertNewPasswordInHistory in interface IMyluteceDirectoryUserDAO
Parameters:
strPassword - New password of the user
nUserId - Id of the user
plugin - The Plugin

removeAllPasswordHistoryForUser

public void removeAllPasswordHistoryForUser(int nUserId,
                                            fr.paris.lutece.portal.service.plugin.Plugin plugin)
Remove every password saved in the password history for a user.

Specified by:
removeAllPasswordHistoryForUser in interface IMyluteceDirectoryUserDAO
Parameters:
nUserId - Id of the user
plugin - The Plugin

findAllExpiredUserId

public List<Integer> findAllExpiredUserId(fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get the list of id of user with the expired status.

Specified by:
findAllExpiredUserId in interface IMyluteceDirectoryUserDAO
Parameters:
plugin - The Plugin
Returns:
The list of if of user with the expired status.

getIdUsersWithExpiredLifeTimeList

public List<Integer> getIdUsersWithExpiredLifeTimeList(Timestamp currentTimestamp,
                                                       fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get the list of id of users that have an expired time life but not the expired status

Specified by:
getIdUsersWithExpiredLifeTimeList in interface IMyluteceDirectoryUserDAO
Parameters:
currentTimestamp - Timestamp describing the current time.
plugin - The Plugin
Returns:
the list of id of users with expired time life

getIdUsersToSendFirstAlert

public List<Integer> getIdUsersToSendFirstAlert(Timestamp alertMaxDate,
                                                fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get the list of id of users that need to receive their first alert

Specified by:
getIdUsersToSendFirstAlert in interface IMyluteceDirectoryUserDAO
Parameters:
alertMaxDate - The maximum date to send alerts.
plugin - The Plugin
Returns:
the list of id of users that need to receive their first alert

getIdUsersToSendOtherAlert

public List<Integer> getIdUsersToSendOtherAlert(Timestamp alertMaxDate,
                                                Timestamp timeBetweenAlerts,
                                                int maxNumberAlerts,
                                                fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get the list of id of users that need to receive their first alert

Specified by:
getIdUsersToSendOtherAlert in interface IMyluteceDirectoryUserDAO
Parameters:
alertMaxDate - The maximum date to send alerts.
timeBetweenAlerts - Timestamp describing the time between two alerts.
maxNumberAlerts - Maximum number of alerts to send to a user
plugin - The Plugin
Returns:
the list of id of users that need to receive their first alert

getIdUsersWithExpiredPasswordsList

public List<Integer> getIdUsersWithExpiredPasswordsList(Timestamp currentTimestamp,
                                                        fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get the list of id of users that have an expired password but not the change password flag

Specified by:
getIdUsersWithExpiredPasswordsList in interface IMyluteceDirectoryUserDAO
Parameters:
currentTimestamp - Timestamp describing the current time.
plugin - The plugin
Returns:
the list of id of users with expired passwords

updateUserStatus

public void updateUserStatus(List<Integer> ndUserList,
                             int nNewStatus,
                             fr.paris.lutece.portal.service.plugin.Plugin plugin)
Update status of a list of user accounts

Specified by:
updateUserStatus in interface IMyluteceDirectoryUserDAO
Parameters:
ndUserList - List of user accounts to update
nNewStatus - New status of the user
plugin - The Plugin

updateNbAlert

public void updateNbAlert(List<Integer> listIdUser,
                          fr.paris.lutece.portal.service.plugin.Plugin plugin)
Increment the number of alert send to users by 1

Specified by:
updateNbAlert in interface IMyluteceDirectoryUserDAO
Parameters:
listIdUser - The list of users to update
plugin - The Plugin

updateChangePassword

public void updateChangePassword(List<Integer> listIdUser,
                                 fr.paris.lutece.portal.service.plugin.Plugin plugin)
Set the "change password" flag of users to true

Specified by:
updateChangePassword in interface IMyluteceDirectoryUserDAO
Parameters:
listIdUser - The list of users to update
plugin - The plugin

updateUserExpirationDate

public void updateUserExpirationDate(int nIdUser,
                                     Timestamp newExpirationDate,
                                     fr.paris.lutece.portal.service.plugin.Plugin plugin)
Update the user expiration date with the new values. Also update his alert account to 0

Specified by:
updateUserExpirationDate in interface IMyluteceDirectoryUserDAO
Parameters:
nIdUser - Id of the user to update
newExpirationDate - Id of the user to update
plugin - The Plugin

getNbAccountLifeTimeNotification

public int getNbAccountLifeTimeNotification(int nIdUser,
                                            fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get the number of notification send to a user to warn him about the expiration of his account

Specified by:
getNbAccountLifeTimeNotification in interface IMyluteceDirectoryUserDAO
Parameters:
nIdUser - Id of the user
plugin - The plugin
Returns:
The number of notification send to the user

updateUserLastLoginDate

public void updateUserLastLoginDate(String strLogin,
                                    Timestamp dateLastLogin,
                                    fr.paris.lutece.portal.service.plugin.Plugin plugin)
Update a user last login date

Specified by:
updateUserLastLoginDate in interface IMyluteceDirectoryUserDAO
Parameters:
strLogin - Login of the user to update
dateLastLogin - date of the last login of the user
plugin - The plugin


Copyright © 2013 Mairie de Paris. All Rights Reserved.