001/* 002 * Copyright 2011-2024 Ping Identity Corporation 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright 2011-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) 2011-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; 037 038 039 040import com.unboundid.util.NotNull; 041import com.unboundid.util.Nullable; 042import com.unboundid.util.StaticUtils; 043import com.unboundid.util.ThreadSafety; 044import com.unboundid.util.ThreadSafetyLevel; 045 046 047 048/** 049 * This enum defines the set of LDAP operation types. 050 */ 051@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 052public enum OperationType 053{ 054 /** 055 * The operation type that will be used for abandon operations. 056 */ 057 ABANDON, 058 059 060 061 /** 062 * The operation type that will be used for add operations. 063 */ 064 ADD, 065 066 067 068 /** 069 * The operation type that will be used for bind operations. 070 */ 071 BIND, 072 073 074 075 /** 076 * The operation type that will be used for compare operations. 077 */ 078 COMPARE, 079 080 081 082 /** 083 * The operation type that will be used for delete operations. 084 */ 085 DELETE, 086 087 088 089 /** 090 * The operation type that will be used for extended operations. 091 */ 092 EXTENDED, 093 094 095 096 /** 097 * The operation type that will be used for modify operations. 098 */ 099 MODIFY, 100 101 102 103 /** 104 * The operation type that will be used for modify DN operations. 105 */ 106 MODIFY_DN, 107 108 109 110 /** 111 * The operation type that will be used for search operations. 112 */ 113 SEARCH, 114 115 116 117 /** 118 * The operation type that will be used for unbind operations. 119 */ 120 UNBIND; 121 122 123 124 /** 125 * Retrieves the operation type with the specified name. 126 * 127 * @param name The name of the operation type to retrieve. It must not be 128 * {@code null}. 129 * 130 * @return The requested operation type, or {@code null} if no such operation 131 * type is defined. 132 */ 133 @Nullable() 134 public static OperationType forName(@NotNull final String name) 135 { 136 switch (StaticUtils.toLowerCase(name)) 137 { 138 case "abandon": 139 return ABANDON; 140 case "add": 141 return ADD; 142 case "bind": 143 return BIND; 144 case "compare": 145 return COMPARE; 146 case "delete": 147 case "del": 148 return DELETE; 149 case "extended": 150 case "extendedoperation": 151 case "extended-operation": 152 case "extended_operation": 153 case "extendedop": 154 case "extended-op": 155 case "extended_op": 156 case "extop": 157 case "ext-op": 158 case "ext_op": 159 return EXTENDED; 160 case "modify": 161 case "mod": 162 return MODIFY; 163 case "modifydn": 164 case "modify-dn": 165 case "modify_dn": 166 case "moddn": 167 case "mod-dn": 168 case "mod_dn": 169 case "modifyrdn": 170 case "modify-rdn": 171 case "modify_rdn": 172 case "modrdn": 173 case "mod-rdn": 174 case "mod_rdn": 175 return MODIFY_DN; 176 case "search": 177 return SEARCH; 178 case "unbind": 179 return UNBIND; 180 default: 181 return null; 182 } 183 } 184}