001/*
002 * Copyright 2015-2024 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright 2015-2024 Ping Identity Corporation
007 *
008 * Licensed under the Apache License, Version 2.0 (the "License");
009 * you may not use this file except in compliance with the License.
010 * You may obtain a copy of the License at
011 *
012 *    http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing, software
015 * distributed under the License is distributed on an "AS IS" BASIS,
016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017 * See the License for the specific language governing permissions and
018 * limitations under the License.
019 */
020/*
021 * Copyright (C) 2015-2024 Ping Identity Corporation
022 *
023 * This program is free software; you can redistribute it and/or modify
024 * it under the terms of the GNU General Public License (GPLv2 only)
025 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
026 * as published by the Free Software Foundation.
027 *
028 * This program is distributed in the hope that it will be useful,
029 * but WITHOUT ANY WARRANTY; without even the implied warranty of
030 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
031 * GNU General Public License for more details.
032 *
033 * You should have received a copy of the GNU General Public License
034 * along with this program; if not, see <http://www.gnu.org/licenses>.
035 */
036package com.unboundid.ldap.sdk.unboundidds.extensions;
037
038
039
040import com.unboundid.util.NotNull;
041import com.unboundid.util.Nullable;
042import com.unboundid.util.StaticUtils;
043
044
045
046/**
047 * This enum defines a set of change type values that may be used in conjunction
048 * with the set notification destination extended request.
049 * <BR>
050 * <BLOCKQUOTE>
051 *   <B>NOTE:</B>  This class, and other classes within the
052 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
053 *   supported for use against Ping Identity, UnboundID, and
054 *   Nokia/Alcatel-Lucent 8661 server products.  These classes provide support
055 *   for proprietary functionality or for external specifications that are not
056 *   considered stable or mature enough to be guaranteed to work in an
057 *   interoperable way with other types of LDAP servers.
058 * </BLOCKQUOTE>
059 */
060public enum SetNotificationDestinationChangeType
061{
062  /**
063   * Indicates that the complete set of destination details should be replaced.
064   */
065  REPLACE(0),
066
067
068
069  /**
070   * Indicates that the provided destination details should be added to the
071   * existing set.
072   */
073  ADD(1),
074
075
076
077  /**
078   * Indicates tht the specified destination details should be removed from the
079   * notification destination.
080   */
081  DELETE(2);
082
083
084
085  // The integer value for this change type.
086  private final int intValue;
087
088
089
090  /**
091   * Creates a new set notification destination change type with the provided
092   * information.
093   *
094   * @param  intValue  The integer value for this change type.
095   */
096  SetNotificationDestinationChangeType(final int intValue)
097  {
098    this.intValue = intValue;
099  }
100
101
102
103  /**
104   * Retrieves the integer value for this set notification destination change
105   * type.
106   *
107   * @return  The integer value for this set notification destination change
108   *          type.
109   */
110  public int intValue()
111  {
112    return intValue;
113  }
114
115
116
117  /**
118   * Retrieves the set notification destination change type with the specified
119   * integer value.
120   *
121   * @param  intValue  The integer value for the change type to retrieve.
122   *
123   * @return  The requested change type, or {@code null} if there is no change
124   *          type with the specified integer value.
125   */
126  @Nullable()
127  public static SetNotificationDestinationChangeType valueOf(final int intValue)
128  {
129    for (final SetNotificationDestinationChangeType t : values())
130    {
131      if (t.intValue == intValue)
132      {
133        return t;
134      }
135    }
136
137    return null;
138  }
139
140
141
142  /**
143   * Retrieves the set notification destination change type with the specified
144   * name.
145   *
146   * @param  name  The name of the set notification destination change type to
147   *               retrieve.  It must not be {@code null}.
148   *
149   * @return  The requested set notification destination change type, or
150   *          {@code null} if no such type is defined.
151   */
152  @Nullable()
153  public static SetNotificationDestinationChangeType forName(
154                     @NotNull final String name)
155  {
156    switch (StaticUtils.toLowerCase(name))
157    {
158      case "replace":
159        return REPLACE;
160      case "add":
161        return ADD;
162      case "delete":
163        return DELETE;
164      default:
165        return null;
166    }
167  }
168}