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