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