日期:2014-05-20 浏览次数:20832 次
/**
* 功能:生成下载配置文件
* */
@SuppressWarnings("unchecked")
public StringBuffer buildTemplate(Object[] htmlTag,String template,String downloadPath,String shellBasePath,String shellId){
HashMap<String,String> headMap = (HashMap<String,String>)htmlTag[0];
ArrayList<HashMap<String,String>> bodyList = (ArrayList<HashMap<String,String>>)htmlTag[1];
StringBuffer downloadConfig = new StringBuffer();
if(downloadPath.indexOf(downloadPath.length()-1) == -1){
downloadPath = downloadPath + File.separator;
}
for(Iterator<HashMap<String,String>> it = bodyList.iterator();it.hasNext();){
HashMap<String,String> bodyMap = it.next();
StringBuffer config = new StringBuffer()
.append(template.replace("{nTag}", bodyMap.get("<N>"))//<N>
.replace("{pTag}", bodyMap.get("<P>") == null ? "" : bodyMap.get("<P>"))//<P>
.replace("{fTag}", headMap.get("<F>") == null ? "" : headMap.get("<F>"))//<F>
.replace("{xTag}", bodyMap.get("<X>") == null ? "" : bodyMap.get("<X>"))//<X>
.replace("{uTag}", bodyMap.get("<U>") == null ? "" : bodyMap.get("<U>"))//<U>
.replace("{cTag}", bodyMap.get("<C>") == null ? "" : bodyMap.get("<C>"))//<C>
.replace("{peTag}", bodyMap.get("<PE>") == null ? "" : bodyMap.get("<PE>"))//<PE>
.replace("{usTag}", bodyMap.get("<US>") == null ? "" : bodyMap.get("<US>"))//<PE>
.replace("{ueTag}", bodyMap.get("<UE>") == null ? "" : bodyMap.get("<UE>"))//<PE>
.replace("{explodeIdTag}", bodyMap.get("<EXPLODEID>") == null ? "" : bodyMap.get("<EXPLODEID>"))
.replace("{sTag}", downloadPath)//下载路径
.replace("{bTag}", shellBasePath) //生成下载文件脚本地址