001/* 002 * Copyright 2012-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 020 021import com.unboundid.scim.schema.ResourceDescriptor; 022 023import javax.servlet.http.HttpServletRequest; 024import java.net.URI; 025 026 027/** 028 * This class represents a SCIM Patch Resource request to update a resource. 029 */ 030public class PatchResourceRequest extends ResourceReturningRequest 031{ 032 033 /** 034 * The target resource ID. 035 */ 036 private final String resourceID; 037 038 /** 039 * The new contents of the resource. 040 */ 041 private final SCIMObject resourceObject; 042 043 /** 044 * Create a new SCIM request from the provided information. 045 * 046 * @param baseURL The base URL for the SCIM service. 047 * @param authenticatedUserID The authenticated user name or {@code null} if 048 * the request is not authenticated. 049 * @param resourceDescriptor The ResourceDescriptor associated with this 050 * request. 051 * @param resourceID The target resource ID. 052 * @param resourceObject The new contents of the resource. 053 * @param attributes The set of requested attributes. 054 */ 055 public PatchResourceRequest(final URI baseURL, 056 final String authenticatedUserID, 057 final ResourceDescriptor resourceDescriptor, 058 final String resourceID, 059 final SCIMObject resourceObject, 060 final SCIMQueryAttributes attributes) 061 { 062 super(baseURL, authenticatedUserID, resourceDescriptor, attributes); 063 this.resourceID = resourceID; 064 this.resourceObject = resourceObject; 065 } 066 067 068 /** 069 * Create a new SCIM 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 PatchResourceRequest(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 * Create a new SCIM request from the provided information. 100 * 101 * @param baseURL The base URL for the SCIM service. 102 * @param authenticatedUserID The authenticated user name or {@code null} if 103 * the request is not authenticated. 104 * @param resourceDescriptor The ResourceDescriptor associated with this 105 * request. 106 * @param resourceID The target resource ID. 107 * @param resourceObject The new contents of the resource. 108 * @param attributes The set of requested attributes. 109 * @param httpServletRequest The HTTP servlet request associated with this 110 * request or {@code null} if this request is not 111 * initiated by a servlet. 112 * @param ifMatchHeaderValue The If-Match header value. 113 * @param ifNoneMatchHeaderValue The If-None-Match header value. 114 */ 115 public PatchResourceRequest(final URI baseURL, 116 final String authenticatedUserID, 117 final ResourceDescriptor resourceDescriptor, 118 final String resourceID, 119 final SCIMObject resourceObject, 120 final SCIMQueryAttributes attributes, 121 final HttpServletRequest httpServletRequest, 122 final String ifMatchHeaderValue, 123 final String ifNoneMatchHeaderValue) 124 { 125 super(baseURL, authenticatedUserID, resourceDescriptor, attributes, 126 httpServletRequest, ifMatchHeaderValue, ifNoneMatchHeaderValue); 127 this.resourceID = resourceID; 128 this.resourceObject = resourceObject; 129 } 130 131 132 /** 133 * Get the target resource ID. 134 * 135 * @return The target resource ID. 136 */ 137 public String getResourceID() 138 { 139 return resourceID; 140 } 141 142 143 144 /** 145 * Get the contents of the resource to be created. 146 * 147 * @return The contents of the resource to be created. 148 */ 149 public SCIMObject getResourceObject() 150 { 151 return resourceObject; 152 } 153}