View Javadoc
1 /*** 2 LoaderGenerator - tool for generated xml, sql and doml file needed for Octopus. 3 4 5 Copyright (C) 2003 Together 6 7 This library is free software; you can redistribute it and/or 8 modify it under the terms of the GNU Lesser General Public 9 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.transformation; 23 24 import java.util.Vector; 25 26 import org.webdocwf.util.loader.ConfigReader; 27 import org.webdocwf.util.loader.LoaderException; 28 29 /*** 30 * 31 * QueryTransformationSet class sets the query statement for constant columns 32 * @author unascribed 33 * @version 1.0 34 * @author Zeljko Kovacevic 35 */ 36 public class QueryTransformationSet { 37 38 private String strQueryTransformation = null; 39 private Vector indexDummyOverwrite = new Vector(); 40 private Vector indexDummyNull = new Vector(); 41 private Vector indexDummyUpdate = new Vector(); 42 private ConfigReader targetConfigReader; 43 /*** 44 * Construct object QueryTransformationSet class with associated parameters 45 * @param tableName current table name 46 * @param vecTransformationColumns vector of tarnsformation column names 47 * @param vecTransformationValueMode vector of tarnsformation column modes 48 * @param vecTransformationType vector of tarnsformation column types 49 * @param targetConfigReader is ConfigReader object for target database 50 */ 51 public QueryTransformationSet( 52 String tableName, 53 Vector vecTransformationColumns, 54 Vector vecTransformationValueMode, 55 Vector vecTransformationType, ConfigReader targetConfigReader) throws LoaderException { 56 strQueryTransformation = "update " + tableName + " set "; 57 for (int i = 0; i < vecTransformationColumns.size(); i++) { 58 if (vecTransformationValueMode.get(i).toString().equalsIgnoreCase("Overwrite")) { 59 //ZK change this from CheckType to targetConfigReader 60 try { 61 if (!targetConfigReader.isNumber(vecTransformationType.get(i).toString())) { 62 strQueryTransformation 63 += vecTransformationColumns.get(i).toString() 64 + " = " 65 + "'dummyTransformationOver'" 66 + ", "; 67 } else { 68 strQueryTransformation 69 += vecTransformationColumns.get(i).toString() 70 + " = " 71 + "dummyTransformationOver" 72 + ", "; 73 } 74 75 } catch (LoaderException e) { 76 LoaderException le = new LoaderException("Exception:Type not present in conf file for target database, add it into conf file.",(Throwable)e); 77 throw le; 78 } 79 indexDummyOverwrite.add(String.valueOf(i)); 80 } else if (vecTransformationValueMode.get(i).toString().equalsIgnoreCase("SetNull")) { 81 strQueryTransformation+="dummyTransformationNull, "; 82 indexDummyNull.add(String.valueOf(i)); 83 }else if (vecTransformationValueMode.get(i).toString().equalsIgnoreCase("Update")){ 84 indexDummyUpdate.add(String.valueOf(i)); 85 } 86 } 87 } 88 89 /*** 90 * This method read value of strQueryTransformation parameter 91 * @return value of parameter 92 */ 93 public String getQueryTransformation() { 94 return strQueryTransformation; 95 } 96 97 /*** 98 * This method read value from indexDummyOverwrite parameter 99 * @return value of parameter 100 */ 101 public Vector getIndexDummyOverwrite() { 102 return indexDummyOverwrite; 103 } 104 105 /*** 106 * This method read value from indexDummyNull parameter 107 * @return value of parameter 108 */ 109 public Vector getIndexDummyNull() { 110 return indexDummyNull; 111 } 112 /*** 113 * This method read value from indexDummyUpdate parameter 114 * @return value of parameter 115 */ 116 public Vector getIndexDummyUpdate() { 117 return indexDummyUpdate; 118 } 119 }

This page was automatically generated by Maven