001/* 002 * Copyright 2022-2024 Ping Identity Corporation 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright 2022-2024 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) 2022-2024 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.logs.v2.json; 037 038 039 040import java.util.List; 041import java.util.Set; 042 043import com.unboundid.ldap.sdk.ResultCode; 044import com.unboundid.ldap.sdk.unboundidds.logs.AccessLogMessageType; 045import com.unboundid.ldap.sdk.unboundidds.logs.LogException; 046import com.unboundid.ldap.sdk.unboundidds.logs.v2.SearchResultAccessLogMessage; 047import com.unboundid.util.NotMutable; 048import com.unboundid.util.NotNull; 049import com.unboundid.util.Nullable; 050import com.unboundid.util.ThreadSafety; 051import com.unboundid.util.ThreadSafetyLevel; 052import com.unboundid.util.json.JSONObject; 053 054 055 056/** 057 * This class provides a data structure that holds information about a 058 * JSON-formatted search result access log message. 059 * <BR> 060 * <BLOCKQUOTE> 061 * <B>NOTE:</B> This class, and other classes within the 062 * {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only 063 * supported for use against Ping Identity, UnboundID, and 064 * Nokia/Alcatel-Lucent 8661 server products. These classes provide support 065 * for proprietary functionality or for external specifications that are not 066 * considered stable or mature enough to be guaranteed to work in an 067 * interoperable way with other types of LDAP servers. 068 * </BLOCKQUOTE> 069 */ 070@NotMutable() 071@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 072public final class JSONSearchResultAccessLogMessage 073 extends JSONSearchRequestAccessLogMessage 074 implements SearchResultAccessLogMessage 075{ 076 /** 077 * The serial version UID for this serializable class. 078 */ 079 private static final long serialVersionUID = 1765439451592454553L; 080 081 082 083 // Indicates whether the search is unindexed. 084 @Nullable private final Boolean isUnindexed; 085 086 // The forward helper for this access log message. 087 @NotNull private final JSONForwardAccessLogMessageHelper forwardHelper; 088 089 // The result helper for this access log message. 090 @NotNull private final JSONResultAccessLogMessageHelper resultHelper; 091 092 // The number of entries returned for this access log message. 093 @Nullable private final Long entriesReturned; 094 095 096 097 /** 098 * Creates a new JSON search result access log message from the provided JSON 099 * object. 100 * 101 * @param jsonObject The JSON object that contains an encoded representation 102 * of this log message. It must not be {@code null}. 103 * 104 * @throws LogException If the provided JSON object cannot be parsed as a 105 * valid log message. 106 */ 107 public JSONSearchResultAccessLogMessage(@NotNull final JSONObject jsonObject) 108 throws LogException 109 { 110 super(jsonObject); 111 112 entriesReturned = 113 getLongNoThrow(JSONFormattedAccessLogFields.SEARCH_ENTRIES_RETURNED); 114 115 final Boolean isIndexed = getBooleanNoThrow( 116 JSONFormattedAccessLogFields.SEARCH_INDEXED); 117 if (isIndexed == null) 118 { 119 isUnindexed = null; 120 } 121 else 122 { 123 isUnindexed = ! isIndexed; 124 } 125 126 resultHelper = new JSONResultAccessLogMessageHelper(this); 127 forwardHelper = new JSONForwardAccessLogMessageHelper(this); 128 } 129 130 131 132 /** 133 * {@inheritDoc} 134 */ 135 @Override() 136 @NotNull() 137 public AccessLogMessageType getMessageType() 138 { 139 return AccessLogMessageType.RESULT; 140 } 141 142 143 144 /** 145 * {@inheritDoc} 146 */ 147 @Override() 148 @Nullable() 149 public ResultCode getResultCode() 150 { 151 return resultHelper.getResultCode(); 152 } 153 154 155 156 /** 157 * {@inheritDoc} 158 */ 159 @Override() 160 @Nullable() 161 public String getDiagnosticMessage() 162 { 163 return resultHelper.getDiagnosticMessage(); 164 } 165 166 167 168 /** 169 * {@inheritDoc} 170 */ 171 @Override() 172 @Nullable() 173 public String getAdditionalInformation() 174 { 175 return resultHelper.getAdditionalInformation(); 176 } 177 178 179 180 /** 181 * {@inheritDoc} 182 */ 183 @Override() 184 @Nullable() 185 public String getMatchedDN() 186 { 187 return resultHelper.getMatchedDN(); 188 } 189 190 191 192 /** 193 * {@inheritDoc} 194 */ 195 @Override() 196 @NotNull() 197 public List<String> getReferralURLs() 198 { 199 return resultHelper.getReferralURLs(); 200 } 201 202 203 204 /** 205 * {@inheritDoc} 206 */ 207 @Override() 208 @Nullable() 209 public Double getProcessingTimeMillis() 210 { 211 return resultHelper.getProcessingTimeMillis(); 212 } 213 214 215 216 /** 217 * {@inheritDoc} 218 */ 219 @Override() 220 @Nullable() 221 public Double getWorkQueueWaitTimeMillis() 222 { 223 return resultHelper.getWorkQueueWaitTimeMillis(); 224 } 225 226 227 228 /** 229 * {@inheritDoc} 230 */ 231 @Override() 232 @NotNull() 233 public Set<String> getResponseControlOIDs() 234 { 235 return resultHelper.getResponseControlOIDs(); 236 } 237 238 239 240 /** 241 * {@inheritDoc} 242 */ 243 @Override() 244 @Nullable() 245 public Long getIntermediateResponsesReturned() 246 { 247 return resultHelper.getIntermediateResponsesReturned(); 248 } 249 250 251 252 /** 253 * {@inheritDoc} 254 */ 255 @Override() 256 @NotNull() 257 public List<String> getServersAccessed() 258 { 259 return resultHelper.getServersAccessed(); 260 } 261 262 263 264 /** 265 * {@inheritDoc} 266 */ 267 @Override() 268 @Nullable() 269 public Boolean getUncachedDataAccessed() 270 { 271 return resultHelper.getUncachedDataAccessed(); 272 } 273 274 275 276 /** 277 * {@inheritDoc} 278 */ 279 @Override() 280 @NotNull() 281 public Set<String> getUsedPrivileges() 282 { 283 return resultHelper.getUsedPrivileges(); 284 } 285 286 287 288 /** 289 * {@inheritDoc} 290 */ 291 @Override() 292 @NotNull() 293 public Set<String> getPreAuthorizationUsedPrivileges() 294 { 295 return resultHelper.getPreAuthorizationUsedPrivileges(); 296 } 297 298 299 300 /** 301 * {@inheritDoc} 302 */ 303 @Override() 304 @NotNull() 305 public Set<String> getMissingPrivileges() 306 { 307 return resultHelper.getMissingPrivileges(); 308 } 309 310 311 312 /** 313 * {@inheritDoc} 314 */ 315 @Override() 316 @Nullable() 317 public String getAlternateAuthorizationDN() 318 { 319 return resultHelper.getAlternateAuthorizationDN(); 320 } 321 322 323 324 /** 325 * {@inheritDoc} 326 */ 327 @Override() 328 @NotNull() 329 public Set<String> getIndexesWithKeysAccessedNearEntryLimit() 330 { 331 return resultHelper.getIndexesWithKeysAccessedNearEntryLimit(); 332 } 333 334 335 336 /** 337 * {@inheritDoc} 338 */ 339 @Override() 340 @NotNull() 341 public Set<String> getIndexesWithKeysAccessedExceedingEntryLimit() 342 { 343 return resultHelper.getIndexesWithKeysAccessedExceedingEntryLimit(); 344 } 345 346 347 348 /** 349 * Retrieves information about an intermediate client response control 350 * included in the log message. 351 * 352 * @return An intermediate client response control included in the log 353 * message, or {@code null} if no intermediate client response 354 * control is available. 355 */ 356 @Nullable() 357 public JSONIntermediateClientResponseControl 358 getIntermediateClientResponseControl() 359 { 360 return resultHelper.getIntermediateClientResponseControl(); 361 } 362 363 364 365 /** 366 * {@inheritDoc} 367 */ 368 @Override() 369 @Nullable() 370 public String getTargetHost() 371 { 372 return forwardHelper.getTargetHost(); 373 } 374 375 376 377 /** 378 * {@inheritDoc} 379 */ 380 @Override() 381 @Nullable() 382 public Integer getTargetPort() 383 { 384 return forwardHelper.getTargetPort(); 385 } 386 387 388 389 /** 390 * {@inheritDoc} 391 */ 392 @Override() 393 @Nullable() 394 public String getTargetProtocol() 395 { 396 return forwardHelper.getTargetProtocol(); 397 } 398 399 400 401 /** 402 * {@inheritDoc} 403 */ 404 @Override() 405 @Nullable() 406 public Long getEntriesReturned() 407 { 408 return entriesReturned; 409 } 410 411 412 413 /** 414 * {@inheritDoc} 415 */ 416 @Override() 417 @Nullable() 418 public Boolean getUnindexed() 419 { 420 return isUnindexed; 421 } 422}