Advertisement
Guest User

Untitled

a guest
Jul 11th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.39 KB | None | 0 0
  1. {
  2. "_id" : ObjectId("591ae4ab397af5b2ff7bbff0"),
  3. "emailRequest" : {
  4. "from" : "vivekmangal162@gmail.com",
  5. "to" : [
  6. "rakhi.mittal3@gmail.com"
  7. ],
  8. "subject" : "Password reset email",
  9. "template" : "http://localhost:1010/email-gateway/email/send",
  10. "text" : "Password reset link",
  11. "fields" : {
  12. "link" : "http://localhost:4200/#/resetPassword?userData=JDIxJDE2LzA1LzE3IDE3OjA4OjA5"
  13. },
  14. "tenantId" : "gmail"
  15. },
  16. "emailResponses" : [
  17. {
  18. "errorCode" : NumberInt("0"),
  19. "uuid" : "41bd4596-de5a-46ce-b9ec-0c18713199eb",
  20. "status" : "SCHEDULED",
  21. "receivedOn" : ISODate("2017-05-16T17:08:18.950+05:30"),
  22. "scheduledOn" : ISODate("2017-05-16T17:08:18.950+05:30"),
  23. "createdOn" : ISODate("2017-05-16T17:08:18.950+05:30")
  24. }
  25. ]
  26. },
  27.  
  28. /* 7 createdAt:5/16/2017, 5:11:21 PM*/
  29. {
  30. "_id" : ObjectId("591ae561397af5b2ff7bc202"),
  31. "emailRequest" : {
  32. "from" : "vivekmangal162@gmail.com",
  33. "to" : [
  34. "rakhi.mittal3@gmail.com"
  35. ],
  36. "subject" : "Password reset email",
  37. "template" : "T0001",
  38. "text" : "Password reset link",
  39. "fields" : {
  40. "link" : "http://localhost:4200/#/resetPassword?userData=JDIxJDE2LzA1LzE3IDE3OjExOjIx"
  41. },
  42. "tenantId" : "gmail"
  43. },
  44. "emailResponses" : [
  45. {
  46. "errorCode" : NumberInt("0"),
  47. "uuid" : "2128ca10-d34e-4633-93c5-0cab7ddfdcc2",
  48. "status" : "SCHEDULED",
  49. "receivedOn" : ISODate("2017-05-16T17:11:21.704+05:30"),
  50. "scheduledOn" : ISODate("2017-05-16T17:11:21.704+05:30"),
  51. "createdOn" : ISODate("2017-05-16T17:11:21.704+05:30")
  52. },
  53. {
  54. "errorCode" : NumberInt("0"),
  55. "uuid" : "f9a9e181-c494-4489-a09b-6da460697ba3",
  56. "status" : "SENT",
  57. "deliveredOn" : ISODate("2017-05-16T17:11:35.059+05:30"),
  58. "createdOn" : ISODate("2017-05-16T17:11:35.059+05:30")
  59. }
  60. ]
  61. }
  62.  
  63. public class Email {
  64. @MongoId
  65. private String id;
  66. private EmailRequest emailRequest;
  67. private List<EmailResponse> emailResponses;
  68.  
  69. public Email() {
  70. super();
  71. }
  72.  
  73. public String getId() {
  74. return id;
  75. }
  76. public void setId(String id) {
  77. this.id = id;
  78. }
  79. public EmailRequest getEmailRequest() {
  80. return emailRequest;
  81. }
  82. public void setEmailRequest(EmailRequest emailRequest) {
  83. this.emailRequest = emailRequest;
  84. }
  85. public List<EmailResponse> getEmailResponses() {
  86. return emailResponses;
  87. }
  88. public void setEmailResponses(List<EmailResponse> emailResponses) {
  89. this.emailResponses = emailResponses;
  90. }
  91. public void addEmailResponse(EmailResponse emailResponse) {
  92. if(emailResponses == null) {
  93. emailResponses = new ArrayList<>();
  94. }
  95. emailResponses.add(emailResponse);
  96. }
  97.  
  98. }
  99.  
  100. query = "{emailResponses:{$elemMatch:{scheduledOn:{$gte:#}}}},{emailResponses.$:1,_id:0}";
  101. MongoService<EmailResponse> mongoService = new MongoServiceImpl<>(EmailResponse.class);
  102. emailResponses = mongoService.getDataArrayByDate("email", query, date);
  103.  
  104. [{
  105. "errorCode": 0,
  106. "uuid": null,
  107. "status": null,
  108. "receivedOn": null,
  109. "scheduledOn": null,
  110. "deliveredOn": null,
  111. "createdOn": null,
  112. "message": null
  113. }]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement