KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > webdocwf > util > loader > QuerySet


1
2 /*
3 LoaderGenerator - tool for generated xml, sql and doml file needed for Octopus.
4
5
6     Copyright (C) 2003 Together
7
8     This library is free software; you can redistribute it and/or
9     modify it under the terms of the GNU Lesser General Public
10     License as published by the Free Software Foundation; either
11     version 2.1 of the License, or (at your option) any later version.
12
13     This library is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16     Lesser General Public License for more details.
17
18     You should have received a copy of the GNU Lesser General Public
19     License along with this library; if not, write to the Free Software
20     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */

22
23 package org.webdocwf.util.loader;
24
25 import java.sql.*;
26 import java.util.*;
27
28 /**
29  *
30  * QuerySet class sets the first part of sql statement
31  * table_Name
32  * @author Radoslav Dutina
33  * @version 1.0
34  */

35 public class QuerySet {
36
37   private String JavaDoc strQuery = new String JavaDoc("select ");
38   private String JavaDoc oidColumnName="oid";
39   private String JavaDoc versionColumnName="version";
40
41   /**
42    * Construct object QuerySet with associated parameters.
43    * @param iTableInt is the number of target table.
44    * @param bOidLogicCurrentTable is boolean which decide odi logic
45    * @param isTOS is boolean which decide odi logic
46    * @param vecColumnNames is vector of column names in a target table.
47    * @param vecTableTableName is vector of source (target) table names.
48    */

49   public QuerySet(int iTableInt, boolean bOidLogicCurrentTable, boolean isTOS,
50                   Vector vecColumnNames, Vector vecTableTableName,
51                  String JavaDoc oidColumnName, String JavaDoc versionColumnName ) {
52
53   this.oidColumnName=oidColumnName;
54   this.versionColumnName=versionColumnName;
55
56    if (bOidLogicCurrentTable) {
57       if(isTOS){
58 // strQuery = strQuery + "oid ";
59
strQuery = strQuery + this.oidColumnName+" ";
60       }else{
61 // strQuery = strQuery + "oid, version ";
62
strQuery = strQuery + this.oidColumnName+", "+this.versionColumnName+" ";
63       }
64     }
65
66     for (int i = 0; i < vecColumnNames.size(); i++) {
67       if(strQuery.length()>9)
68         strQuery = strQuery+ ", " + vecColumnNames.get(i).toString();
69       else
70         strQuery = strQuery+ " " + vecColumnNames.get(i).toString();
71     }
72     strQuery += " from " + vecTableTableName.get(iTableInt).toString();
73
74   }
75
76   /**
77    * This method read value of strQuery parameter
78    * @return value of parameter
79    */

80   public String JavaDoc getQuerySet(){
81     return this.strQuery;
82   }
83
84 }
85
Popular Tags