KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > storage > search > implementation > database > TestSqlHandler


1 /*
2  * TestSqlHandler.java
3  *
4  * Created on October 21, 2002, 2:55 PM
5  */

6
7 package org.mmbase.storage.search.implementation.database;
8
9 import org.mmbase.storage.search.*;
10 import org.mmbase.storage.search.implementation.database.SqlHandler;
11
12 /**
13  * Test implementation of the <@link SqlHandler SqlHandler> interface.
14  *
15  * @author Rob van Maris
16  */

17 public class TestSqlHandler implements SqlHandler {
18     public final static String JavaDoc TEST1 = "test1";
19     public final static String JavaDoc TEST2 = "test2";
20     public final static String JavaDoc TEST3 = "test3";
21     public final static String JavaDoc TEST4 = "test4";
22     
23     /** Fixed supportLevel. */
24     int supportLevel = 0;
25     
26     /** Creates a new instance of TestSqlHandler */
27     public TestSqlHandler(int supportLevel) {
28         this.supportLevel = supportLevel;
29     }
30     
31     /**
32      * Implements this method by appending sb with TEST1.
33      */

34     public void appendConstraintToSql(StringBuffer JavaDoc sb, Constraint constraint,
35     SearchQuery query, boolean inverse, boolean inComposite) {
36         sb.append(TEST1);
37     }
38     
39     /**
40      * Implements this method by appending sb with TEST2.
41      */

42     public void appendQueryBodyToSql(
43     StringBuffer JavaDoc sb, SearchQuery query, SqlHandler firstInChain) {
44         sb.append(TEST2);
45     }
46     
47     /**
48      * Implements this method by returning with TEST3 + value.
49      */

50     public String JavaDoc getAllowedValue(String JavaDoc value) {
51         return TEST3 + value;
52     }
53     
54     /**
55      * Implements this method by returning the supportlevel set
56      * in the constructor.
57      */

58     public int getSupportLevel(Constraint constraint, SearchQuery query) {
59         return supportLevel;
60     }
61     
62     /**
63      * Implements this method by returning the supportlevel set
64      * in the constructor.
65      */

66     public int getSupportLevel(int feature, SearchQuery query) {
67         return supportLevel;
68     }
69     
70     /**
71      * Implements this method by returning TEST4.
72      */

73     public String JavaDoc toSql(SearchQuery query, SqlHandler firstInChain) {
74         return TEST4;
75     }
76     
77 }
78
Popular Tags