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 2009 Sun Microsystems, Inc.
015 * Portions copyright 2012 ForgeRock AS.
016 */
017
018package org.forgerock.opendj.ldap.requests;
019
020import java.util.Collection;
021import java.util.List;
022
023import org.forgerock.opendj.ldap.Attribute;
024import org.forgerock.opendj.ldap.AttributeDescription;
025import org.forgerock.opendj.ldap.ByteString;
026import org.forgerock.opendj.ldap.DN;
027import org.forgerock.opendj.ldap.DecodeException;
028import org.forgerock.opendj.ldap.DecodeOptions;
029import org.forgerock.opendj.ldap.Entry;
030import org.forgerock.opendj.ldap.controls.Control;
031import org.forgerock.opendj.ldap.controls.ControlDecoder;
032import org.forgerock.opendj.ldif.ChangeRecord;
033import org.forgerock.opendj.ldif.ChangeRecordVisitor;
034
035/**
036 * The Add operation allows a client to request the addition of an entry into
037 * the Directory.
038 * <p>
039 * The RDN attribute(s) may or may not be included in the Add request.
040 * NO-USER-MODIFICATION attributes such as the {@code createTimestamp} or
041 * {@code creatorsName} attributes must not be included, since the server
042 * maintains these automatically.
043 */
044public interface AddRequest extends Request, ChangeRecord, Entry {
045
046    @Override
047    <R, P> R accept(ChangeRecordVisitor<R, P> v, P p);
048
049    @Override
050    boolean addAttribute(Attribute attribute);
051
052    @Override
053    boolean addAttribute(Attribute attribute, Collection<? super ByteString> duplicateValues);
054
055    @Override
056    AddRequest addAttribute(String attributeDescription, Object... values);
057
058    @Override
059    AddRequest addControl(Control control);
060
061    @Override
062    AddRequest clearAttributes();
063
064    @Override
065    boolean containsAttribute(Attribute attribute, Collection<? super ByteString> missingValues);
066
067    @Override
068    boolean containsAttribute(String attributeDescription, Object... values);
069
070    @Override
071    Iterable<Attribute> getAllAttributes();
072
073    @Override
074    Iterable<Attribute> getAllAttributes(AttributeDescription attributeDescription);
075
076    @Override
077    Iterable<Attribute> getAllAttributes(String attributeDescription);
078
079    @Override
080    Attribute getAttribute(AttributeDescription attributeDescription);
081
082    @Override
083    Attribute getAttribute(String attributeDescription);
084
085    @Override
086    int getAttributeCount();
087
088    @Override
089    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
090            throws DecodeException;
091
092    @Override
093    List<Control> getControls();
094
095    @Override
096    DN getName();
097
098    @Override
099    boolean removeAttribute(Attribute attribute, Collection<? super ByteString> missingValues);
100
101    @Override
102    boolean removeAttribute(AttributeDescription attributeDescription);
103
104    @Override
105    AddRequest removeAttribute(String attributeDescription, Object... values);
106
107    @Override
108    boolean replaceAttribute(Attribute attribute);
109
110    @Override
111    AddRequest replaceAttribute(String attributeDescription, Object... values);
112
113    @Override
114    AddRequest setName(DN dn);
115
116    @Override
117    AddRequest setName(String dn);
118
119}