View Javadoc
1 /*** 2 Copyright (C) 2002-2003 Together 3 4 This library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 9 This library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public 15 License along with this library; if not, write to the Free Software 16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 18 */ 19 20 package org.webdocwf.util.loader; 21 22 import java.util.*; 23 import java.sql.*; 24 25 /*** 26 * Class used while building relations in target tables 27 * 28 * @author Radoslav Dutina 29 * @version 1.1 30 */ 31 public class QueryRelationSet { 32 33 private String strQueryRelations = ""; 34 private Vector indexDummyRelationNull= new Vector(); 35 private Vector indexDummyRelationOver= new Vector(); 36 private Vector vecTempRelationSourceType=new Vector(); 37 private String tableName=null; 38 private String tableID=null; 39 40 /*** 41 * Construct object of QueryRelationSet class with an associated parameters. 42 * @param iRelationColumns defines number of relation column 43 * @param vecRelationColumnSourceTableName defines source table name for relations 44 * @param vecRelationColumnSourceTableID defines source table ID for relations 45 * @param vecVariableUseIDTableName defines variable ID name 46 * @param vecVariableUseIDTableID defines variable ID 47 * @param vecRelationColumnSourceColumnName defines cource column names for relations 48 * @param iTargetFirstColumnResult defines parameter of ResultSet object 49 * @param stmtTarget defines statement object for target table 50 * @param tableID is table ID 51 * @param vecRelationColumnTargetTableID defines target table ID for relations 52 * @param tableName is name of the current table 53 */ 54 public QueryRelationSet(int iRelationColumns, Vector vecRelationColumnSourceTableName, 55 Vector vecRelationColumnSourceTableID, Vector vecVariableUseIDTableName, 56 Vector vecVariableUseIDTableID, Vector vecRelationColumnSourceColumnName, 57 int iTargetFirstColumnResult, Statement stmtTarget, String tableID, 58 Vector vecRelationColumnTargetTableID, String tableName) { 59 60 ResultSet rsetTarget; 61 this.tableName=tableName; 62 this.tableID=tableID; 63 for (int i = 0; i < iRelationColumns; i++) { 64 outLoop: if (vecRelationColumnSourceTableName.get(i).toString().equalsIgnoreCase(tableName) 65 && vecRelationColumnSourceTableID.get(i).toString().equalsIgnoreCase(tableID)) { 66 for (int m = 0; m < vecVariableUseIDTableName.size(); m++) { 67 if (vecRelationColumnSourceTableName.get(i).toString().equalsIgnoreCase(vecVariableUseIDTableName.get(m).toString()) 68 && vecRelationColumnSourceTableID.get(i).toString().equalsIgnoreCase(vecVariableUseIDTableID.get(m).toString())) { 69 String strQueryRelations = "select " 70 + vecRelationColumnSourceColumnName.get(i).toString() 71 + " from " + vecRelationColumnSourceTableName.get(i).toString(); 72 try{ 73 rsetTarget = stmtTarget.executeQuery(strQueryRelations); 74 rsetTarget.next(); 75 if (iTargetFirstColumnResult ==1) { 76 this.vecTempRelationSourceType.add(rsetTarget.getMetaData().getColumnTypeName(1)); 77 }else { 78 this.vecTempRelationSourceType.add(rsetTarget.getMetaData().getColumnTypeName(0)); 79 } 80 rsetTarget.close(); 81 break outLoop; 82 }catch(Exception e){ 83 e.getMessage(); 84 } 85 } 86 } 87 String strQueryRelations = "select " + vecRelationColumnSourceColumnName.get(i).toString() 88 + " from " + vecRelationColumnSourceTableName.get(i).toString(); 89 try{ 90 rsetTarget = stmtTarget.executeQuery(strQueryRelations); 91 rsetTarget.next(); 92 if (iTargetFirstColumnResult == 1) { 93 vecTempRelationSourceType.add(rsetTarget.getMetaData().getColumnTypeName(1)); 94 } 95 else { 96 vecTempRelationSourceType.add(rsetTarget.getMetaData().getColumnTypeName(0)); 97 rsetTarget.next(); 98 } 99 }catch(Exception e){ 100 e.getMessage(); 101 } 102 } 103 } 104 } 105 106 /*** 107 * This method read value of vecTempRelationSourceType parameter 108 * @return value of parameter 109 */ 110 public Vector getRelationSourceType(){ 111 return vecTempRelationSourceType; 112 } 113 114 115 /*** 116 * This method read value of strQueryRelations parameter 117 * @return value of parameter 118 */ 119 public String getQueryRelations(){ 120 return strQueryRelations; 121 } 122 123 /*** 124 * This method read value of indexDummyRelationNull parameter 125 * @return value of parameter 126 */ 127 public Vector getIndexDummyRelationNull(){ 128 return indexDummyRelationNull; 129 } 130 131 /*** 132 * This method read value of indexDummyRelationOver parameter 133 * @return value of parameter 134 */ 135 public Vector getIndexDummyRelationOver(){ 136 return indexDummyRelationOver; 137 } 138 139 }

This page was automatically generated by Maven