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