ludc
2024-09-14 36c2449aec5b51e5ed4e5c6841154b746060e09a
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
package com.vci.client.bof;
 
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import javax.imageio.ImageIO;
 
import junit.framework.Assert;
 
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
 
import com.vci.corba.omd.atm.AttribItem;
import com.vci.corba.omd.btm.BtmItem;
import com.vci.corba.omd.lcm.TransitionVO;
import com.vci.mw.InvocationUtility;
import com.vci.client.LogonApplication;
import com.vci.client.common.objects.UserEntityObject;
import com.vci.client.common.objects.UserObject;
import com.vci.client.omd.provider.BtmProvider;
import com.vci.client.ui.exception.VCIException;
import com.vci.corba.common.VCIError;
import com.vci.corba.common.data.VCIInvocationInfo;
 
 
public class BOFClientTest {
 
    ClientBusinessObjectOperation operation = new ClientBusinessObjectOperation();
    @BeforeClass
    public static void setUpBeforeClass() throws Exception {
    }
 
    @AfterClass
    public static void tearDownAfterClass() throws Exception {
    }
 
    @Before
    public void setUp() throws Exception {
        UserEntityObject ueo = new UserEntityObject();
        ueo.setIp("192.168.0.50");
        ueo.setUserName("1");
        LogonApplication.userEntityObject = ueo;
        
        VCIInvocationInfo info = InvocationUtility.initInvocationInfo();
        info.clientIPInfo = "192.168.0.44";
        info.userName = "eddie";
    }
 
    @After
    public void tearDown() throws Exception {
    }
    
    @Test
    public void testSelect() throws VCIError {
        try {
        ClientBusinessObject ccbo = operation.readBusinessObjectById("023028CC-E08F-81A0-CF93-600A67FE0A80", "folder");
        System.out.println(ccbo.getRevisionRule());
 
        String[] links = new String[1];
        links[0] = "EBOM";
        ClientBusinessObject rcbo = operation.revisionBusinessObject(ccbo, links, true, true, true, false);
//        System.out.println(ccbo.getRevisionValue() + " " + ccbo.getRevisionSeq() + " " + ccbo.getVersionValue() + " " + ccbo.getVersionSeq());
//        ClientBusinessObject rcbo = operation.(ccbo, new ClientLinkObject[0], true, true, false, false);
//        System.out.println(rcbo.getRevisionValue() + " " + rcbo.getRevisionSeq() + " " + rcbo.getVersionValue() + " " + rcbo.getVersionSeq());
//        operation.saveRevisionBuinessObject(rcbo);
//        ClientBusinessObject vcbo = operation.createBusinessObjectVersion(ccbo);
//        System.out.println(vcbo.getRevisionValue() + " " + vcbo.getRevisionSeq() + " " + vcbo.getVersionValue() + " " + vcbo.getVersionSeq());
//        operation.saveVersionBuinessObject(vcbo);
        System.out.println(rcbo.getLcStatus());
        } catch (VCIError e) {
            System.out.println(e.code);
        }
    }
    
    @Test
    public void testSelectLastRevObj() throws VCIError {
        try {
            ClientBusinessObject[] ccbo = operation.getLastRevisionBusinessObject("CF425923-1B0C-4F98-4FB7-5E707C59AA14", "part");
            System.out.println(ccbo.length);
        } catch (VCIError e) {
            e.printStackTrace();
        }
    }
    
    @Test
    public void testClone() throws VCIError {
        try {
        ClientBusinessObject cbo = operation.readBusinessObjectById("30430FAE-370E-935A-4143-A25CEB264B61", "part");
        ClientBusinessObject cbo2 = operation.cloneBusinessObject(cbo);
        System.out.println(cbo2.getLcStatus());
        } catch (VCIError e) {
            System.out.println(e.code);
        }
    }
    
    @Test
    public void testInitBO(){
//        ClientBusinessObject cbo = operation.initBusinessObject("equipment");
//        cbo.setAttributeValue("code", "test6");
        try {
            ClientBusinessObject saveCbo = operation.readBusinessObjectById("BA8686B0-2B55-A9B8-D97C-0279A853CBB2", "part");
            System.out.println(saveCbo.getAttributeValue("code"));
            
            ClientBusinessObject revisonObj = operation.revisionBusinessObject(saveCbo, new ClientLinkObject[0], true, true, true, false);
            System.out.println(revisonObj.getAttributeValue("code"));
        } catch (VCIError e) {
            System.out.println(e.code);
        }
    
//        ClientBusinessObject vsionObj = operation.revisionBusinessObject(revisonObj, new ClientLinkObject[0], false, true, false, false);
//        System.out.println(vsionObj.getAttributeValue("code"));
    }
    
    @Test 
    public void testRevisionBO() {
        try {
            ClientBusinessObject cbo = operation.readBusinessObjectById("F41298E3-CA0D-CD9C-EE58-84EA7E7730DB", "datamodule");
            ClientBusinessObject cbo2 = operation.revisionBusinessObject(cbo, new ClientLinkObject[0] , false, true, false, false);
            System.out.println(cbo.getIsFirstR() + " " + cbo.getIsLastR());
        } catch (VCIError e) {
            e.printStackTrace();
        }
    }
    
    @Test
    public  void testCreatObject() {
        
        try {
            ClientBusinessObject cbo = operation.createBusinessObject("photograph");
            cbo.setName("test-006");
            cbo.setAttributeValue("filepath", "http://192.168.0.31:8080/PlatformBS2.0/abc-6.jpg");
//            cbo.setAttributeValue("sender", "1");
//            cbo.setAttributeValue("sendstatus", "2");
//            cbo.setAttributeValue("receivers", "user:1");
//            cbo.setAttributeValue("messagetitle", "test4");    
//            cbo.setAttributeValue("messagecontent", "testddd4");
//            cbo.setAttributeValue("receivestatus", "1");
//            cbo.setAttributeValue("receiver", "1");
//            cbo.setAttributeValue("messageoid", "CC303DB4-EE9E-C654-DA7E-C0E4F4C0B816");
//            File f = new File("C:/Users/liudi/Desktop/a.html");
//            BufferedReader in = new BufferedReader(new FileReader(f));
//            
//            StringBuffer s= new StringBuffer();
//            String ss;
//            while((ss=in.readLine())!=null){
//                System.out.print(ss);
//                s.append(ss);
//            }
//            in.close();
//            cbo.setAttributeValue("TESTCLOB".toLowerCase(),s.toString());
//            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
//            String str = df.format(new java.util.Date());
//            cbo.setAttributeValue("starttime", str);
//            cbo.setAttributeValue("affiliatedrole", "B336CC22-7BCD-AE17-20A8-07D78405A2E5");
//            cbo.setAttributeValue("twoclsf", "采用标准目录");
//            cbo.setAttributeValue("twoclsf", "标准体系表");
//            cbo.setAttributeValue("twoclsf", "产品技术规范");
//            cbo.setAttributeValue("twoclsf", "标准");
//            plm.bs.bom.common.AttributeValue[] attrVals = cbo.getBusinessObject().newAttrValList;
//            List<AttributeValue> attrList = new ArrayList<AttributeValue>();
//            for (int i = 0; i < attrVals.length; i++) {
//                attrList.add(attrVals[i]);
//            }
//            AttributeValue av = new AttributeValue();
//            av.attrName = "twoclsf";
//            av.attrVal = "采用标准目录";
//            attrList.add(av);
//            cbo.getBusinessObject().newAttrValList = attrList.toArray(new AttributeValue[0]);
//            cbo.setAttributeValue("partfile", "442E356E-524C-49F3-B194-E571868C0093");
//            cbo.setAttributeValue("muser", "0EB2AF20-3D6B-4CFF-9D10-0A379BED1E12");
            
            ClientBusinessObject ccbo = operation.saveCreateBuinessObject(cbo);
            System.out.println(ccbo);
//            System.out.println(ccbo.getRevisionValue() + " " + ccbo.getRevisionSeq() + " " + ccbo.getVersionValue() + " " + ccbo.getVersionSeq());
//            ClientBusinessObject rcbo = operation.reviseBusinessObject(ccbo, "");
//            System.out.println(rcbo.getRevisionValue() + " " + rcbo.getRevisionSeq() + " " + rcbo.getVersionValue() + " " + rcbo.getVersionSeq());
//            ClientBusinessObject vcbo = operation.createBusinessObjectVersion(ccbo);
//            System.out.println(vcbo.getRevisionValue() + " " + vcbo.getRevisionSeq() + " " + vcbo.getVersionValue() + " " + vcbo.getVersionSeq());
        } catch (VCIError e) {
            // TODO Auto-generated catch block
            VCIException exp = new VCIException(e.code, e.messages);
            System.out.println(e.messages[1]);
            e.printStackTrace();
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }
    
    @Test
    public void testBatchCreateFileObject() {
        try {
            String fileName = "D:\\apache-tomcat-7.0.42\\wtpwebapps\\PlatformBS2.0\\upload\\";
            String sfileName = "D:\\apache-tomcat-7.0.42\\wtpwebapps\\PlatformBS2.0\\upload\\Photo\\";
            List<String> pathlist = new ArrayList<String>();
            List<String> namelist = new ArrayList<String>();
            getAllFileNames(sfileName, pathlist, namelist);
            for (int i = 0; i < pathlist.size(); i++) {
                ClientBusinessObject cbo = operation.createBusinessObject("photograph");
                cbo.setName(namelist.get(i).substring(0, namelist.get(i).lastIndexOf(".")));
                String cfilePath = pathlist.get(i).substring(fileName.length()).replace("\\", "/");
                cbo.setAttributeValue("filepath", cfilePath);
                cbo.setAttributeValue("tfilepath", "t" + cfilePath);
                
                ClientBusinessObject ccbo = operation.saveCreateBuinessObject(cbo);
                System.out.println(
                        pathlist.get(i).substring(fileName.length()) + " - " + namelist.get(i).substring(0, namelist.get(i).lastIndexOf(".")));
            }
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }
    
    private void getAllFileNames(String fileName, List<String> pathlist, List<String> nameList) {
        File file = new File(fileName);
        File[] files = file.listFiles();
        for (File f : files) {
            if (f.isDirectory()) {
                getAllFileNames(f.getAbsolutePath(), pathlist, nameList);
            } else {
                pathlist.add(f.getAbsolutePath());
                nameList.add(f.getName());
            }
        }
    }
    
    @Test
    public void testBatchScaleFileObject() {
        try {
            String fileName = "D:\\apache-tomcat-7.0.42\\wtpwebapps\\PlatformBS2.0\\upload\\";
            List<String> pathlist = new ArrayList<String>();
            List<String> namelist = new ArrayList<String>();
            getAllFileNames(fileName, pathlist, namelist);
            for (int i = 0; i < pathlist.size(); i++) {
                String cPath = pathlist.get(i).replace("Photo", "tPhoto");
                String cfolderPath = cPath.substring(0, cPath.length() - namelist.get(i).length());
                File cfolder = new File(cfolderPath);
                if (!cfolder.exists()) {
                    cfolder.mkdirs();
                }
                String format = namelist.get(i).substring(namelist.get(i).lastIndexOf(".") + 1);
                scale(pathlist.get(i), cPath, format);
//                ClientBusinessObject cbo = operation.createBusinessObject("photograph");
//                cbo.setName(namelist.get(i).substring(0, namelist.get(i).lastIndexOf(".")));
//                cbo.setAttributeValue("filepath", pathlist.get(i).substring(fileName.length() + 1).replace("\\", "/"));
//                ClientBusinessObject ccbo = operation.saveCreateBuinessObject(cbo);
                System.out.println(
                        pathlist.get(i).substring(fileName.length() + 1) + " - " + namelist.get(i).substring(0, namelist.get(i).lastIndexOf(".")));
            }
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }
    
    private void scale(String srcImageFile, String result, String format) {  
        try {  
            BufferedImage src = ImageIO.read(new File(srcImageFile)); // 读入文件  
            int width = src.getWidth(); // 得到源图宽  
            int height = src.getHeight(); // 得到源图长  
            width = 110 * 4;  
            height = 150 * 4; 
            Image image = src.getScaledInstance(width, height, Image.SCALE_DEFAULT);  
            BufferedImage tag = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);  
            Graphics g = tag.getGraphics();  
            g.drawImage(image, 0, 0, null); // 绘制缩小后的图  
            g.dispose();  
            ImageIO.write(tag, format, new File(result));// 输出到文件流  
        }  catch (IOException e) {  
            e.printStackTrace();  
        }  
    }
    
    @Test
    public void testQuery() {
//        TableDataUtil util = new TableDataUtil();
//        List<Map<String, String>> dataModel = null;
//        String qtName = "currentUserMsgUnReadQuery";
//        Map<String, String> replaceMap = new HashMap<String, String>();
//        replaceMap.put("CURRENTUSER.NAME", "1");
//        
//        Map<String, String> queryColumnsMap = new HashMap<String, String>();
//        queryColumnsMap.put("messageoid.messagetitle", "标题");
//        
//        try {
//            dataModel = util.getObjectDataList(qtName, replaceMap,
//                    new HashMap<String, String>() , null, null, "vcireceivemessage",
//                    queryColumnsMap, null, null);
//            System.out.println(dataModel.size());
//        } catch (VCIError e) {
//            // TODO Auto-generated catch block
//            e.printStackTrace();
//        } catch (DocumentException e) {
//            // TODO Auto-generated catch block
//            e.printStackTrace();
//        }
    }
    
    @Test
    public void testBatchCreateObjWithLink() {
        try {
            
            
            ClientLinkObjectOperation cloperation = new ClientLinkObjectOperation();
            ClientBusinessObject[] cbos = new ClientBusinessObject[8000];
            ClientLinkObject[] los = new ClientLinkObject[4000];
            
            ClientBusinessObject workitem = operation.createBusinessObject("workitem");
            BtmItem workItemType = null;
            AttribItem[] workItemItems = BtmProvider.getInstance().getBtAbItems("workitem");
            ClientBusinessObject part = operation.createBusinessObject("part");
            BtmItem partType = null;
            AttribItem[] partItems = BtmProvider.getInstance().getBtAbItems("part");
             long start = System.currentTimeMillis();
             System.out.println("start time: " + start);
            for (int i = 0; i < 4000; i++) {
                cbos[i] = operation.cloneBusinessObject(workitem, workItemType, workItemItems, true, "1");
                cbos[4000 + i] = operation.cloneBusinessObject(part, partType, partItems, true, "1");
                los[i] = cloperation.createLinkObject("input");
                los[i].setFromBO(cbos[i]);
                los[i].setToBO(cbos[4000 + i]);
            }
            long end = System.currentTimeMillis();
            System.out.println("end time: " + end);
            long duration = end - start;
            System.out.println("save time is: " + duration);
//                ClientBusinessObject[] cbos = new ClientBusinessObject[1];
//                cbos[0] = operation.createBusinessObject("engine");
            start = System.currentTimeMillis();
            System.out.println("start time: " + start);
            operation.batchSaveCreateBuinessObject(cbos, new ClientLinkObject[0]);
            end = System.currentTimeMillis();
            System.out.println("end time: " + end);
            duration = end - start;
            System.out.println("save time is: " + duration);
            
            start = System.currentTimeMillis();
            System.out.println("start time: " + start);
            operation.batchSaveCreateBuinessObject(new ClientBusinessObject[0], los);
            end = System.currentTimeMillis();
            System.out.println("end time: " + end);
            duration = end - start;
            System.out.println("save time is: " + duration);
        } catch (VCIError e) {
            e.printStackTrace();
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }
    
    @Test
    public  void testCreatObjectWithLink() {
        
        try {
//            ClientBusinessObject[] bos = new ClientBusinessObject[7];
//            ClientBusinessObject bo1 = operation.createBusinessObject("part");
//            bo1.setAttributeValue("code", "LCQ10");
//            bos[0] = bo1;
//            
//            ClientBusinessObject bo2 = operation.createBusinessObject("part");
//            bo2.setAttributeValue("code", "LCQ20");
//            bos[1] = bo2;
//            
//            ClientBusinessObject bo3 = operation.createBusinessObject("part");
//            bo3.setAttributeValue("code", "LCQ21");
//            bos[2] = bo3;
//            
//            ClientBusinessObject bo4 = operation.createBusinessObject("part");
//            bo4.setAttributeValue("code", "LCQ30");
//            bos[3] = bo4;
//            
//            ClientBusinessObject bo5 = operation.createBusinessObject("part");
//            bo5.setAttributeValue("code", "LCQ31");
//            bos[4] = bo5;
//            
//            ClientBusinessObject bo6 = operation.createBusinessObject("part");
//            bo6.setAttributeValue("code", "LCQ32");
//            bos[5] = bo6;
//            
//            ClientBusinessObject bo7 = operation.createBusinessObject("part");
//            bo7.setAttributeValue("code", "LCQ33");
//            bos[6] = bo7;
//            
//            List<ClientLinkObject> linkList = new ArrayList<ClientLinkObject>();
//            
//            ClientLinkObjectOperation coperation = new ClientLinkObjectOperation();
//            ClientLinkObject lo = coperation.createLinkObject("EBOM");
//            lo.setFromBO(bo1);
//            lo.setToBO(bo2);
//            linkList.add(lo);
//            
//            lo = coperation.createLinkObject("EBOM");
//            lo.setFromBO(bo1);
//            lo.setToBO(bo3);
//            linkList.add(lo);
//            
//            lo = coperation.createLinkObject("EBOM");
//            lo.setFromBO(bo2);
//            lo.setToBO(bo4);
//            linkList.add(lo);
//            
//            lo = coperation.createLinkObject("EBOM");
//            lo.setFromBO(bo2);
//            lo.setToBO(bo5);
//            linkList.add(lo);
//            
//            lo = coperation.createLinkObject("EBOM");
//            lo.setFromBO(bo3);
//            lo.setToBO(bo6);
//            linkList.add(lo);
//            
//            lo = coperation.createLinkObject("EBOM");
//            lo.setFromBO(bo3);
//            lo.setToBO(bo7);
//            linkList.add(lo);
//            
//            lo = coperation.createLinkObject("PBOM");
//            lo.setFromBO(bo1);
//            lo.setToBO(bo2);
//            linkList.add(lo);
//            
//            lo = coperation.createLinkObject("PBOM");
//            lo.setFromBO(bo1);
//            lo.setToBO(bo3);
//            linkList.add(lo);
//            
//            lo = coperation.createLinkObject("PBOM");
//            lo.setFromBO(bo2);
//            lo.setToBO(bo4);
//            linkList.add(lo);
//            
//            lo = coperation.createLinkObject("PBOM");
//            lo.setFromBO(bo2);
//            lo.setToBO(bo5);
//            linkList.add(lo);
//            
//            lo = coperation.createLinkObject("PBOM");
//            lo.setFromBO(bo3);
//            lo.setToBO(bo6);
//            linkList.add(lo);
//            
//            lo = coperation.createLinkObject("PBOM");
//            lo.setFromBO(bo3);
//            lo.setToBO(bo7);
//            linkList.add(lo);
//            
            ClientBusinessObject[] bos = new ClientBusinessObject[2];
            ClientBusinessObject bo1 = operation.createBusinessObject("part");
            bo1.setAttributeValue("id", "lzm-009", true);
            bos[0] = bo1;
            
            ClientBusinessObject bo2 = operation.createBusinessObject("part");
            bo2.setAttributeValue("id", "lzm-010", true);
            bos[1] = bo2;
            
            List<ClientLinkObject> linkList = new ArrayList<ClientLinkObject>();
            
            ClientLinkObjectOperation coperation = new ClientLinkObjectOperation();
            ClientLinkObject lo = coperation.createLinkObject("EBOM");
            lo.setFromBO(bo1);
            lo.setToBO(bo2);
            linkList.add(lo);
            operation.batchSaveCreateBuinessObject(bos, linkList.toArray(new ClientLinkObject[0]));
        } catch (VCIError e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    
    @Test
    public  void testCUDObject() {
        
        try {
            ClientBusinessObject[] bos = new ClientBusinessObject[2];
            ClientBusinessObject bo1 = operation.createBusinessObject("part");
            bo1.setAttributeValue("id", "lzm-005", true);
            bos[0] = bo1;
            
            ClientBusinessObject bo2 = operation.createBusinessObject("part");
            bo1.setAttributeValue("id", "lzm-006", true);
            bos[1] = bo2;
            
            List<ClientLinkObject> linkList = new ArrayList<ClientLinkObject>();
            
            ClientLinkObjectOperation coperation = new ClientLinkObjectOperation();
            ClientLinkObject lo = coperation.createLinkObject("EBOM");
            lo.setFromBO(bo1);
            lo.setToBO(bo2);
            linkList.add(lo);
            
            ClientBusinessObject ucbo1 = operation.readBusinessObjectById("6B7D84EC-244F-C769-CCCC-2C2C79B7D028", "part");
            ucbo1.setAttributeValue("name", "lzm-002");
            ClientBusinessObject ucbo2 = operation.readBusinessObjectById("54990B02-1B01-1D04-9C85-EF8A14612230", "part");
            ucbo2.setAttributeValue("name", "lzm-003");
            
            ClientBusinessObject[] updatecbos = new ClientBusinessObject[2];
            updatecbos[0] = ucbo1;
            updatecbos[1] = ucbo2;
            
            ClientLinkObject ulo  = coperation.readLinkObjectById("F3A2C786-895A-5707-FE7E-D64D190EEA98", "EBOM");
            ulo.setAttributeValue("sequence", "3");
            ClientLinkObject[] ulos = new ClientLinkObject[1];
            ulos[0] = ulo;
            
            ClientBusinessObject dcbo1 = operation.readBusinessObjectById("FB5D19BA-B521-6951-C6F8-B25A10730489", "part");
            ClientBusinessObject dcbo2 = operation.readBusinessObjectById("5F667F84-B8B3-9B01-7775-3D4AF920CB9C", "part");
            
            ClientBusinessObject[] dpdatecbos = new ClientBusinessObject[2];
            dpdatecbos[0] = dcbo1;
            dpdatecbos[1] = dcbo2;
            
            ClientLinkObject dlo  = coperation.readLinkObjectById("CB442ECE-B832-E67C-C9BC-EFBC8932FAA4", "EBOM");
            ClientLinkObject[] dlos = new ClientLinkObject[1];
            dlos[0] = dlo;
            
            operation.batchCUDBOLO(bos, linkList.toArray(new ClientLinkObject[0]), updatecbos, ulos, dpdatecbos, dlos);
        } catch (VCIError e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    
    @Test
    public void testUpdateBO() {
        boolean rs = false;
        try {
            ClientBusinessObject cbo = operation.readBusinessObjectById("C433B01F-F878-9EFE-83A0-C0C68DC398B2", "testclob");
            File f = new File("C:/Users/liudi/Desktop/a.html");
            BufferedReader in = new BufferedReader(new FileReader(f));
            
            StringBuffer s= new StringBuffer();
            String ss;
            while((ss=in.readLine())!=null){
                System.out.print(ss);
                s.append(ss);
            }
            in.close();
            cbo.setAttributeValue("TESTCLOB".toLowerCase(),s.toString());
//            cbo.setAttributeValue(BusinessConstants.SELECT_DESCRIPTION, "特色太太太太太太");
/*            plm.bs.bom.common.AttributeValue[] attrVals = cbo.getBusinessObject().newAttrValList;
            List<AttributeValue> attrList = new ArrayList<AttributeValue>();
            for (int i = 0; i < attrVals.length; i++) {
                attrList.add(attrVals[i]);
            }
            AttributeValue av = new AttributeValue();
            av.attrName = "twoclsf";
            av.attrVal = "采用标准目录";
            attrList.add(av);
            cbo.getBusinessObject().newAttrValList = attrList.toArray(new AttributeValue[0]);*/
            rs = operation.updateBuinessObject(cbo);
            System.out.println(rs);
        } catch (VCIError e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        Assert.assertTrue(rs);
    }
    
    @Test
    public void testReadManyObjectById() {
        try {
            String[] oids = {"0336E18E-94BF-E892-CF43-2BBD4C9380B5"};
            ClientBusinessObject[] cbos = operation.readBusinessObjectById(oids, "Filetest");
            System.out.println(cbos.length);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    
    @Test
    public void testDeleteBO() {
        boolean rs = false;
        try {
            ClientBusinessObject cbo = operation.readBusinessObjectById("CF58736E-152A-7EF8-73FA-AC135A536E18", "ChangeClsf");
            rs = operation.deleteBuinessObject(cbo);
        } catch (VCIError e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        Assert.assertTrue(rs);
    }
    
    @Test
    public void testCheckinBO() throws VCIError {
        ClientBusinessObject cbo = operation.readBusinessObjectById("E8E01F66-4572-1318-A136-7A6EBCD73919", "part");
        boolean rs = operation.checkinBusinessObject(cbo);
        Assert.assertTrue(true);
    }
    
    
    @Test
    public void testCheckoutBO() throws VCIError {
        ClientBusinessObject cbo = operation.readBusinessObjectById("E8E01F66-4572-1318-A136-7A6EBCD73919", "part");
        boolean rs = operation.checkoutBusinessObject(cbo);
        Assert.assertTrue(rs);
    }
    
    @Test
    public void testTransferBO() throws VCIError {
        ClientBusinessObject cbo = operation.readBusinessObjectById("37F926A1-C470-42D2-B17D-B8E35CBAFDF8", "part");
        
        TransitionVO vo = new TransitionVO();
        vo.id = "";
//        vo.source = "Working";
//        vo.destination = "Auditing";
        vo.source = "Auditing";
        vo.destination = "Published";
        
//        TransitionVOEvent[] events = new TransitionVOEvent[2];
//        TransitionVOEvent event = new TransitionVOEvent();
//        event.id = "ttt";
//        event.name = "plm.EventTest";
//        events[0] = event;
//        
//        TransitionVOEvent event2 = new TransitionVOEvent();
//        event2.id = "ttt2";
//        event2.name = "plm.EventTest2";
//        events[1] = event2;
        
//        vo.transitionVOEvents = events;
        boolean rs = operation.transferBusinessObject(cbo, vo, "Released");
        Assert.assertTrue(rs);
    }
    
    @Test
    public void testBatchTransferBO() throws VCIError {
        ClientBusinessObject[] cbos = new ClientBusinessObject[2];
        cbos[0] = operation.readBusinessObjectById("8B9C37C0-933D-4D3B-95E7-9F85E60FE1B5", "part");
        cbos[1] = operation.readBusinessObjectById("1ABC8C12-7EF5-3140-CF35-D6579C603F76", "part");
        
        TransitionVO[] vos = new TransitionVO[2];
        TransitionVO vo1 = new TransitionVO();
        vo1.id = "";
//        vo.source = "Working";
//        vo.destination = "Auditing";
        vo1.source = "Auditing";
        vo1.destination = "Released";
        
        TransitionVO vo2 = new TransitionVO();
        vo2.id = "";
//        vo.source = "Working";
//        vo.destination = "Auditing";
        vo2.source = "Auditing";
        vo2.destination = "Released";
        vos[0] = vo1;
        vos[1] = vo2;
        
//        TransitionVOEvent[] events = new TransitionVOEvent[2];
//        TransitionVOEvent event = new TransitionVOEvent();
//        event.id = "ttt";
//        event.name = "plm.EventTest";
//        events[0] = event;
//        
//        TransitionVOEvent event2 = new TransitionVOEvent();
//        event2.id = "ttt2";
//        event2.name = "plm.EventTest2";
//        events[1] = event2;
        
//        vo.transitionVOEvents = events;
        String[] status = new String[2];
        status[0] = "Released";
        status[1] = "Released";
        boolean rs = operation.batchTransferBusinessObject(cbos, vos, status);
        Assert.assertTrue(rs);
    }
    
    @Test
    public void testUndoCheckOutBO() throws VCIError {
        ClientBusinessObject cbo = operation.readBusinessObjectById("E5433746-04DE-D7B1-927E-9F4EF6C742D9", "ChangeClsf");
        boolean rs = operation.undoCheckOutBusinessObject(cbo);
        Assert.assertTrue(rs);
    }
    
    @Test
    public void testChangeBOOwner() throws VCIError {
        ClientBusinessObject cbo = operation.readBusinessObjectById("E5433746-04DE-D7B1-927E-9F4EF6C742D9", "ChangeClsf");
        UserObject uo = new UserObject();
        uo.setId("eddieliu111");
        boolean rs = operation.changeBusinessObjectOwner(cbo, uo);
        Assert.assertTrue(true);
    }
    
    @Test
    public void testBatchRevision() {
        String[] oids = new String[3];
        oids[0] = "CB832B90-F993-1C76-9886-9734A2D1E56F";
        oids[1] = "D3054ABB-B8B8-2189-3801-25AD7CCDB856";
        oids[2] = "DFA37B8B-304B-F9FA-588A-DB4BC58B20C3"; 
        String btmName = "Document";
        boolean rs = false;
        try {
            rs = operation.batchRevisonBusinessObject(oids, btmName);
        } catch (VCIError e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        Assert.assertTrue(rs);
    }
    
    @Test
    public void testEnoce() {
        try {
            String str = "Photo\\云南之旅-刘革辛\\刘革辛_16.jpg";
            str = str.replace("\\", "/");
            System.out.println(str);
            String[] strs = str.split("/");
            String cStr = "";
            for (int i = 0; i< strs.length; i++) {
                strs[i] = URLEncoder.encode(strs[i],"utf-8");
                System.out.println(strs[i]);
                cStr += "/" + strs[i];
            }
            System.out.println(cStr);
        } catch (UnsupportedEncodingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}