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.dsmlv2.request;
021
022
023/**
024 * Object to store the filter. A filter is seen as a tree with a root.
025 * 
026 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
027 */
028public class AttributeValueAssertionFilter extends Filter
029{
030    /** The assertion. */
031    private AttributeValueAssertion assertion;
032
033    /** The filter type */
034    private int filterType;
035
036
037    /**
038     * The constructor.
039     * 
040     * @param filterType The filter type
041     */
042    public AttributeValueAssertionFilter( int filterType )
043    {
044        this.filterType = filterType;
045    }
046
047
048    /**
049     * Get the assertion
050     * 
051     * @return Returns the assertion.
052     */
053    public AttributeValueAssertion getAssertion()
054    {
055        return assertion;
056    }
057
058
059    /**
060     * Set the assertion
061     * 
062     * @param assertion The assertion to set.
063     */
064    public void setAssertion( AttributeValueAssertion assertion )
065    {
066        this.assertion = assertion;
067    }
068
069
070    /**
071     * Get the filter type
072     * 
073     * @return Returns the filterType.
074     */
075    public int getFilterType()
076    {
077        return filterType;
078    }
079
080
081    /**
082     * Set the filter type
083     * 
084     * @param filterType The filterType to set.
085     */
086    public void setFilterType( int filterType )
087    {
088        this.filterType = filterType;
089    }
090
091
092    /**
093     * Return a string compliant with RFC 2254 representing an item filter
094     * 
095     * @return The item filter string
096     */
097    public String toString()
098    {
099        return assertion != null ? assertion.toStringRFC2254( filterType ) : "";
100    }
101}