package com.vci.web.other;
|
|
import com.vci.corba.portal.data.PLAction;
|
import com.vci.corba.portal.data.PLActionCls;
|
import com.vci.corba.portal.data.PLActionParam;
|
|
import java.io.Serializable;
|
import java.util.ArrayList;
|
import java.util.HashMap;
|
import java.util.Map.Entry;
|
|
|
public class ExportBeans implements Serializable{
|
private static final long serialVersionUID = 10086L;
|
private HashMap<String/*ActionId*/,PLAction> PLActionBeans = new HashMap<String,PLAction>();
|
private HashMap<String/*分类名称*/,String/*id*/> PLActionClsExt = new HashMap<String,String>();
|
private HashMap<String/*id*/,PLActionCls> PLActionClsBeans = new HashMap<String,PLActionCls>();
|
private HashMap<String/*Action编码*/, ArrayList<PLActionParam> > PLActionParamBeans = new HashMap<String, ArrayList<PLActionParam> >();
|
private HashMap<String/*ActionCls编码*/, ArrayList<PLAction> > PLActionListsMap = null;
|
private ExportActionLogBean logBean = null;//日志文件
|
|
public ExportBeans() {
|
|
logBean = new ExportActionLogBean();
|
}
|
public HashMap<String, PLActionCls> getPLActionClsBeans() {
|
return PLActionClsBeans;
|
}
|
public HashMap<String, PLAction> getPLActions() {
|
return PLActionBeans;
|
}
|
|
public void addPLActionClsBean(PLActionCls pLActionCls){
|
PLActionClsBeans.put(pLActionCls.id, pLActionCls);
|
PLActionClsExt.put(pLActionCls.name,pLActionCls.id);
|
|
}
|
public PLActionCls getPLActionClsBeanById(String id){
|
return PLActionClsBeans.get(id);
|
}
|
public PLActionCls getPLActionClsBeanByName(String name){
|
if(PLActionClsExt.get(name) == null){
|
return null;
|
}
|
return PLActionClsBeans.get(PLActionClsExt.get(name));
|
}
|
/**
|
* 添加PLActionBean并同时添加PLActionBean对应参数进行记录
|
* @param pLAction
|
*/
|
// public void addPLActionBean(PLAction pLAction){
|
// this.addPLActionBean(pLAction,null);
|
// }
|
/**
|
* 添加PLActionBean后 logBean存入值
|
*
|
*/
|
public void setLogBean(ExportActionLogBean logBean) {
|
this.logBean = logBean;
|
}
|
/**
|
* 添加PLActionBean后 logBean存入值
|
*
|
*/
|
public ExportActionLogBean getLogBean() {
|
return logBean;
|
}
|
|
public PLAction getPLActionById(String pLActionId){
|
return PLActionBeans.get(pLActionId);
|
}
|
public ArrayList<PLAction> getPLActionByPlActionClsId(String plActionClsId){
|
if( PLActionListsMap == null){
|
PLActionListsMap = new HashMap<String/*ActionCls编码*/,ArrayList<PLAction>>();
|
for (Entry<String, PLAction> PLActionEntry : PLActionBeans.entrySet()) {
|
String PLActionListsMapKey = PLActionEntry.getValue().plActionCls ;
|
if(PLActionListsMapKey.equals("")){
|
PLActionListsMapKey = "when key is null ,change the key to this";
|
}
|
ArrayList<PLAction> actionList = PLActionListsMap.get(PLActionListsMapKey);
|
if( actionList == null){
|
actionList = new ArrayList<PLAction>();
|
actionList.add(PLActionEntry.getValue());
|
PLActionListsMap.put(PLActionListsMapKey,actionList);
|
}else{
|
actionList.add(PLActionEntry.getValue());
|
}
|
|
}
|
};
|
|
if(plActionClsId.equals("")){
|
plActionClsId = "when key is null ,change the key to this";
|
}
|
return PLActionListsMap.get(plActionClsId);
|
}
|
public void addPLActionParamBean(PLActionParam pLActionParam){
|
if(pLActionParam.action!=null && pLActionParam.action!=""){
|
if(PLActionParamBeans.get(pLActionParam.action) == null){
|
ArrayList<PLActionParam> arraylist = new ArrayList<PLActionParam>();
|
PLActionParamBeans.put(pLActionParam.action, arraylist);
|
}
|
PLActionParamBeans.get(pLActionParam.action).add(pLActionParam);
|
}
|
|
}
|
public PLActionParam[] getPLActionParamArrayByActionId(String paramString){
|
ArrayList<PLActionParam> pLActionParams = PLActionParamBeans.get(paramString);
|
|
if(pLActionParams != null && pLActionParams.size() > 0 ){
|
PLActionParam[] actionParams = new PLActionParam[pLActionParams.size()];
|
for (int i = 0; i < pLActionParams.size(); i++) {
|
actionParams[i] = pLActionParams.get(i);
|
}
|
return actionParams;
|
}
|
return null;
|
}
|
// /**
|
// * 添加PLActionBean并同时添加PLActionBean对应参数进行记录
|
// * 能过方便获得category时用此方法. 可以降低系统消耗
|
// * @param pLAction
|
// */
|
// public void addPLActionBean(PLAction plAction, String category) {
|
// PLActionBeans.put(plAction.plOId, plAction);
|
// PLActionCls[] plActionCls = null;
|
//
|
// try {
|
// if(category == null ){
|
// plActionCls = UITools.getService().getPLActionClsArray();
|
// for (PLActionCls plActionCls2 : plActionCls) {//获得分类名称
|
// if(plActionCls2.id.equals(plAction.plActionCls)){
|
// category = plActionCls2.name ;
|
// }
|
// }
|
// }
|
// PLActionParam[] params = UITools.getService().getPLActionParamArrayByActionId(plAction.plOId);
|
// if(params != null && params.length > 0){//如果参数存在
|
// for (PLActionParam plActionParam : params) {//添加action参数
|
// this.addPLActionParamBean(plActionParam);
|
// }
|
// }
|
// logBean = new ExportActionLogBean(ExportActionLogBean.RIGHT_STATE,
|
// plAction.plCode,plAction.plName,plAction.plCSClass,plAction.plBSUrl,
|
// plAction.plTypeType,plAction.plDesc,category);
|
//
|
// } catch (PLException e) {
|
// logBean = new ExportActionLogBean(e.getMessage(),
|
// plAction.plCode,plAction.plName,plAction.plCSClass,plAction.plBSUrl,
|
// plAction.plTypeType,plAction.plDesc,category); e.printStackTrace();
|
// }
|
// }
|
|
}
|