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