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 029 030 031import java.util.List; 032import java.util.Map; 033 034import org.opends.server.types.Attribute; 035import org.opends.server.types.AttributeType; 036import org.forgerock.opendj.ldap.ByteString; 037import org.opends.server.types.DN; 038import org.opends.server.types.Entry; 039import org.opends.server.types.ObjectClass; 040import org.opends.server.types.RawAttribute; 041 042 043 044/** 045 * This class defines a set of methods that are available for use by 046 * pre-operation plugins for add operations. Note that this interface 047 * is intended only to define an API for use by plugins and is not 048 * intended to be implemented by any custom classes. 049 */ 050@org.opends.server.types.PublicAPI( 051 stability=org.opends.server.types.StabilityLevel.UNCOMMITTED, 052 mayInstantiate=false, 053 mayExtend=false, 054 mayInvoke=true) 055public interface PreOperationAddOperation 056 extends PreOperationOperation 057{ 058 /** 059 * Retrieves the DN of the entry to add in a raw, unparsed form as 060 * it was included in the request. This may or may not actually 061 * contain a valid DN, since no validation will have been performed 062 * on it. 063 * 064 * @return The DN of the entry in a raw, unparsed form. 065 */ 066 ByteString getRawEntryDN(); 067 068 069 070 /** 071 * Retrieves the set of attributes in their raw, unparsed form as 072 * read from the client request. Some of these attributes may be 073 * invalid as no validation will have been performed on them. The 074 * returned list must not be altered by the caller. 075 * 076 * @return The set of attributes in their raw, unparsed form as 077 * read from the client request. 078 */ 079 List<RawAttribute> getRawAttributes(); 080 081 082 083 /** 084 * Retrieves the DN of the entry to add. 085 * 086 * @return The DN of the entry to add. 087 */ 088 DN getEntryDN(); 089 090 091 092 /** 093 * Retrieves the set of processed objectclasses for the entry to 094 * add. The contents of the returned map must not be altered by the 095 * caller. 096 * 097 * @return The set of processed objectclasses for the entry to add. 098 */ 099 Map<ObjectClass,String> getObjectClasses(); 100 101 102 103 /** 104 * Adds the provided objectclass to the entry to add. Note that 105 * pre-operation plugin processing is invoked after access control 106 * and schema validation, so plugins should be careful to only make 107 * changes that will not violate either schema or access control 108 * rules. 109 * 110 * @param objectClass The objectclass to add to the entry. 111 * @param name The name to use for the objectclass. 112 */ 113 void addObjectClass(ObjectClass objectClass, String name); 114 115 116 117 /** 118 * Removes the provided objectclass from the entry to add. Note 119 * that pre-operation plugin processing is invoked after access 120 * control and schema validation, so plugins should be careful to 121 * only make changes that will not violate either schema or access 122 * control rules. 123 * 124 * @param objectClass The objectclass to remove from the entry. 125 */ 126 void removeObjectClass(ObjectClass objectClass); 127 128 129 130 /** 131 * Retrieves the set of processed user attributes for the entry to 132 * add. The contents of the returned map must not be altered by the 133 * caller. 134 * 135 * @return The set of processed user attributes for the entry to 136 * add. 137 */ 138 Map<AttributeType,List<Attribute>> getUserAttributes(); 139 140 141 142 /** 143 * Retrieves the set of processed operational attributes for the 144 * entry to add. The contents of the returned map must not be 145 * altered by the caller. 146 * 147 * @return The set of processed operational attributes for the 148 * entry to add. 149 */ 150 Map<AttributeType, List<Attribute>> getOperationalAttributes(); 151 152 153 154 /** 155 * Sets the specified attribute in the entry to add, overwriting any 156 * existing attribute of the specified type if necessary. Note that 157 * pre-operation plugin processing is invoked after access control 158 * and schema validation, so plugins should be careful to only make 159 * changes that will not violate either schema or access control 160 * rules. 161 * 162 * @param attributeType The attribute type for the attribute. 163 * @param attributeList The attribute list for the provided 164 * attribute type. 165 */ 166 void setAttribute(AttributeType attributeType, List<Attribute> attributeList); 167 168 169 170 /** 171 * Removes the specified attribute from the entry to add. Note that 172 * pre-operation processing is invoked after access control and 173 * schema validation, so plugins should be careful to only make 174 * changes that will not violate either schema or access control 175 * rules. 176 * 177 * @param attributeType The attribute tyep for the attribute to 178 * remove. 179 */ 180 void removeAttribute(AttributeType attributeType); 181 182 183 184 /** 185 * Retrieves the entry to be added to the server. The contents of 186 * the returned entry must not be altered by the caller. 187 * 188 * @return The entry to be added to the server. 189 */ 190 Entry getEntryToAdd(); 191} 192