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 * This class represents a SCIM Put Resource request to replace the contents 028 * of an existing resource. 029 */ 030public 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 * Create a new SCIM Put Resource request from the provided information. 044 * 045 * @param baseURL The base URL for the SCIM service. 046 * @param authenticatedUserID The authenticated user name or {@code null} if 047 * the request is not authenticated. 048 * @param resourceDescriptor The ResourceDescriptor associated with this 049 * request. 050 * @param resourceID The target resource ID. 051 * @param resourceObject The new contents of the resource. 052 * @param attributes The set of requested attributes. 053 */ 054 public PutResourceRequest(final URI baseURL, 055 final String authenticatedUserID, 056 final ResourceDescriptor resourceDescriptor, 057 final String resourceID, 058 final SCIMObject resourceObject, 059 final SCIMQueryAttributes attributes) 060 { 061 super(baseURL, authenticatedUserID, resourceDescriptor, attributes); 062 this.resourceID = resourceID; 063 this.resourceObject = resourceObject; 064 } 065 066 067 068 /** 069 * Create a new SCIM Put Resource request from the provided information. 070 * 071 * @param baseURL The base URL for the SCIM service. 072 * @param authenticatedUserID The authenticated user name or {@code null} if 073 * the request is not authenticated. 074 * @param resourceDescriptor The ResourceDescriptor associated with this 075 * request. 076 * @param resourceID The target resource ID. 077 * @param resourceObject The new contents of the resource. 078 * @param attributes The set of requested attributes. 079 * @param httpServletRequest The HTTP servlet request associated with this 080 * request or {@code null} if this request is not 081 * initiated by a servlet. 082 */ 083 public PutResourceRequest(final URI baseURL, 084 final String authenticatedUserID, 085 final ResourceDescriptor resourceDescriptor, 086 final String resourceID, 087 final SCIMObject resourceObject, 088 final SCIMQueryAttributes attributes, 089 final HttpServletRequest httpServletRequest) 090 { 091 super(baseURL, authenticatedUserID, resourceDescriptor, attributes, 092 httpServletRequest); 093 this.resourceID = resourceID; 094 this.resourceObject = resourceObject; 095 } 096 097 098 099 /** 100 * Create a new SCIM Put Resource request from the provided information. 101 * 102 * @param baseURL The base URL for the SCIM service. 103 * @param authenticatedUserID The authenticated user name or {@code null} if 104 * the request is not authenticated. 105 * @param resourceDescriptor The ResourceDescriptor associated with this 106 * request. 107 * @param resourceID The target resource ID. 108 * @param resourceObject The new contents of the resource. 109 * @param attributes The set of requested attributes. 110 * @param httpServletRequest The HTTP servlet request associated with this 111 * request or {@code null} if this request is not 112 * initiated by a servlet. 113 * @param ifMatchHeaderValue The If-Match header value. 114 * @param ifNoneMatchHeaderValue The If-None-Match header value. 115 */ 116 public PutResourceRequest(final URI baseURL, 117 final String authenticatedUserID, 118 final ResourceDescriptor resourceDescriptor, 119 final String resourceID, 120 final SCIMObject resourceObject, 121 final SCIMQueryAttributes attributes, 122 final HttpServletRequest httpServletRequest, 123 final String ifMatchHeaderValue, 124 final String ifNoneMatchHeaderValue) 125 { 126 super(baseURL, authenticatedUserID, resourceDescriptor, attributes, 127 httpServletRequest,ifMatchHeaderValue, ifNoneMatchHeaderValue); 128 this.resourceID = resourceID; 129 this.resourceObject = resourceObject; 130 } 131 132 133 134 /** 135 * Get the target resource ID. 136 * 137 * @return The target resource ID. 138 */ 139 public String getResourceID() 140 { 141 return resourceID; 142 } 143 144 145 146 /** 147 * Get the contents of the resource to be created. 148 * 149 * @return The contents of the resource to be created. 150 */ 151 public SCIMObject getResourceObject() 152 { 153 return resourceObject; 154 } 155}