001/*
002 * Copyright 2015-2020 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright 2015-2020 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-2020 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.StaticUtils;
041
042
043
044/**
045 * This enum defines a set of change type values that may be used in conjunction
046 * with the set notification destination extended request.
047 * <BR>
048 * <BLOCKQUOTE>
049 *   <B>NOTE:</B>  This class, and other classes within the
050 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
051 *   supported for use against Ping Identity, UnboundID, and
052 *   Nokia/Alcatel-Lucent 8661 server products.  These classes provide support
053 *   for proprietary functionality or for external specifications that are not
054 *   considered stable or mature enough to be guaranteed to work in an
055 *   interoperable way with other types of LDAP servers.
056 * </BLOCKQUOTE>
057 */
058public enum SetNotificationDestinationChangeType
059{
060  /**
061   * Indicates that the complete set of destination details should be replaced.
062   */
063  REPLACE(0),
064
065
066
067  /**
068   * Indicates that the provided destination details should be added to the
069   * existing set.
070   */
071  ADD(1),
072
073
074
075  /**
076   * Indicates tht the specified destination details should be removed from the
077   * notification destination.
078   */
079  DELETE(2);
080
081
082
083  // The integer value for this change type.
084  private final int intValue;
085
086
087
088  /**
089   * Creates a new set notification destination change type with the provided
090   * information.
091   *
092   * @param  intValue  The integer value for this change type.
093   */
094  SetNotificationDestinationChangeType(final int intValue)
095  {
096    this.intValue = intValue;
097  }
098
099
100
101  /**
102   * Retrieves the integer value for this set notification destination change
103   * type.
104   *
105   * @return  The integer value for this set notification destination change
106   *          type.
107   */
108  public int intValue()
109  {
110    return intValue;
111  }
112
113
114
115  /**
116   * Retrieves the set notification destination change type with the specified
117   * integer value.
118   *
119   * @param  intValue  The integer value for the change type to retrieve.
120   *
121   * @return  The requested change type, or {@code null} if there is no change
122   *          type with the specified integer value.
123   */
124  public static SetNotificationDestinationChangeType valueOf(final int intValue)
125  {
126    for (final SetNotificationDestinationChangeType t : values())
127    {
128      if (t.intValue == intValue)
129      {
130        return t;
131      }
132    }
133
134    return null;
135  }
136
137
138
139  /**
140   * Retrieves the set notification destination change type with the specified
141   * name.
142   *
143   * @param  name  The name of the set notification destination change type to
144   *               retrieve.  It must not be {@code null}.
145   *
146   * @return  The requested set notification destination change type, or
147   *          {@code null} if no such type is defined.
148   */
149  public static SetNotificationDestinationChangeType forName(final String name)
150  {
151    switch (StaticUtils.toLowerCase(name))
152    {
153      case "replace":
154        return REPLACE;
155      case "add":
156        return ADD;
157      case "delete":
158        return DELETE;
159      default:
160        return null;
161    }
162  }
163}