Source code: com/flexstor/ejb/search/SearchInstance.java
1 /*
2 * SearchInstance.java
3 *
4 * Copyright $Date: 2003/08/11 02:22:38 $ FLEXSTOR.net Inc.
5 *
6 * This work is licensed for use and distribution under license terms found at
7 * http://www.flexstor.org/license.html
8 *
9 */
10
11 package com.flexstor.ejb.search;
12
13 import java.util.ArrayList;
14 import java.util.Vector;
15
16 import com.flexstor.common.data.ejb.Data;
17
18 /**
19 * This class contains information about a search. All criteria
20 * constructed during a search setup have an associated Instance.
21 * For example: I build a search with an array of SearchCriteria.
22 * It is organized in the following manner:
23 * <br><b>Basic->FullText->Vir</b><br>
24 * I would have three search Instances, each relation existing based
25 * upon the relation in the criteria. All statements are executed during a
26 * search are executed one at a time and appended. The next instance is then
27 * executed and the Current Result Set is either AND/OR with the new Result
28 * Set. The Set produced from this relation is used for the next instance...
29 *
30 * @author Daniel Nickel
31 * @version 1.0, 3/15/00
32 *
33 * @since FLEXSTOR.db 3.0
34 */
35
36 public class SearchInstance
37 extends Data
38 {
39 // MKS macro expander
40 public final static String IDENTIFIER = "$Id: SearchInstance.java,v 1.2 2003/08/11 02:22:38 aleric Exp $";
41
42 // This will hold the sqls for this instance.
43 // In the search, all sqls are or'd together
44 private String[] sqlStmts = null;
45
46
47 // This will hold the relation between this and the next search ( AND/OR )
48 private int relation = 0;
49 //For each bucket, holds an array list of field Ids (Integer) for lu fields. If it is not a lookup field, a zero is inserted, if it is a lookup, the disguise field id is inserted
50 private Vector bucketLUFields = null;
51 //Holds the string parameters needed for the sqlstatement.
52 private ArrayList alStringParams = null;
53
54 /**
55 * Constructor: Default
56 */
57
58 public SearchInstance( String[] sqls, int relation, Vector vBuckLUFields, ArrayList alStringParams)
59 {
60 sqlStmts = sqls;
61 this.relation = relation;
62 this.bucketLUFields = vBuckLUFields;
63 this.alStringParams = alStringParams;
64 }
65
66 /**
67 * This will return the statements for this instance of the search.
68 * All statements are Or'd together
69 */
70 public String[] getStatements()
71 {
72 return sqlStmts;
73 }
74
75
76 /**
77 *This will return the array list of strings for a particular sqlStatement
78 */
79 public ArrayList getStringParams()
80 {
81 return alStringParams;
82 }
83
84 /**
85 * The relation for this instance is AND/OR. This is the relation
86 * between this instance and the next instance.
87 */
88 public int getRelation()
89 {
90 return this.relation;
91 }
92
93 public Vector getBucketLUFields()
94 {
95 return bucketLUFields;
96 }
97
98 public void setBucketLUFields(Vector myIDs)
99 {
100 bucketLUFields = myIDs;
101 }
102 }