1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
package com.vci.web.other;
 
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map.Entry;
import com.vci.corba.portal.data.PLAction;
import com.vci.corba.portal.data.PLActionCls;
import com.vci.corba.portal.data.PLActionParam;
 
 
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();
//        }
//    }
 
}