ExportTAData.java 2.9 KB
Newer Older
TongZuu committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
/*
 * Created on 23 .. 2549
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.csc.library.cscexport;

import com.csc.library.utilities.MyLog;
import java.util.Properties;

import org.apache.log4j.Logger;

import com.csc.library.cscexport.ExportXml;
import com.csc.library.cscexport.MyExport;
import com.csc.library.cscexport.TransferEmployeeToBank;
import com.csc.library.session.DbInquiry;
import com.csc.library.session.InitialEnvironment;
import com.csc.library.utilities.DbXml;
import com.csc.library.utilities.UProfile;

/**
 * @author SassyBoy100
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class ExportTAData extends MyExport {
	final static private Logger logger = Logger.getLogger(TransferEmployeeToBank.class);
	public ExportTAData() {
	}	
	/**
	 * <PRE>
	 * Overide ʹ process 
	 *  ͵Ǩͺ ͹зӡ export 
	 * </PRE>
	 * @see com.csc.library.cscexport.MyExport#process(String)
	 */
	public boolean process(String conid) throws Exception {
		this.initValue(conid);
		// new writefile for write text main process
		DbInquiry inq = this.getDbInq();
		String filter = inq.getFilter();
		MyLog.debug(this, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SCREEN FILTER IS:" + filter + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
		String exportDir = new InitialEnvironment("GLOBAL").getValue("export-dir");
		this.setExpXml(new ExportXml(exportDir + "REPORT/EXPORT/XML/" +this.getCondition().get("SCREEN").toString()));
		if (this.getExpXml().getRequiryFound()!=null){
			if (this.getExpXml().getRequiryFound().equalsIgnoreCase("true")){
				inq.setRequiredFound(true);
			}
		}
		inq.refresh();
		this.setDbInq(inq);		
		this.setExportFile(conid+ "." + this.getExpXml().getFileType()); // follow by report id
		String appName = (String) this.getUp().get("appname");
		this.setOutFile(exportDir+"/"+appName+"/REPORT/" + this.getExportFile());
		return super.process();
	}
	/**
	 * @see com.csc.library.cscexport.MyExport#initValue(String)
	 */
	protected boolean initValue(String conid) {
		try {
			this.setConid(conid);
			MyLog.debug(this, "!!!!!!!!!!!!!!!!!!!!!!! PARAM BEFORE EXPORT IS:" + this.getCondition() + "!!!!!!!!!!!!!!!!!!!!!!!");
			this.setUp((UProfile) this.getCondition().get("UPROFILE"));
			this.setFilter((Properties) this.getCondition().get("FILTER"));
			
			this.setDbInq(new DbXml(this.getUp(), (String) this.getCondition().get("SCREEN"), "", "", "", this.condition).getInquiry());
			this.setInquiryFilter();
			this.setExportPath(new InitialEnvironment("GLOBAL").getValue("exportglfile-dir"));
			this.setOutFile(this.getExportPath() + this.getExportFile());
			return true;
		} catch (Exception e) {
			MyLog.error(this, e);
			return false;
		}
	}
}