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    package org.apache.directory.server.core.subtree;
021    
022    
023    import org.apache.directory.shared.ldap.subtree.SubtreeSpecification;
024    
025    
026    /**
027     * An operational view of a subentry within the system.
028     *
029     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
030     * @version $Rev$
031     */
032    public class Subentry
033    {
034        static final int COLLECTIVE_SUBENTRY = 1;
035        static final int SCHEMA_SUBENTRY = 2;
036        static final int ACCESS_CONTROL_SUBENTRY = 4;
037        static final int TRIGGER_SUBENTRY = 8;
038        
039        private SubtreeSpecification ss;
040        private int type;
041        
042        
043        final void setSubtreeSpecification( SubtreeSpecification ss )
044        {
045            this.ss = ss;
046        }
047        
048    
049        final SubtreeSpecification getSubtreeSpecification()
050        {
051            return ss;
052        }
053    
054    
055        final void setTypes( int type )
056        {
057            this.type = type;
058        }
059    
060    
061        final int getTypes()
062        {
063            return type;
064        }
065        
066        
067        final boolean isCollectiveSubentry()
068        {
069            return ( COLLECTIVE_SUBENTRY & type ) == COLLECTIVE_SUBENTRY;
070        }
071        
072        
073        final boolean isSchemaSubentry()
074        {
075            return ( SCHEMA_SUBENTRY & type ) == SCHEMA_SUBENTRY;
076        }
077        
078        
079        final boolean isAccessControlSubentry()
080        {
081            return ( ACCESS_CONTROL_SUBENTRY & type ) == ACCESS_CONTROL_SUBENTRY;
082        }
083        
084        
085        final boolean isTriggerSubentry()
086        {
087            return ( TRIGGER_SUBENTRY & type ) == TRIGGER_SUBENTRY;
088        }
089    }