View Javadoc

1   package org.gageot.excel.core;
2   
3   import org.springframework.core.io.Resource;
4   import org.springframework.dao.support.DaoSupport;
5   
6   /***
7    * TODO.
8    */
9   public abstract class ExcelTemplateDaoSupport extends DaoSupport {
10  	private String tabName;
11  	private ExcelTemplate excelTemplate;
12  
13  	public final void setResource(Resource resource) {
14  		this.excelTemplate = createExcelTemplate (resource);
15  	}
16  
17  	public final Resource getResource() {
18  		return (null != excelTemplate) ? excelTemplate.getResource() : null;
19  	}
20  
21  	public final void setExcelTemplate(ExcelTemplate excelTemplate) {
22  		this.excelTemplate = excelTemplate;
23  	}
24  
25  	public final ExcelTemplate getExcelTemplate() {
26  		return excelTemplate;
27  	}
28  	
29  	public final String getTabName() {
30  		return tabName;
31  	}
32  
33  	public final void setTabName(String tabName) {
34  		this.tabName = tabName;
35  	}
36  	
37  	protected ExcelTemplate createExcelTemplate (Resource resource) {
38  		return new ExcelTemplate (resource);
39  	}
40  
41  	protected final void checkDaoConfig() {
42  		if (this.excelTemplate == null) {
43  			throw new IllegalArgumentException ("resource or excelTemplate is required");
44  		}
45  	}	
46  }