01: /*
02: LoaderGenerator - tool for generated xml, sql and doml file needed for Octopus.
03:
04:
05: Copyright (C) 2003 Together
06:
07: This library is free software; you can redistribute it and/or
08: modify it under the terms of the GNU Lesser General Public
09: License as published by the Free Software Foundation; either
10: version 2.1 of the License, or (at your option) any later version.
11:
12: This library is distributed in the hope that it will be useful,
13: but WITHOUT ANY WARRANTY; without even the implied warranty of
14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: Lesser General Public License for more details.
16:
17: You should have received a copy of the GNU Lesser General Public
18: License along with this library; if not, write to the Free Software
19: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20: */
21:
22: package org.webdocwf.util.loader;
23:
24: import java.sql.*;
25: import java.util.*;
26:
27: /**
28: *
29: * QuerySet class sets the first part of sql statement
30: * table_Name
31: * @author Radoslav Dutina
32: * @version 1.0
33: */
34: public class QuerySet {
35:
36: private String strQuery = new String("select ");
37: private String oidColumnName = "oid";
38: private String versionColumnName = "version";
39:
40: /**
41: * Construct object QuerySet with associated parameters.
42: * @param iTableInt is the number of target table.
43: * @param bOidLogicCurrentTable is boolean which decide odi logic
44: * @param isTOS is boolean which decide odi logic
45: * @param vecColumnNames is vector of column names in a target table.
46: * @param vecTableTableName is vector of source (target) table names.
47: */
48: public QuerySet(int iTableInt, boolean bOidLogicCurrentTable,
49: boolean isTOS, Vector vecColumnNames,
50: Vector vecTableTableName, String oidColumnName,
51: String 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 + ", "
63: + this .versionColumnName + " ";
64: }
65: }
66:
67: for (int i = 0; i < vecColumnNames.size(); i++) {
68: if (strQuery.length() > 9)
69: strQuery = strQuery + ", "
70: + vecColumnNames.get(i).toString();
71: else
72: strQuery = strQuery + " "
73: + vecColumnNames.get(i).toString();
74: }
75: strQuery += " from "
76: + vecTableTableName.get(iTableInt).toString();
77:
78: }
79:
80: /**
81: * This method read value of strQuery parameter
82: * @return value of parameter
83: */
84: public String getQuerySet() {
85: return this.strQuery;
86: }
87:
88: }
|