001/* 002 * Copyright 2012-2020 Ping Identity Corporation 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright 2012-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.controls; 037 038 039 040import com.unboundid.util.StaticUtils; 041import com.unboundid.util.ThreadSafety; 042import com.unboundid.util.ThreadSafetyLevel; 043 044 045 046/** 047 * This enum defines the set of operational update types that may be suppressed 048 * by the suppress operational attribute update request control. 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 */ 060@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 061public enum SuppressType 062{ 063 /** 064 * The value that indicates that last access time updates should be 065 * suppressed. 066 */ 067 LAST_ACCESS_TIME(0), 068 069 070 071 /** 072 * The value that indicates that last login time updates should be suppressed. 073 */ 074 LAST_LOGIN_TIME(1), 075 076 077 078 /** 079 * The value that indicates that last login IP address updates should be 080 * suppressed. 081 */ 082 LAST_LOGIN_IP(2), 083 084 085 086 /** 087 * The value that indicates that lastmod updates (creatorsName, 088 * createTimestamp, modifiersName, modifyTimestamp) should be suppressed. 089 */ 090 LASTMOD(3); 091 092 093 094 // The integer value for this suppress type enum value. 095 private final int intValue; 096 097 098 099 /** 100 * Creates a new suppress type enum value with the provided information. 101 * 102 * @param intValue The integer value for this value, as will be used to 103 * indicate it in the request control. 104 */ 105 SuppressType(final int intValue) 106 { 107 this.intValue = intValue; 108 } 109 110 111 112 /** 113 * Retrieves the integer value for this suppress type value. 114 * 115 * @return The integer value for this suppress type value. 116 */ 117 public int intValue() 118 { 119 return intValue; 120 } 121 122 123 124 /** 125 * Retrieves the suppress type value for the provided integer value. 126 * 127 * @param intValue The integer value for the suppress type value to 128 retrieve. 129 * 130 * @return The suppress type value that corresponds to the provided integer 131 * value, or {@code null} if there is no corresponding suppress type 132 * value. 133 */ 134 public static SuppressType valueOf(final int intValue) 135 { 136 for (final SuppressType t : values()) 137 { 138 if (t.intValue == intValue) 139 { 140 return t; 141 } 142 } 143 144 return null; 145 } 146 147 148 149 /** 150 * Retrieves the suppress type with the specified name. 151 * 152 * @param name The name of the suppress type to retrieve. It must not be 153 * {@code null}. 154 * 155 * @return The requested suppress type, or {@code null} if no such type is 156 * defined. 157 */ 158 public static SuppressType forName(final String name) 159 { 160 switch (StaticUtils.toLowerCase(name)) 161 { 162 case "lastaccesstime": 163 case "last-access-time": 164 case "last_access_time": 165 return LAST_ACCESS_TIME; 166 case "lastlogintime": 167 case "last-login-time": 168 case "last_login_time": 169 return LAST_LOGIN_TIME; 170 case "lastloginip": 171 case "last-login-ip": 172 case "last_login_ip": 173 return LAST_LOGIN_IP; 174 case "lastmod": 175 return LASTMOD; 176 default: 177 return null; 178 } 179 } 180}