1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package com.xpn.xwiki.plugin.feed

File SyndEntrySourceApi.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart0.png
83% of files have more coverage

Code metrics

0
18
6
1
97
53
8
0.44
3
6
1.33

Classes

Class Line # Actions
SyndEntrySourceApi 34 18 0% 8 24
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package com.xpn.xwiki.plugin.feed;
21   
22    import java.util.HashMap;
23    import java.util.Map;
24   
25    import com.sun.syndication.feed.synd.SyndEntry;
26    import com.sun.syndication.feed.synd.SyndEntryImpl;
27    import com.xpn.xwiki.XWikiContext;
28    import com.xpn.xwiki.XWikiException;
29    import com.xpn.xwiki.api.Api;
30   
31    /**
32    * API for {@link SyndEntrySource}
33    */
 
34    public class SyndEntrySourceApi extends Api
35    {
36    public static final String SYND_ENTRY_SOURCE_EXCEPTION = "SyndEntrySourceException";
37   
38    private SyndEntrySource source;
39   
 
40  0 toggle public SyndEntrySourceApi(SyndEntrySource source, XWikiContext context)
41    {
42  0 super(context);
43  0 this.source = source;
44    }
45   
 
46  0 toggle protected SyndEntrySource getSyndEntrySource()
47    {
48  0 return this.source;
49    }
50   
51    /**
52    * @see SyndEntrySource#source(SyndEntry, Object, java.util.Map, XWikiContext)
53    */
 
54  0 toggle public boolean source(SyndEntry entry, Object obj, Map<String, Object> params)
55    {
56  0 getXWikiContext().remove(SYND_ENTRY_SOURCE_EXCEPTION);
57  0 try {
58  0 this.source.source(entry, obj, params, getXWikiContext());
59  0 return true;
60    } catch (XWikiException e) {
61  0 getXWikiContext().put(SYND_ENTRY_SOURCE_EXCEPTION, e);
62  0 return false;
63    }
64    }
65   
66    /**
67    * @see SyndEntrySource#source(SyndEntry, Object, java.util.Map, XWikiContext)
68    */
 
69  0 toggle public boolean source(SyndEntry entry, Object obj)
70    {
71  0 return this.source(entry, obj, new HashMap<String, Object>());
72    }
73   
74    /**
75    * @see SyndEntrySource#source(SyndEntry, Object, java.util.Map, XWikiContext)
76    */
 
77  0 toggle public SyndEntry source(Object obj, Map<String, Object> params)
78    {
79  0 getXWikiContext().remove(SYND_ENTRY_SOURCE_EXCEPTION);
80  0 try {
81  0 SyndEntry entry = new SyndEntryImpl();
82  0 this.source.source(entry, obj, params, getXWikiContext());
83  0 return entry;
84    } catch (XWikiException e) {
85  0 getXWikiContext().put(SYND_ENTRY_SOURCE_EXCEPTION, e);
86  0 return null;
87    }
88    }
89   
90    /**
91    * @see SyndEntrySource#source(SyndEntry, Object, java.util.Map, XWikiContext)
92    */
 
93  0 toggle public SyndEntry source(Object obj)
94    {
95  0 return this.source(obj, new HashMap<String, Object>());
96    }
97    }