001/* 002 * Copyright 2008-2020 Ping Identity Corporation 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright 2008-2020 Ping Identity Corporation 007 * 008 * Licensed under the Apache License, Version 2.0 (the "License"); 009 * you may not use this file except in compliance with the License. 010 * You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, software 015 * distributed under the License is distributed on an "AS IS" BASIS, 016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 017 * See the License for the specific language governing permissions and 018 * limitations under the License. 019 */ 020/* 021 * Copyright (C) 2008-2020 Ping Identity Corporation 022 * 023 * This program is free software; you can redistribute it and/or modify 024 * it under the terms of the GNU General Public License (GPLv2 only) 025 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only) 026 * as published by the Free Software Foundation. 027 * 028 * This program is distributed in the hope that it will be useful, 029 * but WITHOUT ANY WARRANTY; without even the implied warranty of 030 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 031 * GNU General Public License for more details. 032 * 033 * You should have received a copy of the GNU General Public License 034 * along with this program; if not, see <http://www.gnu.org/licenses>. 035 */ 036package com.unboundid.ldap.sdk.unboundidds.extensions; 037 038 039 040import com.unboundid.ldap.sdk.Control; 041import com.unboundid.ldap.sdk.ExtendedResult; 042import com.unboundid.ldap.sdk.ResultCode; 043import com.unboundid.util.NotMutable; 044import com.unboundid.util.NotNull; 045import com.unboundid.util.Nullable; 046import com.unboundid.util.ThreadSafety; 047import com.unboundid.util.ThreadSafetyLevel; 048 049import static com.unboundid.ldap.sdk.unboundidds.extensions.ExtOpMessages.*; 050 051 052 053/** 054 * This class provides an implementation of the interactive transaction aborted 055 * extended result, which is used as an unsolicited notification to indicate 056 * that the server has aborted an interactive transaction without the client's 057 * explicit request. 058 * <BR> 059 * <BLOCKQUOTE> 060 * <B>NOTE:</B> This class, and other classes within the 061 * {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only 062 * supported for use against Ping Identity, UnboundID, and 063 * Nokia/Alcatel-Lucent 8661 server products. These classes provide support 064 * for proprietary functionality or for external specifications that are not 065 * considered stable or mature enough to be guaranteed to work in an 066 * interoperable way with other types of LDAP servers. 067 * </BLOCKQUOTE> 068 */ 069@NotMutable() 070@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 071public final class InteractiveTransactionAbortedExtendedResult 072 extends ExtendedResult 073{ 074 /** 075 * The OID (1.3.6.1.4.1.30221.2.6.5) for the interactive transaction aborted 076 * extended result. 077 */ 078 @NotNull public static final String 079 INTERACTIVE_TRANSACTION_ABORTED_RESULT_OID = 080 "1.3.6.1.4.1.30221.2.6.5"; 081 082 083 084 /** 085 * The serial version UID for this serializable class. 086 */ 087 private static final long serialVersionUID = 296814913448182605L; 088 089 090 091 /** 092 * Creates a new instance of this interactive transaction aborted extended 093 * result from the provided generic extended result. 094 * 095 * @param extendedResult The extended result to use to create this 096 * interactive transaction aborted extended result. 097 */ 098 public InteractiveTransactionAbortedExtendedResult( 099 @NotNull final ExtendedResult extendedResult) 100 { 101 super(extendedResult); 102 } 103 104 105 106 /** 107 * Creates a new instance of this interactive transaction aborted extended 108 * result from the provided information. 109 * 110 * @param messageID The message ID for the LDAP message that is 111 * associated with this LDAP result. 112 * @param resultCode The result code from the response. 113 * @param diagnosticMessage The diagnostic message from the response, if 114 * available. 115 * @param matchedDN The matched DN from the response, if available. 116 * @param referralURLs The set of referral URLs from the response, if 117 * available. 118 * @param responseControls The set of controls from the response, if 119 * available. 120 */ 121 public InteractiveTransactionAbortedExtendedResult( 122 final int messageID, @NotNull final ResultCode resultCode, 123 @Nullable final String diagnosticMessage, 124 @Nullable final String matchedDN, 125 @Nullable final String[] referralURLs, 126 @Nullable final Control[] responseControls) 127 { 128 super(messageID, resultCode, diagnosticMessage, matchedDN, referralURLs, 129 INTERACTIVE_TRANSACTION_ABORTED_RESULT_OID, null, responseControls); 130 } 131 132 133 134 /** 135 * {@inheritDoc} 136 */ 137 @Override() 138 @NotNull() 139 public String getExtendedResultName() 140 { 141 return INFO_EXTENDED_RESULT_NAME_INTERACTIVE_TXN_ABORTED.get(); 142 } 143 144 145 146 /** 147 * Appends a string representation of this extended result to the provided 148 * buffer. 149 * 150 * @param buffer The buffer to which a string representation of this 151 * extended result will be appended. 152 */ 153 @Override() 154 public void toString(@NotNull final StringBuilder buffer) 155 { 156 buffer.append("InteractiveTransactionAbortedExtendedResult(resultCode="); 157 buffer.append(getResultCode()); 158 159 final int messageID = getMessageID(); 160 if (messageID >= 0) 161 { 162 buffer.append(", messageID="); 163 buffer.append(messageID); 164 } 165 166 final String diagnosticMessage = getDiagnosticMessage(); 167 if (diagnosticMessage != null) 168 { 169 buffer.append(", diagnosticMessage='"); 170 buffer.append(diagnosticMessage); 171 buffer.append('\''); 172 } 173 174 final String matchedDN = getMatchedDN(); 175 if (matchedDN != null) 176 { 177 buffer.append(", matchedDN='"); 178 buffer.append(matchedDN); 179 buffer.append('\''); 180 } 181 182 final String[] referralURLs = getReferralURLs(); 183 if (referralURLs.length > 0) 184 { 185 buffer.append(", referralURLs={"); 186 for (int i=0; i < referralURLs.length; i++) 187 { 188 if (i > 0) 189 { 190 buffer.append(", "); 191 } 192 193 buffer.append('\''); 194 buffer.append(referralURLs[i]); 195 buffer.append('\''); 196 } 197 buffer.append('}'); 198 } 199 200 buffer.append(", oid="); 201 buffer.append(INTERACTIVE_TRANSACTION_ABORTED_RESULT_OID); 202 203 final Control[] responseControls = getResponseControls(); 204 if (responseControls.length > 0) 205 { 206 buffer.append(", responseControls={"); 207 for (int i=0; i < responseControls.length; i++) 208 { 209 if (i > 0) 210 { 211 buffer.append(", "); 212 } 213 214 buffer.append(responseControls[i]); 215 } 216 buffer.append('}'); 217 } 218 219 buffer.append(')'); 220 } 221}