001    /*
002     * Copyright 2011-2012 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    
018    package com.unboundid.scim.sdk;
019    
020    import com.unboundid.scim.schema.ResourceDescriptor;
021    
022    import java.net.URI;
023    
024    
025    
026    /**
027     * This class represents a SCIM Put Resource request to replace the contents
028     * of an existing resource.
029     */
030    public final class PutResourceRequest extends ResourceReturningRequest
031    {
032      /**
033       * The target resource ID.
034       */
035      private final String resourceID;
036    
037      /**
038       * The new contents of the resource.
039       */
040      private final SCIMObject resourceObject;
041    
042    
043    
044      /**
045       * Create a new SCIM Put Resource request from the provided information.
046       *
047       * @param baseURL              The base URL for the SCIM service.
048       * @param authenticatedUserID  The authenticated user name or {@code null} if
049       *                             the request is not authenticated.
050       * @param resourceDescriptor   The ResourceDescriptor associated with this
051       *                             request.
052       * @param resourceID           The target resource ID.
053       * @param resourceObject       The new contents of the resource.
054       * @param attributes           The set of requested attributes.
055       */
056      public PutResourceRequest(final URI baseURL,
057                                final String authenticatedUserID,
058                                final ResourceDescriptor resourceDescriptor,
059                                final String resourceID,
060                                final SCIMObject resourceObject,
061                                final SCIMQueryAttributes attributes)
062      {
063        super(baseURL, authenticatedUserID, resourceDescriptor, attributes);
064        this.resourceID          = resourceID;
065        this.resourceObject      = resourceObject;
066      }
067    
068    
069    
070      /**
071       * Get the target resource ID.
072       *
073       * @return  The target resource ID.
074       */
075      public String getResourceID()
076      {
077        return resourceID;
078      }
079    
080    
081    
082      /**
083       * Get the contents of the resource to be created.
084       *
085       * @return  The contents of the resource to be created.
086       */
087      public SCIMObject getResourceObject()
088      {
089        return resourceObject;
090      }
091    }