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