001/* 002 * The MIT License 003 * Copyright (c) 2012 Microsoft Corporation 004 * 005 * Permission is hereby granted, free of charge, to any person obtaining a copy 006 * of this software and associated documentation files (the "Software"), to deal 007 * in the Software without restriction, including without limitation the rights 008 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 009 * copies of the Software, and to permit persons to whom the Software is 010 * furnished to do so, subject to the following conditions: 011 * 012 * The above copyright notice and this permission notice shall be included in 013 * all copies or substantial portions of the Software. 014 * 015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 018 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 019 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 020 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 021 * THE SOFTWARE. 022 */ 023 024package microsoft.exchange.webservices.data.search; 025 026import microsoft.exchange.webservices.data.core.service.folder.Folder; 027 028import java.util.ArrayList; 029import java.util.Iterator; 030 031/** 032 * Represents the results of a folder search operation. 033 */ 034public final class FindFoldersResults implements Iterable<Folder> { 035 036 /** 037 * The total count. 038 */ 039 private int totalCount; 040 041 /** 042 * The next page offset. 043 */ 044 private Integer nextPageOffset; 045 046 /** 047 * The more available. 048 */ 049 private boolean moreAvailable; 050 051 /** 052 * The folder. 053 */ 054 private ArrayList<Folder> folders = new ArrayList<Folder>(); 055 056 /** 057 * Initializes a new instance of the <see cref="FindFoldersResults"/> class. 058 */ 059 public FindFoldersResults() { 060 061 } 062 063 /** 064 * Gets the total number of folder matching the search criteria available 065 * in the searched folder. 066 * 067 * @return the total count 068 */ 069 public int getTotalCount() { 070 return totalCount; 071 } 072 073 /** 074 * Sets the total number of folder. 075 * 076 * @param totalCount the new total count 077 */ 078 public void setTotalCount(int totalCount) { 079 this.totalCount = totalCount; 080 } 081 082 /** 083 * Gets the offset that should be used with FolderView to retrieve the next 084 * page of folder in a FindFolders operation. 085 * 086 * @return the next page offset 087 */ 088 public Integer getNextPageOffset() { 089 return nextPageOffset; 090 } 091 092 /** 093 * Sets the offset that should be used with FolderView to retrieve the next 094 * page of folder in a FindFolders operation. 095 * 096 * @param nextPageOffset the new next page offset 097 */ 098 public void setNextPageOffset(Integer nextPageOffset) { 099 this.nextPageOffset = nextPageOffset; 100 } 101 102 /** 103 * Gets a value indicating whether more folder matching the search 104 * criteria. are available in the searched folder. 105 * 106 * @return true, if is more available 107 */ 108 public boolean isMoreAvailable() { 109 return moreAvailable; 110 } 111 112 /** 113 * Sets a value indicating whether more folder matching the search 114 * criteria. are available in the searched folder. 115 * 116 * @param moreAvailable the new more available 117 */ 118 public void setMoreAvailable(boolean moreAvailable) { 119 this.moreAvailable = moreAvailable; 120 } 121 122 /** 123 * Gets a collection containing the folder that were found by the search 124 * operation. 125 * 126 * @return the folder 127 */ 128 public ArrayList<Folder> getFolders() { 129 return folders; 130 } 131 132 /** 133 * Returns an iterator that iterates through a collection. 134 * 135 * @return the iterator 136 */ 137 @Override 138 public Iterator<Folder> iterator() { 139 return this.folders.iterator(); 140 } 141 142}