001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.apache.directory.api.ldap.model.message.controls;
020
021
022import org.apache.directory.api.ldap.model.message.Control;
023
024
025/**
026 * A persistence search object, as defined in https://tools.ietf.org/html/draft-ietf-ldapext-psearch-03
027 * 
028 * <pre>
029 *  PersistentSearch ::= SEQUENCE {
030 *         changeTypes INTEGER,
031 *         changesOnly BOOLEAN,
032 *         returnECs BOOLEAN
033 * }
034
035 * </pre>
036 *
037 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
038 */
039public interface PersistentSearch extends Control
040{
041    /** This control OID */
042    String OID = "2.16.840.1.113730.3.4.3";
043
044    /** Min and Max values for the possible combined change types */
045    int CHANGE_TYPES_MIN = ChangeType.ADD.getValue();
046
047    /** The maximum value for the possible combined changes type */
048    int CHANGE_TYPES_MAX = ChangeType.ADD.getValue()
049        | ChangeType.DELETE.getValue()
050        | ChangeType.MODIFY.getValue()
051        | ChangeType.MODDN.getValue();
052
053
054    /**
055     * Sets the ChangesOnly flag
056     *   
057     * @param changesOnly The ChangesOnly flag
058     */
059    void setChangesOnly( boolean changesOnly );
060
061
062    /**
063     * @return <TT>TRUE</TT> if the changesOnly flag is set
064     */
065    boolean isChangesOnly();
066
067
068    /**
069     * Sets the return entry changes flag
070     * 
071     * @param returnECs the return entry changes flag
072     */
073    void setReturnECs( boolean returnECs );
074
075
076    /**
077     * @return <TT>TRUE</TT> if the return entry changes flag is set
078     */
079    boolean isReturnECs();
080
081
082    /**
083     * Set the changeType value we want to get back ( a combinaison of Add, Delete,
084     * Modify and ModifyDN)
085     *  
086     * @param changeTypes The changeType values (Add, Modify, Delete and ModifyDn)
087     */
088    void setChangeTypes( int changeTypes );
089
090
091    /**
092     * @return The changeTypes value
093     */
094    int getChangeTypes();
095
096
097    /**
098     * For each changeType, tells if the notification is enabled
099     * 
100     * @param changeType The ChnageType we are interested in
101     * @return <tt>TRUE</tt> if the notification is set for this ChangeType
102     */
103    boolean isNotificationEnabled( ChangeType changeType );
104
105
106    /**
107     * Sets the notification for a given changeType 
108     * @param changeType The chnageType we want some notification to be set
109     */
110    void enableNotification( ChangeType changeType );
111
112
113    /**
114     * Unsets the notification for a given changeType 
115     * @param changeType The chnageType we want some notification to be unset
116     */
117    void disableNotification( ChangeType changeType );
118}