1 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 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 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 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 93 public String getQueryTransformation() { 94 return strQueryTransformation; 95 } 96 97 101 public Vector getIndexDummyOverwrite() { 102 return indexDummyOverwrite; 103 } 104 105 109 public Vector getIndexDummyNull() { 110 return indexDummyNull; 111 } 112 116 public Vector getIndexDummyUpdate() { 117 return indexDummyUpdate; 118 } 119 } | Popular Tags |