All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nfwork.dbfound.model.bean.ExcelReader Maven / Gradle / Ivy

There is a newer version: 4.2.4
Show newest version
package com.nfwork.dbfound.model.bean;

import java.util.List;
import java.util.Map;

import org.apache.commons.fileupload.FileItem;

import com.nfwork.dbfound.core.Context;
import com.nfwork.dbfound.exception.ParamNotFoundException;

public class ExcelReader extends SqlEntity {

	private static final long serialVersionUID = -9013279323716030635L;

	private String sourceParam;
	private String rootPath;

	@SuppressWarnings("unchecked")
	@Override
	public void execute(Context context, Map params,
			String provideName){
		Param param = params.get(sourceParam);
		if (param == null) {
			throw new ParamNotFoundException("param: " + sourceParam + " 没有定义");
		}
		Object ofile = param.getValue();
		if (ofile != null) {
			FileItem item = (FileItem) ofile;
			List> datas = com.nfwork.dbfound.excel.ExcelReader
					.readExcel(item);
			context.setData(rootPath, datas);
		}
	}

	public String getSourceParam() {
		return sourceParam;
	}

	public void setSourceParam(String sourceParam) {
		this.sourceParam = sourceParam;
	}

	public String getRootPath() {
		return rootPath;
	}

	public void setRootPath(String rootPath) {
		this.rootPath = rootPath;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy