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 */ 020package org.apache.directory.server.core.api.interceptor.context; 021 022import org.apache.directory.api.ldap.model.name.Ava; 023 024/** 025 * A class used to hold the RDN changed during a Rename or a MoveAndRename operation. 026 * We store and AVA that is part of the oldRDN or the new RDN in an instance of this class. 027 * 028 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 029 */ 030public class ModDnAva 031{ 032 /** The type of modification */ 033 public enum ModDnType 034 { 035 ADD, // for added AttributeTypes 036 UPDATE_ADD, // for attributeTypes present in both Rdn but with a different value 037 UPDATE_DELETE, // for attributeTypes present in 038 DELETE // for deleted attributeTypes 039 } 040 041 /** The type of modification applied on this AVA */ 042 private ModDnType type; 043 044 /** The added or removed Ava */ 045 private Ava ava; 046 047 /** 048 * Creates a new instance of a ModDnAva 049 * @param type The type of modification 050 * @param ava The AVA to store 051 */ 052 public ModDnAva( ModDnType type, Ava ava ) 053 { 054 this.type = type; 055 this.ava = ava; 056 } 057 058 059 /** 060 * @return the ava 061 */ 062 public Ava getAva() 063 { 064 return ava; 065 } 066 067 068 /** 069 * @return the modification type 070 */ 071 public ModDnType getType() 072 { 073 return type; 074 } 075 076 077 /** 078 * {@inheritDoc} 079 */ 080 @Override 081 public String toString() 082 { 083 StringBuilder sb = new StringBuilder(); 084 085 sb.append( '<' ).append( type ).append( ',' ).append( ava ).append( '>' ); 086 087 return sb.toString(); 088 } 089}