microsoft.exchange.webservices.data.core.enumeration.search.SortDirection Java Examples
The following examples show how to use
microsoft.exchange.webservices.data.core.enumeration.search.SortDirection.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExchangeFileSystem.java From iaf with Apache License 2.0 | 7 votes |
@Override public Iterator<Item> listFiles(String folder) throws FileSystemException { try { FolderId folderId = findFolder(basefolderId,folder); ItemView view = new ItemView(getMaxNumberOfMessagesToList()); 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(folderId,searchFilterBounce, view); } else { findResults = exchangeService.findItems(folderId, view); } if (findResults.getTotalCount() == 0) { return null; } else { return findResults.getItems().iterator(); } } catch (Exception e) { throw new FileSystemException("Cannot list messages in folder ["+folder+"]", e); } }
Example #2
Source File: OrderByCollection.java From ews-java-api with MIT License | 6 votes |
/** * Writes to XML. * * @param writer the writer * @param xmlElementName the xml element name * @throws XMLStreamException the XML stream exception * @throws ServiceXmlSerializationException the service xml serialization exception */ protected void writeToXml(EwsServiceXmlWriter writer, String xmlElementName) throws XMLStreamException, ServiceXmlSerializationException { if (this.count() > 0) { writer.writeStartElement(XmlNamespace.Messages, xmlElementName); for (Map<PropertyDefinitionBase, SortDirection> keyValuePair : this.propDefSortOrderPairList) { writer.writeStartElement(XmlNamespace.Types, XmlElementNames.FieldOrder); writer.writeAttributeValue(XmlAttributeNames.Order, keyValuePair.values().iterator().next()); keyValuePair.keySet().iterator().next().writeToXml(writer); writer.writeEndElement(); // FieldOrder } writer.writeEndElement(); } }
Example #3
Source File: Grouping.java From ews-java-api with MIT License | 5 votes |
/** * Initializes a new instance of the "Grouping" class. * * @param groupOn The property to group on * @param sortDirection The sort direction. * @param aggregateOn The property to aggregate on. * @param aggregateType The type of aggregate to calculate. * @throws Exception the exception */ public Grouping(PropertyDefinitionBase groupOn, SortDirection sortDirection, PropertyDefinitionBase aggregateOn, AggregateType aggregateType) throws Exception { this(); EwsUtilities.validateParam(groupOn, "groupOn"); EwsUtilities.validateParam(aggregateOn, "aggregateOn"); this.groupOn = groupOn; this.sortDirection = sortDirection; this.aggregateOn = aggregateOn; this.aggregateType = aggregateType; }
Example #4
Source File: OrderByCollection.java From ews-java-api with MIT License | 5 votes |
/** * Adds the specified property definition / sort direction pair to the * collection. * * @param propertyDefinition the property definition * @param sortDirection the sort direction * @throws ServiceLocalException the service local exception */ public void add(PropertyDefinitionBase propertyDefinition, SortDirection sortDirection) throws ServiceLocalException { if (this.contains(propertyDefinition)) { throw new ServiceLocalException(String.format("Property %s already exists in OrderByCollection.", propertyDefinition.getPrintableName())); } Map<PropertyDefinitionBase, SortDirection> propertyDefinitionSortDirectionPair = new HashMap<PropertyDefinitionBase, SortDirection>(); propertyDefinitionSortDirectionPair.put(propertyDefinition, sortDirection); this.propDefSortOrderPairList.add(propertyDefinitionSortDirectionPair); }
Example #5
Source File: OrderByCollection.java From ews-java-api with MIT License | 5 votes |
/** * Removes the specified property definition from the collection. * * @param propertyDefinition the property definition * @return True if the property definition is successfully removed; * otherwise, false */ public boolean remove(PropertyDefinitionBase propertyDefinition) { List<Map<PropertyDefinitionBase, SortDirection>> removeList = new ArrayList<Map<PropertyDefinitionBase, SortDirection>>(); for (Map<PropertyDefinitionBase, SortDirection> propDefSortOrderPair : propDefSortOrderPairList) { if (propDefSortOrderPair.containsKey(propertyDefinition)) { removeList.add(propDefSortOrderPair); } } this.propDefSortOrderPairList.removeAll(removeList); return removeList.size() > 0; }
Example #6
Source File: OrderByCollection.java From ews-java-api with MIT License | 5 votes |
/** * Tries to get the value for a property definition in the collection. * * @param propertyDefinition the property definition * @param sortDirection the sort direction * @return True if collection contains property definition, otherwise false. */ public boolean tryGetValue(PropertyDefinitionBase propertyDefinition, OutParam<SortDirection> sortDirection) { for (Map<PropertyDefinitionBase, SortDirection> pair : this.propDefSortOrderPairList) { if (pair.containsKey(propertyDefinition)) { sortDirection.setParam(pair.get(propertyDefinition)); return true; } } sortDirection.setParam(SortDirection.Ascending); // out parameter has to // be set to some // value. return false; }
Example #7
Source File: ExchangeFileSystem.java From iaf with Apache License 2.0 | 5 votes |
@Override public boolean exists(Item f) throws FileSystemException { try { ItemView view = new ItemView(1); view.getOrderBy().add(ItemSchema.DateTimeReceived, SortDirection.Ascending); SearchFilter searchFilter = new SearchFilter.IsEqualTo(ItemSchema.Id, f.getId().toString()); FindItemsResults<Item> findResults; findResults = exchangeService.findItems(basefolderId,searchFilter, view); return findResults.getTotalCount()!=0; } catch (Exception e) { throw new FileSystemException(e); } }
Example #8
Source File: ConsumeEWS.java From localization_nifi with Apache License 2.0 | 4 votes |
/** * Fills the internal message queue if such queue is empty. This is due to * the fact that per single session there may be multiple messages retrieved * from the email server (see FETCH_SIZE). */ protected void fillMessageQueueIfNecessary(ProcessContext context) throws ProcessException { if (this.messageQueue.isEmpty()) { ExchangeService service = this.initializeIfNecessary(context); boolean deleteOnRead = context.getProperty(SHOULD_DELETE_MESSAGES).getValue().equals("true"); boolean markAsRead = context.getProperty(SHOULD_MARK_READ).getValue().equals("true"); try { //Get Folder Folder folder = getFolder(service); ItemView view = new ItemView(messageQueue.remainingCapacity()); view.getOrderBy().add(ItemSchema.DateTimeReceived, SortDirection.Ascending); SearchFilter sf = new SearchFilter.SearchFilterCollection(LogicalOperator.And, new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, false)); FindItemsResults<Item> findResults = service.findItems(folder.getId(), sf, view); if(findResults == null || findResults.getItems().size()== 0){ return; } service.loadPropertiesForItems(findResults, PropertySet.FirstClassProperties); for (Item item : findResults) { EmailMessage ewsMessage = (EmailMessage) item; messageQueue.add(parseMessage(ewsMessage)); if(deleteOnRead){ ewsMessage.delete(DeleteMode.HardDelete); } else if(markAsRead){ ewsMessage.setIsRead(true); ewsMessage.update(ConflictResolutionMode.AlwaysOverwrite); } } service.close(); } catch (Exception e) { throw new ProcessException("Failed retrieving new messages from EWS.", e); } } }
Example #9
Source File: OrderByCollection.java From ews-java-api with MIT License | 4 votes |
/** * Initializes a new instance of the OrderByCollection class. */ protected OrderByCollection() { this.propDefSortOrderPairList = new ArrayList<Map<PropertyDefinitionBase, SortDirection>>(); }
Example #10
Source File: OrderByCollection.java From ews-java-api with MIT License | 4 votes |
@Override public Iterator<Map<PropertyDefinitionBase, SortDirection>> iterator() { return this.propDefSortOrderPairList.iterator(); }
Example #11
Source File: ConsumeEWS.java From nifi with Apache License 2.0 | 4 votes |
/** * Fills the internal message queue if such queue is empty. This is due to * the fact that per single session there may be multiple messages retrieved * from the email server (see FETCH_SIZE). */ protected void fillMessageQueueIfNecessary(ProcessContext context) throws ProcessException { if (this.messageQueue.isEmpty()) { ExchangeService service = this.initializeIfNecessary(context); boolean deleteOnRead = context.getProperty(SHOULD_DELETE_MESSAGES).getValue().equals("true"); boolean markAsRead = context.getProperty(SHOULD_MARK_READ).getValue().equals("true"); String includeHeaders = context.getProperty(INCLUDE_EMAIL_HEADERS).getValue(); String excludeHeaders = context.getProperty(EXCLUDE_EMAIL_HEADERS).getValue(); List<String> includeHeadersList = null; List<String> excludeHeadersList = null; if (!StringUtils.isEmpty(includeHeaders)) { includeHeadersList = Arrays.asList(includeHeaders.split(",")); } if (!StringUtils.isEmpty(excludeHeaders)) { excludeHeadersList = Arrays.asList(excludeHeaders.split(",")); } try { //Get Folder Folder folder = getFolder(service); ItemView view = new ItemView(messageQueue.remainingCapacity()); view.getOrderBy().add(ItemSchema.DateTimeReceived, SortDirection.Ascending); SearchFilter sf = new SearchFilter.SearchFilterCollection(LogicalOperator.And, new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, false)); FindItemsResults<Item> findResults = service.findItems(folder.getId(), sf, view); if(findResults == null || findResults.getItems().size()== 0){ return; } service.loadPropertiesForItems(findResults, PropertySet.FirstClassProperties); for (Item item : findResults) { EmailMessage ewsMessage = (EmailMessage) item; messageQueue.add(parseMessage(ewsMessage,includeHeadersList,excludeHeadersList)); if(deleteOnRead){ ewsMessage.delete(DeleteMode.HardDelete); } else if(markAsRead){ ewsMessage.setIsRead(true); ewsMessage.update(ConflictResolutionMode.AlwaysOverwrite); } } service.close(); } catch (Exception e) { throw new ProcessException("Failed retrieving new messages from EWS.", e); } } }
Example #12
Source File: OrderByCollection.java From ews-java-api with MIT License | 3 votes |
/** * Determines whether the collection contains the specified property * definition. * * @param propertyDefinition the property definition * @return True if the collection contains the specified property * definition; otherwise, false. */ protected boolean contains(PropertyDefinitionBase propertyDefinition) { for (Map<PropertyDefinitionBase, SortDirection> propDefSortOrderPair : propDefSortOrderPairList) { return propDefSortOrderPair.containsKey(propertyDefinition); } return false; }
Example #13
Source File: Grouping.java From ews-java-api with MIT License | 2 votes |
/** * Gets the Sort Direction. * * @return the sort direction */ public SortDirection getSortDirection() { return sortDirection; }
Example #14
Source File: Grouping.java From ews-java-api with MIT License | 2 votes |
/** * Sets the Sort Direction. * * @param sortDirection the new sort direction */ public void setSortDirection(SortDirection sortDirection) { this.sortDirection = sortDirection; }
Example #15
Source File: OrderByCollection.java From ews-java-api with MIT License | 2 votes |
/** * Gets the element at the specified index from the collection. * * @param index the index * @return the property definition sort direction pair */ public Map<PropertyDefinitionBase, SortDirection> getPropertyDefinitionSortDirectionPair( int index) { return this.propDefSortOrderPairList.get(index); }
Example #16
Source File: OrderByCollection.java From ews-java-api with MIT License | 2 votes |
/** * Returns an enumerator that iterates through the collection. * * @return A Iterator that can be used to iterate through the collection. */ public Iterator<Map<PropertyDefinitionBase, SortDirection>> getEnumerator() { return (this.propDefSortOrderPairList.iterator()); }