1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.rendering.macro.rss; |
21 |
|
|
22 |
|
import java.net.MalformedURLException; |
23 |
|
import java.net.URL; |
24 |
|
|
25 |
|
import org.apache.commons.lang3.StringUtils; |
26 |
|
import org.xwiki.properties.annotation.PropertyDescription; |
27 |
|
import org.xwiki.properties.annotation.PropertyMandatory; |
28 |
|
import org.xwiki.rendering.macro.parameter.MacroParameterException; |
29 |
|
|
30 |
|
|
31 |
|
@link |
32 |
|
|
33 |
|
@version |
34 |
|
@since |
35 |
|
|
|
|
| 89.7% |
Uncovered Elements: 3 (29) |
Complexity: 14 |
Complexity Density: 0.88 |
|
36 |
|
public class RssMacroParameters |
37 |
|
{ |
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
private String feed; |
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
private boolean content; |
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
private int count = 10; |
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
private boolean image; |
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
private String width = StringUtils.EMPTY; |
62 |
|
|
63 |
|
|
64 |
|
@see |
65 |
|
|
66 |
|
private boolean decoration = true; |
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
private URL feedURL; |
72 |
|
|
73 |
|
|
74 |
|
@return |
75 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
76 |
25 |
public String getFeed()... |
77 |
|
{ |
78 |
25 |
return feed; |
79 |
|
} |
80 |
|
|
81 |
|
|
82 |
|
@param |
83 |
|
@throws |
84 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
85 |
13 |
@PropertyMandatory... |
86 |
|
@PropertyDescription("URL of the RSS feed") |
87 |
|
public void setFeed(String feed) throws MacroParameterException |
88 |
|
{ |
89 |
13 |
this.feed = feed; |
90 |
13 |
try { |
91 |
13 |
this.feedURL = new java.net.URL(feed); |
92 |
|
} catch (MalformedURLException ex) { |
93 |
0 |
throw new MacroParameterException("Malformed feed URL", ex); |
94 |
|
} |
95 |
|
} |
96 |
|
|
97 |
|
|
98 |
|
@param |
99 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
100 |
4 |
@PropertyDescription("If the feeds has an image associated, display it?")... |
101 |
|
public void setImage(boolean image) |
102 |
|
{ |
103 |
4 |
this.image = image; |
104 |
|
} |
105 |
|
|
106 |
|
|
107 |
|
@return |
108 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
109 |
10 |
public boolean isImage()... |
110 |
|
{ |
111 |
10 |
return image; |
112 |
|
} |
113 |
|
|
114 |
|
|
115 |
|
@param |
116 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
117 |
0 |
@PropertyDescription("The width, in px or %, of the box containing the RSS output (default is 30%)")... |
118 |
|
public void setWidth(String width) |
119 |
|
{ |
120 |
0 |
this.width = width; |
121 |
|
} |
122 |
|
|
123 |
|
|
124 |
|
@return |
125 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
126 |
10 |
public String getWidth()... |
127 |
|
{ |
128 |
10 |
return this.width; |
129 |
|
} |
130 |
|
|
131 |
|
|
132 |
|
@param |
133 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
134 |
6 |
@PropertyDescription("The maximum number of feed items to display on the page.")... |
135 |
|
public void setCount(int count) |
136 |
|
{ |
137 |
6 |
this.count = count; |
138 |
|
} |
139 |
|
|
140 |
|
|
141 |
|
@return |
142 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
143 |
12 |
public int getCount()... |
144 |
|
{ |
145 |
12 |
return count; |
146 |
|
} |
147 |
|
|
148 |
|
|
149 |
|
@return |
150 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
151 |
6 |
public URL getFeedURL()... |
152 |
|
{ |
153 |
6 |
return feedURL; |
154 |
|
} |
155 |
|
|
156 |
|
|
157 |
|
@param |
158 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
159 |
6 |
@PropertyDescription("Display content for feed entries")... |
160 |
|
public void setContent(boolean content) |
161 |
|
{ |
162 |
6 |
this.content = content; |
163 |
|
} |
164 |
|
|
165 |
|
|
166 |
|
@return |
167 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
168 |
16 |
public boolean isContent()... |
169 |
|
{ |
170 |
16 |
return this.content; |
171 |
|
} |
172 |
|
|
173 |
|
|
174 |
|
@param |
175 |
|
|
176 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
177 |
2 |
@PropertyDescription("Display UI decorations around feed and feed entries")... |
178 |
|
public void setDecoration(boolean decoration) |
179 |
|
{ |
180 |
2 |
this.decoration = decoration; |
181 |
|
} |
182 |
|
|
183 |
|
|
184 |
|
@return |
185 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
186 |
12 |
public boolean isDecoration()... |
187 |
|
{ |
188 |
12 |
return this.decoration; |
189 |
|
} |
190 |
|
} |