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