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
package com.yeshi.buwan.service.imp;
 
import java.util.ArrayList;
import java.util.List;
 
import javax.annotation.Resource;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
 
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.springframework.orm.hibernate4.HibernateCallback;
import org.springframework.stereotype.Service;
 
import com.yeshi.buwan.dao.VideoDetailInfoDao;
import com.yeshi.buwan.dao.VideoInfoDao;
import com.yeshi.buwan.dao.VideoTypeDao;
import com.yeshi.buwan.domain.AdminInfo;
import com.yeshi.buwan.domain.HomeAd;
import com.yeshi.buwan.domain.HomeVideo;
import com.yeshi.buwan.domain.SuperHomeAd;
import com.yeshi.buwan.domain.VideoBanQuanVideo;
import com.yeshi.buwan.domain.VideoDetailInfo;
import com.yeshi.buwan.domain.VideoInfo;
import com.yeshi.buwan.domain.VideoIntersectionVideo;
import com.yeshi.buwan.domain.VideoResource;
import com.yeshi.buwan.domain.VideoType;
import com.yeshi.buwan.domain.VideoUrl;
import com.yeshi.buwan.domain.special.SpecialVideo;
import com.yeshi.buwan.domain.special.SuperSpecial;
import com.yeshi.buwan.util.JuheVideoUtil;
import com.yeshi.buwan.util.LogUtil;
import com.yeshi.buwan.util.StringUtil;
 
@Service
public class VideoManager {
    @Resource
    private VideoInfoDao videoInfoDao;
    @Resource
    private VideoTypeDao videoTypeDao;
    @Resource
    private VideoDetailInfoDao videoDetailInfoDao;
 
    /**
     * 主键查询某一个视频的信息
     * 
     * @param id
     * @return
     */
    public VideoInfo getVideoInfo(String id) {
        VideoInfo info = videoInfoDao.find(VideoInfo.class, id);
        info.setVideoDetailList(getVideoDetail(info.getId()));
        return info;
    }
 
    /**
     * 添加一个视频信息
     * 
     * @param info
     * @return
     */
    public VideoInfo addVideoInfo(VideoInfo info) {
        info.setUpdatetime(System.currentTimeMillis() + "");
 
        videoInfoDao.save(info);
        List<VideoInfo> list = videoInfoDao.list("from VideoInfo v where v.createtime=? and v.name=?",
                new String[] { info.getCreatetime() + "", info.getName() });
        return list.get(0);
    }
 
    String[] sts = { "彼得兔", "铁扇公主", "过猴山", "骄傲的将军", "夸口的青蛙", "小猫钓鱼", "好朋友", "神笔马良", "木头公主", "猪八戒吃西瓜", "小鲤鱼", "我知道",
            "老小阿凡提", "阿狸通话日记" };
 
    boolean isContains(String st) {
        for (String s : sts) {
            if (st.contains(s)) {
                return true;
            }
        }
        return false;
    }
 
    // 获取大分类
    public String getRootType(long id) {
        VideoType type = videoTypeDao.find(VideoType.class, id);
        while (type.getParent() != null)
            type = type.getParent();
        return type.getId() + "";
    }
 
    // 添加视频
    @SuppressWarnings("unchecked")
    public void addVideoInfo(List<VideoInfo> list) {
        for (VideoInfo in : list) {
            final VideoInfo info = in;
            LogUtil.i("视频名称:" + info.getName());
            // if (!info.getName().contains("三个奶爸")) continue;
            final String parentId = getRootType(info.getVideoType().getId());
            videoInfoDao.excute(new HibernateCallback() {
                public Object doInHibernate(Session session) throws HibernateException {
                    try {
                        List<VideoInfo> vList = session
                                .createQuery("from VideoInfo v where v.name=? and v.show=1 and (v.videoType.id="
                                        + parentId + " or v.videoType.parent.id=" + parentId + ")")
                                .setParameter(0, info.getName()).list();
                        session.getTransaction().begin();
                        if (vList.size() <= 0) {// 不存在视频--可以添加进去
                            info.setUpdatetime(System.currentTimeMillis() + "");
                            session.persist(info);
                            List<VideoInfo> viList = session
                                    .createQuery("from VideoInfo v where v.name=? and v.createtime=?")
                                    .setParameter(0, info.getName()).setParameter(1, info.getCreatetime()).list();// 查询出刚刚添加的视频
                            if (viList != null && viList.size() > 0) {
                                VideoInfo newVideo = new VideoInfo(viList.get(0).getId());
                                LogUtil.i("查出的VideoId为:" + newVideo.getId());
                                for (int i = 0; i < info.getVideoDetailList().size(); i++) {
                                    VideoDetailInfo detail = info.getVideoDetailList().get(i);
                                    detail.setVideo(newVideo);
                                    session.persist(detail);
                                    session.createSQLQuery(
                                            "update wk_video_video_detail d set d.videoid=? where d.name=? and d.tag=? and d.createtime=?")
                                            .setParameter(0, newVideo.getId()).setParameter(1, detail.getName())
                                            .setParameter(2, detail.getTag()).setParameter(3, detail.getCreatetime())
                                            .executeUpdate();
                                }
                            } else {
                                LogUtil.i("videoId没有查出来");
                            }
 
                        } else {// 存在的视频,添加进UrlList
                            // 获取videoDetail;
                            vList.get(0).setTag(info.getTag());
                            session.update(vList.get(0));
                            vList.get(0).setNowNumber(info.getNowNumber());
                            vList.get(0).setTotalNumber(info.getTotalNumber());
 
                            List<VideoDetailInfo> detailList = getVideoDetail(session, vList.get(0).getId());// 获取原来的detailList
                            for (int n = 0; n < info.getVideoDetailList().size(); n++) {
                                if (n + 1 > detailList.size()) {// 原来不存在这一集
                                    VideoInfo newVideo = vList.get(0);
                                    // 保存详情
                                    VideoDetailInfo detail = info.getVideoDetailList().get(n);
                                    detail.setVideo(newVideo);
                                    session.persist(detail);
                                    session.createSQLQuery(
                                            "update wk_video_video_detail d set d.videoid=? where d.name=? and d.tag=? and d.createtime=?")
                                            .setParameter(0, newVideo.getId()).setParameter(1, detail.getName())
                                            .setParameter(2, detail.getTag()).setParameter(3, detail.getCreatetime())
                                            .executeUpdate();
 
                                } else {// 原来存在这个detail
                                    VideoDetailInfo detail = detailList.get(n);// 获取原来那个url
                                    List<VideoUrl> urlList = detail.getUrls();
                                    VideoUrl vurl = null;
 
                                    for (VideoUrl videoUrl : urlList) {
                                        if (videoUrl.getResource().getId().equalsIgnoreCase(info.getVideoDetailList()
                                                .get(n).getUrls().get(0).getResource().getId())) {// 存在
                                            vurl = videoUrl;
                                        }
                                    }
 
                                    if (vurl == null) {// 不存在--往里面添加
                                        VideoUrl vu = null;
                                        try {
                                            vu = info.getVideoDetailList().get(n).getUrls().get(0);
                                        } catch (Exception e) {
                                            vu = info.getVideoDetailList().get(n).getUrls().get(0);
                                        }
                                        vu.setVideoDetail(detail);
                                        // 更新url
                                        session.createSQLQuery(
                                                "insert into wk_video_video_url  (videodetailid,resourceid,vdetailurl,createtime,adminid,beizhu,baseurl) values(?,?,?,?,?,?,?)")
                                                .setParameter(0, detail.getId())
                                                .setParameter(1, vu.getResource().getId()).setParameter(2, vu.getUrl())
                                                .setParameter(3, vu.getCreatetime())
                                                .setParameter(4, vu.getAdmin().getId()).setParameter(5, vu.getBeizhu())
                                                .setParameter(6, vu.getBaseUrl()).executeUpdate();
                                    } else {// 原来存在该URL
                                        VideoUrl newUrl = info.getVideoDetailList().get(n).getUrls().get(0);
                                        if (!newUrl.getUrl().equals(vurl.getUrl())) {
                                            vurl.setUrl(newUrl.getUrl());
                                            session.update(vurl);
                                            detail.setTag(info.getVideoDetailList().get(n).getTag());
                                            session.update(detail);
                                        }
                                    }
                                }
                            }
                        }
                        session.flush();
                        session.getTransaction().commit();
                    } catch (Exception e) {
                        LogUtil.i("视频名称:" + info.getName());
                        e.printStackTrace();
                        session.getTransaction().rollback();
                    }
 
                    return null;
                }
            });
 
        }
    }
 
    public void updateVideoInfo(VideoInfo info) {
        videoInfoDao.update(info);
    }
 
    public void updateVideoInfo(List<VideoInfo> list) {
        for (VideoInfo vi : list)
            videoInfoDao.update(vi);
    }
 
    @ManyToOne
    private AdminInfo getAdmin() {
        AdminInfo info = new AdminInfo();
        info.setId("1");
        return info;
    }
 
    /**
     * 添加视频详情
     * 
     * @param list
     */
    public void addVideoDetail(final VideoInfo info, final List<VideoDetailInfo> list) {
        videoInfoDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    session.getTransaction().begin();
                    for (int i = 0; i < list.size(); i++) {
                        VideoInfo video = new VideoInfo(info.getId());
                        list.get(i).setVideo(video);
                        session.persist(list.get(i));
                    }
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
 
    }
 
    /**
     * 添加视频详情
     * 
     * @param list
     */
    public void addVideoDetail(final List<VideoDetailInfo> list) {
        videoInfoDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    session.getTransaction().begin();
                    for (int i = 0; i < list.size(); i++) {
                        session.persist(list.get(i));
                    }
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
 
    }
 
    public VideoDetailInfo addVideoDetail(final VideoDetailInfo detail) {
        videoInfoDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    session.getTransaction().begin();
                    session.persist(detail);
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                }
                return null;
            }
        });
 
        List<VideoDetailInfo> list = getVideoDetail(detail.getVideo().getId());
        if (list != null && list.size() > 0)
            return list.get(0);
        else
            return null;
    }
 
    public List<VideoDetailInfo> getVideoDetail(String videoId) {
        LogUtil.i("请求开始:" + System.currentTimeMillis());
        List<VideoDetailInfo> list = videoDetailInfoDao.list("from VideoDetailInfo d where d.video.id=?",
                new String[] { videoId });
        LogUtil.i("请求结束:" + System.currentTimeMillis());
        return list;
    }
 
    public VideoDetailInfo getVideoDetailById(long videoDetailId) {
        return videoDetailInfoDao.find(VideoDetailInfo.class, videoDetailId);
    }
 
    public List<VideoDetailInfo> getVideoDetailByVideoName(String name) {
        LogUtil.i("请求开始:" + System.currentTimeMillis());
 
        List<VideoDetailInfo> list = videoDetailInfoDao.list("from VideoDetailInfo d where d.name=?",
                new String[] { name });
        LogUtil.i("请求结束:" + System.currentTimeMillis());
        return list;
    }
 
    public List<VideoDetailInfo> getVideoDetail(Session session, String videoId) {
        @SuppressWarnings("unchecked")
        List<VideoDetailInfo> list = session.createQuery("from VideoDetailInfo d where d.video.id=?")
                .setParameter(0, videoId).list();
        LogUtil.i("请求结束:" + System.currentTimeMillis());
        return list;
    }
 
    /**
     * 更新视频的详情
     * 
     * @param list
     */
    public void updateVideoDetail(final List<VideoDetailInfo> list) {
 
        videoInfoDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
 
                    // BaseDao<VideoDetailInfo> dao = new
                    // BaseDao<VideoDetailInfo>();
                    // /BaseDao<VideoUrl> urlDao = new BaseDao<VideoUrl>();
                    // BaseDao<VideoDetailInfo> dao = new
                    // BaseDao<VideoDetailInfo>();
                    session.getTransaction().begin();
                    for (int i = 0; i < list.size(); i++) {
                        for (int j = 0; j < list.get(i).getUrls().size(); j++) {
                            session.createSQLQuery("update wk_video_video_url set vdetailurl=? where id=?")
                                    .setParameter(0, list.get(i).getUrls().get(j).getUrl())
                                    .setParameter(1, list.get(i).getUrls().get(j).getId() + "").executeUpdate();
                        }
                    }
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
 
    }
 
    public void updateVideoDetail(final VideoDetailInfo detail) {
        if (detail.getUrls() == null || detail.getUrls().size() < 1)
            return;
 
        videoInfoDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    session.getTransaction().begin();
                    session.createQuery("delete from VideoUrl vu where vu.videoDetail.id=?")
                            .setParameter(0, detail.getId()).executeUpdate();
                    for (VideoUrl vu : detail.getUrls())
                        session.save(vu);
                    session.update(detail);
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
 
    }
 
    public void deleteVideoDetail(VideoDetailInfo detail) {
        videoDetailInfoDao.delete(detail);
    }
 
    /**
     * 更新视频的详情
     * 
     * @param list
     */
    public void updateVideoDetailByAdmin(final List<VideoDetailInfo> list) {
        videoInfoDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    session.getTransaction().begin();
                    for (int i = 0; i < list.size(); i++) {
                        try {
                            session.persist(list.get(i));
                        } catch (Exception e) {
                            session.update(list.get(i));
                        }
                    }
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                    LogUtil.i("事物回滚");
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
 
    }
 
    @SuppressWarnings("unchecked")
    public void deleteVideo(final String videoId) {
        try {
            videoInfoDao.excute(new HibernateCallback() {
                public Object doInHibernate(Session session) throws HibernateException {
                    try {
                        List<HomeVideo> hlist = session.createQuery("from HomeVideo v where v.video.id=?")
                                .setParameter(0, videoId).list();
                        session.getTransaction().begin();
                        JuheVideoUtil.clearData(session, videoId);
                        if (hlist != null && hlist.size() > 0) {
                            for (HomeVideo hv : hlist) {
                                session.delete(hv);
                            }
                        }
                        // 删除收藏
                        session.createSQLQuery("delete from wk_video_collection where videoid=" + videoId)
                                .executeUpdate();
 
                        List<VideoBanQuanVideo> qlist = session
                                .createQuery("from VideoBanQuanVideo c where c.info.id=?").setParameter(0, videoId)
                                .list();
                        if (qlist != null && qlist.size() > 0) {
                            for (VideoBanQuanVideo c : qlist)
                                session.delete(c);
                        }
 
                        List<HomeAd> hdList = session
                                .createQuery("from HomeAd ha where ha.linkType=1 and ha.video.id=?")
                                .setParameter(0, videoId).list();
 
                        for (HomeAd had : hdList) {
                            List<SuperHomeAd> shadL = session
                                    .createQuery("from SuperHomeAd shad where shad.homeAd.id=?")
                                    .setParameter(0, had.getId()).list();
                            for (SuperHomeAd shad : shadL)
                                session.delete(shad);
                            session.delete(had);
                        }
 
                        // 专题视频删除
                        List<SpecialVideo> svList = session.createQuery("from SpecialVideo ha where ha.video.id=?")
                                .setParameter(0, videoId).list();
 
                        for (SpecialVideo sv : svList) {
                            List<SuperSpecial> shadL = session
                                    .createQuery("from SuperSpecial shad where shad.special.id=?")
                                    .setParameter(0, sv.getSpecial().getId()).list();
                            for (SuperSpecial shad : shadL)
                                session.delete(shad);
                            session.delete(sv);
                        }
 
                        // 合集视频删除
                        List<VideoIntersectionVideo> viList = session
                                .createQuery("from VideoIntersectionVideo ha where ha.video.id=?")
                                .setParameter(0, videoId).list();
                        for (VideoIntersectionVideo sv : viList) {
                            session.delete(sv);
                        }
 
                        // 视频删除
                        List<VideoDetailInfo> list = session.createQuery("from VideoDetailInfo v where v.video.id=?")
                                .setParameter(0, videoId).list();
                        // 删除视频的详细信息
                        for (VideoDetailInfo object : list) {
                            // 删除链接信息
                            for (VideoUrl vu : object.getUrls())
                                session.delete(vu);
                            // 删除详情
                            session.delete(object);
                        }
 
                        // 删除视频源信息
                        session.createSQLQuery("delete  from wk_video_video where id=?").setParameter(0, videoId)
                                .executeUpdate();
                        session.flush();
                        session.getTransaction().commit();
                    } catch (Exception e) {
                        e.printStackTrace();
                        session.getTransaction().rollback();
                    }
                    return null;
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
 
    }
 
    // 更新视频的观看数
    public void updateVideoWatchCount(final String videoId) {
        videoInfoDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                try {
                    session.getTransaction().begin();
                    session.createSQLQuery("update wk_video_video set watchcount=(watchcount+1) where id=" + videoId)
                            .executeUpdate();
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                    session.getTransaction().rollback();
                }
                return null;
            }
        });
 
    }
 
    @OneToMany
    private List<VideoDetailInfo> getVideoDetailList() {
        List<VideoDetailInfo> list = new ArrayList<VideoDetailInfo>();
        VideoDetailInfo info = new VideoDetailInfo();
        info.setAdmin(getAdmin());
        info.setBeizhu("测试信息");
        info.setCreatetime(System.currentTimeMillis() + "");
        info.setName("功夫");
        info.setTag("");
        List<VideoUrl> urlList = info.getUrls();
        VideoUrl url = new VideoUrl();
        url.setAdmin(getAdmin());
        url.setBeizhu("测试");
        url.setCreatetime(System.currentTimeMillis() + "");
        VideoResource resource = new VideoResource();
        resource.setId("1");
        url.setResource(resource);
        url.setUrl("http://123333.mp4");
        urlList.add(url);
        info.setUrls(urlList);
        list.add(info);
        return list;
    }
 
    @SuppressWarnings("finally")
    public boolean changeVideoShow(final VideoInfo info) {
        return (Boolean) videoInfoDao.excute(new HibernateCallback<Boolean>() {
            public Boolean doInHibernate(Session session) throws HibernateException {
                int result = 0;
                try {
                    session.getTransaction().begin();
                    result = session.createSQLQuery("update wk_video_video set `show`=? where `id`=?")
                            .setParameter(0, info.getShow()).setParameter(1, info.getId()).executeUpdate();
                    session.flush();
                    session.getTransaction().commit();
                } catch (Exception e) {
                    e.printStackTrace();
                } finally {
                    if (result > 0)
                        return true;
                    else
                        return false;
                }
 
            }
        });
 
    }
 
    /**
     * 生成视频的名称--唯一
     * 
     * @return
     */
    public String getVideoPathName(String type, String oldName) {
        String src = (long) (Math.random() * 100000000)
                + StringUtil.Md5(System.currentTimeMillis() + (long) (Math.random() * 100000000) + "");
        return StringUtil.getBase64(src) + "_" + StringUtil.getBase64(oldName) + "." + type;
    }
 
    @ManyToOne
    private VideoType getVideoType() {
        VideoType type = new VideoType();
        type.setId(1);
        return type;
    }
 
    // 隐藏视频
    public void setVideoHidden(final String urlKey) {
 
        videoInfoDao.excute(new HibernateCallback() {
            public Object doInHibernate(Session session) throws HibernateException {
                List<String> listSt = new ArrayList<String>();
                try {
                    List list = session
                            .createSQLQuery(
                                    "select d.videoid from wk_video_video_url u left join wk_video_video_detail d on d.id=u.videodetailid where vdetailurl like ?")
                            .setParameter(0, "%" + urlKey + "%").list();
                    for (int i = 0; i < list.size(); i++) {
                        Object obj = (Object) list.get(i);
                        listSt.add(obj.toString());
                        LogUtil.i(obj.toString());
                    }
                    LogUtil.i(list.size());
                    for (int j = 0; j < listSt.size(); j++) {
                        VideoInfo vi = videoInfoDao.find(VideoInfo.class, listSt.get(j));
                        vi.setShow("0");
                        videoInfoDao.update(vi);
                    }
 
                } catch (Exception e) {
                    e.printStackTrace();
                }
                return null;
            }
        });
 
    }
}