001/*
002 * Copyright 2009-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.logs;
022
023
024
025import com.unboundid.util.NotExtensible;
026import com.unboundid.util.NotMutable;
027import com.unboundid.util.ThreadSafety;
028import com.unboundid.util.ThreadSafetyLevel;
029
030
031
032/**
033 * This class provides a data structure that holds information about a log
034 * message that may appear in the Directory Server access log about a modify DN
035 * request received from a client.
036 * <BR>
037 * <BLOCKQUOTE>
038 *   <B>NOTE:</B>  This class, and other classes within the
039 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
040 *   supported for use against Ping Identity, UnboundID, and
041 *   Nokia/Alcatel-Lucent 8661 server products.  These classes provide support
042 *   for proprietary functionality or for external specifications that are not
043 *   considered stable or mature enough to be guaranteed to work in an
044 *   interoperable way with other types of LDAP servers.
045 * </BLOCKQUOTE>
046 */
047@NotExtensible()
048@NotMutable()
049@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
050public class ModifyDNRequestAccessLogMessage
051       extends OperationRequestAccessLogMessage
052{
053  /**
054   * The serial version UID for this serializable class.
055   */
056  private static final long serialVersionUID = -1968625384801993253L;
057
058
059
060  // Indicates whether to delete the old RDN value(s).
061  private final Boolean deleteOldRDN;
062
063  // The DN of the entry to rename.
064  private final String dn;
065
066  // The new RDN to use for the entry.
067  private final String newRDN;
068
069  // The new superior DN for the entry.
070  private final String newSuperiorDN;
071
072
073
074  /**
075   * Creates a new modify DN request access log message from the provided
076   * message string.
077   *
078   * @param  s  The string to be parsed as a modify DN request access log
079   *            message.
080   *
081   * @throws  LogException  If the provided string cannot be parsed as a valid
082   *                        log message.
083   */
084  public ModifyDNRequestAccessLogMessage(final String s)
085         throws LogException
086  {
087    this(new LogMessage(s));
088  }
089
090
091
092  /**
093   * Creates a new modify DN request access log message from the provided log
094   * message.
095   *
096   * @param  m  The log message to be parsed as a modify DN request access log
097   *            message.
098   */
099  public ModifyDNRequestAccessLogMessage(final LogMessage m)
100  {
101    super(m);
102
103    dn            = getNamedValue("dn");
104    newRDN        = getNamedValue("newRDN");
105    deleteOldRDN  = getNamedValueAsBoolean("deleteOldRDN");
106    newSuperiorDN = getNamedValue("newSuperior");
107  }
108
109
110
111  /**
112   * Retrieves the DN of the entry to rename.
113   *
114   * @return  The DN of the entry to rename, or {@code null} if it is not
115   *          included in the log message.
116   */
117  public final String getDN()
118  {
119    return dn;
120  }
121
122
123
124  /**
125   * Retrieves the new RDN to use for the entry.
126   *
127   * @return  The new RDN to use for the entry, or {@code null} if it is not
128   *          included in the log message.
129   */
130  public final String getNewRDN()
131  {
132    return newRDN;
133  }
134
135
136
137  /**
138   * Indicates whether the old RDN value(s) should be removed from the entry.
139   *
140   * @return  {@code Boolean.TRUE} if the old RDN value(s) should be removed
141   *          from the entry, {@code Boolean.FALSE} if the old RDN value(s)
142   *          should be kept in the entry, or {@code null} if it is not included
143   *          in the log message.
144   */
145  public final Boolean deleteOldRDN()
146  {
147    return deleteOldRDN;
148  }
149
150
151
152  /**
153   * Retrieves the new superior DN to use for the entry.
154   *
155   * @return  The new superior DN to use for the entry, or {@code null} if it is
156   *          not included in the log message.
157   */
158  public final String getNewSuperiorDN()
159  {
160    return newSuperiorDN;
161  }
162
163
164
165  /**
166   * {@inheritDoc}
167   */
168  @Override()
169  public final AccessLogOperationType getOperationType()
170  {
171    return AccessLogOperationType.MODDN;
172  }
173}