001/* 002 * Copyright 2012-2024 Ping Identity Corporation 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright 2012-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) 2012-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 the set of possible values for the element of a 048 * multi-update result which indicates whether any updates were applied to 049 * server data. 050 * <BR> 051 * <BLOCKQUOTE> 052 * <B>NOTE:</B> This class, and other classes within the 053 * {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only 054 * supported for use against Ping Identity, UnboundID, and 055 * Nokia/Alcatel-Lucent 8661 server products. These classes provide support 056 * for proprietary functionality or for external specifications that are not 057 * considered stable or mature enough to be guaranteed to work in an 058 * interoperable way with other types of LDAP servers. 059 * </BLOCKQUOTE> 060 * 061 * @see MultiUpdateExtendedResult 062 */ 063public enum MultiUpdateChangesApplied 064{ 065 /** 066 * Indicates that none of the changes contained in the multi-update request 067 * were applied to the server. 068 */ 069 NONE(0), 070 071 072 073 /** 074 * Indicates that all of the changes contained in the multi-update request 075 * were applied to the server. 076 */ 077 ALL(1), 078 079 080 081 /** 082 * Indicates that one or more changes from the multi-update request were 083 * applied, but at least one failure was also encountered. 084 */ 085 PARTIAL(2); 086 087 088 089 // The integer value associated with this changes applied value. 090 private final int intValue; 091 092 093 094 /** 095 * Creates a new multi-update changes applied value with the provided integer 096 * representation. 097 * 098 * @param intValue The integer value associated with this changes applied 099 * value. 100 */ 101 MultiUpdateChangesApplied(final int intValue) 102 { 103 this.intValue = intValue; 104 } 105 106 107 108 /** 109 * Retrieves the integer value associated with this changes applied value. 110 * 111 * @return The integer value associated with this changes applied value. 112 */ 113 public int intValue() 114 { 115 return intValue; 116 } 117 118 119 120 /** 121 * Retrieves the multi-update changes applied value with the specified integer 122 * value. 123 * 124 * @param intValue The integer value for the changes applied value to 125 * retrieve. 126 * 127 * @return The multi-update changes applied value with the specified integer 128 * value, or {@code null} if there is no changes applied value with 129 * the specified integer value. 130 */ 131 @Nullable() 132 public static MultiUpdateChangesApplied valueOf(final int intValue) 133 { 134 for (final MultiUpdateChangesApplied v : values()) 135 { 136 if (intValue == v.intValue) 137 { 138 return v; 139 } 140 } 141 142 return null; 143 } 144 145 146 147 /** 148 * Retrieves the multi-update changes applied value with the specified name. 149 * 150 * @param name The name of the multi-update changes applied value to 151 * retrieve. It must not be {@code null}. 152 * 153 * @return The requested multi-update changes applied value, or {@code null} 154 * if no such value is defined. 155 */ 156 @Nullable() 157 public static MultiUpdateChangesApplied forName(@NotNull final String name) 158 { 159 switch (StaticUtils.toLowerCase(name)) 160 { 161 case "none": 162 return NONE; 163 case "all": 164 return ALL; 165 case "partial": 166 return PARTIAL; 167 default: 168 return null; 169 } 170 } 171}