ludc
2025-01-16 986aa62ed00bee39363bab41b4eeb8259d446efd
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
package com.vci.client.portal.utility;
 
import java.io.ByteArrayInputStream;
import java.io.ObjectInputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
 
import org.apache.commons.lang3.StringUtils;
import org.dom4j.DocumentException;
import org.omg.CORBA.IntHolder;
 
import com.vci.corba.omd.atm.AttribItem;
import com.vci.corba.omd.btm.BtmAndApName;
import com.vci.corba.omd.btm.BtmItem;
import com.vci.corba.omd.data.BusinessObject;
import com.vci.corba.omd.data.LinkObject;
import com.vci.corba.omd.etm.EnumChild;
import com.vci.corba.omd.etm.EnumItem;
import com.vci.corba.omd.ltm.LinkType;
import com.vci.corba.omd.stm.StatePool;
import com.vci.corba.query.ObjectQueryService.FindBTMObjectsV3Result;
import com.vci.corba.query.ObjectQueryService.FindLTObjectsV2Result;
import com.vci.corba.query.data.BtmRefQueryOption;
import com.vci.corba.query.data.RefPath;
import com.vci.omd.utils.ObjectTool;
import com.vci.client.common.oq.OQTool;
import com.vci.client.common.providers.ServiceProvider;
import com.vci.client.omd.attribpool.ui.APClient;
import com.vci.client.omd.btm.ui.BtmClient;
import com.vci.client.omd.linktype.LinkTypeStart;
import com.vci.client.omd.statepool.StatePoolStart;
import com.vci.client.oq.QTClient;
import com.vci.client.portal.custom.CustomChangeDataByExprission;
import com.vci.client.portal.custom.ICustomDefine;
import com.vci.client.portal.utility.tabledata.DefaultTableDataQueryParam;
import com.vci.client.portal.utility.tabledata.ITableDataQueryParam;
import com.vci.client.utils.TimeMonitor;
import com.vci.common.qt.object.Condition;
import com.vci.common.qt.object.OrderInfo;
import com.vci.common.qt.object.PageInfo;
import com.vci.common.qt.object.QTConstants;
import com.vci.common.qt.object.QueryTemplate;
import com.vci.common.util.CollectionUtils;
import com.vci.common.utility.ObjectUtility;
import com.vci.corba.common.VCIError;
 
public class TableDataUtil {
    
    public final String LCSTATUS = "lcstatus";
    private HashMap<String, HashMap<String, String>> typeAttrEnumValueToNameMap = new HashMap<String,HashMap<String,String>>();
    private HashMap<String, HashMap<String, String>> typeAttrEnumNameToValueMap = new HashMap<String,HashMap<String,String>>();
    private Map<String, PRMItem> showExpressMap = new HashMap<String, PRMItem>();
    /**
     * 查询历史数据对应的详细信息
     * @param sourceDataOid, 选择数据的oid
     * @param showType, 显示类型
     * @param queryColumnsMap, 查询列, key为查询列名,value为显示名称
     * @param customMap, 自定义列
     * @return
     * @throws VCIError
     * @throws DocumentException
     */
    public List<Map<String, String>> getHistoryObjectDataList(String sourceDataOid,String showType,
            Map<String, String> queryColumnsMap, 
            Map<String, PRMItem> customMap, 
            Map<String, PRMItem> fileMap) throws VCIError, DocumentException {
        //查询历史数据
        BusinessObject[] bos = getHistroyBusinessObject(sourceDataOid);
        
        DataModelProcessor processor = new DataModelProcessor();
        List<Map<String, String>> datas = getObjectDataSecondList(processor, bos, showType, queryColumnsMap);
        if (customMap != null && customMap.size() > 0) {
            getCustomValue(customMap, datas);
        }
        if (fileMap != null && fileMap.size() > 0) {
            getFileColValue(fileMap, datas);
        }
        return datas;
    }
    
    /**
     * 获取对象对应的历史信息
     * @param objOid 历史数据oid
     * @return
     * @throws VCIError
     */
    private BusinessObject[] getHistroyBusinessObject(String objOid) throws VCIError {
        Map<String, String> conditionMap = new HashMap<String, String>();
        conditionMap.put("hoid", objOid);
        QueryTemplate qt = this.getHistoryBOQueryTemplate(conditionMap);
        return this.getHistoryBusinessObject(qt);
    }
 
    /**
     * 获取 objecthistoryinfo 对应的 实际业务类型历史版本数据(返回的是 plhistory 对应的 BusinessObject)
     * @param objHisOid objecthistoryinfo 对象的oid
     * @return
     * @throws VCIError
     */
    public BusinessObject[] getHistroyBusinessObjectByObjHistoryOid(String objHisOid) throws VCIError {
        Map<String, String> conditionMap = new HashMap<String, String>();
        conditionMap.put("oid", objHisOid);
        QueryTemplate qt = this.getHistoryBOQueryTemplate(conditionMap);
        return this.getHistoryBusinessObject(qt);
    }
    
    private BusinessObject[] getHistoryBusinessObject(QueryTemplate qt) throws VCIError{
        List<BusinessObject> result = new ArrayList<BusinessObject>();
        try {
            BusinessObject[] bos = QTClient.getService().findBTMObjects(qt.getId(),  OQTool.qtTOXMl(qt).asXML());
            for(int i = 0; i < bos.length; i++) {            
                String s = ObjectTool.getBOAttributeValue(bos[i], "plhistory");
                byte[] bs = URLDecoder.decode(s, "UTF-8").getBytes("ISO-8859-1");
                if(bs!= null && bs.length>0){
                    BusinessObject obj = (BusinessObject)this.getObj(bs);
                    result.add(obj);
                }
            }
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            VCIError vcierror = new VCIError("获取历史信息时,发生转码错误!",new String[]{e.getMessage()});
            throw vcierror;
        }
        return result.toArray(new BusinessObject[0]);
    }
    
    /**
     * 从clob中读取历史信息对象
     * @param bs
     * @return
     * @throws VCIError
     */
    private Object getObj(byte[] bs) throws VCIError {
        try {
            ByteArrayInputStream bais = new ByteArrayInputStream(bs);
            ObjectInputStream ips = new ObjectInputStream(bais);
            Object bo = ips.readObject();
            ips.close();
            bais.close();    
            return bo;
        } catch (Exception e) {
            e.printStackTrace();
            VCIError vcierror = new VCIError("读取历史信息出错!",new String[]{e.getMessage()});
            throw vcierror;
        }
    }
    private QueryTemplate getHistoryBOQueryTemplate(Map<String, String> conditionMap) {
        QueryTemplate qt = new QueryTemplate();
        qt.setId("historyBOQueryTemplate");
        qt.setBtmType("objecthistoryinfo");
        qt.setType("btm");
        List<String> clauseList = new ArrayList<String>();
        clauseList.add("*");
        qt.setClauseList(clauseList);
        qt.setQueryChildrenFlag(false);
        qt.setRightFlag(false);
        qt.setVersion(1);
        
        OrderInfo oi = new OrderInfo();
        oi.setOrderField("createtime");
        oi.setOrderMode("desc");
        oi.setLevel(0);
        List<OrderInfo> orderInfoList = new ArrayList<OrderInfo>();
        orderInfoList.add(oi);
        if (orderInfoList != null && orderInfoList.size() > 0) {
            qt.setOrderInfoList(orderInfoList);
        }
        if (conditionMap != null && conditionMap.size() > 0) {
            Condition cond = OQTool.getCondition(conditionMap);
            qt.setCondition(cond);
        }
        return qt;
    }
    
    /**
     * 返回 表格业务对象数据结果(V3)
     * @param queryParam 表格数据查询参照 
     * @return 返回 List<Map<String, String>> 每条数据 以Map(key:itemField value:属性的值)的形式存在于List中
     * @throws VCIError
     * @throws DocumentException
     * @see com.vci.client.portal.utility.tabledata.ITableDataQueryParam
     */
    public List<Map<String, String>> getObjectDataListV3(ITableDataQueryParam queryParam) throws VCIError, DocumentException {
        return this.getObjectDataListV4(queryParam, new IntHolder(0));
    }
    /**
     * 返回 表格业务对象数据结果(V3)
     * @param queryParam 表格数据查询参照 
     * @return 返回 List<Map<String, String>> 每条数据 以Map(key:itemField value:属性的值)的形式存在于List中
     * @throws VCIError
     * @throws DocumentException
     * @see com.vci.client.portal.utility.tabledata.ITableDataQueryParam
     */
    public List<Map<String, String>> getObjectDataListV4(ITableDataQueryParam queryParam, IntHolder count) throws VCIError, DocumentException {
        return this.getObjectDataListExecV2(queryParam, count);
    }
    
    //add by caill start 2017.3.20
    public List<Map<String, String>> getObjectDataListV2(String qtName, Map<String, String> replaceMap, 
            Map<String, String> conditionMap, PageInfo pageInfo, List<OrderInfo> orderInfos, String showType,
            Map<String, String> queryColumnsMap, Map<String, PRMItem> customMap, Map<String, PRMItem> fileMap,Map<String, PRMItem> showExpressMap) throws VCIError, DocumentException {
        ITableDataQueryParam p = new DefaultTableDataQueryParam();
        p.setQueryTemplateName(qtName);
        p.setReplaceMap(replaceMap);
        p.setConditionMap(conditionMap);
        p.setPageInfo(pageInfo);
        p.setOrderInfos(orderInfos);
        p.setShowType(showType);
        p.setQueryColumnsMap(queryColumnsMap);
        p.setCustomMap(customMap);
        p.setFileMap(fileMap);
        p.setShowExpressMap(showExpressMap);
        return this.getObjectDataListV3(p);
    }
    //add by caill end
    
    /**
     * 查询业务对象的详细信息
     * @param qtName, 查询模版
     * @param replaceMap, 替换map
     * @param conditionMap, 附加条件
     * @param pageInfo, 翻页信息
     * @param orderInfos, 排序信息
     * @param showType, 显示类型
     * @param queryColumnsMap, 查询列, key为查询列名,value为显示名称
     * @param customMap, 自定义列
     * @return
     * @throws VCIError
     * @throws DocumentException
     */
    public List<Map<String, String>> getObjectDataList(String qtName, Map<String, String> replaceMap, 
            Map<String, String> conditionMap, PageInfo pageInfo, List<OrderInfo> orderInfos, String showType,
            Map<String, String> queryColumnsMap, Map<String, PRMItem> customMap, Map<String, PRMItem> fileMap) throws VCIError, DocumentException {
        ITableDataQueryParam p = new DefaultTableDataQueryParam();
        p.setQueryTemplateName(qtName);
        p.setReplaceMap(replaceMap);
        p.setConditionMap(conditionMap);
        p.setPageInfo(pageInfo);
        p.setOrderInfos(orderInfos);
        p.setShowType(showType);
        p.setQueryColumnsMap(queryColumnsMap);
        p.setCustomMap(customMap);
        p.setFileMap(fileMap);
        p.setShowExpressMap(showExpressMap);
        return this.getObjectDataListV3(p);
    }
 
    protected List<Map<String, String>> getObjectDataListExec(ITableDataQueryParam queryParam) throws VCIError{
        return getObjectDataListExecV2(queryParam, new IntHolder(0));
    }
    
    protected List<Map<String, String>> getObjectDataListExecV2(ITableDataQueryParam queryParam, IntHolder count) throws VCIError{
        this.showExpressMap = queryParam.getShowExpressMap();
        return this.getObjectDataListDetailExecCoreV2(queryParam, count);
    }
    
    protected List<Map<String, String>> getObjectDataListDetailExecCore(ITableDataQueryParam queryParam) throws VCIError{
        return getObjectDataListDetailExecCoreV2(queryParam, new IntHolder(0));
    }
        
    protected List<Map<String, String>> getObjectDataListDetailExecCoreV2(ITableDataQueryParam queryParam, IntHolder count) throws VCIError{
        DataModelProcessor processor = new DataModelProcessor();
 
        // 根据查询模板、查询条件、替换条件、分页信息、排序信息查询出数据
        // add by xchao 2017.05.26 begin
        // 优先使用查询参数对象中的查询模板
        QueryTemplate qt = queryParam.getQueryTemplate();
        if(qt == null || "".equals(qt.getId())){
            // 构建查询模板对象
            qt = processor.getCustomQt(
                queryParam.getQueryTemplateName(), queryParam.getReplaceMap(), 
                queryParam.getConditionMap(), 
                queryParam.getPageInfo(), queryParam.getOrderInfos());
        }
        // 根据要查询显示的列确定后端数据查询
        boolean hasRefQuery = false;
        List<BtmRefQueryOption> refOpts = new ArrayList<BtmRefQueryOption>();
        List<String> showFields =queryParam.getShowFields();
        if(CollectionUtils.isEmpty(showFields)){
            showFields = new ArrayList<String>();
            if(!CollectionUtils.isEmpty(queryParam.getQueryColumnsMap())){
                for(String key : queryParam.getQueryColumnsMap().keySet()){
                    showFields.add(key);
                }
            }
        }
        if(showFields != null && showFields.size() > 0){
            Iterator<String> its = showFields.iterator();
            while(its.hasNext()){
                String clause = its.next();
                if(clause.indexOf(".") >= 0){
                    // 只设置一次
                    if(!hasRefQuery){
                        hasRefQuery = true;
                    }
                    String[] kvs = clause.split("\\.");
                    int len = kvs.length;
                    if(len == 2){
                        // 一层参照 a.b
                        // 第二个参数给空,是此不处从属性中查其参数的业务类型,由下下专用掊中进行处理
                        BtmRefQueryOption refOpt = new BtmRefQueryOption(
                        kvs[0], "", new String[]{kvs[1]}
                        );
                        refOpts.add(refOpt);
                    } else if(len == 3){
                        // 二层参照 a.b.c
                        // TODO 需要支持两层参照
                    } else {
                        // 三层以的参照 a.b.c.d a.b.c.d.e
                        // TODO 需要支持三层以及以上的参照
                    }
                    its.remove();
                }
            }
            // update by xchao 20167.12.20 end
            qt.setClauseList(showFields);
        }
        // add by xchao 2017.05.26 end
        
        List<Map<String, String>> datas = new ArrayList<Map<String,String>>();
//        if(hasRefQuery){
        FindBTMObjectsV3Result result = QTClient.getService().findBTMObjectsV3(
                    qt.getId(), OQTool.qtTOXMl(qt).asXML(), refOpts.toArray(new BtmRefQueryOption[0]));
             BusinessObject[] objs = result.returnValue;
             count.value = (int)result.count;
            datas = Arrays.asList(CBOHelper.getBOValueMap(objs));
//        } else {
//            BusinessObject[] objs = QTClient.getService().findBTMObjectsV2(
//                    qt.getId(), plm.oq.objectQuery.common.Tool.qtTOXMl(qt).asXML(), count);
//            datas = getObjectDataSecondList(
//                    processor, objs, 
//                    queryParam.getShowType(), queryParam.getQueryColumnsMap());
//        }
        datas = getCommonProcessedDatas(queryParam, datas);
        return datas;
    }
    protected List<Map<String, String>> getCommonProcessedDatas(
            ITableDataQueryParam queryParam,
            List<Map<String, String>> datas) throws VCIError{
        Map<String, PRMItem> customMap = queryParam.getCustomMap();
        if (customMap != null&&customMap.size()>0) {
            getCustomValue(customMap, datas);
        }
        
        Map<String, PRMItem> showExpressMap = queryParam.getShowExpressMap();
        //根据freemarker配置修改datas add by wang1
        if(showExpressMap != null && showExpressMap.size() > 0){
            getFreeMarkerData(showExpressMap,datas);
        }
 
        // update by xchao 2017.12.19 begin
        // 基于选项确定是否要对文件属性进行处理
        if(!queryParam.isIgnoreFileColumn()){
            Map<String, PRMItem> fileMap = queryParam.getFileMap();
            if (fileMap != null && fileMap.size() > 0) {
                getFileColValue(fileMap, datas);
            }
        }
        // update by xchao 2017.12.19 end
        
        return datas;
    }
    
    /**
     * 查询业务对象的详细信息
     * @param qtName, 查询模版
     * @param replaceMap, 替换map
     * @param conditionMap, 附加条件
     * @param pageInfo, 翻页信息
     * @param orderInfos, 排序信息
     * @param showType, 显示类型
     * @param queryColumnsMap, 查询列, key为查询列名,value为显示名称
     * @param customMap, 自定义列
     * @return
     * @throws VCIError
     * @throws DocumentException
     */
    public List<Map<String, String>> getNewObjectDataList(String qtName, Map<String, String> replaceMap, 
            Map<String, List<String>> conditionMap, PageInfo pageInfo, List<OrderInfo> orderInfos, String showType,
            Map<String, String> queryColumnsMap, Map<String, PRMItem> customMap, Map<String, PRMItem> fileMap) throws VCIError {
        DataModelProcessor processor = new DataModelProcessor();
        BusinessObject[] objs = processor.getNewBusinessObjectByQueryTemplate(qtName, replaceMap, conditionMap, pageInfo, orderInfos);
        List<Map<String, String>> datas = getObjectDataSecondList(processor, objs, showType, queryColumnsMap);
        if (customMap != null && customMap.size() > 0) {
            getCustomValue(customMap, datas);
        }
        if (fileMap != null && fileMap.size() > 0) {
            getFileColValue(fileMap, datas);
        }
        return datas;
    }
    
    /**
     * 直接根据查询模板对象查询业务数据 ADD BY ZhongGY 2015-04-14
     * @Title        :getObjectDataList
     * @Description    :
     * @param qt
     * @param showType
     * @param queryColumnsMap
     * @param customMap
     * @param fileMap
     * @return
     * @throws VCIError
     * @throws DocumentException
     */
    public List<Map<String, String>> getObjectDataList(QueryTemplate qt, String showType,Map<String, String> queryColumnsMap, Map<String, PRMItem> customMap, Map<String, PRMItem> fileMap) throws VCIError, DocumentException {
        DataModelProcessor processor = new DataModelProcessor();
        BusinessObject[] objs = processor.getBusinessObjectByQueryTemplate(qt);
        List<Map<String, String>> datas = getObjectDataSecondList(processor, objs, showType, queryColumnsMap);
        if (customMap != null&&customMap.size()>0) {
            getCustomValue(customMap, datas);
        }
        //根据freemarker配置修改datas add by wang1
        if(customMap!=null&&customMap.size()>0){
            getFreeMarkerData(customMap,datas);
        }
        if (fileMap != null && fileMap.size() > 0) {
            getFileColValue(fileMap, datas);
        }
        return datas;
    }
    
    /**
     * 获取业务对象二次查询的结果
     * @param processor
     * @param objs, 业务对象
     * @param showType, 显示类型
     * @param formColumnsMap,key为内部主键,value为显示名称(在此过程中暂不使用,可以传入空值)
     */
    private List<Map<String, String>> getObjectDataSecondList(
            DataModelProcessor processor,
            BusinessObject[] objs, String showType,
            Map<String, String> queryColumnsMap){
        @SuppressWarnings("unchecked")
        Map<String, String>[] res = new LinkedHashMap[0];
        res = CBOHelper.getBOValueMap(objs);
        Map<String, List<String>>  referenceKeyMap = processor.getReferenceCol(queryColumnsMap);
        if (referenceKeyMap != null && referenceKeyMap.size() > 0) {
            TimeMonitor tm = new TimeMonitor();
            String tmkey = "secondQuery";;
            
            tm.begin(tmkey);
            Iterator<String> referenceKey = referenceKeyMap.keySet().iterator();
            List<String> referenceList = new LinkedList<String>();
            while (referenceKey.hasNext()) {
                referenceList.add(referenceKey.next());
            }
            Map<String, Map<String, String>> rowRefMap = new LinkedHashMap<String, Map<String, String>>();
            Map<String, Boolean> emptyCheckMap = new LinkedHashMap<String, Boolean>();
            for (BusinessObject obj : objs) {
                String boOid = obj.oid;
                Map<String, String> refMap = new LinkedHashMap<String, String>();
                for (int j = 0; j < referenceList.size(); j++) {
                    String refKey = referenceList.get(j);
                    String refVal = ObjectTool.getBOAttributeValue(obj, refKey);
                    if (refVal == null) {
                        refVal = "";
                        emptyCheckMap.put(refVal, true);
                    } else {
                        emptyCheckMap.put(refKey, false);
                    }
                    refMap.put(refKey, refVal);
                }
                rowRefMap.put(boOid, refMap);
            }
            
            Map<String, String> emptyMap = new HashMap<String, String>();
            Iterator<String> emptyCheckItor = emptyCheckMap.keySet().iterator();
            List<String> delKeyList = new ArrayList<String>();
            while (emptyCheckItor.hasNext()) {
                String emptyCheckKey = emptyCheckItor.next();
                boolean  emptyCheckVal = emptyCheckMap.get(emptyCheckKey);
                if (!emptyCheckVal) {
                    continue;
                }
                List<String> list  = referenceKeyMap.get(emptyCheckKey);
                emptyMap.put(emptyCheckKey, "");
                for (int j = 0; j < list.size(); j++) {
                    emptyMap.put(list.get(j), "");
                }
                referenceKeyMap.remove(emptyCheckKey);
                delKeyList.add(emptyCheckKey);
            }
            if (delKeyList.size() > 0) {
                Iterator<String> itor = rowRefMap.keySet().iterator();
                while (itor.hasNext()) {
                    Map<String, String> crowMap = rowRefMap.get(itor.next());
                    for (int i = 0; i < delKeyList.size(); i++) {
                        crowMap.remove(delKeyList.get(i));
                    }
                }
            }
            
            Map<String, String> secQueryMap = processor.getQueryBusinessObjectCondition(showType, rowRefMap, referenceKeyMap);
            RefPath[] refPaths = processor.queryReference(secQueryMap, showType);
            connectSecondQueryResult(res, refPaths, secQueryMap, referenceKeyMap);
            tm.end(tmkey);
            //System.out.println(tm.toString());
        }
        
        List<Map<String, String>> listRes = new LinkedList<Map<String, String>>();
        for (Map<String, String> resMap : res) {
            listRes.add(resMap);
        }
        return listRes;
    }
    
    /**
     * 将二次查询结果拼接到一次查询结果中
     * @param res
     * @param refPaths
     * @param secQueryMap
     * @param referenceKeyMap
     */
    private void connectSecondQueryResult(Map<String, String>[] res, RefPath[] refPaths, Map<String, String> secQueryMap, Map<String, List<String>>  referenceKeyMap) {
        if (refPaths != null) {
            int colNum = secQueryMap.size();
            for (int i = 0; i < res.length; i++) {
                Map<String, String> rowVal = res[i];
                for (int j = 0; j < colNum; j++) {
                    String key = secQueryMap.keySet().toArray(new String[colNum])[j];
                    if (referenceKeyMap.containsKey(key)) {
                        continue;
                    }
                    if (refPaths[j].values.length <= i) {
                        continue;
                    }
                    String cVal = refPaths[j].values[i].value;
                    rowVal.put(secQueryMap.keySet().toArray(new String[colNum])[j], cVal);
                }
            }
        }
    }
    
    /**
     * 获取自定义列的值
     * @param customMap, 自定义查询列
     * @param datas, 查询结果
     * @throws VCIError
     */
    private void getCustomValue(Map<String, PRMItem> customMap, List<Map<String, String>> datas) throws VCIError {
        Iterator<String> itor = customMap.keySet().iterator();
        while (itor.hasNext()) {
            String key = itor.next();
            PRMItem prm = customMap.get(key);
            String customCls = prm.getItemCustomClass();
            if(customCls == null || "".equals(customCls)){
                continue;
            }
            executeSetCustomValue(customCls, key, customMap, datas);
        }
    }
    /**
     * 根据freeMaker配置的值处理dataModel
     * @param showExpressionList,freeMarker配置的值
     * @param dataModel,需要处理的数据
     * @throws VCIError
     */
    private void getFreeMarkerData(Map<String, PRMItem> showExpressMap, List<Map<String, String>> dataModel) throws VCIError {
        if(dataModel==null||dataModel.size()==0){
            return ;
        }
        new CustomChangeDataByExprission().getCustomValue("", showExpressMap, dataModel);
        
    }
    
    /**
     * 执行自定义列类获取具体的值
     * @param customCls, 自定义类
     * @param key, 自定义列主键
     * @param customMap, 自定义列对应的Map
     * @param datas, 数据
     */
    private void executeSetCustomValue(String customCls, String key, Map<String, PRMItem> customMap, List<Map<String, String>> datas){
        try {
            int paramIndex = customCls.indexOf("?");
            String param = "";
            if(paramIndex > 0){
                param = customCls.substring(paramIndex + 1);
                customCls = customCls.substring(0, paramIndex);
            }
            Class<?> cls = Class.forName(customCls);
            ICustomDefine custom = (ICustomDefine)cls.getConstructor().newInstance();
            if(param != null && !"".equals(param)){
                key = key + "?" + param;
            }
            custom.getCustomValue(key, customMap, datas);
        } catch (Exception e){
            e.printStackTrace();
        }
    }
    
    private void getFileColValue(Map<String, PRMItem> fileMap, List<Map<String, String>> datas) throws VCIError {
        try {
            Iterator<String> itor = fileMap.keySet().iterator();
            while (itor.hasNext()) {
                String key = itor.next();
                PRMItem prm = fileMap.get(key);
                String customCls = prm.getItemCustomClass();
                if(customCls == null || "".equals(customCls)){
                    customCls = "plm.portal.custom.CustomFileInterceptor";
                }
                executeSetCustomValue(customCls, key, fileMap, datas);
            }
        } catch (Exception e){
            e.printStackTrace();
        }
    }
    
    /**
     * 获取链接对象的详细信息
     * @param qtName, 查询模版
     * @param replaceMap, 替换map
     * @param conditionMap, 附加条件
     * @param linkType, 显示类型
     * @param isForward, 方向
     * @param queryColumnsMap, 查询列
     * @param customMap, 自定义列
     * @return
     * @throws VCIError
     * @throws DocumentException
     */
    public List<Map<String, String>> getLinkDataList(String qtName, Map<String, String> replaceMap, Map<String, String> conditionMap, boolean isForward, 
            String linkType, Map<String, String> queryColumnsMap, Map<String, PRMItem> customMap, Map<String, PRMItem> fileMap) throws VCIError, DocumentException {
        DataModelProcessor processor = new DataModelProcessor();
        LinkObject[] los = processor.getLinkObjectByQueryTemplate(qtName, replaceMap, conditionMap);
        List<Map<String, String>> datas = getLinkDataSecondList(processor, los, isForward, linkType, queryColumnsMap);
        if (customMap != null&&customMap.size()>0) {
            getCustomValue(customMap, datas);
        }
        if (fileMap != null && fileMap.size() > 0) {
            getFileColValue(fileMap, datas);
        }
        return datas;
    }
    
    /**
     * 获取链接对象的详细信息
     * @param qtName, 查询模版
     * @param replaceMap, 替换map
     * @param conditionMap, 附加条件
     * @param linkType, 显示类型
     * @param isForward, 方向
     * @param queryColumnsMap, 查询列
     * @param customMap, 自定义列
     * @param pageInfo  分页信息
     * @return
     * @throws VCIError
     * @throws DocumentException
     */
    public List<Map<String, String>> getLinkDataListV2(String qtName, Map<String, String> replaceMap, Map<String, String> conditionMap, boolean isForward, 
            String linkType, Map<String, String> queryColumnsMap, Map<String, PRMItem> customMap, Map<String, PRMItem> fileMap,PageInfo pageInfo,Map<String, PRMItem> showExpressMap) throws VCIError, DocumentException {
        ITableDataQueryParam p = new DefaultTableDataQueryParam();
        p.setQueryTemplateName(qtName);
        p.setReplaceMap(replaceMap);
        p.setConditionMap(conditionMap);
        p.setPageInfo(pageInfo);
        p.setQueryColumnsMap(queryColumnsMap);
        p.setCustomMap(customMap);
        p.setFileMap(fileMap);
        p.setShowExpressMap(showExpressMap);
        return getLinkDataListV3(p);
    }
    
    public List<Map<String, String>> getLinkDataListV3(ITableDataQueryParam queryParam) throws VCIError, DocumentException {
        return getLinkDataListV4(queryParam, new IntHolder(0));
    }
    public List<Map<String, String>> getLinkDataListV4(ITableDataQueryParam queryParam, IntHolder count) throws VCIError, DocumentException {
        return getLinkDataListExecV2(queryParam, count);
    }
    public List<Map<String, String>> getLinkDataList(String qtName, Map<String, String> replaceMap, Map<String, String> conditionMap, boolean isForward, 
            String linkType, Map<String, String> queryColumnsMap, Map<String, PRMItem> customMap, Map<String, PRMItem> fileMap,PageInfo pageInfo) throws VCIError, DocumentException {
        return this.getLinkDataListV2(qtName, replaceMap, conditionMap, isForward, linkType, queryColumnsMap, customMap, fileMap, pageInfo, fileMap);
    }
    private boolean isForward(QueryTemplate qt){
        boolean res = false;
        if(qt == null){
            return res;
        }
        String direction = qt.getDirection();
        if(StringUtils.isNotEmpty(direction) && direction.equalsIgnoreCase(QTConstants.DIRECTION_POSITIVE)){
            res = true;
        }
        return res;
    }
    protected List<Map<String, String>> getLinkDataListExec(ITableDataQueryParam queryParam) throws VCIError{
        return this.getLinkDataListExecV2(queryParam, new IntHolder(0));
    }
    protected List<Map<String, String>> getLinkDataListExecV2(ITableDataQueryParam queryParam, IntHolder count) throws VCIError{
        DataModelProcessor processor = new DataModelProcessor();
 
        // 根据查询模板、查询条件、替换条件、分页信息、排序信息查询出数据
        // add by xchao 2017.05.26 begin
        // 优先使用查询参数对象中的查询模板
        QueryTemplate qt = queryParam.getQueryTemplate();
        if(qt == null || "".equals(qt.getId())){
            // 构建查询模板对象
            qt = processor.getCustomQt(
                queryParam.getQueryTemplateName(), queryParam.getReplaceMap(), 
                queryParam.getConditionMap(), 
                queryParam.getPageInfo(), queryParam.getOrderInfos());
        }
        // 根据要查询显示的列确定后端数据查询
        List<String> showFields = queryParam.getShowFields();
        if(showFields != null && showFields.size() > 0){
            qt.setClauseList(showFields);
        }
        // add by xchao 2017.05.26 end
        
        FindLTObjectsV2Result result = QTClient.getService().findLTObjectsV2(qt.getId(), OQTool.qtTOXMl(qt).asXML());
        LinkObject[] los = result.returnValue;
        count.value = (int)result.count;
        List<Map<String, String>> datas = getLinkDataSecondList(processor, los, isForward(queryParam.getQueryTemplate()), queryParam.getLinkType(), queryParam.getQueryColumnsMap());
        
        datas = getCommonProcessedDatas(queryParam, datas);
        
        return datas;
    }
    
    /**
     * 返回LO二次查询结果
     * @param processor
     * @param los
     * @param isForward
     * @param linkType
     * @param formColumnsMap
     * @return
     */
    private List<Map<String, String>>  getLinkDataSecondList(
            DataModelProcessor processor,
            LinkObject[] los, boolean isForward, String linkType, 
            Map<String, String> queryColumnsMap){
        @SuppressWarnings("unchecked")
        Map<String, String>[] res = new LinkedHashMap[0];
        Map<String, List<String>>  referenceKeyMap = processor.getReferenceCol(queryColumnsMap);
        
        res = CBOHelper.getLOValueMap(los);
        if (res == null || res.length == 0) {
            return new LinkedList<Map<String, String>>();
        }
        if (referenceKeyMap.containsKey("t_oid")) {
            Map<String, String> rowRefMap = new LinkedHashMap<String, String>();
            Map<String, String> rowKeyMap = new LinkedHashMap<String, String>();
            String[] cTypes = new String[los.length];
            String cType = los[0].toBTName;
            boolean isSingleType = true;
            for (int i = 0; i < los.length; i++) {
                String loOid = los[i].toOid;
                String refKey = "t_oid";
                rowRefMap.put(loOid, refKey);
                rowKeyMap.put(ObjectUtility.getNewObjectID36(), loOid);
                if (!cType.equals(los[i].toBTName)) {
                    isSingleType = false;
                }
                cTypes[i] = los[i].toBTName;
            }
            Map<String, String> secQueryMap = processor.getQueryLinkObjectCondition(linkType, rowKeyMap, rowRefMap, referenceKeyMap);
            RefPath[] refPaths;
            if (isSingleType) {
                refPaths = processor.queryReference(secQueryMap, cType);
            } else {
                refPaths = processor.queryReference(secQueryMap, cTypes);
            }
            connectSecondQueryResult(res, refPaths, secQueryMap, referenceKeyMap);
            referenceKeyMap.remove("t_oid");
        }
        if (referenceKeyMap.containsKey("f_oid")) {
            Map<String, String> rowRefMap = new LinkedHashMap<String, String>();
            Map<String, String> rowKeyMap = new LinkedHashMap<String, String>();
            String[] cTypes = new String[los.length];
            String cType = los[0].fromBTName;
            boolean isSingleType = true;
            for (int i = 0; i < los.length; i++) {
                String loOid = los[i].fromOid;
                String refKey = "f_oid";
                rowRefMap.put(loOid, refKey);
                rowKeyMap.put(ObjectUtility.getNewObjectID36(), loOid);
                if (!cType.equals(los[i].fromBTName)) {
                    isSingleType = false;
                }
                cTypes[i] = los[i].fromBTName;
            }
            Map<String, String> secQueryMap = processor.getQueryLinkObjectCondition(linkType, rowKeyMap, rowRefMap, referenceKeyMap);
            RefPath[] refPaths;
            if (isSingleType) {
                refPaths = processor.queryReference(secQueryMap, cType);
            } else {
                refPaths = processor.queryReference(secQueryMap, cTypes);
            }
            connectSecondQueryResult(res, refPaths, secQueryMap, referenceKeyMap);
            referenceKeyMap.remove("f_oid");
        }
        
        Iterator<String> referenceKey = referenceKeyMap.keySet().iterator();
        List<String> referenceList = new LinkedList<String>();
        while (referenceKey.hasNext()) {
            referenceList.add(referenceKey.next());
        }
        if (referenceList.size() > 0) {
            Map<String, Map<String, String>> rowRefMap = new LinkedHashMap<String, Map<String, String>>();
            for (int i = 0; i < los.length; i++) {
                String boOid = los[i].oid;
                Map<String, String> refMap = new LinkedHashMap<String, String>();
                for (int j = 0; j < referenceList.size(); j++) {
                    String refKey = referenceList.get(j);
                    String refVal = ObjectTool.getLOAttributeValue(los[i], refKey);
                    if (refVal == null) {
                        refVal = "";
                    }
                    refMap.put(refKey, refVal);
                }
                rowRefMap.put(boOid, refMap);
            }
            Map<String, String> secQueryMap = processor.getQueryBusinessObjectCondition(linkType, rowRefMap, referenceKeyMap);
            RefPath[] refPaths = processor.queryReference(secQueryMap, "");
            connectSecondQueryResult(res, refPaths, secQueryMap, referenceKeyMap);
        }
        
        List<Map<String, String>> listRes = new LinkedList<Map<String, String>>();
        for (Map<String, String> resMap : res) {
            listRes.add(resMap);
        }
        return listRes;
    }
    
    /**
     * 国际化生命周期状态
     * @param datas
     */
    Map<String, StatePool> statePoolsMap=new HashMap<String, StatePool>();
    public void displayLifeCycleStatus(List<Map<String, String>> datas) {
        if (statePoolsMap.size()==0) {
            statePoolsMap = getAllStatusInfo();
        }
        for (Map<String, String> data : datas) {
            Iterator<String> itor = data.keySet().iterator();
            while (itor.hasNext()) {
                String key = itor.next();
                if (!key.equalsIgnoreCase(LCSTATUS) && !key.toLowerCase().endsWith("." + LCSTATUS)) {
                    continue;
                }
                String value = data.get(key);
                if (statePoolsMap.containsKey(value)) {
                    data.put(key, statePoolsMap.get(value).tag);
                }
            }
        }
    }
    
    /**
     * 获取所有的生命周期状态
     * @return
     */
    private Map<String, StatePool> getAllStatusInfo() {
        Map<String, StatePool> statePoolsMap = new HashMap<String, StatePool>();
        try {
            StatePool[] statePools = StatePoolStart.getService().getStatePools();
            for(StatePool sp:statePools){
                statePoolsMap.put(sp.name, sp);
            }
        } catch (VCIError e) {
            e.printStackTrace();
        }
        return statePoolsMap;
    }
    
    /**
     * 显示链接类型数据的枚举值
     * @param datas
     * @param linkType
     * @param toDoTaskOneToOne 
     */
    public void displayLinkObjectEnumValue(List<Map<String, String>> datas, String linkType, String toDoTaskOneToOne) {
    TimeMonitor tm = new TimeMonitor();
        if ("true".equals(toDoTaskOneToOne) && datas != null && datas.size() > 0) {//一对一
            Map<String, String> map = datas.get(0);
            String f_btwname = map.get("f_btwname");//add by liyp 获取f_btwname t_btwname
            String t_btwname = map.get("t_btwname");
            calcAttrEnumMapForLinkTypeOneToOne(linkType,t_btwname,f_btwname);
        }else {
            String[] linktypes = new String[1];
            linktypes[0] = linkType;
            calcAttrEnumMapForLinkType(linktypes);
        }
        
        
        getEnumValue(datas);
    }
    
    /**
     * 显示业务类型数据的枚举值
     * @param datas
     * @param type
     */
    public void displayBusinessObjectEnumValue(List<Map<String, String>> datas, String type) {
        String[] types = new String[1];
        types[0] = type;
        calcAttrEnumMapForBtmType(types);
        getEnumValue(datas);
    }
    
    private void getEnumValue(List<Map<String, String>> datas) {
        for (Map<String, String> data : datas) {
            Iterator<String> itor = data.keySet().iterator();
            while (itor.hasNext()) {
                String key = itor.next();
                String ckey = "";
                if (typeAttrEnumValueToNameMap.containsKey(key)) {
                    ckey = key;
                } else if (key.indexOf(".") > 0){
                    ckey = key.substring(key.lastIndexOf(".") + 1);
                    if (!typeAttrEnumValueToNameMap.containsKey(ckey)) {
                        continue;
                    }
                } else {
                    continue;
                }
                String value = data.get(key);
                HashMap<String, String> enumValue = typeAttrEnumValueToNameMap.get(ckey);
                if (enumValue.containsKey(value)) {
                    value = enumValue.get(value);
                }
                data.put(key, value);
            }
        }
    }
    
    /**
     * 计算指定链接类型 枚举属性的值map
     * @param types 业务类型名称集合
     */
    public void calcAttrEnumMapForLinkType(String[] linkTypes){
        try {
            LinkType[] lts = LinkTypeStart.getService().getLinkTypes();
            for(String type : linkTypes){
                for(LinkType lt : lts){
                    if(type.equals(lt.name)){
                        calcAttrEnumMapCommonLogic(lt.name, lt.attributes);
                        calcAttrEnumMapForBtmType(lt.btmItemsFrom);
                        calcAttrEnumMapForBtmType(lt.btmItemsTo);
                    }
                }
            }
        } catch (VCIError e) {
            e.printStackTrace();
        }
    }
    Map<String, LinkType> linkTypeMap = new HashMap<String, LinkType>();
    /**
     * 计算指定链接类型 枚举属性的值map 一对一查询 
     * @param types 业务类型名称集合
     * @author liyp
     */
    private void calcAttrEnumMapForLinkTypeOneToOne(String linkType,String t_btwname,String f_btwname){
        try {
            if(linkTypeMap.containsKey(linkType)){
                return;
            }
            
            LinkType lt = LinkTypeStart.getService().getLinkType(linkType);//.getLinkTypeByBtmName(t_btwname,"");
            linkTypeMap.put(linkType, lt);
            if(linkType.equals(lt.name)){
                calcAttrEnumMapCommonLogic(lt.name, lt.attributes);
                calcAttrEnumMapForBtmTypeOneToOne(f_btwname);
                calcAttrEnumMapForBtmTypeOneToOne(t_btwname);//改为固定的to端 从datas中查询出来的
            }
        } catch (VCIError e) {
            e.printStackTrace();
        }
    }
    /**
     * 计算指定业务类型 枚举属性的值map
     * @param types 业务类型名称集合
     */
    Map<String, BtmAndApName[]> BtmAndApMap = new HashMap<String, BtmAndApName[]>();
    public void calcAttrEnumMapForBtmType(String[] btmTypes){
        try {
            for(String type : btmTypes){
                if(BtmAndApMap.containsKey(type)){
                    continue;
                }
                //BtmAndApName[] baans = BtmClient.getService().getBtmAndApNameArray(type);
                BtmItem bt = BtmClient.getService().getBtmItemByName(type);
                BtmAndApName[] baans = new BtmAndApName[] {new BtmAndApName(bt.name, bt.apNameArray)};
                BtmAndApMap.put(type, baans);
                for(BtmAndApName baan : baans) {
                    calcAttrEnumMapCommonLogic(baan.btmName, baan.apName);
                }
            }
        } catch (VCIError e) {
            e.printStackTrace();
        }
    }
    
    
    Map<String, BtmAndApName[]> btmAndApNameMap = new HashMap<String, BtmAndApName[]>();
    /**
     * 计算指定业务类型 枚举属性的值map
     * @param types 业务类型名称集合
     */
    private void calcAttrEnumMapForBtmTypeOneToOne(String btmType){
        try {
            if(btmAndApNameMap.containsKey(btmType)||StringUtils.isEmpty(btmType)){
                return;
            }
            
            //BtmAndApName[] baans = BtmClient.getService().getBtmAndApNameArray(btmType);
            BtmItem bt = BtmClient.getService().getBtmItemByName(btmType);
            BtmAndApName[] baans = new BtmAndApName[] {new BtmAndApName(bt.name, bt.apNameArray)};
            
            btmAndApNameMap.put(btmType, baans);
            for(BtmAndApName baan : baans) {
                calcAttrEnumMapCommonLogic(baan.btmName, baan.apName);
            }
        } catch (VCIError e) {
            e.printStackTrace();
        }
    }
    
    private void calcAttrEnumMapCommonLogic(String type, String[] attrNames) throws VCIError{
        AttribItem[] arItems = APClient.getService().getAttribItemsByNames(attrNames);
        for(AttribItem ai : arItems){
            //allowNull = yes;enumName = parttypeenum
            String[] others = ai.other.split(";");
            for(String other : others){
                String[] cvs = other.split("=");
                if(cvs[0].trim().equalsIgnoreCase("enumName")){
                    String enumName = cvs[1].trim();
                    if(typeAttrEnumNameToValueMap.containsKey(enumName)){
                        continue;
                    }
                    
                    HashMap<String, String> enumValueToName = new HashMap<String, String>();
                    HashMap<String, String> enumNameToValue = new HashMap<String, String>();
                    getEnumValueOrNameMap(enumName, enumValueToName, enumNameToValue);
                    
                    HashMap<String, HashMap<String, String>> fieldToEnumValuetoNameMap = new HashMap<String, HashMap<String,String>>();
                    fieldToEnumValuetoNameMap.put(ai.name, enumValueToName);
                    typeAttrEnumValueToNameMap.putAll(fieldToEnumValuetoNameMap);
                    
                    HashMap<String, HashMap<String, String>> fieldToEnumNameToValueMap = new HashMap<String, HashMap<String,String>>();
                    fieldToEnumNameToValueMap.put(ai.name, enumNameToValue);
                    typeAttrEnumNameToValueMap.putAll(fieldToEnumNameToValueMap);
                    
                    break;
                }
            }
        }
    }
    
//    private HashMap<String, EnumItem> enumItemMap = new HashMap<String, EnumItem>();
    private HashMap<String, String> getEnumValueOrNameMap(String enumName, 
            HashMap<String, String> enumValueToName,
            HashMap<String, String> enumNameToValue
            ){
        HashMap<String, String> map = new HashMap<String, String>();
        try {
//            if(enumItemMap.size() == 0){
                String filter = enumName;
                EnumItem[] enumItems = ServiceProvider.getOMDService().getEnumService().getEmItems(filter, 1, 1);
                for(EnumItem ei : enumItems){
//                    enumItemMap.put(ei.name, ei);
 
                    for(EnumChild ec : ei.children){
                        enumValueToName.put(ec.value, ec.name);
                        enumNameToValue.put(ec.name, ec.value);
                    }
                }
//            }
//            if(enumItemMap.containsKey(enumName)){
//                EnumItem ei = enumItemMap.get(enumName);
//            }
        } catch (VCIError e) {
            e.printStackTrace();
        }
        return map;
    }
    
    public void displayBSDataFileURL(List<Map<String, String>> datas, Map<String, PRMItem> fileMap) {
        Iterator<String> fileKeys = fileMap.keySet().iterator();
        while (fileKeys.hasNext()) {
            String key = fileKeys.next();
            PRMItem item = fileMap.get(key);
            for (int i = 0 ; i < datas.size(); i++) {
                Map<String, String> data = datas.get(i);
                if (!data.containsKey(key)) {
                    continue;
                }
                String value = data.get(key);
                if (value == null || value.trim().equals("")) {
                    continue;
                }
                String[] values = value.split(",");
                StringBuffer href = new StringBuffer();
                boolean isFirst = true;
                for (String cValue : values) {
                    if (!isFirst) {
                        href.append("<br>");
                    }
                    String displayVal = "浏览";
                    String[] sValues = cValue.split(":");
                    if (sValues.length == 2) {
                        displayVal = sValues[1];
                    }
                    href.append("<a style='text-decoration:none' href=\"javascript:downLoadFile('")
                    .append(sValues[0]).append("')\">").append(displayVal).append("</a>");
                    isFirst = false;
                }
                data.put(key, href.toString());
            }
        }
    }
}