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 021package org.apache.directory.api.ldap.extras.controls; 022 023 024/** 025 * The type of MODDN modification. One of MOVE, RENAME or MOVE_AND_RENAME 026 * 027 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 028 */ 029public enum SyncModifyDnType 030{ 031 MOVE(0), 032 RENAME(1), 033 MOVE_AND_RENAME(2); 034 035 /** Internal value for each tag */ 036 private int value; 037 038 039 /** 040 * Creates the value 041 */ 042 private SyncModifyDnType( int value ) 043 { 044 this.value = value; 045 } 046 047 048 /** 049 * @return The value associated with the current element. 050 */ 051 public int getValue() 052 { 053 return value; 054 } 055 056 057 /** 058 * Get the instance from it's interger value 059 * @param value The value we are looking for 060 * @return The associated value 061 */ 062 public static SyncModifyDnType getModifyDnType( int value ) 063 { 064 switch ( value ) 065 { 066 case 0: 067 return MOVE; 068 069 case 1: 070 return RENAME; 071 072 case 2: 073 return MOVE_AND_RENAME; 074 } 075 076 throw new IllegalArgumentException( "unknown modify dn operantion type " + value ); 077 } 078}