001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions Copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2012-2015 ForgeRock AS. 015 */ 016 017package org.forgerock.json.resource; 018 019import java.util.List; 020import java.util.Map; 021 022import org.forgerock.http.routing.Version; 023import org.forgerock.json.JsonPointer; 024import org.forgerock.json.JsonValue; 025import org.forgerock.util.i18n.PreferredLocales; 026 027/** 028 * A request to delete a JSON resource. 029 */ 030public interface DeleteRequest extends Request { 031 032 /** 033 * The name of the field which contains the resource version in the JSON representation. 034 */ 035 String FIELD_REVISION = "revision"; 036 037 038 @Override 039 <R, P> R accept(final RequestVisitor<R, P> v, final P p); 040 041 042 @Override 043 DeleteRequest addField(JsonPointer... fields); 044 045 046 @Override 047 DeleteRequest addField(String... fields); 048 049 050 @Override 051 String getAdditionalParameter(String name); 052 053 054 @Override 055 Map<String, String> getAdditionalParameters(); 056 057 058 @Override 059 List<JsonPointer> getFields(); 060 061 062 @Override 063 PreferredLocales getPreferredLocales(); 064 065 066 @Override 067 RequestType getRequestType(); 068 069 @Override 070 String getResourcePath(); 071 072 @Override 073 ResourcePath getResourcePathObject(); 074 075 @Override 076 Version getResourceVersion(); 077 078 /** 079 * Returns the expected version information associated with the JSON resource to be deleted. Version information can 080 * be used in order to implement multi-version concurrency control (MVCC). 081 * <p> 082 * The returned version information may be {@code null} indicating that the client does not care if the resource has 083 * been modified concurrently. If the version information is non-{@code null}, and it does not match the current 084 * version of the targeted JSON resource, then the delete request will be rejected by the provider. 085 * 086 * @return The expected version information associated with the JSON resource to be deleted. 087 */ 088 String getRevision(); 089 090 @Override 091 DeleteRequest setAdditionalParameter(String name, String value) throws BadRequestException; 092 093 @Override 094 DeleteRequest setPreferredLocales(PreferredLocales preferredLocales); 095 096 @Override 097 DeleteRequest setResourcePath(String path); 098 099 @Override 100 DeleteRequest setResourcePath(ResourcePath path); 101 102 @Override 103 DeleteRequest setResourceVersion(Version resourceVersion); 104 105 /** 106 * Sets the expected version information associated with the JSON resource to be deleted. Version information can be 107 * used in order to implement multi-version concurrency control (MVCC). 108 * <p> 109 * The provided version information may be {@code null} indicating that the client does not care if the resource has 110 * been modified concurrently. If the version information is non-{@code null}, and it does not match the current 111 * version of the targeted JSON resource, then the delete request will be rejected by the provider. 112 * 113 * @param version 114 * The expected version information associated with the JSON resource to be deleted. 115 * @return This delete request. 116 * @throws UnsupportedOperationException 117 * If this delete request does not permit changes to the version information. 118 */ 119 DeleteRequest setRevision(String version); 120 121 @Override 122 JsonValue toJsonValue(); 123}