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 2010 Sun Microsystems, Inc.
015 * Portions copyright 2012-2015 ForgeRock AS.
016 */
017
018package org.forgerock.opendj.ldap.responses;
019
020import java.util.List;
021
022import org.forgerock.opendj.ldap.ByteString;
023import org.forgerock.opendj.ldap.DecodeException;
024import org.forgerock.opendj.ldap.DecodeOptions;
025import org.forgerock.opendj.ldap.ResultCode;
026import org.forgerock.opendj.ldap.controls.Control;
027import org.forgerock.opendj.ldap.controls.ControlDecoder;
028
029/**
030 * A Generic Extended result indicates the final status of an Generic Extended
031 * operation.
032 */
033public interface GenericExtendedResult extends ExtendedResult {
034
035    @Override
036    GenericExtendedResult addControl(Control control);
037
038    @Override
039    GenericExtendedResult addReferralURI(String uri);
040
041    @Override
042    Throwable getCause();
043
044    @Override
045    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
046            throws DecodeException;
047
048    @Override
049    List<Control> getControls();
050
051    @Override
052    String getDiagnosticMessage();
053
054    @Override
055    String getMatchedDN();
056
057    @Override
058    String getOID();
059
060    @Override
061    List<String> getReferralURIs();
062
063    @Override
064    ResultCode getResultCode();
065
066    @Override
067    ByteString getValue();
068
069    @Override
070    boolean hasValue();
071
072    @Override
073    boolean isReferral();
074
075    @Override
076    boolean isSuccess();
077
078    @Override
079    GenericExtendedResult setCause(Throwable cause);
080
081    @Override
082    GenericExtendedResult setDiagnosticMessage(String message);
083
084    @Override
085    GenericExtendedResult setMatchedDN(String dn);
086
087    /**
088     * Sets the numeric OID, if any, associated with this extended result.
089     *
090     * @param oid
091     *            The numeric OID associated with this extended result, or
092     *            {@code null} if there is no value.
093     * @return This generic extended result.
094     * @throws UnsupportedOperationException
095     *             If this generic extended result does not permit the result
096     *             name to be set.
097     */
098    GenericExtendedResult setOID(String oid);
099
100    @Override
101    GenericExtendedResult setResultCode(ResultCode resultCode);
102
103    /**
104     * Sets the value, if any, associated with this extended result. Its format
105     * is defined by the specification of this extended result.
106     * <p>
107     * If {@code value} is not an instance of {@code ByteString} then it will be
108     * converted using the {@link ByteString#valueOfObject(Object)} method.
109     *
110     * @param value
111     *            The value associated with this extended result, or
112     *            {@code null} if there is no value.
113     * @return This generic extended result.
114     * @throws UnsupportedOperationException
115     *             If this generic extended result does not permit the result
116     *             value to be set.
117     */
118    GenericExtendedResult setValue(Object value);
119
120}