Haifisch7734

Untitled

Aug 21st, 2015
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.31 KB | None | 0 0
  1. @Override
  2.     public List<Appointment> findAppointmentsForSearchFilter(SearchFilter filter) throws MSExchangeServiceException {
  3.         ExchangeService service = new ExchangeService();
  4.         try {
  5.             List<Appointment> apptList = new ArrayList<>();
  6.             service = config.buildExchangeService();
  7.             ItemView itemView = new ItemView(Integer.MAX_VALUE);
  8.  
  9.             FindItemsResults<Item> findResults = service.findItems(WellKnownFolderName.Calendar, filter, itemView);
  10.             List<String> idList = getAppointmentIDListFromItemList(findResults.getItems());
  11.  
  12.             for (String id : idList) {
  13.                 apptList.add(findAppointmentById(id));
  14.             }
  15.             service.close();
  16.             return apptList;
  17.         } catch (ExchangeServiceNotBuiltException ex) {
  18.             throw new MSExchangeServiceException();
  19.         } catch (ServiceLocalException ex) {
  20.             logger.error("Error during fetching appointment IDs");
  21.             logger.trace("{}", ex);
  22.             throw new MSExchangeServiceException();
  23.         } catch (Exception ex) {
  24.             logger.warn("Error during getting appointment list");
  25.             logger.trace("{}", ex);
  26.             throw new MSExchangeServiceException();
  27.         } finally {
  28.             service.close();
  29.         }
  30.     }
Advertisement
Add Comment
Please, Sign In to add comment