📄 dictmanager.java
字号:
/*
* Created on 2004-3-25
*
*/
package com.esimple.service.dict;
import java.util.*;
import org.springframework.beans.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.esimple.service.dict.po.*;
import com.esimple.framework.dao.ibatis.BaseSqlMapClientDaoImpl;
/**
* @author steven
*
*/
public class DictManager {
public static final String BEAN_CONFIG_NAME="dictManager";
private Log logger = LogFactory.getLog(DictManager.class);
private DictDataCache cache;//数据字典内容缓存
private BaseSqlMapClientDaoImpl sqlMapDao;
public void setCache(DictDataCache cache){
this.cache = cache;
}
public DictDataCache getCache(){
return this.cache;
}
public BaseSqlMapClientDaoImpl getSqlMapDao() {
return this.sqlMapDao;
}
public void setSqlMapDao(BaseSqlMapClientDaoImpl sqlMapDao) {
this.sqlMapDao = sqlMapDao;
}
public String getDictType(String typeID){
return cache.getDictType(typeID);
}
public HashMap getDictContent(String typeID){
return cache.getDictContent(typeID);
}
public String getDictContent(String typeID,String contentID){
return cache.getDictContent(typeID,contentID);
}
public void load() throws FatalBeanException{
cache =new DictDataCache();
try{
//clear cache
cache.clear();
//read dict
getTypes();
getItems();
}catch(Exception e){
logger.debug(e);
throw new FatalBeanException("error in DictManager init",e);
}
}
private void getTypes() {
List list = sqlMapDao.query("EBS.Dict.getAllDictTypes",null);
Iterator iter = list.iterator();
while ( iter.hasNext() ) {
DictType type = (DictType) iter.next();
logger.debug(type.getBusintypeid()+":" +type.getBusintypename());
cache.addDictType(type.getBusintypeid(),type.getBusintypename());
}
}
private void getItems(){
List list = sqlMapDao.query("EBS.Dict.getAllDictItems",null);
Iterator iter = list.iterator();
while ( iter.hasNext() ) {
DictItem content = (DictItem)iter.next();
cache.addDictContent(
content.getBusintypeid(),
content.getBusinid(),
content.getBusinname() );
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -