001
014
015 package com.liferay.portlet.wiki.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.kernel.annotation.BeanReference;
019 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
022 import com.liferay.portal.kernel.dao.orm.FinderPath;
023 import com.liferay.portal.kernel.dao.orm.Query;
024 import com.liferay.portal.kernel.dao.orm.QueryPos;
025 import com.liferay.portal.kernel.dao.orm.QueryUtil;
026 import com.liferay.portal.kernel.dao.orm.Session;
027 import com.liferay.portal.kernel.exception.SystemException;
028 import com.liferay.portal.kernel.log.Log;
029 import com.liferay.portal.kernel.log.LogFactoryUtil;
030 import com.liferay.portal.kernel.util.GetterUtil;
031 import com.liferay.portal.kernel.util.InstanceFactory;
032 import com.liferay.portal.kernel.util.OrderByComparator;
033 import com.liferay.portal.kernel.util.StringBundler;
034 import com.liferay.portal.kernel.util.StringPool;
035 import com.liferay.portal.kernel.util.StringUtil;
036 import com.liferay.portal.kernel.util.Validator;
037 import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
038 import com.liferay.portal.model.ModelListener;
039 import com.liferay.portal.service.persistence.BatchSessionUtil;
040 import com.liferay.portal.service.persistence.CompanyPersistence;
041 import com.liferay.portal.service.persistence.GroupPersistence;
042 import com.liferay.portal.service.persistence.PortletPreferencesPersistence;
043 import com.liferay.portal.service.persistence.ResourcePersistence;
044 import com.liferay.portal.service.persistence.SubscriptionPersistence;
045 import com.liferay.portal.service.persistence.UserPersistence;
046 import com.liferay.portal.service.persistence.WorkflowInstanceLinkPersistence;
047 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
048
049 import com.liferay.portlet.asset.service.persistence.AssetCategoryPersistence;
050 import com.liferay.portlet.asset.service.persistence.AssetEntryPersistence;
051 import com.liferay.portlet.asset.service.persistence.AssetTagPersistence;
052 import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
053 import com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence;
054 import com.liferay.portlet.social.service.persistence.SocialActivityPersistence;
055 import com.liferay.portlet.social.service.persistence.SocialEquityLogPersistence;
056 import com.liferay.portlet.wiki.NoSuchPageException;
057 import com.liferay.portlet.wiki.model.WikiPage;
058 import com.liferay.portlet.wiki.model.impl.WikiPageImpl;
059 import com.liferay.portlet.wiki.model.impl.WikiPageModelImpl;
060
061 import java.io.Serializable;
062
063 import java.util.ArrayList;
064 import java.util.Collections;
065 import java.util.List;
066
067
083 public class WikiPagePersistenceImpl extends BasePersistenceImpl<WikiPage>
084 implements WikiPagePersistence {
085 public static final String FINDER_CLASS_NAME_ENTITY = WikiPageImpl.class.getName();
086 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
087 ".List";
088 public static final FinderPath FINDER_PATH_FIND_BY_UUID = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
089 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
090 "findByUuid",
091 new String[] {
092 String.class.getName(),
093
094 "java.lang.Integer", "java.lang.Integer",
095 "com.liferay.portal.kernel.util.OrderByComparator"
096 });
097 public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
098 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
099 "countByUuid", new String[] { String.class.getName() });
100 public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
101 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
102 "fetchByUUID_G",
103 new String[] { String.class.getName(), Long.class.getName() });
104 public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
105 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
106 "countByUUID_G",
107 new String[] { String.class.getName(), Long.class.getName() });
108 public static final FinderPath FINDER_PATH_FIND_BY_NODEID = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
109 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
110 "findByNodeId",
111 new String[] {
112 Long.class.getName(),
113
114 "java.lang.Integer", "java.lang.Integer",
115 "com.liferay.portal.kernel.util.OrderByComparator"
116 });
117 public static final FinderPath FINDER_PATH_COUNT_BY_NODEID = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
118 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
119 "countByNodeId", new String[] { Long.class.getName() });
120 public static final FinderPath FINDER_PATH_FIND_BY_FORMAT = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
121 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
122 "findByFormat",
123 new String[] {
124 String.class.getName(),
125
126 "java.lang.Integer", "java.lang.Integer",
127 "com.liferay.portal.kernel.util.OrderByComparator"
128 });
129 public static final FinderPath FINDER_PATH_COUNT_BY_FORMAT = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
130 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
131 "countByFormat", new String[] { String.class.getName() });
132 public static final FinderPath FINDER_PATH_FIND_BY_R_N = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
133 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
134 "findByR_N",
135 new String[] {
136 Long.class.getName(), Long.class.getName(),
137
138 "java.lang.Integer", "java.lang.Integer",
139 "com.liferay.portal.kernel.util.OrderByComparator"
140 });
141 public static final FinderPath FINDER_PATH_COUNT_BY_R_N = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
142 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
143 "countByR_N",
144 new String[] { Long.class.getName(), Long.class.getName() });
145 public static final FinderPath FINDER_PATH_FIND_BY_N_T = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
146 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
147 "findByN_T",
148 new String[] {
149 Long.class.getName(), String.class.getName(),
150
151 "java.lang.Integer", "java.lang.Integer",
152 "com.liferay.portal.kernel.util.OrderByComparator"
153 });
154 public static final FinderPath FINDER_PATH_COUNT_BY_N_T = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
155 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
156 "countByN_T",
157 new String[] { Long.class.getName(), String.class.getName() });
158 public static final FinderPath FINDER_PATH_FIND_BY_N_H = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
159 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
160 "findByN_H",
161 new String[] {
162 Long.class.getName(), Boolean.class.getName(),
163
164 "java.lang.Integer", "java.lang.Integer",
165 "com.liferay.portal.kernel.util.OrderByComparator"
166 });
167 public static final FinderPath FINDER_PATH_COUNT_BY_N_H = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
168 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
169 "countByN_H",
170 new String[] { Long.class.getName(), Boolean.class.getName() });
171 public static final FinderPath FINDER_PATH_FIND_BY_N_P = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
172 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
173 "findByN_P",
174 new String[] {
175 Long.class.getName(), String.class.getName(),
176
177 "java.lang.Integer", "java.lang.Integer",
178 "com.liferay.portal.kernel.util.OrderByComparator"
179 });
180 public static final FinderPath FINDER_PATH_COUNT_BY_N_P = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
181 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
182 "countByN_P",
183 new String[] { Long.class.getName(), String.class.getName() });
184 public static final FinderPath FINDER_PATH_FIND_BY_N_R = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
185 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
186 "findByN_R",
187 new String[] {
188 Long.class.getName(), String.class.getName(),
189
190 "java.lang.Integer", "java.lang.Integer",
191 "com.liferay.portal.kernel.util.OrderByComparator"
192 });
193 public static final FinderPath FINDER_PATH_COUNT_BY_N_R = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
194 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
195 "countByN_R",
196 new String[] { Long.class.getName(), String.class.getName() });
197 public static final FinderPath FINDER_PATH_FIND_BY_N_S = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
198 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
199 "findByN_S",
200 new String[] {
201 Long.class.getName(), Integer.class.getName(),
202
203 "java.lang.Integer", "java.lang.Integer",
204 "com.liferay.portal.kernel.util.OrderByComparator"
205 });
206 public static final FinderPath FINDER_PATH_COUNT_BY_N_S = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
207 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
208 "countByN_S",
209 new String[] { Long.class.getName(), Integer.class.getName() });
210 public static final FinderPath FINDER_PATH_FETCH_BY_R_N_V = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
211 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
212 "fetchByR_N_V",
213 new String[] {
214 Long.class.getName(), Long.class.getName(),
215 Double.class.getName()
216 });
217 public static final FinderPath FINDER_PATH_COUNT_BY_R_N_V = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
218 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
219 "countByR_N_V",
220 new String[] {
221 Long.class.getName(), Long.class.getName(),
222 Double.class.getName()
223 });
224 public static final FinderPath FINDER_PATH_FIND_BY_R_N_S = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
225 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
226 "findByR_N_S",
227 new String[] {
228 Long.class.getName(), Long.class.getName(),
229 Integer.class.getName(),
230
231 "java.lang.Integer", "java.lang.Integer",
232 "com.liferay.portal.kernel.util.OrderByComparator"
233 });
234 public static final FinderPath FINDER_PATH_COUNT_BY_R_N_S = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
235 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
236 "countByR_N_S",
237 new String[] {
238 Long.class.getName(), Long.class.getName(),
239 Integer.class.getName()
240 });
241 public static final FinderPath FINDER_PATH_FIND_BY_U_N_S = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
242 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
243 "findByU_N_S",
244 new String[] {
245 Long.class.getName(), Long.class.getName(),
246 Integer.class.getName(),
247
248 "java.lang.Integer", "java.lang.Integer",
249 "com.liferay.portal.kernel.util.OrderByComparator"
250 });
251 public static final FinderPath FINDER_PATH_COUNT_BY_U_N_S = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
252 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
253 "countByU_N_S",
254 new String[] {
255 Long.class.getName(), Long.class.getName(),
256 Integer.class.getName()
257 });
258 public static final FinderPath FINDER_PATH_FETCH_BY_N_T_V = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
259 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
260 "fetchByN_T_V",
261 new String[] {
262 Long.class.getName(), String.class.getName(),
263 Double.class.getName()
264 });
265 public static final FinderPath FINDER_PATH_COUNT_BY_N_T_V = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
266 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
267 "countByN_T_V",
268 new String[] {
269 Long.class.getName(), String.class.getName(),
270 Double.class.getName()
271 });
272 public static final FinderPath FINDER_PATH_FIND_BY_N_T_H = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
273 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
274 "findByN_T_H",
275 new String[] {
276 Long.class.getName(), String.class.getName(),
277 Boolean.class.getName(),
278
279 "java.lang.Integer", "java.lang.Integer",
280 "com.liferay.portal.kernel.util.OrderByComparator"
281 });
282 public static final FinderPath FINDER_PATH_COUNT_BY_N_T_H = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
283 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
284 "countByN_T_H",
285 new String[] {
286 Long.class.getName(), String.class.getName(),
287 Boolean.class.getName()
288 });
289 public static final FinderPath FINDER_PATH_FIND_BY_N_T_S = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
290 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
291 "findByN_T_S",
292 new String[] {
293 Long.class.getName(), String.class.getName(),
294 Integer.class.getName(),
295
296 "java.lang.Integer", "java.lang.Integer",
297 "com.liferay.portal.kernel.util.OrderByComparator"
298 });
299 public static final FinderPath FINDER_PATH_COUNT_BY_N_T_S = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
300 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
301 "countByN_T_S",
302 new String[] {
303 Long.class.getName(), String.class.getName(),
304 Integer.class.getName()
305 });
306 public static final FinderPath FINDER_PATH_FIND_BY_N_H_P = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
307 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
308 "findByN_H_P",
309 new String[] {
310 Long.class.getName(), Boolean.class.getName(),
311 String.class.getName(),
312
313 "java.lang.Integer", "java.lang.Integer",
314 "com.liferay.portal.kernel.util.OrderByComparator"
315 });
316 public static final FinderPath FINDER_PATH_COUNT_BY_N_H_P = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
317 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
318 "countByN_H_P",
319 new String[] {
320 Long.class.getName(), Boolean.class.getName(),
321 String.class.getName()
322 });
323 public static final FinderPath FINDER_PATH_FIND_BY_N_H_S = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
324 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
325 "findByN_H_S",
326 new String[] {
327 Long.class.getName(), Boolean.class.getName(),
328 Integer.class.getName(),
329
330 "java.lang.Integer", "java.lang.Integer",
331 "com.liferay.portal.kernel.util.OrderByComparator"
332 });
333 public static final FinderPath FINDER_PATH_COUNT_BY_N_H_S = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
334 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
335 "countByN_H_S",
336 new String[] {
337 Long.class.getName(), Boolean.class.getName(),
338 Integer.class.getName()
339 });
340 public static final FinderPath FINDER_PATH_FIND_BY_N_H_P_S = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
341 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
342 "findByN_H_P_S",
343 new String[] {
344 Long.class.getName(), Boolean.class.getName(),
345 String.class.getName(), Integer.class.getName(),
346
347 "java.lang.Integer", "java.lang.Integer",
348 "com.liferay.portal.kernel.util.OrderByComparator"
349 });
350 public static final FinderPath FINDER_PATH_COUNT_BY_N_H_P_S = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
351 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
352 "countByN_H_P_S",
353 new String[] {
354 Long.class.getName(), Boolean.class.getName(),
355 String.class.getName(), Integer.class.getName()
356 });
357 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
358 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
359 "findAll", new String[0]);
360 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
361 WikiPageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
362 "countAll", new String[0]);
363
364
369 public void cacheResult(WikiPage wikiPage) {
370 EntityCacheUtil.putResult(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
371 WikiPageImpl.class, wikiPage.getPrimaryKey(), wikiPage);
372
373 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
374 new Object[] { wikiPage.getUuid(), new Long(wikiPage.getGroupId()) },
375 wikiPage);
376
377 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_R_N_V,
378 new Object[] {
379 new Long(wikiPage.getResourcePrimKey()),
380 new Long(wikiPage.getNodeId()),
381 new Double(wikiPage.getVersion())
382 }, wikiPage);
383
384 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_T_V,
385 new Object[] {
386 new Long(wikiPage.getNodeId()),
387
388 wikiPage.getTitle(), new Double(wikiPage.getVersion())
389 }, wikiPage);
390 }
391
392
397 public void cacheResult(List<WikiPage> wikiPages) {
398 for (WikiPage wikiPage : wikiPages) {
399 if (EntityCacheUtil.getResult(
400 WikiPageModelImpl.ENTITY_CACHE_ENABLED,
401 WikiPageImpl.class, wikiPage.getPrimaryKey(), this) == null) {
402 cacheResult(wikiPage);
403 }
404 }
405 }
406
407
414 public void clearCache() {
415 CacheRegistryUtil.clear(WikiPageImpl.class.getName());
416 EntityCacheUtil.clearCache(WikiPageImpl.class.getName());
417 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
418 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
419 }
420
421
428 public void clearCache(WikiPage wikiPage) {
429 EntityCacheUtil.removeResult(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
430 WikiPageImpl.class, wikiPage.getPrimaryKey());
431
432 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
433 new Object[] { wikiPage.getUuid(), new Long(wikiPage.getGroupId()) });
434
435 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_R_N_V,
436 new Object[] {
437 new Long(wikiPage.getResourcePrimKey()),
438 new Long(wikiPage.getNodeId()),
439 new Double(wikiPage.getVersion())
440 });
441
442 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_N_T_V,
443 new Object[] {
444 new Long(wikiPage.getNodeId()),
445
446 wikiPage.getTitle(), new Double(wikiPage.getVersion())
447 });
448 }
449
450
456 public WikiPage create(long pageId) {
457 WikiPage wikiPage = new WikiPageImpl();
458
459 wikiPage.setNew(true);
460 wikiPage.setPrimaryKey(pageId);
461
462 String uuid = PortalUUIDUtil.generate();
463
464 wikiPage.setUuid(uuid);
465
466 return wikiPage;
467 }
468
469
477 public WikiPage remove(Serializable primaryKey)
478 throws NoSuchModelException, SystemException {
479 return remove(((Long)primaryKey).longValue());
480 }
481
482
490 public WikiPage remove(long pageId)
491 throws NoSuchPageException, SystemException {
492 Session session = null;
493
494 try {
495 session = openSession();
496
497 WikiPage wikiPage = (WikiPage)session.get(WikiPageImpl.class,
498 new Long(pageId));
499
500 if (wikiPage == null) {
501 if (_log.isWarnEnabled()) {
502 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + pageId);
503 }
504
505 throw new NoSuchPageException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
506 pageId);
507 }
508
509 return remove(wikiPage);
510 }
511 catch (NoSuchPageException nsee) {
512 throw nsee;
513 }
514 catch (Exception e) {
515 throw processException(e);
516 }
517 finally {
518 closeSession(session);
519 }
520 }
521
522 protected WikiPage removeImpl(WikiPage wikiPage) throws SystemException {
523 wikiPage = toUnwrappedModel(wikiPage);
524
525 Session session = null;
526
527 try {
528 session = openSession();
529
530 BatchSessionUtil.delete(session, wikiPage);
531 }
532 catch (Exception e) {
533 throw processException(e);
534 }
535 finally {
536 closeSession(session);
537 }
538
539 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
540
541 WikiPageModelImpl wikiPageModelImpl = (WikiPageModelImpl)wikiPage;
542
543 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
544 new Object[] {
545 wikiPageModelImpl.getUuid(),
546 new Long(wikiPageModelImpl.getGroupId())
547 });
548
549 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_R_N_V,
550 new Object[] {
551 new Long(wikiPageModelImpl.getResourcePrimKey()),
552 new Long(wikiPageModelImpl.getNodeId()),
553 new Double(wikiPageModelImpl.getVersion())
554 });
555
556 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_N_T_V,
557 new Object[] {
558 new Long(wikiPageModelImpl.getNodeId()),
559
560 wikiPageModelImpl.getTitle(),
561 new Double(wikiPageModelImpl.getVersion())
562 });
563
564 EntityCacheUtil.removeResult(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
565 WikiPageImpl.class, wikiPage.getPrimaryKey());
566
567 return wikiPage;
568 }
569
570 public WikiPage updateImpl(
571 com.liferay.portlet.wiki.model.WikiPage wikiPage, boolean merge)
572 throws SystemException {
573 wikiPage = toUnwrappedModel(wikiPage);
574
575 boolean isNew = wikiPage.isNew();
576
577 WikiPageModelImpl wikiPageModelImpl = (WikiPageModelImpl)wikiPage;
578
579 if (Validator.isNull(wikiPage.getUuid())) {
580 String uuid = PortalUUIDUtil.generate();
581
582 wikiPage.setUuid(uuid);
583 }
584
585 Session session = null;
586
587 try {
588 session = openSession();
589
590 BatchSessionUtil.update(session, wikiPage, merge);
591
592 wikiPage.setNew(false);
593 }
594 catch (Exception e) {
595 throw processException(e);
596 }
597 finally {
598 closeSession(session);
599 }
600
601 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
602
603 EntityCacheUtil.putResult(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
604 WikiPageImpl.class, wikiPage.getPrimaryKey(), wikiPage);
605
606 if (!isNew &&
607 (!Validator.equals(wikiPage.getUuid(),
608 wikiPageModelImpl.getOriginalUuid()) ||
609 (wikiPage.getGroupId() != wikiPageModelImpl.getOriginalGroupId()))) {
610 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
611 new Object[] {
612 wikiPageModelImpl.getOriginalUuid(),
613 new Long(wikiPageModelImpl.getOriginalGroupId())
614 });
615 }
616
617 if (isNew ||
618 (!Validator.equals(wikiPage.getUuid(),
619 wikiPageModelImpl.getOriginalUuid()) ||
620 (wikiPage.getGroupId() != wikiPageModelImpl.getOriginalGroupId()))) {
621 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
622 new Object[] { wikiPage.getUuid(), new Long(
623 wikiPage.getGroupId()) }, wikiPage);
624 }
625
626 if (!isNew &&
627 ((wikiPage.getResourcePrimKey() != wikiPageModelImpl.getOriginalResourcePrimKey()) ||
628 (wikiPage.getNodeId() != wikiPageModelImpl.getOriginalNodeId()) ||
629 (wikiPage.getVersion() != wikiPageModelImpl.getOriginalVersion()))) {
630 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_R_N_V,
631 new Object[] {
632 new Long(wikiPageModelImpl.getOriginalResourcePrimKey()),
633 new Long(wikiPageModelImpl.getOriginalNodeId()),
634 new Double(wikiPageModelImpl.getOriginalVersion())
635 });
636 }
637
638 if (isNew ||
639 ((wikiPage.getResourcePrimKey() != wikiPageModelImpl.getOriginalResourcePrimKey()) ||
640 (wikiPage.getNodeId() != wikiPageModelImpl.getOriginalNodeId()) ||
641 (wikiPage.getVersion() != wikiPageModelImpl.getOriginalVersion()))) {
642 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_R_N_V,
643 new Object[] {
644 new Long(wikiPage.getResourcePrimKey()),
645 new Long(wikiPage.getNodeId()),
646 new Double(wikiPage.getVersion())
647 }, wikiPage);
648 }
649
650 if (!isNew &&
651 ((wikiPage.getNodeId() != wikiPageModelImpl.getOriginalNodeId()) ||
652 !Validator.equals(wikiPage.getTitle(),
653 wikiPageModelImpl.getOriginalTitle()) ||
654 (wikiPage.getVersion() != wikiPageModelImpl.getOriginalVersion()))) {
655 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_N_T_V,
656 new Object[] {
657 new Long(wikiPageModelImpl.getOriginalNodeId()),
658
659 wikiPageModelImpl.getOriginalTitle(),
660 new Double(wikiPageModelImpl.getOriginalVersion())
661 });
662 }
663
664 if (isNew ||
665 ((wikiPage.getNodeId() != wikiPageModelImpl.getOriginalNodeId()) ||
666 !Validator.equals(wikiPage.getTitle(),
667 wikiPageModelImpl.getOriginalTitle()) ||
668 (wikiPage.getVersion() != wikiPageModelImpl.getOriginalVersion()))) {
669 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_T_V,
670 new Object[] {
671 new Long(wikiPage.getNodeId()),
672
673 wikiPage.getTitle(), new Double(wikiPage.getVersion())
674 }, wikiPage);
675 }
676
677 return wikiPage;
678 }
679
680 protected WikiPage toUnwrappedModel(WikiPage wikiPage) {
681 if (wikiPage instanceof WikiPageImpl) {
682 return wikiPage;
683 }
684
685 WikiPageImpl wikiPageImpl = new WikiPageImpl();
686
687 wikiPageImpl.setNew(wikiPage.isNew());
688 wikiPageImpl.setPrimaryKey(wikiPage.getPrimaryKey());
689
690 wikiPageImpl.setUuid(wikiPage.getUuid());
691 wikiPageImpl.setPageId(wikiPage.getPageId());
692 wikiPageImpl.setResourcePrimKey(wikiPage.getResourcePrimKey());
693 wikiPageImpl.setGroupId(wikiPage.getGroupId());
694 wikiPageImpl.setCompanyId(wikiPage.getCompanyId());
695 wikiPageImpl.setUserId(wikiPage.getUserId());
696 wikiPageImpl.setUserName(wikiPage.getUserName());
697 wikiPageImpl.setCreateDate(wikiPage.getCreateDate());
698 wikiPageImpl.setModifiedDate(wikiPage.getModifiedDate());
699 wikiPageImpl.setNodeId(wikiPage.getNodeId());
700 wikiPageImpl.setTitle(wikiPage.getTitle());
701 wikiPageImpl.setVersion(wikiPage.getVersion());
702 wikiPageImpl.setMinorEdit(wikiPage.isMinorEdit());
703 wikiPageImpl.setContent(wikiPage.getContent());
704 wikiPageImpl.setSummary(wikiPage.getSummary());
705 wikiPageImpl.setFormat(wikiPage.getFormat());
706 wikiPageImpl.setHead(wikiPage.isHead());
707 wikiPageImpl.setParentTitle(wikiPage.getParentTitle());
708 wikiPageImpl.setRedirectTitle(wikiPage.getRedirectTitle());
709 wikiPageImpl.setStatus(wikiPage.getStatus());
710 wikiPageImpl.setStatusByUserId(wikiPage.getStatusByUserId());
711 wikiPageImpl.setStatusByUserName(wikiPage.getStatusByUserName());
712 wikiPageImpl.setStatusDate(wikiPage.getStatusDate());
713
714 return wikiPageImpl;
715 }
716
717
725 public WikiPage findByPrimaryKey(Serializable primaryKey)
726 throws NoSuchModelException, SystemException {
727 return findByPrimaryKey(((Long)primaryKey).longValue());
728 }
729
730
738 public WikiPage findByPrimaryKey(long pageId)
739 throws NoSuchPageException, SystemException {
740 WikiPage wikiPage = fetchByPrimaryKey(pageId);
741
742 if (wikiPage == null) {
743 if (_log.isWarnEnabled()) {
744 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + pageId);
745 }
746
747 throw new NoSuchPageException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
748 pageId);
749 }
750
751 return wikiPage;
752 }
753
754
761 public WikiPage fetchByPrimaryKey(Serializable primaryKey)
762 throws SystemException {
763 return fetchByPrimaryKey(((Long)primaryKey).longValue());
764 }
765
766
773 public WikiPage fetchByPrimaryKey(long pageId) throws SystemException {
774 WikiPage wikiPage = (WikiPage)EntityCacheUtil.getResult(WikiPageModelImpl.ENTITY_CACHE_ENABLED,
775 WikiPageImpl.class, pageId, this);
776
777 if (wikiPage == null) {
778 Session session = null;
779
780 try {
781 session = openSession();
782
783 wikiPage = (WikiPage)session.get(WikiPageImpl.class,
784 new Long(pageId));
785 }
786 catch (Exception e) {
787 throw processException(e);
788 }
789 finally {
790 if (wikiPage != null) {
791 cacheResult(wikiPage);
792 }
793
794 closeSession(session);
795 }
796 }
797
798 return wikiPage;
799 }
800
801
808 public List<WikiPage> findByUuid(String uuid) throws SystemException {
809 return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
810 }
811
812
825 public List<WikiPage> findByUuid(String uuid, int start, int end)
826 throws SystemException {
827 return findByUuid(uuid, start, end, null);
828 }
829
830
844 public List<WikiPage> findByUuid(String uuid, int start, int end,
845 OrderByComparator orderByComparator) throws SystemException {
846 Object[] finderArgs = new Object[] {
847 uuid,
848
849 String.valueOf(start), String.valueOf(end),
850 String.valueOf(orderByComparator)
851 };
852
853 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
854 finderArgs, this);
855
856 if (list == null) {
857 StringBundler query = null;
858
859 if (orderByComparator != null) {
860 query = new StringBundler(3 +
861 (orderByComparator.getOrderByFields().length * 3));
862 }
863 else {
864 query = new StringBundler(3);
865 }
866
867 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
868
869 if (uuid == null) {
870 query.append(_FINDER_COLUMN_UUID_UUID_1);
871 }
872 else {
873 if (uuid.equals(StringPool.BLANK)) {
874 query.append(_FINDER_COLUMN_UUID_UUID_3);
875 }
876 else {
877 query.append(_FINDER_COLUMN_UUID_UUID_2);
878 }
879 }
880
881 if (orderByComparator != null) {
882 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
883 orderByComparator);
884 }
885
886 else {
887 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
888 }
889
890 String sql = query.toString();
891
892 Session session = null;
893
894 try {
895 session = openSession();
896
897 Query q = session.createQuery(sql);
898
899 QueryPos qPos = QueryPos.getInstance(q);
900
901 if (uuid != null) {
902 qPos.add(uuid);
903 }
904
905 list = (List<WikiPage>)QueryUtil.list(q, getDialect(), start,
906 end);
907 }
908 catch (Exception e) {
909 throw processException(e);
910 }
911 finally {
912 if (list == null) {
913 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_UUID,
914 finderArgs);
915 }
916 else {
917 cacheResult(list);
918
919 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID,
920 finderArgs, list);
921 }
922
923 closeSession(session);
924 }
925 }
926
927 return list;
928 }
929
930
943 public WikiPage findByUuid_First(String uuid,
944 OrderByComparator orderByComparator)
945 throws NoSuchPageException, SystemException {
946 List<WikiPage> list = findByUuid(uuid, 0, 1, orderByComparator);
947
948 if (list.isEmpty()) {
949 StringBundler msg = new StringBundler(4);
950
951 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
952
953 msg.append("uuid=");
954 msg.append(uuid);
955
956 msg.append(StringPool.CLOSE_CURLY_BRACE);
957
958 throw new NoSuchPageException(msg.toString());
959 }
960 else {
961 return list.get(0);
962 }
963 }
964
965
978 public WikiPage findByUuid_Last(String uuid,
979 OrderByComparator orderByComparator)
980 throws NoSuchPageException, SystemException {
981 int count = countByUuid(uuid);
982
983 List<WikiPage> list = findByUuid(uuid, count - 1, count,
984 orderByComparator);
985
986 if (list.isEmpty()) {
987 StringBundler msg = new StringBundler(4);
988
989 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
990
991 msg.append("uuid=");
992 msg.append(uuid);
993
994 msg.append(StringPool.CLOSE_CURLY_BRACE);
995
996 throw new NoSuchPageException(msg.toString());
997 }
998 else {
999 return list.get(0);
1000 }
1001 }
1002
1003
1017 public WikiPage[] findByUuid_PrevAndNext(long pageId, String uuid,
1018 OrderByComparator orderByComparator)
1019 throws NoSuchPageException, SystemException {
1020 WikiPage wikiPage = findByPrimaryKey(pageId);
1021
1022 Session session = null;
1023
1024 try {
1025 session = openSession();
1026
1027 WikiPage[] array = new WikiPageImpl[3];
1028
1029 array[0] = getByUuid_PrevAndNext(session, wikiPage, uuid,
1030 orderByComparator, true);
1031
1032 array[1] = wikiPage;
1033
1034 array[2] = getByUuid_PrevAndNext(session, wikiPage, uuid,
1035 orderByComparator, false);
1036
1037 return array;
1038 }
1039 catch (Exception e) {
1040 throw processException(e);
1041 }
1042 finally {
1043 closeSession(session);
1044 }
1045 }
1046
1047 protected WikiPage getByUuid_PrevAndNext(Session session,
1048 WikiPage wikiPage, String uuid, OrderByComparator orderByComparator,
1049 boolean previous) {
1050 StringBundler query = null;
1051
1052 if (orderByComparator != null) {
1053 query = new StringBundler(6 +
1054 (orderByComparator.getOrderByFields().length * 6));
1055 }
1056 else {
1057 query = new StringBundler(3);
1058 }
1059
1060 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
1061
1062 if (uuid == null) {
1063 query.append(_FINDER_COLUMN_UUID_UUID_1);
1064 }
1065 else {
1066 if (uuid.equals(StringPool.BLANK)) {
1067 query.append(_FINDER_COLUMN_UUID_UUID_3);
1068 }
1069 else {
1070 query.append(_FINDER_COLUMN_UUID_UUID_2);
1071 }
1072 }
1073
1074 if (orderByComparator != null) {
1075 String[] orderByFields = orderByComparator.getOrderByFields();
1076
1077 if (orderByFields.length > 0) {
1078 query.append(WHERE_AND);
1079 }
1080
1081 for (int i = 0; i < orderByFields.length; i++) {
1082 query.append(_ORDER_BY_ENTITY_ALIAS);
1083 query.append(orderByFields[i]);
1084
1085 if ((i + 1) < orderByFields.length) {
1086 if (orderByComparator.isAscending() ^ previous) {
1087 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1088 }
1089 else {
1090 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1091 }
1092 }
1093 else {
1094 if (orderByComparator.isAscending() ^ previous) {
1095 query.append(WHERE_GREATER_THAN);
1096 }
1097 else {
1098 query.append(WHERE_LESSER_THAN);
1099 }
1100 }
1101 }
1102
1103 query.append(ORDER_BY_CLAUSE);
1104
1105 for (int i = 0; i < orderByFields.length; i++) {
1106 query.append(_ORDER_BY_ENTITY_ALIAS);
1107 query.append(orderByFields[i]);
1108
1109 if ((i + 1) < orderByFields.length) {
1110 if (orderByComparator.isAscending() ^ previous) {
1111 query.append(ORDER_BY_ASC_HAS_NEXT);
1112 }
1113 else {
1114 query.append(ORDER_BY_DESC_HAS_NEXT);
1115 }
1116 }
1117 else {
1118 if (orderByComparator.isAscending() ^ previous) {
1119 query.append(ORDER_BY_ASC);
1120 }
1121 else {
1122 query.append(ORDER_BY_DESC);
1123 }
1124 }
1125 }
1126 }
1127
1128 else {
1129 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
1130 }
1131
1132 String sql = query.toString();
1133
1134 Query q = session.createQuery(sql);
1135
1136 q.setFirstResult(0);
1137 q.setMaxResults(2);
1138
1139 QueryPos qPos = QueryPos.getInstance(q);
1140
1141 if (uuid != null) {
1142 qPos.add(uuid);
1143 }
1144
1145 if (orderByComparator != null) {
1146 Object[] values = orderByComparator.getOrderByValues(wikiPage);
1147
1148 for (Object value : values) {
1149 qPos.add(value);
1150 }
1151 }
1152
1153 List<WikiPage> list = q.list();
1154
1155 if (list.size() == 2) {
1156 return list.get(1);
1157 }
1158 else {
1159 return null;
1160 }
1161 }
1162
1163
1172 public WikiPage findByUUID_G(String uuid, long groupId)
1173 throws NoSuchPageException, SystemException {
1174 WikiPage wikiPage = fetchByUUID_G(uuid, groupId);
1175
1176 if (wikiPage == null) {
1177 StringBundler msg = new StringBundler(6);
1178
1179 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1180
1181 msg.append("uuid=");
1182 msg.append(uuid);
1183
1184 msg.append(", groupId=");
1185 msg.append(groupId);
1186
1187 msg.append(StringPool.CLOSE_CURLY_BRACE);
1188
1189 if (_log.isWarnEnabled()) {
1190 _log.warn(msg.toString());
1191 }
1192
1193 throw new NoSuchPageException(msg.toString());
1194 }
1195
1196 return wikiPage;
1197 }
1198
1199
1207 public WikiPage fetchByUUID_G(String uuid, long groupId)
1208 throws SystemException {
1209 return fetchByUUID_G(uuid, groupId, true);
1210 }
1211
1212
1220 public WikiPage fetchByUUID_G(String uuid, long groupId,
1221 boolean retrieveFromCache) throws SystemException {
1222 Object[] finderArgs = new Object[] { uuid, groupId };
1223
1224 Object result = null;
1225
1226 if (retrieveFromCache) {
1227 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
1228 finderArgs, this);
1229 }
1230
1231 if (result == null) {
1232 StringBundler query = new StringBundler(4);
1233
1234 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
1235
1236 if (uuid == null) {
1237 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
1238 }
1239 else {
1240 if (uuid.equals(StringPool.BLANK)) {
1241 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
1242 }
1243 else {
1244 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1245 }
1246 }
1247
1248 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1249
1250 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
1251
1252 String sql = query.toString();
1253
1254 Session session = null;
1255
1256 try {
1257 session = openSession();
1258
1259 Query q = session.createQuery(sql);
1260
1261 QueryPos qPos = QueryPos.getInstance(q);
1262
1263 if (uuid != null) {
1264 qPos.add(uuid);
1265 }
1266
1267 qPos.add(groupId);
1268
1269 List<WikiPage> list = q.list();
1270
1271 result = list;
1272
1273 WikiPage wikiPage = null;
1274
1275 if (list.isEmpty()) {
1276 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1277 finderArgs, list);
1278 }
1279 else {
1280 wikiPage = list.get(0);
1281
1282 cacheResult(wikiPage);
1283
1284 if ((wikiPage.getUuid() == null) ||
1285 !wikiPage.getUuid().equals(uuid) ||
1286 (wikiPage.getGroupId() != groupId)) {
1287 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1288 finderArgs, wikiPage);
1289 }
1290 }
1291
1292 return wikiPage;
1293 }
1294 catch (Exception e) {
1295 throw processException(e);
1296 }
1297 finally {
1298 if (result == null) {
1299 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
1300 finderArgs);
1301 }
1302
1303 closeSession(session);
1304 }
1305 }
1306 else {
1307 if (result instanceof List<?>) {
1308 return null;
1309 }
1310 else {
1311 return (WikiPage)result;
1312 }
1313 }
1314 }
1315
1316
1323 public List<WikiPage> findByNodeId(long nodeId) throws SystemException {
1324 return findByNodeId(nodeId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1325 }
1326
1327
1340 public List<WikiPage> findByNodeId(long nodeId, int start, int end)
1341 throws SystemException {
1342 return findByNodeId(nodeId, start, end, null);
1343 }
1344
1345
1359 public List<WikiPage> findByNodeId(long nodeId, int start, int end,
1360 OrderByComparator orderByComparator) throws SystemException {
1361 Object[] finderArgs = new Object[] {
1362 nodeId,
1363
1364 String.valueOf(start), String.valueOf(end),
1365 String.valueOf(orderByComparator)
1366 };
1367
1368 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_NODEID,
1369 finderArgs, this);
1370
1371 if (list == null) {
1372 StringBundler query = null;
1373
1374 if (orderByComparator != null) {
1375 query = new StringBundler(3 +
1376 (orderByComparator.getOrderByFields().length * 3));
1377 }
1378 else {
1379 query = new StringBundler(3);
1380 }
1381
1382 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
1383
1384 query.append(_FINDER_COLUMN_NODEID_NODEID_2);
1385
1386 if (orderByComparator != null) {
1387 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1388 orderByComparator);
1389 }
1390
1391 else {
1392 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
1393 }
1394
1395 String sql = query.toString();
1396
1397 Session session = null;
1398
1399 try {
1400 session = openSession();
1401
1402 Query q = session.createQuery(sql);
1403
1404 QueryPos qPos = QueryPos.getInstance(q);
1405
1406 qPos.add(nodeId);
1407
1408 list = (List<WikiPage>)QueryUtil.list(q, getDialect(), start,
1409 end);
1410 }
1411 catch (Exception e) {
1412 throw processException(e);
1413 }
1414 finally {
1415 if (list == null) {
1416 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_NODEID,
1417 finderArgs);
1418 }
1419 else {
1420 cacheResult(list);
1421
1422 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_NODEID,
1423 finderArgs, list);
1424 }
1425
1426 closeSession(session);
1427 }
1428 }
1429
1430 return list;
1431 }
1432
1433
1446 public WikiPage findByNodeId_First(long nodeId,
1447 OrderByComparator orderByComparator)
1448 throws NoSuchPageException, SystemException {
1449 List<WikiPage> list = findByNodeId(nodeId, 0, 1, orderByComparator);
1450
1451 if (list.isEmpty()) {
1452 StringBundler msg = new StringBundler(4);
1453
1454 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1455
1456 msg.append("nodeId=");
1457 msg.append(nodeId);
1458
1459 msg.append(StringPool.CLOSE_CURLY_BRACE);
1460
1461 throw new NoSuchPageException(msg.toString());
1462 }
1463 else {
1464 return list.get(0);
1465 }
1466 }
1467
1468
1481 public WikiPage findByNodeId_Last(long nodeId,
1482 OrderByComparator orderByComparator)
1483 throws NoSuchPageException, SystemException {
1484 int count = countByNodeId(nodeId);
1485
1486 List<WikiPage> list = findByNodeId(nodeId, count - 1, count,
1487 orderByComparator);
1488
1489 if (list.isEmpty()) {
1490 StringBundler msg = new StringBundler(4);
1491
1492 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1493
1494 msg.append("nodeId=");
1495 msg.append(nodeId);
1496
1497 msg.append(StringPool.CLOSE_CURLY_BRACE);
1498
1499 throw new NoSuchPageException(msg.toString());
1500 }
1501 else {
1502 return list.get(0);
1503 }
1504 }
1505
1506
1520 public WikiPage[] findByNodeId_PrevAndNext(long pageId, long nodeId,
1521 OrderByComparator orderByComparator)
1522 throws NoSuchPageException, SystemException {
1523 WikiPage wikiPage = findByPrimaryKey(pageId);
1524
1525 Session session = null;
1526
1527 try {
1528 session = openSession();
1529
1530 WikiPage[] array = new WikiPageImpl[3];
1531
1532 array[0] = getByNodeId_PrevAndNext(session, wikiPage, nodeId,
1533 orderByComparator, true);
1534
1535 array[1] = wikiPage;
1536
1537 array[2] = getByNodeId_PrevAndNext(session, wikiPage, nodeId,
1538 orderByComparator, false);
1539
1540 return array;
1541 }
1542 catch (Exception e) {
1543 throw processException(e);
1544 }
1545 finally {
1546 closeSession(session);
1547 }
1548 }
1549
1550 protected WikiPage getByNodeId_PrevAndNext(Session session,
1551 WikiPage wikiPage, long nodeId, OrderByComparator orderByComparator,
1552 boolean previous) {
1553 StringBundler query = null;
1554
1555 if (orderByComparator != null) {
1556 query = new StringBundler(6 +
1557 (orderByComparator.getOrderByFields().length * 6));
1558 }
1559 else {
1560 query = new StringBundler(3);
1561 }
1562
1563 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
1564
1565 query.append(_FINDER_COLUMN_NODEID_NODEID_2);
1566
1567 if (orderByComparator != null) {
1568 String[] orderByFields = orderByComparator.getOrderByFields();
1569
1570 if (orderByFields.length > 0) {
1571 query.append(WHERE_AND);
1572 }
1573
1574 for (int i = 0; i < orderByFields.length; i++) {
1575 query.append(_ORDER_BY_ENTITY_ALIAS);
1576 query.append(orderByFields[i]);
1577
1578 if ((i + 1) < orderByFields.length) {
1579 if (orderByComparator.isAscending() ^ previous) {
1580 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1581 }
1582 else {
1583 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1584 }
1585 }
1586 else {
1587 if (orderByComparator.isAscending() ^ previous) {
1588 query.append(WHERE_GREATER_THAN);
1589 }
1590 else {
1591 query.append(WHERE_LESSER_THAN);
1592 }
1593 }
1594 }
1595
1596 query.append(ORDER_BY_CLAUSE);
1597
1598 for (int i = 0; i < orderByFields.length; i++) {
1599 query.append(_ORDER_BY_ENTITY_ALIAS);
1600 query.append(orderByFields[i]);
1601
1602 if ((i + 1) < orderByFields.length) {
1603 if (orderByComparator.isAscending() ^ previous) {
1604 query.append(ORDER_BY_ASC_HAS_NEXT);
1605 }
1606 else {
1607 query.append(ORDER_BY_DESC_HAS_NEXT);
1608 }
1609 }
1610 else {
1611 if (orderByComparator.isAscending() ^ previous) {
1612 query.append(ORDER_BY_ASC);
1613 }
1614 else {
1615 query.append(ORDER_BY_DESC);
1616 }
1617 }
1618 }
1619 }
1620
1621 else {
1622 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
1623 }
1624
1625 String sql = query.toString();
1626
1627 Query q = session.createQuery(sql);
1628
1629 q.setFirstResult(0);
1630 q.setMaxResults(2);
1631
1632 QueryPos qPos = QueryPos.getInstance(q);
1633
1634 qPos.add(nodeId);
1635
1636 if (orderByComparator != null) {
1637 Object[] values = orderByComparator.getOrderByValues(wikiPage);
1638
1639 for (Object value : values) {
1640 qPos.add(value);
1641 }
1642 }
1643
1644 List<WikiPage> list = q.list();
1645
1646 if (list.size() == 2) {
1647 return list.get(1);
1648 }
1649 else {
1650 return null;
1651 }
1652 }
1653
1654
1661 public List<WikiPage> findByFormat(String format) throws SystemException {
1662 return findByFormat(format, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1663 }
1664
1665
1678 public List<WikiPage> findByFormat(String format, int start, int end)
1679 throws SystemException {
1680 return findByFormat(format, start, end, null);
1681 }
1682
1683
1697 public List<WikiPage> findByFormat(String format, int start, int end,
1698 OrderByComparator orderByComparator) throws SystemException {
1699 Object[] finderArgs = new Object[] {
1700 format,
1701
1702 String.valueOf(start), String.valueOf(end),
1703 String.valueOf(orderByComparator)
1704 };
1705
1706 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_FORMAT,
1707 finderArgs, this);
1708
1709 if (list == null) {
1710 StringBundler query = null;
1711
1712 if (orderByComparator != null) {
1713 query = new StringBundler(3 +
1714 (orderByComparator.getOrderByFields().length * 3));
1715 }
1716 else {
1717 query = new StringBundler(3);
1718 }
1719
1720 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
1721
1722 if (format == null) {
1723 query.append(_FINDER_COLUMN_FORMAT_FORMAT_1);
1724 }
1725 else {
1726 if (format.equals(StringPool.BLANK)) {
1727 query.append(_FINDER_COLUMN_FORMAT_FORMAT_3);
1728 }
1729 else {
1730 query.append(_FINDER_COLUMN_FORMAT_FORMAT_2);
1731 }
1732 }
1733
1734 if (orderByComparator != null) {
1735 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1736 orderByComparator);
1737 }
1738
1739 else {
1740 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
1741 }
1742
1743 String sql = query.toString();
1744
1745 Session session = null;
1746
1747 try {
1748 session = openSession();
1749
1750 Query q = session.createQuery(sql);
1751
1752 QueryPos qPos = QueryPos.getInstance(q);
1753
1754 if (format != null) {
1755 qPos.add(format);
1756 }
1757
1758 list = (List<WikiPage>)QueryUtil.list(q, getDialect(), start,
1759 end);
1760 }
1761 catch (Exception e) {
1762 throw processException(e);
1763 }
1764 finally {
1765 if (list == null) {
1766 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_FORMAT,
1767 finderArgs);
1768 }
1769 else {
1770 cacheResult(list);
1771
1772 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_FORMAT,
1773 finderArgs, list);
1774 }
1775
1776 closeSession(session);
1777 }
1778 }
1779
1780 return list;
1781 }
1782
1783
1796 public WikiPage findByFormat_First(String format,
1797 OrderByComparator orderByComparator)
1798 throws NoSuchPageException, SystemException {
1799 List<WikiPage> list = findByFormat(format, 0, 1, orderByComparator);
1800
1801 if (list.isEmpty()) {
1802 StringBundler msg = new StringBundler(4);
1803
1804 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1805
1806 msg.append("format=");
1807 msg.append(format);
1808
1809 msg.append(StringPool.CLOSE_CURLY_BRACE);
1810
1811 throw new NoSuchPageException(msg.toString());
1812 }
1813 else {
1814 return list.get(0);
1815 }
1816 }
1817
1818
1831 public WikiPage findByFormat_Last(String format,
1832 OrderByComparator orderByComparator)
1833 throws NoSuchPageException, SystemException {
1834 int count = countByFormat(format);
1835
1836 List<WikiPage> list = findByFormat(format, count - 1, count,
1837 orderByComparator);
1838
1839 if (list.isEmpty()) {
1840 StringBundler msg = new StringBundler(4);
1841
1842 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1843
1844 msg.append("format=");
1845 msg.append(format);
1846
1847 msg.append(StringPool.CLOSE_CURLY_BRACE);
1848
1849 throw new NoSuchPageException(msg.toString());
1850 }
1851 else {
1852 return list.get(0);
1853 }
1854 }
1855
1856
1870 public WikiPage[] findByFormat_PrevAndNext(long pageId, String format,
1871 OrderByComparator orderByComparator)
1872 throws NoSuchPageException, SystemException {
1873 WikiPage wikiPage = findByPrimaryKey(pageId);
1874
1875 Session session = null;
1876
1877 try {
1878 session = openSession();
1879
1880 WikiPage[] array = new WikiPageImpl[3];
1881
1882 array[0] = getByFormat_PrevAndNext(session, wikiPage, format,
1883 orderByComparator, true);
1884
1885 array[1] = wikiPage;
1886
1887 array[2] = getByFormat_PrevAndNext(session, wikiPage, format,
1888 orderByComparator, false);
1889
1890 return array;
1891 }
1892 catch (Exception e) {
1893 throw processException(e);
1894 }
1895 finally {
1896 closeSession(session);
1897 }
1898 }
1899
1900 protected WikiPage getByFormat_PrevAndNext(Session session,
1901 WikiPage wikiPage, String format, OrderByComparator orderByComparator,
1902 boolean previous) {
1903 StringBundler query = null;
1904
1905 if (orderByComparator != null) {
1906 query = new StringBundler(6 +
1907 (orderByComparator.getOrderByFields().length * 6));
1908 }
1909 else {
1910 query = new StringBundler(3);
1911 }
1912
1913 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
1914
1915 if (format == null) {
1916 query.append(_FINDER_COLUMN_FORMAT_FORMAT_1);
1917 }
1918 else {
1919 if (format.equals(StringPool.BLANK)) {
1920 query.append(_FINDER_COLUMN_FORMAT_FORMAT_3);
1921 }
1922 else {
1923 query.append(_FINDER_COLUMN_FORMAT_FORMAT_2);
1924 }
1925 }
1926
1927 if (orderByComparator != null) {
1928 String[] orderByFields = orderByComparator.getOrderByFields();
1929
1930 if (orderByFields.length > 0) {
1931 query.append(WHERE_AND);
1932 }
1933
1934 for (int i = 0; i < orderByFields.length; i++) {
1935 query.append(_ORDER_BY_ENTITY_ALIAS);
1936 query.append(orderByFields[i]);
1937
1938 if ((i + 1) < orderByFields.length) {
1939 if (orderByComparator.isAscending() ^ previous) {
1940 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1941 }
1942 else {
1943 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1944 }
1945 }
1946 else {
1947 if (orderByComparator.isAscending() ^ previous) {
1948 query.append(WHERE_GREATER_THAN);
1949 }
1950 else {
1951 query.append(WHERE_LESSER_THAN);
1952 }
1953 }
1954 }
1955
1956 query.append(ORDER_BY_CLAUSE);
1957
1958 for (int i = 0; i < orderByFields.length; i++) {
1959 query.append(_ORDER_BY_ENTITY_ALIAS);
1960 query.append(orderByFields[i]);
1961
1962 if ((i + 1) < orderByFields.length) {
1963 if (orderByComparator.isAscending() ^ previous) {
1964 query.append(ORDER_BY_ASC_HAS_NEXT);
1965 }
1966 else {
1967 query.append(ORDER_BY_DESC_HAS_NEXT);
1968 }
1969 }
1970 else {
1971 if (orderByComparator.isAscending() ^ previous) {
1972 query.append(ORDER_BY_ASC);
1973 }
1974 else {
1975 query.append(ORDER_BY_DESC);
1976 }
1977 }
1978 }
1979 }
1980
1981 else {
1982 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
1983 }
1984
1985 String sql = query.toString();
1986
1987 Query q = session.createQuery(sql);
1988
1989 q.setFirstResult(0);
1990 q.setMaxResults(2);
1991
1992 QueryPos qPos = QueryPos.getInstance(q);
1993
1994 if (format != null) {
1995 qPos.add(format);
1996 }
1997
1998 if (orderByComparator != null) {
1999 Object[] values = orderByComparator.getOrderByValues(wikiPage);
2000
2001 for (Object value : values) {
2002 qPos.add(value);
2003 }
2004 }
2005
2006 List<WikiPage> list = q.list();
2007
2008 if (list.size() == 2) {
2009 return list.get(1);
2010 }
2011 else {
2012 return null;
2013 }
2014 }
2015
2016
2024 public List<WikiPage> findByR_N(long resourcePrimKey, long nodeId)
2025 throws SystemException {
2026 return findByR_N(resourcePrimKey, nodeId, QueryUtil.ALL_POS,
2027 QueryUtil.ALL_POS, null);
2028 }
2029
2030
2044 public List<WikiPage> findByR_N(long resourcePrimKey, long nodeId,
2045 int start, int end) throws SystemException {
2046 return findByR_N(resourcePrimKey, nodeId, start, end, null);
2047 }
2048
2049
2064 public List<WikiPage> findByR_N(long resourcePrimKey, long nodeId,
2065 int start, int end, OrderByComparator orderByComparator)
2066 throws SystemException {
2067 Object[] finderArgs = new Object[] {
2068 resourcePrimKey, nodeId,
2069
2070 String.valueOf(start), String.valueOf(end),
2071 String.valueOf(orderByComparator)
2072 };
2073
2074 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_R_N,
2075 finderArgs, this);
2076
2077 if (list == null) {
2078 StringBundler query = null;
2079
2080 if (orderByComparator != null) {
2081 query = new StringBundler(4 +
2082 (orderByComparator.getOrderByFields().length * 3));
2083 }
2084 else {
2085 query = new StringBundler(4);
2086 }
2087
2088 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
2089
2090 query.append(_FINDER_COLUMN_R_N_RESOURCEPRIMKEY_2);
2091
2092 query.append(_FINDER_COLUMN_R_N_NODEID_2);
2093
2094 if (orderByComparator != null) {
2095 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2096 orderByComparator);
2097 }
2098
2099 else {
2100 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
2101 }
2102
2103 String sql = query.toString();
2104
2105 Session session = null;
2106
2107 try {
2108 session = openSession();
2109
2110 Query q = session.createQuery(sql);
2111
2112 QueryPos qPos = QueryPos.getInstance(q);
2113
2114 qPos.add(resourcePrimKey);
2115
2116 qPos.add(nodeId);
2117
2118 list = (List<WikiPage>)QueryUtil.list(q, getDialect(), start,
2119 end);
2120 }
2121 catch (Exception e) {
2122 throw processException(e);
2123 }
2124 finally {
2125 if (list == null) {
2126 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_R_N,
2127 finderArgs);
2128 }
2129 else {
2130 cacheResult(list);
2131
2132 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_R_N,
2133 finderArgs, list);
2134 }
2135
2136 closeSession(session);
2137 }
2138 }
2139
2140 return list;
2141 }
2142
2143
2157 public WikiPage findByR_N_First(long resourcePrimKey, long nodeId,
2158 OrderByComparator orderByComparator)
2159 throws NoSuchPageException, SystemException {
2160 List<WikiPage> list = findByR_N(resourcePrimKey, nodeId, 0, 1,
2161 orderByComparator);
2162
2163 if (list.isEmpty()) {
2164 StringBundler msg = new StringBundler(6);
2165
2166 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2167
2168 msg.append("resourcePrimKey=");
2169 msg.append(resourcePrimKey);
2170
2171 msg.append(", nodeId=");
2172 msg.append(nodeId);
2173
2174 msg.append(StringPool.CLOSE_CURLY_BRACE);
2175
2176 throw new NoSuchPageException(msg.toString());
2177 }
2178 else {
2179 return list.get(0);
2180 }
2181 }
2182
2183
2197 public WikiPage findByR_N_Last(long resourcePrimKey, long nodeId,
2198 OrderByComparator orderByComparator)
2199 throws NoSuchPageException, SystemException {
2200 int count = countByR_N(resourcePrimKey, nodeId);
2201
2202 List<WikiPage> list = findByR_N(resourcePrimKey, nodeId, count - 1,
2203 count, orderByComparator);
2204
2205 if (list.isEmpty()) {
2206 StringBundler msg = new StringBundler(6);
2207
2208 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2209
2210 msg.append("resourcePrimKey=");
2211 msg.append(resourcePrimKey);
2212
2213 msg.append(", nodeId=");
2214 msg.append(nodeId);
2215
2216 msg.append(StringPool.CLOSE_CURLY_BRACE);
2217
2218 throw new NoSuchPageException(msg.toString());
2219 }
2220 else {
2221 return list.get(0);
2222 }
2223 }
2224
2225
2240 public WikiPage[] findByR_N_PrevAndNext(long pageId, long resourcePrimKey,
2241 long nodeId, OrderByComparator orderByComparator)
2242 throws NoSuchPageException, SystemException {
2243 WikiPage wikiPage = findByPrimaryKey(pageId);
2244
2245 Session session = null;
2246
2247 try {
2248 session = openSession();
2249
2250 WikiPage[] array = new WikiPageImpl[3];
2251
2252 array[0] = getByR_N_PrevAndNext(session, wikiPage, resourcePrimKey,
2253 nodeId, orderByComparator, true);
2254
2255 array[1] = wikiPage;
2256
2257 array[2] = getByR_N_PrevAndNext(session, wikiPage, resourcePrimKey,
2258 nodeId, orderByComparator, false);
2259
2260 return array;
2261 }
2262 catch (Exception e) {
2263 throw processException(e);
2264 }
2265 finally {
2266 closeSession(session);
2267 }
2268 }
2269
2270 protected WikiPage getByR_N_PrevAndNext(Session session, WikiPage wikiPage,
2271 long resourcePrimKey, long nodeId, OrderByComparator orderByComparator,
2272 boolean previous) {
2273 StringBundler query = null;
2274
2275 if (orderByComparator != null) {
2276 query = new StringBundler(6 +
2277 (orderByComparator.getOrderByFields().length * 6));
2278 }
2279 else {
2280 query = new StringBundler(3);
2281 }
2282
2283 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
2284
2285 query.append(_FINDER_COLUMN_R_N_RESOURCEPRIMKEY_2);
2286
2287 query.append(_FINDER_COLUMN_R_N_NODEID_2);
2288
2289 if (orderByComparator != null) {
2290 String[] orderByFields = orderByComparator.getOrderByFields();
2291
2292 if (orderByFields.length > 0) {
2293 query.append(WHERE_AND);
2294 }
2295
2296 for (int i = 0; i < orderByFields.length; i++) {
2297 query.append(_ORDER_BY_ENTITY_ALIAS);
2298 query.append(orderByFields[i]);
2299
2300 if ((i + 1) < orderByFields.length) {
2301 if (orderByComparator.isAscending() ^ previous) {
2302 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2303 }
2304 else {
2305 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2306 }
2307 }
2308 else {
2309 if (orderByComparator.isAscending() ^ previous) {
2310 query.append(WHERE_GREATER_THAN);
2311 }
2312 else {
2313 query.append(WHERE_LESSER_THAN);
2314 }
2315 }
2316 }
2317
2318 query.append(ORDER_BY_CLAUSE);
2319
2320 for (int i = 0; i < orderByFields.length; i++) {
2321 query.append(_ORDER_BY_ENTITY_ALIAS);
2322 query.append(orderByFields[i]);
2323
2324 if ((i + 1) < orderByFields.length) {
2325 if (orderByComparator.isAscending() ^ previous) {
2326 query.append(ORDER_BY_ASC_HAS_NEXT);
2327 }
2328 else {
2329 query.append(ORDER_BY_DESC_HAS_NEXT);
2330 }
2331 }
2332 else {
2333 if (orderByComparator.isAscending() ^ previous) {
2334 query.append(ORDER_BY_ASC);
2335 }
2336 else {
2337 query.append(ORDER_BY_DESC);
2338 }
2339 }
2340 }
2341 }
2342
2343 else {
2344 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
2345 }
2346
2347 String sql = query.toString();
2348
2349 Query q = session.createQuery(sql);
2350
2351 q.setFirstResult(0);
2352 q.setMaxResults(2);
2353
2354 QueryPos qPos = QueryPos.getInstance(q);
2355
2356 qPos.add(resourcePrimKey);
2357
2358 qPos.add(nodeId);
2359
2360 if (orderByComparator != null) {
2361 Object[] values = orderByComparator.getOrderByValues(wikiPage);
2362
2363 for (Object value : values) {
2364 qPos.add(value);
2365 }
2366 }
2367
2368 List<WikiPage> list = q.list();
2369
2370 if (list.size() == 2) {
2371 return list.get(1);
2372 }
2373 else {
2374 return null;
2375 }
2376 }
2377
2378
2386 public List<WikiPage> findByN_T(long nodeId, String title)
2387 throws SystemException {
2388 return findByN_T(nodeId, title, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
2389 null);
2390 }
2391
2392
2406 public List<WikiPage> findByN_T(long nodeId, String title, int start,
2407 int end) throws SystemException {
2408 return findByN_T(nodeId, title, start, end, null);
2409 }
2410
2411
2426 public List<WikiPage> findByN_T(long nodeId, String title, int start,
2427 int end, OrderByComparator orderByComparator) throws SystemException {
2428 Object[] finderArgs = new Object[] {
2429 nodeId, title,
2430
2431 String.valueOf(start), String.valueOf(end),
2432 String.valueOf(orderByComparator)
2433 };
2434
2435 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_N_T,
2436 finderArgs, this);
2437
2438 if (list == null) {
2439 StringBundler query = null;
2440
2441 if (orderByComparator != null) {
2442 query = new StringBundler(4 +
2443 (orderByComparator.getOrderByFields().length * 3));
2444 }
2445 else {
2446 query = new StringBundler(4);
2447 }
2448
2449 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
2450
2451 query.append(_FINDER_COLUMN_N_T_NODEID_2);
2452
2453 if (title == null) {
2454 query.append(_FINDER_COLUMN_N_T_TITLE_1);
2455 }
2456 else {
2457 if (title.equals(StringPool.BLANK)) {
2458 query.append(_FINDER_COLUMN_N_T_TITLE_3);
2459 }
2460 else {
2461 query.append(_FINDER_COLUMN_N_T_TITLE_2);
2462 }
2463 }
2464
2465 if (orderByComparator != null) {
2466 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2467 orderByComparator);
2468 }
2469
2470 else {
2471 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
2472 }
2473
2474 String sql = query.toString();
2475
2476 Session session = null;
2477
2478 try {
2479 session = openSession();
2480
2481 Query q = session.createQuery(sql);
2482
2483 QueryPos qPos = QueryPos.getInstance(q);
2484
2485 qPos.add(nodeId);
2486
2487 if (title != null) {
2488 qPos.add(title);
2489 }
2490
2491 list = (List<WikiPage>)QueryUtil.list(q, getDialect(), start,
2492 end);
2493 }
2494 catch (Exception e) {
2495 throw processException(e);
2496 }
2497 finally {
2498 if (list == null) {
2499 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_N_T,
2500 finderArgs);
2501 }
2502 else {
2503 cacheResult(list);
2504
2505 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_N_T,
2506 finderArgs, list);
2507 }
2508
2509 closeSession(session);
2510 }
2511 }
2512
2513 return list;
2514 }
2515
2516
2530 public WikiPage findByN_T_First(long nodeId, String title,
2531 OrderByComparator orderByComparator)
2532 throws NoSuchPageException, SystemException {
2533 List<WikiPage> list = findByN_T(nodeId, title, 0, 1, orderByComparator);
2534
2535 if (list.isEmpty()) {
2536 StringBundler msg = new StringBundler(6);
2537
2538 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2539
2540 msg.append("nodeId=");
2541 msg.append(nodeId);
2542
2543 msg.append(", title=");
2544 msg.append(title);
2545
2546 msg.append(StringPool.CLOSE_CURLY_BRACE);
2547
2548 throw new NoSuchPageException(msg.toString());
2549 }
2550 else {
2551 return list.get(0);
2552 }
2553 }
2554
2555
2569 public WikiPage findByN_T_Last(long nodeId, String title,
2570 OrderByComparator orderByComparator)
2571 throws NoSuchPageException, SystemException {
2572 int count = countByN_T(nodeId, title);
2573
2574 List<WikiPage> list = findByN_T(nodeId, title, count - 1, count,
2575 orderByComparator);
2576
2577 if (list.isEmpty()) {
2578 StringBundler msg = new StringBundler(6);
2579
2580 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2581
2582 msg.append("nodeId=");
2583 msg.append(nodeId);
2584
2585 msg.append(", title=");
2586 msg.append(title);
2587
2588 msg.append(StringPool.CLOSE_CURLY_BRACE);
2589
2590 throw new NoSuchPageException(msg.toString());
2591 }
2592 else {
2593 return list.get(0);
2594 }
2595 }
2596
2597
2612 public WikiPage[] findByN_T_PrevAndNext(long pageId, long nodeId,
2613 String title, OrderByComparator orderByComparator)
2614 throws NoSuchPageException, SystemException {
2615 WikiPage wikiPage = findByPrimaryKey(pageId);
2616
2617 Session session = null;
2618
2619 try {
2620 session = openSession();
2621
2622 WikiPage[] array = new WikiPageImpl[3];
2623
2624 array[0] = getByN_T_PrevAndNext(session, wikiPage, nodeId, title,
2625 orderByComparator, true);
2626
2627 array[1] = wikiPage;
2628
2629 array[2] = getByN_T_PrevAndNext(session, wikiPage, nodeId, title,
2630 orderByComparator, false);
2631
2632 return array;
2633 }
2634 catch (Exception e) {
2635 throw processException(e);
2636 }
2637 finally {
2638 closeSession(session);
2639 }
2640 }
2641
2642 protected WikiPage getByN_T_PrevAndNext(Session session, WikiPage wikiPage,
2643 long nodeId, String title, OrderByComparator orderByComparator,
2644 boolean previous) {
2645 StringBundler query = null;
2646
2647 if (orderByComparator != null) {
2648 query = new StringBundler(6 +
2649 (orderByComparator.getOrderByFields().length * 6));
2650 }
2651 else {
2652 query = new StringBundler(3);
2653 }
2654
2655 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
2656
2657 query.append(_FINDER_COLUMN_N_T_NODEID_2);
2658
2659 if (title == null) {
2660 query.append(_FINDER_COLUMN_N_T_TITLE_1);
2661 }
2662 else {
2663 if (title.equals(StringPool.BLANK)) {
2664 query.append(_FINDER_COLUMN_N_T_TITLE_3);
2665 }
2666 else {
2667 query.append(_FINDER_COLUMN_N_T_TITLE_2);
2668 }
2669 }
2670
2671 if (orderByComparator != null) {
2672 String[] orderByFields = orderByComparator.getOrderByFields();
2673
2674 if (orderByFields.length > 0) {
2675 query.append(WHERE_AND);
2676 }
2677
2678 for (int i = 0; i < orderByFields.length; i++) {
2679 query.append(_ORDER_BY_ENTITY_ALIAS);
2680 query.append(orderByFields[i]);
2681
2682 if ((i + 1) < orderByFields.length) {
2683 if (orderByComparator.isAscending() ^ previous) {
2684 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2685 }
2686 else {
2687 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2688 }
2689 }
2690 else {
2691 if (orderByComparator.isAscending() ^ previous) {
2692 query.append(WHERE_GREATER_THAN);
2693 }
2694 else {
2695 query.append(WHERE_LESSER_THAN);
2696 }
2697 }
2698 }
2699
2700 query.append(ORDER_BY_CLAUSE);
2701
2702 for (int i = 0; i < orderByFields.length; i++) {
2703 query.append(_ORDER_BY_ENTITY_ALIAS);
2704 query.append(orderByFields[i]);
2705
2706 if ((i + 1) < orderByFields.length) {
2707 if (orderByComparator.isAscending() ^ previous) {
2708 query.append(ORDER_BY_ASC_HAS_NEXT);
2709 }
2710 else {
2711 query.append(ORDER_BY_DESC_HAS_NEXT);
2712 }
2713 }
2714 else {
2715 if (orderByComparator.isAscending() ^ previous) {
2716 query.append(ORDER_BY_ASC);
2717 }
2718 else {
2719 query.append(ORDER_BY_DESC);
2720 }
2721 }
2722 }
2723 }
2724
2725 else {
2726 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
2727 }
2728
2729 String sql = query.toString();
2730
2731 Query q = session.createQuery(sql);
2732
2733 q.setFirstResult(0);
2734 q.setMaxResults(2);
2735
2736 QueryPos qPos = QueryPos.getInstance(q);
2737
2738 qPos.add(nodeId);
2739
2740 if (title != null) {
2741 qPos.add(title);
2742 }
2743
2744 if (orderByComparator != null) {
2745 Object[] values = orderByComparator.getOrderByValues(wikiPage);
2746
2747 for (Object value : values) {
2748 qPos.add(value);
2749 }
2750 }
2751
2752 List<WikiPage> list = q.list();
2753
2754 if (list.size() == 2) {
2755 return list.get(1);
2756 }
2757 else {
2758 return null;
2759 }
2760 }
2761
2762
2770 public List<WikiPage> findByN_H(long nodeId, boolean head)
2771 throws SystemException {
2772 return findByN_H(nodeId, head, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
2773 null);
2774 }
2775
2776
2790 public List<WikiPage> findByN_H(long nodeId, boolean head, int start,
2791 int end) throws SystemException {
2792 return findByN_H(nodeId, head, start, end, null);
2793 }
2794
2795
2810 public List<WikiPage> findByN_H(long nodeId, boolean head, int start,
2811 int end, OrderByComparator orderByComparator) throws SystemException {
2812 Object[] finderArgs = new Object[] {
2813 nodeId, head,
2814
2815 String.valueOf(start), String.valueOf(end),
2816 String.valueOf(orderByComparator)
2817 };
2818
2819 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_N_H,
2820 finderArgs, this);
2821
2822 if (list == null) {
2823 StringBundler query = null;
2824
2825 if (orderByComparator != null) {
2826 query = new StringBundler(4 +
2827 (orderByComparator.getOrderByFields().length * 3));
2828 }
2829 else {
2830 query = new StringBundler(4);
2831 }
2832
2833 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
2834
2835 query.append(_FINDER_COLUMN_N_H_NODEID_2);
2836
2837 query.append(_FINDER_COLUMN_N_H_HEAD_2);
2838
2839 if (orderByComparator != null) {
2840 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2841 orderByComparator);
2842 }
2843
2844 else {
2845 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
2846 }
2847
2848 String sql = query.toString();
2849
2850 Session session = null;
2851
2852 try {
2853 session = openSession();
2854
2855 Query q = session.createQuery(sql);
2856
2857 QueryPos qPos = QueryPos.getInstance(q);
2858
2859 qPos.add(nodeId);
2860
2861 qPos.add(head);
2862
2863 list = (List<WikiPage>)QueryUtil.list(q, getDialect(), start,
2864 end);
2865 }
2866 catch (Exception e) {
2867 throw processException(e);
2868 }
2869 finally {
2870 if (list == null) {
2871 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_N_H,
2872 finderArgs);
2873 }
2874 else {
2875 cacheResult(list);
2876
2877 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_N_H,
2878 finderArgs, list);
2879 }
2880
2881 closeSession(session);
2882 }
2883 }
2884
2885 return list;
2886 }
2887
2888
2902 public WikiPage findByN_H_First(long nodeId, boolean head,
2903 OrderByComparator orderByComparator)
2904 throws NoSuchPageException, SystemException {
2905 List<WikiPage> list = findByN_H(nodeId, head, 0, 1, orderByComparator);
2906
2907 if (list.isEmpty()) {
2908 StringBundler msg = new StringBundler(6);
2909
2910 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2911
2912 msg.append("nodeId=");
2913 msg.append(nodeId);
2914
2915 msg.append(", head=");
2916 msg.append(head);
2917
2918 msg.append(StringPool.CLOSE_CURLY_BRACE);
2919
2920 throw new NoSuchPageException(msg.toString());
2921 }
2922 else {
2923 return list.get(0);
2924 }
2925 }
2926
2927
2941 public WikiPage findByN_H_Last(long nodeId, boolean head,
2942 OrderByComparator orderByComparator)
2943 throws NoSuchPageException, SystemException {
2944 int count = countByN_H(nodeId, head);
2945
2946 List<WikiPage> list = findByN_H(nodeId, head, count - 1, count,
2947 orderByComparator);
2948
2949 if (list.isEmpty()) {
2950 StringBundler msg = new StringBundler(6);
2951
2952 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2953
2954 msg.append("nodeId=");
2955 msg.append(nodeId);
2956
2957 msg.append(", head=");
2958 msg.append(head);
2959
2960 msg.append(StringPool.CLOSE_CURLY_BRACE);
2961
2962 throw new NoSuchPageException(msg.toString());
2963 }
2964 else {
2965 return list.get(0);
2966 }
2967 }
2968
2969
2984 public WikiPage[] findByN_H_PrevAndNext(long pageId, long nodeId,
2985 boolean head, OrderByComparator orderByComparator)
2986 throws NoSuchPageException, SystemException {
2987 WikiPage wikiPage = findByPrimaryKey(pageId);
2988
2989 Session session = null;
2990
2991 try {
2992 session = openSession();
2993
2994 WikiPage[] array = new WikiPageImpl[3];
2995
2996 array[0] = getByN_H_PrevAndNext(session, wikiPage, nodeId, head,
2997 orderByComparator, true);
2998
2999 array[1] = wikiPage;
3000
3001 array[2] = getByN_H_PrevAndNext(session, wikiPage, nodeId, head,
3002 orderByComparator, false);
3003
3004 return array;
3005 }
3006 catch (Exception e) {
3007 throw processException(e);
3008 }
3009 finally {
3010 closeSession(session);
3011 }
3012 }
3013
3014 protected WikiPage getByN_H_PrevAndNext(Session session, WikiPage wikiPage,
3015 long nodeId, boolean head, OrderByComparator orderByComparator,
3016 boolean previous) {
3017 StringBundler query = null;
3018
3019 if (orderByComparator != null) {
3020 query = new StringBundler(6 +
3021 (orderByComparator.getOrderByFields().length * 6));
3022 }
3023 else {
3024 query = new StringBundler(3);
3025 }
3026
3027 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
3028
3029 query.append(_FINDER_COLUMN_N_H_NODEID_2);
3030
3031 query.append(_FINDER_COLUMN_N_H_HEAD_2);
3032
3033 if (orderByComparator != null) {
3034 String[] orderByFields = orderByComparator.getOrderByFields();
3035
3036 if (orderByFields.length > 0) {
3037 query.append(WHERE_AND);
3038 }
3039
3040 for (int i = 0; i < orderByFields.length; i++) {
3041 query.append(_ORDER_BY_ENTITY_ALIAS);
3042 query.append(orderByFields[i]);
3043
3044 if ((i + 1) < orderByFields.length) {
3045 if (orderByComparator.isAscending() ^ previous) {
3046 query.append(WHERE_GREATER_THAN_HAS_NEXT);
3047 }
3048 else {
3049 query.append(WHERE_LESSER_THAN_HAS_NEXT);
3050 }
3051 }
3052 else {
3053 if (orderByComparator.isAscending() ^ previous) {
3054 query.append(WHERE_GREATER_THAN);
3055 }
3056 else {
3057 query.append(WHERE_LESSER_THAN);
3058 }
3059 }
3060 }
3061
3062 query.append(ORDER_BY_CLAUSE);
3063
3064 for (int i = 0; i < orderByFields.length; i++) {
3065 query.append(_ORDER_BY_ENTITY_ALIAS);
3066 query.append(orderByFields[i]);
3067
3068 if ((i + 1) < orderByFields.length) {
3069 if (orderByComparator.isAscending() ^ previous) {
3070 query.append(ORDER_BY_ASC_HAS_NEXT);
3071 }
3072 else {
3073 query.append(ORDER_BY_DESC_HAS_NEXT);
3074 }
3075 }
3076 else {
3077 if (orderByComparator.isAscending() ^ previous) {
3078 query.append(ORDER_BY_ASC);
3079 }
3080 else {
3081 query.append(ORDER_BY_DESC);
3082 }
3083 }
3084 }
3085 }
3086
3087 else {
3088 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
3089 }
3090
3091 String sql = query.toString();
3092
3093 Query q = session.createQuery(sql);
3094
3095 q.setFirstResult(0);
3096 q.setMaxResults(2);
3097
3098 QueryPos qPos = QueryPos.getInstance(q);
3099
3100 qPos.add(nodeId);
3101
3102 qPos.add(head);
3103
3104 if (orderByComparator != null) {
3105 Object[] values = orderByComparator.getOrderByValues(wikiPage);
3106
3107 for (Object value : values) {
3108 qPos.add(value);
3109 }
3110 }
3111
3112 List<WikiPage> list = q.list();
3113
3114 if (list.size() == 2) {
3115 return list.get(1);
3116 }
3117 else {
3118 return null;
3119 }
3120 }
3121
3122
3130 public List<WikiPage> findByN_P(long nodeId, String parentTitle)
3131 throws SystemException {
3132 return findByN_P(nodeId, parentTitle, QueryUtil.ALL_POS,
3133 QueryUtil.ALL_POS, null);
3134 }
3135
3136
3150 public List<WikiPage> findByN_P(long nodeId, String parentTitle, int start,
3151 int end) throws SystemException {
3152 return findByN_P(nodeId, parentTitle, start, end, null);
3153 }
3154
3155
3170 public List<WikiPage> findByN_P(long nodeId, String parentTitle, int start,
3171 int end, OrderByComparator orderByComparator) throws SystemException {
3172 Object[] finderArgs = new Object[] {
3173 nodeId, parentTitle,
3174
3175 String.valueOf(start), String.valueOf(end),
3176 String.valueOf(orderByComparator)
3177 };
3178
3179 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_N_P,
3180 finderArgs, this);
3181
3182 if (list == null) {
3183 StringBundler query = null;
3184
3185 if (orderByComparator != null) {
3186 query = new StringBundler(4 +
3187 (orderByComparator.getOrderByFields().length * 3));
3188 }
3189 else {
3190 query = new StringBundler(4);
3191 }
3192
3193 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
3194
3195 query.append(_FINDER_COLUMN_N_P_NODEID_2);
3196
3197 if (parentTitle == null) {
3198 query.append(_FINDER_COLUMN_N_P_PARENTTITLE_1);
3199 }
3200 else {
3201 if (parentTitle.equals(StringPool.BLANK)) {
3202 query.append(_FINDER_COLUMN_N_P_PARENTTITLE_3);
3203 }
3204 else {
3205 query.append(_FINDER_COLUMN_N_P_PARENTTITLE_2);
3206 }
3207 }
3208
3209 if (orderByComparator != null) {
3210 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3211 orderByComparator);
3212 }
3213
3214 else {
3215 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
3216 }
3217
3218 String sql = query.toString();
3219
3220 Session session = null;
3221
3222 try {
3223 session = openSession();
3224
3225 Query q = session.createQuery(sql);
3226
3227 QueryPos qPos = QueryPos.getInstance(q);
3228
3229 qPos.add(nodeId);
3230
3231 if (parentTitle != null) {
3232 qPos.add(parentTitle);
3233 }
3234
3235 list = (List<WikiPage>)QueryUtil.list(q, getDialect(), start,
3236 end);
3237 }
3238 catch (Exception e) {
3239 throw processException(e);
3240 }
3241 finally {
3242 if (list == null) {
3243 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_N_P,
3244 finderArgs);
3245 }
3246 else {
3247 cacheResult(list);
3248
3249 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_N_P,
3250 finderArgs, list);
3251 }
3252
3253 closeSession(session);
3254 }
3255 }
3256
3257 return list;
3258 }
3259
3260
3274 public WikiPage findByN_P_First(long nodeId, String parentTitle,
3275 OrderByComparator orderByComparator)
3276 throws NoSuchPageException, SystemException {
3277 List<WikiPage> list = findByN_P(nodeId, parentTitle, 0, 1,
3278 orderByComparator);
3279
3280 if (list.isEmpty()) {
3281 StringBundler msg = new StringBundler(6);
3282
3283 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3284
3285 msg.append("nodeId=");
3286 msg.append(nodeId);
3287
3288 msg.append(", parentTitle=");
3289 msg.append(parentTitle);
3290
3291 msg.append(StringPool.CLOSE_CURLY_BRACE);
3292
3293 throw new NoSuchPageException(msg.toString());
3294 }
3295 else {
3296 return list.get(0);
3297 }
3298 }
3299
3300
3314 public WikiPage findByN_P_Last(long nodeId, String parentTitle,
3315 OrderByComparator orderByComparator)
3316 throws NoSuchPageException, SystemException {
3317 int count = countByN_P(nodeId, parentTitle);
3318
3319 List<WikiPage> list = findByN_P(nodeId, parentTitle, count - 1, count,
3320 orderByComparator);
3321
3322 if (list.isEmpty()) {
3323 StringBundler msg = new StringBundler(6);
3324
3325 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3326
3327 msg.append("nodeId=");
3328 msg.append(nodeId);
3329
3330 msg.append(", parentTitle=");
3331 msg.append(parentTitle);
3332
3333 msg.append(StringPool.CLOSE_CURLY_BRACE);
3334
3335 throw new NoSuchPageException(msg.toString());
3336 }
3337 else {
3338 return list.get(0);
3339 }
3340 }
3341
3342
3357 public WikiPage[] findByN_P_PrevAndNext(long pageId, long nodeId,
3358 String parentTitle, OrderByComparator orderByComparator)
3359 throws NoSuchPageException, SystemException {
3360 WikiPage wikiPage = findByPrimaryKey(pageId);
3361
3362 Session session = null;
3363
3364 try {
3365 session = openSession();
3366
3367 WikiPage[] array = new WikiPageImpl[3];
3368
3369 array[0] = getByN_P_PrevAndNext(session, wikiPage, nodeId,
3370 parentTitle, orderByComparator, true);
3371
3372 array[1] = wikiPage;
3373
3374 array[2] = getByN_P_PrevAndNext(session, wikiPage, nodeId,
3375 parentTitle, orderByComparator, false);
3376
3377 return array;
3378 }
3379 catch (Exception e) {
3380 throw processException(e);
3381 }
3382 finally {
3383 closeSession(session);
3384 }
3385 }
3386
3387 protected WikiPage getByN_P_PrevAndNext(Session session, WikiPage wikiPage,
3388 long nodeId, String parentTitle, OrderByComparator orderByComparator,
3389 boolean previous) {
3390 StringBundler query = null;
3391
3392 if (orderByComparator != null) {
3393 query = new StringBundler(6 +
3394 (orderByComparator.getOrderByFields().length * 6));
3395 }
3396 else {
3397 query = new StringBundler(3);
3398 }
3399
3400 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
3401
3402 query.append(_FINDER_COLUMN_N_P_NODEID_2);
3403
3404 if (parentTitle == null) {
3405 query.append(_FINDER_COLUMN_N_P_PARENTTITLE_1);
3406 }
3407 else {
3408 if (parentTitle.equals(StringPool.BLANK)) {
3409 query.append(_FINDER_COLUMN_N_P_PARENTTITLE_3);
3410 }
3411 else {
3412 query.append(_FINDER_COLUMN_N_P_PARENTTITLE_2);
3413 }
3414 }
3415
3416 if (orderByComparator != null) {
3417 String[] orderByFields = orderByComparator.getOrderByFields();
3418
3419 if (orderByFields.length > 0) {
3420 query.append(WHERE_AND);
3421 }
3422
3423 for (int i = 0; i < orderByFields.length; i++) {
3424 query.append(_ORDER_BY_ENTITY_ALIAS);
3425 query.append(orderByFields[i]);
3426
3427 if ((i + 1) < orderByFields.length) {
3428 if (orderByComparator.isAscending() ^ previous) {
3429 query.append(WHERE_GREATER_THAN_HAS_NEXT);
3430 }
3431 else {
3432 query.append(WHERE_LESSER_THAN_HAS_NEXT);
3433 }
3434 }
3435 else {
3436 if (orderByComparator.isAscending() ^ previous) {
3437 query.append(WHERE_GREATER_THAN);
3438 }
3439 else {
3440 query.append(WHERE_LESSER_THAN);
3441 }
3442 }
3443 }
3444
3445 query.append(ORDER_BY_CLAUSE);
3446
3447 for (int i = 0; i < orderByFields.length; i++) {
3448 query.append(_ORDER_BY_ENTITY_ALIAS);
3449 query.append(orderByFields[i]);
3450
3451 if ((i + 1) < orderByFields.length) {
3452 if (orderByComparator.isAscending() ^ previous) {
3453 query.append(ORDER_BY_ASC_HAS_NEXT);
3454 }
3455 else {
3456 query.append(ORDER_BY_DESC_HAS_NEXT);
3457 }
3458 }
3459 else {
3460 if (orderByComparator.isAscending() ^ previous) {
3461 query.append(ORDER_BY_ASC);
3462 }
3463 else {
3464 query.append(ORDER_BY_DESC);
3465 }
3466 }
3467 }
3468 }
3469
3470 else {
3471 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
3472 }
3473
3474 String sql = query.toString();
3475
3476 Query q = session.createQuery(sql);
3477
3478 q.setFirstResult(0);
3479 q.setMaxResults(2);
3480
3481 QueryPos qPos = QueryPos.getInstance(q);
3482
3483 qPos.add(nodeId);
3484
3485 if (parentTitle != null) {
3486 qPos.add(parentTitle);
3487 }
3488
3489 if (orderByComparator != null) {
3490 Object[] values = orderByComparator.getOrderByValues(wikiPage);
3491
3492 for (Object value : values) {
3493 qPos.add(value);
3494 }
3495 }
3496
3497 List<WikiPage> list = q.list();
3498
3499 if (list.size() == 2) {
3500 return list.get(1);
3501 }
3502 else {
3503 return null;
3504 }
3505 }
3506
3507
3515 public List<WikiPage> findByN_R(long nodeId, String redirectTitle)
3516 throws SystemException {
3517 return findByN_R(nodeId, redirectTitle, QueryUtil.ALL_POS,
3518 QueryUtil.ALL_POS, null);
3519 }
3520
3521
3535 public List<WikiPage> findByN_R(long nodeId, String redirectTitle,
3536 int start, int end) throws SystemException {
3537 return findByN_R(nodeId, redirectTitle, start, end, null);
3538 }
3539
3540
3555 public List<WikiPage> findByN_R(long nodeId, String redirectTitle,
3556 int start, int end, OrderByComparator orderByComparator)
3557 throws SystemException {
3558 Object[] finderArgs = new Object[] {
3559 nodeId, redirectTitle,
3560
3561 String.valueOf(start), String.valueOf(end),
3562 String.valueOf(orderByComparator)
3563 };
3564
3565 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_N_R,
3566 finderArgs, this);
3567
3568 if (list == null) {
3569 StringBundler query = null;
3570
3571 if (orderByComparator != null) {
3572 query = new StringBundler(4 +
3573 (orderByComparator.getOrderByFields().length * 3));
3574 }
3575 else {
3576 query = new StringBundler(4);
3577 }
3578
3579 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
3580
3581 query.append(_FINDER_COLUMN_N_R_NODEID_2);
3582
3583 if (redirectTitle == null) {
3584 query.append(_FINDER_COLUMN_N_R_REDIRECTTITLE_1);
3585 }
3586 else {
3587 if (redirectTitle.equals(StringPool.BLANK)) {
3588 query.append(_FINDER_COLUMN_N_R_REDIRECTTITLE_3);
3589 }
3590 else {
3591 query.append(_FINDER_COLUMN_N_R_REDIRECTTITLE_2);
3592 }
3593 }
3594
3595 if (orderByComparator != null) {
3596 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3597 orderByComparator);
3598 }
3599
3600 else {
3601 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
3602 }
3603
3604 String sql = query.toString();
3605
3606 Session session = null;
3607
3608 try {
3609 session = openSession();
3610
3611 Query q = session.createQuery(sql);
3612
3613 QueryPos qPos = QueryPos.getInstance(q);
3614
3615 qPos.add(nodeId);
3616
3617 if (redirectTitle != null) {
3618 qPos.add(redirectTitle);
3619 }
3620
3621 list = (List<WikiPage>)QueryUtil.list(q, getDialect(), start,
3622 end);
3623 }
3624 catch (Exception e) {
3625 throw processException(e);
3626 }
3627 finally {
3628 if (list == null) {
3629 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_N_R,
3630 finderArgs);
3631 }
3632 else {
3633 cacheResult(list);
3634
3635 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_N_R,
3636 finderArgs, list);
3637 }
3638
3639 closeSession(session);
3640 }
3641 }
3642
3643 return list;
3644 }
3645
3646
3660 public WikiPage findByN_R_First(long nodeId, String redirectTitle,
3661 OrderByComparator orderByComparator)
3662 throws NoSuchPageException, SystemException {
3663 List<WikiPage> list = findByN_R(nodeId, redirectTitle, 0, 1,
3664 orderByComparator);
3665
3666 if (list.isEmpty()) {
3667 StringBundler msg = new StringBundler(6);
3668
3669 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3670
3671 msg.append("nodeId=");
3672 msg.append(nodeId);
3673
3674 msg.append(", redirectTitle=");
3675 msg.append(redirectTitle);
3676
3677 msg.append(StringPool.CLOSE_CURLY_BRACE);
3678
3679 throw new NoSuchPageException(msg.toString());
3680 }
3681 else {
3682 return list.get(0);
3683 }
3684 }
3685
3686
3700 public WikiPage findByN_R_Last(long nodeId, String redirectTitle,
3701 OrderByComparator orderByComparator)
3702 throws NoSuchPageException, SystemException {
3703 int count = countByN_R(nodeId, redirectTitle);
3704
3705 List<WikiPage> list = findByN_R(nodeId, redirectTitle, count - 1,
3706 count, orderByComparator);
3707
3708 if (list.isEmpty()) {
3709 StringBundler msg = new StringBundler(6);
3710
3711 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3712
3713 msg.append("nodeId=");
3714 msg.append(nodeId);
3715
3716 msg.append(", redirectTitle=");
3717 msg.append(redirectTitle);
3718
3719 msg.append(StringPool.CLOSE_CURLY_BRACE);
3720
3721 throw new NoSuchPageException(msg.toString());
3722 }
3723 else {
3724 return list.get(0);
3725 }
3726 }
3727
3728
3743 public WikiPage[] findByN_R_PrevAndNext(long pageId, long nodeId,
3744 String redirectTitle, OrderByComparator orderByComparator)
3745 throws NoSuchPageException, SystemException {
3746 WikiPage wikiPage = findByPrimaryKey(pageId);
3747
3748 Session session = null;
3749
3750 try {
3751 session = openSession();
3752
3753 WikiPage[] array = new WikiPageImpl[3];
3754
3755 array[0] = getByN_R_PrevAndNext(session, wikiPage, nodeId,
3756 redirectTitle, orderByComparator, true);
3757
3758 array[1] = wikiPage;
3759
3760 array[2] = getByN_R_PrevAndNext(session, wikiPage, nodeId,
3761 redirectTitle, orderByComparator, false);
3762
3763 return array;
3764 }
3765 catch (Exception e) {
3766 throw processException(e);
3767 }
3768 finally {
3769 closeSession(session);
3770 }
3771 }
3772
3773 protected WikiPage getByN_R_PrevAndNext(Session session, WikiPage wikiPage,
3774 long nodeId, String redirectTitle, OrderByComparator orderByComparator,
3775 boolean previous) {
3776 StringBundler query = null;
3777
3778 if (orderByComparator != null) {
3779 query = new StringBundler(6 +
3780 (orderByComparator.getOrderByFields().length * 6));
3781 }
3782 else {
3783 query = new StringBundler(3);
3784 }
3785
3786 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
3787
3788 query.append(_FINDER_COLUMN_N_R_NODEID_2);
3789
3790 if (redirectTitle == null) {
3791 query.append(_FINDER_COLUMN_N_R_REDIRECTTITLE_1);
3792 }
3793 else {
3794 if (redirectTitle.equals(StringPool.BLANK)) {
3795 query.append(_FINDER_COLUMN_N_R_REDIRECTTITLE_3);
3796 }
3797 else {
3798 query.append(_FINDER_COLUMN_N_R_REDIRECTTITLE_2);
3799 }
3800 }
3801
3802 if (orderByComparator != null) {
3803 String[] orderByFields = orderByComparator.getOrderByFields();
3804
3805 if (orderByFields.length > 0) {
3806 query.append(WHERE_AND);
3807 }
3808
3809 for (int i = 0; i < orderByFields.length; i++) {
3810 query.append(_ORDER_BY_ENTITY_ALIAS);
3811 query.append(orderByFields[i]);
3812
3813 if ((i + 1) < orderByFields.length) {
3814 if (orderByComparator.isAscending() ^ previous) {
3815 query.append(WHERE_GREATER_THAN_HAS_NEXT);
3816 }
3817 else {
3818 query.append(WHERE_LESSER_THAN_HAS_NEXT);
3819 }
3820 }
3821 else {
3822 if (orderByComparator.isAscending() ^ previous) {
3823 query.append(WHERE_GREATER_THAN);
3824 }
3825 else {
3826 query.append(WHERE_LESSER_THAN);
3827 }
3828 }
3829 }
3830
3831 query.append(ORDER_BY_CLAUSE);
3832
3833 for (int i = 0; i < orderByFields.length; i++) {
3834 query.append(_ORDER_BY_ENTITY_ALIAS);
3835 query.append(orderByFields[i]);
3836
3837 if ((i + 1) < orderByFields.length) {
3838 if (orderByComparator.isAscending() ^ previous) {
3839 query.append(ORDER_BY_ASC_HAS_NEXT);
3840 }
3841 else {
3842 query.append(ORDER_BY_DESC_HAS_NEXT);
3843 }
3844 }
3845 else {
3846 if (orderByComparator.isAscending() ^ previous) {
3847 query.append(ORDER_BY_ASC);
3848 }
3849 else {
3850 query.append(ORDER_BY_DESC);
3851 }
3852 }
3853 }
3854 }
3855
3856 else {
3857 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
3858 }
3859
3860 String sql = query.toString();
3861
3862 Query q = session.createQuery(sql);
3863
3864 q.setFirstResult(0);
3865 q.setMaxResults(2);
3866
3867 QueryPos qPos = QueryPos.getInstance(q);
3868
3869 qPos.add(nodeId);
3870
3871 if (redirectTitle != null) {
3872 qPos.add(redirectTitle);
3873 }
3874
3875 if (orderByComparator != null) {
3876 Object[] values = orderByComparator.getOrderByValues(wikiPage);
3877
3878 for (Object value : values) {
3879 qPos.add(value);
3880 }
3881 }
3882
3883 List<WikiPage> list = q.list();
3884
3885 if (list.size() == 2) {
3886 return list.get(1);
3887 }
3888 else {
3889 return null;
3890 }
3891 }
3892
3893
3901 public List<WikiPage> findByN_S(long nodeId, int status)
3902 throws SystemException {
3903 return findByN_S(nodeId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
3904 null);
3905 }
3906
3907
3921 public List<WikiPage> findByN_S(long nodeId, int status, int start, int end)
3922 throws SystemException {
3923 return findByN_S(nodeId, status, start, end, null);
3924 }
3925
3926
3941 public List<WikiPage> findByN_S(long nodeId, int status, int start,
3942 int end, OrderByComparator orderByComparator) throws SystemException {
3943 Object[] finderArgs = new Object[] {
3944 nodeId, status,
3945
3946 String.valueOf(start), String.valueOf(end),
3947 String.valueOf(orderByComparator)
3948 };
3949
3950 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_N_S,
3951 finderArgs, this);
3952
3953 if (list == null) {
3954 StringBundler query = null;
3955
3956 if (orderByComparator != null) {
3957 query = new StringBundler(4 +
3958 (orderByComparator.getOrderByFields().length * 3));
3959 }
3960 else {
3961 query = new StringBundler(4);
3962 }
3963
3964 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
3965
3966 query.append(_FINDER_COLUMN_N_S_NODEID_2);
3967
3968 query.append(_FINDER_COLUMN_N_S_STATUS_2);
3969
3970 if (orderByComparator != null) {
3971 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3972 orderByComparator);
3973 }
3974
3975 else {
3976 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
3977 }
3978
3979 String sql = query.toString();
3980
3981 Session session = null;
3982
3983 try {
3984 session = openSession();
3985
3986 Query q = session.createQuery(sql);
3987
3988 QueryPos qPos = QueryPos.getInstance(q);
3989
3990 qPos.add(nodeId);
3991
3992 qPos.add(status);
3993
3994 list = (List<WikiPage>)QueryUtil.list(q, getDialect(), start,
3995 end);
3996 }
3997 catch (Exception e) {
3998 throw processException(e);
3999 }
4000 finally {
4001 if (list == null) {
4002 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_N_S,
4003 finderArgs);
4004 }
4005 else {
4006 cacheResult(list);
4007
4008 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_N_S,
4009 finderArgs, list);
4010 }
4011
4012 closeSession(session);
4013 }
4014 }
4015
4016 return list;
4017 }
4018
4019
4033 public WikiPage findByN_S_First(long nodeId, int status,
4034 OrderByComparator orderByComparator)
4035 throws NoSuchPageException, SystemException {
4036 List<WikiPage> list = findByN_S(nodeId, status, 0, 1, orderByComparator);
4037
4038 if (list.isEmpty()) {
4039 StringBundler msg = new StringBundler(6);
4040
4041 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4042
4043 msg.append("nodeId=");
4044 msg.append(nodeId);
4045
4046 msg.append(", status=");
4047 msg.append(status);
4048
4049 msg.append(StringPool.CLOSE_CURLY_BRACE);
4050
4051 throw new NoSuchPageException(msg.toString());
4052 }
4053 else {
4054 return list.get(0);
4055 }
4056 }
4057
4058
4072 public WikiPage findByN_S_Last(long nodeId, int status,
4073 OrderByComparator orderByComparator)
4074 throws NoSuchPageException, SystemException {
4075 int count = countByN_S(nodeId, status);
4076
4077 List<WikiPage> list = findByN_S(nodeId, status, count - 1, count,
4078 orderByComparator);
4079
4080 if (list.isEmpty()) {
4081 StringBundler msg = new StringBundler(6);
4082
4083 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4084
4085 msg.append("nodeId=");
4086 msg.append(nodeId);
4087
4088 msg.append(", status=");
4089 msg.append(status);
4090
4091 msg.append(StringPool.CLOSE_CURLY_BRACE);
4092
4093 throw new NoSuchPageException(msg.toString());
4094 }
4095 else {
4096 return list.get(0);
4097 }
4098 }
4099
4100
4115 public WikiPage[] findByN_S_PrevAndNext(long pageId, long nodeId,
4116 int status, OrderByComparator orderByComparator)
4117 throws NoSuchPageException, SystemException {
4118 WikiPage wikiPage = findByPrimaryKey(pageId);
4119
4120 Session session = null;
4121
4122 try {
4123 session = openSession();
4124
4125 WikiPage[] array = new WikiPageImpl[3];
4126
4127 array[0] = getByN_S_PrevAndNext(session, wikiPage, nodeId, status,
4128 orderByComparator, true);
4129
4130 array[1] = wikiPage;
4131
4132 array[2] = getByN_S_PrevAndNext(session, wikiPage, nodeId, status,
4133 orderByComparator, false);
4134
4135 return array;
4136 }
4137 catch (Exception e) {
4138 throw processException(e);
4139 }
4140 finally {
4141 closeSession(session);
4142 }
4143 }
4144
4145 protected WikiPage getByN_S_PrevAndNext(Session session, WikiPage wikiPage,
4146 long nodeId, int status, OrderByComparator orderByComparator,
4147 boolean previous) {
4148 StringBundler query = null;
4149
4150 if (orderByComparator != null) {
4151 query = new StringBundler(6 +
4152 (orderByComparator.getOrderByFields().length * 6));
4153 }
4154 else {
4155 query = new StringBundler(3);
4156 }
4157
4158 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
4159
4160 query.append(_FINDER_COLUMN_N_S_NODEID_2);
4161
4162 query.append(_FINDER_COLUMN_N_S_STATUS_2);
4163
4164 if (orderByComparator != null) {
4165 String[] orderByFields = orderByComparator.getOrderByFields();
4166
4167 if (orderByFields.length > 0) {
4168 query.append(WHERE_AND);
4169 }
4170
4171 for (int i = 0; i < orderByFields.length; i++) {
4172 query.append(_ORDER_BY_ENTITY_ALIAS);
4173 query.append(orderByFields[i]);
4174
4175 if ((i + 1) < orderByFields.length) {
4176 if (orderByComparator.isAscending() ^ previous) {
4177 query.append(WHERE_GREATER_THAN_HAS_NEXT);
4178 }
4179 else {
4180 query.append(WHERE_LESSER_THAN_HAS_NEXT);
4181 }
4182 }
4183 else {
4184 if (orderByComparator.isAscending() ^ previous) {
4185 query.append(WHERE_GREATER_THAN);
4186 }
4187 else {
4188 query.append(WHERE_LESSER_THAN);
4189 }
4190 }
4191 }
4192
4193 query.append(ORDER_BY_CLAUSE);
4194
4195 for (int i = 0; i < orderByFields.length; i++) {
4196 query.append(_ORDER_BY_ENTITY_ALIAS);
4197 query.append(orderByFields[i]);
4198
4199 if ((i + 1) < orderByFields.length) {
4200 if (orderByComparator.isAscending() ^ previous) {
4201 query.append(ORDER_BY_ASC_HAS_NEXT);
4202 }
4203 else {
4204 query.append(ORDER_BY_DESC_HAS_NEXT);
4205 }
4206 }
4207 else {
4208 if (orderByComparator.isAscending() ^ previous) {
4209 query.append(ORDER_BY_ASC);
4210 }
4211 else {
4212 query.append(ORDER_BY_DESC);
4213 }
4214 }
4215 }
4216 }
4217
4218 else {
4219 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
4220 }
4221
4222 String sql = query.toString();
4223
4224 Query q = session.createQuery(sql);
4225
4226 q.setFirstResult(0);
4227 q.setMaxResults(2);
4228
4229 QueryPos qPos = QueryPos.getInstance(q);
4230
4231 qPos.add(nodeId);
4232
4233 qPos.add(status);
4234
4235 if (orderByComparator != null) {
4236 Object[] values = orderByComparator.getOrderByValues(wikiPage);
4237
4238 for (Object value : values) {
4239 qPos.add(value);
4240 }
4241 }
4242
4243 List<WikiPage> list = q.list();
4244
4245 if (list.size() == 2) {
4246 return list.get(1);
4247 }
4248 else {
4249 return null;
4250 }
4251 }
4252
4253
4263 public WikiPage findByR_N_V(long resourcePrimKey, long nodeId,
4264 double version) throws NoSuchPageException, SystemException {
4265 WikiPage wikiPage = fetchByR_N_V(resourcePrimKey, nodeId, version);
4266
4267 if (wikiPage == null) {
4268 StringBundler msg = new StringBundler(8);
4269
4270 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4271
4272 msg.append("resourcePrimKey=");
4273 msg.append(resourcePrimKey);
4274
4275 msg.append(", nodeId=");
4276 msg.append(nodeId);
4277
4278 msg.append(", version=");
4279 msg.append(version);
4280
4281 msg.append(StringPool.CLOSE_CURLY_BRACE);
4282
4283 if (_log.isWarnEnabled()) {
4284 _log.warn(msg.toString());
4285 }
4286
4287 throw new NoSuchPageException(msg.toString());
4288 }
4289
4290 return wikiPage;
4291 }
4292
4293
4302 public WikiPage fetchByR_N_V(long resourcePrimKey, long nodeId,
4303 double version) throws SystemException {
4304 return fetchByR_N_V(resourcePrimKey, nodeId, version, true);
4305 }
4306
4307
4316 public WikiPage fetchByR_N_V(long resourcePrimKey, long nodeId,
4317 double version, boolean retrieveFromCache) throws SystemException {
4318 Object[] finderArgs = new Object[] { resourcePrimKey, nodeId, version };
4319
4320 Object result = null;
4321
4322 if (retrieveFromCache) {
4323 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_R_N_V,
4324 finderArgs, this);
4325 }
4326
4327 if (result == null) {
4328 StringBundler query = new StringBundler(5);
4329
4330 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
4331
4332 query.append(_FINDER_COLUMN_R_N_V_RESOURCEPRIMKEY_2);
4333
4334 query.append(_FINDER_COLUMN_R_N_V_NODEID_2);
4335
4336 query.append(_FINDER_COLUMN_R_N_V_VERSION_2);
4337
4338 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
4339
4340 String sql = query.toString();
4341
4342 Session session = null;
4343
4344 try {
4345 session = openSession();
4346
4347 Query q = session.createQuery(sql);
4348
4349 QueryPos qPos = QueryPos.getInstance(q);
4350
4351 qPos.add(resourcePrimKey);
4352
4353 qPos.add(nodeId);
4354
4355 qPos.add(version);
4356
4357 List<WikiPage> list = q.list();
4358
4359 result = list;
4360
4361 WikiPage wikiPage = null;
4362
4363 if (list.isEmpty()) {
4364 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_R_N_V,
4365 finderArgs, list);
4366 }
4367 else {
4368 wikiPage = list.get(0);
4369
4370 cacheResult(wikiPage);
4371
4372 if ((wikiPage.getResourcePrimKey() != resourcePrimKey) ||
4373 (wikiPage.getNodeId() != nodeId) ||
4374 (wikiPage.getVersion() != version)) {
4375 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_R_N_V,
4376 finderArgs, wikiPage);
4377 }
4378 }
4379
4380 return wikiPage;
4381 }
4382 catch (Exception e) {
4383 throw processException(e);
4384 }
4385 finally {
4386 if (result == null) {
4387 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_R_N_V,
4388 finderArgs);
4389 }
4390
4391 closeSession(session);
4392 }
4393 }
4394 else {
4395 if (result instanceof List<?>) {
4396 return null;
4397 }
4398 else {
4399 return (WikiPage)result;
4400 }
4401 }
4402 }
4403
4404
4413 public List<WikiPage> findByR_N_S(long resourcePrimKey, long nodeId,
4414 int status) throws SystemException {
4415 return findByR_N_S(resourcePrimKey, nodeId, status, QueryUtil.ALL_POS,
4416 QueryUtil.ALL_POS, null);
4417 }
4418
4419
4434 public List<WikiPage> findByR_N_S(long resourcePrimKey, long nodeId,
4435 int status, int start, int end) throws SystemException {
4436 return findByR_N_S(resourcePrimKey, nodeId, status, start, end, null);
4437 }
4438
4439
4455 public List<WikiPage> findByR_N_S(long resourcePrimKey, long nodeId,
4456 int status, int start, int end, OrderByComparator orderByComparator)
4457 throws SystemException {
4458 Object[] finderArgs = new Object[] {
4459 resourcePrimKey, nodeId, status,
4460
4461 String.valueOf(start), String.valueOf(end),
4462 String.valueOf(orderByComparator)
4463 };
4464
4465 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_R_N_S,
4466 finderArgs, this);
4467
4468 if (list == null) {
4469 StringBundler query = null;
4470
4471 if (orderByComparator != null) {
4472 query = new StringBundler(5 +
4473 (orderByComparator.getOrderByFields().length * 3));
4474 }
4475 else {
4476 query = new StringBundler(5);
4477 }
4478
4479 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
4480
4481 query.append(_FINDER_COLUMN_R_N_S_RESOURCEPRIMKEY_2);
4482
4483 query.append(_FINDER_COLUMN_R_N_S_NODEID_2);
4484
4485 query.append(_FINDER_COLUMN_R_N_S_STATUS_2);
4486
4487 if (orderByComparator != null) {
4488 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4489 orderByComparator);
4490 }
4491
4492 else {
4493 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
4494 }
4495
4496 String sql = query.toString();
4497
4498 Session session = null;
4499
4500 try {
4501 session = openSession();
4502
4503 Query q = session.createQuery(sql);
4504
4505 QueryPos qPos = QueryPos.getInstance(q);
4506
4507 qPos.add(resourcePrimKey);
4508
4509 qPos.add(nodeId);
4510
4511 qPos.add(status);
4512
4513 list = (List<WikiPage>)QueryUtil.list(q, getDialect(), start,
4514 end);
4515 }
4516 catch (Exception e) {
4517 throw processException(e);
4518 }
4519 finally {
4520 if (list == null) {
4521 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_R_N_S,
4522 finderArgs);
4523 }
4524 else {
4525 cacheResult(list);
4526
4527 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_R_N_S,
4528 finderArgs, list);
4529 }
4530
4531 closeSession(session);
4532 }
4533 }
4534
4535 return list;
4536 }
4537
4538
4553 public WikiPage findByR_N_S_First(long resourcePrimKey, long nodeId,
4554 int status, OrderByComparator orderByComparator)
4555 throws NoSuchPageException, SystemException {
4556 List<WikiPage> list = findByR_N_S(resourcePrimKey, nodeId, status, 0,
4557 1, orderByComparator);
4558
4559 if (list.isEmpty()) {
4560 StringBundler msg = new StringBundler(8);
4561
4562 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4563
4564 msg.append("resourcePrimKey=");
4565 msg.append(resourcePrimKey);
4566
4567 msg.append(", nodeId=");
4568 msg.append(nodeId);
4569
4570 msg.append(", status=");
4571 msg.append(status);
4572
4573 msg.append(StringPool.CLOSE_CURLY_BRACE);
4574
4575 throw new NoSuchPageException(msg.toString());
4576 }
4577 else {
4578 return list.get(0);
4579 }
4580 }
4581
4582
4597 public WikiPage findByR_N_S_Last(long resourcePrimKey, long nodeId,
4598 int status, OrderByComparator orderByComparator)
4599 throws NoSuchPageException, SystemException {
4600 int count = countByR_N_S(resourcePrimKey, nodeId, status);
4601
4602 List<WikiPage> list = findByR_N_S(resourcePrimKey, nodeId, status,
4603 count - 1, count, orderByComparator);
4604
4605 if (list.isEmpty()) {
4606 StringBundler msg = new StringBundler(8);
4607
4608 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4609
4610 msg.append("resourcePrimKey=");
4611 msg.append(resourcePrimKey);
4612
4613 msg.append(", nodeId=");
4614 msg.append(nodeId);
4615
4616 msg.append(", status=");
4617 msg.append(status);
4618
4619 msg.append(StringPool.CLOSE_CURLY_BRACE);
4620
4621 throw new NoSuchPageException(msg.toString());
4622 }
4623 else {
4624 return list.get(0);
4625 }
4626 }
4627
4628
4644 public WikiPage[] findByR_N_S_PrevAndNext(long pageId,
4645 long resourcePrimKey, long nodeId, int status,
4646 OrderByComparator orderByComparator)
4647 throws NoSuchPageException, SystemException {
4648 WikiPage wikiPage = findByPrimaryKey(pageId);
4649
4650 Session session = null;
4651
4652 try {
4653 session = openSession();
4654
4655 WikiPage[] array = new WikiPageImpl[3];
4656
4657 array[0] = getByR_N_S_PrevAndNext(session, wikiPage,
4658 resourcePrimKey, nodeId, status, orderByComparator, true);
4659
4660 array[1] = wikiPage;
4661
4662 array[2] = getByR_N_S_PrevAndNext(session, wikiPage,
4663 resourcePrimKey, nodeId, status, orderByComparator, false);
4664
4665 return array;
4666 }
4667 catch (Exception e) {
4668 throw processException(e);
4669 }
4670 finally {
4671 closeSession(session);
4672 }
4673 }
4674
4675 protected WikiPage getByR_N_S_PrevAndNext(Session session,
4676 WikiPage wikiPage, long resourcePrimKey, long nodeId, int status,
4677 OrderByComparator orderByComparator, boolean previous) {
4678 StringBundler query = null;
4679
4680 if (orderByComparator != null) {
4681 query = new StringBundler(6 +
4682 (orderByComparator.getOrderByFields().length * 6));
4683 }
4684 else {
4685 query = new StringBundler(3);
4686 }
4687
4688 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
4689
4690 query.append(_FINDER_COLUMN_R_N_S_RESOURCEPRIMKEY_2);
4691
4692 query.append(_FINDER_COLUMN_R_N_S_NODEID_2);
4693
4694 query.append(_FINDER_COLUMN_R_N_S_STATUS_2);
4695
4696 if (orderByComparator != null) {
4697 String[] orderByFields = orderByComparator.getOrderByFields();
4698
4699 if (orderByFields.length > 0) {
4700 query.append(WHERE_AND);
4701 }
4702
4703 for (int i = 0; i < orderByFields.length; i++) {
4704 query.append(_ORDER_BY_ENTITY_ALIAS);
4705 query.append(orderByFields[i]);
4706
4707 if ((i + 1) < orderByFields.length) {
4708 if (orderByComparator.isAscending() ^ previous) {
4709 query.append(WHERE_GREATER_THAN_HAS_NEXT);
4710 }
4711 else {
4712 query.append(WHERE_LESSER_THAN_HAS_NEXT);
4713 }
4714 }
4715 else {
4716 if (orderByComparator.isAscending() ^ previous) {
4717 query.append(WHERE_GREATER_THAN);
4718 }
4719 else {
4720 query.append(WHERE_LESSER_THAN);
4721 }
4722 }
4723 }
4724
4725 query.append(ORDER_BY_CLAUSE);
4726
4727 for (int i = 0; i < orderByFields.length; i++) {
4728 query.append(_ORDER_BY_ENTITY_ALIAS);
4729 query.append(orderByFields[i]);
4730
4731 if ((i + 1) < orderByFields.length) {
4732 if (orderByComparator.isAscending() ^ previous) {
4733 query.append(ORDER_BY_ASC_HAS_NEXT);
4734 }
4735 else {
4736 query.append(ORDER_BY_DESC_HAS_NEXT);
4737 }
4738 }
4739 else {
4740 if (orderByComparator.isAscending() ^ previous) {
4741 query.append(ORDER_BY_ASC);
4742 }
4743 else {
4744 query.append(ORDER_BY_DESC);
4745 }
4746 }
4747 }
4748 }
4749
4750 else {
4751 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
4752 }
4753
4754 String sql = query.toString();
4755
4756 Query q = session.createQuery(sql);
4757
4758 q.setFirstResult(0);
4759 q.setMaxResults(2);
4760
4761 QueryPos qPos = QueryPos.getInstance(q);
4762
4763 qPos.add(resourcePrimKey);
4764
4765 qPos.add(nodeId);
4766
4767 qPos.add(status);
4768
4769 if (orderByComparator != null) {
4770 Object[] values = orderByComparator.getOrderByValues(wikiPage);
4771
4772 for (Object value : values) {
4773 qPos.add(value);
4774 }
4775 }
4776
4777 List<WikiPage> list = q.list();
4778
4779 if (list.size() == 2) {
4780 return list.get(1);
4781 }
4782 else {
4783 return null;
4784 }
4785 }
4786
4787
4796 public List<WikiPage> findByU_N_S(long userId, long nodeId, int status)
4797 throws SystemException {
4798 return findByU_N_S(userId, nodeId, status, QueryUtil.ALL_POS,
4799 QueryUtil.ALL_POS, null);
4800 }
4801
4802
4817 public List<WikiPage> findByU_N_S(long userId, long nodeId, int status,
4818 int start, int end) throws SystemException {
4819 return findByU_N_S(userId, nodeId, status, start, end, null);
4820 }
4821
4822
4838 public List<WikiPage> findByU_N_S(long userId, long nodeId, int status,
4839 int start, int end, OrderByComparator orderByComparator)
4840 throws SystemException {
4841 Object[] finderArgs = new Object[] {
4842 userId, nodeId, status,
4843
4844 String.valueOf(start), String.valueOf(end),
4845 String.valueOf(orderByComparator)
4846 };
4847
4848 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_U_N_S,
4849 finderArgs, this);
4850
4851 if (list == null) {
4852 StringBundler query = null;
4853
4854 if (orderByComparator != null) {
4855 query = new StringBundler(5 +
4856 (orderByComparator.getOrderByFields().length * 3));
4857 }
4858 else {
4859 query = new StringBundler(5);
4860 }
4861
4862 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
4863
4864 query.append(_FINDER_COLUMN_U_N_S_USERID_2);
4865
4866 query.append(_FINDER_COLUMN_U_N_S_NODEID_2);
4867
4868 query.append(_FINDER_COLUMN_U_N_S_STATUS_2);
4869
4870 if (orderByComparator != null) {
4871 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4872 orderByComparator);
4873 }
4874
4875 else {
4876 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
4877 }
4878
4879 String sql = query.toString();
4880
4881 Session session = null;
4882
4883 try {
4884 session = openSession();
4885
4886 Query q = session.createQuery(sql);
4887
4888 QueryPos qPos = QueryPos.getInstance(q);
4889
4890 qPos.add(userId);
4891
4892 qPos.add(nodeId);
4893
4894 qPos.add(status);
4895
4896 list = (List<WikiPage>)QueryUtil.list(q, getDialect(), start,
4897 end);
4898 }
4899 catch (Exception e) {
4900 throw processException(e);
4901 }
4902 finally {
4903 if (list == null) {
4904 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_U_N_S,
4905 finderArgs);
4906 }
4907 else {
4908 cacheResult(list);
4909
4910 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_U_N_S,
4911 finderArgs, list);
4912 }
4913
4914 closeSession(session);
4915 }
4916 }
4917
4918 return list;
4919 }
4920
4921
4936 public WikiPage findByU_N_S_First(long userId, long nodeId, int status,
4937 OrderByComparator orderByComparator)
4938 throws NoSuchPageException, SystemException {
4939 List<WikiPage> list = findByU_N_S(userId, nodeId, status, 0, 1,
4940 orderByComparator);
4941
4942 if (list.isEmpty()) {
4943 StringBundler msg = new StringBundler(8);
4944
4945 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4946
4947 msg.append("userId=");
4948 msg.append(userId);
4949
4950 msg.append(", nodeId=");
4951 msg.append(nodeId);
4952
4953 msg.append(", status=");
4954 msg.append(status);
4955
4956 msg.append(StringPool.CLOSE_CURLY_BRACE);
4957
4958 throw new NoSuchPageException(msg.toString());
4959 }
4960 else {
4961 return list.get(0);
4962 }
4963 }
4964
4965
4980 public WikiPage findByU_N_S_Last(long userId, long nodeId, int status,
4981 OrderByComparator orderByComparator)
4982 throws NoSuchPageException, SystemException {
4983 int count = countByU_N_S(userId, nodeId, status);
4984
4985 List<WikiPage> list = findByU_N_S(userId, nodeId, status, count - 1,
4986 count, orderByComparator);
4987
4988 if (list.isEmpty()) {
4989 StringBundler msg = new StringBundler(8);
4990
4991 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4992
4993 msg.append("userId=");
4994 msg.append(userId);
4995
4996 msg.append(", nodeId=");
4997 msg.append(nodeId);
4998
4999 msg.append(", status=");
5000 msg.append(status);
5001
5002 msg.append(StringPool.CLOSE_CURLY_BRACE);
5003
5004 throw new NoSuchPageException(msg.toString());
5005 }
5006 else {
5007 return list.get(0);
5008 }
5009 }
5010
5011
5027 public WikiPage[] findByU_N_S_PrevAndNext(long pageId, long userId,
5028 long nodeId, int status, OrderByComparator orderByComparator)
5029 throws NoSuchPageException, SystemException {
5030 WikiPage wikiPage = findByPrimaryKey(pageId);
5031
5032 Session session = null;
5033
5034 try {
5035 session = openSession();
5036
5037 WikiPage[] array = new WikiPageImpl[3];
5038
5039 array[0] = getByU_N_S_PrevAndNext(session, wikiPage, userId,
5040 nodeId, status, orderByComparator, true);
5041
5042 array[1] = wikiPage;
5043
5044 array[2] = getByU_N_S_PrevAndNext(session, wikiPage, userId,
5045 nodeId, status, orderByComparator, false);
5046
5047 return array;
5048 }
5049 catch (Exception e) {
5050 throw processException(e);
5051 }
5052 finally {
5053 closeSession(session);
5054 }
5055 }
5056
5057 protected WikiPage getByU_N_S_PrevAndNext(Session session,
5058 WikiPage wikiPage, long userId, long nodeId, int status,
5059 OrderByComparator orderByComparator, boolean previous) {
5060 StringBundler query = null;
5061
5062 if (orderByComparator != null) {
5063 query = new StringBundler(6 +
5064 (orderByComparator.getOrderByFields().length * 6));
5065 }
5066 else {
5067 query = new StringBundler(3);
5068 }
5069
5070 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
5071
5072 query.append(_FINDER_COLUMN_U_N_S_USERID_2);
5073
5074 query.append(_FINDER_COLUMN_U_N_S_NODEID_2);
5075
5076 query.append(_FINDER_COLUMN_U_N_S_STATUS_2);
5077
5078 if (orderByComparator != null) {
5079 String[] orderByFields = orderByComparator.getOrderByFields();
5080
5081 if (orderByFields.length > 0) {
5082 query.append(WHERE_AND);
5083 }
5084
5085 for (int i = 0; i < orderByFields.length; i++) {
5086 query.append(_ORDER_BY_ENTITY_ALIAS);
5087 query.append(orderByFields[i]);
5088
5089 if ((i + 1) < orderByFields.length) {
5090 if (orderByComparator.isAscending() ^ previous) {
5091 query.append(WHERE_GREATER_THAN_HAS_NEXT);
5092 }
5093 else {
5094 query.append(WHERE_LESSER_THAN_HAS_NEXT);
5095 }
5096 }
5097 else {
5098 if (orderByComparator.isAscending() ^ previous) {
5099 query.append(WHERE_GREATER_THAN);
5100 }
5101 else {
5102 query.append(WHERE_LESSER_THAN);
5103 }
5104 }
5105 }
5106
5107 query.append(ORDER_BY_CLAUSE);
5108
5109 for (int i = 0; i < orderByFields.length; i++) {
5110 query.append(_ORDER_BY_ENTITY_ALIAS);
5111 query.append(orderByFields[i]);
5112
5113 if ((i + 1) < orderByFields.length) {
5114 if (orderByComparator.isAscending() ^ previous) {
5115 query.append(ORDER_BY_ASC_HAS_NEXT);
5116 }
5117 else {
5118 query.append(ORDER_BY_DESC_HAS_NEXT);
5119 }
5120 }
5121 else {
5122 if (orderByComparator.isAscending() ^ previous) {
5123 query.append(ORDER_BY_ASC);
5124 }
5125 else {
5126 query.append(ORDER_BY_DESC);
5127 }
5128 }
5129 }
5130 }
5131
5132 else {
5133 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
5134 }
5135
5136 String sql = query.toString();
5137
5138 Query q = session.createQuery(sql);
5139
5140 q.setFirstResult(0);
5141 q.setMaxResults(2);
5142
5143 QueryPos qPos = QueryPos.getInstance(q);
5144
5145 qPos.add(userId);
5146
5147 qPos.add(nodeId);
5148
5149 qPos.add(status);
5150
5151 if (orderByComparator != null) {
5152 Object[] values = orderByComparator.getOrderByValues(wikiPage);
5153
5154 for (Object value : values) {
5155 qPos.add(value);
5156 }
5157 }
5158
5159 List<WikiPage> list = q.list();
5160
5161 if (list.size() == 2) {
5162 return list.get(1);
5163 }
5164 else {
5165 return null;
5166 }
5167 }
5168
5169
5179 public WikiPage findByN_T_V(long nodeId, String title, double version)
5180 throws NoSuchPageException, SystemException {
5181 WikiPage wikiPage = fetchByN_T_V(nodeId, title, version);
5182
5183 if (wikiPage == null) {
5184 StringBundler msg = new StringBundler(8);
5185
5186 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5187
5188 msg.append("nodeId=");
5189 msg.append(nodeId);
5190
5191 msg.append(", title=");
5192 msg.append(title);
5193
5194 msg.append(", version=");
5195 msg.append(version);
5196
5197 msg.append(StringPool.CLOSE_CURLY_BRACE);
5198
5199 if (_log.isWarnEnabled()) {
5200 _log.warn(msg.toString());
5201 }
5202
5203 throw new NoSuchPageException(msg.toString());
5204 }
5205
5206 return wikiPage;
5207 }
5208
5209
5218 public WikiPage fetchByN_T_V(long nodeId, String title, double version)
5219 throws SystemException {
5220 return fetchByN_T_V(nodeId, title, version, true);
5221 }
5222
5223
5232 public WikiPage fetchByN_T_V(long nodeId, String title, double version,
5233 boolean retrieveFromCache) throws SystemException {
5234 Object[] finderArgs = new Object[] { nodeId, title, version };
5235
5236 Object result = null;
5237
5238 if (retrieveFromCache) {
5239 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_N_T_V,
5240 finderArgs, this);
5241 }
5242
5243 if (result == null) {
5244 StringBundler query = new StringBundler(5);
5245
5246 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
5247
5248 query.append(_FINDER_COLUMN_N_T_V_NODEID_2);
5249
5250 if (title == null) {
5251 query.append(_FINDER_COLUMN_N_T_V_TITLE_1);
5252 }
5253 else {
5254 if (title.equals(StringPool.BLANK)) {
5255 query.append(_FINDER_COLUMN_N_T_V_TITLE_3);
5256 }
5257 else {
5258 query.append(_FINDER_COLUMN_N_T_V_TITLE_2);
5259 }
5260 }
5261
5262 query.append(_FINDER_COLUMN_N_T_V_VERSION_2);
5263
5264 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
5265
5266 String sql = query.toString();
5267
5268 Session session = null;
5269
5270 try {
5271 session = openSession();
5272
5273 Query q = session.createQuery(sql);
5274
5275 QueryPos qPos = QueryPos.getInstance(q);
5276
5277 qPos.add(nodeId);
5278
5279 if (title != null) {
5280 qPos.add(title);
5281 }
5282
5283 qPos.add(version);
5284
5285 List<WikiPage> list = q.list();
5286
5287 result = list;
5288
5289 WikiPage wikiPage = null;
5290
5291 if (list.isEmpty()) {
5292 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_T_V,
5293 finderArgs, list);
5294 }
5295 else {
5296 wikiPage = list.get(0);
5297
5298 cacheResult(wikiPage);
5299
5300 if ((wikiPage.getNodeId() != nodeId) ||
5301 (wikiPage.getTitle() == null) ||
5302 !wikiPage.getTitle().equals(title) ||
5303 (wikiPage.getVersion() != version)) {
5304 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_T_V,
5305 finderArgs, wikiPage);
5306 }
5307 }
5308
5309 return wikiPage;
5310 }
5311 catch (Exception e) {
5312 throw processException(e);
5313 }
5314 finally {
5315 if (result == null) {
5316 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_N_T_V,
5317 finderArgs);
5318 }
5319
5320 closeSession(session);
5321 }
5322 }
5323 else {
5324 if (result instanceof List<?>) {
5325 return null;
5326 }
5327 else {
5328 return (WikiPage)result;
5329 }
5330 }
5331 }
5332
5333
5342 public List<WikiPage> findByN_T_H(long nodeId, String title, boolean head)
5343 throws SystemException {
5344 return findByN_T_H(nodeId, title, head, QueryUtil.ALL_POS,
5345 QueryUtil.ALL_POS, null);
5346 }
5347
5348
5363 public List<WikiPage> findByN_T_H(long nodeId, String title, boolean head,
5364 int start, int end) throws SystemException {
5365 return findByN_T_H(nodeId, title, head, start, end, null);
5366 }
5367
5368
5384 public List<WikiPage> findByN_T_H(long nodeId, String title, boolean head,
5385 int start, int end, OrderByComparator orderByComparator)
5386 throws SystemException {
5387 Object[] finderArgs = new Object[] {
5388 nodeId, title, head,
5389
5390 String.valueOf(start), String.valueOf(end),
5391 String.valueOf(orderByComparator)
5392 };
5393
5394 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_N_T_H,
5395 finderArgs, this);
5396
5397 if (list == null) {
5398 StringBundler query = null;
5399
5400 if (orderByComparator != null) {
5401 query = new StringBundler(5 +
5402 (orderByComparator.getOrderByFields().length * 3));
5403 }
5404 else {
5405 query = new StringBundler(5);
5406 }
5407
5408 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
5409
5410 query.append(_FINDER_COLUMN_N_T_H_NODEID_2);
5411
5412 if (title == null) {
5413 query.append(_FINDER_COLUMN_N_T_H_TITLE_1);
5414 }
5415 else {
5416 if (title.equals(StringPool.BLANK)) {
5417 query.append(_FINDER_COLUMN_N_T_H_TITLE_3);
5418 }
5419 else {
5420 query.append(_FINDER_COLUMN_N_T_H_TITLE_2);
5421 }
5422 }
5423
5424 query.append(_FINDER_COLUMN_N_T_H_HEAD_2);
5425
5426 if (orderByComparator != null) {
5427 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
5428 orderByComparator);
5429 }
5430
5431 else {
5432 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
5433 }
5434
5435 String sql = query.toString();
5436
5437 Session session = null;
5438
5439 try {
5440 session = openSession();
5441
5442 Query q = session.createQuery(sql);
5443
5444 QueryPos qPos = QueryPos.getInstance(q);
5445
5446 qPos.add(nodeId);
5447
5448 if (title != null) {
5449 qPos.add(title);
5450 }
5451
5452 qPos.add(head);
5453
5454 list = (List<WikiPage>)QueryUtil.list(q, getDialect(), start,
5455 end);
5456 }
5457 catch (Exception e) {
5458 throw processException(e);
5459 }
5460 finally {
5461 if (list == null) {
5462 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_N_T_H,
5463 finderArgs);
5464 }
5465 else {
5466 cacheResult(list);
5467
5468 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_N_T_H,
5469 finderArgs, list);
5470 }
5471
5472 closeSession(session);
5473 }
5474 }
5475
5476 return list;
5477 }
5478
5479
5494 public WikiPage findByN_T_H_First(long nodeId, String title, boolean head,
5495 OrderByComparator orderByComparator)
5496 throws NoSuchPageException, SystemException {
5497 List<WikiPage> list = findByN_T_H(nodeId, title, head, 0, 1,
5498 orderByComparator);
5499
5500 if (list.isEmpty()) {
5501 StringBundler msg = new StringBundler(8);
5502
5503 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5504
5505 msg.append("nodeId=");
5506 msg.append(nodeId);
5507
5508 msg.append(", title=");
5509 msg.append(title);
5510
5511 msg.append(", head=");
5512 msg.append(head);
5513
5514 msg.append(StringPool.CLOSE_CURLY_BRACE);
5515
5516 throw new NoSuchPageException(msg.toString());
5517 }
5518 else {
5519 return list.get(0);
5520 }
5521 }
5522
5523
5538 public WikiPage findByN_T_H_Last(long nodeId, String title, boolean head,
5539 OrderByComparator orderByComparator)
5540 throws NoSuchPageException, SystemException {
5541 int count = countByN_T_H(nodeId, title, head);
5542
5543 List<WikiPage> list = findByN_T_H(nodeId, title, head, count - 1,
5544 count, orderByComparator);
5545
5546 if (list.isEmpty()) {
5547 StringBundler msg = new StringBundler(8);
5548
5549 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5550
5551 msg.append("nodeId=");
5552 msg.append(nodeId);
5553
5554 msg.append(", title=");
5555 msg.append(title);
5556
5557 msg.append(", head=");
5558 msg.append(head);
5559
5560 msg.append(StringPool.CLOSE_CURLY_BRACE);
5561
5562 throw new NoSuchPageException(msg.toString());
5563 }
5564 else {
5565 return list.get(0);
5566 }
5567 }
5568
5569
5585 public WikiPage[] findByN_T_H_PrevAndNext(long pageId, long nodeId,
5586 String title, boolean head, OrderByComparator orderByComparator)
5587 throws NoSuchPageException, SystemException {
5588 WikiPage wikiPage = findByPrimaryKey(pageId);
5589
5590 Session session = null;
5591
5592 try {
5593 session = openSession();
5594
5595 WikiPage[] array = new WikiPageImpl[3];
5596
5597 array[0] = getByN_T_H_PrevAndNext(session, wikiPage, nodeId, title,
5598 head, orderByComparator, true);
5599
5600 array[1] = wikiPage;
5601
5602 array[2] = getByN_T_H_PrevAndNext(session, wikiPage, nodeId, title,
5603 head, orderByComparator, false);
5604
5605 return array;
5606 }
5607 catch (Exception e) {
5608 throw processException(e);
5609 }
5610 finally {
5611 closeSession(session);
5612 }
5613 }
5614
5615 protected WikiPage getByN_T_H_PrevAndNext(Session session,
5616 WikiPage wikiPage, long nodeId, String title, boolean head,
5617 OrderByComparator orderByComparator, boolean previous) {
5618 StringBundler query = null;
5619
5620 if (orderByComparator != null) {
5621 query = new StringBundler(6 +
5622 (orderByComparator.getOrderByFields().length * 6));
5623 }
5624 else {
5625 query = new StringBundler(3);
5626 }
5627
5628 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
5629
5630 query.append(_FINDER_COLUMN_N_T_H_NODEID_2);
5631
5632 if (title == null) {
5633 query.append(_FINDER_COLUMN_N_T_H_TITLE_1);
5634 }
5635 else {
5636 if (title.equals(StringPool.BLANK)) {
5637 query.append(_FINDER_COLUMN_N_T_H_TITLE_3);
5638 }
5639 else {
5640 query.append(_FINDER_COLUMN_N_T_H_TITLE_2);
5641 }
5642 }
5643
5644 query.append(_FINDER_COLUMN_N_T_H_HEAD_2);
5645
5646 if (orderByComparator != null) {
5647 String[] orderByFields = orderByComparator.getOrderByFields();
5648
5649 if (orderByFields.length > 0) {
5650 query.append(WHERE_AND);
5651 }
5652
5653 for (int i = 0; i < orderByFields.length; i++) {
5654 query.append(_ORDER_BY_ENTITY_ALIAS);
5655 query.append(orderByFields[i]);
5656
5657 if ((i + 1) < orderByFields.length) {
5658 if (orderByComparator.isAscending() ^ previous) {
5659 query.append(WHERE_GREATER_THAN_HAS_NEXT);
5660 }
5661 else {
5662 query.append(WHERE_LESSER_THAN_HAS_NEXT);
5663 }
5664 }
5665 else {
5666 if (orderByComparator.isAscending() ^ previous) {
5667 query.append(WHERE_GREATER_THAN);
5668 }
5669 else {
5670 query.append(WHERE_LESSER_THAN);
5671 }
5672 }
5673 }
5674
5675 query.append(ORDER_BY_CLAUSE);
5676
5677 for (int i = 0; i < orderByFields.length; i++) {
5678 query.append(_ORDER_BY_ENTITY_ALIAS);
5679 query.append(orderByFields[i]);
5680
5681 if ((i + 1) < orderByFields.length) {
5682 if (orderByComparator.isAscending() ^ previous) {
5683 query.append(ORDER_BY_ASC_HAS_NEXT);
5684 }
5685 else {
5686 query.append(ORDER_BY_DESC_HAS_NEXT);
5687 }
5688 }
5689 else {
5690 if (orderByComparator.isAscending() ^ previous) {
5691 query.append(ORDER_BY_ASC);
5692 }
5693 else {
5694 query.append(ORDER_BY_DESC);
5695 }
5696 }
5697 }
5698 }
5699
5700 else {
5701 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
5702 }
5703
5704 String sql = query.toString();
5705
5706 Query q = session.createQuery(sql);
5707
5708 q.setFirstResult(0);
5709 q.setMaxResults(2);
5710
5711 QueryPos qPos = QueryPos.getInstance(q);
5712
5713 qPos.add(nodeId);
5714
5715 if (title != null) {
5716 qPos.add(title);
5717 }
5718
5719 qPos.add(head);
5720
5721 if (orderByComparator != null) {
5722 Object[] values = orderByComparator.getOrderByValues(wikiPage);
5723
5724 for (Object value : values) {
5725 qPos.add(value);
5726 }
5727 }
5728
5729 List<WikiPage> list = q.list();
5730
5731 if (list.size() == 2) {
5732 return list.get(1);
5733 }
5734 else {
5735 return null;
5736 }
5737 }
5738
5739
5748 public List<WikiPage> findByN_T_S(long nodeId, String title, int status)
5749 throws SystemException {
5750 return findByN_T_S(nodeId, title, status, QueryUtil.ALL_POS,
5751 QueryUtil.ALL_POS, null);
5752 }
5753
5754
5769 public List<WikiPage> findByN_T_S(long nodeId, String title, int status,
5770 int start, int end) throws SystemException {
5771 return findByN_T_S(nodeId, title, status, start, end, null);
5772 }
5773
5774
5790 public List<WikiPage> findByN_T_S(long nodeId, String title, int status,
5791 int start, int end, OrderByComparator orderByComparator)
5792 throws SystemException {
5793 Object[] finderArgs = new Object[] {
5794 nodeId, title, status,
5795
5796 String.valueOf(start), String.valueOf(end),
5797 String.valueOf(orderByComparator)
5798 };
5799
5800 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_N_T_S,
5801 finderArgs, this);
5802
5803 if (list == null) {
5804 StringBundler query = null;
5805
5806 if (orderByComparator != null) {
5807 query = new StringBundler(5 +
5808 (orderByComparator.getOrderByFields().length * 3));
5809 }
5810 else {
5811 query = new StringBundler(5);
5812 }
5813
5814 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
5815
5816 query.append(_FINDER_COLUMN_N_T_S_NODEID_2);
5817
5818 if (title == null) {
5819 query.append(_FINDER_COLUMN_N_T_S_TITLE_1);
5820 }
5821 else {
5822 if (title.equals(StringPool.BLANK)) {
5823 query.append(_FINDER_COLUMN_N_T_S_TITLE_3);
5824 }
5825 else {
5826 query.append(_FINDER_COLUMN_N_T_S_TITLE_2);
5827 }
5828 }
5829
5830 query.append(_FINDER_COLUMN_N_T_S_STATUS_2);
5831
5832 if (orderByComparator != null) {
5833 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
5834 orderByComparator);
5835 }
5836
5837 else {
5838 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
5839 }
5840
5841 String sql = query.toString();
5842
5843 Session session = null;
5844
5845 try {
5846 session = openSession();
5847
5848 Query q = session.createQuery(sql);
5849
5850 QueryPos qPos = QueryPos.getInstance(q);
5851
5852 qPos.add(nodeId);
5853
5854 if (title != null) {
5855 qPos.add(title);
5856 }
5857
5858 qPos.add(status);
5859
5860 list = (List<WikiPage>)QueryUtil.list(q, getDialect(), start,
5861 end);
5862 }
5863 catch (Exception e) {
5864 throw processException(e);
5865 }
5866 finally {
5867 if (list == null) {
5868 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_N_T_S,
5869 finderArgs);
5870 }
5871 else {
5872 cacheResult(list);
5873
5874 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_N_T_S,
5875 finderArgs, list);
5876 }
5877
5878 closeSession(session);
5879 }
5880 }
5881
5882 return list;
5883 }
5884
5885
5900 public WikiPage findByN_T_S_First(long nodeId, String title, int status,
5901 OrderByComparator orderByComparator)
5902 throws NoSuchPageException, SystemException {
5903 List<WikiPage> list = findByN_T_S(nodeId, title, status, 0, 1,
5904 orderByComparator);
5905
5906 if (list.isEmpty()) {
5907 StringBundler msg = new StringBundler(8);
5908
5909 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5910
5911 msg.append("nodeId=");
5912 msg.append(nodeId);
5913
5914 msg.append(", title=");
5915 msg.append(title);
5916
5917 msg.append(", status=");
5918 msg.append(status);
5919
5920 msg.append(StringPool.CLOSE_CURLY_BRACE);
5921
5922 throw new NoSuchPageException(msg.toString());
5923 }
5924 else {
5925 return list.get(0);
5926 }
5927 }
5928
5929
5944 public WikiPage findByN_T_S_Last(long nodeId, String title, int status,
5945 OrderByComparator orderByComparator)
5946 throws NoSuchPageException, SystemException {
5947 int count = countByN_T_S(nodeId, title, status);
5948
5949 List<WikiPage> list = findByN_T_S(nodeId, title, status, count - 1,
5950 count, orderByComparator);
5951
5952 if (list.isEmpty()) {
5953 StringBundler msg = new StringBundler(8);
5954
5955 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5956
5957 msg.append("nodeId=");
5958 msg.append(nodeId);
5959
5960 msg.append(", title=");
5961 msg.append(title);
5962
5963 msg.append(", status=");
5964 msg.append(status);
5965
5966 msg.append(StringPool.CLOSE_CURLY_BRACE);
5967
5968 throw new NoSuchPageException(msg.toString());
5969 }
5970 else {
5971 return list.get(0);
5972 }
5973 }
5974
5975
5991 public WikiPage[] findByN_T_S_PrevAndNext(long pageId, long nodeId,
5992 String title, int status, OrderByComparator orderByComparator)
5993 throws NoSuchPageException, SystemException {
5994 WikiPage wikiPage = findByPrimaryKey(pageId);
5995
5996 Session session = null;
5997
5998 try {
5999 session = openSession();
6000
6001 WikiPage[] array = new WikiPageImpl[3];
6002
6003 array[0] = getByN_T_S_PrevAndNext(session, wikiPage, nodeId, title,
6004 status, orderByComparator, true);
6005
6006 array[1] = wikiPage;
6007
6008 array[2] = getByN_T_S_PrevAndNext(session, wikiPage, nodeId, title,
6009 status, orderByComparator, false);
6010
6011 return array;
6012 }
6013 catch (Exception e) {
6014 throw processException(e);
6015 }
6016 finally {
6017 closeSession(session);
6018 }
6019 }
6020
6021 protected WikiPage getByN_T_S_PrevAndNext(Session session,
6022 WikiPage wikiPage, long nodeId, String title, int status,
6023 OrderByComparator orderByComparator, boolean previous) {
6024 StringBundler query = null;
6025
6026 if (orderByComparator != null) {
6027 query = new StringBundler(6 +
6028 (orderByComparator.getOrderByFields().length * 6));
6029 }
6030 else {
6031 query = new StringBundler(3);
6032 }
6033
6034 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
6035
6036 query.append(_FINDER_COLUMN_N_T_S_NODEID_2);
6037
6038 if (title == null) {
6039 query.append(_FINDER_COLUMN_N_T_S_TITLE_1);
6040 }
6041 else {
6042 if (title.equals(StringPool.BLANK)) {
6043 query.append(_FINDER_COLUMN_N_T_S_TITLE_3);
6044 }
6045 else {
6046 query.append(_FINDER_COLUMN_N_T_S_TITLE_2);
6047 }
6048 }
6049
6050 query.append(_FINDER_COLUMN_N_T_S_STATUS_2);
6051
6052 if (orderByComparator != null) {
6053 String[] orderByFields = orderByComparator.getOrderByFields();
6054
6055 if (orderByFields.length > 0) {
6056 query.append(WHERE_AND);
6057 }
6058
6059 for (int i = 0; i < orderByFields.length; i++) {
6060 query.append(_ORDER_BY_ENTITY_ALIAS);
6061 query.append(orderByFields[i]);
6062
6063 if ((i + 1) < orderByFields.length) {
6064 if (orderByComparator.isAscending() ^ previous) {
6065 query.append(WHERE_GREATER_THAN_HAS_NEXT);
6066 }
6067 else {
6068 query.append(WHERE_LESSER_THAN_HAS_NEXT);
6069 }
6070 }
6071 else {
6072 if (orderByComparator.isAscending() ^ previous) {
6073 query.append(WHERE_GREATER_THAN);
6074 }
6075 else {
6076 query.append(WHERE_LESSER_THAN);
6077 }
6078 }
6079 }
6080
6081 query.append(ORDER_BY_CLAUSE);
6082
6083 for (int i = 0; i < orderByFields.length; i++) {
6084 query.append(_ORDER_BY_ENTITY_ALIAS);
6085 query.append(orderByFields[i]);
6086
6087 if ((i + 1) < orderByFields.length) {
6088 if (orderByComparator.isAscending() ^ previous) {
6089 query.append(ORDER_BY_ASC_HAS_NEXT);
6090 }
6091 else {
6092 query.append(ORDER_BY_DESC_HAS_NEXT);
6093 }
6094 }
6095 else {
6096 if (orderByComparator.isAscending() ^ previous) {
6097 query.append(ORDER_BY_ASC);
6098 }
6099 else {
6100 query.append(ORDER_BY_DESC);
6101 }
6102 }
6103 }
6104 }
6105
6106 else {
6107 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
6108 }
6109
6110 String sql = query.toString();
6111
6112 Query q = session.createQuery(sql);
6113
6114 q.setFirstResult(0);
6115 q.setMaxResults(2);
6116
6117 QueryPos qPos = QueryPos.getInstance(q);
6118
6119 qPos.add(nodeId);
6120
6121 if (title != null) {
6122 qPos.add(title);
6123 }
6124
6125 qPos.add(status);
6126
6127 if (orderByComparator != null) {
6128 Object[] values = orderByComparator.getOrderByValues(wikiPage);
6129
6130 for (Object value : values) {
6131 qPos.add(value);
6132 }
6133 }
6134
6135 List<WikiPage> list = q.list();
6136
6137 if (list.size() == 2) {
6138 return list.get(1);
6139 }
6140 else {
6141 return null;
6142 }
6143 }
6144
6145
6154 public List<WikiPage> findByN_H_P(long nodeId, boolean head,
6155 String parentTitle) throws SystemException {
6156 return findByN_H_P(nodeId, head, parentTitle, QueryUtil.ALL_POS,
6157 QueryUtil.ALL_POS, null);
6158 }
6159
6160
6175 public List<WikiPage> findByN_H_P(long nodeId, boolean head,
6176 String parentTitle, int start, int end) throws SystemException {
6177 return findByN_H_P(nodeId, head, parentTitle, start, end, null);
6178 }
6179
6180
6196 public List<WikiPage> findByN_H_P(long nodeId, boolean head,
6197 String parentTitle, int start, int end,
6198 OrderByComparator orderByComparator) throws SystemException {
6199 Object[] finderArgs = new Object[] {
6200 nodeId, head, parentTitle,
6201
6202 String.valueOf(start), String.valueOf(end),
6203 String.valueOf(orderByComparator)
6204 };
6205
6206 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_N_H_P,
6207 finderArgs, this);
6208
6209 if (list == null) {
6210 StringBundler query = null;
6211
6212 if (orderByComparator != null) {
6213 query = new StringBundler(5 +
6214 (orderByComparator.getOrderByFields().length * 3));
6215 }
6216 else {
6217 query = new StringBundler(5);
6218 }
6219
6220 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
6221
6222 query.append(_FINDER_COLUMN_N_H_P_NODEID_2);
6223
6224 query.append(_FINDER_COLUMN_N_H_P_HEAD_2);
6225
6226 if (parentTitle == null) {
6227 query.append(_FINDER_COLUMN_N_H_P_PARENTTITLE_1);
6228 }
6229 else {
6230 if (parentTitle.equals(StringPool.BLANK)) {
6231 query.append(_FINDER_COLUMN_N_H_P_PARENTTITLE_3);
6232 }
6233 else {
6234 query.append(_FINDER_COLUMN_N_H_P_PARENTTITLE_2);
6235 }
6236 }
6237
6238 if (orderByComparator != null) {
6239 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
6240 orderByComparator);
6241 }
6242
6243 else {
6244 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
6245 }
6246
6247 String sql = query.toString();
6248
6249 Session session = null;
6250
6251 try {
6252 session = openSession();
6253
6254 Query q = session.createQuery(sql);
6255
6256 QueryPos qPos = QueryPos.getInstance(q);
6257
6258 qPos.add(nodeId);
6259
6260 qPos.add(head);
6261
6262 if (parentTitle != null) {
6263 qPos.add(parentTitle);
6264 }
6265
6266 list = (List<WikiPage>)QueryUtil.list(q, getDialect(), start,
6267 end);
6268 }
6269 catch (Exception e) {
6270 throw processException(e);
6271 }
6272 finally {
6273 if (list == null) {
6274 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_N_H_P,
6275 finderArgs);
6276 }
6277 else {
6278 cacheResult(list);
6279
6280 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_N_H_P,
6281 finderArgs, list);
6282 }
6283
6284 closeSession(session);
6285 }
6286 }
6287
6288 return list;
6289 }
6290
6291
6306 public WikiPage findByN_H_P_First(long nodeId, boolean head,
6307 String parentTitle, OrderByComparator orderByComparator)
6308 throws NoSuchPageException, SystemException {
6309 List<WikiPage> list = findByN_H_P(nodeId, head, parentTitle, 0, 1,
6310 orderByComparator);
6311
6312 if (list.isEmpty()) {
6313 StringBundler msg = new StringBundler(8);
6314
6315 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
6316
6317 msg.append("nodeId=");
6318 msg.append(nodeId);
6319
6320 msg.append(", head=");
6321 msg.append(head);
6322
6323 msg.append(", parentTitle=");
6324 msg.append(parentTitle);
6325
6326 msg.append(StringPool.CLOSE_CURLY_BRACE);
6327
6328 throw new NoSuchPageException(msg.toString());
6329 }
6330 else {
6331 return list.get(0);
6332 }
6333 }
6334
6335
6350 public WikiPage findByN_H_P_Last(long nodeId, boolean head,
6351 String parentTitle, OrderByComparator orderByComparator)
6352 throws NoSuchPageException, SystemException {
6353 int count = countByN_H_P(nodeId, head, parentTitle);
6354
6355 List<WikiPage> list = findByN_H_P(nodeId, head, parentTitle, count - 1,
6356 count, orderByComparator);
6357
6358 if (list.isEmpty()) {
6359 StringBundler msg = new StringBundler(8);
6360
6361 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
6362
6363 msg.append("nodeId=");
6364 msg.append(nodeId);
6365
6366 msg.append(", head=");
6367 msg.append(head);
6368
6369 msg.append(", parentTitle=");
6370 msg.append(parentTitle);
6371
6372 msg.append(StringPool.CLOSE_CURLY_BRACE);
6373
6374 throw new NoSuchPageException(msg.toString());
6375 }
6376 else {
6377 return list.get(0);
6378 }
6379 }
6380
6381
6397 public WikiPage[] findByN_H_P_PrevAndNext(long pageId, long nodeId,
6398 boolean head, String parentTitle, OrderByComparator orderByComparator)
6399 throws NoSuchPageException, SystemException {
6400 WikiPage wikiPage = findByPrimaryKey(pageId);
6401
6402 Session session = null;
6403
6404 try {
6405 session = openSession();
6406
6407 WikiPage[] array = new WikiPageImpl[3];
6408
6409 array[0] = getByN_H_P_PrevAndNext(session, wikiPage, nodeId, head,
6410 parentTitle, orderByComparator, true);
6411
6412 array[1] = wikiPage;
6413
6414 array[2] = getByN_H_P_PrevAndNext(session, wikiPage, nodeId, head,
6415 parentTitle, orderByComparator, false);
6416
6417 return array;
6418 }
6419 catch (Exception e) {
6420 throw processException(e);
6421 }
6422 finally {
6423 closeSession(session);
6424 }
6425 }
6426
6427 protected WikiPage getByN_H_P_PrevAndNext(Session session,
6428 WikiPage wikiPage, long nodeId, boolean head, String parentTitle,
6429 OrderByComparator orderByComparator, boolean previous) {
6430 StringBundler query = null;
6431
6432 if (orderByComparator != null) {
6433 query = new StringBundler(6 +
6434 (orderByComparator.getOrderByFields().length * 6));
6435 }
6436 else {
6437 query = new StringBundler(3);
6438 }
6439
6440 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
6441
6442 query.append(_FINDER_COLUMN_N_H_P_NODEID_2);
6443
6444 query.append(_FINDER_COLUMN_N_H_P_HEAD_2);
6445
6446 if (parentTitle == null) {
6447 query.append(_FINDER_COLUMN_N_H_P_PARENTTITLE_1);
6448 }
6449 else {
6450 if (parentTitle.equals(StringPool.BLANK)) {
6451 query.append(_FINDER_COLUMN_N_H_P_PARENTTITLE_3);
6452 }
6453 else {
6454 query.append(_FINDER_COLUMN_N_H_P_PARENTTITLE_2);
6455 }
6456 }
6457
6458 if (orderByComparator != null) {
6459 String[] orderByFields = orderByComparator.getOrderByFields();
6460
6461 if (orderByFields.length > 0) {
6462 query.append(WHERE_AND);
6463 }
6464
6465 for (int i = 0; i < orderByFields.length; i++) {
6466 query.append(_ORDER_BY_ENTITY_ALIAS);
6467 query.append(orderByFields[i]);
6468
6469 if ((i + 1) < orderByFields.length) {
6470 if (orderByComparator.isAscending() ^ previous) {
6471 query.append(WHERE_GREATER_THAN_HAS_NEXT);
6472 }
6473 else {
6474 query.append(WHERE_LESSER_THAN_HAS_NEXT);
6475 }
6476 }
6477 else {
6478 if (orderByComparator.isAscending() ^ previous) {
6479 query.append(WHERE_GREATER_THAN);
6480 }
6481 else {
6482 query.append(WHERE_LESSER_THAN);
6483 }
6484 }
6485 }
6486
6487 query.append(ORDER_BY_CLAUSE);
6488
6489 for (int i = 0; i < orderByFields.length; i++) {
6490 query.append(_ORDER_BY_ENTITY_ALIAS);
6491 query.append(orderByFields[i]);
6492
6493 if ((i + 1) < orderByFields.length) {
6494 if (orderByComparator.isAscending() ^ previous) {
6495 query.append(ORDER_BY_ASC_HAS_NEXT);
6496 }
6497 else {
6498 query.append(ORDER_BY_DESC_HAS_NEXT);
6499 }
6500 }
6501 else {
6502 if (orderByComparator.isAscending() ^ previous) {
6503 query.append(ORDER_BY_ASC);
6504 }
6505 else {
6506 query.append(ORDER_BY_DESC);
6507 }
6508 }
6509 }
6510 }
6511
6512 else {
6513 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
6514 }
6515
6516 String sql = query.toString();
6517
6518 Query q = session.createQuery(sql);
6519
6520 q.setFirstResult(0);
6521 q.setMaxResults(2);
6522
6523 QueryPos qPos = QueryPos.getInstance(q);
6524
6525 qPos.add(nodeId);
6526
6527 qPos.add(head);
6528
6529 if (parentTitle != null) {
6530 qPos.add(parentTitle);
6531 }
6532
6533 if (orderByComparator != null) {
6534 Object[] values = orderByComparator.getOrderByValues(wikiPage);
6535
6536 for (Object value : values) {
6537 qPos.add(value);
6538 }
6539 }
6540
6541 List<WikiPage> list = q.list();
6542
6543 if (list.size() == 2) {
6544 return list.get(1);
6545 }
6546 else {
6547 return null;
6548 }
6549 }
6550
6551
6560 public List<WikiPage> findByN_H_S(long nodeId, boolean head, int status)
6561 throws SystemException {
6562 return findByN_H_S(nodeId, head, status, QueryUtil.ALL_POS,
6563 QueryUtil.ALL_POS, null);
6564 }
6565
6566
6581 public List<WikiPage> findByN_H_S(long nodeId, boolean head, int status,
6582 int start, int end) throws SystemException {
6583 return findByN_H_S(nodeId, head, status, start, end, null);
6584 }
6585
6586
6602 public List<WikiPage> findByN_H_S(long nodeId, boolean head, int status,
6603 int start, int end, OrderByComparator orderByComparator)
6604 throws SystemException {
6605 Object[] finderArgs = new Object[] {
6606 nodeId, head, status,
6607
6608 String.valueOf(start), String.valueOf(end),
6609 String.valueOf(orderByComparator)
6610 };
6611
6612 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_N_H_S,
6613 finderArgs, this);
6614
6615 if (list == null) {
6616 StringBundler query = null;
6617
6618 if (orderByComparator != null) {
6619 query = new StringBundler(5 +
6620 (orderByComparator.getOrderByFields().length * 3));
6621 }
6622 else {
6623 query = new StringBundler(5);
6624 }
6625
6626 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
6627
6628 query.append(_FINDER_COLUMN_N_H_S_NODEID_2);
6629
6630 query.append(_FINDER_COLUMN_N_H_S_HEAD_2);
6631
6632 query.append(_FINDER_COLUMN_N_H_S_STATUS_2);
6633
6634 if (orderByComparator != null) {
6635 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
6636 orderByComparator);
6637 }
6638
6639 else {
6640 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
6641 }
6642
6643 String sql = query.toString();
6644
6645 Session session = null;
6646
6647 try {
6648 session = openSession();
6649
6650 Query q = session.createQuery(sql);
6651
6652 QueryPos qPos = QueryPos.getInstance(q);
6653
6654 qPos.add(nodeId);
6655
6656 qPos.add(head);
6657
6658 qPos.add(status);
6659
6660 list = (List<WikiPage>)QueryUtil.list(q, getDialect(), start,
6661 end);
6662 }
6663 catch (Exception e) {
6664 throw processException(e);
6665 }
6666 finally {
6667 if (list == null) {
6668 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_N_H_S,
6669 finderArgs);
6670 }
6671 else {
6672 cacheResult(list);
6673
6674 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_N_H_S,
6675 finderArgs, list);
6676 }
6677
6678 closeSession(session);
6679 }
6680 }
6681
6682 return list;
6683 }
6684
6685
6700 public WikiPage findByN_H_S_First(long nodeId, boolean head, int status,
6701 OrderByComparator orderByComparator)
6702 throws NoSuchPageException, SystemException {
6703 List<WikiPage> list = findByN_H_S(nodeId, head, status, 0, 1,
6704 orderByComparator);
6705
6706 if (list.isEmpty()) {
6707 StringBundler msg = new StringBundler(8);
6708
6709 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
6710
6711 msg.append("nodeId=");
6712 msg.append(nodeId);
6713
6714 msg.append(", head=");
6715 msg.append(head);
6716
6717 msg.append(", status=");
6718 msg.append(status);
6719
6720 msg.append(StringPool.CLOSE_CURLY_BRACE);
6721
6722 throw new NoSuchPageException(msg.toString());
6723 }
6724 else {
6725 return list.get(0);
6726 }
6727 }
6728
6729
6744 public WikiPage findByN_H_S_Last(long nodeId, boolean head, int status,
6745 OrderByComparator orderByComparator)
6746 throws NoSuchPageException, SystemException {
6747 int count = countByN_H_S(nodeId, head, status);
6748
6749 List<WikiPage> list = findByN_H_S(nodeId, head, status, count - 1,
6750 count, orderByComparator);
6751
6752 if (list.isEmpty()) {
6753 StringBundler msg = new StringBundler(8);
6754
6755 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
6756
6757 msg.append("nodeId=");
6758 msg.append(nodeId);
6759
6760 msg.append(", head=");
6761 msg.append(head);
6762
6763 msg.append(", status=");
6764 msg.append(status);
6765
6766 msg.append(StringPool.CLOSE_CURLY_BRACE);
6767
6768 throw new NoSuchPageException(msg.toString());
6769 }
6770 else {
6771 return list.get(0);
6772 }
6773 }
6774
6775
6791 public WikiPage[] findByN_H_S_PrevAndNext(long pageId, long nodeId,
6792 boolean head, int status, OrderByComparator orderByComparator)
6793 throws NoSuchPageException, SystemException {
6794 WikiPage wikiPage = findByPrimaryKey(pageId);
6795
6796 Session session = null;
6797
6798 try {
6799 session = openSession();
6800
6801 WikiPage[] array = new WikiPageImpl[3];
6802
6803 array[0] = getByN_H_S_PrevAndNext(session, wikiPage, nodeId, head,
6804 status, orderByComparator, true);
6805
6806 array[1] = wikiPage;
6807
6808 array[2] = getByN_H_S_PrevAndNext(session, wikiPage, nodeId, head,
6809 status, orderByComparator, false);
6810
6811 return array;
6812 }
6813 catch (Exception e) {
6814 throw processException(e);
6815 }
6816 finally {
6817 closeSession(session);
6818 }
6819 }
6820
6821 protected WikiPage getByN_H_S_PrevAndNext(Session session,
6822 WikiPage wikiPage, long nodeId, boolean head, int status,
6823 OrderByComparator orderByComparator, boolean previous) {
6824 StringBundler query = null;
6825
6826 if (orderByComparator != null) {
6827 query = new StringBundler(6 +
6828 (orderByComparator.getOrderByFields().length * 6));
6829 }
6830 else {
6831 query = new StringBundler(3);
6832 }
6833
6834 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
6835
6836 query.append(_FINDER_COLUMN_N_H_S_NODEID_2);
6837
6838 query.append(_FINDER_COLUMN_N_H_S_HEAD_2);
6839
6840 query.append(_FINDER_COLUMN_N_H_S_STATUS_2);
6841
6842 if (orderByComparator != null) {
6843 String[] orderByFields = orderByComparator.getOrderByFields();
6844
6845 if (orderByFields.length > 0) {
6846 query.append(WHERE_AND);
6847 }
6848
6849 for (int i = 0; i < orderByFields.length; i++) {
6850 query.append(_ORDER_BY_ENTITY_ALIAS);
6851 query.append(orderByFields[i]);
6852
6853 if ((i + 1) < orderByFields.length) {
6854 if (orderByComparator.isAscending() ^ previous) {
6855 query.append(WHERE_GREATER_THAN_HAS_NEXT);
6856 }
6857 else {
6858 query.append(WHERE_LESSER_THAN_HAS_NEXT);
6859 }
6860 }
6861 else {
6862 if (orderByComparator.isAscending() ^ previous) {
6863 query.append(WHERE_GREATER_THAN);
6864 }
6865 else {
6866 query.append(WHERE_LESSER_THAN);
6867 }
6868 }
6869 }
6870
6871 query.append(ORDER_BY_CLAUSE);
6872
6873 for (int i = 0; i < orderByFields.length; i++) {
6874 query.append(_ORDER_BY_ENTITY_ALIAS);
6875 query.append(orderByFields[i]);
6876
6877 if ((i + 1) < orderByFields.length) {
6878 if (orderByComparator.isAscending() ^ previous) {
6879 query.append(ORDER_BY_ASC_HAS_NEXT);
6880 }
6881 else {
6882 query.append(ORDER_BY_DESC_HAS_NEXT);
6883 }
6884 }
6885 else {
6886 if (orderByComparator.isAscending() ^ previous) {
6887 query.append(ORDER_BY_ASC);
6888 }
6889 else {
6890 query.append(ORDER_BY_DESC);
6891 }
6892 }
6893 }
6894 }
6895
6896 else {
6897 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
6898 }
6899
6900 String sql = query.toString();
6901
6902 Query q = session.createQuery(sql);
6903
6904 q.setFirstResult(0);
6905 q.setMaxResults(2);
6906
6907 QueryPos qPos = QueryPos.getInstance(q);
6908
6909 qPos.add(nodeId);
6910
6911 qPos.add(head);
6912
6913 qPos.add(status);
6914
6915 if (orderByComparator != null) {
6916 Object[] values = orderByComparator.getOrderByValues(wikiPage);
6917
6918 for (Object value : values) {
6919 qPos.add(value);
6920 }
6921 }
6922
6923 List<WikiPage> list = q.list();
6924
6925 if (list.size() == 2) {
6926 return list.get(1);
6927 }
6928 else {
6929 return null;
6930 }
6931 }
6932
6933
6943 public List<WikiPage> findByN_H_P_S(long nodeId, boolean head,
6944 String parentTitle, int status) throws SystemException {
6945 return findByN_H_P_S(nodeId, head, parentTitle, status,
6946 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
6947 }
6948
6949
6965 public List<WikiPage> findByN_H_P_S(long nodeId, boolean head,
6966 String parentTitle, int status, int start, int end)
6967 throws SystemException {
6968 return findByN_H_P_S(nodeId, head, parentTitle, status, start, end, null);
6969 }
6970
6971
6988 public List<WikiPage> findByN_H_P_S(long nodeId, boolean head,
6989 String parentTitle, int status, int start, int end,
6990 OrderByComparator orderByComparator) throws SystemException {
6991 Object[] finderArgs = new Object[] {
6992 nodeId, head, parentTitle, status,
6993
6994 String.valueOf(start), String.valueOf(end),
6995 String.valueOf(orderByComparator)
6996 };
6997
6998 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_N_H_P_S,
6999 finderArgs, this);
7000
7001 if (list == null) {
7002 StringBundler query = null;
7003
7004 if (orderByComparator != null) {
7005 query = new StringBundler(6 +
7006 (orderByComparator.getOrderByFields().length * 3));
7007 }
7008 else {
7009 query = new StringBundler(6);
7010 }
7011
7012 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
7013
7014 query.append(_FINDER_COLUMN_N_H_P_S_NODEID_2);
7015
7016 query.append(_FINDER_COLUMN_N_H_P_S_HEAD_2);
7017
7018 if (parentTitle == null) {
7019 query.append(_FINDER_COLUMN_N_H_P_S_PARENTTITLE_1);
7020 }
7021 else {
7022 if (parentTitle.equals(StringPool.BLANK)) {
7023 query.append(_FINDER_COLUMN_N_H_P_S_PARENTTITLE_3);
7024 }
7025 else {
7026 query.append(_FINDER_COLUMN_N_H_P_S_PARENTTITLE_2);
7027 }
7028 }
7029
7030 query.append(_FINDER_COLUMN_N_H_P_S_STATUS_2);
7031
7032 if (orderByComparator != null) {
7033 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
7034 orderByComparator);
7035 }
7036
7037 else {
7038 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
7039 }
7040
7041 String sql = query.toString();
7042
7043 Session session = null;
7044
7045 try {
7046 session = openSession();
7047
7048 Query q = session.createQuery(sql);
7049
7050 QueryPos qPos = QueryPos.getInstance(q);
7051
7052 qPos.add(nodeId);
7053
7054 qPos.add(head);
7055
7056 if (parentTitle != null) {
7057 qPos.add(parentTitle);
7058 }
7059
7060 qPos.add(status);
7061
7062 list = (List<WikiPage>)QueryUtil.list(q, getDialect(), start,
7063 end);
7064 }
7065 catch (Exception e) {
7066 throw processException(e);
7067 }
7068 finally {
7069 if (list == null) {
7070 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_N_H_P_S,
7071 finderArgs);
7072 }
7073 else {
7074 cacheResult(list);
7075
7076 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_N_H_P_S,
7077 finderArgs, list);
7078 }
7079
7080 closeSession(session);
7081 }
7082 }
7083
7084 return list;
7085 }
7086
7087
7103 public WikiPage findByN_H_P_S_First(long nodeId, boolean head,
7104 String parentTitle, int status, OrderByComparator orderByComparator)
7105 throws NoSuchPageException, SystemException {
7106 List<WikiPage> list = findByN_H_P_S(nodeId, head, parentTitle, status,
7107 0, 1, orderByComparator);
7108
7109 if (list.isEmpty()) {
7110 StringBundler msg = new StringBundler(10);
7111
7112 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
7113
7114 msg.append("nodeId=");
7115 msg.append(nodeId);
7116
7117 msg.append(", head=");
7118 msg.append(head);
7119
7120 msg.append(", parentTitle=");
7121 msg.append(parentTitle);
7122
7123 msg.append(", status=");
7124 msg.append(status);
7125
7126 msg.append(StringPool.CLOSE_CURLY_BRACE);
7127
7128 throw new NoSuchPageException(msg.toString());
7129 }
7130 else {
7131 return list.get(0);
7132 }
7133 }
7134
7135
7151 public WikiPage findByN_H_P_S_Last(long nodeId, boolean head,
7152 String parentTitle, int status, OrderByComparator orderByComparator)
7153 throws NoSuchPageException, SystemException {
7154 int count = countByN_H_P_S(nodeId, head, parentTitle, status);
7155
7156 List<WikiPage> list = findByN_H_P_S(nodeId, head, parentTitle, status,
7157 count - 1, count, orderByComparator);
7158
7159 if (list.isEmpty()) {
7160 StringBundler msg = new StringBundler(10);
7161
7162 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
7163
7164 msg.append("nodeId=");
7165 msg.append(nodeId);
7166
7167 msg.append(", head=");
7168 msg.append(head);
7169
7170 msg.append(", parentTitle=");
7171 msg.append(parentTitle);
7172
7173 msg.append(", status=");
7174 msg.append(status);
7175
7176 msg.append(StringPool.CLOSE_CURLY_BRACE);
7177
7178 throw new NoSuchPageException(msg.toString());
7179 }
7180 else {
7181 return list.get(0);
7182 }
7183 }
7184
7185
7202 public WikiPage[] findByN_H_P_S_PrevAndNext(long pageId, long nodeId,
7203 boolean head, String parentTitle, int status,
7204 OrderByComparator orderByComparator)
7205 throws NoSuchPageException, SystemException {
7206 WikiPage wikiPage = findByPrimaryKey(pageId);
7207
7208 Session session = null;
7209
7210 try {
7211 session = openSession();
7212
7213 WikiPage[] array = new WikiPageImpl[3];
7214
7215 array[0] = getByN_H_P_S_PrevAndNext(session, wikiPage, nodeId,
7216 head, parentTitle, status, orderByComparator, true);
7217
7218 array[1] = wikiPage;
7219
7220 array[2] = getByN_H_P_S_PrevAndNext(session, wikiPage, nodeId,
7221 head, parentTitle, status, orderByComparator, false);
7222
7223 return array;
7224 }
7225 catch (Exception e) {
7226 throw processException(e);
7227 }
7228 finally {
7229 closeSession(session);
7230 }
7231 }
7232
7233 protected WikiPage getByN_H_P_S_PrevAndNext(Session session,
7234 WikiPage wikiPage, long nodeId, boolean head, String parentTitle,
7235 int status, OrderByComparator orderByComparator, boolean previous) {
7236 StringBundler query = null;
7237
7238 if (orderByComparator != null) {
7239 query = new StringBundler(6 +
7240 (orderByComparator.getOrderByFields().length * 6));
7241 }
7242 else {
7243 query = new StringBundler(3);
7244 }
7245
7246 query.append(_SQL_SELECT_WIKIPAGE_WHERE);
7247
7248 query.append(_FINDER_COLUMN_N_H_P_S_NODEID_2);
7249
7250 query.append(_FINDER_COLUMN_N_H_P_S_HEAD_2);
7251
7252 if (parentTitle == null) {
7253 query.append(_FINDER_COLUMN_N_H_P_S_PARENTTITLE_1);
7254 }
7255 else {
7256 if (parentTitle.equals(StringPool.BLANK)) {
7257 query.append(_FINDER_COLUMN_N_H_P_S_PARENTTITLE_3);
7258 }
7259 else {
7260 query.append(_FINDER_COLUMN_N_H_P_S_PARENTTITLE_2);
7261 }
7262 }
7263
7264 query.append(_FINDER_COLUMN_N_H_P_S_STATUS_2);
7265
7266 if (orderByComparator != null) {
7267 String[] orderByFields = orderByComparator.getOrderByFields();
7268
7269 if (orderByFields.length > 0) {
7270 query.append(WHERE_AND);
7271 }
7272
7273 for (int i = 0; i < orderByFields.length; i++) {
7274 query.append(_ORDER_BY_ENTITY_ALIAS);
7275 query.append(orderByFields[i]);
7276
7277 if ((i + 1) < orderByFields.length) {
7278 if (orderByComparator.isAscending() ^ previous) {
7279 query.append(WHERE_GREATER_THAN_HAS_NEXT);
7280 }
7281 else {
7282 query.append(WHERE_LESSER_THAN_HAS_NEXT);
7283 }
7284 }
7285 else {
7286 if (orderByComparator.isAscending() ^ previous) {
7287 query.append(WHERE_GREATER_THAN);
7288 }
7289 else {
7290 query.append(WHERE_LESSER_THAN);
7291 }
7292 }
7293 }
7294
7295 query.append(ORDER_BY_CLAUSE);
7296
7297 for (int i = 0; i < orderByFields.length; i++) {
7298 query.append(_ORDER_BY_ENTITY_ALIAS);
7299 query.append(orderByFields[i]);
7300
7301 if ((i + 1) < orderByFields.length) {
7302 if (orderByComparator.isAscending() ^ previous) {
7303 query.append(ORDER_BY_ASC_HAS_NEXT);
7304 }
7305 else {
7306 query.append(ORDER_BY_DESC_HAS_NEXT);
7307 }
7308 }
7309 else {
7310 if (orderByComparator.isAscending() ^ previous) {
7311 query.append(ORDER_BY_ASC);
7312 }
7313 else {
7314 query.append(ORDER_BY_DESC);
7315 }
7316 }
7317 }
7318 }
7319
7320 else {
7321 query.append(WikiPageModelImpl.ORDER_BY_JPQL);
7322 }
7323
7324 String sql = query.toString();
7325
7326 Query q = session.createQuery(sql);
7327
7328 q.setFirstResult(0);
7329 q.setMaxResults(2);
7330
7331 QueryPos qPos = QueryPos.getInstance(q);
7332
7333 qPos.add(nodeId);
7334
7335 qPos.add(head);
7336
7337 if (parentTitle != null) {
7338 qPos.add(parentTitle);
7339 }
7340
7341 qPos.add(status);
7342
7343 if (orderByComparator != null) {
7344 Object[] values = orderByComparator.getOrderByValues(wikiPage);
7345
7346 for (Object value : values) {
7347 qPos.add(value);
7348 }
7349 }
7350
7351 List<WikiPage> list = q.list();
7352
7353 if (list.size() == 2) {
7354 return list.get(1);
7355 }
7356 else {
7357 return null;
7358 }
7359 }
7360
7361
7367 public List<WikiPage> findAll() throws SystemException {
7368 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
7369 }
7370
7371
7383 public List<WikiPage> findAll(int start, int end) throws SystemException {
7384 return findAll(start, end, null);
7385 }
7386
7387
7400 public List<WikiPage> findAll(int start, int end,
7401 OrderByComparator orderByComparator) throws SystemException {
7402 Object[] finderArgs = new Object[] {
7403 String.valueOf(start), String.valueOf(end),
7404 String.valueOf(orderByComparator)
7405 };
7406
7407 List<WikiPage> list = (List<WikiPage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
7408 finderArgs, this);
7409
7410 if (list == null) {
7411 StringBundler query = null;
7412 String sql = null;
7413
7414 if (orderByComparator != null) {
7415 query = new StringBundler(2 +
7416 (orderByComparator.getOrderByFields().length * 3));
7417
7418 query.append(_SQL_SELECT_WIKIPAGE);
7419
7420 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
7421 orderByComparator);
7422
7423 sql = query.toString();
7424 }
7425 else {
7426 sql = _SQL_SELECT_WIKIPAGE.concat(WikiPageModelImpl.ORDER_BY_JPQL);
7427 }
7428
7429 Session session = null;
7430
7431 try {
7432 session = openSession();
7433
7434 Query q = session.createQuery(sql);
7435
7436 if (orderByComparator == null) {
7437 list = (List<WikiPage>)QueryUtil.list(q, getDialect(),
7438 start, end, false);
7439
7440 Collections.sort(list);
7441 }
7442 else {
7443 list = (List<WikiPage>)QueryUtil.list(q, getDialect(),
7444 start, end);
7445 }
7446 }
7447 catch (Exception e) {
7448 throw processException(e);
7449 }
7450 finally {
7451 if (list == null) {
7452 FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL,
7453 finderArgs);
7454 }
7455 else {
7456 cacheResult(list);
7457
7458 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs,
7459 list);
7460 }
7461
7462 closeSession(session);
7463 }
7464 }
7465
7466 return list;
7467 }
7468
7469
7475 public void removeByUuid(String uuid) throws SystemException {
7476 for (WikiPage wikiPage : findByUuid(uuid)) {
7477 remove(wikiPage);
7478 }
7479 }
7480
7481
7488 public void removeByUUID_G(String uuid, long groupId)
7489 throws NoSuchPageException, SystemException {
7490 WikiPage wikiPage = findByUUID_G(uuid, groupId);
7491
7492 remove(wikiPage);
7493 }
7494
7495
7501 public void removeByNodeId(long nodeId) throws SystemException {
7502 for (WikiPage wikiPage : findByNodeId(nodeId)) {
7503 remove(wikiPage);
7504 }
7505 }
7506
7507
7513 public void removeByFormat(String format) throws SystemException {
7514 for (WikiPage wikiPage : findByFormat(format)) {
7515 remove(wikiPage);
7516 }
7517 }
7518
7519
7526 public void removeByR_N(long resourcePrimKey, long nodeId)
7527 throws SystemException {
7528 for (WikiPage wikiPage : findByR_N(resourcePrimKey, nodeId)) {
7529 remove(wikiPage);
7530 }
7531 }
7532
7533
7540 public void removeByN_T(long nodeId, String title)
7541 throws SystemException {
7542 for (WikiPage wikiPage : findByN_T(nodeId, title)) {
7543 remove(wikiPage);
7544 }
7545 }
7546
7547
7554 public void removeByN_H(long nodeId, boolean head)
7555 throws SystemException {
7556 for (WikiPage wikiPage : findByN_H(nodeId, head)) {
7557 remove(wikiPage);
7558 }
7559 }
7560
7561
7568 public void removeByN_P(long nodeId, String parentTitle)
7569 throws SystemException {
7570 for (WikiPage wikiPage : findByN_P(nodeId, parentTitle)) {
7571 remove(wikiPage);
7572 }
7573 }
7574
7575
7582 public void removeByN_R(long nodeId, String redirectTitle)
7583 throws SystemException {
7584 for (WikiPage wikiPage : findByN_R(nodeId, redirectTitle)) {
7585 remove(wikiPage);
7586 }
7587 }
7588
7589
7596 public void removeByN_S(long nodeId, int status) throws SystemException {
7597 for (WikiPage wikiPage : findByN_S(nodeId, status)) {
7598 remove(wikiPage);
7599 }
7600 }
7601
7602
7610 public void removeByR_N_V(long resourcePrimKey, long nodeId, double version)
7611 throws NoSuchPageException, SystemException {
7612 WikiPage wikiPage = findByR_N_V(resourcePrimKey, nodeId, version);
7613
7614 remove(wikiPage);
7615 }
7616
7617
7625 public void removeByR_N_S(long resourcePrimKey, long nodeId, int status)
7626 throws SystemException {
7627 for (WikiPage wikiPage : findByR_N_S(resourcePrimKey, nodeId, status)) {
7628 remove(wikiPage);
7629 }
7630 }
7631
7632
7640 public void removeByU_N_S(long userId, long nodeId, int status)
7641 throws SystemException {
7642 for (WikiPage wikiPage : findByU_N_S(userId, nodeId, status)) {
7643 remove(wikiPage);
7644 }
7645 }
7646
7647
7655 public void removeByN_T_V(long nodeId, String title, double version)
7656 throws NoSuchPageException, SystemException {
7657 WikiPage wikiPage = findByN_T_V(nodeId, title, version);
7658
7659 remove(wikiPage);
7660 }
7661
7662
7670 public void removeByN_T_H(long nodeId, String title, boolean head)
7671 throws SystemException {
7672 for (WikiPage wikiPage : findByN_T_H(nodeId, title, head)) {
7673 remove(wikiPage);
7674 }
7675 }
7676
7677
7685 public void removeByN_T_S(long nodeId, String title, int status)
7686 throws SystemException {
7687 for (WikiPage wikiPage : findByN_T_S(nodeId, title, status)) {
7688 remove(wikiPage);
7689 }
7690 }
7691
7692
7700 public void removeByN_H_P(long nodeId, boolean head, String parentTitle)
7701 throws SystemException {
7702 for (WikiPage wikiPage : findByN_H_P(nodeId, head, parentTitle)) {
7703 remove(wikiPage);
7704 }
7705 }
7706
7707
7715 public void removeByN_H_S(long nodeId, boolean head, int status)
7716 throws SystemException {
7717 for (WikiPage wikiPage : findByN_H_S(nodeId, head, status)) {
7718 remove(wikiPage);
7719 }
7720 }
7721
7722
7731 public void removeByN_H_P_S(long nodeId, boolean head, String parentTitle,
7732 int status) throws SystemException {
7733 for (WikiPage wikiPage : findByN_H_P_S(nodeId, head, parentTitle, status)) {
7734 remove(wikiPage);
7735 }
7736 }
7737
7738
7743 public void removeAll() throws SystemException {
7744 for (WikiPage wikiPage : findAll()) {
7745 remove(wikiPage);
7746 }
7747 }
7748
7749
7756 public int countByUuid(String uuid) throws SystemException {
7757 Object[] finderArgs = new Object[] { uuid };
7758
7759 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
7760 finderArgs, this);
7761
7762 if (count == null) {
7763 StringBundler query = new StringBundler(2);
7764
7765 query.append(_SQL_COUNT_WIKIPAGE_WHERE);
7766
7767 if (uuid == null) {
7768 query.append(_FINDER_COLUMN_UUID_UUID_1);
7769 }
7770 else {
7771 if (uuid.equals(StringPool.BLANK)) {
7772 query.append(_FINDER_COLUMN_UUID_UUID_3);
7773 }
7774 else {
7775 query.append(_FINDER_COLUMN_UUID_UUID_2);
7776 }
7777 }
7778
7779 String sql = query.toString();
7780
7781 Session session = null;
7782
7783 try {
7784 session = openSession();
7785
7786 Query q = session.createQuery(sql);
7787
7788 QueryPos qPos = QueryPos.getInstance(q);
7789
7790 if (uuid != null) {
7791 qPos.add(uuid);
7792 }
7793
7794 count = (Long)q.uniqueResult();
7795 }
7796 catch (Exception e) {
7797 throw processException(e);
7798 }
7799 finally {
7800 if (count == null) {
7801 count = Long.valueOf(0);
7802 }
7803
7804 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
7805 finderArgs, count);
7806
7807 closeSession(session);
7808 }
7809 }
7810
7811 return count.intValue();
7812 }
7813
7814
7822 public int countByUUID_G(String uuid, long groupId)
7823 throws SystemException {
7824 Object[] finderArgs = new Object[] { uuid, groupId };
7825
7826 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
7827 finderArgs, this);
7828
7829 if (count == null) {
7830 StringBundler query = new StringBundler(3);
7831
7832 query.append(_SQL_COUNT_WIKIPAGE_WHERE);
7833
7834 if (uuid == null) {
7835 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
7836 }
7837 else {
7838 if (uuid.equals(StringPool.BLANK)) {
7839 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
7840 }
7841 else {
7842 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
7843 }
7844 }
7845
7846 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
7847
7848 String sql = query.toString();
7849
7850 Session session = null;
7851
7852 try {
7853 session = openSession();
7854
7855 Query q = session.createQuery(sql);
7856
7857 QueryPos qPos = QueryPos.getInstance(q);
7858
7859 if (uuid != null) {
7860 qPos.add(uuid);
7861 }
7862
7863 qPos.add(groupId);
7864
7865 count = (Long)q.uniqueResult();
7866 }
7867 catch (Exception e) {
7868 throw processException(e);
7869 }
7870 finally {
7871 if (count == null) {
7872 count = Long.valueOf(0);
7873 }
7874
7875 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
7876 finderArgs, count);
7877
7878 closeSession(session);
7879 }
7880 }
7881
7882 return count.intValue();
7883 }
7884
7885
7892 public int countByNodeId(long nodeId) throws SystemException {
7893 Object[] finderArgs = new Object[] { nodeId };
7894
7895 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_NODEID,
7896 finderArgs, this);
7897
7898 if (count == null) {
7899 StringBundler query = new StringBundler(2);
7900
7901 query.append(_SQL_COUNT_WIKIPAGE_WHERE);
7902
7903 query.append(_FINDER_COLUMN_NODEID_NODEID_2);
7904
7905 String sql = query.toString();
7906
7907 Session session = null;
7908
7909 try {
7910 session = openSession();
7911
7912 Query q = session.createQuery(sql);
7913
7914 QueryPos qPos = QueryPos.getInstance(q);
7915
7916 qPos.add(nodeId);
7917
7918 count = (Long)q.uniqueResult();
7919 }
7920 catch (Exception e) {
7921 throw processException(e);
7922 }
7923 finally {
7924 if (count == null) {
7925 count = Long.valueOf(0);
7926 }
7927
7928 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_NODEID,
7929 finderArgs, count);
7930
7931 closeSession(session);
7932 }
7933 }
7934
7935 return count.intValue();
7936 }
7937
7938
7945 public int countByFormat(String format) throws SystemException {
7946 Object[] finderArgs = new Object[] { format };
7947
7948 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_FORMAT,
7949 finderArgs, this);
7950
7951 if (count == null) {
7952 StringBundler query = new StringBundler(2);
7953
7954 query.append(_SQL_COUNT_WIKIPAGE_WHERE);
7955
7956 if (format == null) {
7957 query.append(_FINDER_COLUMN_FORMAT_FORMAT_1);
7958 }
7959 else {
7960 if (format.equals(StringPool.BLANK)) {
7961 query.append(_FINDER_COLUMN_FORMAT_FORMAT_3);
7962 }
7963 else {
7964 query.append(_FINDER_COLUMN_FORMAT_FORMAT_2);
7965 }
7966 }
7967
7968 String sql = query.toString();
7969
7970 Session session = null;
7971
7972 try {
7973 session = openSession();
7974
7975 Query q = session.createQuery(sql);
7976
7977 QueryPos qPos = QueryPos.getInstance(q);
7978
7979 if (format != null) {
7980 qPos.add(format);
7981 }
7982
7983 count = (Long)q.uniqueResult();
7984 }
7985 catch (Exception e) {
7986 throw processException(e);
7987 }
7988 finally {
7989 if (count == null) {
7990 count = Long.valueOf(0);
7991 }
7992
7993 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_FORMAT,
7994 finderArgs, count);
7995
7996 closeSession(session);
7997 }
7998 }
7999
8000 return count.intValue();
8001 }
8002
8003
8011 public int countByR_N(long resourcePrimKey, long nodeId)
8012 throws SystemException {
8013 Object[] finderArgs = new Object[] { resourcePrimKey, nodeId };
8014
8015 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_R_N,
8016 finderArgs, this);
8017
8018 if (count == null) {
8019 StringBundler query = new StringBundler(3);
8020
8021 query.append(_SQL_COUNT_WIKIPAGE_WHERE);
8022
8023 query.append(_FINDER_COLUMN_R_N_RESOURCEPRIMKEY_2);
8024
8025 query.append(_FINDER_COLUMN_R_N_NODEID_2);
8026
8027 String sql = query.toString();
8028
8029 Session session = null;
8030
8031 try {
8032 session = openSession();
8033
8034 Query q = session.createQuery(sql);
8035
8036 QueryPos qPos = QueryPos.getInstance(q);
8037
8038 qPos.add(resourcePrimKey);
8039
8040 qPos.add(nodeId);
8041
8042 count = (Long)q.uniqueResult();
8043 }
8044 catch (Exception e) {
8045 throw processException(e);
8046 }
8047 finally {
8048 if (count == null) {
8049 count = Long.valueOf(0);
8050 }
8051
8052 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_R_N, finderArgs,
8053 count);
8054
8055 closeSession(session);
8056 }
8057 }
8058
8059 return count.intValue();
8060 }
8061
8062
8070 public int countByN_T(long nodeId, String title) throws SystemException {
8071 Object[] finderArgs = new Object[] { nodeId, title };
8072
8073 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_N_T,
8074 finderArgs, this);
8075
8076 if (count == null) {
8077 StringBundler query = new StringBundler(3);
8078
8079 query.append(_SQL_COUNT_WIKIPAGE_WHERE);
8080
8081 query.append(_FINDER_COLUMN_N_T_NODEID_2);
8082
8083 if (title == null) {
8084 query.append(_FINDER_COLUMN_N_T_TITLE_1);
8085 }
8086 else {
8087 if (title.equals(StringPool.BLANK)) {
8088 query.append(_FINDER_COLUMN_N_T_TITLE_3);
8089 }
8090 else {
8091 query.append(_FINDER_COLUMN_N_T_TITLE_2);
8092 }
8093 }
8094
8095 String sql = query.toString();
8096
8097 Session session = null;
8098
8099 try {
8100 session = openSession();
8101
8102 Query q = session.createQuery(sql);
8103
8104 QueryPos qPos = QueryPos.getInstance(q);
8105
8106 qPos.add(nodeId);
8107
8108 if (title != null) {
8109 qPos.add(title);
8110 }
8111
8112 count = (Long)q.uniqueResult();
8113 }
8114 catch (Exception e) {
8115 throw processException(e);
8116 }
8117 finally {
8118 if (count == null) {
8119 count = Long.valueOf(0);
8120 }
8121
8122 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_N_T, finderArgs,
8123 count);
8124
8125 closeSession(session);
8126 }
8127 }
8128
8129 return count.intValue();
8130 }
8131
8132
8140 public int countByN_H(long nodeId, boolean head) throws SystemException {
8141 Object[] finderArgs = new Object[] { nodeId, head };
8142
8143 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_N_H,
8144 finderArgs, this);
8145
8146 if (count == null) {
8147 StringBundler query = new StringBundler(3);
8148
8149 query.append(_SQL_COUNT_WIKIPAGE_WHERE);
8150
8151 query.append(_FINDER_COLUMN_N_H_NODEID_2);
8152
8153 query.append(_FINDER_COLUMN_N_H_HEAD_2);
8154
8155 String sql = query.toString();
8156
8157 Session session = null;
8158
8159 try {
8160 session = openSession();
8161
8162 Query q = session.createQuery(sql);
8163
8164 QueryPos qPos = QueryPos.getInstance(q);
8165
8166 qPos.add(nodeId);
8167
8168 qPos.add(head);
8169
8170 count = (Long)q.uniqueResult();
8171 }
8172 catch (Exception e) {
8173 throw processException(e);
8174 }
8175 finally {
8176 if (count == null) {
8177 count = Long.valueOf(0);
8178 }
8179
8180 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_N_H, finderArgs,
8181 count);
8182
8183 closeSession(session);
8184 }
8185 }
8186
8187 return count.intValue();
8188 }
8189
8190
8198 public int countByN_P(long nodeId, String parentTitle)
8199 throws SystemException {
8200 Object[] finderArgs = new Object[] { nodeId, parentTitle };
8201
8202 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_N_P,
8203 finderArgs, this);
8204
8205 if (count == null) {
8206 StringBundler query = new StringBundler(3);
8207
8208 query.append(_SQL_COUNT_WIKIPAGE_WHERE);
8209
8210 query.append(_FINDER_COLUMN_N_P_NODEID_2);
8211
8212 if (parentTitle == null) {
8213 query.append(_FINDER_COLUMN_N_P_PARENTTITLE_1);
8214 }
8215 else {
8216 if (parentTitle.equals(StringPool.BLANK)) {
8217 query.append(_FINDER_COLUMN_N_P_PARENTTITLE_3);
8218 }
8219 else {
8220 query.append(_FINDER_COLUMN_N_P_PARENTTITLE_2);
8221 }
8222 }
8223
8224 String sql = query.toString();
8225
8226 Session session = null;
8227
8228 try {
8229 session = openSession();
8230
8231 Query q = session.createQuery(sql);
8232
8233 QueryPos qPos = QueryPos.getInstance(q);
8234
8235 qPos.add(nodeId);
8236
8237 if (parentTitle != null) {
8238 qPos.add(parentTitle);
8239 }
8240
8241 count = (Long)q.uniqueResult();
8242 }
8243 catch (Exception e) {
8244 throw processException(e);
8245 }
8246 finally {
8247 if (count == null) {
8248 count = Long.valueOf(0);
8249 }
8250
8251 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_N_P, finderArgs,
8252 count);
8253
8254 closeSession(session);
8255 }
8256 }
8257
8258 return count.intValue();
8259 }
8260
8261
8269 public int countByN_R(long nodeId, String redirectTitle)
8270 throws SystemException {
8271 Object[] finderArgs = new Object[] { nodeId, redirectTitle };
8272
8273 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_N_R,
8274 finderArgs, this);
8275
8276 if (count == null) {
8277 StringBundler query = new StringBundler(3);
8278
8279 query.append(_SQL_COUNT_WIKIPAGE_WHERE);
8280
8281 query.append(_FINDER_COLUMN_N_R_NODEID_2);
8282
8283 if (redirectTitle == null) {
8284 query.append(_FINDER_COLUMN_N_R_REDIRECTTITLE_1);
8285 }
8286 else {
8287 if (redirectTitle.equals(StringPool.BLANK)) {
8288 query.append(_FINDER_COLUMN_N_R_REDIRECTTITLE_3);
8289 }
8290 else {
8291 query.append(_FINDER_COLUMN_N_R_REDIRECTTITLE_2);
8292 }
8293 }
8294
8295 String sql = query.toString();
8296
8297 Session session = null;
8298
8299 try {
8300 session = openSession();
8301
8302 Query q = session.createQuery(sql);
8303
8304 QueryPos qPos = QueryPos.getInstance(q);
8305
8306 qPos.add(nodeId);
8307
8308 if (redirectTitle != null) {
8309 qPos.add(redirectTitle);
8310 }
8311
8312 count = (Long)q.uniqueResult();
8313 }
8314 catch (Exception e) {
8315 throw processException(e);
8316 }
8317 finally {
8318 if (count == null) {
8319 count = Long.valueOf(0);
8320 }
8321
8322 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_N_R, finderArgs,
8323 count);
8324
8325 closeSession(session);
8326 }
8327 }
8328
8329 return count.intValue();
8330 }
8331
8332
8340 public int countByN_S(long nodeId, int status) throws SystemException {
8341 Object[] finderArgs = new Object[] { nodeId, status };
8342
8343 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_N_S,
8344 finderArgs, this);
8345
8346 if (count == null) {
8347 StringBundler query = new StringBundler(3);
8348
8349 query.append(_SQL_COUNT_WIKIPAGE_WHERE);
8350
8351 query.append(_FINDER_COLUMN_N_S_NODEID_2);
8352
8353 query.append(_FINDER_COLUMN_N_S_STATUS_2);
8354
8355 String sql = query.toString();
8356
8357 Session session = null;
8358
8359 try {
8360 session = openSession();
8361
8362 Query q = session.createQuery(sql);
8363
8364 QueryPos qPos = QueryPos.getInstance(q);
8365
8366 qPos.add(nodeId);
8367
8368 qPos.add(status);
8369
8370 count = (Long)q.uniqueResult();
8371 }
8372 catch (Exception e) {
8373 throw processException(e);
8374 }
8375 finally {
8376 if (count == null) {
8377 count = Long.valueOf(0);
8378 }
8379
8380 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_N_S, finderArgs,
8381 count);
8382
8383 closeSession(session);
8384 }
8385 }
8386
8387 return count.intValue();
8388 }
8389
8390
8399 public int countByR_N_V(long resourcePrimKey, long nodeId, double version)
8400 throws SystemException {
8401 Object[] finderArgs = new Object[] { resourcePrimKey, nodeId, version };
8402
8403 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_R_N_V,
8404 finderArgs, this);
8405
8406 if (count == null) {
8407 StringBundler query = new StringBundler(4);
8408
8409 query.append(_SQL_COUNT_WIKIPAGE_WHERE);
8410
8411 query.append(_FINDER_COLUMN_R_N_V_RESOURCEPRIMKEY_2);
8412
8413 query.append(_FINDER_COLUMN_R_N_V_NODEID_2);
8414
8415 query.append(_FINDER_COLUMN_R_N_V_VERSION_2);
8416
8417 String sql = query.toString();
8418
8419 Session session = null;
8420
8421 try {
8422 session = openSession();
8423
8424 Query q = session.createQuery(sql);
8425
8426 QueryPos qPos = QueryPos.getInstance(q);
8427
8428 qPos.add(resourcePrimKey);
8429
8430 qPos.add(nodeId);
8431
8432 qPos.add(version);
8433
8434 count = (Long)q.uniqueResult();
8435 }
8436 catch (Exception e) {
8437 throw processException(e);
8438 }
8439 finally {
8440 if (count == null) {
8441 count = Long.valueOf(0);
8442 }
8443
8444 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_R_N_V,
8445 finderArgs, count);
8446
8447 closeSession(session);
8448 }
8449 }
8450
8451 return count.intValue();
8452 }
8453
8454
8463 public int countByR_N_S(long resourcePrimKey, long nodeId, int status)
8464 throws SystemException {
8465 Object[] finderArgs = new Object[] { resourcePrimKey, nodeId, status };
8466
8467 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_R_N_S,
8468 finderArgs, this);
8469
8470 if (count == null) {
8471 StringBundler query = new StringBundler(4);
8472
8473 query.append(_SQL_COUNT_WIKIPAGE_WHERE);
8474
8475 query.append(_FINDER_COLUMN_R_N_S_RESOURCEPRIMKEY_2);
8476
8477 query.append(_FINDER_COLUMN_R_N_S_NODEID_2);
8478
8479 query.append(_FINDER_COLUMN_R_N_S_STATUS_2);
8480
8481 String sql = query.toString();
8482
8483 Session session = null;
8484
8485 try {
8486 session = openSession();
8487
8488 Query q = session.createQuery(sql);
8489
8490 QueryPos qPos = QueryPos.getInstance(q);
8491
8492 qPos.add(resourcePrimKey);
8493
8494 qPos.add(nodeId);
8495
8496 qPos.add(status);
8497
8498 count = (Long)q.uniqueResult();
8499 }
8500 catch (Exception e) {
8501 throw processException(e);
8502 }
8503 finally {
8504 if (count == null) {
8505 count = Long.valueOf(0);
8506 }
8507
8508 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_R_N_S,
8509 finderArgs, count);
8510
8511 closeSession(session);
8512 }
8513 }
8514
8515 return count.intValue();
8516 }
8517
8518
8527 public int countByU_N_S(long userId, long nodeId, int status)
8528 throws SystemException {
8529 Object[] finderArgs = new Object[] { userId, nodeId, status };
8530
8531 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U_N_S,
8532 finderArgs, this);
8533
8534 if (count == null) {
8535 StringBundler query = new StringBundler(4);
8536
8537 query.append(_SQL_COUNT_WIKIPAGE_WHERE);
8538
8539 query.append(_FINDER_COLUMN_U_N_S_USERID_2);
8540
8541 query.append(_FINDER_COLUMN_U_N_S_NODEID_2);
8542
8543 query.append(_FINDER_COLUMN_U_N_S_STATUS_2);
8544
8545 String sql = query.toString();
8546
8547 Session session = null;
8548
8549 try {
8550 session = openSession();
8551
8552 Query q = session.createQuery(sql);
8553
8554 QueryPos qPos = QueryPos.getInstance(q);
8555
8556 qPos.add(userId);
8557
8558 qPos.add(nodeId);
8559
8560 qPos.add(status);
8561
8562 count = (Long)q.uniqueResult();
8563 }
8564 catch (Exception e) {
8565 throw processException(e);
8566 }
8567 finally {
8568 if (count == null) {
8569 count = Long.valueOf(0);
8570 }
8571
8572 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_N_S,
8573 finderArgs, count);
8574
8575 closeSession(session);
8576 }
8577 }
8578
8579 return count.intValue();
8580 }
8581
8582
8591 public int countByN_T_V(long nodeId, String title, double version)
8592 throws SystemException {
8593 Object[] finderArgs = new Object[] { nodeId, title, version };
8594
8595 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_N_T_V,
8596 finderArgs, this);
8597
8598 if (count == null) {
8599 StringBundler query = new StringBundler(4);
8600
8601 query.append(_SQL_COUNT_WIKIPAGE_WHERE);
8602
8603 query.append(_FINDER_COLUMN_N_T_V_NODEID_2);
8604
8605 if (title == null) {
8606 query.append(_FINDER_COLUMN_N_T_V_TITLE_1);
8607 }
8608 else {
8609 if (title.equals(StringPool.BLANK)) {
8610 query.append(_FINDER_COLUMN_N_T_V_TITLE_3);
8611 }
8612 else {
8613 query.append(_FINDER_COLUMN_N_T_V_TITLE_2);
8614 }
8615 }
8616
8617 query.append(_FINDER_COLUMN_N_T_V_VERSION_2);
8618
8619 String sql = query.toString();
8620
8621 Session session = null;
8622
8623 try {
8624 session = openSession();
8625
8626 Query q = session.createQuery(sql);
8627
8628 QueryPos qPos = QueryPos.getInstance(q);
8629
8630 qPos.add(nodeId);
8631
8632 if (title != null) {
8633 qPos.add(title);
8634 }
8635
8636 qPos.add(version);
8637
8638 count = (Long)q.uniqueResult();
8639 }
8640 catch (Exception e) {
8641 throw processException(e);
8642 }
8643 finally {
8644 if (count == null) {
8645 count = Long.valueOf(0);
8646 }
8647
8648 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_N_T_V,
8649 finderArgs, count);
8650
8651 closeSession(session);
8652 }
8653 }
8654
8655 return count.intValue();
8656 }
8657
8658
8667 public int countByN_T_H(long nodeId, String title, boolean head)
8668 throws SystemException {
8669 Object[] finderArgs = new Object[] { nodeId, title, head };
8670
8671 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_N_T_H,
8672 finderArgs, this);
8673
8674 if (count == null) {
8675 StringBundler query = new StringBundler(4);
8676
8677 query.append(_SQL_COUNT_WIKIPAGE_WHERE);
8678
8679 query.append(_FINDER_COLUMN_N_T_H_NODEID_2);
8680
8681 if (title == null) {
8682 query.append(_FINDER_COLUMN_N_T_H_TITLE_1);
8683 }
8684 else {
8685 if (title.equals(StringPool.BLANK)) {
8686 query.append(_FINDER_COLUMN_N_T_H_TITLE_3);
8687 }
8688 else {
8689 query.append(_FINDER_COLUMN_N_T_H_TITLE_2);
8690 }
8691 }
8692
8693 query.append(_FINDER_COLUMN_N_T_H_HEAD_2);
8694
8695 String sql = query.toString();
8696
8697 Session session = null;
8698
8699 try {
8700 session = openSession();
8701
8702 Query q = session.createQuery(sql);
8703
8704 QueryPos qPos = QueryPos.getInstance(q);
8705
8706 qPos.add(nodeId);
8707
8708 if (title != null) {
8709 qPos.add(title);
8710 }
8711
8712 qPos.add(head);
8713
8714 count = (Long)q.uniqueResult();
8715 }
8716 catch (Exception e) {
8717 throw processException(e);
8718 }
8719 finally {
8720 if (count == null) {
8721 count = Long.valueOf(0);
8722 }
8723
8724 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_N_T_H,
8725 finderArgs, count);
8726
8727 closeSession(session);
8728 }
8729 }
8730
8731 return count.intValue();
8732 }
8733
8734
8743 public int countByN_T_S(long nodeId, String title, int status)
8744 throws SystemException {
8745 Object[] finderArgs = new Object[] { nodeId, title, status };
8746
8747 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_N_T_S,
8748 finderArgs, this);
8749
8750 if (count == null) {
8751 StringBundler query = new StringBundler(4);
8752
8753 query.append(_SQL_COUNT_WIKIPAGE_WHERE);
8754
8755 query.append(_FINDER_COLUMN_N_T_S_NODEID_2);
8756
8757 if (title == null) {
8758 query.append(_FINDER_COLUMN_N_T_S_TITLE_1);
8759 }
8760 else {
8761 if (title.equals(StringPool.BLANK)) {
8762 query.append(_FINDER_COLUMN_N_T_S_TITLE_3);
8763 }
8764 else {
8765 query.append(_FINDER_COLUMN_N_T_S_TITLE_2);
8766 }
8767 }
8768
8769 query.append(_FINDER_COLUMN_N_T_S_STATUS_2);
8770
8771 String sql = query.toString();
8772
8773 Session session = null;
8774
8775 try {
8776 session = openSession();
8777
8778 Query q = session.createQuery(sql);
8779
8780 QueryPos qPos = QueryPos.getInstance(q);
8781
8782 qPos.add(nodeId);
8783
8784 if (title != null) {
8785 qPos.add(title);
8786 }
8787
8788 qPos.add(status);
8789
8790 count = (Long)q.uniqueResult();
8791 }
8792 catch (Exception e) {
8793 throw processException(e);
8794 }
8795 finally {
8796 if (count == null) {
8797 count = Long.valueOf(0);
8798 }
8799
8800 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_N_T_S,
8801 finderArgs, count);
8802
8803 closeSession(session);
8804 }
8805 }
8806
8807 return count.intValue();
8808 }
8809
8810
8819 public int countByN_H_P(long nodeId, boolean head, String parentTitle)
8820 throws SystemException {
8821 Object[] finderArgs = new Object[] { nodeId, head, parentTitle };
8822
8823 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_N_H_P,
8824 finderArgs, this);
8825
8826 if (count == null) {
8827 StringBundler query = new StringBundler(4);
8828
8829 query.append(_SQL_COUNT_WIKIPAGE_WHERE);
8830
8831 query.append(_FINDER_COLUMN_N_H_P_NODEID_2);
8832
8833 query.append(_FINDER_COLUMN_N_H_P_HEAD_2);
8834
8835 if (parentTitle == null) {
8836 query.append(_FINDER_COLUMN_N_H_P_PARENTTITLE_1);
8837 }
8838 else {
8839 if (parentTitle.equals(StringPool.BLANK)) {
8840 query.append(_FINDER_COLUMN_N_H_P_PARENTTITLE_3);
8841 }
8842 else {
8843 query.append(_FINDER_COLUMN_N_H_P_PARENTTITLE_2);
8844 }
8845 }
8846
8847 String sql = query.toString();
8848
8849 Session session = null;
8850
8851 try {
8852 session = openSession();
8853
8854 Query q = session.createQuery(sql);
8855
8856 QueryPos qPos = QueryPos.getInstance(q);
8857
8858 qPos.add(nodeId);
8859
8860 qPos.add(head);
8861
8862 if (parentTitle != null) {
8863 qPos.add(parentTitle);
8864 }
8865
8866 count = (Long)q.uniqueResult();
8867 }
8868 catch (Exception e) {
8869 throw processException(e);
8870 }
8871 finally {
8872 if (count == null) {
8873 count = Long.valueOf(0);
8874 }
8875
8876 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_N_H_P,
8877 finderArgs, count);
8878
8879 closeSession(session);
8880 }
8881 }
8882
8883 return count.intValue();
8884 }
8885
8886
8895 public int countByN_H_S(long nodeId, boolean head, int status)
8896 throws SystemException {
8897 Object[] finderArgs = new Object[] { nodeId, head, status };
8898
8899 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_N_H_S,
8900 finderArgs, this);
8901
8902 if (count == null) {
8903 StringBundler query = new StringBundler(4);
8904
8905 query.append(_SQL_COUNT_WIKIPAGE_WHERE);
8906
8907 query.append(_FINDER_COLUMN_N_H_S_NODEID_2);
8908
8909 query.append(_FINDER_COLUMN_N_H_S_HEAD_2);
8910
8911 query.append(_FINDER_COLUMN_N_H_S_STATUS_2);
8912
8913 String sql = query.toString();
8914
8915 Session session = null;
8916
8917 try {
8918 session = openSession();
8919
8920 Query q = session.createQuery(sql);
8921
8922 QueryPos qPos = QueryPos.getInstance(q);
8923
8924 qPos.add(nodeId);
8925
8926 qPos.add(head);
8927
8928 qPos.add(status);
8929
8930 count = (Long)q.uniqueResult();
8931 }
8932 catch (Exception e) {
8933 throw processException(e);
8934 }
8935 finally {
8936 if (count == null) {
8937 count = Long.valueOf(0);
8938 }
8939
8940 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_N_H_S,
8941 finderArgs, count);
8942
8943 closeSession(session);
8944 }
8945 }
8946
8947 return count.intValue();
8948 }
8949
8950
8960 public int countByN_H_P_S(long nodeId, boolean head, String parentTitle,
8961 int status) throws SystemException {
8962 Object[] finderArgs = new Object[] { nodeId, head, parentTitle, status };
8963
8964 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_N_H_P_S,
8965 finderArgs, this);
8966
8967 if (count == null) {
8968 StringBundler query = new StringBundler(5);
8969
8970 query.append(_SQL_COUNT_WIKIPAGE_WHERE);
8971
8972 query.append(_FINDER_COLUMN_N_H_P_S_NODEID_2);
8973
8974 query.append(_FINDER_COLUMN_N_H_P_S_HEAD_2);
8975
8976 if (parentTitle == null) {
8977 query.append(_FINDER_COLUMN_N_H_P_S_PARENTTITLE_1);
8978 }
8979 else {
8980 if (parentTitle.equals(StringPool.BLANK)) {
8981 query.append(_FINDER_COLUMN_N_H_P_S_PARENTTITLE_3);
8982 }
8983 else {
8984 query.append(_FINDER_COLUMN_N_H_P_S_PARENTTITLE_2);
8985 }
8986 }
8987
8988 query.append(_FINDER_COLUMN_N_H_P_S_STATUS_2);
8989
8990 String sql = query.toString();
8991
8992 Session session = null;
8993
8994 try {
8995 session = openSession();
8996
8997 Query q = session.createQuery(sql);
8998
8999 QueryPos qPos = QueryPos.getInstance(q);
9000
9001 qPos.add(nodeId);
9002
9003 qPos.add(head);
9004
9005 if (parentTitle != null) {
9006 qPos.add(parentTitle);
9007 }
9008
9009 qPos.add(status);
9010
9011 count = (Long)q.uniqueResult();
9012 }
9013 catch (Exception e) {
9014 throw processException(e);
9015 }
9016 finally {
9017 if (count == null) {
9018 count = Long.valueOf(0);
9019 }
9020
9021 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_N_H_P_S,
9022 finderArgs, count);
9023
9024 closeSession(session);
9025 }
9026 }
9027
9028 return count.intValue();
9029 }
9030
9031
9037 public int countAll() throws SystemException {
9038 Object[] finderArgs = new Object[0];
9039
9040 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
9041 finderArgs, this);
9042
9043 if (count == null) {
9044 Session session = null;
9045
9046 try {
9047 session = openSession();
9048
9049 Query q = session.createQuery(_SQL_COUNT_WIKIPAGE);
9050
9051 count = (Long)q.uniqueResult();
9052 }
9053 catch (Exception e) {
9054 throw processException(e);
9055 }
9056 finally {
9057 if (count == null) {
9058 count = Long.valueOf(0);
9059 }
9060
9061 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
9062 count);
9063
9064 closeSession(session);
9065 }
9066 }
9067
9068 return count.intValue();
9069 }
9070
9071
9074 public void afterPropertiesSet() {
9075 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
9076 com.liferay.portal.util.PropsUtil.get(
9077 "value.object.listener.com.liferay.portlet.wiki.model.WikiPage")));
9078
9079 if (listenerClassNames.length > 0) {
9080 try {
9081 List<ModelListener<WikiPage>> listenersList = new ArrayList<ModelListener<WikiPage>>();
9082
9083 for (String listenerClassName : listenerClassNames) {
9084 listenersList.add((ModelListener<WikiPage>)InstanceFactory.newInstance(
9085 listenerClassName));
9086 }
9087
9088 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
9089 }
9090 catch (Exception e) {
9091 _log.error(e);
9092 }
9093 }
9094 }
9095
9096 public void destroy() {
9097 EntityCacheUtil.removeCache(WikiPageImpl.class.getName());
9098 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
9099 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
9100 }
9101
9102 @BeanReference(type = WikiNodePersistence.class)
9103 protected WikiNodePersistence wikiNodePersistence;
9104 @BeanReference(type = WikiPagePersistence.class)
9105 protected WikiPagePersistence wikiPagePersistence;
9106 @BeanReference(type = WikiPageResourcePersistence.class)
9107 protected WikiPageResourcePersistence wikiPageResourcePersistence;
9108 @BeanReference(type = CompanyPersistence.class)
9109 protected CompanyPersistence companyPersistence;
9110 @BeanReference(type = GroupPersistence.class)
9111 protected GroupPersistence groupPersistence;
9112 @BeanReference(type = PortletPreferencesPersistence.class)
9113 protected PortletPreferencesPersistence portletPreferencesPersistence;
9114 @BeanReference(type = ResourcePersistence.class)
9115 protected ResourcePersistence resourcePersistence;
9116 @BeanReference(type = SubscriptionPersistence.class)
9117 protected SubscriptionPersistence subscriptionPersistence;
9118 @BeanReference(type = UserPersistence.class)
9119 protected UserPersistence userPersistence;
9120 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
9121 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
9122 @BeanReference(type = AssetCategoryPersistence.class)
9123 protected AssetCategoryPersistence assetCategoryPersistence;
9124 @BeanReference(type = AssetEntryPersistence.class)
9125 protected AssetEntryPersistence assetEntryPersistence;
9126 @BeanReference(type = AssetTagPersistence.class)
9127 protected AssetTagPersistence assetTagPersistence;
9128 @BeanReference(type = ExpandoValuePersistence.class)
9129 protected ExpandoValuePersistence expandoValuePersistence;
9130 @BeanReference(type = MBMessagePersistence.class)
9131 protected MBMessagePersistence mbMessagePersistence;
9132 @BeanReference(type = SocialActivityPersistence.class)
9133 protected SocialActivityPersistence socialActivityPersistence;
9134 @BeanReference(type = SocialEquityLogPersistence.class)
9135 protected SocialEquityLogPersistence socialEquityLogPersistence;
9136 private static final String _SQL_SELECT_WIKIPAGE = "SELECT wikiPage FROM WikiPage wikiPage";
9137 private static final String _SQL_SELECT_WIKIPAGE_WHERE = "SELECT wikiPage FROM WikiPage wikiPage WHERE ";
9138 private static final String _SQL_COUNT_WIKIPAGE = "SELECT COUNT(wikiPage) FROM WikiPage wikiPage";
9139 private static final String _SQL_COUNT_WIKIPAGE_WHERE = "SELECT COUNT(wikiPage) FROM WikiPage wikiPage WHERE ";
9140 private static final String _FINDER_COLUMN_UUID_UUID_1 = "wikiPage.uuid IS NULL";
9141 private static final String _FINDER_COLUMN_UUID_UUID_2 = "wikiPage.uuid = ?";
9142 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(wikiPage.uuid IS NULL OR wikiPage.uuid = ?)";
9143 private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "wikiPage.uuid IS NULL AND ";
9144 private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "wikiPage.uuid = ? AND ";
9145 private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(wikiPage.uuid IS NULL OR wikiPage.uuid = ?) AND ";
9146 private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "wikiPage.groupId = ?";
9147 private static final String _FINDER_COLUMN_NODEID_NODEID_2 = "wikiPage.nodeId = ?";
9148 private static final String _FINDER_COLUMN_FORMAT_FORMAT_1 = "wikiPage.format IS NULL";
9149 private static final String _FINDER_COLUMN_FORMAT_FORMAT_2 = "wikiPage.format = ?";
9150 private static final String _FINDER_COLUMN_FORMAT_FORMAT_3 = "(wikiPage.format IS NULL OR wikiPage.format = ?)";
9151 private static final String _FINDER_COLUMN_R_N_RESOURCEPRIMKEY_2 = "wikiPage.resourcePrimKey = ? AND ";
9152 private static final String _FINDER_COLUMN_R_N_NODEID_2 = "wikiPage.nodeId = ?";
9153 private static final String _FINDER_COLUMN_N_T_NODEID_2 = "wikiPage.nodeId = ? AND ";
9154 private static final String _FINDER_COLUMN_N_T_TITLE_1 = "wikiPage.title IS NULL";
9155 private static final String _FINDER_COLUMN_N_T_TITLE_2 = "lower(wikiPage.title) = lower(CAST_TEXT(?))";
9156 private static final String _FINDER_COLUMN_N_T_TITLE_3 = "(wikiPage.title IS NULL OR lower(wikiPage.title) = lower(CAST_TEXT(?)))";
9157 private static final String _FINDER_COLUMN_N_H_NODEID_2 = "wikiPage.nodeId = ? AND ";
9158 private static final String _FINDER_COLUMN_N_H_HEAD_2 = "wikiPage.head = ?";
9159 private static final String _FINDER_COLUMN_N_P_NODEID_2 = "wikiPage.nodeId = ? AND ";
9160 private static final String _FINDER_COLUMN_N_P_PARENTTITLE_1 = "wikiPage.parentTitle IS NULL";
9161 private static final String _FINDER_COLUMN_N_P_PARENTTITLE_2 = "lower(wikiPage.parentTitle) = lower(CAST_TEXT(?))";
9162 private static final String _FINDER_COLUMN_N_P_PARENTTITLE_3 = "(wikiPage.parentTitle IS NULL OR lower(wikiPage.parentTitle) = lower(CAST_TEXT(?)))";
9163 private static final String _FINDER_COLUMN_N_R_NODEID_2 = "wikiPage.nodeId = ? AND ";
9164 private static final String _FINDER_COLUMN_N_R_REDIRECTTITLE_1 = "wikiPage.redirectTitle IS NULL";
9165 private static final String _FINDER_COLUMN_N_R_REDIRECTTITLE_2 = "lower(wikiPage.redirectTitle) = lower(CAST_TEXT(?))";
9166 private static final String _FINDER_COLUMN_N_R_REDIRECTTITLE_3 = "(wikiPage.redirectTitle IS NULL OR lower(wikiPage.redirectTitle) = lower(CAST_TEXT(?)))";
9167 private static final String _FINDER_COLUMN_N_S_NODEID_2 = "wikiPage.nodeId = ? AND ";
9168 private static final String _FINDER_COLUMN_N_S_STATUS_2 = "wikiPage.status = ?";
9169 private static final String _FINDER_COLUMN_R_N_V_RESOURCEPRIMKEY_2 = "wikiPage.resourcePrimKey = ? AND ";
9170 private static final String _FINDER_COLUMN_R_N_V_NODEID_2 = "wikiPage.nodeId = ? AND ";
9171 private static final String _FINDER_COLUMN_R_N_V_VERSION_2 = "wikiPage.version = ?";
9172 private static final String _FINDER_COLUMN_R_N_S_RESOURCEPRIMKEY_2 = "wikiPage.resourcePrimKey = ? AND ";
9173 private static final String _FINDER_COLUMN_R_N_S_NODEID_2 = "wikiPage.nodeId = ? AND ";
9174 private static final String _FINDER_COLUMN_R_N_S_STATUS_2 = "wikiPage.status = ?";
9175 private static final String _FINDER_COLUMN_U_N_S_USERID_2 = "wikiPage.userId = ? AND ";
9176 private static final String _FINDER_COLUMN_U_N_S_NODEID_2 = "wikiPage.nodeId = ? AND ";
9177 private static final String _FINDER_COLUMN_U_N_S_STATUS_2 = "wikiPage.status = ?";
9178 private static final String _FINDER_COLUMN_N_T_V_NODEID_2 = "wikiPage.nodeId = ? AND ";
9179 private static final String _FINDER_COLUMN_N_T_V_TITLE_1 = "wikiPage.title IS NULL AND ";
9180 private static final String _FINDER_COLUMN_N_T_V_TITLE_2 = "lower(wikiPage.title) = lower(CAST_TEXT(?)) AND ";
9181 private static final String _FINDER_COLUMN_N_T_V_TITLE_3 = "(wikiPage.title IS NULL OR lower(wikiPage.title) = lower(CAST_TEXT(?))) AND ";
9182 private static final String _FINDER_COLUMN_N_T_V_VERSION_2 = "wikiPage.version = ?";
9183 private static final String _FINDER_COLUMN_N_T_H_NODEID_2 = "wikiPage.nodeId = ? AND ";
9184 private static final String _FINDER_COLUMN_N_T_H_TITLE_1 = "wikiPage.title IS NULL AND ";
9185 private static final String _FINDER_COLUMN_N_T_H_TITLE_2 = "lower(wikiPage.title) = lower(CAST_TEXT(?)) AND ";
9186 private static final String _FINDER_COLUMN_N_T_H_TITLE_3 = "(wikiPage.title IS NULL OR lower(wikiPage.title) = lower(CAST_TEXT(?))) AND ";
9187 private static final String _FINDER_COLUMN_N_T_H_HEAD_2 = "wikiPage.head = ?";
9188 private static final String _FINDER_COLUMN_N_T_S_NODEID_2 = "wikiPage.nodeId = ? AND ";
9189 private static final String _FINDER_COLUMN_N_T_S_TITLE_1 = "wikiPage.title IS NULL AND ";
9190 private static final String _FINDER_COLUMN_N_T_S_TITLE_2 = "lower(wikiPage.title) = lower(CAST_TEXT(?)) AND ";
9191 private static final String _FINDER_COLUMN_N_T_S_TITLE_3 = "(wikiPage.title IS NULL OR lower(wikiPage.title) = lower(CAST_TEXT(?))) AND ";
9192 private static final String _FINDER_COLUMN_N_T_S_STATUS_2 = "wikiPage.status = ?";
9193 private static final String _FINDER_COLUMN_N_H_P_NODEID_2 = "wikiPage.nodeId = ? AND ";
9194 private static final String _FINDER_COLUMN_N_H_P_HEAD_2 = "wikiPage.head = ? AND ";
9195 private static final String _FINDER_COLUMN_N_H_P_PARENTTITLE_1 = "wikiPage.parentTitle IS NULL";
9196 private static final String _FINDER_COLUMN_N_H_P_PARENTTITLE_2 = "lower(wikiPage.parentTitle) = lower(CAST_TEXT(?))";
9197 private static final String _FINDER_COLUMN_N_H_P_PARENTTITLE_3 = "(wikiPage.parentTitle IS NULL OR lower(wikiPage.parentTitle) = lower(CAST_TEXT(?)))";
9198 private static final String _FINDER_COLUMN_N_H_S_NODEID_2 = "wikiPage.nodeId = ? AND ";
9199 private static final String _FINDER_COLUMN_N_H_S_HEAD_2 = "wikiPage.head = ? AND ";
9200 private static final String _FINDER_COLUMN_N_H_S_STATUS_2 = "wikiPage.status = ?";
9201 private static final String _FINDER_COLUMN_N_H_P_S_NODEID_2 = "wikiPage.nodeId = ? AND ";
9202 private static final String _FINDER_COLUMN_N_H_P_S_HEAD_2 = "wikiPage.head = ? AND ";
9203 private static final String _FINDER_COLUMN_N_H_P_S_PARENTTITLE_1 = "wikiPage.parentTitle IS NULL AND ";
9204 private static final String _FINDER_COLUMN_N_H_P_S_PARENTTITLE_2 = "lower(wikiPage.parentTitle) = lower(CAST_TEXT(?)) AND ";
9205 private static final String _FINDER_COLUMN_N_H_P_S_PARENTTITLE_3 = "(wikiPage.parentTitle IS NULL OR lower(wikiPage.parentTitle) = lower(CAST_TEXT(?))) AND ";
9206 private static final String _FINDER_COLUMN_N_H_P_S_STATUS_2 = "wikiPage.status = ?";
9207 private static final String _ORDER_BY_ENTITY_ALIAS = "wikiPage.";
9208 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No WikiPage exists with the primary key ";
9209 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No WikiPage exists with the key {";
9210 private static Log _log = LogFactoryUtil.getLog(WikiPagePersistenceImpl.class);
9211 }