View Javadoc
1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *  
10   *    https://www.apache.org/licenses/LICENSE-2.0
11   *  
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License. 
18   *  
19   */
20  package org.apache.directory.api.dsmlv2.request;
21  
22  import org.apache.directory.api.util.Strings;
23  
24  /**
25   * Object to store the filter. A filter is seen as a tree with a root.
26   * 
27   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
28   */
29  public class AttributeValueAssertionFilter extends Filter
30  {
31      /** The assertion. */
32      private AttributeValueAssertion assertion;
33  
34      /** The filter type */
35      private int filterType;
36  
37  
38      /**
39       * The constructor.
40       * 
41       * @param filterType The filter type
42       */
43      public AttributeValueAssertionFilter( int filterType )
44      {
45          this.filterType = filterType;
46      }
47  
48  
49      /**
50       * Get the assertion
51       * 
52       * @return Returns the assertion.
53       */
54      public AttributeValueAssertion getAssertion()
55      {
56          return assertion;
57      }
58  
59  
60      /**
61       * Set the assertion
62       * 
63       * @param assertion The assertion to set.
64       */
65      public void setAssertion( AttributeValueAssertion assertion )
66      {
67          this.assertion = assertion;
68      }
69  
70  
71      /**
72       * Get the filter type
73       * 
74       * @return Returns the filterType.
75       */
76      public int getFilterType()
77      {
78          return filterType;
79      }
80  
81  
82      /**
83       * Set the filter type
84       * 
85       * @param filterType The filterType to set.
86       */
87      public void setFilterType( int filterType )
88      {
89          this.filterType = filterType;
90      }
91  
92  
93      /**
94       * Return a string compliant with RFC 2254 representing an item filter
95       * 
96       * @return The item filter string
97       */
98      @Override
99      public String toString()
100     {
101         return assertion != null ? assertion.toStringRFC2254( filterType ) : Strings.EMPTY_STRING;
102     }
103 }