roaddefectexport.java

来自「Java的框架」· Java 代码 · 共 110 行

JAVA
110
字号
package mcaps.apps.prrm.roaddefect.dao.jdbc.query;

import javax.sql.DataSource;

import mcaps.apps.prrm.roaddefect.dao.util.RoadDefectField;
import mcap.core.base.dao.jdbc.SQLExport;
import mcap.core.base.dao.util.SortOrder;

/**
 * The class that extends the SQLExport class to customize
 * the export query for road defect table.
 * 
 * @author jov
 * @date Sep 23, 2005
 * @version 1.0.1.0
 */
public class RoadDefectExport extends SQLExport{

	/**
	 * The default constructor that accepts datasource and table name.
	 * @param ds the datasource object
	 * @param tableName the table in which the export operation executes upon
	 */
   public RoadDefectExport(DataSource ds,String tableName) {
  	super(ds,tableName);
	}

 	/**
 	 * The constructor that accepts datasource and table name along with 
 	 * additional parameters like sort column name and sort order for
 	 * sorting the query result.
 	 * @param ds the datasource object
 	 * @param tableName the table in which the export operation executes upon
 	 * @param sortColName the name of the column used for sorting
 	 * @param order the sort order
 	 */
	public RoadDefectExport(DataSource ds,String tableName,
													String sortColName,SortOrder order) {
  	super(ds,tableName,sortColName,order);
	}

	/**
	 * The constructor that accepts datasource and table name along with 
	 * additional parameters like sort column name array and sort order array 
	 * for sorting the query result.
	 * @param ds the datasource object
	 * @param tableName the table in which the export operation executes upon
	 * @param sortColNameArray the array of the sort column name
	 * @param orderArray the array of the sort order based on the column name
	 */
	public RoadDefectExport(DataSource ds,String tableName,
													String[] sortColNameArray,SortOrder[] orderArray) {
  	super(ds,tableName,sortColNameArray,orderArray);
	}

	/**
	 * The constructor that accepts datasource and table name and whereclause 
	 * to further refine the export query.
	 * @param ds the datasource object
	 * @param tableName the table in which the export operation executes upon
	 * @param whereClause sql where clause to refine the export query
	 */
	public RoadDefectExport(DataSource ds,String tableName,
													String whereClause){
	  	super(ds,tableName,whereClause);
	}
	
	//========================================================================================

	//Override the parent implementation that uses <tablename>.*
	/* (non-Javadoc)
	 * @see mcapss.prrm.base.dao.jdbc.SQLExport#getSelectFields()
	 */
	protected String getSelectFields(){
		StringBuffer sb = new StringBuffer();
		for (int i = 0; i<RoadDefectField.FIELDS.length; i++){
			sb.append(RoadDefectField.FIELDS[i]);
			if (i >= RoadDefectField.FIELDS.length-1){
				sb.append(" ");
			}else{
				sb.append(", ");
			}
		}
		return sb.toString();
	}
	

//========================================================================

//	public void doExecute(String fileName, Date startDate, Date endDate) {
//		int idx = -1;
//		//Replace
//		if ((startDate != null) && (endDate != null)){
//			lastIdx = sql.lastIndexOf("?");
//			sql.replace(sql.substring(idx),new Timestamp(endDate.getTime()));
//			if (lastIdx.)
//		}else if ((startDate != null) && (endDate == null)){
//			
//		}else if ((startDate == null) && (endDate != null)){
//		
//		}
//		sql = sql.replaceFirst("?",fileName);
//		doExecute(fileName);
//	}

//========================================================================================


}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?