View Javadoc
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.util.*; 26 import java.sql.*; 27 28 /*** 29 * 30 * QueryConstantSet class sets the query statement for constant columns 31 * @author unascribed 32 * @version 1.0 33 */ 34 public class QueryConstantSet { 35 36 private String strQueryConstant=null; 37 private Vector indexDummyOverwrite=new Vector(); 38 private Vector indexDummyNull=new Vector(); 39 40 /*** 41 * Construct object QueryConstantSet class with associated parameters 42 * @param tableName current table name 43 * @param vecConstantColumns vector of constant column names 44 * @param vecConstantMode vector of constant column modes 45 * @param vecConstantType vector of constant column types 46 */ 47 public QueryConstantSet(String tableName,Vector vecConstantColumns, 48 Vector vecConstantMode, Vector vecConstantType, ConfigReader configReaderTarget) throws LoaderException{ 49 50 strQueryConstant="update "+ tableName+ " set "; 51 for(int i=0;i<vecConstantColumns.size();i++){ 52 if(vecConstantMode.get(i).toString().equalsIgnoreCase("Overwrite") 53 || vecConstantMode.get(i).toString().equalsIgnoreCase("Key")){ 54 //ZK change this 7.5 2004 from CheckType to configReaderTarget 55 try { 56 if(!configReaderTarget.isNumber(vecConstantType.get(i).toString())){ 57 strQueryConstant += vecConstantColumns.get(i).toString() 58 + " = " + "'dummyConstantOver'"+", "; 59 }else{ 60 strQueryConstant += vecConstantColumns.get(i).toString() 61 + " = " + "dummyConstantOver"+", "; 62 } 63 } catch (LoaderException e) { 64 LoaderException le = new LoaderException("Exception:Type not present in conf file for target database, add it into conf file.",(Throwable)e); 65 throw le; 66 } 67 indexDummyOverwrite.add(String.valueOf(i)); 68 }else if(vecConstantMode.get(i).toString().equalsIgnoreCase("Update")|| 69 vecConstantMode.get(i).toString().equalsIgnoreCase("SetNull")){ 70 //ZK change this 7.5 2004 from CheckType to configReaderTarget 71 try { 72 if(!configReaderTarget.isNumber(vecConstantType.get(i).toString())){ 73 strQueryConstant += vecConstantColumns.get(i).toString() 74 + " = " + "'dummyConstantNull'"+", "; 75 }else{ 76 strQueryConstant += vecConstantColumns.get(i).toString() 77 + " = " + "dummyConstantNull"+", "; 78 } 79 } catch (LoaderException e) { 80 LoaderException le = new LoaderException("Exception:Type not present in conf file for target database, add it into conf file.",(Throwable)e); 81 throw le; 82 } 83 indexDummyNull.add(String.valueOf(i)); 84 } 85 } 86 } 87 88 /*** 89 * This method read value of strQueryConstant parameter 90 * @return value of parameter 91 */ 92 public String getQueryConstant(){ 93 return strQueryConstant; 94 } 95 96 /*** 97 * This method read value from indexDummyOverwrite parameter 98 * @return value of parameter 99 */ 100 public Vector getIndexDummyOverwrite(){ 101 return indexDummyOverwrite; 102 } 103 104 /*** 105 * This method read value from indexDummyNull parameter 106 * @return value of parameter 107 */ 108 public Vector getIndexDummyNull(){ 109 return indexDummyNull; 110 } 111 112 113 114 115 }

This page was automatically generated by Maven