田源
2024-03-07 4b4083fd73dc27ece42f4835483565eef0e4f608
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
package com.vci.server.framework.delegate;
 
 
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
 
import org.apache.commons.lang3.StringUtils;
 
import com.vci.common.log.LogType;
import com.vci.common.objects.UserEntity;
import com.vci.common.resource.CommonProperties;
import com.vci.common.utility.ObjectUtility;
import com.vci.corba.common.VCIError;
import com.vci.corba.framework.data.AppConfigDetailInfo;
import com.vci.corba.framework.data.DataSourceInfo;
import com.vci.corba.framework.data.SpecialCharClsfInfo;
import com.vci.corba.framework.data.SpecialCharInfo;
import com.vci.corba.framework.data.SystemCfgInfo;
import com.vci.corba.common.data.UserEntityInfo;
import com.vci.server.base.delegate.BaseDelegate;
import com.vci.server.base.delegate.UserEntityDelegate;
import com.vci.server.framework.systemConfig.SystemCfg;
import com.vci.server.framework.systemConfig.SystemCfgService;
import com.vci.server.framework.systemConfig.log.LogRecordUtil;
import com.vci.server.framework.systemConfig.specialchar.SpecialChar;
import com.vci.server.framework.systemConfig.specialchar.SpecialCharService;
import com.vci.server.framework.systemConfig.specialcharclsf.SpecialCharClsf;
import com.vci.server.framework.systemConfig.specialcharclsf.SpecialCharClsfService;
 
public class SystemCfgDelegate extends BaseDelegate{
    
    public String getConfigValue(String key)  throws VCIError {
        // add by xchao 2017.11.28 begin
        // 优先基于系统配置选项中取
        // 如果没有取到则从打包到jar中的配置文件中读取
        AppConfigDetailInfo acdi = new AppConfigDetailDelegate(new UserEntityInfo("", "", "")).getAppConfigDetailByKey(key);
        if(acdi != null && StringUtils.isNotBlank(acdi.id)){
            return acdi.value;
        }
        // add by xchao 2017.11.28 end        
        return CommonProperties.getStringProperty(key);
    }
    
//    public String getConfigValue(String propertyPath, String key) throws VCIError
//    {
//        // add by xchao 2017.11.28 begin
//        // 优先基于系统配置选项中取
//        // 如果没有取到则从打包到jar中的配置文件中读取
//        AppConfigDetailInfo acdi = new AppConfigDetailDelegate(new UserEntityInfo("", "", "")).getAppConfigDetailByKey(key);
//        if(StringUtils.isNotEmpty(acdi.id)){
//            return acdi.value;
//        }
//        // add by xchao 2017.11.28 end
//       try {
//           if(propertyPath == null || "".equals(propertyPath)){
//               return CommonProperties.getStringProperty(key);
//           }
//           return CommonPropertiesExt.getProperty(propertyPath, key);
//        } catch (Exception e) {
//            e.printStackTrace();
//            return "";
//        }
//    }
    /*** 得到相应的 字符集、流水方式、日期格式、 补位字符对象
     * 
     * @param type 系统配置管理  字符集:charset   流水方式:flowType  日期格式:dateFormat  补位字符:fillerChar
     * @return
     * @throws VCIError
     */
    public SystemCfgInfo[] fetchSystemCfgInfo(String type) throws VCIError {
        List<SystemCfg> list = null;
        try {
            SystemCfgService systemCfgService = new SystemCfgService();
            list = systemCfgService.selectSystemCfgByType(type);
        } catch (Exception e) {
            e.printStackTrace();
            //throw new VCIError("10014 , "");
        }
        int size = list.size();
        SystemCfgInfo[] systemCfgInfo = new SystemCfgInfo[size];
        for (int i = 0; i < size; i++) {
            systemCfgInfo [i] = changeSystemCfgToSystemCfgInfo(list.get(i));
        }
        return systemCfgInfo;
    }
    
 
    /***
     * 存储特殊字符分类
     * @param specialCharClsfInfo  特殊字符分类对象
     * @return
     * @throws VCIError
     */
    public String saveSpecialCharClsf(SpecialCharClsfInfo specialCharClsfInfo, UserEntityInfo userEntityInfo) throws VCIError {
        SpecialCharClsfService specialCharClsfService = new SpecialCharClsfService();
        UserEntityDelegate.setUserEntityToService(specialCharClsfService, userEntityInfo);
        SpecialCharClsf checkSpecialCharClsf = specialCharClsfService.selectSpecialCharClsfByName(specialCharClsfInfo.name);
        if (checkSpecialCharClsf != null) {
            throw new VCIError("10061", new String[]{});
        }
        String id = ObjectUtility.getNewObjectID36();
        specialCharClsfInfo.id = id;
        UserEntity userEntity = changeUserEntityInfoToUserEntity(userEntityInfo);
        try {
            SpecialCharClsf special = changeSpecialCharClsfInfoToSpecialCharClsf(specialCharClsfInfo);
            specialCharClsfService.saveSpecialCharClsf(special);
            LogRecordUtil.writeLog(userEntity, "添加", "成功", special.getLogInfo(),LogType.GeneralOperation,special.getId());
        } catch (Exception e) {
            //LogRecordUtil.writeLog(userEntity, "特殊字符分类", "添加失败!",LogType.GeneralOperation);
            e.printStackTrace();
            throw new VCIError("150008", new String[]{});
        }
        return id;
    }
    
    /***
     *  更新特殊字符分类
     * @param specialCharInfo  要更新的特殊字符分类
     * @return
     * @throws VCIError
     */
    public boolean updateSpecialCharClsf(SpecialCharClsfInfo specialCharClsfInfo, UserEntityInfo userEntityInfo) throws VCIError {
        SpecialCharClsfService specialCharClsfService = new SpecialCharClsfService();
        SpecialCharClsf checkSpecialCharClsf = specialCharClsfService.selectSpecialCharClsfByName(specialCharClsfInfo.name);
        UserEntityDelegate.setUserEntityToService(specialCharClsfService, userEntityInfo);
        UserEntity userEntity = changeUserEntityInfoToUserEntity(userEntityInfo);
        if (checkSpecialCharClsf != null && !checkSpecialCharClsf.getId().equals(specialCharClsfInfo.id)) {
            throw new VCIError("10063", new String[]{});
        }
        try {
            SpecialCharClsf specia = changeSpecialCharClsfInfoToSpecialCharClsf(specialCharClsfInfo);
            SpecialCharClsf speciaBefore = specialCharClsfService.selectSpecialCharClsfById(specia.getId());
            specialCharClsfService.updateSpecialCharClsf(specia);
            StringBuilder logres = new StringBuilder();
            logres.append("更新前:"+speciaBefore.getLogInfo());
            logres.append(" 更新后:"+specia.getLogInfo());
            LogRecordUtil.writeLog(userEntity, "更新", "成功", logres.toString(), LogType.GeneralOperation,specia.getId());
            } catch (Exception e) {
            e.printStackTrace();
            throw new VCIError("150012", new String[]{});
        }
        return true;
    }
    
    /**
     * 
     * <p>Description:获取所有的特殊字符分类 </p>
     * 
     * @author sunbo
     * @time 2012-5-25
     * @return
     * @throws VCIError
     */
    public SpecialCharClsfInfo[] getSpecialCharClsfList(int pageNo,int pageSize) throws VCIError {
        SpecialCharClsfService specialCharClsfService = new SpecialCharClsfService();
        List<SpecialCharClsf> list = null; 
        try {
            list = specialCharClsfService.getSpecialCharClsfList(pageNo,pageSize);
        } catch (Exception e) {
            e.printStackTrace();
            //throw new VCIError("10020 , "");
        }
        int size = list.size();
        SpecialCharClsfInfo[] specialCharClsfInfo = new SpecialCharClsfInfo[size];
        for (int i = 0; i < size; i++) {
            specialCharClsfInfo[i] = changeSpecialCharClsfToSpecialCharClsfInfo(list.get(i));
        }
        return specialCharClsfInfo;
    }
 
    
    public SpecialCharInfo[] getBychar(String plscsfoId){
        SpecialCharInfo[] specialCharInfos=null;
        SpecialCharClsfService specialCharClsfService = new SpecialCharClsfService();
        
        List<SpecialChar> specialCharList=specialCharClsfService.getbyChar(plscsfoId);
        specialCharInfos=new SpecialCharInfo[specialCharList.size()];
        
        for (int i = 0; i < specialCharList.size(); i++) {
            
            specialCharInfos[i]= changeSpecialCharToSpecialCharInfo(specialCharList.get(i));
        }
        
        
        return specialCharInfos;
    }
    /**
     * 
     * <p>Description:获取所有的特殊字符分类 </p>
     * 
     * @author sunbo
     * @time 2012-5-25
     * @return
     * @throws VCIError
     */
    public SpecialCharClsfInfo[] getSpecialCharClsfList() throws VCIError {
        SpecialCharClsfService specialCharClsfService = new SpecialCharClsfService();
        List<SpecialCharClsf> list = null; 
        try {
            list = specialCharClsfService.getSpecialCharClsfList();
        } catch (Exception e) {
            e.printStackTrace();
            //throw new VCIError("10020 , "");
        }
        int size = list.size();
        SpecialCharClsfInfo[] specialCharClsfInfo = new SpecialCharClsfInfo[size];
        for (int i = 0; i < size; i++) {
            specialCharClsfInfo[i] = changeSpecialCharClsfToSpecialCharClsfInfo(list.get(i));
        }
        return specialCharClsfInfo;
    }
    
    public int getSpecialCharClsTotal() throws VCIError {
        int total = 0;
        try {
            total = new SpecialCharClsfService().getSpecialCharClsTotal();
        }catch(Exception e) {
            throw new VCIError("150117", new String[0]);
        }
        
        return total;
    }
    
    /***
     * 
     * @param ids 根据ID删除特殊字符分类
     * @return
     * @throws VCIError
     */
    public boolean deletSpecialCharClsf(String[] ids, UserEntityInfo userEntityInfo) throws VCIError {
        boolean rs = true;
        UserEntity userEntity = changeUserEntityInfoToUserEntity(userEntityInfo);
        SpecialCharClsfService specialCharClsfService = new SpecialCharClsfService();
        try {
            UserEntityDelegate.setUserEntityToService(specialCharClsfService, userEntityInfo);
            LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
            for(String id : ids){
                SpecialCharClsf specia = specialCharClsfService.selectSpecialCharClsfById(id);
                map.put(specia.getLogInfo(), specia.getId());
            }
            rs = specialCharClsfService.deleteSpecialCharClsfByHQL(ids);
            Iterator<String> it = map.keySet().iterator();
            while(it.hasNext()){
                String speciaId = it.next();
                LogRecordUtil.writeLog(userEntity, "删除", "成功", speciaId, LogType.GeneralOperation,map.get(speciaId));
                }
        } catch (Exception e) {
            //LogRecordUtil.writeLog(userEntity, "特殊字符分类", "删除失败!",LogType.GeneralOperation);
            e.printStackTrace();
            throw new VCIError("150002", new String[]{});
        }
        return rs;
    }
    /***
     * 存储特殊字符
     * @param specialCharInfo 要存储的特殊字符
     * @return
     * @throws VCIError
     */
    public String saveSpecialChar(SpecialCharInfo[] specialCharInfos, UserEntityInfo userEntityInfo) throws VCIError {
        SpecialCharService specialCharService = new SpecialCharService();
        int length = specialCharInfos.length;
        UserEntityDelegate.setUserEntityToService(specialCharService, userEntityInfo);
        UserEntity userEntity = changeUserEntityInfoToUserEntity(userEntityInfo);
        for (int i = 0; i < length; i++) {
            SpecialChar checksPecialChar = specialCharService.getSepcialCharByClsfIdAndVal(specialCharInfos[i].parentId, specialCharInfos[i].value);
            if (checksPecialChar != null) {
                throw new VCIError("10060", new String[]{""});
            }
        }
        for (int i = 0; i < length; i++) {
            String id = ObjectUtility.getNewObjectID36();
            specialCharInfos[i].id = id;
            try {
                SpecialChar specia = changeSpecialCharInfoToSpecialChar(specialCharInfos[i]);
                specialCharService.saveSpecialChar(specia);
                LogRecordUtil.writeLog(userEntity, "添加", "成功", specia.getLogInfo(),LogType.GeneralOperation,specia.getId());
            } catch (Exception e) {
                //LogRecordUtil.writeLog(userEntity, "特殊字符", "添加失败!",LogType.GeneralOperation);
                e.printStackTrace();
                throw new VCIError("150006", new String[]{});
            }
        }
        return "";
    }
    /***
     * 更新特殊字符
     * @param specialCharInfo 要更新的特殊字符
     * @return
     * @throws VCIError
     */
    public boolean updateSpecialChar(SpecialCharInfo specialCharInfo, UserEntityInfo userEntityInfo) throws VCIError {
        SpecialCharService specialCharService = new SpecialCharService();
        UserEntityDelegate.setUserEntityToService(specialCharService, userEntityInfo);
        SpecialChar checksPecialChar = specialCharService.getSepcialCharByClsfIdAndVal(specialCharInfo.parentId, specialCharInfo.value);
        UserEntity userEntity = changeUserEntityInfoToUserEntity(userEntityInfo);
        if (checksPecialChar != null && !checksPecialChar.getId().equals(specialCharInfo.id)) {
            throw new VCIError("10062", new String[]{});
        }
        try {
            SpecialChar specia = changeSpecialCharInfoToSpecialChar(specialCharInfo);
            SpecialChar speciaBefore = specialCharService.getSepcialCharById(specia.getId());
            specialCharService.updateSpecialChar(specia);
            StringBuilder logres = new StringBuilder();
            logres.append("更新前:"+speciaBefore.getLogInfo());
            logres.append(" 更新后:"+specia.getLogInfo());
            LogRecordUtil.writeLog(userEntity, "更新", "成功", logres.toString(), LogType.GeneralOperation,specia.getId());
            } catch (Exception e) {
            //LogRecordUtil.writeLog(userEntity, "特殊字符", "修改失败!",LogType.GeneralOperation);
            e.printStackTrace();
            throw new VCIError("150010", new String[]{});
        }
        return true;
    }
    /***
     * 
     * @param ids  要删除的特殊字符的id
     * @return
     * @throws VCIError
     */
    public boolean deletSpecialChar(String[] ids, UserEntityInfo userEntityInfo) throws VCIError {
        boolean rs = true;
        SpecialCharService specialCharService = new SpecialCharService();
        UserEntity userEntity = changeUserEntityInfoToUserEntity(userEntityInfo);
        try {
            UserEntityDelegate.setUserEntityToService(specialCharService, userEntityInfo);
            LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
            for(String id : ids){
                SpecialChar spe =     specialCharService.getSepcialCharById(id);
                map.put(spe.getLogInfo(), spe.getId());
            }
            rs = specialCharService.deleteSpecialCharByHql(ids);
            Iterator<String> it = map.keySet().iterator();
            while(it.hasNext()){
                String logKey =  it.next();
                LogRecordUtil.writeLog(userEntity, "删除", "成功", logKey, LogType.GeneralOperation,map.get(logKey));            }
            } catch (Exception e) {
            //LogRecordUtil.writeLog(userEntity, "特殊字符", "删除失败!",LogType.GeneralOperation);
            e.printStackTrace();
            throw new VCIError("150001", new String[]{});
        }
        return rs;
    }
 
    
 
    /***
     * 得到当前分类下的特殊字符
     * @param classId  分类id
     * @return
     * @throws VCIError
     */
    public SpecialCharInfo[] fetchSpecialChar(String classId) throws VCIError {
        SpecialCharService specialCharService = new SpecialCharService();
        List<SpecialChar> list = null;
        try {
            list = specialCharService.getSepcialCharByClsfId(classId);
        } catch (Exception e) {
            e.printStackTrace();
            //throw new VCIError("10019 , "");
        }
        int size = list.size();
        SpecialCharInfo[] specialCharInfo = new SpecialCharInfo[size];
        for (int i = 0; i < size; i++) {
            specialCharInfo[i] = changeSpecialCharToSpecialCharInfo(list.get(i));
        }
        return specialCharInfo;
    }
    
    /**
     * 
     * <p>Description: 根据PID删除特殊字符</p>
     * 
     * @author sunbo
     * @time 2012-5-28
     * @param id
     * @param userEntityInfo
     * @return
     * @throws VCIError
     */
    public boolean deleteSpecialCharByParentId(String id, UserEntityInfo userEntityInfo) throws VCIError {
        boolean rs = true;
        SpecialCharService specialCharService = new SpecialCharService();
        UserEntity userEntity = changeUserEntityInfoToUserEntity(userEntityInfo);
        try {
            UserEntityDelegate.setUserEntityToService(specialCharService, userEntityInfo);
            rs = specialCharService.deleteSpecialCharByParentId(id);
            //LogRecordUtil.writeLog(userEntity, "特殊字符", "删除成功!");
        } catch (Exception e) {
            //LogRecordUtil.writeLog(userEntity, "特殊字符", "删除失败!");
            e.printStackTrace();
            //throw new VCIError("10017 , "");
        }
        return rs;
    }
//    /***
//     * 删除流水算法
//     * @param ids
//     * @return
//     * @throws VCIError
//     */
//    public boolean deleteFlowAlg(String[] ids, UserEntityInfo userEntityInfo) throws VCIError {
//        boolean rs = false;
//        FlowAlgService flowAlgService = new FlowAlgService();
//        int count = ids.length;
//        UserEntityDelegate.setUserEntityToService(flowAlgService, userEntityInfo);        
//        for (int i = 0; i < count; i++) {
//            FlowAlg flowAlg = flowAlgService.getFlowAlgById(ids[i]);
//            if (flowAlg.getFlowSecs().size() != 0) {
//                deleteVarRangeMessage(flowAlg.getFlowSecs());
//            }
//        }
//        try {
//            rs = flowAlgService.deleteFlowAlgByHql(ids);
//        } catch (Exception e) {
//            e.printStackTrace();
//            throw new VCIError("10025 , "删除流水算法信息时发生异常,删除失败!");
//        }
//        return rs;
//    }
 
//    /****
//     * 删除可变码段取值范围
//     */
//    public boolean deleteVarRange(String[] ids, UserEntityInfo userEntityInfo) throws VCIError {
//        boolean rs = false;
//        VarRangeService varRangeService = new VarRangeService();
//        int count = ids.length;
//        UserEntityDelegate.setUserEntityToService(varRangeService, userEntityInfo);
//        for (int i = 0; i < count; i++) {
//            VarRange varRange = varRangeService.getVarRangeById(ids[i]);
//            if (varRange.getVarSecs().size() != 0) {
//                deleteVarRangeMessage(varRange.getVarSecs());
//            }
//        }
//        
//        try {
//            rs = varRangeService.deleteVarRangeByHql(ids);
//        } catch (Exception e) {
//            e.printStackTrace();
//            throw new VCIError("10026 , "删除可变码段取值范围信息时发生异常,删除失败!");
//        }
//        return rs;
//    }
    
//    /****
//     * 删除流水算法、可变码段取值范围时如果被引用提示的错误信息
//     * @param varSecs
//     * @throws VCIError
//     */
//    private void deleteVarRangeMessage(Set<Section> varSecs) throws VCIError {
//        String secGrpTitle = "码段分组:";
//        String secGrp = "";
//        String s = "";
//        int i = 0;
//        Section currentVarSec = null;
//        for (Section varSec : varSecs) {
//            currentVarSec = varSec;
//            secGrp = secGrpTitle + varSec.getSecGrp().getName() + "下  ";
//            if (i == 0) {
//                s = secGrp + varSec.getName() + " 码段";
//            } else if(i == 1){
//                s += ", " + secGrp + varSec.getName();
//            } else {
//                s += "┅";
//                break;
//            }
//            i++;
//        }
//        String type = "流水算法";
//        if (currentVarSec.getSecType() == 2) {
//            type = "取值范围";
//        }
//        s = "要删除的" + type + "被 " + s + " 引用!";
//        throw new VCIError("1 , s);
//    }
 
//    /****
//     * 得到所有流水算法
//     */
//    public FlowAlgInfo[] fetchFlowAlgInfo() throws VCIError {
//        FlowAlgService flowAlgService = new FlowAlgService();
//        List<FlowAlg> list = null;
//        try {
//            list = flowAlgService.getFlowAlgList();
//        } catch (Exception e) {
//            e.printStackTrace();
//            throw new VCIError("10027 , "");
//        }
//        int size = list.size();
//        FlowAlgInfo[] flowAlgInfo = new FlowAlgInfo[size];
//        for (int i = 0; i < size; i++) {
//            flowAlgInfo[i] = changeFlowAlgToFlowAlgInfo(list.get(i));
//        }
//        return flowAlgInfo;
//    }
 
//    /****
//     * 得到所有可变码段取值范围
//     */
//    public VarRangeInfo[] fetchVarRangeInfo() throws VCIError {
//        VarRangeService varRangeService = new VarRangeService();
//        List<VarRange> list = null;
//        try {
//            list = varRangeService.getVarRangeList();
//        } catch (Exception e) {
//            e.printStackTrace();
//            throw new VCIError("10028 , "");
//        }
//        int size = list.size();
//        VarRangeInfo[] varRangeInfo = new VarRangeInfo[size];
//        for (int i = 0; i < size; i++) {
//            varRangeInfo[i] = changeVarRangeToVarRangeInfo(list.get(i));
//        }
//        return varRangeInfo;
//    }
 
//    /****
//     * 保存流水算法
//     */
//    public String saveFlowAlg(FlowAlgInfo flowAlgInfo, UserEntityInfo userEntityInfo) throws VCIError {
//        FlowAlgService flowAlgService = new FlowAlgService();
//        FlowAlg checkFlowAlgName = flowAlgService.getFlowAlgByName(flowAlgInfo.name);
//        UserEntityDelegate.setUserEntityToService(flowAlgService, userEntityInfo);
//        if (checkFlowAlgName != null) {
//            throw new VCIError("10064 , "");
//        }
//        String id = ObjectUtility.getNewObjectID36();
//        flowAlgInfo.id = id;
//        FlowAlg flowAlg = changeFlowAlgInfoToFlowAlg(flowAlgInfo) ;
//        try {
//            flowAlgService.saveFlowAlg(flowAlg);
//        } catch (Exception e) {
//            e.printStackTrace();
//            throw new VCIError("10029 , "");
//        }
//        return id;
//    }
 
//    /****
//     * 保存可变码段取值范围
//     */
//    public String saveVarRange(VarRangeInfo varRangeInfo, UserEntityInfo userEntityInfo) throws VCIError {
//        VarRangeService varRangeService = new VarRangeService();
//        UserEntityDelegate.setUserEntityToService(varRangeService, userEntityInfo);
//        VarRange checkVarRange = varRangeService.getVarRangeByName(varRangeInfo.name);
//        if (checkVarRange != null) {
//            throw new VCIError("10064 , "");
//        }
//        String id = ObjectUtility.getNewObjectID36();
//        varRangeInfo.id = id;
//        VarRange varRange = changeVarRangeInfoToVarRange(varRangeInfo);
//        try {
//            varRangeService.saveVarRange(varRange);
//        } catch (Exception e) {
//            e.printStackTrace();
//            throw new VCIError("10030 , "");
//        }
//        return id;
//    }
 
//    /***
//     * 更新流水算法
//     */
//    public boolean updateFlowAlg(FlowAlgInfo flowAlgInfo, UserEntityInfo userEntityInfo) throws VCIError {
//        FlowAlgService flowAlgService = new FlowAlgService();
//        FlowAlg checkFlowAlgName = flowAlgService.getFlowAlgByName(flowAlgInfo.name);
//        if (checkFlowAlgName != null && !checkFlowAlgName.getId().equals(flowAlgInfo.id)) {
//            throw new VCIError("10065 , "");
//        }
//        FlowAlg flowAlg = changeFlowAlgInfoToFlowAlg(flowAlgInfo);
//        try {
//            UserEntityDelegate.setUserEntityToService(flowAlgService, userEntityInfo);
//            flowAlgService.updateFlowAlg(flowAlg);
//        } catch (Exception e) {
//            e.printStackTrace();
//            throw new VCIError("10031 , "");
//        }
//        return true;
//    }
    
//    /****
//     * 通过流水算法名称看是否存在
//     * @param flowAlgInfo
//     * @return
//     * @throws VCIError
//     */
//    public FlowAlg flowAlgInfoIsExist(String name) throws VCIError {
//        FlowAlgService flowAlgService = new FlowAlgService();
//        FlowAlg checkFlowAlgName = null;
//        try {
//            checkFlowAlgName = flowAlgService
//                    .getFlowAlgByName(name);
//        } catch (Exception e) {
//            e.printStackTrace();
//            throw new VCIError("10027 , "");
//        }
//        return checkFlowAlgName;
//    }
    
//    /***
//     * 可变码段取值范围通过名称是否存在
//     * @param varRangeInfo
//     * @return
//     * @throws VCIError
//     */
//    public VarRange varRangeInfoIsExist(String name) throws VCIError {
//        VarRangeService varRangeService = new VarRangeService();
//        VarRangeInfo[] varRangeInfos = null; 
//        VarRange checkVarRange = null;
//        try {
//            checkVarRange = varRangeService
//                    .getVarRangeByName(name);
//        } catch (Exception e) {
//            e.printStackTrace();
//            throw new VCIError("10028 , "");
//        }
//        
//        return checkVarRange;
//    }
 
//    /***
//     * 更新可变码段取值范围
//     */
//    public boolean updateVarRange(VarRangeInfo varRangeInfo, UserEntityInfo userEntityInfo) throws VCIError {
//        VarRangeService varRangeService = new VarRangeService();
//        UserEntityDelegate.setUserEntityToService(varRangeService, userEntityInfo);
//        VarRange checkVarRange = varRangeService.getVarRangeByName(varRangeInfo.name);
//        if (checkVarRange != null && !checkVarRange.getId().equals(varRangeInfo.id)) {
//            throw new VCIError("10065 , "");
//        }
//        VarRange varRange = changeVarRangeInfoToVarRange(varRangeInfo);
//        try {
//            varRangeService.updateVarRange(varRange);
//        } catch (Exception e) {
//            e.printStackTrace();
//            throw new VCIError("10032 , "");
//        }
//        return true;
//    }
    
//    /***可变码段取值范围 
//     * 从业务对象对象到corba
//     * @param varRange
//     * @return
//     */
//    public VarRangeInfo changeVarRangeToVarRangeInfo(VarRange varRange) {
//        VarRangeInfo varRangeInfo = new VarRangeInfo();
//        varRangeInfo.id = varRange.getId();
//        varRangeInfo.desc = varRange.getDesc() == null ? "" : varRange.getDesc();
//        varRangeInfo.name = varRange.getName() == null ? "" : varRange.getName();
//        varRangeInfo.range = varRange.getRange() == null ? "" : varRange.getRange();
//        return varRangeInfo;
//    }
    
//    /***流水算法
//     * 从corba对象到业务对象
//     * @param flowAlg
//     * @return
//     */
//    public FlowAlg changeFlowAlgInfoToFlowAlg(FlowAlgInfo flowAlgInfo) {
//        FlowAlg flowAlg = new FlowAlg();
//        flowAlg.setId(flowAlgInfo.id == "" ? null : flowAlgInfo.id);
//        flowAlg.setName(flowAlgInfo.name == "" ? null : flowAlgInfo.name);
//        flowAlg.setDesc(flowAlgInfo.desc == "" ? null : flowAlgInfo.desc);
//        flowAlg.setAlg(flowAlgInfo.alg == "" ? null : flowAlgInfo.alg);
//        return flowAlg;
//    }
    
//    /***可变码段取值范围 
//     * 从corba对象到业务对象
//     * @param varRangeInfo
//     * @return
//     */
//    public VarRange changeVarRangeInfoToVarRange(VarRangeInfo varRangeInfo) {
//        VarRange varRange = new VarRange();
//        varRange.setId(varRangeInfo.id == "" ? null : varRangeInfo.id);
//        varRange.setName(varRangeInfo.name == "" ? null : varRangeInfo.name);
//        varRange.setDesc(varRangeInfo.desc == "" ? null : varRangeInfo.desc);
//        varRange.setRange(varRangeInfo.range == "" ? null : varRangeInfo.range);
//        return varRange;
//    }
    
//    /***流水算法
//     * 从业务对象对象到corba
//     * @param varRange
//     * @return
//     */
//    public FlowAlgInfo changeFlowAlgToFlowAlgInfo(FlowAlg flowAlg) {
//        FlowAlgInfo flowAlgInfo = new FlowAlgInfo();
//        flowAlgInfo.id = flowAlg.getId();
//        flowAlgInfo.name = flowAlg.getName() == null ? "" : flowAlg.getName();
//        flowAlgInfo.desc = flowAlg.getDesc() == null ? "" : flowAlg.getDesc();
//        flowAlgInfo.alg = flowAlg.getAlg() == null ? "" : flowAlg.getAlg();
//        return flowAlgInfo;
//    }
    
    
    /***
     * 特殊字符分类,从业务对象到corba对象
     * @param specialCharClsf
     * @return
     */
    private SpecialCharClsfInfo changeSpecialCharClsfToSpecialCharClsfInfo(SpecialCharClsf specialCharClsf){
        SpecialCharClsfInfo specialCharClsfInfo = new SpecialCharClsfInfo();
        specialCharClsfInfo.id = specialCharClsf.getId();
        specialCharClsfInfo.name = specialCharClsf.getName() == null ? "" :  specialCharClsf.getName();
        specialCharClsfInfo.desc = specialCharClsf.getDesc() == null ? "" :  specialCharClsf.getDesc();
        return specialCharClsfInfo;
    }
    
    /***
     * 特殊字符分类,从corba对象到业务对象
     * @param specialCharClsfInfo
     * @return
     */
    private SpecialCharClsf changeSpecialCharClsfInfoToSpecialCharClsf(SpecialCharClsfInfo specialCharClsfInfo) {
        SpecialCharClsf specialCharClsf = new SpecialCharClsf();
        specialCharClsf.setId(specialCharClsfInfo.id == "" ? null : specialCharClsfInfo.id);
        specialCharClsf.setDesc(specialCharClsfInfo.desc == "" ? null : specialCharClsfInfo.desc);
        specialCharClsf.setName(specialCharClsfInfo.name == "" ? null : specialCharClsfInfo.name);
        return specialCharClsf;
    }
    
    /***
     * 特殊字符,从corba对象到业务对象
     * @param specialCharInfo
     * @return
     */
    private SpecialChar changeSpecialCharInfoToSpecialChar(SpecialCharInfo specialCharInfo) {
        SpecialChar specialChar = new SpecialChar();
        specialChar.setId(specialCharInfo.id == "" ? null : specialCharInfo.id);
        specialChar.setValue(specialCharInfo.value == "" ? null : specialCharInfo.value);
        specialChar.setParentId(specialCharInfo.parentId == "" ? null : specialCharInfo.parentId);
        return specialChar;
    }
    
    /***
     * 特殊字符,从业务对象到corba对象
     * @param specialChar
     * @return
     */
    private SpecialCharInfo changeSpecialCharToSpecialCharInfo(SpecialChar specialChar) {
        SpecialCharInfo specialCharInfo = new SpecialCharInfo();
        specialCharInfo.id = specialChar.getId();
        specialCharInfo.value = specialChar.getValue() == null ? "" : specialChar.getValue();
        specialCharInfo.parentId = specialChar.getParentId();
        return specialCharInfo;
    }
    
    /***
     *    系统配置对象从corba对象到业务对象
     * @param systemCfgInfo
     * @return
     */
    public SystemCfg changeSystemCfgInfoToSystemCfg(SystemCfgInfo systemCfgInfo) {
        SystemCfg systemCfg = new SystemCfg();
        systemCfg.setId(systemCfgInfo.id == "" ? null : systemCfgInfo.id);
        systemCfg.setName(systemCfgInfo.name == "" ? null : systemCfgInfo.name);
        systemCfg.setValue(systemCfgInfo.value == "" ? null : systemCfgInfo.value);
        return systemCfg;
    }
    
    /***
     *   系统配置对象从业务对象到corba对象
     * @param systemCfg
     * @return
     */
    public SystemCfgInfo changeSystemCfgToSystemCfgInfo(SystemCfg systemCfg) {
        SystemCfgInfo systemCfgInfo = new SystemCfgInfo();
        systemCfgInfo.id = systemCfg.getId();
        systemCfgInfo.name = systemCfg.getName();
        systemCfgInfo.value = systemCfg.getValue();
        return systemCfgInfo;
    }
    
    public UserEntity changeUserEntityInfoToUserEntity(UserEntityInfo info){
        UserEntity entity = new UserEntity();
        entity.setModule(info.modules);
        entity.setIp(info.ip);
        entity.setUserName(info.userName);
        return entity;
    }
    
    /**
     * 获取数据库信息
     * @return
     */
    public DataSourceInfo getDataSourceInfo() {
        DataSourceInfo info = new DataSourceInfo();
        SystemCfgService systemCfgService = new SystemCfgService();
        systemCfgService.getDataSourceInfo(info);
        systemCfgService.getLogSize(info);
        return info;
    }
 
}