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.api.ldap.model.entry;
021
022
023import java.io.Externalizable;
024
025import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
026import org.apache.directory.api.ldap.model.schema.AttributeType;
027
028
029/**
030 * An internal interface for a ModificationItem. The name has been
031 * chosen so that it does not conflict with @see ModificationItem
032 *
033 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
034 */
035public interface Modification extends Cloneable, Externalizable
036{
037    /**
038     *  @return the operation
039     */
040    ModificationOperation getOperation();
041
042
043    /**
044     * Store the modification operation
045     *
046     * @param operation The DirContext value to assign
047     */
048    void setOperation( int operation );
049
050
051    /**
052     * Store the modification operation
053     *
054     * @param operation The ModificationOperation value to assign
055     */
056    void setOperation( ModificationOperation operation );
057
058
059    /**
060     * @return the attribute containing the modifications
061     */
062    Attribute getAttribute();
063
064
065    /**
066     * Set the attribute's modification
067     *
068     * @param attribute The modified attribute
069     */
070    void setAttribute( Attribute attribute );
071
072
073    /**
074     * The clone operation
075     *
076     * @return a clone of the current modification
077     */
078    Modification clone();
079
080
081    /**
082     * Apply the AttributeType to the Modification
083     * 
084     * @param attributeType the injected AttributeType
085     * @throws LdapInvalidAttributeValueException If one of the value is not valid
086     */
087    void apply( AttributeType attributeType ) throws LdapInvalidAttributeValueException;
088}