001 /*
002 * Copyright 2010-2013 UnboundID Corp.
003 * All Rights Reserved.
004 */
005 /*
006 * Copyright (C) 2010-2013 UnboundID Corp.
007 *
008 * This program is free software; you can redistribute it and/or modify
009 * it under the terms of the GNU General Public License (GPLv2 only)
010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
011 * as published by the Free Software Foundation.
012 *
013 * This program is distributed in the hope that it will be useful,
014 * but WITHOUT ANY WARRANTY; without even the implied warranty of
015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016 * GNU General Public License for more details.
017 *
018 * You should have received a copy of the GNU General Public License
019 * along with this program; if not, see <http://www.gnu.org/licenses>.
020 */
021 package com.unboundid.ldap.sdk.controls;
022
023
024
025 /**
026 * This enum defines the modes which may be used with the content
027 * synchronization request control. See the documentation for the
028 * {@link ContentSyncRequestControl} class for more information about using the
029 * content synchronization operation.
030 */
031 public enum ContentSyncRequestMode
032 {
033 /**
034 * Indicates that the client only wishes to retrieve information about entries
035 * which have changed up to this point.
036 */
037 REFRESH_ONLY(1),
038
039
040
041 /**
042 * Indicates that the client wishes to retrieve information about entries
043 * which have changed up to this point, and also to be notified of any
044 * additional matching changes in the future.
045 */
046 REFRESH_AND_PERSIST(3);
047
048
049
050 // The integer value of this request mode.
051 private final int intValue;
052
053
054
055 /**
056 * Creates a new content synchronization request mode with the specified
057 * integer value.
058 *
059 * @param intValue The integer value for this request mode.
060 */
061 private ContentSyncRequestMode(final int intValue)
062 {
063 this.intValue = intValue;
064 }
065
066
067
068 /**
069 * Retrieves the integer value for this request mode.
070 *
071 * @return The integer value for this request mode.
072 */
073 public int intValue()
074 {
075 return intValue;
076 }
077
078
079
080 /**
081 * Retrieves the content synchronization request mode with the specified
082 * integer value.
083 *
084 * @param intValue The integer value for which to retrieve the corresponding
085 * request mode.
086 *
087 * @return The content synchronization mode with the specified integer value,
088 * or {@code null} if the given value does not correspond with any
089 * defined mode.
090 */
091 public static ContentSyncRequestMode valueOf(final int intValue)
092 {
093 if (intValue == REFRESH_ONLY.intValue())
094 {
095 return REFRESH_ONLY;
096 }
097 else if (intValue == REFRESH_AND_PERSIST.intValue())
098 {
099 return REFRESH_AND_PERSIST;
100 }
101 else
102 {
103 return null;
104 }
105 }
106 }