001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions Copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2006-2008 Sun Microsystems, Inc.
015 * Portions Copyright 2014-2016 ForgeRock AS.
016 */
017package org.opends.server.types.operation;
018
019import java.util.List;
020
021import org.forgerock.opendj.ldap.ByteString;
022import org.opends.server.types.DirectoryException;
023import org.forgerock.opendj.ldap.DN;
024import org.opends.server.types.Entry;
025import org.opends.server.types.Modification;
026import org.opends.server.types.RawModification;
027
028/**
029 * This class defines a set of methods that are available for use by
030 * pre-operation plugins for modify operations.  Note that this
031 * interface is intended only to define an API for use by plugins and
032 * is not intended to be implemented by any custom classes.
033 */
034@org.opends.server.types.PublicAPI(
035     stability=org.opends.server.types.StabilityLevel.UNCOMMITTED,
036     mayInstantiate=false,
037     mayExtend=false,
038     mayInvoke=true)
039public interface PreOperationModifyOperation
040       extends PreOperationOperation
041{
042  /**
043   * Retrieves the raw, unprocessed entry DN as included in the client
044   * request.  The DN that is returned may or may not be a valid DN,
045   * since no validation will have been performed upon it.
046   *
047   * @return  The raw, unprocessed entry DN as included in the client
048   *          request.
049   */
050  ByteString getRawEntryDN();
051
052
053
054  /**
055   * Retrieves the DN of the entry to modify.
056   *
057   * @return  The DN of the entry to modify.
058   */
059  DN getEntryDN();
060
061
062
063  /**
064   * Retrieves the set of raw, unprocessed modifications as included
065   * in the client request.  Note that this may contain one or more
066   * invalid modifications, as no validation will have been performed
067   * on this information.  The list returned must not be altered by
068   * the caller.
069   *
070   * @return  The set of raw, unprocessed modifications as included
071   *          in the client request.
072   */
073  List<RawModification> getRawModifications();
074
075
076
077  /**
078   * Retrieves the set of modifications for this modify operation.
079   Its contents should not be altered.
080   *
081   * @return  The set of modifications for this modify operation.
082   */
083  List<Modification> getModifications();
084
085
086
087  /**
088   * Adds the provided modification to the set of modifications to
089   * this modify operation.  Note that this will be called after the
090   * schema and access control processing, so the caller must be
091   * careful to avoid making any changes that will violate schema or
092   * access control constraints.
093   *
094   * @param  modification  The modification to add to the set of
095   *                       changes for this modify operation.
096   *
097   * @throws  DirectoryException  If an unexpected problem occurs
098   *                              while applying the modification to
099   *                              the entry.
100   */
101  void addModification(Modification modification) throws DirectoryException;
102
103
104
105  /**
106   * Retrieves the current entry before any modifications are applied.
107   * It should not be modified by the caller.
108   *
109   * @return  The current entry before any modifications are applied.
110   */
111  Entry getCurrentEntry();
112
113
114
115  /**
116   * Retrieves the modified entry that is to be written to the
117   * backend.  This entry should not be modified directly, but should
118   * only be altered through the <CODE>addModification</CODE> method.
119   *
120   * @return  The modified entry that is to be written to the backend.
121   */
122  Entry getModifiedEntry();
123
124
125
126  /**
127   * Retrieves the set of clear-text current passwords for the user,
128   * if available.  This will only be available if the modify
129   * operation contains one or more delete elements that target the
130   * password attribute and provide the values to delete in the clear.
131   * This list should not be altered by the caller.
132   *
133   * @return  The set of clear-text current password values as
134   *          provided in the modify request, or <CODE>null</CODE> if
135   *          there were none.
136   */
137  List<ByteString> getCurrentPasswords();
138
139
140
141  /**
142   * Retrieves the set of clear-text new passwords for the user, if
143   * available.  This will only be available if the modify operation
144   * contains one or more add or replace elements that target the
145   * password attribute and provide the values in the clear.  This
146   * list should not be altered by the caller.
147   *
148   * @return  The set of clear-text new passwords as provided in the
149   *          modify request, or <CODE>null</CODE> if there were none.
150   */
151  List<ByteString> getNewPasswords();
152}
153