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