Guest User

Untitled

a guest
Nov 24th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. public class UserLoginHistory {
  2. private set<Id> userids;
  3. private Map<Id,User> usermap;
  4. public List<MyLoginHistory> loginHistories {get; set;}
  5.  
  6. public UserLoginHistory(List<LoginHistory> histories){
  7. this.userids = new set<Id>();
  8. this.usermap = new Map<Id,User>();
  9. this.loginHistories = new List<MyLoginHistory>();
  10. for(LoginHistory history : histories){
  11. this.userids.add(history.UserId);
  12. }
  13. for(User u : [Select Id, Profile.Name, Username from User where Id IN : this.userids]){
  14. this.usermap.put(u.Id, u);
  15. }
  16. for(LoginHistory history : histories){
  17. MyLoginHistory mlh = new MyLoginHistory(history,usermap.get(history.UserId));
  18. this.loginHistories.add(mlh);
  19. }
  20. }
  21.  
  22. public class MyLoginHistory{
  23. public Id UserId {get;set;}
  24. public String ApiType {get; set;}
  25. public String ApiVersion {get; set;}
  26. public String Application {get; set;}
  27. public Id AuthenticationServiceId {get; set;}
  28. public String Browser {get;set;}
  29. public String CipherSuite {get; set;}
  30. public String ClientVersion {get; set;}
  31. public String CountryIso {get; set;}
  32. public Id Id {get; set;}
  33. public Id LoginGeoId {get; set;}
  34. public DateTime LoginTime {get; set;}
  35. public String LoginType {get; set;}
  36. public String LoginUrl {get; set;}
  37. public Id NetworkId {get; set;}
  38. public String Platform {get; set;}
  39. public String SourceIp {get; set;}
  40. public String Status {get; set;}
  41. public String TlsProtocol {get; set;}
  42. public String Username {get; set;}
  43. public String ProfileName {get; set;}
  44.  
  45. public MyLoginHistory(LoginHistory lh , User u){
  46. this.UserId = lh.UserId;
  47. this.ApiType = lh.ApiType;
  48. this.ApiVersion = lh.ApiVersion;
  49. this.Application = lh.Application;
  50. this.AuthenticationServiceId = lh.AuthenticationServiceId;
  51. this.Browser = lh.Browser;
  52. this.CipherSuite = lh.CipherSuite;
  53. this.ClientVersion = lh.ClientVersion;
  54. this.CountryIso = lh.CountryIso;
  55. this.Id = lh.Id;
  56. this.LoginGeoId = lh.LoginGeoId;
  57. this.LoginTime = lh.LoginTime;
  58. this.LoginUrl = lh.LoginUrl;
  59. this.NetworkId = lh.NetworkId;
  60. this.Platform = lh.Platform;
  61. this.SourceIp = lh.SourceIp;
  62. this.Status = lh.Status;
  63. this.TlsProtocol = lh.TlsProtocol;
  64. this.Username = u.Username;
  65. this.ProfileName = u.Profile.Name;
  66. }
  67. }
  68. }
Add Comment
Please, Sign In to add comment