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