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
010     * docs/licenses/cddl.txt
011     * or http://www.opensource.org/licenses/cddl1.php.
012     * See the License for the specific language governing permissions
013     * and limitations under the License.
014     *
015     * When distributing Covered Code, include this CDDL HEADER in each
016     * file and include the License file at
017     * docs/licenses/cddl.txt.  If applicable,
018     * add the following below this CDDL HEADER, with the fields enclosed
019     * by brackets "[]" replaced with your own identifying information:
020     *      Portions Copyright [yyyy] [name of copyright owner]
021     *
022     * CDDL HEADER END
023     *
024     *
025     *      Copyright 2010-2012 UnboundID Corp.
026     */
027    package com.unboundid.directory.sdk.ds.types;
028    
029    
030    
031    import java.io.Serializable;
032    
033    import com.unboundid.util.NotMutable;
034    import com.unboundid.util.ThreadSafety;
035    import com.unboundid.util.ThreadSafetyLevel;
036    
037    
038    
039    /**
040     * This class defines a structure which may be used to provide information about
041     * the result of the processing performed by a search reference plugin.
042     */
043    @NotMutable()
044    @ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
045    public final class SearchReferencePluginResult
046           implements Serializable
047    {
048      /**
049       * A predefined result instance that indicates all processing completed
050       * successfully.
051       */
052      public static final SearchReferencePluginResult SUCCESS =
053           new SearchReferencePluginResult(false, true, true, true);
054    
055    
056    
057      /**
058       * The serial version UID for this serializable class.
059       */
060      private static final long serialVersionUID = 2020591749477287500L;
061    
062    
063    
064      // Indicates whether the client connection was terminated by the plugin.
065      private final boolean connectionTerminated;
066    
067      // Indicates whether the server should continue processing other search
068      // reference plugins for the associated reference.
069      private final boolean continuePluginProcessing;
070    
071      // Indicates whether the server should continue processing for the associated
072      // search operation.
073      private final boolean continueSearchProcessing;
074    
075      // Indicates whether the associated reference should be returned to the
076      // client.
077      private final boolean sendReference;
078    
079    
080    
081      /**
082       * Creates a new search reference plugin result with the provided information.
083       *
084       * @param  connectionTerminated      Indicates whether the client connection
085       *                                   was terminated by the plugin.
086       * @param  continuePluginProcessing  Indicates whether to continue processing
087       *                                   other search reference plugins for the
088       *                                   reference.
089       * @param  sendReference             Indicates whether to send the reference
090       *                                   to the client.
091       * @param  continueSearchProcessing  Indicates whether to continue processing
092       *                                   the associated search operation.
093       */
094      public SearchReferencePluginResult(final boolean connectionTerminated,
095                                         final boolean continuePluginProcessing,
096                                         final boolean sendReference,
097                                         final boolean continueSearchProcessing)
098      {
099        this.connectionTerminated     = connectionTerminated;
100        this.continuePluginProcessing = continuePluginProcessing;
101        this.continueSearchProcessing = continueSearchProcessing;
102        this.sendReference            = sendReference;
103      }
104    
105    
106    
107      /**
108       * Indicates whether the client connection was terminated by the plugin.
109       *
110       * @return  {@code true} if the client connection was terminated by the
111       *          plugin, or {@code false} if not.
112       */
113      public boolean connectionTerminated()
114      {
115        return connectionTerminated;
116      }
117    
118    
119    
120      /**
121       * Indicates whether to continue processing other search reference plugins for
122       * the associated search reference.
123       *
124       * @return  {@code true} if the server should continue processing other
125       *          search reference plugins for the associated search reference, or
126       *          {@code false} if not.
127       */
128      public boolean continuePluginProcessing()
129      {
130        return continuePluginProcessing;
131      }
132    
133    
134    
135      /**
136       * Indicates whether to continue processing for the associated search
137       * operation.
138       *
139       * @return  {@code true} if the server should continue processing for the
140       *          associated search operation, or {@code false} if not and the
141       *          search done response should be sent to the client.
142       */
143      public boolean continueSearchProcessing()
144      {
145        return continueSearchProcessing;
146      }
147    
148    
149    
150      /**
151       * Indicates whether the associated reference should be returned to the
152       * client.
153       *
154       * @return  {@code true} if the reference should be returned to the client, or
155       *          {@code false} if the server should exclude the reference from the
156       *          set of search results.
157       */
158      public boolean sendReference()
159      {
160        return sendReference;
161      }
162    
163    
164    
165      /**
166       * Retrieves a string representation of this search reference plugin result.
167       *
168       * @return  A string representation of this search reference plugin result.
169       */
170      @Override()
171      public String toString()
172      {
173        final StringBuilder buffer = new StringBuilder();
174    
175        buffer.append("SearchReferencePluginResult(connectionTerminated=");
176        buffer.append(connectionTerminated);
177        buffer.append(", continuePluginProcessing=");
178        buffer.append(continuePluginProcessing);
179        buffer.append(", sendReference=");
180        buffer.append(sendReference);
181        buffer.append(", continueSearchProcessing=");
182        buffer.append(continueSearchProcessing);
183        buffer.append(')');
184    
185        return buffer.toString();
186      }
187    }