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 020/** 021 * Signals the Resource has not changed on the server since last retrieved 022 * 023 * This exception corresponds to HTTP response code 024 * 304 NOT MODIFIED. 025 */ 026public class NotModifiedException extends SCIMException 027{ 028 private final String version; 029 030 /** 031 * Create a new <code>NotModifiedException</code> from the provided 032 * information. 033 * 034 * @param errorMessage The error message for this SCIM exception. 035 */ 036 public NotModifiedException(final String errorMessage) { 037 super(304, errorMessage); 038 version = null; 039 } 040 041 /** 042 * Create a new <code>NotModifiedException</code> from the provided 043 * information. 044 * 045 * @param errorMessage The error message for this SCIM exception. 046 * @param cause The cause (which is saved for later retrieval by the 047 * {@link #getCause()} method). (A <tt>null</tt> value 048 * is permitted, and indicates that the cause is 049 * nonexistent or unknown.) 050 */ 051 public NotModifiedException(final String errorMessage, 052 final Throwable cause) { 053 super(304, errorMessage, cause); 054 version = null; 055 } 056 057 /** 058 * Create a new <code>NotModifiedException</code> from the provided 059 * information. 060 * 061 * @param errorMessage The error message for this SCIM exception. 062 * @param version The current version of the Resource. 063 * @param cause The cause (which is saved for later retrieval by the 064 * {@link #getCause()} method). (A <tt>null</tt> value 065 * is permitted, and indicates that the cause is 066 * nonexistent or unknown.) 067 */ 068 public NotModifiedException(final String errorMessage, 069 final String version, 070 final Throwable cause) { 071 super(304, errorMessage, cause); 072 this.version = version; 073 } 074 075 /** 076 * Retrieves the version of the Resource. 077 * 078 * @return The current version of the Resource. 079 */ 080 public String getVersion() { 081 return version; 082 } 083}