001/*
002 * Copyright 2011-2016 UnboundID Corp.
003 *
004 * This program is free software; you can redistribute it and/or modify
005 * it under the terms of the GNU General Public License (GPLv2 only)
006 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
007 * as published by the Free Software Foundation.
008 *
009 * This program is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012 * GNU General Public License for more details.
013 *
014 * You should have received a copy of the GNU General Public License
015 * along with this program; if not, see <http://www.gnu.org/licenses>.
016 */
017
018package com.unboundid.scim.sdk;
019
020import com.unboundid.scim.schema.ResourceDescriptor;
021
022import javax.servlet.http.HttpServletRequest;
023import java.net.URI;
024
025
026
027/**
028 * This class represents a SCIM Get Resources request to retrieve selected
029 * resources.
030 */
031public class GetResourcesRequest extends ResourceReturningRequest
032{
033  /**
034   * The filter parameters of the request.
035   */
036  private final SCIMFilter filter;
037
038  /**
039   * The SCIM resource ID of the search base entry.
040   */
041  private final String baseID;
042
043  /**
044   * The LDAP search scope to use.
045   */
046  private final String searchScope;
047
048  /**
049   * The sorting parameters of the request.
050   */
051  private final SortParameters sortParameters;
052
053  /**
054   * The pagination parameters of the request.
055   */
056  private final PageParameters pageParameters;
057
058
059
060  /**
061   * Create a new SCIM Get Resource request from the provided information.
062   *
063   * @param baseURL               The base URL for the SCIM service.
064   * @param authenticatedUserID   The authenticated user name or {@code null} if
065   *                              the request is not authenticated.
066   * @param resourceDescriptor    The ResourceDescriptor associated with this
067   *                              request.
068   * @param filter                The filter parameters of the request.
069   * @param baseID                The SCIM resource ID of the search base entry,
070   *                              or {@code null}.
071   * @param searchScope           The LDAP search scope to use, or {@code null}
072   *                              if the default (whole-subtree) should be used.
073   * @param sortParameters        The sorting parameters of the request.
074   * @param pageParameters        The pagination parameters of the request.
075   * @param attributes            The set of requested attributes.
076   */
077  public GetResourcesRequest(final URI baseURL,
078                             final String authenticatedUserID,
079                             final ResourceDescriptor resourceDescriptor,
080                             final SCIMFilter filter,
081                             final String baseID,
082                             final String searchScope,
083                             final SortParameters sortParameters,
084                             final PageParameters pageParameters,
085                             final SCIMQueryAttributes attributes)
086  {
087    super(baseURL, authenticatedUserID, resourceDescriptor, attributes);
088    this.filter         = filter;
089    this.baseID         = baseID;
090    this.searchScope    = searchScope;
091    this.sortParameters = sortParameters;
092    this.pageParameters = pageParameters;
093  }
094
095
096
097  /**
098   * Create a new SCIM Get Resource request from the provided information.
099   *
100   * @param baseURL               The base URL for the SCIM service.
101   * @param authenticatedUserID   The authenticated user name or {@code null} if
102   *                              the request is not authenticated.
103   * @param resourceDescriptor    The ResourceDescriptor associated with this
104   *                              request.
105   * @param filter                The filter parameters of the request.
106   * @param baseID                The SCIM resource ID of the search base entry,
107   *                              or {@code null}.
108   * @param searchScope           The LDAP search scope to use, or {@code null}
109   *                              if the default (whole-subtree) should be used.
110   * @param sortParameters        The sorting parameters of the request.
111   * @param pageParameters        The pagination parameters of the request.
112   * @param attributes            The set of requested attributes.
113   * @param httpServletRequest   The HTTP servlet request associated with this
114   *                             request or {@code null} if this request is not
115   *                             initiated by a servlet.
116   */
117  public GetResourcesRequest(final URI baseURL,
118                             final String authenticatedUserID,
119                             final ResourceDescriptor resourceDescriptor,
120                             final SCIMFilter filter,
121                             final String baseID,
122                             final String searchScope,
123                             final SortParameters sortParameters,
124                             final PageParameters pageParameters,
125                             final SCIMQueryAttributes attributes,
126                             final HttpServletRequest httpServletRequest)
127  {
128    super(baseURL, authenticatedUserID, resourceDescriptor, attributes,
129          httpServletRequest);
130    this.filter         = filter;
131    this.baseID         = baseID;
132    this.searchScope    = searchScope;
133    this.sortParameters = sortParameters;
134    this.pageParameters = pageParameters;
135  }
136
137
138
139  /**
140   * Retrieve the filter parameters of the request.
141   *
142   * @return  The filter parameters of the request.
143   */
144  public SCIMFilter getFilter()
145  {
146    return filter;
147  }
148
149
150  /**
151   * Retrieve the base-id parameter of the request.
152   *
153   * @return  The base-id parameter of the request.
154   */
155  public String getBaseID()
156  {
157    return baseID;
158  }
159
160
161
162  /**
163   * Retrieve the scope parameter of the request.
164   *
165   * @return  The scope parameter of the request.
166   */
167  public String getSearchScope()
168  {
169    return searchScope;
170  }
171
172
173
174  /**
175   * Retrieve the sorting parameters of the request.
176   *
177   * @return  The sorting parameters of the request.
178   */
179  public SortParameters getSortParameters()
180  {
181    return sortParameters;
182  }
183
184
185
186  /**
187   * Retrieve the pagination parameters of the request.
188   *
189   * @return  The pagination parameters of the request.
190   */
191  public PageParameters getPageParameters()
192  {
193    return pageParameters;
194  }
195}