Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.39 KB | None | 0 0
  1. Index: exchange-core/src/main/java/com/funambol/exchange/items/accessor/ews/CalendarEwsExchangeAccessor.java
  2. ===================================================================
  3. --- exchange-core/src/main/java/com/funambol/exchange/items/accessor/ews/CalendarEwsExchangeAccessor.java (revision 513)
  4. +++ exchange-core/src/main/java/com/funambol/exchange/items/accessor/ews/CalendarEwsExchangeAccessor.java (working copy)
  5. @@ -40,10 +40,14 @@
  6. protected Date since;
  7. protected Date until;
  8.  
  9. + protected boolean suppressItemFailures;
  10. +
  11. public CalendarEwsExchangeAccessor(ExchangeUser exuser) {
  12. super(exuser);
  13. +
  14. since = null;
  15. until = null;
  16. + suppressItemFailures = false;
  17. }
  18.  
  19. /**
  20. @@ -73,6 +77,10 @@
  21. this.until = until;
  22. }
  23.  
  24. + public void setSuppressItemErrors(boolean suppressItemFailures) {
  25. + this.suppressItemFailures = suppressItemFailures;
  26. + }
  27. +
  28. /**
  29. * Add the attendees in the EWS array of attendee objects to the given ExchangeCalendar.
  30. *
  31. @@ -110,7 +118,7 @@
  32. exchangeItems.addAll(getOccurrencesFromCalendar(calendar));
  33. }
  34. ExchangeCalendar exchCal = getExchangeCalendarFromCalendarItem(calendar);
  35. - if (eventCouldOccurInRange(exchCal)) {
  36. + if (exchCal != null && eventCouldOccurInRange(exchCal)) {
  37. exchangeItems.add(exchCal);
  38. }
  39. }
  40. @@ -132,7 +140,7 @@
  41. for (OccurrenceInfoType occurrence : modified.getOccurrence()) {
  42. CalendarItemType calOccurrence = (CalendarItemType) getItem(occurrence.getItemId());
  43. ExchangeCalendar exchCal = getExchangeCalendarFromCalendarItem(calOccurrence);
  44. - if (eventCouldOccurInRange(exchCal)) {
  45. + if (exchCal != null && eventCouldOccurInRange(exchCal)) {
  46. exchangeItems.add(exchCal);
  47. }
  48. }
  49. @@ -498,6 +506,29 @@
  50.  
  51. return recurType;
  52. }
  53. +
  54. + /**
  55. + * Get the Exchange calendar from the given calendar item while checking for errors. If an error
  56. + * is encountered and error supressing is on, return null.
  57. + *
  58. + * @param cal The EWS item to get the Exchange calendar from
  59. + * @return An ExchangeCalendar or null
  60. + * @throws DataAccessException when the calendar item cannot be converted and errors are not
  61. + * suppressed
  62. + */
  63. + protected ExchangeCalendar getExchangeCalendarFromCalendarItem(CalendarItemType cal) throws DataAccessException {
  64. + ExchangeCalendar exchCal;
  65. + try {
  66. + exchCal = convertCalendarItem(cal);
  67. + } catch (DataAccessException e) {
  68. + if (!suppressItemFailures) {
  69. + throw e;
  70. + } else {
  71. + exchCal = null;
  72. + }
  73. + }
  74. + return exchCal;
  75. + }
  76.  
  77. /**
  78. * Convert an EWS calendar to an ExchangeCalendar.
  79. @@ -506,7 +537,7 @@
  80. * @return An ExchangeCalendar version of the given EWS calendar
  81. * @throws DataAccessException
  82. */
  83. - protected ExchangeCalendar getExchangeCalendarFromCalendarItem(CalendarItemType cal) throws DataAccessException {
  84. + protected ExchangeCalendar convertCalendarItem(CalendarItemType cal) throws DataAccessException {
  85. String id = cal.getItemId().getId();
  86. String lastModifiedString = getLastModifiedTimeFromItem(cal);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement