1
22
23 package com.liferay.portlet.wiki.service.persistence;
24
25 import com.liferay.portal.kernel.util.GetterUtil;
26 import com.liferay.portal.kernel.util.Validator;
27 import com.liferay.portal.model.ModelListener;
28 import com.liferay.portal.util.PropsUtil;
29
30 import org.apache.commons.logging.Log;
31 import org.apache.commons.logging.LogFactory;
32
33
39 public class WikiPageUtil {
40 public static com.liferay.portlet.wiki.model.WikiPage create(long pageId) {
41 return getPersistence().create(pageId);
42 }
43
44 public static com.liferay.portlet.wiki.model.WikiPage remove(long pageId)
45 throws com.liferay.portal.SystemException,
46 com.liferay.portlet.wiki.NoSuchPageException {
47 ModelListener listener = _getListener();
48
49 if (listener != null) {
50 listener.onBeforeRemove(findByPrimaryKey(pageId));
51 }
52
53 com.liferay.portlet.wiki.model.WikiPage wikiPage = getPersistence()
54 .remove(pageId);
55
56 if (listener != null) {
57 listener.onAfterRemove(wikiPage);
58 }
59
60 return wikiPage;
61 }
62
63 public static com.liferay.portlet.wiki.model.WikiPage remove(
64 com.liferay.portlet.wiki.model.WikiPage wikiPage)
65 throws com.liferay.portal.SystemException {
66 ModelListener listener = _getListener();
67
68 if (listener != null) {
69 listener.onBeforeRemove(wikiPage);
70 }
71
72 wikiPage = getPersistence().remove(wikiPage);
73
74 if (listener != null) {
75 listener.onAfterRemove(wikiPage);
76 }
77
78 return wikiPage;
79 }
80
81 public static com.liferay.portlet.wiki.model.WikiPage update(
82 com.liferay.portlet.wiki.model.WikiPage wikiPage)
83 throws com.liferay.portal.SystemException {
84 ModelListener listener = _getListener();
85 boolean isNew = wikiPage.isNew();
86
87 if (listener != null) {
88 if (isNew) {
89 listener.onBeforeCreate(wikiPage);
90 }
91 else {
92 listener.onBeforeUpdate(wikiPage);
93 }
94 }
95
96 wikiPage = getPersistence().update(wikiPage);
97
98 if (listener != null) {
99 if (isNew) {
100 listener.onAfterCreate(wikiPage);
101 }
102 else {
103 listener.onAfterUpdate(wikiPage);
104 }
105 }
106
107 return wikiPage;
108 }
109
110 public static com.liferay.portlet.wiki.model.WikiPage update(
111 com.liferay.portlet.wiki.model.WikiPage wikiPage, boolean merge)
112 throws com.liferay.portal.SystemException {
113 ModelListener listener = _getListener();
114 boolean isNew = wikiPage.isNew();
115
116 if (listener != null) {
117 if (isNew) {
118 listener.onBeforeCreate(wikiPage);
119 }
120 else {
121 listener.onBeforeUpdate(wikiPage);
122 }
123 }
124
125 wikiPage = getPersistence().update(wikiPage, merge);
126
127 if (listener != null) {
128 if (isNew) {
129 listener.onAfterCreate(wikiPage);
130 }
131 else {
132 listener.onAfterUpdate(wikiPage);
133 }
134 }
135
136 return wikiPage;
137 }
138
139 public static com.liferay.portlet.wiki.model.WikiPage findByPrimaryKey(
140 long pageId)
141 throws com.liferay.portal.SystemException,
142 com.liferay.portlet.wiki.NoSuchPageException {
143 return getPersistence().findByPrimaryKey(pageId);
144 }
145
146 public static com.liferay.portlet.wiki.model.WikiPage fetchByPrimaryKey(
147 long pageId) throws com.liferay.portal.SystemException {
148 return getPersistence().fetchByPrimaryKey(pageId);
149 }
150
151 public static java.util.List findByNodeId(long nodeId)
152 throws com.liferay.portal.SystemException {
153 return getPersistence().findByNodeId(nodeId);
154 }
155
156 public static java.util.List findByNodeId(long nodeId, int begin, int end)
157 throws com.liferay.portal.SystemException {
158 return getPersistence().findByNodeId(nodeId, begin, end);
159 }
160
161 public static java.util.List findByNodeId(long nodeId, int begin, int end,
162 com.liferay.portal.kernel.util.OrderByComparator obc)
163 throws com.liferay.portal.SystemException {
164 return getPersistence().findByNodeId(nodeId, begin, end, obc);
165 }
166
167 public static com.liferay.portlet.wiki.model.WikiPage findByNodeId_First(
168 long nodeId, com.liferay.portal.kernel.util.OrderByComparator obc)
169 throws com.liferay.portal.SystemException,
170 com.liferay.portlet.wiki.NoSuchPageException {
171 return getPersistence().findByNodeId_First(nodeId, obc);
172 }
173
174 public static com.liferay.portlet.wiki.model.WikiPage findByNodeId_Last(
175 long nodeId, com.liferay.portal.kernel.util.OrderByComparator obc)
176 throws com.liferay.portal.SystemException,
177 com.liferay.portlet.wiki.NoSuchPageException {
178 return getPersistence().findByNodeId_Last(nodeId, obc);
179 }
180
181 public static com.liferay.portlet.wiki.model.WikiPage[] findByNodeId_PrevAndNext(
182 long pageId, long nodeId,
183 com.liferay.portal.kernel.util.OrderByComparator obc)
184 throws com.liferay.portal.SystemException,
185 com.liferay.portlet.wiki.NoSuchPageException {
186 return getPersistence().findByNodeId_PrevAndNext(pageId, nodeId, obc);
187 }
188
189 public static java.util.List findByN_T(long nodeId, java.lang.String title)
190 throws com.liferay.portal.SystemException {
191 return getPersistence().findByN_T(nodeId, title);
192 }
193
194 public static java.util.List findByN_T(long nodeId, java.lang.String title,
195 int begin, int end) throws com.liferay.portal.SystemException {
196 return getPersistence().findByN_T(nodeId, title, begin, end);
197 }
198
199 public static java.util.List findByN_T(long nodeId, java.lang.String title,
200 int begin, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
201 throws com.liferay.portal.SystemException {
202 return getPersistence().findByN_T(nodeId, title, begin, end, obc);
203 }
204
205 public static com.liferay.portlet.wiki.model.WikiPage findByN_T_First(
206 long nodeId, java.lang.String title,
207 com.liferay.portal.kernel.util.OrderByComparator obc)
208 throws com.liferay.portal.SystemException,
209 com.liferay.portlet.wiki.NoSuchPageException {
210 return getPersistence().findByN_T_First(nodeId, title, obc);
211 }
212
213 public static com.liferay.portlet.wiki.model.WikiPage findByN_T_Last(
214 long nodeId, java.lang.String title,
215 com.liferay.portal.kernel.util.OrderByComparator obc)
216 throws com.liferay.portal.SystemException,
217 com.liferay.portlet.wiki.NoSuchPageException {
218 return getPersistence().findByN_T_Last(nodeId, title, obc);
219 }
220
221 public static com.liferay.portlet.wiki.model.WikiPage[] findByN_T_PrevAndNext(
222 long pageId, long nodeId, java.lang.String title,
223 com.liferay.portal.kernel.util.OrderByComparator obc)
224 throws com.liferay.portal.SystemException,
225 com.liferay.portlet.wiki.NoSuchPageException {
226 return getPersistence().findByN_T_PrevAndNext(pageId, nodeId, title, obc);
227 }
228
229 public static java.util.List findByN_H(long nodeId, boolean head)
230 throws com.liferay.portal.SystemException {
231 return getPersistence().findByN_H(nodeId, head);
232 }
233
234 public static java.util.List findByN_H(long nodeId, boolean head,
235 int begin, int end) throws com.liferay.portal.SystemException {
236 return getPersistence().findByN_H(nodeId, head, begin, end);
237 }
238
239 public static java.util.List findByN_H(long nodeId, boolean head,
240 int begin, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
241 throws com.liferay.portal.SystemException {
242 return getPersistence().findByN_H(nodeId, head, begin, end, obc);
243 }
244
245 public static com.liferay.portlet.wiki.model.WikiPage findByN_H_First(
246 long nodeId, boolean head,
247 com.liferay.portal.kernel.util.OrderByComparator obc)
248 throws com.liferay.portal.SystemException,
249 com.liferay.portlet.wiki.NoSuchPageException {
250 return getPersistence().findByN_H_First(nodeId, head, obc);
251 }
252
253 public static com.liferay.portlet.wiki.model.WikiPage findByN_H_Last(
254 long nodeId, boolean head,
255 com.liferay.portal.kernel.util.OrderByComparator obc)
256 throws com.liferay.portal.SystemException,
257 com.liferay.portlet.wiki.NoSuchPageException {
258 return getPersistence().findByN_H_Last(nodeId, head, obc);
259 }
260
261 public static com.liferay.portlet.wiki.model.WikiPage[] findByN_H_PrevAndNext(
262 long pageId, long nodeId, boolean head,
263 com.liferay.portal.kernel.util.OrderByComparator obc)
264 throws com.liferay.portal.SystemException,
265 com.liferay.portlet.wiki.NoSuchPageException {
266 return getPersistence().findByN_H_PrevAndNext(pageId, nodeId, head, obc);
267 }
268
269 public static com.liferay.portlet.wiki.model.WikiPage findByN_T_V(
270 long nodeId, java.lang.String title, double version)
271 throws com.liferay.portal.SystemException,
272 com.liferay.portlet.wiki.NoSuchPageException {
273 return getPersistence().findByN_T_V(nodeId, title, version);
274 }
275
276 public static com.liferay.portlet.wiki.model.WikiPage fetchByN_T_V(
277 long nodeId, java.lang.String title, double version)
278 throws com.liferay.portal.SystemException {
279 return getPersistence().fetchByN_T_V(nodeId, title, version);
280 }
281
282 public static java.util.List findByN_T_H(long nodeId,
283 java.lang.String title, boolean head)
284 throws com.liferay.portal.SystemException {
285 return getPersistence().findByN_T_H(nodeId, title, head);
286 }
287
288 public static java.util.List findByN_T_H(long nodeId,
289 java.lang.String title, boolean head, int begin, int end)
290 throws com.liferay.portal.SystemException {
291 return getPersistence().findByN_T_H(nodeId, title, head, begin, end);
292 }
293
294 public static java.util.List findByN_T_H(long nodeId,
295 java.lang.String title, boolean head, int begin, int end,
296 com.liferay.portal.kernel.util.OrderByComparator obc)
297 throws com.liferay.portal.SystemException {
298 return getPersistence().findByN_T_H(nodeId, title, head, begin, end, obc);
299 }
300
301 public static com.liferay.portlet.wiki.model.WikiPage findByN_T_H_First(
302 long nodeId, java.lang.String title, boolean head,
303 com.liferay.portal.kernel.util.OrderByComparator obc)
304 throws com.liferay.portal.SystemException,
305 com.liferay.portlet.wiki.NoSuchPageException {
306 return getPersistence().findByN_T_H_First(nodeId, title, head, obc);
307 }
308
309 public static com.liferay.portlet.wiki.model.WikiPage findByN_T_H_Last(
310 long nodeId, java.lang.String title, boolean head,
311 com.liferay.portal.kernel.util.OrderByComparator obc)
312 throws com.liferay.portal.SystemException,
313 com.liferay.portlet.wiki.NoSuchPageException {
314 return getPersistence().findByN_T_H_Last(nodeId, title, head, obc);
315 }
316
317 public static com.liferay.portlet.wiki.model.WikiPage[] findByN_T_H_PrevAndNext(
318 long pageId, long nodeId, java.lang.String title, boolean head,
319 com.liferay.portal.kernel.util.OrderByComparator obc)
320 throws com.liferay.portal.SystemException,
321 com.liferay.portlet.wiki.NoSuchPageException {
322 return getPersistence().findByN_T_H_PrevAndNext(pageId, nodeId, title,
323 head, obc);
324 }
325
326 public static java.util.List findWithDynamicQuery(
327 com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer)
328 throws com.liferay.portal.SystemException {
329 return getPersistence().findWithDynamicQuery(queryInitializer);
330 }
331
332 public static java.util.List findWithDynamicQuery(
333 com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer,
334 int begin, int end) throws com.liferay.portal.SystemException {
335 return getPersistence().findWithDynamicQuery(queryInitializer, begin,
336 end);
337 }
338
339 public static java.util.List findAll()
340 throws com.liferay.portal.SystemException {
341 return getPersistence().findAll();
342 }
343
344 public static java.util.List findAll(int begin, int end)
345 throws com.liferay.portal.SystemException {
346 return getPersistence().findAll(begin, end);
347 }
348
349 public static java.util.List findAll(int begin, int end,
350 com.liferay.portal.kernel.util.OrderByComparator obc)
351 throws com.liferay.portal.SystemException {
352 return getPersistence().findAll(begin, end, obc);
353 }
354
355 public static void removeByNodeId(long nodeId)
356 throws com.liferay.portal.SystemException {
357 getPersistence().removeByNodeId(nodeId);
358 }
359
360 public static void removeByN_T(long nodeId, java.lang.String title)
361 throws com.liferay.portal.SystemException {
362 getPersistence().removeByN_T(nodeId, title);
363 }
364
365 public static void removeByN_H(long nodeId, boolean head)
366 throws com.liferay.portal.SystemException {
367 getPersistence().removeByN_H(nodeId, head);
368 }
369
370 public static void removeByN_T_V(long nodeId, java.lang.String title,
371 double version)
372 throws com.liferay.portal.SystemException,
373 com.liferay.portlet.wiki.NoSuchPageException {
374 getPersistence().removeByN_T_V(nodeId, title, version);
375 }
376
377 public static void removeByN_T_H(long nodeId, java.lang.String title,
378 boolean head) throws com.liferay.portal.SystemException {
379 getPersistence().removeByN_T_H(nodeId, title, head);
380 }
381
382 public static void removeAll() throws com.liferay.portal.SystemException {
383 getPersistence().removeAll();
384 }
385
386 public static int countByNodeId(long nodeId)
387 throws com.liferay.portal.SystemException {
388 return getPersistence().countByNodeId(nodeId);
389 }
390
391 public static int countByN_T(long nodeId, java.lang.String title)
392 throws com.liferay.portal.SystemException {
393 return getPersistence().countByN_T(nodeId, title);
394 }
395
396 public static int countByN_H(long nodeId, boolean head)
397 throws com.liferay.portal.SystemException {
398 return getPersistence().countByN_H(nodeId, head);
399 }
400
401 public static int countByN_T_V(long nodeId, java.lang.String title,
402 double version) throws com.liferay.portal.SystemException {
403 return getPersistence().countByN_T_V(nodeId, title, version);
404 }
405
406 public static int countByN_T_H(long nodeId, java.lang.String title,
407 boolean head) throws com.liferay.portal.SystemException {
408 return getPersistence().countByN_T_H(nodeId, title, head);
409 }
410
411 public static int countAll() throws com.liferay.portal.SystemException {
412 return getPersistence().countAll();
413 }
414
415 public static WikiPagePersistence getPersistence() {
416 return _getUtil()._persistence;
417 }
418
419 public void setPersistence(WikiPagePersistence persistence) {
420 _persistence = persistence;
421 }
422
423 private static WikiPageUtil _getUtil() {
424 if (_util == null) {
425 _util = (WikiPageUtil)com.liferay.portal.kernel.bean.BeanLocatorUtil.locate(_UTIL);
426 }
427
428 return _util;
429 }
430
431 private static ModelListener _getListener() {
432 if (Validator.isNotNull(_LISTENER)) {
433 try {
434 return (ModelListener)Class.forName(_LISTENER).newInstance();
435 }
436 catch (Exception e) {
437 _log.error(e);
438 }
439 }
440
441 return null;
442 }
443
444 private static final String _UTIL = WikiPageUtil.class.getName();
445 private static final String _LISTENER = GetterUtil.getString(PropsUtil.get(
446 "value.object.listener.com.liferay.portlet.wiki.model.WikiPage"));
447 private static Log _log = LogFactory.getLog(WikiPageUtil.class);
448 private static WikiPageUtil _util;
449 private WikiPagePersistence _persistence;
450 }