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 package fr.paris.lutece.plugins.whatsnew.service.portlet;
35
36 import fr.paris.lutece.plugins.whatsnew.business.PortletDocumentLink;
37 import fr.paris.lutece.plugins.whatsnew.business.portlet.WhatsNewPortlet;
38 import fr.paris.lutece.plugins.whatsnew.business.portlet.WhatsNewPortletHome;
39 import fr.paris.lutece.plugins.whatsnew.service.WhatsNewPlugin;
40 import fr.paris.lutece.portal.business.portlet.PortletHome;
41 import fr.paris.lutece.portal.service.plugin.Plugin;
42 import fr.paris.lutece.portal.service.plugin.PluginService;
43
44 import java.util.List;
45
46
47
48
49
50
51
52 public class WhatsNewPortletService
53 {
54 private static WhatsNewPortletService _singleton;
55
56
57
58
59
60
61 public static WhatsNewPortletService getInstance( )
62 {
63 if ( _singleton == null )
64 {
65 _singleton = new WhatsNewPortletService( );
66 }
67
68 return _singleton;
69 }
70
71
72
73
74 public void init( )
75 {
76 }
77
78
79
80
81
82
83 public WhatsNewPortlet getPortlet( int nPortletId )
84 {
85 return (WhatsNewPortlet) PortletHome.findByPrimaryKey( nPortletId );
86 }
87
88
89
90
91
92 public String getPortletTypeId( )
93 {
94 return WhatsNewPortletHome.getInstance( ).getPortletTypeId( );
95 }
96
97
98
99
100
101 public void create( WhatsNewPortlet portlet )
102 {
103 WhatsNewPortletHome.getInstance( ).create( portlet );
104 }
105
106
107
108
109
110 public void update( WhatsNewPortlet portlet )
111 {
112 WhatsNewPortletHome.getInstance( ).update( portlet );
113 }
114
115
116
117
118
119 public void remove( WhatsNewPortlet portlet )
120 {
121 Plugin plugin = PluginService.getPlugin( WhatsNewPlugin.PLUGIN_NAME );
122 WhatsNewPortletHome.getInstance( ).remove( portlet );
123 removeModeratedElements( portlet, plugin );
124 }
125
126
127
128
129
130 public List<WhatsNewPortlet> selectAll( )
131 {
132 return WhatsNewPortletHome.getInstance( ).selectAll( );
133 }
134
135
136
137
138
139
140
141 public List<Integer> getPageIdsFromWhatsNewId( int nWhatsNewPortletId, Plugin plugin )
142 {
143 return WhatsNewPortletHome.getInstance( ).getPageIdsFromWhatsNewId( nWhatsNewPortletId, plugin );
144 }
145
146
147
148
149
150
151
152 public List<Integer> getPortletIdsFromWhatsNewId( int nWhatsNewPortletId, Plugin plugin )
153 {
154 return WhatsNewPortletHome.getInstance( ).getPortletIdsFromWhatsNewId( nWhatsNewPortletId, plugin );
155 }
156
157
158
159
160
161
162
163 public List<PortletDocumentLink> getDocumentsFromWhatsNewId( int nWhatsNewPortletId, Plugin plugin )
164 {
165 return WhatsNewPortletHome.getInstance( ).getDocumentsFromWhatsNewId( nWhatsNewPortletId, plugin );
166 }
167
168
169
170
171
172
173
174 public void createModeratedPage( int nWhatsNewPortletId, int nPageId, Plugin plugin )
175 {
176 WhatsNewPortletHome.getInstance( ).createModeratedPage( nWhatsNewPortletId, nPageId, plugin );
177 }
178
179
180
181
182
183
184
185 public void createModeratedPortlet( int nWhatsNewPortletId, int nPortletId, Plugin plugin )
186 {
187 WhatsNewPortletHome.getInstance( ).createModeratedPortlet( nWhatsNewPortletId, nPortletId, plugin );
188 }
189
190
191
192
193
194
195
196 public void createModeratedDocument( int nWhatsNewPortletId, PortletDocumentLink pdLink, Plugin plugin )
197 {
198 WhatsNewPortletHome.getInstance( ).createModeratedDocument( nWhatsNewPortletId, pdLink, plugin );
199 }
200
201
202
203
204
205
206 public void removeModeratedElements( WhatsNewPortlet portlet, Plugin plugin )
207 {
208 removeModeratedPortlets( portlet, plugin );
209 removeModeratedPages( portlet, plugin );
210 removeModeratedDocuments( portlet, plugin );
211 }
212
213
214
215
216
217
218 public void removeModeratedPages( WhatsNewPortlet whatsNewPortlet, Plugin plugin )
219 {
220 WhatsNewPortletHome.getInstance( ).removeModeratedPages( whatsNewPortlet.getId( ), plugin );
221 }
222
223
224
225
226
227
228 public void removeModeratedPortlets( WhatsNewPortlet whatsNewPortlet, Plugin plugin )
229 {
230 WhatsNewPortletHome.getInstance( ).removeModeratedPortlets( whatsNewPortlet.getId( ), plugin );
231 }
232
233
234
235
236
237
238 public void removeModeratedDocuments( WhatsNewPortlet whatsNewPortlet, Plugin plugin )
239 {
240 WhatsNewPortletHome.getInstance( ).removeModeratedDocuments( whatsNewPortlet.getId( ), plugin );
241 }
242
243
244
245
246
247
248
249 public void removeModeratedPage( int nWhatsNewPortletId, int nPageId, Plugin plugin )
250 {
251 WhatsNewPortletHome.getInstance( ).removeModeratedPage( nWhatsNewPortletId, nPageId, plugin );
252 }
253
254
255
256
257
258
259
260 public void removeModeratedPortlet( int nWhatsNewPortletId, int nPortletId, Plugin plugin )
261 {
262 WhatsNewPortletHome.getInstance( ).removeModeratedPortlet( nWhatsNewPortletId, nPortletId, plugin );
263 }
264
265
266
267
268
269
270
271 public void removeModeratedDocument( int nWhatsNewPortletId, PortletDocumentLink pdLink, Plugin plugin )
272 {
273 WhatsNewPortletHome.getInstance( ).removeModeratedDocument( nWhatsNewPortletId, pdLink, plugin );
274 }
275 }