田源
2025-01-09 8a166a60cfd1a2e593ffa103d10c0dc224fc8628
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
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
package com.vci.client.workflow.launch;
 
import java.util.LinkedHashMap;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
 
import javax.imageio.ImageIO;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JSplitPane;
import javax.swing.border.TitledBorder;
import javax.swing.event.TreeExpansionEvent;
import javax.swing.event.TreeExpansionListener;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
 
import java.awt.GridBagLayout;
import javax.swing.JLabel;
import java.awt.GridBagConstraints;
import javax.swing.JTextField;
import java.awt.Insets;
 
import javax.swing.DefaultListModel;
import javax.swing.ImageIcon;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JComboBox;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import javax.swing.tree.TreePath;
import javax.swing.JList;
 
import com.vci.client.LogonApplication;
import com.vci.client.common.TransmitTreeObject;
import com.vci.client.common.objects.DeptObject;
import com.vci.client.common.objects.RoleObject;
import com.vci.client.common.objects.UserObject;
import com.vci.client.common.oq.OQTool;
import com.vci.client.framework.delegate.RightManagementClientDelegate;
import com.vci.client.framework.systemConfig.stafforgmanage.RightManagementTreeCellRenderer;
import com.vci.client.oq.QTClient;
import com.vci.client.ui.exception.VCIException;
import com.vci.client.ui.locale.LocaleDisplay;
import com.vci.client.ui.swing.VCIOptionPane;
import com.vci.client.ui.swing.components.VCIJLabel;
import com.vci.client.ui.swing.components.VCIJScrollPane;
import com.vci.client.ui.table.VCIBaseTableModel;
import com.vci.client.ui.table.VCIBaseTableNode;
import com.vci.client.ui.tree.VCIBaseTree;
import com.vci.client.ui.tree.VCIBaseTreeModel;
import com.vci.client.ui.tree.VCIBaseTreeNode;
import com.vci.client.workflow.commom.FlowCustomProperties;
import com.vci.client.workflow.delegate.ProcessCustomClientDelegate;
import com.vci.client.workflow.template.object.ProcessCategoryObject;
import com.vci.client.workflow.template.object.ProcessDefinitionObject;
import com.vci.common.qt.object.Condition;
import com.vci.common.qt.object.Connector;
import com.vci.common.qt.object.QueryTemplate;
import com.vci.corba.common.VCIError;
import com.vci.corba.omd.data.BusinessObject;
 
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
 
public class LaunchDialog extends JDialog {
 
    /**
     * 
     */
    private static final long serialVersionUID = 2539859820247075177L;
    private final JPanel contentPanel = new JPanel();
    private JTextField processName;
    private JTable dataTable;
    private JComboBox processTemplate;
    private JTextArea processDec;
    private JList taskList;
    private DefaultListModel taskListModel;
    
    private JList userList;
    
    private DefaultListModel resultListModel;
    private DefaultListModel tmpListModel = new DefaultListModel();
    
    private String processType = ""; 
    private boolean saveFlag = false;
    private VCIBaseTree rightManagementTree;
    private VCIBaseTreeModel treeModel;
    private UserObject userInfo;
    private TransmitTreeObject transmitTreeObject = new TransmitTreeObject();
//    private Map<String,List<String>> taskAndUserMap = new HashMap<String,List<String>>();
    private Map<String,List<String>> taskAndUserMap = (Map<String,List<String>>)new LinkedHashMap();
    private Map<String,DefaultListModel> taskAndUserMap_1 = new HashMap<String,DefaultListModel>();
    private String processTemplateName = "";
    private String processNameValue;
    private String processDecValue;
    
    private String userValue ;
    private String roleValue ;
    private String departmentValue ;
    
    private JScrollPane treeScrollPane;
    private JPanel panel_2;
    private VCIBaseTreeNode selectNode;
    
    private VCIBaseTreeNode rootNode = new VCIBaseTreeNode("人员组织", "root");
    
    private Map<String, Map<String,String>> resMap = new HashMap<String,Map<String,String>>();
    public String getProcessTemplateName() {
        return processTemplateName;
    }
 
    public void setProcessTemplateName(String processTemplateName) {
        this.processTemplateName = processTemplateName;
    }
 
    public JComboBox getProcessTemplate() {
        return processTemplate;
    }
 
    public void setProcessTemplate(JComboBox processTemplate) {
        this.processTemplate = processTemplate;
    }
 
    public String getProcessName() {
        return processNameValue;
    }
 
    public void setProcessName(String processNameValue) {
        this.processNameValue = processNameValue;
        this.processName.setText(processNameValue);
    }
 
    public String getProcessDec() {
        return processDecValue;
    }
 
    public void setProcessDec(String processDecValue) {
        this.processDecValue = processDecValue;
        this.processDec.setText(processDecValue);
    }
 
    public Map<String, List<String>> getTaskAndUserMap() {
        return taskAndUserMap;
    }
 
    public void setTaskAndUserMap(Map<String, List<String>> taskAndUserMap) {
        this.taskAndUserMap = taskAndUserMap;
    }
    
    private List<String> resultList = new ArrayList<String>();
    private String[] headers ;
    private Class[] columnTypes ;
    private VCIBaseTableModel tableModel = null;
    public boolean isSaveFlag() {
        return saveFlag;
    }
 
    public void setSaveFlag(boolean saveFlag) {
        this.saveFlag = saveFlag;
    }
 
    public LaunchDialog(String processType,String[] headers,Map<String, Map<String,String>> resMap) {
        super(LogonApplication.frame,true);
        setTitle("发起流程");
        this.processType = processType;
        this.resMap = resMap;
        this.headers = headers;
        init();
        actionListener();
        initProcessTemplate();
        initObjectData();
        hiddenTableColumn();
        this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
        this.setLocationRelativeTo(null);
//        this.setVisible(true);
    }
 
    protected void init() {
        setBounds(100, 100, 812, 553);
        getContentPane().setLayout(new BorderLayout());
        contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
        getContentPane().add(contentPanel, BorderLayout.CENTER);
        contentPanel.setLayout(new BorderLayout(0, 0));
        {
            JSplitPane splitPane = new JSplitPane();
            splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
            contentPanel.add(splitPane, BorderLayout.CENTER);
            {
                JPanel panel = new JPanel();
                panel.setBorder(new TitledBorder(null, "流程信息", TitledBorder.LEADING, TitledBorder.TOP, null, null));
                splitPane.setLeftComponent(panel);
                GridBagLayout gbl_panel = new GridBagLayout();
                gbl_panel.columnWidths = new int[]{0, 0, 0, 0};
                gbl_panel.rowHeights = new int[]{0, 0, 0, 0, 0};
                gbl_panel.columnWeights = new double[]{0.0, 0.0, 1.0, Double.MIN_VALUE};
                gbl_panel.rowWeights = new double[]{0.0, 1.0, 0.0, 0.0, Double.MIN_VALUE};
                panel.setLayout(gbl_panel);
                {
                    JLabel label = new JLabel("流程名称");
                    GridBagConstraints gbc_label = new GridBagConstraints();
                    gbc_label.insets = new Insets(0, 0, 5, 5);
                    gbc_label.gridx = 1;
                    gbc_label.gridy = 0;
                    panel.add(label, gbc_label);
                }
                {
                    processName = new JTextField();
                    GridBagConstraints gbc_textField = new GridBagConstraints();
                    gbc_textField.insets = new Insets(0, 0, 5, 0);
                    gbc_textField.fill = GridBagConstraints.HORIZONTAL;
                    gbc_textField.gridx = 2;
                    gbc_textField.gridy = 0;
                    panel.add(processName, gbc_textField);
                    processName.setColumns(10);
                }
                {
                    JLabel label = new JLabel("描述信息");
                    GridBagConstraints gbc_label = new GridBagConstraints();
                    gbc_label.insets = new Insets(0, 0, 5, 5);
                    gbc_label.gridx = 1;
                    gbc_label.gridy = 1;
                    panel.add(label, gbc_label);
                }
                {
                    JScrollPane scrollPane = new JScrollPane();
                    GridBagConstraints gbc_scrollPane = new GridBagConstraints();
                    gbc_scrollPane.gridheight = 2;
                    gbc_scrollPane.insets = new Insets(0, 0, 5, 0);
                    gbc_scrollPane.fill = GridBagConstraints.BOTH;
                    gbc_scrollPane.gridx = 2;
                    gbc_scrollPane.gridy = 1;
                    panel.add(scrollPane, gbc_scrollPane);
                    {
                        processDec = new JTextArea();
                        scrollPane.setViewportView(processDec);
                    }
                }
                {
                    JLabel label = new JLabel("流程模板");
                    GridBagConstraints gbc_label = new GridBagConstraints();
                    gbc_label.anchor = GridBagConstraints.EAST;
                    gbc_label.insets = new Insets(0, 0, 0, 5);
                    gbc_label.gridx = 1;
                    gbc_label.gridy = 3;
                    panel.add(label, gbc_label);
                }
                {
                    processTemplate = new JComboBox();
                    GridBagConstraints gbc_processTemplate = new GridBagConstraints();
                    gbc_processTemplate.fill = GridBagConstraints.HORIZONTAL;
                    gbc_processTemplate.gridx = 2;
                    gbc_processTemplate.gridy = 3;
                    panel.add(processTemplate, gbc_processTemplate);
                }
            }
            {
                JPanel panel = new JPanel();
                panel.setBorder(new TitledBorder(null, "流程", TitledBorder.LEADING, TitledBorder.TOP, null, null));
                splitPane.setRightComponent(panel);
                panel.setLayout(new BorderLayout(0, 0));
                {
                    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
                    JPanel panel_1 = new JPanel();
                    tabbedPane.addTab("流程审批数据", panel_1);
                    panel_1.setLayout(new BorderLayout(0, 0));
                    {
                        JScrollPane scrollPane = new JScrollPane();
                        panel_1.add(scrollPane, BorderLayout.CENTER);
                        {
                            dataTable = new JTable();
                            columnTypes = new Class[headers.length];
                            for(int i=0;i<headers.length;i++){
                                columnTypes[i] = String.class;
                            }
                            tableModel = new VCIBaseTableModel(headers,columnTypes);
                            dataTable.setModel(tableModel);
                            scrollPane.setViewportView(dataTable);
                        }
                    }
                    panel_2 = new JPanel();
                    tabbedPane.addTab("选择任务处理人", panel_2);
                    GridBagLayout gbl_panel_2 = new GridBagLayout();
                    gbl_panel_2.columnWidths = new int[]{0, 0, 0, 0, 0, 0, 0, 0};
                    gbl_panel_2.rowHeights = new int[]{0, 0, 0};
                    gbl_panel_2.columnWeights = new double[]{0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, Double.MIN_VALUE};
                    gbl_panel_2.rowWeights = new double[]{0.0, 1.0, Double.MIN_VALUE};
                    panel_2.setLayout(gbl_panel_2);
                    {
                        JLabel label = new JLabel("任务列表");
                        GridBagConstraints gbc_label = new GridBagConstraints();
                        gbc_label.insets = new Insets(0, 0, 0, 5);
                        gbc_label.gridx = 1;
                        gbc_label.gridy = 1;
                        panel_2.add(label, gbc_label);
                    }
                    {
                        JScrollPane scrollPane = new JScrollPane();
                        GridBagConstraints gbc_scrollPane = new GridBagConstraints();
                        gbc_scrollPane.insets = new Insets(0, 0, 0, 5);
                        gbc_scrollPane.fill = GridBagConstraints.BOTH;
                        gbc_scrollPane.gridx = 2;
                        gbc_scrollPane.gridy = 1;
                        panel_2.add(scrollPane, gbc_scrollPane);
                        {
                            taskList = new JList();
                            taskListModel = new DefaultListModel();
                            taskList.setModel(taskListModel);
                            scrollPane.setViewportView(taskList);
                        }
                    }
                    {
                        JLabel label = new JLabel("人员列表");
                        GridBagConstraints gbc_label = new GridBagConstraints();
                        gbc_label.insets = new Insets(0, 0, 0, 5);
                        gbc_label.gridx = 3;
                        gbc_label.gridy = 1;
                        panel_2.add(label, gbc_label);
                    }
                    {
                        treeScrollPane = new JScrollPane();
                        GridBagConstraints gbc_scrollPane = new GridBagConstraints();
                        gbc_scrollPane.insets = new Insets(0, 0, 0, 5);
                        gbc_scrollPane.fill = GridBagConstraints.BOTH;
                        gbc_scrollPane.gridx = 4;
                        gbc_scrollPane.gridy = 1;
                        panel_2.add(treeScrollPane, gbc_scrollPane);
                        {
//                            VCIBaseTreeNode rootNode = new VCIBaseTreeNode("人员组织", "root");
                            treeModel = new VCIBaseTreeModel(rootNode);
                            initUserTree(rootNode, "root");
                            initRoleTree(rootNode, "root");
                            initDepartTree(rootNode, "root");
                            rightManagementTree = new VCIBaseTree(treeModel, new RightManagementTreeCellRenderer());
                            treeScrollPane.setViewportView(rightManagementTree);
                        }
                    }
                    {
                        JPanel panel_3 = new JPanel();
                        GridBagConstraints gbc_panel_3 = new GridBagConstraints();
                        gbc_panel_3.insets = new Insets(0, 0, 0, 5);
                        gbc_panel_3.fill = GridBagConstraints.BOTH;
                        gbc_panel_3.gridx = 5;
                        gbc_panel_3.gridy = 1;
                        panel_2.add(panel_3, gbc_panel_3);
                        GridBagLayout gbl_panel_3 = new GridBagLayout();
                        gbl_panel_3.columnWidths = new int[]{45, 0};
                        gbl_panel_3.rowHeights = new int[]{23, 0, 0, 0, 0, 0};
                        gbl_panel_3.columnWeights = new double[]{0.0, Double.MIN_VALUE};
                        gbl_panel_3.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
                        panel_3.setLayout(gbl_panel_3);
                        {
                            JButton btnNewButton = new JButton(">>");
                            btnNewButton.addActionListener(new ActionListener() {
                                public void actionPerformed(ActionEvent arg0) {
                                    int selectedIndex = taskList.getSelectedIndex();
                                    if(selectedIndex==-1){
                                        VCIOptionPane.showMessage(LogonApplication.frame, "请选择任务!");
                                        return;
                                    }
                                    VCIBaseTreeNode clickedNode = (VCIBaseTreeNode) rightManagementTree.getLastSelectedPathComponent();
                                    Object object = clickedNode.getObj();
                                    if (object instanceof RoleObject) {
                                        RoleObject role = (RoleObject) object;
                                        UserObject[] fetchUserInfoByRoleId;
                                        try {
                                            fetchUserInfoByRoleId = new RightManagementClientDelegate(LogonApplication.getUserEntityObject()).fetchUserInfoByRoleId(role.getId(), role.getType());
                                            if(fetchUserInfoByRoleId==null||fetchUserInfoByRoleId.length==0){
                                                VCIOptionPane.showMessage(LogonApplication.frame, "该角色下没有用户");
                                                return;
                                            }
                                        } catch (VCIException e1) {
                                            e1.printStackTrace();
                                        }
                                    }
                                    if (object instanceof DeptObject) {
                                        RightManagementClientDelegate del = new RightManagementClientDelegate(LogonApplication.getUserEntityObject());
                                        DeptObject dept = (DeptObject) object;
                                        UserObject[] objs;
                                        try {
                                            objs = del.getUserByDeptId(dept.getId());
                                            if(objs==null||objs.length==0){
                                                VCIOptionPane.showMessage(LogonApplication.frame, "该部门下没有用户");
                                                return;
                                            }
                                        } catch (VCIException e1) {
                                            e1.printStackTrace();
                                        }
                                    }
                                    addToUserListFromTreeNode(true);
                                    taskAndUserMap.put((String) taskList.getSelectedValue(), resultList);
                                    taskAndUserMap_1.put((String) taskList.getSelectedValue(), tmpListModel);
                                    userList.setModel(resultListModel);
                                    userList.updateUI();
                                }
                            });
                            GridBagConstraints gbc_btnNewButton = new GridBagConstraints();
                            gbc_btnNewButton.anchor = GridBagConstraints.NORTHWEST;
                            gbc_btnNewButton.insets = new Insets(0, 0, 5, 0);
                            gbc_btnNewButton.gridx = 0;
                            gbc_btnNewButton.gridy = 2;
                            panel_3.add(btnNewButton, gbc_btnNewButton);
                        }
                        {
                            JButton btnNewButton_1 = new JButton("<<");
                            btnNewButton_1.addActionListener(new ActionListener() {
                                public void actionPerformed(ActionEvent arg0) {
                                    removeUserFromUserList(true);
                                }
                            });
                            GridBagConstraints gbc_btnNewButton_1 = new GridBagConstraints();
                            gbc_btnNewButton_1.anchor = GridBagConstraints.NORTHWEST;
                            gbc_btnNewButton_1.gridx = 0;
                            gbc_btnNewButton_1.gridy = 4;
                            panel_3.add(btnNewButton_1, gbc_btnNewButton_1);
                        }
                    }
                    {
                        JScrollPane scrollPane = new JScrollPane();
                        GridBagConstraints gbc_scrollPane = new GridBagConstraints();
                        gbc_scrollPane.fill = GridBagConstraints.BOTH;
                        gbc_scrollPane.gridx = 6;
                        gbc_scrollPane.gridy = 1;
                        panel_2.add(scrollPane, gbc_scrollPane);
                        {
                            resultListModel = new DefaultListModel();
                            userList = new JList(resultListModel);
                            scrollPane.setViewportView(userList);
                        }
                    }
                    JPanel panel_3 = new JPanel();
                    tabbedPane.addTab("流程模板信息", panel_3);
                    panel_3.setLayout(new BorderLayout(0, 0));
                    {
                        panel_3.add(jspFlowImage);
                    }
                    panel.add(tabbedPane, BorderLayout.CENTER);
                }
            }
        }
        {
            JPanel buttonPane = new JPanel();
            buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
            getContentPane().add(buttonPane, BorderLayout.SOUTH);
            {
                JButton okButton = new JButton("启动流程");
                okButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent arg0) {
                        processNameValue = processName.getText().trim();
                        processDecValue = processDec.getText();
                        processTemplateName = ((ProcessDefinitionObject)processTemplate.getSelectedItem()).getId();
                        if(processNameValue==null||"".equals(processNameValue)){
                            VCIOptionPane.showMessage(LogonApplication.frame, "请填写流程名称!");
                            return;
                        }
                        if(taskAndUserMap==null){
                            VCIOptionPane.showMessage(LogonApplication.frame, "请选择候选人!");
                            return;
                        }
                        if(taskAndUserMap.size()==0){
                            VCIOptionPane.showMessage(LogonApplication.frame, "请选择候选人!");
                            return;
                        }
                        int size = taskListModel.getSize();
                        for(int i=0;i<size;i++){
                            String object = (String) taskListModel.get(i);
                            if(taskAndUserMap.get(object)==null||taskAndUserMap.get(object).size()==0){
                                VCIOptionPane.showMessage(LogonApplication.frame, "请选择候选人!");
                                return;
                            }
                        }
                        saveFlag = true;
                        dispose();
                    }
                });
                buttonPane.add(okButton);
            }
            {
                JButton cancelButton = new JButton("关闭");
                cancelButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent arg0) {
                        saveFlag = false;
                        dispose();
                    }
                });
                buttonPane.add(cancelButton);
            }
        }
    }
 
    protected void initProcessTemplate(){
        ProcessCategoryObject[] processCategories = null;
        ProcessCustomClientDelegate delSrv = new ProcessCustomClientDelegate(LogonApplication.getUserEntityObject());
        try {
            processCategories = delSrv.getProcessCategories("root");
        } catch (VCIException e) {
            e.printStackTrace();
        }
        String processCategoryId = "";
        if(processCategories!=null){
            for(int i=0;i<processCategories.length;i++){
                System.out.println(processCategories[i]);
                if(processType.equals(processCategories[i].getName())){
                    processCategoryId = processCategories[i].getId();
                }
            }
            
        }
        
        try {
            ProcessDefinitionObject[] processDefinitions = new ProcessCustomClientDelegate(LogonApplication.getUserEntityObject()).getProcessDefinitions(processCategoryId);
            for(int i = 0 ; i < processDefinitions.length ; i ++){
                if("1".equals(processDefinitions[i].getStatus())){
                    processTemplate.addItem(processDefinitions[i]);
                }
            }
        } catch (VCIException e) {
            e.printStackTrace();
        }
    }
    protected void loadFlowImage(ProcessDefinitionObject processDefinitionObject){
        loadFlowCharPanel(processDefinitionObject);
    }
    private VCIJLabel lblFlowImage = new VCIJLabel();
    private VCIJScrollPane jspFlowImage  = new VCIJScrollPane(lblFlowImage);
    private VCIBaseTreeNode userNode;
    private VCIBaseTreeNode roleNode;
    private VCIBaseTreeNode departmentNode;
    private void loadFlowCharPanel(ProcessDefinitionObject procDecObj){
        ProcessCustomClientDelegate del = new ProcessCustomClientDelegate(LogonApplication.getUserEntityObject());
        String deploymentId  = procDecObj.getJbpmDeploymentId();
        try {
            byte[] chartData = del.getProcessChart(deploymentId);
            InputStream is = new ByteArrayInputStream(chartData, 0, chartData.length);
            BufferedImage bu = ImageIO.read(is);
            ImageIcon icon = new ImageIcon(bu);
            lblFlowImage.setIcon(icon);
            Color color = new Color(255, 251, 255);
            jspFlowImage.getViewport().setBackground(color);
        } catch (VCIException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    protected void actionListener(){
        taskList.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent arg0) {
                super.mouseClicked(arg0);
                try {
                    ProcessDefinitionObject procDecObj = (ProcessDefinitionObject)processTemplate.getSelectedItem();
                    String[] allCandidatesForTask = new String[0];
                    String selectTask = (String)taskList.getSelectedValue();
                    //子流程节点格式----任务(子流程名称:deployId)
                    //解析子流程节点
                    if (selectTask.indexOf("(") > 0 && selectTask.indexOf(":") > 0) {
                        String taskName = selectTask.substring(0, selectTask.indexOf("("));
                        String deployId = selectTask.substring(selectTask.lastIndexOf(":") + 1, selectTask.lastIndexOf(")"));
                        allCandidatesForTask = new ProcessCustomClientDelegate().getAllCandidatesForTask(deployId, taskName, "");
                    } else {
                        allCandidatesForTask = new ProcessCustomClientDelegate().getAllCandidatesForTask(procDecObj.getJbpmDeploymentId(), selectTask, "");
                    }
                    
                    String templateFlag = FlowCustomProperties.getStrPro("workflow.template");
                    
                    if (templateFlag.equals("1")) {
                        if(allCandidatesForTask.length==1){
                            if("#{process_applicant}".equals(allCandidatesForTask[0])){
                                userValue = null;
                            }else{
                                userValue = allCandidatesForTask[0];
                            }
                            roleValue = null;
                            departmentValue = null;
                        }
                        if(allCandidatesForTask.length==2){
                            userValue = allCandidatesForTask[0];
                            roleValue = allCandidatesForTask[1];
                            departmentValue = null;
                        }
                        if(allCandidatesForTask.length==3){
                            userValue = allCandidatesForTask[0];
                            roleValue = allCandidatesForTask[1];
                            departmentValue = allCandidatesForTask[2];
                        }
                    } else if (templateFlag.equals("2")){
                        constructWorkFlowUserInfo(allCandidatesForTask);
                    }
                    
                    resultList = taskAndUserMap.get(taskList.getSelectedValue());
                    if(resultList == null){
                        resultList = new ArrayList<String>();
                    }
                    resultListModel.clear();
                    DefaultListModel defaultListModel = taskAndUserMap_1.get(taskList.getSelectedValue());
                    for(int i=0;i<resultList.size();i++){
                        String resultValue = resultList.get(i);
                        int indexOf = resultValue.indexOf(":");
                        String resultFilter = resultValue.substring(indexOf+1);
                        for(int j=0;j<defaultListModel.size();j++){
                            Object object = defaultListModel.get(j);
                            if(j==0){
                                if(object instanceof UserObject){
                                    UserObject o = (UserObject)object;
                                    if(resultFilter.equals(o.getUserName())){
                                        resultListModel.addElement(o);
                                    }
                                }
                                if(object instanceof RoleObject){
                                    RoleObject o = (RoleObject)object;
                                    if(resultFilter.equals(o.getName())){
                                        resultListModel.addElement(o);
                                    }
                                }
                                if(object instanceof DeptObject){
                                    DeptObject o = (DeptObject)object;
                                    if(resultFilter.equals(o.getName())){
                                        resultListModel.addElement(o);
                                    }
                                }
                            }else{
                                if(object instanceof UserObject){
                                    UserObject o = (UserObject)object;
                                    if(resultFilter.equals(o.getUserName())){
                                        if(checkUserIdAdded(o)) continue;
                                        resultListModel.addElement(o);
                                    }
                                }
                                if(object instanceof RoleObject){
                                    RoleObject o = (RoleObject)object;
                                    if(resultFilter.equals(o.getName())){
                                        if(checkRoleIdAdded(o)) continue;
                                        resultListModel.addElement(o);
                                    }
                                }
                                if(object instanceof DeptObject){
                                    DeptObject o = (DeptObject)object;
                                    if(resultFilter.equals(o.getName())){
                                        if(checkDeptIdAdded(o)) continue;
                                        resultListModel.addElement(o);
                                    }
                                }
                            }
                        }
                    }
                    
                } catch (VCIException e) {
                    e.printStackTrace();
                }
                userList.setModel(resultListModel);
                userList.updateUI();
                VCIBaseTreeNode root = (VCIBaseTreeNode) treeModel.getRoot();
                int childCount = root.getChildCount();
                for(int i=0;i<childCount;i++){
                    VCIBaseTreeNode childAt = (VCIBaseTreeNode) root.getChildAt(i);
                    childAt.removeAllChildren();
                }
                treeModel.reload();
                rightManagementTree.updateUI();
            }
        });
        processTemplate.addActionListener(new ActionListener() {
            
            public void actionPerformed(ActionEvent arg0) {
                changeProcessDefinitionObject(((ProcessDefinitionObject)processTemplate.getSelectedItem()));
            }
        });
        rightManagementTree.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                if(e.getClickCount() != 2) return;
                TreePath path = rightManagementTree.getPathForLocation(e.getX(), e.getY());
                VCIBaseTreeNode clickedNode = (VCIBaseTreeNode) rightManagementTree.getLastSelectedPathComponent();
                if(path == null) return;
                if(clickedNode.getLevel()<2) return;
                Object object = clickedNode.getObj();
                if (object instanceof RoleObject) {
                    RoleObject role = (RoleObject) object;
                    UserObject[] fetchUserInfoByRoleId;
                    try {
                        fetchUserInfoByRoleId = new RightManagementClientDelegate(LogonApplication.getUserEntityObject()).fetchUserInfoByRoleId(role.getId(), role.getType());
                        if(fetchUserInfoByRoleId==null||fetchUserInfoByRoleId.length==0){
                            VCIOptionPane.showMessage(LogonApplication.frame, "该角色下没有用户");
                            return;
                        }
                    } catch (VCIException e1) {
                        e1.printStackTrace();
                    }
                }
                if (object instanceof DeptObject) {
                    RightManagementClientDelegate del = new RightManagementClientDelegate(LogonApplication.getUserEntityObject());
                    DeptObject dept = (DeptObject) object;
                    UserObject[] objs;
                    try {
                        objs = del.getUserByDeptId(dept.getId());
                        if(objs==null||objs.length==0){
                            VCIOptionPane.showMessage(LogonApplication.frame, "该部门下没有用户");
                            return;
                        }
                    } catch (VCIException e1) {
                        e1.printStackTrace();
                    }
                }
                transmitTreeObject.setCurrentTreeNode(clickedNode);
                addToUserListFromTreeNode(false);
                taskAndUserMap.put((String) taskList.getSelectedValue(), resultList);
                taskAndUserMap_1.put((String) taskList.getSelectedValue(), tmpListModel);
            }
        });
        rightManagementTree.addTreeSelectionListener(new TreeSelectionListener() {
            public void valueChanged(TreeSelectionEvent e) {
                TreePath treePath = e.getPath();
                VCIBaseTreeNode selectNode = (VCIBaseTreeNode) treePath.getLastPathComponent();
                transmitTreeObject.setCurrentTreeNode(selectNode);
            }
        });
 
        /**
         * 树的展开事件
         */
        rightManagementTree.addTreeExpansionListener(new TreeExpansionListener() {
            public void treeExpanded(TreeExpansionEvent event) {
                TreePath treePath = event.getPath();
                selectNode = (VCIBaseTreeNode) treePath.getLastPathComponent();
                transmitTreeObject.setCurrentTreeNode(selectNode);
                Object object = selectNode.getObj();
//                if (!selectNode.isExpand()) {
                if (selectNode.getChildCount()==0) {
                    selectNode.setExpand(true);
                    transmitTreeObject.getCurrentTreeNode().removeAllChildren();
                    
                    if (object instanceof UserObject) {
                        UserObject user = (UserObject) object;
                        if (user.getId().equals("root")) {
                            try {
                                UserObject[] userInfos = new RightManagementClientDelegate(LogonApplication.getUserEntityObject()).fetchUserInfo();
                                for (UserObject userObject : userInfos) {
                                    if(userValue!=null&&!"".equals(userValue)){
                                        String[] split = userValue.split(",");
                                        for(String userSplit : split){
                                            if(userSplit.equals(userObject.getUserName())){
                                                treeModel.insertNodeInto(new VCIBaseTreeNode(userObject.toString(), userObject), selectNode, selectNode.getChildCount());
                                            }
                                        }
                                    }
//                                    else{
//                                        treeModel.insertNodeInto(new VCIBaseTreeNode(userObject.toString(), userObject), selectNode, selectNode.getChildCount());
//                                    }
                                }
                                
                            } catch (VCIException e) {
                                e.printStackTrace();
                                return;
                            }
                        }
                    }
                    if (object instanceof RoleObject) {
                        RoleObject role = (RoleObject) object;
                        if (role.getId().equals("root")) {
                            try {
                                RoleObject[] roleInfos = new RightManagementClientDelegate(LogonApplication.getUserEntityObject()).fetchRoleInfo();
 
                                for (RoleObject roleObject : roleInfos) {
                                    if(roleValue!=null&&!"".equals(roleValue)){
                                        String[] split = roleValue.split(",");
                                        for(String roleSplit : split){
                                            if(roleSplit.equals(roleObject.getId())){
                                                treeModel.insertNodeInto(new VCIBaseTreeNode(roleObject.getName(), roleObject), selectNode, selectNode.getChildCount());
                                            }
                                        }
                                    }
//                                    else{
//                                        treeModel.insertNodeInto(new VCIBaseTreeNode(roleObject.getName(), roleObject), selectNode, selectNode.getChildCount());
//                                    }
                                }
 
                            } catch (VCIException e) {
                                e.printStackTrace();
                                return;
                            }
                        }else{
                            try {
                                UserObject[] fetchUserInfoByRoleId = new RightManagementClientDelegate(LogonApplication.getUserEntityObject()).fetchUserInfoByRoleId(role.getId(), role.getType());
                                for (UserObject userObject : fetchUserInfoByRoleId) {
                                    treeModel.insertNodeInto(new VCIBaseTreeNode(userObject.toString(), userObject), selectNode, selectNode.getChildCount());
                                }
                            } catch (VCIException e) {
                                e.printStackTrace();
                            }
                        }
 
                    }
                    if (object instanceof DeptObject){
                        RightManagementClientDelegate del = new RightManagementClientDelegate(LogonApplication.getUserEntityObject());
                        try {
                            DeptObject[] DeptInfos = null;
                            DeptObject deptObject = (DeptObject) object;
                            if (deptObject.getId().equals("root")){
                                DeptInfos= new RightManagementClientDelegate(LogonApplication.getUserEntityObject())
                                                    .fetchDepartmentInfo();
                                
                            }else{
                                DeptInfos = new RightManagementClientDelegate(LogonApplication.getUserEntityObject())
                                                      .fetchDepartmentInfoByParentId(deptObject.getId());
                            }
                            if (DeptInfos == null){
                                if (!deptObject.getId().equals("root")){
                                    UserObject[] objs = del.getUserByDeptId(deptObject.getId());
                                    for(int i=0;i<objs.length;i++) {
                                        treeModel.insertNodeInto(new VCIBaseTreeNode(objs[i].toString(), objs[i]),selectNode,selectNode.getChildCount());
                                    }
                                }else{
                                    return;
                                }
                            }
                            if(DeptInfos!=null){
                                int len = DeptInfos.length;
                                for (int i = 0; i < len; i++) {
                                    if(departmentValue!=null&&!"".equals(departmentValue)){
                                        String[] split = departmentValue.split(",");
                                        for(String deptmentSplit : split){
                                            if(deptmentSplit.equals(DeptInfos[i].getId())){
                                                treeModel.insertNodeInto(new VCIBaseTreeNode(DeptInfos[i].getName(), DeptInfos[i]),selectNode,selectNode.getChildCount());
                                            }
                                        }
                                    }
//                                    else{
//                                        treeModel.insertNodeInto(new VCIBaseTreeNode(DeptInfos[i].getName(), DeptInfos[i]),selectNode,selectNode.getChildCount());
//                                    }
                                }
                            }
                            
                        } catch (VCIException e) {
                            e.printStackTrace();
                            return;
                        }            
                    }
                }
            }
 
            public void treeCollapsed(TreeExpansionEvent arg0) {
 
            }
        });
        transmitTreeObject.setTreeModel(treeModel);
        transmitTreeObject.setTree(rightManagementTree);
 
    }
    
    /**
     * 判断设置用户的格式是否为新格式
     * @param allCandidatesForTask
     * @return
     */
    private boolean isNewUserFormat(String[] allCandidatesForTask) {
        boolean isNew = false;
        for (int i = 0; i < allCandidatesForTask.length; i++) {
            if (allCandidatesForTask[i].indexOf(":") > 0) {
                return true;
            }
        }
        
        return false;
    }
    
    protected void initUserTree(VCIBaseTreeNode rootNode, String puid) {
        String userName = LogonApplication.getUserEntityObject().getUserName();
        try {
            userInfo = new RightManagementClientDelegate(LogonApplication.getUserEntityObject()).fetchUserInfoByName(userName);
        } catch (VCIException e) {
            e.printStackTrace();
            return;
        }
        UserObject userObject = new UserObject();
        userObject.setId("root");
        userNode = new VCIBaseTreeNode("用户", userObject);
        rootNode.add(userNode);
    }
    protected void initRoleTree(VCIBaseTreeNode rootNode, String puid) {
        String userName = LogonApplication.getUserEntityObject().getUserName();
        try {
            userInfo = new RightManagementClientDelegate(LogonApplication.getUserEntityObject()).fetchUserInfoByName(userName);
        } catch (VCIException e) {
            e.printStackTrace();
            return;
        }
        RoleObject roleObject = new RoleObject();
        roleObject.setId("root");
        roleNode = new VCIBaseTreeNode(LocaleDisplay.getI18nString("rmip.stafforg.menu.role", "RMIPFramework", getLocale()), roleObject);
        rootNode.add(roleNode);
 
    }
    protected void initDepartTree(VCIBaseTreeNode rootNode, String puid) {
        String userName = LogonApplication.getUserEntityObject().getUserName();
        try {
            userInfo = new RightManagementClientDelegate(LogonApplication.getUserEntityObject()).fetchUserInfoByName(userName);
        } catch (VCIException e) {
            e.printStackTrace();
            return;
        }
        DeptObject rootDepartment = new DeptObject();
        rootDepartment.setId("root");
        departmentNode = new VCIBaseTreeNode(
                LocaleDisplay.getI18nString("rmip.stafforg.menu.department",
                        "RMIPFramework", getLocale()), rootDepartment);
        rootNode.add(departmentNode);
    }
    protected void addToUserListFromTreeNode(boolean batch){
        LinkedList<VCIBaseTreeNode> nodeList = new LinkedList<VCIBaseTreeNode>();
        TreePath[] paths = rightManagementTree.getSelectionPaths();
        if(batch && paths != null){
            for(TreePath path : paths){
                nodeList.add((VCIBaseTreeNode)path.getLastPathComponent());
            }
        } else{
            nodeList.add(transmitTreeObject.getCurrentTreeNode());
        }
        for(VCIBaseTreeNode selectNode : nodeList){
            if(selectNode == null) continue;
            Object object = selectNode.getObj();
            if (object instanceof UserObject) {
                UserObject user = (UserObject) object;
                if("root".equals(user.getId())){
                    continue;
                }
                if(checkUserIdAdded(user)) return;
                resultListModel.addElement(object);
                tmpListModel.addElement(object);
                resultList.add("user:"+user.getUserName());
            }
            if (object instanceof RoleObject) {
                RoleObject role = (RoleObject) object;
                if("root".equals(role.getId())){
                    continue;
                }
                if(checkRoleIdAdded(role)) return;
                resultListModel.addElement(object);
                tmpListModel.addElement(object);
                resultList.add("role:"+role.getName());
            }
            if (object instanceof DeptObject) {
                DeptObject dept = (DeptObject) object;
                if("root".equals(dept.getId())){
                    continue;
                }
                if(checkDeptIdAdded(dept)) return;
                resultListModel.addElement(object);
                tmpListModel.addElement(object);
                resultList.add("department:"+dept.getName());
            }
        }
    }
    protected void removeUserFromUserList(boolean batch){
        Object[] selectedIndices = userList.getSelectedValues();
        String selectedTaskValue = (String) taskList.getSelectedValue();
        if(!batch){
            selectedIndices = new Object[]{userList.getSelectedValue()};
        }
        for(int i =0;i<selectedIndices.length;i++){
            resultListModel.removeElement(selectedIndices[i]);
            tmpListModel.removeElement(selectedIndices[i]);
            if(selectedIndices[i] instanceof UserObject){
                UserObject u = (UserObject) selectedIndices[i];
                resultList.remove("user:"+u.getUserName());
            }
            if(selectedIndices[i] instanceof RoleObject){
                RoleObject u = (RoleObject) selectedIndices[i];
                resultList.remove("role:"+u.getName());
            }
            if(selectedIndices[i] instanceof DeptObject){
                DeptObject u = (DeptObject) selectedIndices[i];
                resultList.remove("department:"+u.getName());
            }
        }
        
        taskAndUserMap.put(selectedTaskValue, resultList);
        taskAndUserMap_1.put(selectedTaskValue, tmpListModel);
        
    }
    protected boolean checkUserIdAdded(UserObject obj){
        boolean res = false;
        int size = resultListModel.getSize();
        for(int i = 0; i < size; i++){
            if(resultListModel.get(i) instanceof UserObject){
                res =  obj.getId().equals(((UserObject)resultListModel.get(i)).getId());
                if(res) break;
            }else{
                res = obj.getUserName().equals(resultListModel.get(i));
                if(res) break;
            }
        }
        return res;
    }
    protected boolean checkRoleIdAdded(RoleObject obj){
        boolean res = false;
        int size = resultListModel.getSize();
        for(int i = 0; i < size; i++){
            if(resultListModel.get(i) instanceof RoleObject){
                res = obj.getId().equals(((RoleObject)resultListModel.get(i)).getId());
                if(res) break;
            }else{
                res = obj.getName().equals(resultListModel.get(i));
                if(res) break;
            }
        }
        return res;
    }
    protected boolean checkDeptIdAdded(DeptObject obj){
        boolean res = false;
        int size = resultListModel.getSize();
        for(int i = 0; i < size; i++){
            if(resultListModel.get(i) instanceof DeptObject){
                res = obj.getId().equals(((DeptObject)resultListModel.get(i)).getId());
                if(res) break;
            }else{
                res = obj.getName().equals(resultListModel.get(i));
                if(res) break;
            }
        }
        return res;
    }
    protected void initTaskList(ProcessDefinitionObject processDefinitionObject){
        ProcessCustomClientDelegate delegate = new ProcessCustomClientDelegate();
        try {
            taskListModel.clear();
            String jbpmDeploymentId = delegate.getDeploymentID(processDefinitionObject.getId());
            String[] allTaskNames = delegate.getAllTaskNames(jbpmDeploymentId);
            for(int i=0;i<allTaskNames.length;i++){
                taskListModel.addElement(allTaskNames[i]);
            }
        } catch (VCIException e) {
            e.printStackTrace();
        } catch (VCIError e) {
            e.printStackTrace();
        }
    }
    
    /**
     * 更换选择的洛模板
     * @param processDefinitionObject 流程模板定义对象
     * @return 
     */
    public void changeProcessDefinitionObject(ProcessDefinitionObject processDefinitionObject){
        processTemplate.setSelectedItem(processDefinitionObject);
        taskAndUserMap.clear();
        taskAndUserMap_1.clear();
        initTaskList(processDefinitionObject);
        loadFlowImage(processDefinitionObject);
    }
    protected void initObjectData(){
        tableModel.list.clear();
        VCIBaseTableNode vciBaseTableNode = null;
        int c = 0;
        for(Entry<String, Map<String, String>> entrySet : resMap.entrySet()){
            String key = entrySet.getKey();
//            for(int i =0;i<objId.length;i++){
//                vciBaseTableNode = new VCIBaseTableNode(objId[i]);
//                vciBaseTableNode.setPropertyValueByName(dataTable.getColumnName(0), objCode[i]==null?"":objCode[i]);
//                vciBaseTableNode.setPropertyValueByName(dataTable.getColumnName(1), objNum[i]==null?"":objNum[i]);
//                vciBaseTableNode.setPropertyValueByName(dataTable.getColumnName(2), objName[i]==null?"":objName[i]);
//                tableModel.addRow(i, vciBaseTableNode);
            vciBaseTableNode = new VCIBaseTableNode(key);
            Map<String, String> value = entrySet.getValue();
            
            for(Entry<String, String> data : value.entrySet()){
                for(int k=0;k<headers.length;k++){
                    if(headers[k].equals(data.getKey())){
                        vciBaseTableNode.setPropertyValueByName(dataTable.getColumnName(k), data.getValue()==null?"":data.getValue());
                    }
                }
            }
            tableModel.addRow(c, vciBaseTableNode);
            c++;
//            }
        }
        dataTable.setModel(tableModel);
        dataTable.updateUI();
    }
    
    protected void hiddenTableColumn(){
        TableColumnModel columnModel = dataTable.getColumnModel();
        TableColumn column = columnModel.getColumn(0);
        column.setWidth(0);
        dataTable.updateUI();
    }
    
    private void constructWorkFlowUserInfo(String[] userInfos) {
        List<String> userList = new ArrayList<String>();
        List<String> roleList = new ArrayList<String>();
        List<String> deptList = new ArrayList<String>();
        for (int i = 0; i < userInfos.length; i++) {
            String[] cVal = userInfos[i].split(",");
            for (int j = 0; j < cVal.length; j++) {
                String[] valType = cVal[j].split(":");
                if (valType.length != 2) {
                    continue;
                }
                if (valType[0].equalsIgnoreCase("user")) {
                    userList.add(valType[1]);
                } else if (valType[0].equalsIgnoreCase("role")) {
                    roleList.add(valType[1]);
                } else if (valType[0].equalsIgnoreCase("org")) {
                    deptList.add(valType[1]);
                }
             }
        }
        userList = getUserByPersonID(userList);
        if (userList.size() > 0) {
            this.userValue = convertListToString(userList);
        }
        if (roleList.size() > 0) {
            this.roleValue = convertListToString(roleList);
        }
        if (deptList.size() > 0 ){
            this.departmentValue  = convertListToString(deptList);
        }
    }
    
    private String convertListToString(List<String> list) {
        String str = Arrays.toString(list.toArray(new String[0]));
        return str.substring(1, str.length() - 1);
    }
    
    private List<String> getUserByPersonID(List<String> personIdList) {
        List<String> userList = new ArrayList<String>();
        QueryTemplate qt2 = new QueryTemplate();
        qt2.setId("btmQuery");
        qt2.setBtmType("person");
        qt2.setType("btm");
        List<String> clauseList = new ArrayList<String>();
        clauseList.add("*");
        qt2.setClauseList(clauseList);
        qt2.setQueryChildrenFlag(false);
        qt2.setRightFlag(false);
        qt2.setVersion(1);
        
        Map<String, String> map = new HashMap<String, String>();
        Condition condition_ = OQTool.getCondition(map);
        
        for(String key : personIdList){
            map.put("oid", key);
            Condition condition = OQTool.getCondition(map);
            condition_ = OQTool.mergeCondition(condition, condition_, Connector.OR);
            map.clear();
        }
        qt2.setCondition(condition_);
        try {
            BusinessObject[] bos = QTClient.getService().findBTMObjects(qt2.getId(),  OQTool.qtTOXMl(qt2).asXML());
            for (int i = 0; i < bos.length; i++) {
                userList.add(bos[i].id);
            }
        } catch (VCIError e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        
        return userList;
    }
}