• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java FindItemsResults类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中microsoft.exchange.webservices.data.search.FindItemsResults的典型用法代码示例。如果您正苦于以下问题:Java FindItemsResults类的具体用法?Java FindItemsResults怎么用?Java FindItemsResults使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

FindItemsResults类属于microsoft.exchange.webservices.data.search包,在下文中一共展示了FindItemsResults类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: open

点赞 3

import microsoft.exchange.webservices.data.search.FindItemsResults; //导入依赖的package包/类
@Override
public void open(int mode) throws MessagingException {
    this.mode = mode;
    try {
        if (!exists()) {
            throw new FolderNotFoundException();
        }
        ItemView view = new ItemView(ITEM_VIEW_MAX_ITEMS);
        folder = Folder.bind(getService(), folder.getId());

        if (prefetchItems) {
            FindItemsResults<Item> lFindResults = getService().findItems(folder.getId(), view);
            messages = new ArrayList<>(lFindResults.getTotalCount());
            unreadMessages = new ArrayList<>();
            for (Item aItem : lFindResults) {
                if (aItem instanceof EmailMessage) {
                    logger.info("Fetching content of item {}", aItem.getId());

                    EmailMessage aEmailMessage = (EmailMessage) aItem;

                    EwsMailConverter aConverter = new EwsMailConverter(this, aEmailMessage, messages.size() + 1);

                    messages.add(aConverter.convert());

                } else {
                    logger.warn("Skipping item {} as it is a {}", aItem.getId(), aItem.getClass());
                }
            }
        } else {

        }
        timestamp = new Date();
        getStore().notifyConnectionListeners(ConnectionEvent.OPENED);
    } catch (Exception e) {
        throw new MessagingException(e.getMessage(), e);
    }
}
 

开发者ID:gartcimore,
项目名称:javamail4ews,
代码行数:38,
代码来源:EwsFolder.java

示例2: getRawMessage

点赞 3

import microsoft.exchange.webservices.data.search.FindItemsResults; //导入依赖的package包/类
public Object getRawMessage(Map threadContext) throws ListenerException {
	try {
		ItemView view = new ItemView(1);
		view.getOrderBy().add(ItemSchema.DateTimeReceived,
				SortDirection.Ascending);
		FindItemsResults<Item> findResults;
		if ("NDR".equalsIgnoreCase(getFilter())) {
			SearchFilter searchFilterBounce = new SearchFilter.IsEqualTo(
					ItemSchema.ItemClass, "REPORT.IPM.Note.NDR");
			findResults = exchangeService.findItems(folderIn.getId(),
					searchFilterBounce, view);
		} else {
			findResults = exchangeService.findItems(folderIn.getId(), view);
		}
		if (findResults.getTotalCount() == 0) {
			return null;
		} else {
			return findResults.getItems().get(0);
		}
	} catch (Exception e) {
		throw new ListenerException(e);
	}
}
 

开发者ID:ibissource,
项目名称:iaf,
代码行数:24,
代码来源:ExchangeMailListener.java

示例3: getUnreadMessageCount

点赞 3

import microsoft.exchange.webservices.data.search.FindItemsResults; //导入依赖的package包/类
@Override
public synchronized int getUnreadMessageCount() throws MessagingException {
    ItemView unreadView = new ItemView(ITEM_VIEW_MAX_ITEMS);

    PropertySet setIdOnly = new PropertySet(BasePropertySet.IdOnly);
    unreadView.setPropertySet(setIdOnly);

    SearchFilter unreadFilter = new SearchFilter.SearchFilterCollection(LogicalOperator.And,
            new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, Boolean.FALSE));

    FindItemsResults<Item> findResults;
    try {
        findResults = getService().findItems(folder.getId(), unreadFilter, unreadView);
    } catch (Exception e) {
        throw new MessagingException(e.getMessage());
    }
    return findResults.getTotalCount();
}
 

开发者ID:gartcimore,
项目名称:javamail4ews,
代码行数:19,
代码来源:EwsFolder.java

示例4: hasNewMessages

点赞 3

import microsoft.exchange.webservices.data.search.FindItemsResults; //导入依赖的package包/类
@Override
public boolean hasNewMessages() throws MessagingException {
    ItemView view = new ItemView(ITEM_VIEW_MAX_ITEMS);
    SearchFilter.SearchFilterCollection search = new SearchFilter.SearchFilterCollection();
    search.add(new SearchFilter.IsGreaterThanOrEqualTo(ItemSchema.DateTimeReceived, timestamp));
    FindItemsResults<Item> lFindResults;
    try {
        lFindResults = getService().findItems(folder.getId(), search, view);

        if (lFindResults.getTotalCount() > 0) {
            return true;
        } else {
            return false;
        }
    } catch (Exception e) {
        throw new MessagingException(e.getMessage(), e);
    }
}
 

开发者ID:gartcimore,
项目名称:javamail4ews,
代码行数:19,
代码来源:EwsFolder.java

示例5: findItems

点赞 3

import microsoft.exchange.webservices.data.search.FindItemsResults; //导入依赖的package包/类
/**
 * Obtains a list of item by searching the contents of a specific folder.
 * Calling this method results in a call to EWS.
 *
 * @param parentFolderId the parent folder id
 * @param searchFilter   the search filter
 * @param view           the view
 * @return An object representing the results of the search operation.
 * @throws Exception the exception
 */
public FindItemsResults<Item> findItems(FolderId parentFolderId,
    SearchFilter searchFilter, ItemView view) throws Exception {
  EwsUtilities.validateParamAllowNull(searchFilter, "searchFilter");
  List<FolderId> folderIdArray = new ArrayList<FolderId>();
  folderIdArray.add(parentFolderId);
  ServiceResponseCollection<FindItemResponse<Item>> responses = this
      .findItems(folderIdArray, searchFilter, null, /* queryString */
          view, null, /* groupBy */
          ServiceErrorHandling.ThrowOnError);

  return responses.getResponseAtIndex(0).getResults();
}
 

开发者ID:OfficeDev,
项目名称:ews-java-api,
代码行数:23,
代码来源:ExchangeService.java

示例6: findItems

点赞 3

import microsoft.exchange.webservices.data.search.FindItemsResults; //导入依赖的package包/类
/**
 * Find item.
 *
 * @param view The view controlling the number of item returned.
 * @return FindItems results collection.
 * @throws Exception the exception
 */
public FindItemsResults<Item> findItems(ItemView view) throws Exception {
  ServiceResponseCollection<FindItemResponse<Item>> responses = this
      .internalFindItems((SearchFilter) null, view,
          null /* groupBy */);

  return responses.getResponseAtIndex(0).getResults();
}
 

开发者ID:OfficeDev,
项目名称:ews-java-api,
代码行数:15,
代码来源:Folder.java

示例7: findAppointments

点赞 3

import microsoft.exchange.webservices.data.search.FindItemsResults; //导入依赖的package包/类
/**
 * Obtains a list of appointments by searching the contents of this folder
 * and performing recurrence expansion for recurring appointments. Calling
 * this method results in a call to EWS.
 *
 * @param view the view
 * @return An object representing the results of the search operation.
 * @throws Exception the exception
 */
public FindItemsResults<Appointment> findAppointments(CalendarView view)
    throws Exception {
  EwsUtilities.validateParam(view, "view");

  ServiceResponseCollection<FindItemResponse<Appointment>> responses =
      this.internalFindItems((SearchFilter) null, view, null
                                      /* groupBy */);

  return responses.getResponseAtIndex(0).getResults();
}
 

开发者ID:OfficeDev,
项目名称:ews-java-api,
代码行数:20,
代码来源:CalendarFolder.java

示例8: getMessages

点赞 2

import microsoft.exchange.webservices.data.search.FindItemsResults; //导入依赖的package包/类
@Override
public List<Message> getMessages(int start, int end, Date earliestDate, @Nullable MessageRetrievalListener<Message> listener)
        throws MessagingException {
    
    ArrayList<Message> messages = new ArrayList<>();
    try {
        ItemView view = new ItemView(end - start, start);
        view.getOrderBy().add(ItemSchema.DateTimeReceived, SortDirection.Ascending);
        view.setPropertySet(new PropertySet(BasePropertySet.IdOnly));

        FindItemsResults<Item> results = folder.findItems(view);
        List<Item> items = results.getItems();
        int count = items.size();
        for (int i = 0; i < items.size(); i++) {
            String uid = items.get(i).getId().getUniqueId();
            if (listener != null)
                listener.messageStarted(uid, i, count);
            EwsMessage message = new EwsMessage(uid, this);
            messages.add(message);
            if (listener != null)
                listener.messageFinished(message, i, count);
        }
    } catch (Exception e) {
        throw new MessagingException("Failed to fetch messages", e);
    }
    return messages;
}
 

开发者ID:philipwhiuk,
项目名称:q-mail,
代码行数:28,
代码来源:EwsFolder.java

示例9: findAppointments

点赞 2

import microsoft.exchange.webservices.data.search.FindItemsResults; //导入依赖的package包/类
/**
 * Obtains a list of appointments by searching the contents of a specific
 * folder. Calling this method results in a call to EWS.
 *
 * @param parentFolderId the parent folder id
 * @param calendarView   the calendar view
 * @return A collection of appointments representing the contents of the
 * specified folder.
 * @throws Exception the exception
 */
public FindItemsResults<Appointment> findAppointments(
    FolderId parentFolderId, CalendarView calendarView)
    throws Exception {
  List<FolderId> folderIdArray = new ArrayList<FolderId>();
  folderIdArray.add(parentFolderId);

  ServiceResponseCollection<FindItemResponse<Appointment>> response = this
      .findItems(folderIdArray, null, /* searchFilter */
          null /* queryString */, calendarView, null, /* groupBy */
          ServiceErrorHandling.ThrowOnError);

  return response.getResponseAtIndex(0).getResults();
}
 

开发者ID:OfficeDev,
项目名称:ews-java-api,
代码行数:24,
代码来源:ExchangeService.java

示例10: readElementsFromXml

点赞 2

import microsoft.exchange.webservices.data.search.FindItemsResults; //导入依赖的package包/类
/**
 * Reads response elements from XML.
 *
 * @param reader ,The reader
 * @throws Exception the exception
 */
@Override
protected void readElementsFromXml(EwsServiceXmlReader reader)
    throws Exception {
  reader.readStartElement(XmlNamespace.Messages,
      XmlElementNames.RootFolder);

  int totalItemsInView = reader.readAttributeValue(Integer.class,
      XmlAttributeNames.TotalItemsInView);
  boolean moreItemsAvailable = !reader.readAttributeValue(Boolean.class,
      XmlAttributeNames.IncludesLastItemInRange);

  // Ignore IndexedPagingOffset attribute if moreItemsAvailable is false.
  Integer nextPageOffset = moreItemsAvailable ? reader
      .readNullableAttributeValue(Integer.class,
          XmlAttributeNames.IndexedPagingOffset) : null;

  if (!this.isGrouped) {
    this.results = new FindItemsResults<TItem>();
    this.results.setTotalCount(totalItemsInView);
    this.results.setNextPageOffset(nextPageOffset);
    this.results.setMoreAvailable(moreItemsAvailable);
    internalReadItemsFromXml(reader, this.propertySet, this.results
        .getItems());
  } else {
    this.groupedFindResults = new GroupedFindItemsResults<TItem>();
    this.groupedFindResults.setTotalCount(totalItemsInView);
    this.groupedFindResults.setNextPageOffset(nextPageOffset);
    this.groupedFindResults.setMoreAvailable(moreItemsAvailable);

    reader.readStartElement(XmlNamespace.Types, XmlElementNames.Groups);

    if (!reader.isEmptyElement()) {
      do {
        reader.read();

        if (reader.isStartElement(XmlNamespace.Types,
            XmlElementNames.GroupedItems)) {
          String groupIndex = reader.readElementValue(
              XmlNamespace.Types, XmlElementNames.GroupIndex);

          ArrayList<TItem> itemList = new ArrayList<TItem>();
          internalReadItemsFromXml(reader, this.propertySet,
              itemList);

          reader.readEndElement(XmlNamespace.Types,
              XmlElementNames.GroupedItems);

          this.groupedFindResults.getItemGroups().add(
              new ItemGroup<TItem>(groupIndex, itemList));
        }
      } while (!reader.isEndElement(XmlNamespace.Types,
          XmlElementNames.Groups));
    } else {
      reader.read();
    }
  }

  reader
      .readEndElement(XmlNamespace.Messages,
          XmlElementNames.RootFolder);
}
 

开发者ID:OfficeDev,
项目名称:ews-java-api,
代码行数:68,
代码来源:FindItemResponse.java

示例11: getResults

点赞 1

import microsoft.exchange.webservices.data.search.FindItemsResults; //导入依赖的package包/类
/**
 * Gets the results of the search operation.
 *
 * @return the results
 */
public FindItemsResults<TItem> getResults() {
  return results;
}
 

开发者ID:OfficeDev,
项目名称:ews-java-api,
代码行数:9,
代码来源:FindItemResponse.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)