Created
January 31, 2013 17:44
-
-
Save Lokutus/4684716 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%REM | |
Class UserProfileLoader | |
Load user profile document from database and return UserProfile object | |
@author Jiri Krakora | |
@date 31.1.2013 | |
@revision 31.1.2013 1.0 Relesase | |
%END REM | |
Public Class UserProfileLoader | |
Private oView As NotesView | |
%REM | |
Initialize object | |
@return true/false if success | |
%END REM | |
Public Function Init As Boolean | |
Set Me.oView = session.Db.GetView("$PickValidUser") | |
If Me.oView Is Nothing Then | |
Call TLog.Error("Nebyl nalezen pohled $PickValidUser... nelze dohledat zastupování") | |
Exit Function | |
End If | |
Let Init = True | |
End Function | |
%REM | |
Load a User profile document from database | |
@param User name object | |
@return UserProfile Wrapper Object | |
%END REM | |
Public Function Load(userName As NotesName) As UserProfile | |
Dim s As UserProfile | |
Dim doc As NotesDocument | |
Dim u As NotesName | |
Set doc = Me.oView.GetFirstDocument | |
While Not doc Is Nothing | |
Set u = New NotesName(doc.GetItemValue("UsrName")(0)) | |
If StrCompare(LCase(userName.Abbreviated), LCase(u.Abbreviated), 5) = 0 Then | |
Set s = New UserProfile | |
Call s.SetDocument(doc) | |
End If | |
Set doc = Me.oView.GetNextDocument(doc) | |
Wend | |
Set Load = s | |
End Function | |
End Class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment