001/*
002 * Copyright 2011-2013 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 Resource request to retrieve all or
029 * selected attributes from a single resource.
030 */
031public final class GetResourceRequest extends ResourceReturningRequest
032{
033  /**
034   * The requested resource ID.
035   */
036  private final String resourceID;
037
038
039
040  /**
041   * Create a new SCIM Get Resource request from the provided information.
042   *
043   * @param baseURL              The base URL for the SCIM service.
044   * @param authenticatedUserID  The authenticated user name or {@code null} if
045   *                             the request is not authenticated.
046   * @param resourceDescriptor   The ResourceDescriptor associated with this
047   *                             request.
048   * @param resourceID           The requested resource ID.
049   * @param attributes           The set of requested attributes.
050   */
051  public GetResourceRequest(final URI baseURL,
052                            final String authenticatedUserID,
053                            final ResourceDescriptor resourceDescriptor,
054                            final String resourceID,
055                            final SCIMQueryAttributes attributes)
056  {
057    super(baseURL, authenticatedUserID, resourceDescriptor, attributes);
058    this.resourceID          = resourceID;
059  }
060
061
062
063  /**
064   * Create a new SCIM Get Resource request from the provided information.
065   *
066   * @param baseURL              The base URL for the SCIM service.
067   * @param authenticatedUserID  The authenticated user name or {@code null} if
068   *                             the request is not authenticated.
069   * @param resourceDescriptor   The ResourceDescriptor associated with this
070   *                             request.
071   * @param resourceID           The requested resource ID.
072   * @param attributes           The set of requested attributes.
073   * @param httpServletRequest   The HTTP servlet request associated with this
074   *                             request or {@code null} if this request is not
075   *                             initiated by a servlet.
076   */
077  public GetResourceRequest(final URI baseURL,
078                            final String authenticatedUserID,
079                            final ResourceDescriptor resourceDescriptor,
080                            final String resourceID,
081                            final SCIMQueryAttributes attributes,
082                            final HttpServletRequest httpServletRequest)
083  {
084    super(baseURL, authenticatedUserID, resourceDescriptor, attributes,
085          httpServletRequest);
086    this.resourceID          = resourceID;
087  }
088
089
090
091  /**
092   * Get the requested resource ID.
093   *
094   * @return  The requested resource ID.
095   */
096  public String getResourceID()
097  {
098    return resourceID;
099  }
100}