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    
024    package microsoft.exchange.webservices.data.misc.availability;
025    
026    import microsoft.exchange.webservices.data.core.response.AttendeeAvailability;
027    import microsoft.exchange.webservices.data.core.response.ServiceResponseCollection;
028    import microsoft.exchange.webservices.data.core.response.SuggestionsResponse;
029    import microsoft.exchange.webservices.data.core.exception.service.remote.ServiceResponseException;
030    import microsoft.exchange.webservices.data.property.complex.availability.Suggestion;
031    
032    import java.util.Collection;
033    
034    /**
035     * Represents the results of a GetUserAvailability operation.
036     */
037    public final class GetUserAvailabilityResults {
038    
039      /**
040       * The attendees availability.
041       */
042      private ServiceResponseCollection<AttendeeAvailability>
043          attendeesAvailability;
044    
045      /**
046       * The suggestions response.
047       */
048      private SuggestionsResponse suggestionsResponse;
049    
050      /**
051       * Initializes a new instance of the GetUserAvailabilityResults class.
052       */
053      public GetUserAvailabilityResults() {
054      }
055    
056      /**
057       * Gets  the suggestions response for the requested meeting time.
058       *
059       * @return the suggestions response
060       */
061      public SuggestionsResponse getSuggestionsResponse() {
062        return this.suggestionsResponse;
063      }
064    
065      /**
066       * Sets the suggestions response.
067       *
068       * @param value the new suggestions response
069       */
070      public void setSuggestionsResponse(SuggestionsResponse value) {
071        this.suggestionsResponse = value;
072      }
073    
074      /**
075       * Gets a collection of AttendeeAvailability objects representing
076       * availability information for each of the specified attendees.
077       *
078       * @return the attendees availability
079       */
080      public ServiceResponseCollection<AttendeeAvailability>
081      getAttendeesAvailability() {
082        return this.attendeesAvailability;
083      }
084    
085      /**
086       * Sets the attendees availability.
087       *
088       * @param value the new attendees availability
089       */
090      public void setAttendeesAvailability(ServiceResponseCollection<AttendeeAvailability> value) {
091        this.attendeesAvailability = value;
092      }
093    
094      /**
095       * Gets a collection of suggested meeting times for the specified time
096       * period.
097       *
098       * @return the suggestions
099       * @throws ServiceResponseException the service response exception
100       */
101      public Collection<Suggestion> getSuggestions()
102          throws ServiceResponseException {
103        if (this.suggestionsResponse == null) {
104          return null;
105        } else {
106          this.suggestionsResponse.throwIfNecessary();
107    
108          return this.suggestionsResponse.getSuggestions();
109        }
110    
111      }
112    }