001/*
002 * Copyright 2022 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright 2022 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 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.CompareResultAccessLogMessage;
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 compare 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 JSONCompareResultAccessLogMessage
073       extends JSONCompareRequestAccessLogMessage
074       implements CompareResultAccessLogMessage
075{
076  /**
077   * The serial version UID for this serializable class.
078   */
079  private static final long serialVersionUID = 1348301787691529988L;
080
081
082
083  // The forward helper for this access log message.
084  @NotNull private final JSONForwardAccessLogMessageHelper forwardHelper;
085
086  // The result helper for this access log message.
087  @NotNull private final JSONResultAccessLogMessageHelper resultHelper;
088
089
090
091  /**
092   * Creates a new JSON compare result access log message from the provided JSON
093   * object.
094   *
095   * @param  jsonObject  The JSON object that contains an encoded representation
096   *                     of this log message.  It must not be {@code null}.
097   *
098   * @throws  LogException  If the provided JSON object cannot be parsed as a
099   *                        valid log message.
100   */
101  public JSONCompareResultAccessLogMessage(@NotNull final JSONObject jsonObject)
102         throws LogException
103  {
104    super(jsonObject);
105
106    resultHelper = new JSONResultAccessLogMessageHelper(this);
107    forwardHelper = new JSONForwardAccessLogMessageHelper(this);
108  }
109
110
111
112  /**
113   * {@inheritDoc}
114   */
115  @Override()
116  @NotNull()
117  public AccessLogMessageType getMessageType()
118  {
119    return AccessLogMessageType.RESULT;
120  }
121
122
123
124  /**
125   * {@inheritDoc}
126   */
127  @Override()
128  @Nullable()
129  public ResultCode getResultCode()
130  {
131    return resultHelper.getResultCode();
132  }
133
134
135
136  /**
137   * {@inheritDoc}
138   */
139  @Override()
140  @Nullable()
141  public String getDiagnosticMessage()
142  {
143    return resultHelper.getDiagnosticMessage();
144  }
145
146
147
148  /**
149   * {@inheritDoc}
150   */
151  @Override()
152  @Nullable()
153  public String getAdditionalInformation()
154  {
155    return resultHelper.getAdditionalInformation();
156  }
157
158
159
160  /**
161   * {@inheritDoc}
162   */
163  @Override()
164  @Nullable()
165  public String getMatchedDN()
166  {
167    return resultHelper.getMatchedDN();
168  }
169
170
171
172  /**
173   * {@inheritDoc}
174   */
175  @Override()
176  @NotNull()
177  public List<String> getReferralURLs()
178  {
179    return resultHelper.getReferralURLs();
180  }
181
182
183
184  /**
185   * {@inheritDoc}
186   */
187  @Override()
188  @Nullable()
189  public Double getProcessingTimeMillis()
190  {
191    return resultHelper.getProcessingTimeMillis();
192  }
193
194
195
196  /**
197   * {@inheritDoc}
198   */
199  @Override()
200  @Nullable()
201  public Double getWorkQueueWaitTimeMillis()
202  {
203    return resultHelper.getWorkQueueWaitTimeMillis();
204  }
205
206
207
208  /**
209   * {@inheritDoc}
210   */
211  @Override()
212  @NotNull()
213  public Set<String> getResponseControlOIDs()
214  {
215    return resultHelper.getResponseControlOIDs();
216  }
217
218
219
220  /**
221   * {@inheritDoc}
222   */
223  @Override()
224  @Nullable()
225  public Long getIntermediateResponsesReturned()
226  {
227    return resultHelper.getIntermediateResponsesReturned();
228  }
229
230
231
232  /**
233   * {@inheritDoc}
234   */
235  @Override()
236  @NotNull()
237  public List<String> getServersAccessed()
238  {
239    return resultHelper.getServersAccessed();
240  }
241
242
243
244  /**
245   * {@inheritDoc}
246   */
247  @Override()
248  @Nullable()
249  public Boolean getUncachedDataAccessed()
250  {
251    return resultHelper.getUncachedDataAccessed();
252  }
253
254
255
256  /**
257   * {@inheritDoc}
258   */
259  @Override()
260  @NotNull()
261  public Set<String> getUsedPrivileges()
262  {
263    return resultHelper.getUsedPrivileges();
264  }
265
266
267
268  /**
269   * {@inheritDoc}
270   */
271  @Override()
272  @NotNull()
273  public Set<String> getPreAuthorizationUsedPrivileges()
274  {
275    return resultHelper.getPreAuthorizationUsedPrivileges();
276  }
277
278
279
280  /**
281   * {@inheritDoc}
282   */
283  @Override()
284  @NotNull()
285  public Set<String> getMissingPrivileges()
286  {
287    return resultHelper.getMissingPrivileges();
288  }
289
290
291
292  /**
293   * {@inheritDoc}
294   */
295  @Override()
296  @Nullable()
297  public String getAlternateAuthorizationDN()
298  {
299    return resultHelper.getAlternateAuthorizationDN();
300  }
301
302
303
304  /**
305   * Retrieves information about an intermediate client response control
306   * included in the log message.
307   *
308   * @return  An intermediate client response control included in the log
309   *          message, or {@code null} if no intermediate client response
310   *          control is available.
311   */
312  @Nullable()
313  public JSONIntermediateClientResponseControl
314              getIntermediateClientResponseControl()
315  {
316    return resultHelper.getIntermediateClientResponseControl();
317  }
318
319
320
321  /**
322   * {@inheritDoc}
323   */
324  @Override()
325  @Nullable()
326  public String getTargetHost()
327  {
328    return forwardHelper.getTargetHost();
329  }
330
331
332
333  /**
334   * {@inheritDoc}
335   */
336  @Override()
337  @Nullable()
338  public Integer getTargetPort()
339  {
340    return forwardHelper.getTargetPort();
341  }
342
343
344
345  /**
346   * {@inheritDoc}
347   */
348  @Override()
349  @Nullable()
350  public String getTargetProtocol()
351  {
352    return forwardHelper.getTargetProtocol();
353  }
354}