Project

General

Profile

Revision 2068

Added by Matt Jones over 17 years ago

Created test class QuerySpecificationTest and started process of removing the xml_index from the QuerySpecification code. Reformatted some classes for readability.

View differences:

test/JDBCTest.java
100 100
        select(conn);
101 101
        index++;
102 102
      }//for
103
      System.out.prinln("End");
103
      System.out.println("End");
104 104
     
105 105
    }//try
106 106
    catch (SQLException e)
test/query.xml
17 17
      </querygroup>
18 18
    </querygroup>
19 19
  </querygroup>
20
<pathquery>
20
</pathquery>
test/edu/ucsb/nceas/metacattest/QuerySpecificationTest.java
1
/**
2
 *  '$RCSfile$'
3
 *  Copyright: 2004 Regents of the University of California and the
4
 *             National Center for Ecological Analysis and Synthesis
5
 *
6
 *   '$Author$'
7
 *     '$Date$'
8
 * '$Revision$'
9
 *
10
 * This program is free software; you can redistribute it and/or modify
11
 * it under the terms of the GNU General Public License as published by
12
 * the Free Software Foundation; either version 2 of the License, or
13
 * (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program; if not, write to the Free Software
22
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23
 */
24
package edu.ucsb.nceas.metacattest;
25

  
26
import java.io.File;
27
import java.io.FileNotFoundException;
28
import java.io.FileReader;
29
import java.io.IOException;
30
import java.util.Hashtable;
31

  
32
import junit.framework.Test;
33
import junit.framework.TestCase;
34
import junit.framework.TestSuite;
35

  
36
import edu.ucsb.nceas.metacat.MetaCatUtil;
37
import edu.ucsb.nceas.metacat.QuerySpecification;
38
import edu.ucsb.nceas.utilities.Options;
39

  
40
/**
41
 * @author jones
42
 * 
43
 * Test the output of the QuerySpecification class
44
 */
45
public class QuerySpecificationTest extends TestCase
46
{
47
    /** A test query document in xml format */
48
    private FileReader xml;
49
    
50
    /** The utilities object for accessing property values */
51
    private MetaCatUtil util;
52
    
53
    /**
54
     * Constructor to build the test
55
     * 
56
     * @param name the name of the test method
57
     */
58
    public QuerySpecificationTest(String name)
59
    {
60
        super(name);
61
    }
62

  
63
    /*
64
     * @see TestCase#setUp()
65
     */
66
    protected void setUp() throws Exception
67
    {
68
        super.setUp();
69
        try {
70
            File propertyFile = new File("./lib/metacat.properties");
71
            Options options = Options.initialize(propertyFile);
72
            util = new MetaCatUtil();
73
            String xmlfile = "./test/query.xml";
74
            xml = new FileReader(new File(xmlfile));
75
        } catch (FileNotFoundException e) {
76
            fail(e.getMessage());
77
        } catch (IOException e) {
78
            fail(e.getMessage());
79
        }
80
    }
81

  
82
    /**
83
     * Create a suite of tests to be run together
84
     */
85
    public static Test suite()
86
    {
87
        TestSuite suite = new TestSuite();
88
        suite.addTest(new QuerySpecificationTest("testPrintSQL"));
89
        suite.addTest(new QuerySpecificationTest("testPrintExtendedSQL"));
90
        return suite;
91
    }
92

  
93
    /**
94
     * Print the sql generated from this specification
95
     */
96
    public void testPrintSQL()
97
    {
98
        try {
99
            QuerySpecification qspec = new QuerySpecification(xml, 
100
                    MetaCatUtil.getOption("saxparser"), 
101
                    MetaCatUtil.getOption("accNumberSeparator"));
102
            System.out.println(qspec.printSQL(true));
103
        } catch (IOException e) {
104
            fail(e.getMessage());
105
        }
106
    }
107

  
108
    /**
109
     * Print the extended SQL for a result set.
110
     */
111
    public void testPrintExtendedSQL()
112
    {
113
        try {
114
            Hashtable controlPairs = new Hashtable();
115
            QuerySpecification qspec = new QuerySpecification(xml, 
116
                    MetaCatUtil.getOption("saxparser"), 
117
                    MetaCatUtil.getOption("accNumberSeparator"));
118
            System.out.println(qspec.printExtendedSQL("n.1.1, n.2.2", controlPairs));
119
        } catch (IOException e) {
120
            fail(e.getMessage());
121
        }
122
    }
123

  
124
}
0 125

  
src/edu/ucsb/nceas/metacat/QuerySpecification.java
30 30

  
31 31
package edu.ucsb.nceas.metacat;
32 32

  
33
import java.io.File;
34
import java.io.FileReader;
35 33
import java.io.IOException;
36 34
import java.io.Reader;
37 35
import java.io.StringReader;
......
357 355
        return accessQuery;
358 356
    }
359 357

  
360
    /** Main routine for testing */
361
    static public void main(String[] args)
362
    {
363

  
364
        if (args.length < 1) {
365
            System.err.println("Wrong number of arguments!!!");
366
            System.err.println("USAGE: java QuerySpecification <xmlfile>");
367
            return;
368
        } else {
369
            int i = 0;
370
            boolean useXMLIndex = true;
371
            if (args[i].equals("-noindex")) {
372
                useXMLIndex = false;
373
                i++;
374
            }
375
            String xmlfile = args[i];
376

  
377
            try {
378
                MetaCatUtil util = new MetaCatUtil();
379
                FileReader xml = new FileReader(new File(xmlfile));
380
                QuerySpecification qspec = new QuerySpecification(xml, util
381
                        .getOption("saxparser"), util
382
                        .getOption("accNumberSeparator"));
383
                System.out.println(qspec.printSQL(useXMLIndex));
384

  
385
            } catch (IOException e) {
386
                System.err.println(e.getMessage());
387
            }
388

  
389
        }
390
    }
391

  
392 358
    /**
393 359
     * Returns true if the parsed query contains and extended xml query (i.e.
394 360
     * there is at least one &lt;returnfield&gt; in the pathquery document)
......
814 780
        sql.append(") AND startnodeid IS NOT NULL AND ");
815 781
        sql.append("(");
816 782
        sql.append("(");
817
        sql.append("startnodeid NOT IN (SELECT startnodeid from xml_access, xml_documents ");
783
        sql
784
                .append("startnodeid NOT IN (SELECT startnodeid from xml_access, xml_documents ");
818 785
        sql.append(" WHERE xml_access.docid = xml_documents.docid");
819 786
        sql.append(" AND lower(xml_documents.user_owner) ='");
820 787
        sql.append(userName);
......
822 789
        sql.append(")");
823 790
        sql.append(" AND ");
824 791
        sql.append("(");
825
        sql.append("(startnodeid NOT IN (SELECT startnodeid from xml_access where( ");
792
        sql
793
                .append("(startnodeid NOT IN (SELECT startnodeid from xml_access where( ");
826 794
        sql.append(allowString);
827 795
        sql.append(") AND (startnodeid IS NOT NULL))");
828 796
        sql.append(")");
829
        sql.append(" OR (startnodeid IN (SELECT startnodeid from xml_access where( ");
797
        sql
798
                .append(" OR (startnodeid IN (SELECT startnodeid from xml_access where( ");
830 799
        sql.append(denyString);
831 800
        sql.append(") AND (startnodeid IS NOT NULL))");
832 801
        sql.append(")");
......
851 820
            Hashtable unaccessableNodePair)
852 821
    {
853 822
        StringBuffer self = new StringBuffer();
854
        self
855
                .append("select xml_nodes.docid, xml_index.path, xml_nodes.nodedata, ");
823
        self.append("select xml_nodes.docid, xml_index.path, xml_nodes.nodedata, ");
856 824
        self.append("xml_nodes.parentnodeid ");
857 825
        self.append("from xml_index, xml_nodes where xml_index.nodeid=");
858 826
        self.append("xml_nodes.parentnodeid and (xml_index.path like '");
src/edu/ucsb/nceas/metacat/MetaCatUtil.java
28 28
package edu.ucsb.nceas.metacat;
29 29

  
30 30
import java.io.File;
31
import java.net.MalformedURLException;
31 32
import java.net.URL;
32
import java.net.MalformedURLException;
33
import java.sql.Connection;
34
import java.sql.DriverManager;
35
import java.sql.SQLException;
36
import java.util.PropertyResourceBundle;
37 33
import java.util.Hashtable;
38
import java.util.Enumeration;
39 34
import java.util.Stack;
40 35
import java.util.Vector;
41 36

  
......
45 40
/**
46 41
 * A suite of utility classes for the metadata catalog server
47 42
 */
48
public class MetaCatUtil {
43
public class MetaCatUtil
44
{
49 45

  
50
  public static AbstractDatabase dbAdapter;
51
  private static Options options = null;
52
  private static boolean debug = true;
46
    public static AbstractDatabase dbAdapter;
53 47

  
54
  //private Hashtable connectionPool = new Hashtable();
48
    private static Options options = null;
55 49

  
56
  /**
57
   * Determine our db adapter class and create an instance of that class
58
   */
59
  static {
60
    try {
61
      dbAdapter = (AbstractDatabase)createObject(getOption("dbAdapter"));
62
    } catch (Exception e) {
63
      System.err.println("Error in MetaCatUtil static block:" + e.getMessage());
50
    private static boolean debug = true;
51

  
52
    /**
53
     * Determine our db adapter class and create an instance of that class
54
     */
55
    static {
56
        try {
57
            dbAdapter = (AbstractDatabase) createObject(getOption("dbAdapter"));
58
        } catch (Exception e) {
59
            System.err.println("Error in MetaCatUtil static block:"
60
                    + e.getMessage());
61
        }
64 62
    }
65
  }
66 63

  
64
    /**
65
     * Instantiate a class using the name of the class at runtime
66
     * 
67
     * @param className the fully qualified name of the class to instantiate
68
     */
69
    public static Object createObject(String className) throws Exception
70
    {
67 71

  
72
        Object object = null;
73
        try {
74
            Class classDefinition = Class.forName(className);
75
            object = classDefinition.newInstance();
76
        } catch (InstantiationException e) {
77
            throw e;
78
        } catch (IllegalAccessException e) {
79
            throw e;
80
        } catch (ClassNotFoundException e) {
81
            throw e;
82
        }
83
        return object;
84
    }
68 85

  
69
  /**
70
   * Instantiate a class using the name of the class at runtime
71
   *
72
   * @param className the fully qualified name of the class to instantiate
73
   */
74
  public static Object createObject(String className) throws Exception {
86
    /**
87
     * Utility method to get an option value from the properties file
88
     * 
89
     * @param optionName the name of the option requested
90
     * @return the String value for the option, or null if not set
91
     */
92
    public static String getOption(String optionName)
93
    {
94
        if (options == null) {
95
            options = Options.getInstance();
96
        }
97
        String value = options.getOption(optionName);
98
        return value;
99
    }
75 100

  
76
    Object object = null;
77
    try {
78
      Class classDefinition = Class.forName(className);
79
      object = classDefinition.newInstance();
80
    } catch (InstantiationException e) {
81
      throw e;
82
    } catch (IllegalAccessException e) {
83
      throw e;
84
    } catch (ClassNotFoundException e) {
85
      throw e;
101
    /** Utility method to convert a file handle into a URL */
102
    public static URL fileToURL(File file)
103
    {
104
        String path = file.getAbsolutePath();
105
        String fSep = System.getProperty("file.separator");
106
        if (fSep != null && fSep.length() == 1)
107
                path = path.replace(fSep.charAt(0), '/');
108
        if (path.length() > 0 && path.charAt(0) != '/') path = '/' + path;
109
        try {
110
            return new URL("file", null, path);
111
        } catch (java.net.MalformedURLException e) {
112
            /*
113
             * According to the spec this could only happen if the file
114
             */
115
            throw new Error("unexpected MalformedURLException");
116
        }
86 117
    }
87
    return object;
88
  }
89 118

  
90
  /**
91
   * Utility method to get an option value from the properties file
92
   *
93
   * @param optionName the name of the option requested
94
   * @return the String value for the option, or null if not set
95
   */
96
  public static String getOption(String optionName) {
97
      if (options == null) {
98
        options = Options.getInstance();
99
      }
100
      String value = options.getOption(optionName);
101
      return value;
102
  }
119
    /**
120
     * Utility method to parse the query part of a URL into parameters. This
121
     * method assumes the format of the query par tof the url is an ampersand
122
     * separated list of name/value pairs, with equal signs separating the name
123
     * from the value (e.g., name=tom&zip=99801 ). Returns a has of the name
124
     * value pairs, hashed on name.
125
     */
126
    public static Hashtable parseQuery(String query)
127
            throws MalformedURLException
128
    {
129
        String[][] params = new String[200][2];
130
        Hashtable parameters = new Hashtable();
103 131

  
104
  /** Utility method to convert a file handle into a URL */
105
  public static URL fileToURL(File file)
106
  {
107
     String path = file.getAbsolutePath();
108
     String fSep = System.getProperty("file.separator");
109
     if (fSep != null && fSep.length() == 1)
110
       path = path.replace(fSep.charAt(0), '/');
111
     if (path.length() > 0 && path.charAt(0) != '/')
112
       path = '/' + path;
113
     try {
114
       return new URL("file", null, path);
115
     }
116
     catch (java.net.MalformedURLException e) {
117
       /* According to the spec this could only happen if the file
118
          protocol were not recognized. */
119
       throw new Error("unexpected MalformedURLException");
120
     }
121
  }
132
        String temp = "";
133
        boolean ampflag = true;
134
        boolean poundflag = false;
135
        int arrcount = 0;
122 136

  
123
  /**
124
   * Utility method to parse the query part of a URL into parameters. This
125
   * method assumes the format of the query par tof the url is an
126
   * ampersand separated list of name/value pairs, with equal signs separating
127
   * the name from the value (e.g., name=tom&zip=99801 ). Returns a
128
   * has of the name value pairs, hashed on name.
129
   */
130
  public static Hashtable parseQuery(String query) throws MalformedURLException
131
  {
132
    String[][] params = new String[200][2];
133
    Hashtable parameters = new Hashtable();
137
        if (query != null) {
138
            for (int i = 0; i < query.length(); i++) {
134 139

  
135
    String temp = "";
136
    boolean ampflag = true;
137
    boolean poundflag = false;
138
    int arrcount = 0;
140
                // go throught the remainder of the query one character at a
141
                // time.
142
                if (query.charAt(i) == '=') {
143
                    // if the current char is a # then the preceding should be
144
                    // a name
145
                    if (!poundflag && ampflag) {
146
                        params[arrcount][0] = temp.trim();
147
                        temp = "";
148
                    } else {
149
                        //if there are two #s or &s in a row throw an
150
                        // exception.
151
                        throw new MalformedURLException(
152
                                "metacatURL: Two parameter names "
153
                                        + "not allowed in sequence");
154
                    }
155
                    poundflag = true;
156
                    ampflag = false;
157
                } else if (query.charAt(i) == '&' || i == query.length() - 1) {
158
                    //the text preceding the & should be the param value.
159
                    if (i == query.length() - 1) {
160
                        //if at the end of the string grab the last value and
161
                        // append it.
162
                        if (query.charAt(i) != '=') {
163
                            //ignore an extra & on the end of the string
164
                            temp += query.charAt(i);
165
                        }
166
                    }
139 167

  
140
    if ( query != null ) {
141
      for (int i=0; i < query.length(); i++) {
142

  
143
        // go throught the remainder of the query one character at a time.
144
        if (query.charAt(i) == '=') {
145
          // if the current char is a # then the preceding should be a name
146
          if (!poundflag && ampflag) {
147
            params[arrcount][0] = temp.trim();
148
            temp = "";
149
          } else {
150
            //if there are two #s or &s in a row throw an exception.
151
            throw new MalformedURLException("metacatURL: Two parameter names "+
152
                                            "not allowed in sequence");
153
          }
154
          poundflag = true;
155
          ampflag = false;
156
        } else if (query.charAt(i) == '&' || i == query.length()-1) {
157
          //the text preceding the & should be the param value.
158
          if (i == query.length() - 1) {
159
            //if at the end of the string grab the last value and append it.
160
            if (query.charAt(i) != '=') {
161
            //ignore an extra & on the end of the string
162
              temp += query.charAt(i);
168
                    if (!ampflag && poundflag) {
169
                        params[arrcount][1] = temp.trim();
170
                        parameters
171
                                .put(params[arrcount][0], params[arrcount][1]);
172
                        temp = "";
173
                        arrcount++; //increment the array to the next row.
174
                    } else {
175
                        //if there are two =s or &s in a row through an
176
                        // exception
177
                        throw new MalformedURLException(
178
                                "metacatURL: Two parameter values "
179
                                        + "not allowed in sequence");
180
                    }
181
                    poundflag = false;
182
                    ampflag = true;
183
                } else {
184
                    //get the next character in the string
185
                    temp += query.charAt(i);
186
                }
163 187
            }
164
          }
165

  
166
          if (!ampflag && poundflag) {
167
            params[arrcount][1] = temp.trim();
168
            parameters.put(params[arrcount][0], params[arrcount][1]);
169
            temp = "";
170
            arrcount++; //increment the array to the next row.
171
          } else {
172
            //if there are two =s or &s in a row through an exception
173
            throw new MalformedURLException("metacatURL: Two parameter values "+
174
                                            "not allowed in sequence");
175
          }
176
          poundflag = false;
177
          ampflag = true;
178
        } else {
179
          //get the next character in the string
180
          temp += query.charAt(i);
181 188
        }
182
      }
189
        return parameters;
183 190
    }
184
    return parameters;
185
  }
186 191

  
187
   /**
188
   * Utility method to print debugging messages. User can set debug level
189
   * for this message. The number is fewer, the message is more important
190
   * @param msg, the content of the message
191
   * @param debugLevel, an integer indicating the message debug leve
192
   */
193
  public static void debugMessage(String msg, int debugLevel)
194
  {
195
    if (debug)
192
    /**
193
     * Utility method to print debugging messages. User can set debug level for
194
     * this message. The number is fewer, the message is more important
195
     * 
196
     * @param msg, the content of the message
197
     * @param debugLevel, an integer indicating the message debug leve
198
     */
199
    public static void debugMessage(String msg, int debugLevel)
196 200
    {
197
      int limit = 1;
198
      try
199
      {
200
        limit=Integer.parseInt(getOption("debuglevel"));
201
        if (debug) {
202
            int limit = 1;
203
            try {
204
                limit = Integer.parseInt(getOption("debuglevel"));
201 205

  
202
      }
203
      catch (Exception e)
204
      {
205
        System.out.println(e.getMessage());
206
      }
207
      //don't allow the user set debugLevel less than or equals 0
208
      if (debugLevel<=0)
209
      {
210
        debugLevel=1;
211
      }
206
            } catch (Exception e) {
207
                System.out.println(e.getMessage());
208
            }
209
            //don't allow the user set debugLevel less than or equals 0
210
            if (debugLevel <= 0) {
211
                debugLevel = 1;
212
            }
212 213

  
213
      if (debugLevel < limit)
214
      {
215
        System.err.println("@debugprefix@ " +msg);
216
      }
214
            if (debugLevel < limit) {
215
                System.err.println("@debugprefix@ " + msg);
216
            }
217
        }
217 218
    }
218
  }
219 219

  
220
    public static Vector getOptionList(String optiontext)
221
    {
222
        Vector optionsVector = new Vector();
223
        if (optiontext.indexOf(",") == -1) {
224
            optionsVector.addElement(optiontext);
225
            return optionsVector;
226
        }
220 227

  
221
  public static Vector getOptionList(String optiontext)
222
  {
223
    Vector optionsVector = new Vector();
224
    if(optiontext.indexOf(",") == -1)
225
    {
226
      optionsVector.addElement(optiontext);
227
      return optionsVector;
228
        while (optiontext.indexOf(",") != -1) {
229
            String s = optiontext.substring(0, optiontext.indexOf(","));
230
            optionsVector.addElement(s.trim());
231
            optiontext = optiontext.substring(optiontext.indexOf(",") + 1,
232
                    optiontext.length());
233
            if (optiontext.indexOf(",") == -1) { //catch the last list entry
234
                optionsVector.addElement(optiontext.trim());
235
            }
236
        }
237
        return optionsVector;
228 238
    }
229 239

  
230
    while(optiontext.indexOf(",") != -1)
240
    /** Normalizes the given string. Taken from configXML.java */
241
    public static String normalize(String s)
231 242
    {
232
      String s = optiontext.substring(0, optiontext.indexOf(","));
233
      optionsVector.addElement(s.trim());
234
      optiontext = optiontext.substring(optiontext.indexOf(",") + 1,
235
                                        optiontext.length());
236
      if(optiontext.indexOf(",") == -1)
237
      { //catch the last list entry
238
        optionsVector.addElement(optiontext.trim());
239
      }
243
        StringBuffer str = new StringBuffer();
244

  
245
        int len = (s != null) ? s.length() : 0;
246
        for (int i = 0; i < len; i++) {
247
            char ch = s.charAt(i);
248
            switch (ch) {
249
            case '<':
250
                {
251
                    str.append("&lt;");
252
                    break;
253
                }
254
            case '>':
255
                {
256
                    str.append("&gt;");
257
                    break;
258
                }
259
            case '&':
260
                {
261
                    str.append("&amp;");
262
                    break;
263
                }
264
            case '"':
265
                {
266
                    str.append("&quot;");
267
                    break;
268
                }
269
            case '\r':
270
            case '\n':
271
                {
272
                    // else, default append char
273
                }
274
            default:
275
                {
276
                    str.append(ch);
277
                }
278
            }
279
        }
280
        return (str.toString());
240 281
    }
241
    return optionsVector;
242
  }
243 282

  
244
  /** Normalizes the given string. Taken from configXML.java*/
245
  public static String normalize(String s)
246
  {
247
    StringBuffer str = new StringBuffer();
248

  
249
    int len = (s != null) ? s.length() : 0;
250
    for (int i = 0; i < len; i++)
283
    /**
284
     * Get docid from online/url string
285
     */
286
    public static String getDocIdWithRevFromOnlineURL(String url)
251 287
    {
252
      char ch = s.charAt(i);
253
      switch (ch)
254
      {
255
      case '<':
256
      {
257
        str.append("&lt;");
258
        break;
259
      }
260
        case '>':
261
      {
262
        str.append("&gt;");
263
        break;
264
      }
265
      case '&':
266
      {
267
        str.append("&amp;");
268
        break;
269
      }
270
      case '"':
271
      {
272
        str.append("&quot;");
273
        break;
274
      }
275
      case '\r':
276
      case '\n':
277
      {
278
        // else, default append char
279
      }
280
      default:
281
      {
282
        str.append(ch);
283
      }
284
      }
288
        String docid = null;
289
        String DOCID = "docid";
290
        boolean find = false;
291
        char limited = '&';
292
        int count = 0; //keep track how many & was found
293
        Vector list = new Vector();// keep index number for &
294
        if (url == null) {
295
            MetaCatUtil.debugMessage("url is null and null will be returned",
296
                    30);
297
            return docid;
298
        }
299
        // the first element in list is 0
300
        list.add(new Integer(0));
301
        for (int i = 0; i < url.length(); i++) {
302
            if (url.charAt(i) == limited) {
303
                // count plus 1
304
                count++;
305
                list.add(new Integer(i));
306
                // get substring beween two &
307
                String str = url.substring(
308
                        ((Integer) list.elementAt(count - 1)).intValue(), i);
309
                MetaCatUtil.debugMessage("substring between two & is: " + str,
310
                        30);
311
                //if the subString contains docid, we got it
312
                if (str.indexOf(DOCID) != -1) {
313
                    //get index of '="
314
                    int start = getIndexForGivenChar(str, '=') + 1;
315
                    int end = str.length();
316
                    docid = str.substring(start, end);
317
                    find = true;
318
                }//if
319
            }//if
320
        }//for
321
        //if not find, we need check the subtring between the index of last &
322
        // and
323
        // the end of string
324
        if (!find) {
325
            MetaCatUtil.debugMessage("Checking the last substring", 35);
326
            String str = url.substring(((Integer) list.elementAt(count))
327
                    .intValue() + 1, url.length());
328
            MetaCatUtil.debugMessage("Last substring is: " + str, 30);
329
            if (str.indexOf(DOCID) != -1) {
330
                //get index of '="
331
                int start = getIndexForGivenChar(str, '=') + 1;
332
                int end = str.length();
333
                docid = str.substring(start, end);
334
                find = true;
335
            }//if
336
        }//if
337
        MetaCatUtil.debugMessage("The docid from online url is:" + docid, 30);
338
        return docid.trim();
285 339
    }
286
    return (str.toString());
287
  }
288
  
289
  /** 
290
   * Get docid from online/url string
291
   */
292
  public static String getDocIdWithRevFromOnlineURL(String url)
293
  {
294
    String docid = null;
295
    String DOCID = "docid";
296
    boolean find = false;
297
    char limited = '&';
298
    int  count = 0; //keep track how many & was found
299
    Vector list = new Vector();// keep index number for &
300
    if (url == null)
340

  
341
    private static int getIndexForGivenChar(String str, char character)
301 342
    {
302
      MetaCatUtil.debugMessage("url is null and null will be returned", 30);
303
      return docid;
343
        int index = -1;
344
        // make sure str is not null
345
        if (str == null) {
346
            MetaCatUtil.debugMessage(
347
                    "The given str is null and -1 will be returned", 30);
348
            return index;
349
        }
350
        // got though the string
351
        for (int i = 0; i < str.length(); i++) {
352
            // find the first one then break the loop
353
            if (str.charAt(i) == character) {
354
                index = i;
355
                break;
356
            }//if
357
        }//for
358
        MetaCatUtil.debugMessage("the index for char " + character + " is: "
359
                + index, 30);
360
        return index;
304 361
    }
305
    // the first element in list is 0
306
    list.add(new Integer(0));
307
    for (int i=0; i< url.length(); i++)
362

  
363
    /**
364
     * Utility method to get docid from a given string
365
     * 
366
     * @param string, the given string should be these two format: 1) str1.str2
367
     *            in this case docid= str1.str2 2) str1.str2.str3, in this case
368
     *            docid =str1.str2
369
     * @param the sperator char
370
     */
371
    public static String getDocIdFromString(String str)
308 372
    {
309
      if (url.charAt(i) == limited)
310
      {
311
        // count plus 1
312
        count++;
313
        list.add(new Integer(i));
314
        // get substring beween two &
315
        String str = url.substring(((Integer)list.elementAt(count-1)).intValue(), i);
316
        MetaCatUtil.debugMessage("substring between two & is: " + str, 30);
317
        //if the subString contains docid, we got it
318
        if (str.indexOf(DOCID) != -1)
319
        { 
320
          //get index of '="
321
          int start = getIndexForGivenChar(str, '=')+1;
322
          int end   = str.length();
323
          docid = str.substring(start, end);
324
          find = true;
325
        }//if
326
      }//if
327
    }//for
328
    //if not find, we need check the subtring between the index of last & and 
329
    // the end of string
330
    if (!find)
331
    {
332
      MetaCatUtil.debugMessage("Checking the last substring", 35);
333
      String str = url.substring(((Integer)list.elementAt(count)).intValue() +1, 
334
                                 url.length());
335
      MetaCatUtil.debugMessage("Last substring is: " + str, 30);
336
      if (str.indexOf(DOCID) != -1)
337
      { 
338
          //get index of '="
339
          int start = getIndexForGivenChar(str, '=')+1;
340
          int end   = str.length();
341
          docid = str.substring(start, end);
342
          find = true;
343
      }//if
344
    }//if
345
    MetaCatUtil.debugMessage("The docid from online url is:"+ docid, 30);
346
    return docid.trim();
347
  }
348
  
349
  private static int getIndexForGivenChar(String str, char character)
350
  {
351
    int index = -1;
352
    // make sure str is not null
353
    if(str == null)
354
    {
355
      MetaCatUtil.debugMessage("The given str is null and -1 will be returned",
356
                                30);
357
      return index;
358
    }
359
    // got though the string
360
    for (int i=0; i<str.length(); i++)
361
    {
362
      // find the first one then break the loop
363
      if (str.charAt(i) == character)
364
      {
365
        index = i;
366
        break;
367
      }//if
368
    }//for
369
    MetaCatUtil.debugMessage("the index for char "+ character +
370
                             " is: "+index, 30);
371
    return index;
372
  }
373
  
374
  /**
375
   * Utility method to get docid from a given string
376
   * @param string, the given string should be these two format:
377
   *              1) str1.str2  in this case docid= str1.str2
378
   *              2) str1.str2.str3, in this case docid =str1.str2
379
   * @param the sperator char
380
   */
381
  public static String getDocIdFromString(String str)
382
  {
383
    String docId = null;
384
    if (str == null)
385
    {
386
      MetaCatUtil.debugMessage("The given str is null and null will be returned"
387
                                +" in getDocIdfromString", 30);
388
      return docId;
389
    } //make sure docid is not null
390
    int dotNumber = 0;//count how many dots in given string
391
    int indexOfLastDot = 0;
373
        String docId = null;
374
        if (str == null) {
375
            MetaCatUtil.debugMessage(
376
                    "The given str is null and null will be returned"
377
                            + " in getDocIdfromString", 30);
378
            return docId;
379
        } //make sure docid is not null
380
        int dotNumber = 0;//count how many dots in given string
381
        int indexOfLastDot = 0;
392 382

  
393
    //assume that seperator is one charactor string
394
    char seperator=getOption("accNumSeparator").charAt(0);
383
        //assume that seperator is one charactor string
384
        char seperator = getOption("accNumSeparator").charAt(0);
395 385

  
396
    for (int i=0; i<str.length(); i++)
397
    {
398
      if ( str.charAt(i)==seperator)
399
      {
400
        dotNumber++;//count how many dots
401
        indexOfLastDot=i;//keep the last dot postion
402
      }
403
    }//for
386
        for (int i = 0; i < str.length(); i++) {
387
            if (str.charAt(i) == seperator) {
388
                dotNumber++;//count how many dots
389
                indexOfLastDot = i;//keep the last dot postion
390
            }
391
        }//for
404 392

  
405
    //The string formatt is wrong, because it has more than two or less than
406
    //one seperator
407
    if ( dotNumber>2 || dotNumber < 1)
393
        //The string formatt is wrong, because it has more than two or less
394
        // than
395
        //one seperator
396
        if (dotNumber > 2 || dotNumber < 1) {
397
            docId = null;
398
        } else if (dotNumber == 2) //the case for str1.str2.str3
399
        {
400
            docId = str.substring(0, indexOfLastDot);
401
        } else if (dotNumber == 1) //the case for str1.str2
402
        {
403
            docId = str;
404
        }
405

  
406
        return docId;
407
    }//getDocIdFromString
408

  
409
    /**
410
     * Utility method to get version number from a given string
411
     * 
412
     * @param string, the given string should be these two format: 1)
413
     *            str1.str2(no version) version =-1; 2) str1.str2.str3, in this
414
     *            case version = str3; 3) other, vresion =-2
415
     */
416
    public static int getVersionFromString(String str)
417
            throws NumberFormatException
408 418
    {
409
      docId=null;
410
    }
411
    else if (dotNumber == 2) //the case for str1.str2.str3
412
    {
413
       docId=str.substring(0, indexOfLastDot);
414
    }
415
    else if (dotNumber == 1) //the case for str1.str2
416
    {
417
      docId=str;
418
    }
419
        int version = -1;
420
        String versionString = null;
421
        int dotNumber = 0;//count how many dots in given string
422
        int indexOfLastDot = 0;
419 423

  
420
    return docId;
421
  }//getDocIdFromString
422
  
424
        //assume that seperator is one charactor string
425
        char seperator = getOption("accNumSeparator").charAt(0);
423 426

  
427
        for (int i = 0; i < str.length(); i++) {
428
            if (str.charAt(i) == seperator) {
429
                dotNumber++;//count how many dots
430
                indexOfLastDot = i;//keep the last dot postion
431
            }
432
        }//for
424 433

  
425
  /**
426
   * Utility method to get version number from a given string
427
   * @param string, the given string should be these two format:
428
   *              1) str1.str2(no version)  version =-1;
429
   *              2) str1.str2.str3, in this case version = str3;
430
   *              3) other, vresion =-2
431
   */
432
  public static int getVersionFromString(String str)
433
                                throws NumberFormatException
434
  {
435
    int version=-1;
436
    String versionString=null;
437
    int dotNumber = 0;//count how many dots in given string
438
    int indexOfLastDot = 0;
434
        //The string formatt is wrong, because it has more than two or less
435
        // than
436
        //one seperator
437
        if (dotNumber > 2 || dotNumber < 1) {
438
            version = -2;
439
        } else if (dotNumber == 2 && (indexOfLastDot != (str.length() - 1)))
440
        //the case for str1.str2.str3
441
        {
442
            versionString = str.substring((indexOfLastDot + 1), str.length());
443
            version = Integer.parseInt(versionString);
444
        } else if (dotNumber == 1) //the case for str1.str2
445
        {
446
            version = -1;
447
        }
439 448

  
440
    //assume that seperator is one charactor string
441
    char seperator=getOption("accNumSeparator").charAt(0);
449
        return version;
450
    }//getVersionFromString
442 451

  
443
    for (int i=0; i<str.length(); i++)
452
    /**
453
     * Utility method to get version string from a given string
454
     * 
455
     * @param string, the given string should be these two format: 1)
456
     *            str1.str2(no version) version=null; 2) str1.str2.str3, in
457
     *            this case version = str3; 3) other, vresion =null;
458
     */
459
    public static String getRevisionStringFromString(String str)
460
            throws NumberFormatException
444 461
    {
445
      if ( str.charAt(i)==seperator)
446
      {
447
        dotNumber++;//count how many dots
448
        indexOfLastDot=i;//keep the last dot postion
449
      }
450
    }//for
462
        // String to store the version
463
        String versionString = null;
464
        int dotNumber = 0;//count how many dots in given string
465
        int indexOfLastDot = 0;
451 466

  
452
    //The string formatt is wrong, because it has more than two or less than
453
    //one seperator
454
    if ( dotNumber>2 || dotNumber < 1)
455
    {
456
      version=-2;
457
    }
458
    else if (dotNumber == 2 && (indexOfLastDot != (str.length() -1)))
459
     //the case for str1.str2.str3
460
    {
461
       versionString=str.substring((indexOfLastDot+1), str.length());
462
       version=Integer.parseInt(versionString);
463
    }
464
    else if (dotNumber == 1) //the case for str1.str2
465
    {
466
      version=-1;
467
    }
467
        //assume that seperator is one charactor string
468
        char seperator = getOption("accNumSeparator").charAt(0);
468 469

  
469
    return version;
470
  }//getVersionFromString
470
        for (int i = 0; i < str.length(); i++) {
471
            if (str.charAt(i) == seperator) {
472
                dotNumber++;//count how many dots
473
                indexOfLastDot = i;//keep the last dot postion
474
            }
475
        }//for
471 476

  
477
        //The string formatt is wrong, because it has more than two or less
478
        // than
479
        //one seperator
480
        if (dotNumber > 2 || dotNumber < 1) {
481
            versionString = null;
482
        } else if (dotNumber == 2 && (indexOfLastDot != (str.length() - 1))) {
483
            //the case for str1.str2.str3
484
            // indexOfLastDot != (str.length() -1) means get rid of str1.str2.
485
            versionString = str.substring((indexOfLastDot + 1), str.length());
486
        } else if (dotNumber == 1) //the case for str1.str2 or str1.str2.
487
        {
488
            versionString = null;
489
        }
472 490

  
473
  /**
474
   * Utility method to get version string from a given string
475
   * @param string, the given string should be these two format:
476
   *              1) str1.str2(no version)  version=null;
477
   *              2) str1.str2.str3, in this case version = str3;
478
   *              3) other, vresion =null;
479
   */
480
  public static String getRevisionStringFromString(String str)
481
                                throws NumberFormatException
482
  {
483
    // String to store the version
484
    String versionString=null;
485
    int dotNumber = 0;//count how many dots in given string
486
    int indexOfLastDot = 0;
491
        return versionString;
492
    }//getVersionFromString
487 493

  
488
    //assume that seperator is one charactor string
489
    char seperator=getOption("accNumSeparator").charAt(0);
490

  
491
    for (int i=0; i<str.length(); i++)
494
    /**
495
     * This method will get docid from an AccessionNumber. There is no
496
     * assumption the accessnumber will be str1.str2.str3. It can be more. So
497
     * we think the docid will be get rid of last part
498
     */
499
    public static String getDocIdFromAccessionNumber(String accessionNumber)
492 500
    {
493
      if ( str.charAt(i)==seperator)
494
      {
495
        dotNumber++;//count how many dots
496
        indexOfLastDot=i;//keep the last dot postion
497
      }
498
    }//for
501
        String docid = null;
502
        if (accessionNumber == null) { return docid; }
503
        String seperator = getOption("accNumSeparator");
504
        int indexOfLastSeperator = accessionNumber.lastIndexOf(seperator);
505
        docid = accessionNumber.substring(0, indexOfLastSeperator);
506
        MetaCatUtil.debugMessage("after parsing accessionnumber, docid is "
507
                + docid, 30);
508
        return docid;
509
    }
499 510

  
500
    //The string formatt is wrong, because it has more than two or less than
501
    //one seperator
502
    if ( dotNumber>2 || dotNumber < 1)
511
    /**
512
     * This method will call both getDocIdFromString and
513
     * getDocIdFromAccessionNumber. So first, if the string looks str1.str2,
514
     * the docid will be str1.str2. If the string is str1.str2.str3, the docid
515
     * will be str1.str2. If the string is str1.str2.str3.str4 or more, the
516
     * docid will be str1.str2.str3. If the string look like str1, null will be
517
     * returned
518
     *  
519
     */
520
    public static String getSmartDocId(String str)
503 521
    {
504
      versionString = null;
522
        String docid = null;
523
        //call geDocIdFromString first.
524
        docid = getDocIdFromString(str);
525
        // If docid is null, try to call getDocIdFromAccessionNumber
526
        // it will handle the seperator more than2
527
        if (docid == null) {
528
            docid = getDocIdFromAccessionNumber(str);
529
        }
530
        MetaCatUtil.debugMessage("The docid get from smart docid getor is "
531
                + docid, 30);
532
        return docid;
505 533
    }
506
    else if (dotNumber == 2 && (indexOfLastDot != (str.length() -1)))
534

  
535
    /**
536
     * This method will get revision from an AccessionNumber. There is no
537
     * assumption the accessnumber will be str1.str2.str3. It can be more. So
538
     * we think the docid will be get rid of last part
539
     */
540
    public static int getRevisionFromAccessionNumber(String accessionNumber)
541
            throws NumberFormatException
507 542
    {
508
      //the case for str1.str2.str3
509
      // indexOfLastDot != (str.length() -1) means get rid of str1.str2.
510
      versionString=str.substring((indexOfLastDot+1), str.length());
543
        String rev = null;
544
        int revNumber = -1;
545
        if (accessionNumber == null) { return revNumber; }
546
        String seperator = getOption("accNumSeparator");
547
        int indexOfLastSeperator = accessionNumber.lastIndexOf(seperator);
548
        rev = accessionNumber.substring(indexOfLastSeperator + 1,
549
                accessionNumber.length());
550
        revNumber = Integer.parseInt(rev);
551
        MetaCatUtil.debugMessage("after parsing accessionnumber, rev is "
552
                + revNumber, 30);
553
        return revNumber;
511 554
    }
512
    else if (dotNumber == 1) //the case for str1.str2 or str1.str2.
555

  
556
    /**
557
     * Method to get the name of local replication server
558
     */
559
    public static String getLocalReplicationServerName()
513 560
    {
514
      versionString=null;
561
        String replicationServerName = null;
562
        String serverHost = null;
563
        serverHost = getOption("server");
564
        // append "context/servelet/replication" to the host name
565
        replicationServerName = serverHost + getOption("replicationpath");
566
        return replicationServerName;
567

  
515 568
    }
516 569

  
517
    return versionString;
518
  }//getVersionFromString
519

  
520
  /**
521
   * This method will get docid from an AccessionNumber. There is no assumption
522
   * the accessnumber will be str1.str2.str3. It can be more. So we think
523
   * the docid will be get rid of last part
524
   */
525
   public static String getDocIdFromAccessionNumber(String accessionNumber)
526
   {
527
     String docid = null;
528
     if (accessionNumber == null)
529
     {
530
       return docid;
531
     }
532
     String seperator=getOption("accNumSeparator");
533
     int indexOfLastSeperator = accessionNumber.lastIndexOf(seperator);
534
     docid=accessionNumber.substring(0, indexOfLastSeperator);
535
     MetaCatUtil.debugMessage("after parsing accessionnumber, docid is " + 
536
                              docid, 30);
537
     return docid;
538
   }
539
   
540
   /**
541
    * This method will call both getDocIdFromString and
542
    * getDocIdFromAccessionNumber. So first, if the string looks
543
    * str1.str2, the docid will be str1.str2.
544
    * If the string is str1.str2.str3, the docid will be str1.str2.
545
    * If the string is str1.str2.str3.str4 or more, the docid will be
546
    * str1.str2.str3.
547
    * If the string look like str1, null will be returned
548
    *
549
    */
550
    public static String getSmartDocId(String str)
570
    /**
571
     * Method to get docidwithrev from eml2 inline data id The eml inline data
572
     * id would look like eml.200.2.3
573
     */
574
    public static String getDocIdWithoutRevFromInlineDataID(String inlineDataID)
551 575
    {
552
      String docid = null;
553
      //call geDocIdFromString first. 
554
      docid = getDocIdFromString(str);
555
      // If docid is null, try to call getDocIdFromAccessionNumber
556
      // it will handle the seperator more than2
557
      if (docid == null)
558
      {
559
         docid = getDocIdFromAccessionNumber(str);        
560
      }
561
      MetaCatUtil.debugMessage("The docid get from smart docid getor is " +
562
                                docid, 30);
563
      return docid;
564
    }
565
   
566
    /**
567
   * This method will get revision from an AccessionNumber. There is no assumption
568
   * the accessnumber will be str1.str2.str3. It can be more. So we think
569
   * the docid will be get rid of last part
570
   */
571
   public static int getRevisionFromAccessionNumber(String accessionNumber)
572
                                        throws NumberFormatException
573
   {
574
     String rev = null;
575
     int revNumber =-1;
576
     if (accessionNumber == null)
577
     {
578
       return revNumber;
579
     }
580
     String seperator=getOption("accNumSeparator");
581
     int indexOfLastSeperator = accessionNumber.lastIndexOf(seperator);
582
     rev =accessionNumber.substring(indexOfLastSeperator+1, 
583
                                    accessionNumber.length());
584
     revNumber = Integer.parseInt(rev);
585
     MetaCatUtil.debugMessage("after parsing accessionnumber, rev is " + 
586
                               revNumber, 30);
587
     return revNumber;
588
   }
589
   
590
  
591
  /**
592
   * Method to get the name of local replication server
593
   */
594
   public static String getLocalReplicationServerName()
595
   {
596
     String replicationServerName=null;
597
     String serverHost=null;
598
     serverHost=getOption("server");
599
     // append "context/servelet/replication" to the host name
600
     replicationServerName=serverHost+getOption("replicationpath");
601
     return replicationServerName;
576
        String docidWithoutRev = null;
577
        if (inlineDataID == null) { return docidWithoutRev; }
578
        String seperator = MetaCatUtil.getOption("accNumSeparator");
579
        char charSeperator = seperator.charAt(0);
580
        int targetNumberOfSeperator = 2;// we want to know his index
581
        int numberOfSeperator = 0;
582
        for (int i = 0; i < inlineDataID.length(); i++) {
583
            // meet seperator, increase number of seperator
584
            if (inlineDataID.charAt(i) == charSeperator) {
585
                numberOfSeperator++;
586
            }
587
            // if number of seperator reach the target one, record the index(i)
588
            // and get substring and terminate the loop
589
            if (numberOfSeperator == targetNumberOfSeperator) {
590
                docidWithoutRev = inlineDataID.substring(0, i);
591
                break;
592
            }
593
        }
602 594

  
603
   }
595
        MetaCatUtil.debugMessage("Docid without rev from inlinedata id: "
596
                + docidWithoutRev, 35);
597
        return docidWithoutRev;
604 598

  
605
   /**
606
    * Method to get docidwithrev from eml2 inline data id
607
    * The eml inline data id would look like eml.200.2.3
608
    */
609
   public static String getDocIdWithoutRevFromInlineDataID(String inlineDataID)
610
   {
611
     String docidWithoutRev = null;
612
     if ( inlineDataID == null)
613
     {
614
       return docidWithoutRev;
615
     }
616
     String seperator = MetaCatUtil.getOption("accNumSeparator");
617
     char charSeperator = seperator.charAt(0);
618
     int targetNumberOfSeperator = 2;// we  want to know his index
619
     int numberOfSeperator = 0;
620
     for (int i = 0; i< inlineDataID.length(); i++)
621
     {
622
       // meet seperator, increase number of seperator
623
       if (inlineDataID.charAt(i) == charSeperator)
624
       {
625
         numberOfSeperator++;
626
       }
627
       // if number of seperator reach the target one, record the index(i)
628
       // and get substring and terminate the loop
629
       if ( numberOfSeperator == targetNumberOfSeperator)
630
       {
631
         docidWithoutRev = inlineDataID.substring(0, i);
632
         break;
633
       }
634
     }
599
    }
635 600

  
636
     MetaCatUtil.debugMessage("Docid without rev from inlinedata id: " +
637
                               docidWithoutRev, 35);
638
     return docidWithoutRev;
601
    /**
602
     * Revise stack change a stack to opposite order
603
     */
604
    public static Stack reviseStack(Stack stack)
605
    {
606
        Stack result = new Stack();
607
        // make sure the parameter is correct
608
        if (stack == null || stack.isEmpty()) {
609
            result = stack;
610
            return result;
611
        }
639 612

  
640
   }
641
   
642
   /**
643
    * Revise stack change a stack to opposite order 
644
    */
645
   public static Stack reviseStack(Stack stack)
646
   {
647
     Stack result = new Stack();
648
     // make sure the parameter is correct
649
     if (stack == null || stack.isEmpty())
650
     {
651
       result = stack;
652
       return result;
653
     }
654
     
655
     while (!stack.isEmpty())
656
     {
657
       Object obj = stack.pop();
658
       result.push(obj);
659
     }
660
     return result;
661
   }
662
  
663
  /** A method to replace whitespace in url*/
664
  public static String replaceWhiteSpaceForURL(String urlHasWhiteSpace)
665
  {
666
    StringBuffer newUrl = new StringBuffer();
667
    String whiteSpaceReplace ="%20";
668
    if (urlHasWhiteSpace == null || urlHasWhiteSpace.trim().equals(""))
669
    {
670
      return null;
613
        while (!stack.isEmpty()) {
614
            Object obj = stack.pop();
615
            result.push(obj);
616
        }
617
        return result;
671 618
    }
672 619

  
673
    for (int i=0; i<urlHasWhiteSpace.length(); i++)
620
    /** A method to replace whitespace in url */
621
    public static String replaceWhiteSpaceForURL(String urlHasWhiteSpace)
674 622
    {
675
       char ch = urlHasWhiteSpace.charAt(i);
676
       if ( !Character.isWhitespace(ch))
677
       {
678
          newUrl.append(ch);
679
       }
680
       else
681
       {
682
         //it is white sapce, replace it by %20
683
         newUrl = newUrl.append(whiteSpaceReplace);
684
       }
623
        StringBuffer newUrl = new StringBuffer();
624
        String whiteSpaceReplace = "%20";
625
        if (urlHasWhiteSpace == null || urlHasWhiteSpace.trim().equals("")) { return null; }
685 626

  
686
   }//for
687
   MetaCatUtil.debugMessage("The new string without space is:"+ 
688
                             newUrl.toString(), 35);
689
   return newUrl.toString();
627
        for (int i = 0; i < urlHasWhiteSpace.length(); i++) {
628
            char ch = urlHasWhiteSpace.charAt(i);
629
            if (!Character.isWhitespace(ch)) {
630
                newUrl.append(ch);
631
            } else {
632
                //it is white sapce, replace it by %20
633
                newUrl = newUrl.append(whiteSpaceReplace);
634
            }
690 635

  
691
  }// replaceWhiteSpaceForUR
636
        }//for
637
        MetaCatUtil.debugMessage("The new string without space is:"
638
                + newUrl.toString(), 35);
639
        return newUrl.toString();
692 640

  
641
    }// replaceWhiteSpaceForUR
642

  
693 643
}
src/edu/ucsb/nceas/metacat/QueryTerm.java
30 30

  
31 31
package edu.ucsb.nceas.metacat;
32 32

  
33
import edu.ucsb.nceas.dbadapter.*;
34

  
35
import java.io.*;
36
import java.util.Hashtable;
37
import java.util.Stack;
38 33
import java.util.Vector;
39
import java.util.Enumeration;
40 34

  
41 35
/** a utility class that represents a single term in a query */
42
public class QueryTerm {
36
public class QueryTerm
37
{
38

  
43 39
    private boolean casesensitive = false;
40

  
44 41
    private String searchmode = null;
42

  
45 43
    private String value = null;
44

  
46 45
    private String pathexpr = null;
46

  
47 47
    private boolean percentageSymbol = false;
48

  
48 49
    private int countPercentageSearchItem = 0;
49
   
50 50

  
51 51
    /**
52
     * Construct a new instance of a query term for a free text search
53
     * (using the value only)
54
     *
55
     * @param casesensitive flag indicating whether case is used to match
56
     * @param searchmode determines what kind of substring match is performed
57
     *        (one of starts-with|ends-with|contains|matches-exactly)
58
     * @param value the text value to match
52
     * Construct a new instance of a query term for a free text search (using
53
     * the value only)
54
     * 
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff