001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 * 019 */ 020 021 package org.apache.directory.shared.dsmlv2.reponse; 022 023 import org.apache.directory.shared.ldap.message.ResultCodeEnum; 024 025 026 /** 027 * This Class helps to get resultCodeDesc for a ResultCode of a LdapResult. 028 * 029 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 030 * @version $Rev$, $Date$ 031 */ 032 public class LdapResultEnum 033 { 034 /** 035 * Gets the String description of a given result code 036 * 037 * @param resultCode 038 * a result code 039 * @return 040 * the String description corresponding to the result code 041 */ 042 public static String getResultCodeDescr( ResultCodeEnum resultCode ) 043 { 044 switch ( resultCode ) 045 { 046 case SUCCESS: 047 return "success"; 048 case OPERATIONS_ERROR: 049 return "operationsError"; 050 case PROTOCOL_ERROR: 051 return "protocolError"; 052 case TIME_LIMIT_EXCEEDED: 053 return "timeLimitExceeded"; 054 case SIZE_LIMIT_EXCEEDED: 055 return "sizeLimitExceeded"; 056 case COMPARE_FALSE: 057 return "compareFalse"; 058 case COMPARE_TRUE: 059 return "compareTrue"; 060 case AUTH_METHOD_NOT_SUPPORTED: 061 return "authMethodNotSupported"; 062 case STRONG_AUTH_REQUIRED: 063 return "strongAuthRequired"; 064 case PARTIAL_RESULTS: 065 return "partialResults"; 066 case REFERRAL: 067 return "referral"; 068 case ADMIN_LIMIT_EXCEEDED: 069 return "adminLimitExceeded"; 070 case UNAVAILABLE_CRITICAL_EXTENSION: 071 return "unavailableCriticalExtension"; 072 case CONFIDENTIALITY_REQUIRED: 073 return "confidentialityRequired"; 074 case SASL_BIND_IN_PROGRESS: 075 return "saslBindInProgress"; 076 case NO_SUCH_ATTRIBUTE: 077 return "noSuchAttribute"; 078 case UNDEFINED_ATTRIBUTE_TYPE: 079 return "undefinedAttributeType"; 080 case INAPPROPRIATE_MATCHING: 081 return "inappropriateMatching"; 082 case CONSTRAINT_VIOLATION: 083 return "constraintViolation"; 084 case ATTRIBUTE_OR_VALUE_EXISTS: 085 return "attributeOrValueExists"; 086 case INVALID_ATTRIBUTE_SYNTAX: 087 return "invalidAttributeSyntax"; 088 case NO_SUCH_OBJECT: 089 return "NO_SUCH_OBJECT"; 090 case ALIAS_PROBLEM: 091 return "aliasProblem"; 092 case INVALID_DN_SYNTAX: 093 return "invalidDNSyntax"; 094 case ALIAS_DEREFERENCING_PROBLEM: 095 return "aliasDereferencingProblem"; 096 case INAPPROPRIATE_AUTHENTICATION: 097 return "inappropriateAuthentication"; 098 case INVALID_CREDENTIALS: 099 return "invalidCredentials"; 100 case INSUFFICIENT_ACCESS_RIGHTS: 101 return "insufficientAccessRights"; 102 case BUSY: 103 return "busy"; 104 case UNAVAILABLE: 105 return "unavailable"; 106 case UNWILLING_TO_PERFORM: 107 return "unwillingToPerform"; 108 case LOOP_DETECT: 109 return "loopDetect"; 110 case NAMING_VIOLATION: 111 return "namingViolation"; 112 case OBJECT_CLASS_VIOLATION: 113 return "objectClassViolation"; 114 case NOT_ALLOWED_ON_NON_LEAF: 115 return "notAllowedOnNonLeaf"; 116 case NOT_ALLOWED_ON_RDN: 117 return "notAllowedOnRDN"; 118 case ENTRY_ALREADY_EXISTS: 119 return "entryAlreadyExists"; 120 case OBJECT_CLASS_MODS_PROHIBITED: 121 return "objectClassModsProhibited"; 122 case AFFECTS_MULTIPLE_DSAS: 123 return "affectsMultipleDSAs"; 124 case OTHER: 125 return "other"; 126 case UNKNOWN: 127 return "unknown"; 128 129 default: 130 return "unknoxn"; 131 } 132 } 133 }