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