📄 querytransformationset.java
字号:
/**
LoaderGenerator - tool for generated xml, sql and doml file needed for Octopus.
Copyright (C) 2003 Together
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.webdocwf.util.loader.transformation;
import java.util.Vector;
import org.webdocwf.util.loader.ConfigReader;
import org.webdocwf.util.loader.LoaderException;
/**
*
* QueryTransformationSet class sets the query statement for constant columns
* @author unascribed
* @version 1.0
* @author Zeljko Kovacevic
*/
public class QueryTransformationSet {
private String strQueryTransformation = null;
private Vector indexDummyOverwrite = new Vector();
private Vector indexDummyNull = new Vector();
private Vector indexDummyUpdate = new Vector();
private ConfigReader targetConfigReader;
/**
* Construct object QueryTransformationSet class with associated parameters
* @param tableName current table name
* @param vecTransformationColumns vector of tarnsformation column names
* @param vecTransformationValueMode vector of tarnsformation column modes
* @param vecTransformationType vector of tarnsformation column types
* @param targetConfigReader is ConfigReader object for target database
*/
public QueryTransformationSet(
String tableName,
Vector vecTransformationColumns,
Vector vecTransformationValueMode,
Vector vecTransformationType, ConfigReader targetConfigReader) throws LoaderException {
strQueryTransformation = "update " + tableName + " set ";
for (int i = 0; i < vecTransformationColumns.size(); i++) {
if (vecTransformationValueMode.get(i).toString().equalsIgnoreCase("Overwrite")) {
//ZK change this from CheckType to targetConfigReader
try {
if (!targetConfigReader.isNumber(vecTransformationType.get(i).toString())) {
strQueryTransformation
+= vecTransformationColumns.get(i).toString()
+ " = "
+ "'dummyTransformationOver'"
+ ", ";
} else {
strQueryTransformation
+= vecTransformationColumns.get(i).toString()
+ " = "
+ "dummyTransformationOver"
+ ", ";
}
} catch (LoaderException e) {
LoaderException le = new LoaderException("Exception:Type not present in conf file for target database, add it into conf file.",(Throwable)e);
throw le;
}
indexDummyOverwrite.add(String.valueOf(i));
} else if (vecTransformationValueMode.get(i).toString().equalsIgnoreCase("SetNull")) {
strQueryTransformation+="dummyTransformationNull, ";
indexDummyNull.add(String.valueOf(i));
}else if (vecTransformationValueMode.get(i).toString().equalsIgnoreCase("Update")){
indexDummyUpdate.add(String.valueOf(i));
}
}
}
/**
* This method read value of strQueryTransformation parameter
* @return value of parameter
*/
public String getQueryTransformation() {
return strQueryTransformation;
}
/**
* This method read value from indexDummyOverwrite parameter
* @return value of parameter
*/
public Vector getIndexDummyOverwrite() {
return indexDummyOverwrite;
}
/**
* This method read value from indexDummyNull parameter
* @return value of parameter
*/
public Vector getIndexDummyNull() {
return indexDummyNull;
}
/**
* This method read value from indexDummyUpdate parameter
* @return value of parameter
*/
public Vector getIndexDummyUpdate() {
return indexDummyUpdate;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -