001/* 002 * CDDL HEADER START 003 * 004 * The contents of this file are subject to the terms of the 005 * Common Development and Distribution License, Version 1.0 only 006 * (the "License"). You may not use this file except in compliance 007 * with the License. 008 * 009 * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt 010 * or http://forgerock.org/license/CDDLv1.0.html. 011 * See the License for the specific language governing permissions 012 * and limitations under the License. 013 * 014 * When distributing Covered Code, include this CDDL HEADER in each 015 * file and include the License file at legal-notices/CDDLv1_0.txt. 016 * If applicable, add the following below this CDDL HEADER, with the 017 * fields enclosed by brackets "[]" replaced with your own identifying 018 * information: 019 * Portions Copyright [yyyy] [name of copyright owner] 020 * 021 * CDDL HEADER END 022 * 023 * 024 * Copyright 2006-2008 Sun Microsystems, Inc. 025 * Portions Copyright 2014-2015 ForgeRock AS 026 */ 027package org.opends.server.types; 028 029import org.forgerock.i18n.LocalizableMessage; 030import org.forgerock.opendj.ldap.ResultCode; 031 032 033/** 034 * This enumeration defines the set of possible outcomes that can 035 * result from processing a cancel request. This is based on the 036 * specification contained in RFC 3909. 037 */ 038@org.opends.server.types.PublicAPI( 039 stability=org.opends.server.types.StabilityLevel.UNCOMMITTED, 040 mayInstantiate=false, 041 mayExtend=false, 042 mayInvoke=true) 043public class CancelResult 044{ 045 /** The result code associated with this cancel result. */ 046 private final ResultCode resultCode; 047 048 /** 049 * A human-readable response that the server 050 * provided for the result of the cancellation. 051 */ 052 private final LocalizableMessage responseMessage; 053 054 /** 055 * Creates a new cancel result with the provided result code. 056 * 057 * @param resultCode The result code associated with this cancel 058 * result. 059 * 060 * @param responseMessage A human-readable response that the 061 * server provided for the result 062 * of the cancellation. 063 */ 064 public CancelResult(ResultCode resultCode, LocalizableMessage responseMessage) 065 { 066 this.resultCode = resultCode; 067 this.responseMessage = responseMessage; 068 } 069 070 071 072 /** 073 * Retrieves the result code associated with this cancel result. 074 * 075 * @return The result code associated with this cancel result. 076 */ 077 public final ResultCode getResultCode() 078 { 079 return resultCode; 080 } 081 082 /** 083 * Retrieves the human-readable response that the server provided 084 * for the result of the cancellation. The caller may alter the 085 * contents of this buffer. 086 * 087 * @return The buffer that is used to hold a human-readable 088 * response that the server provided for the result of this 089 * cancellation. 090 */ 091 public LocalizableMessage getResponseMessage() 092 { 093 return responseMessage; 094 } 095 096 /** 097 * Retrieves a string representation of this cancel result. 098 * 099 * @return A string representation of this cancel result. 100 */ 101 @Override 102 public final String toString() 103 { 104 return String.valueOf(resultCode); 105 } 106} 107