001
014
015 package com.liferay.portlet.wiki.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.kernel.bean.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.SQLQuery;
027 import com.liferay.portal.kernel.dao.orm.Session;
028 import com.liferay.portal.kernel.exception.SystemException;
029 import com.liferay.portal.kernel.log.Log;
030 import com.liferay.portal.kernel.log.LogFactoryUtil;
031 import com.liferay.portal.kernel.util.GetterUtil;
032 import com.liferay.portal.kernel.util.InstanceFactory;
033 import com.liferay.portal.kernel.util.OrderByComparator;
034 import com.liferay.portal.kernel.util.StringBundler;
035 import com.liferay.portal.kernel.util.StringPool;
036 import com.liferay.portal.kernel.util.StringUtil;
037 import com.liferay.portal.kernel.util.Validator;
038 import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
039 import com.liferay.portal.model.CacheModel;
040 import com.liferay.portal.model.ModelListener;
041 import com.liferay.portal.security.permission.InlineSQLHelperUtil;
042 import com.liferay.portal.service.persistence.GroupPersistence;
043 import com.liferay.portal.service.persistence.SubscriptionPersistence;
044 import com.liferay.portal.service.persistence.UserPersistence;
045 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
046
047 import com.liferay.portlet.trash.service.persistence.TrashEntryPersistence;
048 import com.liferay.portlet.wiki.NoSuchNodeException;
049 import com.liferay.portlet.wiki.model.WikiNode;
050 import com.liferay.portlet.wiki.model.impl.WikiNodeImpl;
051 import com.liferay.portlet.wiki.model.impl.WikiNodeModelImpl;
052
053 import java.io.Serializable;
054
055 import java.util.ArrayList;
056 import java.util.Collections;
057 import java.util.List;
058
059
071 public class WikiNodePersistenceImpl extends BasePersistenceImpl<WikiNode>
072 implements WikiNodePersistence {
073
078 public static final String FINDER_CLASS_NAME_ENTITY = WikiNodeImpl.class.getName();
079 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
080 ".List1";
081 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
082 ".List2";
083 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
084 WikiNodeModelImpl.FINDER_CACHE_ENABLED, WikiNodeImpl.class,
085 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUuid",
086 new String[] {
087 String.class.getName(),
088
089 "java.lang.Integer", "java.lang.Integer",
090 "com.liferay.portal.kernel.util.OrderByComparator"
091 });
092 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
093 WikiNodeModelImpl.FINDER_CACHE_ENABLED, WikiNodeImpl.class,
094 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid",
095 new String[] { String.class.getName() },
096 WikiNodeModelImpl.UUID_COLUMN_BITMASK);
097 public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
098 WikiNodeModelImpl.FINDER_CACHE_ENABLED, Long.class,
099 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid",
100 new String[] { String.class.getName() });
101 public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
102 WikiNodeModelImpl.FINDER_CACHE_ENABLED, WikiNodeImpl.class,
103 FINDER_CLASS_NAME_ENTITY, "fetchByUUID_G",
104 new String[] { String.class.getName(), Long.class.getName() },
105 WikiNodeModelImpl.UUID_COLUMN_BITMASK |
106 WikiNodeModelImpl.GROUPID_COLUMN_BITMASK);
107 public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
108 WikiNodeModelImpl.FINDER_CACHE_ENABLED, Long.class,
109 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUUID_G",
110 new String[] { String.class.getName(), Long.class.getName() });
111 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID_C = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
112 WikiNodeModelImpl.FINDER_CACHE_ENABLED, WikiNodeImpl.class,
113 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUuid_C",
114 new String[] {
115 String.class.getName(), Long.class.getName(),
116
117 "java.lang.Integer", "java.lang.Integer",
118 "com.liferay.portal.kernel.util.OrderByComparator"
119 });
120 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C =
121 new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
122 WikiNodeModelImpl.FINDER_CACHE_ENABLED, WikiNodeImpl.class,
123 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid_C",
124 new String[] { String.class.getName(), Long.class.getName() },
125 WikiNodeModelImpl.UUID_COLUMN_BITMASK |
126 WikiNodeModelImpl.COMPANYID_COLUMN_BITMASK);
127 public static final FinderPath FINDER_PATH_COUNT_BY_UUID_C = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
128 WikiNodeModelImpl.FINDER_CACHE_ENABLED, Long.class,
129 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid_C",
130 new String[] { String.class.getName(), Long.class.getName() });
131 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
132 WikiNodeModelImpl.FINDER_CACHE_ENABLED, WikiNodeImpl.class,
133 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByGroupId",
134 new String[] {
135 Long.class.getName(),
136
137 "java.lang.Integer", "java.lang.Integer",
138 "com.liferay.portal.kernel.util.OrderByComparator"
139 });
140 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID =
141 new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
142 WikiNodeModelImpl.FINDER_CACHE_ENABLED, WikiNodeImpl.class,
143 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByGroupId",
144 new String[] { Long.class.getName() },
145 WikiNodeModelImpl.GROUPID_COLUMN_BITMASK);
146 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
147 WikiNodeModelImpl.FINDER_CACHE_ENABLED, Long.class,
148 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByGroupId",
149 new String[] { Long.class.getName() });
150 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID =
151 new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
152 WikiNodeModelImpl.FINDER_CACHE_ENABLED, WikiNodeImpl.class,
153 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByCompanyId",
154 new String[] {
155 Long.class.getName(),
156
157 "java.lang.Integer", "java.lang.Integer",
158 "com.liferay.portal.kernel.util.OrderByComparator"
159 });
160 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID =
161 new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
162 WikiNodeModelImpl.FINDER_CACHE_ENABLED, WikiNodeImpl.class,
163 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByCompanyId",
164 new String[] { Long.class.getName() },
165 WikiNodeModelImpl.COMPANYID_COLUMN_BITMASK);
166 public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
167 WikiNodeModelImpl.FINDER_CACHE_ENABLED, Long.class,
168 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByCompanyId",
169 new String[] { Long.class.getName() });
170 public static final FinderPath FINDER_PATH_FETCH_BY_G_N = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
171 WikiNodeModelImpl.FINDER_CACHE_ENABLED, WikiNodeImpl.class,
172 FINDER_CLASS_NAME_ENTITY, "fetchByG_N",
173 new String[] { Long.class.getName(), String.class.getName() },
174 WikiNodeModelImpl.GROUPID_COLUMN_BITMASK |
175 WikiNodeModelImpl.NAME_COLUMN_BITMASK);
176 public static final FinderPath FINDER_PATH_COUNT_BY_G_N = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
177 WikiNodeModelImpl.FINDER_CACHE_ENABLED, Long.class,
178 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_N",
179 new String[] { Long.class.getName(), String.class.getName() });
180 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_S = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
181 WikiNodeModelImpl.FINDER_CACHE_ENABLED, WikiNodeImpl.class,
182 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_S",
183 new String[] {
184 Long.class.getName(), Integer.class.getName(),
185
186 "java.lang.Integer", "java.lang.Integer",
187 "com.liferay.portal.kernel.util.OrderByComparator"
188 });
189 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
190 WikiNodeModelImpl.FINDER_CACHE_ENABLED, WikiNodeImpl.class,
191 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_S",
192 new String[] { Long.class.getName(), Integer.class.getName() },
193 WikiNodeModelImpl.GROUPID_COLUMN_BITMASK |
194 WikiNodeModelImpl.STATUS_COLUMN_BITMASK);
195 public static final FinderPath FINDER_PATH_COUNT_BY_G_S = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
196 WikiNodeModelImpl.FINDER_CACHE_ENABLED, Long.class,
197 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_S",
198 new String[] { Long.class.getName(), Integer.class.getName() });
199 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_S = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
200 WikiNodeModelImpl.FINDER_CACHE_ENABLED, WikiNodeImpl.class,
201 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_S",
202 new String[] {
203 Long.class.getName(), Integer.class.getName(),
204
205 "java.lang.Integer", "java.lang.Integer",
206 "com.liferay.portal.kernel.util.OrderByComparator"
207 });
208 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_S = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
209 WikiNodeModelImpl.FINDER_CACHE_ENABLED, WikiNodeImpl.class,
210 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_S",
211 new String[] { Long.class.getName(), Integer.class.getName() },
212 WikiNodeModelImpl.COMPANYID_COLUMN_BITMASK |
213 WikiNodeModelImpl.STATUS_COLUMN_BITMASK);
214 public static final FinderPath FINDER_PATH_COUNT_BY_C_S = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
215 WikiNodeModelImpl.FINDER_CACHE_ENABLED, Long.class,
216 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_S",
217 new String[] { Long.class.getName(), Integer.class.getName() });
218 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
219 WikiNodeModelImpl.FINDER_CACHE_ENABLED, WikiNodeImpl.class,
220 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
221 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
222 WikiNodeModelImpl.FINDER_CACHE_ENABLED, WikiNodeImpl.class,
223 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
224 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
225 WikiNodeModelImpl.FINDER_CACHE_ENABLED, Long.class,
226 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
227
228
233 public void cacheResult(WikiNode wikiNode) {
234 EntityCacheUtil.putResult(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
235 WikiNodeImpl.class, wikiNode.getPrimaryKey(), wikiNode);
236
237 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
238 new Object[] { wikiNode.getUuid(), Long.valueOf(
239 wikiNode.getGroupId()) }, wikiNode);
240
241 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
242 new Object[] { Long.valueOf(wikiNode.getGroupId()), wikiNode.getName() },
243 wikiNode);
244
245 wikiNode.resetOriginalValues();
246 }
247
248
253 public void cacheResult(List<WikiNode> wikiNodes) {
254 for (WikiNode wikiNode : wikiNodes) {
255 if (EntityCacheUtil.getResult(
256 WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
257 WikiNodeImpl.class, wikiNode.getPrimaryKey()) == null) {
258 cacheResult(wikiNode);
259 }
260 else {
261 wikiNode.resetOriginalValues();
262 }
263 }
264 }
265
266
273 @Override
274 public void clearCache() {
275 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
276 CacheRegistryUtil.clear(WikiNodeImpl.class.getName());
277 }
278
279 EntityCacheUtil.clearCache(WikiNodeImpl.class.getName());
280
281 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
282 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
283 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
284 }
285
286
293 @Override
294 public void clearCache(WikiNode wikiNode) {
295 EntityCacheUtil.removeResult(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
296 WikiNodeImpl.class, wikiNode.getPrimaryKey());
297
298 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
299 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
300
301 clearUniqueFindersCache(wikiNode);
302 }
303
304 @Override
305 public void clearCache(List<WikiNode> wikiNodes) {
306 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
307 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
308
309 for (WikiNode wikiNode : wikiNodes) {
310 EntityCacheUtil.removeResult(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
311 WikiNodeImpl.class, wikiNode.getPrimaryKey());
312
313 clearUniqueFindersCache(wikiNode);
314 }
315 }
316
317 protected void clearUniqueFindersCache(WikiNode wikiNode) {
318 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
319 new Object[] { wikiNode.getUuid(), Long.valueOf(
320 wikiNode.getGroupId()) });
321
322 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_N,
323 new Object[] { Long.valueOf(wikiNode.getGroupId()), wikiNode.getName() });
324 }
325
326
332 public WikiNode create(long nodeId) {
333 WikiNode wikiNode = new WikiNodeImpl();
334
335 wikiNode.setNew(true);
336 wikiNode.setPrimaryKey(nodeId);
337
338 String uuid = PortalUUIDUtil.generate();
339
340 wikiNode.setUuid(uuid);
341
342 return wikiNode;
343 }
344
345
353 public WikiNode remove(long nodeId)
354 throws NoSuchNodeException, SystemException {
355 return remove(Long.valueOf(nodeId));
356 }
357
358
366 @Override
367 public WikiNode remove(Serializable primaryKey)
368 throws NoSuchNodeException, SystemException {
369 Session session = null;
370
371 try {
372 session = openSession();
373
374 WikiNode wikiNode = (WikiNode)session.get(WikiNodeImpl.class,
375 primaryKey);
376
377 if (wikiNode == null) {
378 if (_log.isWarnEnabled()) {
379 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
380 }
381
382 throw new NoSuchNodeException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
383 primaryKey);
384 }
385
386 return remove(wikiNode);
387 }
388 catch (NoSuchNodeException nsee) {
389 throw nsee;
390 }
391 catch (Exception e) {
392 throw processException(e);
393 }
394 finally {
395 closeSession(session);
396 }
397 }
398
399 @Override
400 protected WikiNode removeImpl(WikiNode wikiNode) throws SystemException {
401 wikiNode = toUnwrappedModel(wikiNode);
402
403 Session session = null;
404
405 try {
406 session = openSession();
407
408 if (wikiNode.isCachedModel()) {
409 wikiNode = (WikiNode)session.get(WikiNodeImpl.class,
410 wikiNode.getPrimaryKeyObj());
411 }
412
413 session.delete(wikiNode);
414 }
415 catch (Exception e) {
416 throw processException(e);
417 }
418 finally {
419 closeSession(session);
420 }
421
422 clearCache(wikiNode);
423
424 return wikiNode;
425 }
426
427 @Override
428 public WikiNode updateImpl(com.liferay.portlet.wiki.model.WikiNode wikiNode)
429 throws SystemException {
430 wikiNode = toUnwrappedModel(wikiNode);
431
432 boolean isNew = wikiNode.isNew();
433
434 WikiNodeModelImpl wikiNodeModelImpl = (WikiNodeModelImpl)wikiNode;
435
436 if (Validator.isNull(wikiNode.getUuid())) {
437 String uuid = PortalUUIDUtil.generate();
438
439 wikiNode.setUuid(uuid);
440 }
441
442 Session session = null;
443
444 try {
445 session = openSession();
446
447 if (wikiNode.isNew()) {
448 session.save(wikiNode);
449
450 wikiNode.setNew(false);
451 }
452 else {
453 session.merge(wikiNode);
454 }
455 }
456 catch (Exception e) {
457 throw processException(e);
458 }
459 finally {
460 closeSession(session);
461 }
462
463 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
464
465 if (isNew || !WikiNodeModelImpl.COLUMN_BITMASK_ENABLED) {
466 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
467 }
468
469 else {
470 if ((wikiNodeModelImpl.getColumnBitmask() &
471 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID.getColumnBitmask()) != 0) {
472 Object[] args = new Object[] { wikiNodeModelImpl.getOriginalUuid() };
473
474 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
475 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
476 args);
477
478 args = new Object[] { wikiNodeModelImpl.getUuid() };
479
480 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
481 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
482 args);
483 }
484
485 if ((wikiNodeModelImpl.getColumnBitmask() &
486 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C.getColumnBitmask()) != 0) {
487 Object[] args = new Object[] {
488 wikiNodeModelImpl.getOriginalUuid(),
489 Long.valueOf(wikiNodeModelImpl.getOriginalCompanyId())
490 };
491
492 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_C, args);
493 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C,
494 args);
495
496 args = new Object[] {
497 wikiNodeModelImpl.getUuid(),
498 Long.valueOf(wikiNodeModelImpl.getCompanyId())
499 };
500
501 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_C, args);
502 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C,
503 args);
504 }
505
506 if ((wikiNodeModelImpl.getColumnBitmask() &
507 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
508 Object[] args = new Object[] {
509 Long.valueOf(wikiNodeModelImpl.getOriginalGroupId())
510 };
511
512 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
513 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
514 args);
515
516 args = new Object[] { Long.valueOf(wikiNodeModelImpl.getGroupId()) };
517
518 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
519 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
520 args);
521 }
522
523 if ((wikiNodeModelImpl.getColumnBitmask() &
524 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID.getColumnBitmask()) != 0) {
525 Object[] args = new Object[] {
526 Long.valueOf(wikiNodeModelImpl.getOriginalCompanyId())
527 };
528
529 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
530 args);
531 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
532 args);
533
534 args = new Object[] {
535 Long.valueOf(wikiNodeModelImpl.getCompanyId())
536 };
537
538 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
539 args);
540 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
541 args);
542 }
543
544 if ((wikiNodeModelImpl.getColumnBitmask() &
545 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S.getColumnBitmask()) != 0) {
546 Object[] args = new Object[] {
547 Long.valueOf(wikiNodeModelImpl.getOriginalGroupId()),
548 Integer.valueOf(wikiNodeModelImpl.getOriginalStatus())
549 };
550
551 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_S, args);
552 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S,
553 args);
554
555 args = new Object[] {
556 Long.valueOf(wikiNodeModelImpl.getGroupId()),
557 Integer.valueOf(wikiNodeModelImpl.getStatus())
558 };
559
560 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_S, args);
561 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S,
562 args);
563 }
564
565 if ((wikiNodeModelImpl.getColumnBitmask() &
566 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_S.getColumnBitmask()) != 0) {
567 Object[] args = new Object[] {
568 Long.valueOf(wikiNodeModelImpl.getOriginalCompanyId()),
569 Integer.valueOf(wikiNodeModelImpl.getOriginalStatus())
570 };
571
572 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_S, args);
573 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_S,
574 args);
575
576 args = new Object[] {
577 Long.valueOf(wikiNodeModelImpl.getCompanyId()),
578 Integer.valueOf(wikiNodeModelImpl.getStatus())
579 };
580
581 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_S, args);
582 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_S,
583 args);
584 }
585 }
586
587 EntityCacheUtil.putResult(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
588 WikiNodeImpl.class, wikiNode.getPrimaryKey(), wikiNode);
589
590 if (isNew) {
591 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
592 new Object[] {
593 wikiNode.getUuid(), Long.valueOf(wikiNode.getGroupId())
594 }, wikiNode);
595
596 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
597 new Object[] {
598 Long.valueOf(wikiNode.getGroupId()),
599
600 wikiNode.getName()
601 }, wikiNode);
602 }
603 else {
604 if ((wikiNodeModelImpl.getColumnBitmask() &
605 FINDER_PATH_FETCH_BY_UUID_G.getColumnBitmask()) != 0) {
606 Object[] args = new Object[] {
607 wikiNodeModelImpl.getOriginalUuid(),
608 Long.valueOf(wikiNodeModelImpl.getOriginalGroupId())
609 };
610
611 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_G, args);
612
613 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G, args);
614
615 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
616 new Object[] {
617 wikiNode.getUuid(), Long.valueOf(wikiNode.getGroupId())
618 }, wikiNode);
619 }
620
621 if ((wikiNodeModelImpl.getColumnBitmask() &
622 FINDER_PATH_FETCH_BY_G_N.getColumnBitmask()) != 0) {
623 Object[] args = new Object[] {
624 Long.valueOf(wikiNodeModelImpl.getOriginalGroupId()),
625
626 wikiNodeModelImpl.getOriginalName()
627 };
628
629 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_N, args);
630
631 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_N, args);
632
633 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
634 new Object[] {
635 Long.valueOf(wikiNode.getGroupId()),
636
637 wikiNode.getName()
638 }, wikiNode);
639 }
640 }
641
642 return wikiNode;
643 }
644
645 protected WikiNode toUnwrappedModel(WikiNode wikiNode) {
646 if (wikiNode instanceof WikiNodeImpl) {
647 return wikiNode;
648 }
649
650 WikiNodeImpl wikiNodeImpl = new WikiNodeImpl();
651
652 wikiNodeImpl.setNew(wikiNode.isNew());
653 wikiNodeImpl.setPrimaryKey(wikiNode.getPrimaryKey());
654
655 wikiNodeImpl.setUuid(wikiNode.getUuid());
656 wikiNodeImpl.setNodeId(wikiNode.getNodeId());
657 wikiNodeImpl.setGroupId(wikiNode.getGroupId());
658 wikiNodeImpl.setCompanyId(wikiNode.getCompanyId());
659 wikiNodeImpl.setUserId(wikiNode.getUserId());
660 wikiNodeImpl.setUserName(wikiNode.getUserName());
661 wikiNodeImpl.setCreateDate(wikiNode.getCreateDate());
662 wikiNodeImpl.setModifiedDate(wikiNode.getModifiedDate());
663 wikiNodeImpl.setName(wikiNode.getName());
664 wikiNodeImpl.setDescription(wikiNode.getDescription());
665 wikiNodeImpl.setLastPostDate(wikiNode.getLastPostDate());
666 wikiNodeImpl.setStatus(wikiNode.getStatus());
667 wikiNodeImpl.setStatusByUserId(wikiNode.getStatusByUserId());
668 wikiNodeImpl.setStatusByUserName(wikiNode.getStatusByUserName());
669 wikiNodeImpl.setStatusDate(wikiNode.getStatusDate());
670
671 return wikiNodeImpl;
672 }
673
674
682 @Override
683 public WikiNode findByPrimaryKey(Serializable primaryKey)
684 throws NoSuchModelException, SystemException {
685 return findByPrimaryKey(((Long)primaryKey).longValue());
686 }
687
688
696 public WikiNode findByPrimaryKey(long nodeId)
697 throws NoSuchNodeException, SystemException {
698 WikiNode wikiNode = fetchByPrimaryKey(nodeId);
699
700 if (wikiNode == null) {
701 if (_log.isWarnEnabled()) {
702 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + nodeId);
703 }
704
705 throw new NoSuchNodeException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
706 nodeId);
707 }
708
709 return wikiNode;
710 }
711
712
719 @Override
720 public WikiNode fetchByPrimaryKey(Serializable primaryKey)
721 throws SystemException {
722 return fetchByPrimaryKey(((Long)primaryKey).longValue());
723 }
724
725
732 public WikiNode fetchByPrimaryKey(long nodeId) throws SystemException {
733 WikiNode wikiNode = (WikiNode)EntityCacheUtil.getResult(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
734 WikiNodeImpl.class, nodeId);
735
736 if (wikiNode == _nullWikiNode) {
737 return null;
738 }
739
740 if (wikiNode == null) {
741 Session session = null;
742
743 boolean hasException = false;
744
745 try {
746 session = openSession();
747
748 wikiNode = (WikiNode)session.get(WikiNodeImpl.class,
749 Long.valueOf(nodeId));
750 }
751 catch (Exception e) {
752 hasException = true;
753
754 throw processException(e);
755 }
756 finally {
757 if (wikiNode != null) {
758 cacheResult(wikiNode);
759 }
760 else if (!hasException) {
761 EntityCacheUtil.putResult(WikiNodeModelImpl.ENTITY_CACHE_ENABLED,
762 WikiNodeImpl.class, nodeId, _nullWikiNode);
763 }
764
765 closeSession(session);
766 }
767 }
768
769 return wikiNode;
770 }
771
772
779 public List<WikiNode> findByUuid(String uuid) throws SystemException {
780 return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
781 }
782
783
796 public List<WikiNode> findByUuid(String uuid, int start, int end)
797 throws SystemException {
798 return findByUuid(uuid, start, end, null);
799 }
800
801
815 public List<WikiNode> findByUuid(String uuid, int start, int end,
816 OrderByComparator orderByComparator) throws SystemException {
817 FinderPath finderPath = null;
818 Object[] finderArgs = null;
819
820 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
821 (orderByComparator == null)) {
822 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID;
823 finderArgs = new Object[] { uuid };
824 }
825 else {
826 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID;
827 finderArgs = new Object[] { uuid, start, end, orderByComparator };
828 }
829
830 List<WikiNode> list = (List<WikiNode>)FinderCacheUtil.getResult(finderPath,
831 finderArgs, this);
832
833 if ((list != null) && !list.isEmpty()) {
834 for (WikiNode wikiNode : list) {
835 if (!Validator.equals(uuid, wikiNode.getUuid())) {
836 list = null;
837
838 break;
839 }
840 }
841 }
842
843 if (list == null) {
844 StringBundler query = null;
845
846 if (orderByComparator != null) {
847 query = new StringBundler(3 +
848 (orderByComparator.getOrderByFields().length * 3));
849 }
850 else {
851 query = new StringBundler(3);
852 }
853
854 query.append(_SQL_SELECT_WIKINODE_WHERE);
855
856 if (uuid == null) {
857 query.append(_FINDER_COLUMN_UUID_UUID_1);
858 }
859 else {
860 if (uuid.equals(StringPool.BLANK)) {
861 query.append(_FINDER_COLUMN_UUID_UUID_3);
862 }
863 else {
864 query.append(_FINDER_COLUMN_UUID_UUID_2);
865 }
866 }
867
868 if (orderByComparator != null) {
869 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
870 orderByComparator);
871 }
872
873 else {
874 query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
875 }
876
877 String sql = query.toString();
878
879 Session session = null;
880
881 try {
882 session = openSession();
883
884 Query q = session.createQuery(sql);
885
886 QueryPos qPos = QueryPos.getInstance(q);
887
888 if (uuid != null) {
889 qPos.add(uuid);
890 }
891
892 list = (List<WikiNode>)QueryUtil.list(q, getDialect(), start,
893 end);
894 }
895 catch (Exception e) {
896 throw processException(e);
897 }
898 finally {
899 if (list == null) {
900 FinderCacheUtil.removeResult(finderPath, finderArgs);
901 }
902 else {
903 cacheResult(list);
904
905 FinderCacheUtil.putResult(finderPath, finderArgs, list);
906 }
907
908 closeSession(session);
909 }
910 }
911
912 return list;
913 }
914
915
924 public WikiNode findByUuid_First(String uuid,
925 OrderByComparator orderByComparator)
926 throws NoSuchNodeException, SystemException {
927 WikiNode wikiNode = fetchByUuid_First(uuid, orderByComparator);
928
929 if (wikiNode != null) {
930 return wikiNode;
931 }
932
933 StringBundler msg = new StringBundler(4);
934
935 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
936
937 msg.append("uuid=");
938 msg.append(uuid);
939
940 msg.append(StringPool.CLOSE_CURLY_BRACE);
941
942 throw new NoSuchNodeException(msg.toString());
943 }
944
945
953 public WikiNode fetchByUuid_First(String uuid,
954 OrderByComparator orderByComparator) throws SystemException {
955 List<WikiNode> list = findByUuid(uuid, 0, 1, orderByComparator);
956
957 if (!list.isEmpty()) {
958 return list.get(0);
959 }
960
961 return null;
962 }
963
964
973 public WikiNode findByUuid_Last(String uuid,
974 OrderByComparator orderByComparator)
975 throws NoSuchNodeException, SystemException {
976 WikiNode wikiNode = fetchByUuid_Last(uuid, orderByComparator);
977
978 if (wikiNode != null) {
979 return wikiNode;
980 }
981
982 StringBundler msg = new StringBundler(4);
983
984 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
985
986 msg.append("uuid=");
987 msg.append(uuid);
988
989 msg.append(StringPool.CLOSE_CURLY_BRACE);
990
991 throw new NoSuchNodeException(msg.toString());
992 }
993
994
1002 public WikiNode fetchByUuid_Last(String uuid,
1003 OrderByComparator orderByComparator) throws SystemException {
1004 int count = countByUuid(uuid);
1005
1006 List<WikiNode> list = findByUuid(uuid, count - 1, count,
1007 orderByComparator);
1008
1009 if (!list.isEmpty()) {
1010 return list.get(0);
1011 }
1012
1013 return null;
1014 }
1015
1016
1026 public WikiNode[] findByUuid_PrevAndNext(long nodeId, String uuid,
1027 OrderByComparator orderByComparator)
1028 throws NoSuchNodeException, SystemException {
1029 WikiNode wikiNode = findByPrimaryKey(nodeId);
1030
1031 Session session = null;
1032
1033 try {
1034 session = openSession();
1035
1036 WikiNode[] array = new WikiNodeImpl[3];
1037
1038 array[0] = getByUuid_PrevAndNext(session, wikiNode, uuid,
1039 orderByComparator, true);
1040
1041 array[1] = wikiNode;
1042
1043 array[2] = getByUuid_PrevAndNext(session, wikiNode, uuid,
1044 orderByComparator, false);
1045
1046 return array;
1047 }
1048 catch (Exception e) {
1049 throw processException(e);
1050 }
1051 finally {
1052 closeSession(session);
1053 }
1054 }
1055
1056 protected WikiNode getByUuid_PrevAndNext(Session session,
1057 WikiNode wikiNode, String uuid, OrderByComparator orderByComparator,
1058 boolean previous) {
1059 StringBundler query = null;
1060
1061 if (orderByComparator != null) {
1062 query = new StringBundler(6 +
1063 (orderByComparator.getOrderByFields().length * 6));
1064 }
1065 else {
1066 query = new StringBundler(3);
1067 }
1068
1069 query.append(_SQL_SELECT_WIKINODE_WHERE);
1070
1071 if (uuid == null) {
1072 query.append(_FINDER_COLUMN_UUID_UUID_1);
1073 }
1074 else {
1075 if (uuid.equals(StringPool.BLANK)) {
1076 query.append(_FINDER_COLUMN_UUID_UUID_3);
1077 }
1078 else {
1079 query.append(_FINDER_COLUMN_UUID_UUID_2);
1080 }
1081 }
1082
1083 if (orderByComparator != null) {
1084 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1085
1086 if (orderByConditionFields.length > 0) {
1087 query.append(WHERE_AND);
1088 }
1089
1090 for (int i = 0; i < orderByConditionFields.length; i++) {
1091 query.append(_ORDER_BY_ENTITY_ALIAS);
1092 query.append(orderByConditionFields[i]);
1093
1094 if ((i + 1) < orderByConditionFields.length) {
1095 if (orderByComparator.isAscending() ^ previous) {
1096 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1097 }
1098 else {
1099 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1100 }
1101 }
1102 else {
1103 if (orderByComparator.isAscending() ^ previous) {
1104 query.append(WHERE_GREATER_THAN);
1105 }
1106 else {
1107 query.append(WHERE_LESSER_THAN);
1108 }
1109 }
1110 }
1111
1112 query.append(ORDER_BY_CLAUSE);
1113
1114 String[] orderByFields = orderByComparator.getOrderByFields();
1115
1116 for (int i = 0; i < orderByFields.length; i++) {
1117 query.append(_ORDER_BY_ENTITY_ALIAS);
1118 query.append(orderByFields[i]);
1119
1120 if ((i + 1) < orderByFields.length) {
1121 if (orderByComparator.isAscending() ^ previous) {
1122 query.append(ORDER_BY_ASC_HAS_NEXT);
1123 }
1124 else {
1125 query.append(ORDER_BY_DESC_HAS_NEXT);
1126 }
1127 }
1128 else {
1129 if (orderByComparator.isAscending() ^ previous) {
1130 query.append(ORDER_BY_ASC);
1131 }
1132 else {
1133 query.append(ORDER_BY_DESC);
1134 }
1135 }
1136 }
1137 }
1138
1139 else {
1140 query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
1141 }
1142
1143 String sql = query.toString();
1144
1145 Query q = session.createQuery(sql);
1146
1147 q.setFirstResult(0);
1148 q.setMaxResults(2);
1149
1150 QueryPos qPos = QueryPos.getInstance(q);
1151
1152 if (uuid != null) {
1153 qPos.add(uuid);
1154 }
1155
1156 if (orderByComparator != null) {
1157 Object[] values = orderByComparator.getOrderByConditionValues(wikiNode);
1158
1159 for (Object value : values) {
1160 qPos.add(value);
1161 }
1162 }
1163
1164 List<WikiNode> list = q.list();
1165
1166 if (list.size() == 2) {
1167 return list.get(1);
1168 }
1169 else {
1170 return null;
1171 }
1172 }
1173
1174
1183 public WikiNode findByUUID_G(String uuid, long groupId)
1184 throws NoSuchNodeException, SystemException {
1185 WikiNode wikiNode = fetchByUUID_G(uuid, groupId);
1186
1187 if (wikiNode == null) {
1188 StringBundler msg = new StringBundler(6);
1189
1190 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1191
1192 msg.append("uuid=");
1193 msg.append(uuid);
1194
1195 msg.append(", groupId=");
1196 msg.append(groupId);
1197
1198 msg.append(StringPool.CLOSE_CURLY_BRACE);
1199
1200 if (_log.isWarnEnabled()) {
1201 _log.warn(msg.toString());
1202 }
1203
1204 throw new NoSuchNodeException(msg.toString());
1205 }
1206
1207 return wikiNode;
1208 }
1209
1210
1218 public WikiNode fetchByUUID_G(String uuid, long groupId)
1219 throws SystemException {
1220 return fetchByUUID_G(uuid, groupId, true);
1221 }
1222
1223
1232 public WikiNode fetchByUUID_G(String uuid, long groupId,
1233 boolean retrieveFromCache) throws SystemException {
1234 Object[] finderArgs = new Object[] { uuid, groupId };
1235
1236 Object result = null;
1237
1238 if (retrieveFromCache) {
1239 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
1240 finderArgs, this);
1241 }
1242
1243 if (result instanceof WikiNode) {
1244 WikiNode wikiNode = (WikiNode)result;
1245
1246 if (!Validator.equals(uuid, wikiNode.getUuid()) ||
1247 (groupId != wikiNode.getGroupId())) {
1248 result = null;
1249 }
1250 }
1251
1252 if (result == null) {
1253 StringBundler query = new StringBundler(4);
1254
1255 query.append(_SQL_SELECT_WIKINODE_WHERE);
1256
1257 if (uuid == null) {
1258 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
1259 }
1260 else {
1261 if (uuid.equals(StringPool.BLANK)) {
1262 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
1263 }
1264 else {
1265 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1266 }
1267 }
1268
1269 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1270
1271 query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
1272
1273 String sql = query.toString();
1274
1275 Session session = null;
1276
1277 try {
1278 session = openSession();
1279
1280 Query q = session.createQuery(sql);
1281
1282 QueryPos qPos = QueryPos.getInstance(q);
1283
1284 if (uuid != null) {
1285 qPos.add(uuid);
1286 }
1287
1288 qPos.add(groupId);
1289
1290 List<WikiNode> list = q.list();
1291
1292 result = list;
1293
1294 WikiNode wikiNode = null;
1295
1296 if (list.isEmpty()) {
1297 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1298 finderArgs, list);
1299 }
1300 else {
1301 wikiNode = list.get(0);
1302
1303 cacheResult(wikiNode);
1304
1305 if ((wikiNode.getUuid() == null) ||
1306 !wikiNode.getUuid().equals(uuid) ||
1307 (wikiNode.getGroupId() != groupId)) {
1308 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1309 finderArgs, wikiNode);
1310 }
1311 }
1312
1313 return wikiNode;
1314 }
1315 catch (Exception e) {
1316 throw processException(e);
1317 }
1318 finally {
1319 if (result == null) {
1320 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
1321 finderArgs);
1322 }
1323
1324 closeSession(session);
1325 }
1326 }
1327 else {
1328 if (result instanceof List<?>) {
1329 return null;
1330 }
1331 else {
1332 return (WikiNode)result;
1333 }
1334 }
1335 }
1336
1337
1345 public List<WikiNode> findByUuid_C(String uuid, long companyId)
1346 throws SystemException {
1347 return findByUuid_C(uuid, companyId, QueryUtil.ALL_POS,
1348 QueryUtil.ALL_POS, null);
1349 }
1350
1351
1365 public List<WikiNode> findByUuid_C(String uuid, long companyId, int start,
1366 int end) throws SystemException {
1367 return findByUuid_C(uuid, companyId, start, end, null);
1368 }
1369
1370
1385 public List<WikiNode> findByUuid_C(String uuid, long companyId, int start,
1386 int end, OrderByComparator orderByComparator) throws SystemException {
1387 FinderPath finderPath = null;
1388 Object[] finderArgs = null;
1389
1390 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1391 (orderByComparator == null)) {
1392 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C;
1393 finderArgs = new Object[] { uuid, companyId };
1394 }
1395 else {
1396 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID_C;
1397 finderArgs = new Object[] {
1398 uuid, companyId,
1399
1400 start, end, orderByComparator
1401 };
1402 }
1403
1404 List<WikiNode> list = (List<WikiNode>)FinderCacheUtil.getResult(finderPath,
1405 finderArgs, this);
1406
1407 if ((list != null) && !list.isEmpty()) {
1408 for (WikiNode wikiNode : list) {
1409 if (!Validator.equals(uuid, wikiNode.getUuid()) ||
1410 (companyId != wikiNode.getCompanyId())) {
1411 list = null;
1412
1413 break;
1414 }
1415 }
1416 }
1417
1418 if (list == null) {
1419 StringBundler query = null;
1420
1421 if (orderByComparator != null) {
1422 query = new StringBundler(4 +
1423 (orderByComparator.getOrderByFields().length * 3));
1424 }
1425 else {
1426 query = new StringBundler(4);
1427 }
1428
1429 query.append(_SQL_SELECT_WIKINODE_WHERE);
1430
1431 if (uuid == null) {
1432 query.append(_FINDER_COLUMN_UUID_C_UUID_1);
1433 }
1434 else {
1435 if (uuid.equals(StringPool.BLANK)) {
1436 query.append(_FINDER_COLUMN_UUID_C_UUID_3);
1437 }
1438 else {
1439 query.append(_FINDER_COLUMN_UUID_C_UUID_2);
1440 }
1441 }
1442
1443 query.append(_FINDER_COLUMN_UUID_C_COMPANYID_2);
1444
1445 if (orderByComparator != null) {
1446 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1447 orderByComparator);
1448 }
1449
1450 else {
1451 query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
1452 }
1453
1454 String sql = query.toString();
1455
1456 Session session = null;
1457
1458 try {
1459 session = openSession();
1460
1461 Query q = session.createQuery(sql);
1462
1463 QueryPos qPos = QueryPos.getInstance(q);
1464
1465 if (uuid != null) {
1466 qPos.add(uuid);
1467 }
1468
1469 qPos.add(companyId);
1470
1471 list = (List<WikiNode>)QueryUtil.list(q, getDialect(), start,
1472 end);
1473 }
1474 catch (Exception e) {
1475 throw processException(e);
1476 }
1477 finally {
1478 if (list == null) {
1479 FinderCacheUtil.removeResult(finderPath, finderArgs);
1480 }
1481 else {
1482 cacheResult(list);
1483
1484 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1485 }
1486
1487 closeSession(session);
1488 }
1489 }
1490
1491 return list;
1492 }
1493
1494
1504 public WikiNode findByUuid_C_First(String uuid, long companyId,
1505 OrderByComparator orderByComparator)
1506 throws NoSuchNodeException, SystemException {
1507 WikiNode wikiNode = fetchByUuid_C_First(uuid, companyId,
1508 orderByComparator);
1509
1510 if (wikiNode != null) {
1511 return wikiNode;
1512 }
1513
1514 StringBundler msg = new StringBundler(6);
1515
1516 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1517
1518 msg.append("uuid=");
1519 msg.append(uuid);
1520
1521 msg.append(", companyId=");
1522 msg.append(companyId);
1523
1524 msg.append(StringPool.CLOSE_CURLY_BRACE);
1525
1526 throw new NoSuchNodeException(msg.toString());
1527 }
1528
1529
1538 public WikiNode fetchByUuid_C_First(String uuid, long companyId,
1539 OrderByComparator orderByComparator) throws SystemException {
1540 List<WikiNode> list = findByUuid_C(uuid, companyId, 0, 1,
1541 orderByComparator);
1542
1543 if (!list.isEmpty()) {
1544 return list.get(0);
1545 }
1546
1547 return null;
1548 }
1549
1550
1560 public WikiNode findByUuid_C_Last(String uuid, long companyId,
1561 OrderByComparator orderByComparator)
1562 throws NoSuchNodeException, SystemException {
1563 WikiNode wikiNode = fetchByUuid_C_Last(uuid, companyId,
1564 orderByComparator);
1565
1566 if (wikiNode != null) {
1567 return wikiNode;
1568 }
1569
1570 StringBundler msg = new StringBundler(6);
1571
1572 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1573
1574 msg.append("uuid=");
1575 msg.append(uuid);
1576
1577 msg.append(", companyId=");
1578 msg.append(companyId);
1579
1580 msg.append(StringPool.CLOSE_CURLY_BRACE);
1581
1582 throw new NoSuchNodeException(msg.toString());
1583 }
1584
1585
1594 public WikiNode fetchByUuid_C_Last(String uuid, long companyId,
1595 OrderByComparator orderByComparator) throws SystemException {
1596 int count = countByUuid_C(uuid, companyId);
1597
1598 List<WikiNode> list = findByUuid_C(uuid, companyId, count - 1, count,
1599 orderByComparator);
1600
1601 if (!list.isEmpty()) {
1602 return list.get(0);
1603 }
1604
1605 return null;
1606 }
1607
1608
1619 public WikiNode[] findByUuid_C_PrevAndNext(long nodeId, String uuid,
1620 long companyId, OrderByComparator orderByComparator)
1621 throws NoSuchNodeException, SystemException {
1622 WikiNode wikiNode = findByPrimaryKey(nodeId);
1623
1624 Session session = null;
1625
1626 try {
1627 session = openSession();
1628
1629 WikiNode[] array = new WikiNodeImpl[3];
1630
1631 array[0] = getByUuid_C_PrevAndNext(session, wikiNode, uuid,
1632 companyId, orderByComparator, true);
1633
1634 array[1] = wikiNode;
1635
1636 array[2] = getByUuid_C_PrevAndNext(session, wikiNode, uuid,
1637 companyId, orderByComparator, false);
1638
1639 return array;
1640 }
1641 catch (Exception e) {
1642 throw processException(e);
1643 }
1644 finally {
1645 closeSession(session);
1646 }
1647 }
1648
1649 protected WikiNode getByUuid_C_PrevAndNext(Session session,
1650 WikiNode wikiNode, String uuid, long companyId,
1651 OrderByComparator orderByComparator, boolean previous) {
1652 StringBundler query = null;
1653
1654 if (orderByComparator != null) {
1655 query = new StringBundler(6 +
1656 (orderByComparator.getOrderByFields().length * 6));
1657 }
1658 else {
1659 query = new StringBundler(3);
1660 }
1661
1662 query.append(_SQL_SELECT_WIKINODE_WHERE);
1663
1664 if (uuid == null) {
1665 query.append(_FINDER_COLUMN_UUID_C_UUID_1);
1666 }
1667 else {
1668 if (uuid.equals(StringPool.BLANK)) {
1669 query.append(_FINDER_COLUMN_UUID_C_UUID_3);
1670 }
1671 else {
1672 query.append(_FINDER_COLUMN_UUID_C_UUID_2);
1673 }
1674 }
1675
1676 query.append(_FINDER_COLUMN_UUID_C_COMPANYID_2);
1677
1678 if (orderByComparator != null) {
1679 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1680
1681 if (orderByConditionFields.length > 0) {
1682 query.append(WHERE_AND);
1683 }
1684
1685 for (int i = 0; i < orderByConditionFields.length; i++) {
1686 query.append(_ORDER_BY_ENTITY_ALIAS);
1687 query.append(orderByConditionFields[i]);
1688
1689 if ((i + 1) < orderByConditionFields.length) {
1690 if (orderByComparator.isAscending() ^ previous) {
1691 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1692 }
1693 else {
1694 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1695 }
1696 }
1697 else {
1698 if (orderByComparator.isAscending() ^ previous) {
1699 query.append(WHERE_GREATER_THAN);
1700 }
1701 else {
1702 query.append(WHERE_LESSER_THAN);
1703 }
1704 }
1705 }
1706
1707 query.append(ORDER_BY_CLAUSE);
1708
1709 String[] orderByFields = orderByComparator.getOrderByFields();
1710
1711 for (int i = 0; i < orderByFields.length; i++) {
1712 query.append(_ORDER_BY_ENTITY_ALIAS);
1713 query.append(orderByFields[i]);
1714
1715 if ((i + 1) < orderByFields.length) {
1716 if (orderByComparator.isAscending() ^ previous) {
1717 query.append(ORDER_BY_ASC_HAS_NEXT);
1718 }
1719 else {
1720 query.append(ORDER_BY_DESC_HAS_NEXT);
1721 }
1722 }
1723 else {
1724 if (orderByComparator.isAscending() ^ previous) {
1725 query.append(ORDER_BY_ASC);
1726 }
1727 else {
1728 query.append(ORDER_BY_DESC);
1729 }
1730 }
1731 }
1732 }
1733
1734 else {
1735 query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
1736 }
1737
1738 String sql = query.toString();
1739
1740 Query q = session.createQuery(sql);
1741
1742 q.setFirstResult(0);
1743 q.setMaxResults(2);
1744
1745 QueryPos qPos = QueryPos.getInstance(q);
1746
1747 if (uuid != null) {
1748 qPos.add(uuid);
1749 }
1750
1751 qPos.add(companyId);
1752
1753 if (orderByComparator != null) {
1754 Object[] values = orderByComparator.getOrderByConditionValues(wikiNode);
1755
1756 for (Object value : values) {
1757 qPos.add(value);
1758 }
1759 }
1760
1761 List<WikiNode> list = q.list();
1762
1763 if (list.size() == 2) {
1764 return list.get(1);
1765 }
1766 else {
1767 return null;
1768 }
1769 }
1770
1771
1778 public List<WikiNode> findByGroupId(long groupId) throws SystemException {
1779 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1780 }
1781
1782
1795 public List<WikiNode> findByGroupId(long groupId, int start, int end)
1796 throws SystemException {
1797 return findByGroupId(groupId, start, end, null);
1798 }
1799
1800
1814 public List<WikiNode> findByGroupId(long groupId, int start, int end,
1815 OrderByComparator orderByComparator) throws SystemException {
1816 FinderPath finderPath = null;
1817 Object[] finderArgs = null;
1818
1819 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1820 (orderByComparator == null)) {
1821 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
1822 finderArgs = new Object[] { groupId };
1823 }
1824 else {
1825 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
1826 finderArgs = new Object[] { groupId, start, end, orderByComparator };
1827 }
1828
1829 List<WikiNode> list = (List<WikiNode>)FinderCacheUtil.getResult(finderPath,
1830 finderArgs, this);
1831
1832 if ((list != null) && !list.isEmpty()) {
1833 for (WikiNode wikiNode : list) {
1834 if ((groupId != wikiNode.getGroupId())) {
1835 list = null;
1836
1837 break;
1838 }
1839 }
1840 }
1841
1842 if (list == null) {
1843 StringBundler query = null;
1844
1845 if (orderByComparator != null) {
1846 query = new StringBundler(3 +
1847 (orderByComparator.getOrderByFields().length * 3));
1848 }
1849 else {
1850 query = new StringBundler(3);
1851 }
1852
1853 query.append(_SQL_SELECT_WIKINODE_WHERE);
1854
1855 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1856
1857 if (orderByComparator != null) {
1858 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1859 orderByComparator);
1860 }
1861
1862 else {
1863 query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
1864 }
1865
1866 String sql = query.toString();
1867
1868 Session session = null;
1869
1870 try {
1871 session = openSession();
1872
1873 Query q = session.createQuery(sql);
1874
1875 QueryPos qPos = QueryPos.getInstance(q);
1876
1877 qPos.add(groupId);
1878
1879 list = (List<WikiNode>)QueryUtil.list(q, getDialect(), start,
1880 end);
1881 }
1882 catch (Exception e) {
1883 throw processException(e);
1884 }
1885 finally {
1886 if (list == null) {
1887 FinderCacheUtil.removeResult(finderPath, finderArgs);
1888 }
1889 else {
1890 cacheResult(list);
1891
1892 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1893 }
1894
1895 closeSession(session);
1896 }
1897 }
1898
1899 return list;
1900 }
1901
1902
1911 public WikiNode findByGroupId_First(long groupId,
1912 OrderByComparator orderByComparator)
1913 throws NoSuchNodeException, SystemException {
1914 WikiNode wikiNode = fetchByGroupId_First(groupId, orderByComparator);
1915
1916 if (wikiNode != null) {
1917 return wikiNode;
1918 }
1919
1920 StringBundler msg = new StringBundler(4);
1921
1922 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1923
1924 msg.append("groupId=");
1925 msg.append(groupId);
1926
1927 msg.append(StringPool.CLOSE_CURLY_BRACE);
1928
1929 throw new NoSuchNodeException(msg.toString());
1930 }
1931
1932
1940 public WikiNode fetchByGroupId_First(long groupId,
1941 OrderByComparator orderByComparator) throws SystemException {
1942 List<WikiNode> list = findByGroupId(groupId, 0, 1, orderByComparator);
1943
1944 if (!list.isEmpty()) {
1945 return list.get(0);
1946 }
1947
1948 return null;
1949 }
1950
1951
1960 public WikiNode findByGroupId_Last(long groupId,
1961 OrderByComparator orderByComparator)
1962 throws NoSuchNodeException, SystemException {
1963 WikiNode wikiNode = fetchByGroupId_Last(groupId, orderByComparator);
1964
1965 if (wikiNode != null) {
1966 return wikiNode;
1967 }
1968
1969 StringBundler msg = new StringBundler(4);
1970
1971 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1972
1973 msg.append("groupId=");
1974 msg.append(groupId);
1975
1976 msg.append(StringPool.CLOSE_CURLY_BRACE);
1977
1978 throw new NoSuchNodeException(msg.toString());
1979 }
1980
1981
1989 public WikiNode fetchByGroupId_Last(long groupId,
1990 OrderByComparator orderByComparator) throws SystemException {
1991 int count = countByGroupId(groupId);
1992
1993 List<WikiNode> list = findByGroupId(groupId, count - 1, count,
1994 orderByComparator);
1995
1996 if (!list.isEmpty()) {
1997 return list.get(0);
1998 }
1999
2000 return null;
2001 }
2002
2003
2013 public WikiNode[] findByGroupId_PrevAndNext(long nodeId, long groupId,
2014 OrderByComparator orderByComparator)
2015 throws NoSuchNodeException, SystemException {
2016 WikiNode wikiNode = findByPrimaryKey(nodeId);
2017
2018 Session session = null;
2019
2020 try {
2021 session = openSession();
2022
2023 WikiNode[] array = new WikiNodeImpl[3];
2024
2025 array[0] = getByGroupId_PrevAndNext(session, wikiNode, groupId,
2026 orderByComparator, true);
2027
2028 array[1] = wikiNode;
2029
2030 array[2] = getByGroupId_PrevAndNext(session, wikiNode, groupId,
2031 orderByComparator, false);
2032
2033 return array;
2034 }
2035 catch (Exception e) {
2036 throw processException(e);
2037 }
2038 finally {
2039 closeSession(session);
2040 }
2041 }
2042
2043 protected WikiNode getByGroupId_PrevAndNext(Session session,
2044 WikiNode wikiNode, long groupId, OrderByComparator orderByComparator,
2045 boolean previous) {
2046 StringBundler query = null;
2047
2048 if (orderByComparator != null) {
2049 query = new StringBundler(6 +
2050 (orderByComparator.getOrderByFields().length * 6));
2051 }
2052 else {
2053 query = new StringBundler(3);
2054 }
2055
2056 query.append(_SQL_SELECT_WIKINODE_WHERE);
2057
2058 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2059
2060 if (orderByComparator != null) {
2061 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2062
2063 if (orderByConditionFields.length > 0) {
2064 query.append(WHERE_AND);
2065 }
2066
2067 for (int i = 0; i < orderByConditionFields.length; i++) {
2068 query.append(_ORDER_BY_ENTITY_ALIAS);
2069 query.append(orderByConditionFields[i]);
2070
2071 if ((i + 1) < orderByConditionFields.length) {
2072 if (orderByComparator.isAscending() ^ previous) {
2073 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2074 }
2075 else {
2076 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2077 }
2078 }
2079 else {
2080 if (orderByComparator.isAscending() ^ previous) {
2081 query.append(WHERE_GREATER_THAN);
2082 }
2083 else {
2084 query.append(WHERE_LESSER_THAN);
2085 }
2086 }
2087 }
2088
2089 query.append(ORDER_BY_CLAUSE);
2090
2091 String[] orderByFields = orderByComparator.getOrderByFields();
2092
2093 for (int i = 0; i < orderByFields.length; i++) {
2094 query.append(_ORDER_BY_ENTITY_ALIAS);
2095 query.append(orderByFields[i]);
2096
2097 if ((i + 1) < orderByFields.length) {
2098 if (orderByComparator.isAscending() ^ previous) {
2099 query.append(ORDER_BY_ASC_HAS_NEXT);
2100 }
2101 else {
2102 query.append(ORDER_BY_DESC_HAS_NEXT);
2103 }
2104 }
2105 else {
2106 if (orderByComparator.isAscending() ^ previous) {
2107 query.append(ORDER_BY_ASC);
2108 }
2109 else {
2110 query.append(ORDER_BY_DESC);
2111 }
2112 }
2113 }
2114 }
2115
2116 else {
2117 query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
2118 }
2119
2120 String sql = query.toString();
2121
2122 Query q = session.createQuery(sql);
2123
2124 q.setFirstResult(0);
2125 q.setMaxResults(2);
2126
2127 QueryPos qPos = QueryPos.getInstance(q);
2128
2129 qPos.add(groupId);
2130
2131 if (orderByComparator != null) {
2132 Object[] values = orderByComparator.getOrderByConditionValues(wikiNode);
2133
2134 for (Object value : values) {
2135 qPos.add(value);
2136 }
2137 }
2138
2139 List<WikiNode> list = q.list();
2140
2141 if (list.size() == 2) {
2142 return list.get(1);
2143 }
2144 else {
2145 return null;
2146 }
2147 }
2148
2149
2156 public List<WikiNode> filterFindByGroupId(long groupId)
2157 throws SystemException {
2158 return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
2159 QueryUtil.ALL_POS, null);
2160 }
2161
2162
2175 public List<WikiNode> filterFindByGroupId(long groupId, int start, int end)
2176 throws SystemException {
2177 return filterFindByGroupId(groupId, start, end, null);
2178 }
2179
2180
2194 public List<WikiNode> filterFindByGroupId(long groupId, int start, int end,
2195 OrderByComparator orderByComparator) throws SystemException {
2196 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2197 return findByGroupId(groupId, start, end, orderByComparator);
2198 }
2199
2200 StringBundler query = null;
2201
2202 if (orderByComparator != null) {
2203 query = new StringBundler(3 +
2204 (orderByComparator.getOrderByFields().length * 3));
2205 }
2206 else {
2207 query = new StringBundler(3);
2208 }
2209
2210 if (getDB().isSupportsInlineDistinct()) {
2211 query.append(_FILTER_SQL_SELECT_WIKINODE_WHERE);
2212 }
2213 else {
2214 query.append(_FILTER_SQL_SELECT_WIKINODE_NO_INLINE_DISTINCT_WHERE_1);
2215 }
2216
2217 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2218
2219 if (!getDB().isSupportsInlineDistinct()) {
2220 query.append(_FILTER_SQL_SELECT_WIKINODE_NO_INLINE_DISTINCT_WHERE_2);
2221 }
2222
2223 if (orderByComparator != null) {
2224 if (getDB().isSupportsInlineDistinct()) {
2225 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2226 orderByComparator);
2227 }
2228 else {
2229 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
2230 orderByComparator);
2231 }
2232 }
2233
2234 else {
2235 if (getDB().isSupportsInlineDistinct()) {
2236 query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
2237 }
2238 else {
2239 query.append(WikiNodeModelImpl.ORDER_BY_SQL);
2240 }
2241 }
2242
2243 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2244 WikiNode.class.getName(),
2245 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2246
2247 Session session = null;
2248
2249 try {
2250 session = openSession();
2251
2252 SQLQuery q = session.createSQLQuery(sql);
2253
2254 if (getDB().isSupportsInlineDistinct()) {
2255 q.addEntity(_FILTER_ENTITY_ALIAS, WikiNodeImpl.class);
2256 }
2257 else {
2258 q.addEntity(_FILTER_ENTITY_TABLE, WikiNodeImpl.class);
2259 }
2260
2261 QueryPos qPos = QueryPos.getInstance(q);
2262
2263 qPos.add(groupId);
2264
2265 return (List<WikiNode>)QueryUtil.list(q, getDialect(), start, end);
2266 }
2267 catch (Exception e) {
2268 throw processException(e);
2269 }
2270 finally {
2271 closeSession(session);
2272 }
2273 }
2274
2275
2285 public WikiNode[] filterFindByGroupId_PrevAndNext(long nodeId,
2286 long groupId, OrderByComparator orderByComparator)
2287 throws NoSuchNodeException, SystemException {
2288 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2289 return findByGroupId_PrevAndNext(nodeId, groupId, orderByComparator);
2290 }
2291
2292 WikiNode wikiNode = findByPrimaryKey(nodeId);
2293
2294 Session session = null;
2295
2296 try {
2297 session = openSession();
2298
2299 WikiNode[] array = new WikiNodeImpl[3];
2300
2301 array[0] = filterGetByGroupId_PrevAndNext(session, wikiNode,
2302 groupId, orderByComparator, true);
2303
2304 array[1] = wikiNode;
2305
2306 array[2] = filterGetByGroupId_PrevAndNext(session, wikiNode,
2307 groupId, orderByComparator, false);
2308
2309 return array;
2310 }
2311 catch (Exception e) {
2312 throw processException(e);
2313 }
2314 finally {
2315 closeSession(session);
2316 }
2317 }
2318
2319 protected WikiNode filterGetByGroupId_PrevAndNext(Session session,
2320 WikiNode wikiNode, long groupId, OrderByComparator orderByComparator,
2321 boolean previous) {
2322 StringBundler query = null;
2323
2324 if (orderByComparator != null) {
2325 query = new StringBundler(6 +
2326 (orderByComparator.getOrderByFields().length * 6));
2327 }
2328 else {
2329 query = new StringBundler(3);
2330 }
2331
2332 if (getDB().isSupportsInlineDistinct()) {
2333 query.append(_FILTER_SQL_SELECT_WIKINODE_WHERE);
2334 }
2335 else {
2336 query.append(_FILTER_SQL_SELECT_WIKINODE_NO_INLINE_DISTINCT_WHERE_1);
2337 }
2338
2339 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2340
2341 if (!getDB().isSupportsInlineDistinct()) {
2342 query.append(_FILTER_SQL_SELECT_WIKINODE_NO_INLINE_DISTINCT_WHERE_2);
2343 }
2344
2345 if (orderByComparator != null) {
2346 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2347
2348 if (orderByConditionFields.length > 0) {
2349 query.append(WHERE_AND);
2350 }
2351
2352 for (int i = 0; i < orderByConditionFields.length; i++) {
2353 if (getDB().isSupportsInlineDistinct()) {
2354 query.append(_ORDER_BY_ENTITY_ALIAS);
2355 }
2356 else {
2357 query.append(_ORDER_BY_ENTITY_TABLE);
2358 }
2359
2360 query.append(orderByConditionFields[i]);
2361
2362 if ((i + 1) < orderByConditionFields.length) {
2363 if (orderByComparator.isAscending() ^ previous) {
2364 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2365 }
2366 else {
2367 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2368 }
2369 }
2370 else {
2371 if (orderByComparator.isAscending() ^ previous) {
2372 query.append(WHERE_GREATER_THAN);
2373 }
2374 else {
2375 query.append(WHERE_LESSER_THAN);
2376 }
2377 }
2378 }
2379
2380 query.append(ORDER_BY_CLAUSE);
2381
2382 String[] orderByFields = orderByComparator.getOrderByFields();
2383
2384 for (int i = 0; i < orderByFields.length; i++) {
2385 if (getDB().isSupportsInlineDistinct()) {
2386 query.append(_ORDER_BY_ENTITY_ALIAS);
2387 }
2388 else {
2389 query.append(_ORDER_BY_ENTITY_TABLE);
2390 }
2391
2392 query.append(orderByFields[i]);
2393
2394 if ((i + 1) < orderByFields.length) {
2395 if (orderByComparator.isAscending() ^ previous) {
2396 query.append(ORDER_BY_ASC_HAS_NEXT);
2397 }
2398 else {
2399 query.append(ORDER_BY_DESC_HAS_NEXT);
2400 }
2401 }
2402 else {
2403 if (orderByComparator.isAscending() ^ previous) {
2404 query.append(ORDER_BY_ASC);
2405 }
2406 else {
2407 query.append(ORDER_BY_DESC);
2408 }
2409 }
2410 }
2411 }
2412
2413 else {
2414 if (getDB().isSupportsInlineDistinct()) {
2415 query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
2416 }
2417 else {
2418 query.append(WikiNodeModelImpl.ORDER_BY_SQL);
2419 }
2420 }
2421
2422 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2423 WikiNode.class.getName(),
2424 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2425
2426 SQLQuery q = session.createSQLQuery(sql);
2427
2428 q.setFirstResult(0);
2429 q.setMaxResults(2);
2430
2431 if (getDB().isSupportsInlineDistinct()) {
2432 q.addEntity(_FILTER_ENTITY_ALIAS, WikiNodeImpl.class);
2433 }
2434 else {
2435 q.addEntity(_FILTER_ENTITY_TABLE, WikiNodeImpl.class);
2436 }
2437
2438 QueryPos qPos = QueryPos.getInstance(q);
2439
2440 qPos.add(groupId);
2441
2442 if (orderByComparator != null) {
2443 Object[] values = orderByComparator.getOrderByConditionValues(wikiNode);
2444
2445 for (Object value : values) {
2446 qPos.add(value);
2447 }
2448 }
2449
2450 List<WikiNode> list = q.list();
2451
2452 if (list.size() == 2) {
2453 return list.get(1);
2454 }
2455 else {
2456 return null;
2457 }
2458 }
2459
2460
2467 public List<WikiNode> findByCompanyId(long companyId)
2468 throws SystemException {
2469 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
2470 null);
2471 }
2472
2473
2486 public List<WikiNode> findByCompanyId(long companyId, int start, int end)
2487 throws SystemException {
2488 return findByCompanyId(companyId, start, end, null);
2489 }
2490
2491
2505 public List<WikiNode> findByCompanyId(long companyId, int start, int end,
2506 OrderByComparator orderByComparator) throws SystemException {
2507 FinderPath finderPath = null;
2508 Object[] finderArgs = null;
2509
2510 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2511 (orderByComparator == null)) {
2512 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID;
2513 finderArgs = new Object[] { companyId };
2514 }
2515 else {
2516 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID;
2517 finderArgs = new Object[] { companyId, start, end, orderByComparator };
2518 }
2519
2520 List<WikiNode> list = (List<WikiNode>)FinderCacheUtil.getResult(finderPath,
2521 finderArgs, this);
2522
2523 if ((list != null) && !list.isEmpty()) {
2524 for (WikiNode wikiNode : list) {
2525 if ((companyId != wikiNode.getCompanyId())) {
2526 list = null;
2527
2528 break;
2529 }
2530 }
2531 }
2532
2533 if (list == null) {
2534 StringBundler query = null;
2535
2536 if (orderByComparator != null) {
2537 query = new StringBundler(3 +
2538 (orderByComparator.getOrderByFields().length * 3));
2539 }
2540 else {
2541 query = new StringBundler(3);
2542 }
2543
2544 query.append(_SQL_SELECT_WIKINODE_WHERE);
2545
2546 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2547
2548 if (orderByComparator != null) {
2549 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2550 orderByComparator);
2551 }
2552
2553 else {
2554 query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
2555 }
2556
2557 String sql = query.toString();
2558
2559 Session session = null;
2560
2561 try {
2562 session = openSession();
2563
2564 Query q = session.createQuery(sql);
2565
2566 QueryPos qPos = QueryPos.getInstance(q);
2567
2568 qPos.add(companyId);
2569
2570 list = (List<WikiNode>)QueryUtil.list(q, getDialect(), start,
2571 end);
2572 }
2573 catch (Exception e) {
2574 throw processException(e);
2575 }
2576 finally {
2577 if (list == null) {
2578 FinderCacheUtil.removeResult(finderPath, finderArgs);
2579 }
2580 else {
2581 cacheResult(list);
2582
2583 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2584 }
2585
2586 closeSession(session);
2587 }
2588 }
2589
2590 return list;
2591 }
2592
2593
2602 public WikiNode findByCompanyId_First(long companyId,
2603 OrderByComparator orderByComparator)
2604 throws NoSuchNodeException, SystemException {
2605 WikiNode wikiNode = fetchByCompanyId_First(companyId, orderByComparator);
2606
2607 if (wikiNode != null) {
2608 return wikiNode;
2609 }
2610
2611 StringBundler msg = new StringBundler(4);
2612
2613 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2614
2615 msg.append("companyId=");
2616 msg.append(companyId);
2617
2618 msg.append(StringPool.CLOSE_CURLY_BRACE);
2619
2620 throw new NoSuchNodeException(msg.toString());
2621 }
2622
2623
2631 public WikiNode fetchByCompanyId_First(long companyId,
2632 OrderByComparator orderByComparator) throws SystemException {
2633 List<WikiNode> list = findByCompanyId(companyId, 0, 1, orderByComparator);
2634
2635 if (!list.isEmpty()) {
2636 return list.get(0);
2637 }
2638
2639 return null;
2640 }
2641
2642
2651 public WikiNode findByCompanyId_Last(long companyId,
2652 OrderByComparator orderByComparator)
2653 throws NoSuchNodeException, SystemException {
2654 WikiNode wikiNode = fetchByCompanyId_Last(companyId, orderByComparator);
2655
2656 if (wikiNode != null) {
2657 return wikiNode;
2658 }
2659
2660 StringBundler msg = new StringBundler(4);
2661
2662 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2663
2664 msg.append("companyId=");
2665 msg.append(companyId);
2666
2667 msg.append(StringPool.CLOSE_CURLY_BRACE);
2668
2669 throw new NoSuchNodeException(msg.toString());
2670 }
2671
2672
2680 public WikiNode fetchByCompanyId_Last(long companyId,
2681 OrderByComparator orderByComparator) throws SystemException {
2682 int count = countByCompanyId(companyId);
2683
2684 List<WikiNode> list = findByCompanyId(companyId, count - 1, count,
2685 orderByComparator);
2686
2687 if (!list.isEmpty()) {
2688 return list.get(0);
2689 }
2690
2691 return null;
2692 }
2693
2694
2704 public WikiNode[] findByCompanyId_PrevAndNext(long nodeId, long companyId,
2705 OrderByComparator orderByComparator)
2706 throws NoSuchNodeException, SystemException {
2707 WikiNode wikiNode = findByPrimaryKey(nodeId);
2708
2709 Session session = null;
2710
2711 try {
2712 session = openSession();
2713
2714 WikiNode[] array = new WikiNodeImpl[3];
2715
2716 array[0] = getByCompanyId_PrevAndNext(session, wikiNode, companyId,
2717 orderByComparator, true);
2718
2719 array[1] = wikiNode;
2720
2721 array[2] = getByCompanyId_PrevAndNext(session, wikiNode, companyId,
2722 orderByComparator, false);
2723
2724 return array;
2725 }
2726 catch (Exception e) {
2727 throw processException(e);
2728 }
2729 finally {
2730 closeSession(session);
2731 }
2732 }
2733
2734 protected WikiNode getByCompanyId_PrevAndNext(Session session,
2735 WikiNode wikiNode, long companyId, OrderByComparator orderByComparator,
2736 boolean previous) {
2737 StringBundler query = null;
2738
2739 if (orderByComparator != null) {
2740 query = new StringBundler(6 +
2741 (orderByComparator.getOrderByFields().length * 6));
2742 }
2743 else {
2744 query = new StringBundler(3);
2745 }
2746
2747 query.append(_SQL_SELECT_WIKINODE_WHERE);
2748
2749 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2750
2751 if (orderByComparator != null) {
2752 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2753
2754 if (orderByConditionFields.length > 0) {
2755 query.append(WHERE_AND);
2756 }
2757
2758 for (int i = 0; i < orderByConditionFields.length; i++) {
2759 query.append(_ORDER_BY_ENTITY_ALIAS);
2760 query.append(orderByConditionFields[i]);
2761
2762 if ((i + 1) < orderByConditionFields.length) {
2763 if (orderByComparator.isAscending() ^ previous) {
2764 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2765 }
2766 else {
2767 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2768 }
2769 }
2770 else {
2771 if (orderByComparator.isAscending() ^ previous) {
2772 query.append(WHERE_GREATER_THAN);
2773 }
2774 else {
2775 query.append(WHERE_LESSER_THAN);
2776 }
2777 }
2778 }
2779
2780 query.append(ORDER_BY_CLAUSE);
2781
2782 String[] orderByFields = orderByComparator.getOrderByFields();
2783
2784 for (int i = 0; i < orderByFields.length; i++) {
2785 query.append(_ORDER_BY_ENTITY_ALIAS);
2786 query.append(orderByFields[i]);
2787
2788 if ((i + 1) < orderByFields.length) {
2789 if (orderByComparator.isAscending() ^ previous) {
2790 query.append(ORDER_BY_ASC_HAS_NEXT);
2791 }
2792 else {
2793 query.append(ORDER_BY_DESC_HAS_NEXT);
2794 }
2795 }
2796 else {
2797 if (orderByComparator.isAscending() ^ previous) {
2798 query.append(ORDER_BY_ASC);
2799 }
2800 else {
2801 query.append(ORDER_BY_DESC);
2802 }
2803 }
2804 }
2805 }
2806
2807 else {
2808 query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
2809 }
2810
2811 String sql = query.toString();
2812
2813 Query q = session.createQuery(sql);
2814
2815 q.setFirstResult(0);
2816 q.setMaxResults(2);
2817
2818 QueryPos qPos = QueryPos.getInstance(q);
2819
2820 qPos.add(companyId);
2821
2822 if (orderByComparator != null) {
2823 Object[] values = orderByComparator.getOrderByConditionValues(wikiNode);
2824
2825 for (Object value : values) {
2826 qPos.add(value);
2827 }
2828 }
2829
2830 List<WikiNode> list = q.list();
2831
2832 if (list.size() == 2) {
2833 return list.get(1);
2834 }
2835 else {
2836 return null;
2837 }
2838 }
2839
2840
2849 public WikiNode findByG_N(long groupId, String name)
2850 throws NoSuchNodeException, SystemException {
2851 WikiNode wikiNode = fetchByG_N(groupId, name);
2852
2853 if (wikiNode == null) {
2854 StringBundler msg = new StringBundler(6);
2855
2856 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2857
2858 msg.append("groupId=");
2859 msg.append(groupId);
2860
2861 msg.append(", name=");
2862 msg.append(name);
2863
2864 msg.append(StringPool.CLOSE_CURLY_BRACE);
2865
2866 if (_log.isWarnEnabled()) {
2867 _log.warn(msg.toString());
2868 }
2869
2870 throw new NoSuchNodeException(msg.toString());
2871 }
2872
2873 return wikiNode;
2874 }
2875
2876
2884 public WikiNode fetchByG_N(long groupId, String name)
2885 throws SystemException {
2886 return fetchByG_N(groupId, name, true);
2887 }
2888
2889
2898 public WikiNode fetchByG_N(long groupId, String name,
2899 boolean retrieveFromCache) throws SystemException {
2900 Object[] finderArgs = new Object[] { groupId, name };
2901
2902 Object result = null;
2903
2904 if (retrieveFromCache) {
2905 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_N,
2906 finderArgs, this);
2907 }
2908
2909 if (result instanceof WikiNode) {
2910 WikiNode wikiNode = (WikiNode)result;
2911
2912 if ((groupId != wikiNode.getGroupId()) ||
2913 !Validator.equals(name, wikiNode.getName())) {
2914 result = null;
2915 }
2916 }
2917
2918 if (result == null) {
2919 StringBundler query = new StringBundler(4);
2920
2921 query.append(_SQL_SELECT_WIKINODE_WHERE);
2922
2923 query.append(_FINDER_COLUMN_G_N_GROUPID_2);
2924
2925 if (name == null) {
2926 query.append(_FINDER_COLUMN_G_N_NAME_1);
2927 }
2928 else {
2929 if (name.equals(StringPool.BLANK)) {
2930 query.append(_FINDER_COLUMN_G_N_NAME_3);
2931 }
2932 else {
2933 query.append(_FINDER_COLUMN_G_N_NAME_2);
2934 }
2935 }
2936
2937 query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
2938
2939 String sql = query.toString();
2940
2941 Session session = null;
2942
2943 try {
2944 session = openSession();
2945
2946 Query q = session.createQuery(sql);
2947
2948 QueryPos qPos = QueryPos.getInstance(q);
2949
2950 qPos.add(groupId);
2951
2952 if (name != null) {
2953 qPos.add(name);
2954 }
2955
2956 List<WikiNode> list = q.list();
2957
2958 result = list;
2959
2960 WikiNode wikiNode = null;
2961
2962 if (list.isEmpty()) {
2963 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
2964 finderArgs, list);
2965 }
2966 else {
2967 wikiNode = list.get(0);
2968
2969 cacheResult(wikiNode);
2970
2971 if ((wikiNode.getGroupId() != groupId) ||
2972 (wikiNode.getName() == null) ||
2973 !wikiNode.getName().equals(name)) {
2974 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N,
2975 finderArgs, wikiNode);
2976 }
2977 }
2978
2979 return wikiNode;
2980 }
2981 catch (Exception e) {
2982 throw processException(e);
2983 }
2984 finally {
2985 if (result == null) {
2986 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_N,
2987 finderArgs);
2988 }
2989
2990 closeSession(session);
2991 }
2992 }
2993 else {
2994 if (result instanceof List<?>) {
2995 return null;
2996 }
2997 else {
2998 return (WikiNode)result;
2999 }
3000 }
3001 }
3002
3003
3011 public List<WikiNode> findByG_S(long groupId, int status)
3012 throws SystemException {
3013 return findByG_S(groupId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
3014 null);
3015 }
3016
3017
3031 public List<WikiNode> findByG_S(long groupId, int status, int start, int end)
3032 throws SystemException {
3033 return findByG_S(groupId, status, start, end, null);
3034 }
3035
3036
3051 public List<WikiNode> findByG_S(long groupId, int status, int start,
3052 int end, OrderByComparator orderByComparator) throws SystemException {
3053 FinderPath finderPath = null;
3054 Object[] finderArgs = null;
3055
3056 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
3057 (orderByComparator == null)) {
3058 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S;
3059 finderArgs = new Object[] { groupId, status };
3060 }
3061 else {
3062 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_S;
3063 finderArgs = new Object[] {
3064 groupId, status,
3065
3066 start, end, orderByComparator
3067 };
3068 }
3069
3070 List<WikiNode> list = (List<WikiNode>)FinderCacheUtil.getResult(finderPath,
3071 finderArgs, this);
3072
3073 if ((list != null) && !list.isEmpty()) {
3074 for (WikiNode wikiNode : list) {
3075 if ((groupId != wikiNode.getGroupId()) ||
3076 (status != wikiNode.getStatus())) {
3077 list = null;
3078
3079 break;
3080 }
3081 }
3082 }
3083
3084 if (list == null) {
3085 StringBundler query = null;
3086
3087 if (orderByComparator != null) {
3088 query = new StringBundler(4 +
3089 (orderByComparator.getOrderByFields().length * 3));
3090 }
3091 else {
3092 query = new StringBundler(4);
3093 }
3094
3095 query.append(_SQL_SELECT_WIKINODE_WHERE);
3096
3097 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
3098
3099 query.append(_FINDER_COLUMN_G_S_STATUS_2);
3100
3101 if (orderByComparator != null) {
3102 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3103 orderByComparator);
3104 }
3105
3106 else {
3107 query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
3108 }
3109
3110 String sql = query.toString();
3111
3112 Session session = null;
3113
3114 try {
3115 session = openSession();
3116
3117 Query q = session.createQuery(sql);
3118
3119 QueryPos qPos = QueryPos.getInstance(q);
3120
3121 qPos.add(groupId);
3122
3123 qPos.add(status);
3124
3125 list = (List<WikiNode>)QueryUtil.list(q, getDialect(), start,
3126 end);
3127 }
3128 catch (Exception e) {
3129 throw processException(e);
3130 }
3131 finally {
3132 if (list == null) {
3133 FinderCacheUtil.removeResult(finderPath, finderArgs);
3134 }
3135 else {
3136 cacheResult(list);
3137
3138 FinderCacheUtil.putResult(finderPath, finderArgs, list);
3139 }
3140
3141 closeSession(session);
3142 }
3143 }
3144
3145 return list;
3146 }
3147
3148
3158 public WikiNode findByG_S_First(long groupId, int status,
3159 OrderByComparator orderByComparator)
3160 throws NoSuchNodeException, SystemException {
3161 WikiNode wikiNode = fetchByG_S_First(groupId, status, orderByComparator);
3162
3163 if (wikiNode != null) {
3164 return wikiNode;
3165 }
3166
3167 StringBundler msg = new StringBundler(6);
3168
3169 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3170
3171 msg.append("groupId=");
3172 msg.append(groupId);
3173
3174 msg.append(", status=");
3175 msg.append(status);
3176
3177 msg.append(StringPool.CLOSE_CURLY_BRACE);
3178
3179 throw new NoSuchNodeException(msg.toString());
3180 }
3181
3182
3191 public WikiNode fetchByG_S_First(long groupId, int status,
3192 OrderByComparator orderByComparator) throws SystemException {
3193 List<WikiNode> list = findByG_S(groupId, status, 0, 1, orderByComparator);
3194
3195 if (!list.isEmpty()) {
3196 return list.get(0);
3197 }
3198
3199 return null;
3200 }
3201
3202
3212 public WikiNode findByG_S_Last(long groupId, int status,
3213 OrderByComparator orderByComparator)
3214 throws NoSuchNodeException, SystemException {
3215 WikiNode wikiNode = fetchByG_S_Last(groupId, status, orderByComparator);
3216
3217 if (wikiNode != null) {
3218 return wikiNode;
3219 }
3220
3221 StringBundler msg = new StringBundler(6);
3222
3223 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3224
3225 msg.append("groupId=");
3226 msg.append(groupId);
3227
3228 msg.append(", status=");
3229 msg.append(status);
3230
3231 msg.append(StringPool.CLOSE_CURLY_BRACE);
3232
3233 throw new NoSuchNodeException(msg.toString());
3234 }
3235
3236
3245 public WikiNode fetchByG_S_Last(long groupId, int status,
3246 OrderByComparator orderByComparator) throws SystemException {
3247 int count = countByG_S(groupId, status);
3248
3249 List<WikiNode> list = findByG_S(groupId, status, count - 1, count,
3250 orderByComparator);
3251
3252 if (!list.isEmpty()) {
3253 return list.get(0);
3254 }
3255
3256 return null;
3257 }
3258
3259
3270 public WikiNode[] findByG_S_PrevAndNext(long nodeId, long groupId,
3271 int status, OrderByComparator orderByComparator)
3272 throws NoSuchNodeException, SystemException {
3273 WikiNode wikiNode = findByPrimaryKey(nodeId);
3274
3275 Session session = null;
3276
3277 try {
3278 session = openSession();
3279
3280 WikiNode[] array = new WikiNodeImpl[3];
3281
3282 array[0] = getByG_S_PrevAndNext(session, wikiNode, groupId, status,
3283 orderByComparator, true);
3284
3285 array[1] = wikiNode;
3286
3287 array[2] = getByG_S_PrevAndNext(session, wikiNode, groupId, status,
3288 orderByComparator, false);
3289
3290 return array;
3291 }
3292 catch (Exception e) {
3293 throw processException(e);
3294 }
3295 finally {
3296 closeSession(session);
3297 }
3298 }
3299
3300 protected WikiNode getByG_S_PrevAndNext(Session session, WikiNode wikiNode,
3301 long groupId, int status, OrderByComparator orderByComparator,
3302 boolean previous) {
3303 StringBundler query = null;
3304
3305 if (orderByComparator != null) {
3306 query = new StringBundler(6 +
3307 (orderByComparator.getOrderByFields().length * 6));
3308 }
3309 else {
3310 query = new StringBundler(3);
3311 }
3312
3313 query.append(_SQL_SELECT_WIKINODE_WHERE);
3314
3315 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
3316
3317 query.append(_FINDER_COLUMN_G_S_STATUS_2);
3318
3319 if (orderByComparator != null) {
3320 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
3321
3322 if (orderByConditionFields.length > 0) {
3323 query.append(WHERE_AND);
3324 }
3325
3326 for (int i = 0; i < orderByConditionFields.length; i++) {
3327 query.append(_ORDER_BY_ENTITY_ALIAS);
3328 query.append(orderByConditionFields[i]);
3329
3330 if ((i + 1) < orderByConditionFields.length) {
3331 if (orderByComparator.isAscending() ^ previous) {
3332 query.append(WHERE_GREATER_THAN_HAS_NEXT);
3333 }
3334 else {
3335 query.append(WHERE_LESSER_THAN_HAS_NEXT);
3336 }
3337 }
3338 else {
3339 if (orderByComparator.isAscending() ^ previous) {
3340 query.append(WHERE_GREATER_THAN);
3341 }
3342 else {
3343 query.append(WHERE_LESSER_THAN);
3344 }
3345 }
3346 }
3347
3348 query.append(ORDER_BY_CLAUSE);
3349
3350 String[] orderByFields = orderByComparator.getOrderByFields();
3351
3352 for (int i = 0; i < orderByFields.length; i++) {
3353 query.append(_ORDER_BY_ENTITY_ALIAS);
3354 query.append(orderByFields[i]);
3355
3356 if ((i + 1) < orderByFields.length) {
3357 if (orderByComparator.isAscending() ^ previous) {
3358 query.append(ORDER_BY_ASC_HAS_NEXT);
3359 }
3360 else {
3361 query.append(ORDER_BY_DESC_HAS_NEXT);
3362 }
3363 }
3364 else {
3365 if (orderByComparator.isAscending() ^ previous) {
3366 query.append(ORDER_BY_ASC);
3367 }
3368 else {
3369 query.append(ORDER_BY_DESC);
3370 }
3371 }
3372 }
3373 }
3374
3375 else {
3376 query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
3377 }
3378
3379 String sql = query.toString();
3380
3381 Query q = session.createQuery(sql);
3382
3383 q.setFirstResult(0);
3384 q.setMaxResults(2);
3385
3386 QueryPos qPos = QueryPos.getInstance(q);
3387
3388 qPos.add(groupId);
3389
3390 qPos.add(status);
3391
3392 if (orderByComparator != null) {
3393 Object[] values = orderByComparator.getOrderByConditionValues(wikiNode);
3394
3395 for (Object value : values) {
3396 qPos.add(value);
3397 }
3398 }
3399
3400 List<WikiNode> list = q.list();
3401
3402 if (list.size() == 2) {
3403 return list.get(1);
3404 }
3405 else {
3406 return null;
3407 }
3408 }
3409
3410
3418 public List<WikiNode> filterFindByG_S(long groupId, int status)
3419 throws SystemException {
3420 return filterFindByG_S(groupId, status, QueryUtil.ALL_POS,
3421 QueryUtil.ALL_POS, null);
3422 }
3423
3424
3438 public List<WikiNode> filterFindByG_S(long groupId, int status, int start,
3439 int end) throws SystemException {
3440 return filterFindByG_S(groupId, status, start, end, null);
3441 }
3442
3443
3458 public List<WikiNode> filterFindByG_S(long groupId, int status, int start,
3459 int end, OrderByComparator orderByComparator) throws SystemException {
3460 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3461 return findByG_S(groupId, status, start, end, orderByComparator);
3462 }
3463
3464 StringBundler query = null;
3465
3466 if (orderByComparator != null) {
3467 query = new StringBundler(4 +
3468 (orderByComparator.getOrderByFields().length * 3));
3469 }
3470 else {
3471 query = new StringBundler(4);
3472 }
3473
3474 if (getDB().isSupportsInlineDistinct()) {
3475 query.append(_FILTER_SQL_SELECT_WIKINODE_WHERE);
3476 }
3477 else {
3478 query.append(_FILTER_SQL_SELECT_WIKINODE_NO_INLINE_DISTINCT_WHERE_1);
3479 }
3480
3481 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
3482
3483 query.append(_FINDER_COLUMN_G_S_STATUS_2);
3484
3485 if (!getDB().isSupportsInlineDistinct()) {
3486 query.append(_FILTER_SQL_SELECT_WIKINODE_NO_INLINE_DISTINCT_WHERE_2);
3487 }
3488
3489 if (orderByComparator != null) {
3490 if (getDB().isSupportsInlineDistinct()) {
3491 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3492 orderByComparator);
3493 }
3494 else {
3495 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
3496 orderByComparator);
3497 }
3498 }
3499
3500 else {
3501 if (getDB().isSupportsInlineDistinct()) {
3502 query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
3503 }
3504 else {
3505 query.append(WikiNodeModelImpl.ORDER_BY_SQL);
3506 }
3507 }
3508
3509 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3510 WikiNode.class.getName(),
3511 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
3512
3513 Session session = null;
3514
3515 try {
3516 session = openSession();
3517
3518 SQLQuery q = session.createSQLQuery(sql);
3519
3520 if (getDB().isSupportsInlineDistinct()) {
3521 q.addEntity(_FILTER_ENTITY_ALIAS, WikiNodeImpl.class);
3522 }
3523 else {
3524 q.addEntity(_FILTER_ENTITY_TABLE, WikiNodeImpl.class);
3525 }
3526
3527 QueryPos qPos = QueryPos.getInstance(q);
3528
3529 qPos.add(groupId);
3530
3531 qPos.add(status);
3532
3533 return (List<WikiNode>)QueryUtil.list(q, getDialect(), start, end);
3534 }
3535 catch (Exception e) {
3536 throw processException(e);
3537 }
3538 finally {
3539 closeSession(session);
3540 }
3541 }
3542
3543
3554 public WikiNode[] filterFindByG_S_PrevAndNext(long nodeId, long groupId,
3555 int status, OrderByComparator orderByComparator)
3556 throws NoSuchNodeException, SystemException {
3557 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3558 return findByG_S_PrevAndNext(nodeId, groupId, status,
3559 orderByComparator);
3560 }
3561
3562 WikiNode wikiNode = findByPrimaryKey(nodeId);
3563
3564 Session session = null;
3565
3566 try {
3567 session = openSession();
3568
3569 WikiNode[] array = new WikiNodeImpl[3];
3570
3571 array[0] = filterGetByG_S_PrevAndNext(session, wikiNode, groupId,
3572 status, orderByComparator, true);
3573
3574 array[1] = wikiNode;
3575
3576 array[2] = filterGetByG_S_PrevAndNext(session, wikiNode, groupId,
3577 status, orderByComparator, false);
3578
3579 return array;
3580 }
3581 catch (Exception e) {
3582 throw processException(e);
3583 }
3584 finally {
3585 closeSession(session);
3586 }
3587 }
3588
3589 protected WikiNode filterGetByG_S_PrevAndNext(Session session,
3590 WikiNode wikiNode, long groupId, int status,
3591 OrderByComparator orderByComparator, boolean previous) {
3592 StringBundler query = null;
3593
3594 if (orderByComparator != null) {
3595 query = new StringBundler(6 +
3596 (orderByComparator.getOrderByFields().length * 6));
3597 }
3598 else {
3599 query = new StringBundler(3);
3600 }
3601
3602 if (getDB().isSupportsInlineDistinct()) {
3603 query.append(_FILTER_SQL_SELECT_WIKINODE_WHERE);
3604 }
3605 else {
3606 query.append(_FILTER_SQL_SELECT_WIKINODE_NO_INLINE_DISTINCT_WHERE_1);
3607 }
3608
3609 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
3610
3611 query.append(_FINDER_COLUMN_G_S_STATUS_2);
3612
3613 if (!getDB().isSupportsInlineDistinct()) {
3614 query.append(_FILTER_SQL_SELECT_WIKINODE_NO_INLINE_DISTINCT_WHERE_2);
3615 }
3616
3617 if (orderByComparator != null) {
3618 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
3619
3620 if (orderByConditionFields.length > 0) {
3621 query.append(WHERE_AND);
3622 }
3623
3624 for (int i = 0; i < orderByConditionFields.length; i++) {
3625 if (getDB().isSupportsInlineDistinct()) {
3626 query.append(_ORDER_BY_ENTITY_ALIAS);
3627 }
3628 else {
3629 query.append(_ORDER_BY_ENTITY_TABLE);
3630 }
3631
3632 query.append(orderByConditionFields[i]);
3633
3634 if ((i + 1) < orderByConditionFields.length) {
3635 if (orderByComparator.isAscending() ^ previous) {
3636 query.append(WHERE_GREATER_THAN_HAS_NEXT);
3637 }
3638 else {
3639 query.append(WHERE_LESSER_THAN_HAS_NEXT);
3640 }
3641 }
3642 else {
3643 if (orderByComparator.isAscending() ^ previous) {
3644 query.append(WHERE_GREATER_THAN);
3645 }
3646 else {
3647 query.append(WHERE_LESSER_THAN);
3648 }
3649 }
3650 }
3651
3652 query.append(ORDER_BY_CLAUSE);
3653
3654 String[] orderByFields = orderByComparator.getOrderByFields();
3655
3656 for (int i = 0; i < orderByFields.length; i++) {
3657 if (getDB().isSupportsInlineDistinct()) {
3658 query.append(_ORDER_BY_ENTITY_ALIAS);
3659 }
3660 else {
3661 query.append(_ORDER_BY_ENTITY_TABLE);
3662 }
3663
3664 query.append(orderByFields[i]);
3665
3666 if ((i + 1) < orderByFields.length) {
3667 if (orderByComparator.isAscending() ^ previous) {
3668 query.append(ORDER_BY_ASC_HAS_NEXT);
3669 }
3670 else {
3671 query.append(ORDER_BY_DESC_HAS_NEXT);
3672 }
3673 }
3674 else {
3675 if (orderByComparator.isAscending() ^ previous) {
3676 query.append(ORDER_BY_ASC);
3677 }
3678 else {
3679 query.append(ORDER_BY_DESC);
3680 }
3681 }
3682 }
3683 }
3684
3685 else {
3686 if (getDB().isSupportsInlineDistinct()) {
3687 query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
3688 }
3689 else {
3690 query.append(WikiNodeModelImpl.ORDER_BY_SQL);
3691 }
3692 }
3693
3694 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3695 WikiNode.class.getName(),
3696 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
3697
3698 SQLQuery q = session.createSQLQuery(sql);
3699
3700 q.setFirstResult(0);
3701 q.setMaxResults(2);
3702
3703 if (getDB().isSupportsInlineDistinct()) {
3704 q.addEntity(_FILTER_ENTITY_ALIAS, WikiNodeImpl.class);
3705 }
3706 else {
3707 q.addEntity(_FILTER_ENTITY_TABLE, WikiNodeImpl.class);
3708 }
3709
3710 QueryPos qPos = QueryPos.getInstance(q);
3711
3712 qPos.add(groupId);
3713
3714 qPos.add(status);
3715
3716 if (orderByComparator != null) {
3717 Object[] values = orderByComparator.getOrderByConditionValues(wikiNode);
3718
3719 for (Object value : values) {
3720 qPos.add(value);
3721 }
3722 }
3723
3724 List<WikiNode> list = q.list();
3725
3726 if (list.size() == 2) {
3727 return list.get(1);
3728 }
3729 else {
3730 return null;
3731 }
3732 }
3733
3734
3742 public List<WikiNode> findByC_S(long companyId, int status)
3743 throws SystemException {
3744 return findByC_S(companyId, status, QueryUtil.ALL_POS,
3745 QueryUtil.ALL_POS, null);
3746 }
3747
3748
3762 public List<WikiNode> findByC_S(long companyId, int status, int start,
3763 int end) throws SystemException {
3764 return findByC_S(companyId, status, start, end, null);
3765 }
3766
3767
3782 public List<WikiNode> findByC_S(long companyId, int status, int start,
3783 int end, OrderByComparator orderByComparator) throws SystemException {
3784 FinderPath finderPath = null;
3785 Object[] finderArgs = null;
3786
3787 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
3788 (orderByComparator == null)) {
3789 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_S;
3790 finderArgs = new Object[] { companyId, status };
3791 }
3792 else {
3793 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_S;
3794 finderArgs = new Object[] {
3795 companyId, status,
3796
3797 start, end, orderByComparator
3798 };
3799 }
3800
3801 List<WikiNode> list = (List<WikiNode>)FinderCacheUtil.getResult(finderPath,
3802 finderArgs, this);
3803
3804 if ((list != null) && !list.isEmpty()) {
3805 for (WikiNode wikiNode : list) {
3806 if ((companyId != wikiNode.getCompanyId()) ||
3807 (status != wikiNode.getStatus())) {
3808 list = null;
3809
3810 break;
3811 }
3812 }
3813 }
3814
3815 if (list == null) {
3816 StringBundler query = null;
3817
3818 if (orderByComparator != null) {
3819 query = new StringBundler(4 +
3820 (orderByComparator.getOrderByFields().length * 3));
3821 }
3822 else {
3823 query = new StringBundler(4);
3824 }
3825
3826 query.append(_SQL_SELECT_WIKINODE_WHERE);
3827
3828 query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
3829
3830 query.append(_FINDER_COLUMN_C_S_STATUS_2);
3831
3832 if (orderByComparator != null) {
3833 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3834 orderByComparator);
3835 }
3836
3837 else {
3838 query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
3839 }
3840
3841 String sql = query.toString();
3842
3843 Session session = null;
3844
3845 try {
3846 session = openSession();
3847
3848 Query q = session.createQuery(sql);
3849
3850 QueryPos qPos = QueryPos.getInstance(q);
3851
3852 qPos.add(companyId);
3853
3854 qPos.add(status);
3855
3856 list = (List<WikiNode>)QueryUtil.list(q, getDialect(), start,
3857 end);
3858 }
3859 catch (Exception e) {
3860 throw processException(e);
3861 }
3862 finally {
3863 if (list == null) {
3864 FinderCacheUtil.removeResult(finderPath, finderArgs);
3865 }
3866 else {
3867 cacheResult(list);
3868
3869 FinderCacheUtil.putResult(finderPath, finderArgs, list);
3870 }
3871
3872 closeSession(session);
3873 }
3874 }
3875
3876 return list;
3877 }
3878
3879
3889 public WikiNode findByC_S_First(long companyId, int status,
3890 OrderByComparator orderByComparator)
3891 throws NoSuchNodeException, SystemException {
3892 WikiNode wikiNode = fetchByC_S_First(companyId, status,
3893 orderByComparator);
3894
3895 if (wikiNode != null) {
3896 return wikiNode;
3897 }
3898
3899 StringBundler msg = new StringBundler(6);
3900
3901 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3902
3903 msg.append("companyId=");
3904 msg.append(companyId);
3905
3906 msg.append(", status=");
3907 msg.append(status);
3908
3909 msg.append(StringPool.CLOSE_CURLY_BRACE);
3910
3911 throw new NoSuchNodeException(msg.toString());
3912 }
3913
3914
3923 public WikiNode fetchByC_S_First(long companyId, int status,
3924 OrderByComparator orderByComparator) throws SystemException {
3925 List<WikiNode> list = findByC_S(companyId, status, 0, 1,
3926 orderByComparator);
3927
3928 if (!list.isEmpty()) {
3929 return list.get(0);
3930 }
3931
3932 return null;
3933 }
3934
3935
3945 public WikiNode findByC_S_Last(long companyId, int status,
3946 OrderByComparator orderByComparator)
3947 throws NoSuchNodeException, SystemException {
3948 WikiNode wikiNode = fetchByC_S_Last(companyId, status, orderByComparator);
3949
3950 if (wikiNode != null) {
3951 return wikiNode;
3952 }
3953
3954 StringBundler msg = new StringBundler(6);
3955
3956 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3957
3958 msg.append("companyId=");
3959 msg.append(companyId);
3960
3961 msg.append(", status=");
3962 msg.append(status);
3963
3964 msg.append(StringPool.CLOSE_CURLY_BRACE);
3965
3966 throw new NoSuchNodeException(msg.toString());
3967 }
3968
3969
3978 public WikiNode fetchByC_S_Last(long companyId, int status,
3979 OrderByComparator orderByComparator) throws SystemException {
3980 int count = countByC_S(companyId, status);
3981
3982 List<WikiNode> list = findByC_S(companyId, status, count - 1, count,
3983 orderByComparator);
3984
3985 if (!list.isEmpty()) {
3986 return list.get(0);
3987 }
3988
3989 return null;
3990 }
3991
3992
4003 public WikiNode[] findByC_S_PrevAndNext(long nodeId, long companyId,
4004 int status, OrderByComparator orderByComparator)
4005 throws NoSuchNodeException, SystemException {
4006 WikiNode wikiNode = findByPrimaryKey(nodeId);
4007
4008 Session session = null;
4009
4010 try {
4011 session = openSession();
4012
4013 WikiNode[] array = new WikiNodeImpl[3];
4014
4015 array[0] = getByC_S_PrevAndNext(session, wikiNode, companyId,
4016 status, orderByComparator, true);
4017
4018 array[1] = wikiNode;
4019
4020 array[2] = getByC_S_PrevAndNext(session, wikiNode, companyId,
4021 status, orderByComparator, false);
4022
4023 return array;
4024 }
4025 catch (Exception e) {
4026 throw processException(e);
4027 }
4028 finally {
4029 closeSession(session);
4030 }
4031 }
4032
4033 protected WikiNode getByC_S_PrevAndNext(Session session, WikiNode wikiNode,
4034 long companyId, int status, OrderByComparator orderByComparator,
4035 boolean previous) {
4036 StringBundler query = null;
4037
4038 if (orderByComparator != null) {
4039 query = new StringBundler(6 +
4040 (orderByComparator.getOrderByFields().length * 6));
4041 }
4042 else {
4043 query = new StringBundler(3);
4044 }
4045
4046 query.append(_SQL_SELECT_WIKINODE_WHERE);
4047
4048 query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
4049
4050 query.append(_FINDER_COLUMN_C_S_STATUS_2);
4051
4052 if (orderByComparator != null) {
4053 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
4054
4055 if (orderByConditionFields.length > 0) {
4056 query.append(WHERE_AND);
4057 }
4058
4059 for (int i = 0; i < orderByConditionFields.length; i++) {
4060 query.append(_ORDER_BY_ENTITY_ALIAS);
4061 query.append(orderByConditionFields[i]);
4062
4063 if ((i + 1) < orderByConditionFields.length) {
4064 if (orderByComparator.isAscending() ^ previous) {
4065 query.append(WHERE_GREATER_THAN_HAS_NEXT);
4066 }
4067 else {
4068 query.append(WHERE_LESSER_THAN_HAS_NEXT);
4069 }
4070 }
4071 else {
4072 if (orderByComparator.isAscending() ^ previous) {
4073 query.append(WHERE_GREATER_THAN);
4074 }
4075 else {
4076 query.append(WHERE_LESSER_THAN);
4077 }
4078 }
4079 }
4080
4081 query.append(ORDER_BY_CLAUSE);
4082
4083 String[] orderByFields = orderByComparator.getOrderByFields();
4084
4085 for (int i = 0; i < orderByFields.length; i++) {
4086 query.append(_ORDER_BY_ENTITY_ALIAS);
4087 query.append(orderByFields[i]);
4088
4089 if ((i + 1) < orderByFields.length) {
4090 if (orderByComparator.isAscending() ^ previous) {
4091 query.append(ORDER_BY_ASC_HAS_NEXT);
4092 }
4093 else {
4094 query.append(ORDER_BY_DESC_HAS_NEXT);
4095 }
4096 }
4097 else {
4098 if (orderByComparator.isAscending() ^ previous) {
4099 query.append(ORDER_BY_ASC);
4100 }
4101 else {
4102 query.append(ORDER_BY_DESC);
4103 }
4104 }
4105 }
4106 }
4107
4108 else {
4109 query.append(WikiNodeModelImpl.ORDER_BY_JPQL);
4110 }
4111
4112 String sql = query.toString();
4113
4114 Query q = session.createQuery(sql);
4115
4116 q.setFirstResult(0);
4117 q.setMaxResults(2);
4118
4119 QueryPos qPos = QueryPos.getInstance(q);
4120
4121 qPos.add(companyId);
4122
4123 qPos.add(status);
4124
4125 if (orderByComparator != null) {
4126 Object[] values = orderByComparator.getOrderByConditionValues(wikiNode);
4127
4128 for (Object value : values) {
4129 qPos.add(value);
4130 }
4131 }
4132
4133 List<WikiNode> list = q.list();
4134
4135 if (list.size() == 2) {
4136 return list.get(1);
4137 }
4138 else {
4139 return null;
4140 }
4141 }
4142
4143
4149 public List<WikiNode> findAll() throws SystemException {
4150 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
4151 }
4152
4153
4165 public List<WikiNode> findAll(int start, int end) throws SystemException {
4166 return findAll(start, end, null);
4167 }
4168
4169
4182 public List<WikiNode> findAll(int start, int end,
4183 OrderByComparator orderByComparator) throws SystemException {
4184 FinderPath finderPath = null;
4185 Object[] finderArgs = new Object[] { start, end, orderByComparator };
4186
4187 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
4188 (orderByComparator == null)) {
4189 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
4190 finderArgs = FINDER_ARGS_EMPTY;
4191 }
4192 else {
4193 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
4194 finderArgs = new Object[] { start, end, orderByComparator };
4195 }
4196
4197 List<WikiNode> list = (List<WikiNode>)FinderCacheUtil.getResult(finderPath,
4198 finderArgs, this);
4199
4200 if (list == null) {
4201 StringBundler query = null;
4202 String sql = null;
4203
4204 if (orderByComparator != null) {
4205 query = new StringBundler(2 +
4206 (orderByComparator.getOrderByFields().length * 3));
4207
4208 query.append(_SQL_SELECT_WIKINODE);
4209
4210 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4211 orderByComparator);
4212
4213 sql = query.toString();
4214 }
4215 else {
4216 sql = _SQL_SELECT_WIKINODE.concat(WikiNodeModelImpl.ORDER_BY_JPQL);
4217 }
4218
4219 Session session = null;
4220
4221 try {
4222 session = openSession();
4223
4224 Query q = session.createQuery(sql);
4225
4226 if (orderByComparator == null) {
4227 list = (List<WikiNode>)QueryUtil.list(q, getDialect(),
4228 start, end, false);
4229
4230 Collections.sort(list);
4231 }
4232 else {
4233 list = (List<WikiNode>)QueryUtil.list(q, getDialect(),
4234 start, end);
4235 }
4236 }
4237 catch (Exception e) {
4238 throw processException(e);
4239 }
4240 finally {
4241 if (list == null) {
4242 FinderCacheUtil.removeResult(finderPath, finderArgs);
4243 }
4244 else {
4245 cacheResult(list);
4246
4247 FinderCacheUtil.putResult(finderPath, finderArgs, list);
4248 }
4249
4250 closeSession(session);
4251 }
4252 }
4253
4254 return list;
4255 }
4256
4257
4263 public void removeByUuid(String uuid) throws SystemException {
4264 for (WikiNode wikiNode : findByUuid(uuid)) {
4265 remove(wikiNode);
4266 }
4267 }
4268
4269
4277 public WikiNode removeByUUID_G(String uuid, long groupId)
4278 throws NoSuchNodeException, SystemException {
4279 WikiNode wikiNode = findByUUID_G(uuid, groupId);
4280
4281 return remove(wikiNode);
4282 }
4283
4284
4291 public void removeByUuid_C(String uuid, long companyId)
4292 throws SystemException {
4293 for (WikiNode wikiNode : findByUuid_C(uuid, companyId)) {
4294 remove(wikiNode);
4295 }
4296 }
4297
4298
4304 public void removeByGroupId(long groupId) throws SystemException {
4305 for (WikiNode wikiNode : findByGroupId(groupId)) {
4306 remove(wikiNode);
4307 }
4308 }
4309
4310
4316 public void removeByCompanyId(long companyId) throws SystemException {
4317 for (WikiNode wikiNode : findByCompanyId(companyId)) {
4318 remove(wikiNode);
4319 }
4320 }
4321
4322
4330 public WikiNode removeByG_N(long groupId, String name)
4331 throws NoSuchNodeException, SystemException {
4332 WikiNode wikiNode = findByG_N(groupId, name);
4333
4334 return remove(wikiNode);
4335 }
4336
4337
4344 public void removeByG_S(long groupId, int status) throws SystemException {
4345 for (WikiNode wikiNode : findByG_S(groupId, status)) {
4346 remove(wikiNode);
4347 }
4348 }
4349
4350
4357 public void removeByC_S(long companyId, int status)
4358 throws SystemException {
4359 for (WikiNode wikiNode : findByC_S(companyId, status)) {
4360 remove(wikiNode);
4361 }
4362 }
4363
4364
4369 public void removeAll() throws SystemException {
4370 for (WikiNode wikiNode : findAll()) {
4371 remove(wikiNode);
4372 }
4373 }
4374
4375
4382 public int countByUuid(String uuid) throws SystemException {
4383 Object[] finderArgs = new Object[] { uuid };
4384
4385 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
4386 finderArgs, this);
4387
4388 if (count == null) {
4389 StringBundler query = new StringBundler(2);
4390
4391 query.append(_SQL_COUNT_WIKINODE_WHERE);
4392
4393 if (uuid == null) {
4394 query.append(_FINDER_COLUMN_UUID_UUID_1);
4395 }
4396 else {
4397 if (uuid.equals(StringPool.BLANK)) {
4398 query.append(_FINDER_COLUMN_UUID_UUID_3);
4399 }
4400 else {
4401 query.append(_FINDER_COLUMN_UUID_UUID_2);
4402 }
4403 }
4404
4405 String sql = query.toString();
4406
4407 Session session = null;
4408
4409 try {
4410 session = openSession();
4411
4412 Query q = session.createQuery(sql);
4413
4414 QueryPos qPos = QueryPos.getInstance(q);
4415
4416 if (uuid != null) {
4417 qPos.add(uuid);
4418 }
4419
4420 count = (Long)q.uniqueResult();
4421 }
4422 catch (Exception e) {
4423 throw processException(e);
4424 }
4425 finally {
4426 if (count == null) {
4427 count = Long.valueOf(0);
4428 }
4429
4430 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
4431 finderArgs, count);
4432
4433 closeSession(session);
4434 }
4435 }
4436
4437 return count.intValue();
4438 }
4439
4440
4448 public int countByUUID_G(String uuid, long groupId)
4449 throws SystemException {
4450 Object[] finderArgs = new Object[] { uuid, groupId };
4451
4452 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
4453 finderArgs, this);
4454
4455 if (count == null) {
4456 StringBundler query = new StringBundler(3);
4457
4458 query.append(_SQL_COUNT_WIKINODE_WHERE);
4459
4460 if (uuid == null) {
4461 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
4462 }
4463 else {
4464 if (uuid.equals(StringPool.BLANK)) {
4465 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
4466 }
4467 else {
4468 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
4469 }
4470 }
4471
4472 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
4473
4474 String sql = query.toString();
4475
4476 Session session = null;
4477
4478 try {
4479 session = openSession();
4480
4481 Query q = session.createQuery(sql);
4482
4483 QueryPos qPos = QueryPos.getInstance(q);
4484
4485 if (uuid != null) {
4486 qPos.add(uuid);
4487 }
4488
4489 qPos.add(groupId);
4490
4491 count = (Long)q.uniqueResult();
4492 }
4493 catch (Exception e) {
4494 throw processException(e);
4495 }
4496 finally {
4497 if (count == null) {
4498 count = Long.valueOf(0);
4499 }
4500
4501 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
4502 finderArgs, count);
4503
4504 closeSession(session);
4505 }
4506 }
4507
4508 return count.intValue();
4509 }
4510
4511
4519 public int countByUuid_C(String uuid, long companyId)
4520 throws SystemException {
4521 Object[] finderArgs = new Object[] { uuid, companyId };
4522
4523 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_C,
4524 finderArgs, this);
4525
4526 if (count == null) {
4527 StringBundler query = new StringBundler(3);
4528
4529 query.append(_SQL_COUNT_WIKINODE_WHERE);
4530
4531 if (uuid == null) {
4532 query.append(_FINDER_COLUMN_UUID_C_UUID_1);
4533 }
4534 else {
4535 if (uuid.equals(StringPool.BLANK)) {
4536 query.append(_FINDER_COLUMN_UUID_C_UUID_3);
4537 }
4538 else {
4539 query.append(_FINDER_COLUMN_UUID_C_UUID_2);
4540 }
4541 }
4542
4543 query.append(_FINDER_COLUMN_UUID_C_COMPANYID_2);
4544
4545 String sql = query.toString();
4546
4547 Session session = null;
4548
4549 try {
4550 session = openSession();
4551
4552 Query q = session.createQuery(sql);
4553
4554 QueryPos qPos = QueryPos.getInstance(q);
4555
4556 if (uuid != null) {
4557 qPos.add(uuid);
4558 }
4559
4560 qPos.add(companyId);
4561
4562 count = (Long)q.uniqueResult();
4563 }
4564 catch (Exception e) {
4565 throw processException(e);
4566 }
4567 finally {
4568 if (count == null) {
4569 count = Long.valueOf(0);
4570 }
4571
4572 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_C,
4573 finderArgs, count);
4574
4575 closeSession(session);
4576 }
4577 }
4578
4579 return count.intValue();
4580 }
4581
4582
4589 public int countByGroupId(long groupId) throws SystemException {
4590 Object[] finderArgs = new Object[] { groupId };
4591
4592 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
4593 finderArgs, this);
4594
4595 if (count == null) {
4596 StringBundler query = new StringBundler(2);
4597
4598 query.append(_SQL_COUNT_WIKINODE_WHERE);
4599
4600 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
4601
4602 String sql = query.toString();
4603
4604 Session session = null;
4605
4606 try {
4607 session = openSession();
4608
4609 Query q = session.createQuery(sql);
4610
4611 QueryPos qPos = QueryPos.getInstance(q);
4612
4613 qPos.add(groupId);
4614
4615 count = (Long)q.uniqueResult();
4616 }
4617 catch (Exception e) {
4618 throw processException(e);
4619 }
4620 finally {
4621 if (count == null) {
4622 count = Long.valueOf(0);
4623 }
4624
4625 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
4626 finderArgs, count);
4627
4628 closeSession(session);
4629 }
4630 }
4631
4632 return count.intValue();
4633 }
4634
4635
4642 public int filterCountByGroupId(long groupId) throws SystemException {
4643 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
4644 return countByGroupId(groupId);
4645 }
4646
4647 StringBundler query = new StringBundler(2);
4648
4649 query.append(_FILTER_SQL_COUNT_WIKINODE_WHERE);
4650
4651 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
4652
4653 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
4654 WikiNode.class.getName(),
4655 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
4656
4657 Session session = null;
4658
4659 try {
4660 session = openSession();
4661
4662 SQLQuery q = session.createSQLQuery(sql);
4663
4664 q.addScalar(COUNT_COLUMN_NAME,
4665 com.liferay.portal.kernel.dao.orm.Type.LONG);
4666
4667 QueryPos qPos = QueryPos.getInstance(q);
4668
4669 qPos.add(groupId);
4670
4671 Long count = (Long)q.uniqueResult();
4672
4673 return count.intValue();
4674 }
4675 catch (Exception e) {
4676 throw processException(e);
4677 }
4678 finally {
4679 closeSession(session);
4680 }
4681 }
4682
4683
4690 public int countByCompanyId(long companyId) throws SystemException {
4691 Object[] finderArgs = new Object[] { companyId };
4692
4693 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
4694 finderArgs, this);
4695
4696 if (count == null) {
4697 StringBundler query = new StringBundler(2);
4698
4699 query.append(_SQL_COUNT_WIKINODE_WHERE);
4700
4701 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
4702
4703 String sql = query.toString();
4704
4705 Session session = null;
4706
4707 try {
4708 session = openSession();
4709
4710 Query q = session.createQuery(sql);
4711
4712 QueryPos qPos = QueryPos.getInstance(q);
4713
4714 qPos.add(companyId);
4715
4716 count = (Long)q.uniqueResult();
4717 }
4718 catch (Exception e) {
4719 throw processException(e);
4720 }
4721 finally {
4722 if (count == null) {
4723 count = Long.valueOf(0);
4724 }
4725
4726 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
4727 finderArgs, count);
4728
4729 closeSession(session);
4730 }
4731 }
4732
4733 return count.intValue();
4734 }
4735
4736
4744 public int countByG_N(long groupId, String name) throws SystemException {
4745 Object[] finderArgs = new Object[] { groupId, name };
4746
4747 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_N,
4748 finderArgs, this);
4749
4750 if (count == null) {
4751 StringBundler query = new StringBundler(3);
4752
4753 query.append(_SQL_COUNT_WIKINODE_WHERE);
4754
4755 query.append(_FINDER_COLUMN_G_N_GROUPID_2);
4756
4757 if (name == null) {
4758 query.append(_FINDER_COLUMN_G_N_NAME_1);
4759 }
4760 else {
4761 if (name.equals(StringPool.BLANK)) {
4762 query.append(_FINDER_COLUMN_G_N_NAME_3);
4763 }
4764 else {
4765 query.append(_FINDER_COLUMN_G_N_NAME_2);
4766 }
4767 }
4768
4769 String sql = query.toString();
4770
4771 Session session = null;
4772
4773 try {
4774 session = openSession();
4775
4776 Query q = session.createQuery(sql);
4777
4778 QueryPos qPos = QueryPos.getInstance(q);
4779
4780 qPos.add(groupId);
4781
4782 if (name != null) {
4783 qPos.add(name);
4784 }
4785
4786 count = (Long)q.uniqueResult();
4787 }
4788 catch (Exception e) {
4789 throw processException(e);
4790 }
4791 finally {
4792 if (count == null) {
4793 count = Long.valueOf(0);
4794 }
4795
4796 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_N, finderArgs,
4797 count);
4798
4799 closeSession(session);
4800 }
4801 }
4802
4803 return count.intValue();
4804 }
4805
4806
4814 public int countByG_S(long groupId, int status) throws SystemException {
4815 Object[] finderArgs = new Object[] { groupId, status };
4816
4817 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_S,
4818 finderArgs, this);
4819
4820 if (count == null) {
4821 StringBundler query = new StringBundler(3);
4822
4823 query.append(_SQL_COUNT_WIKINODE_WHERE);
4824
4825 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
4826
4827 query.append(_FINDER_COLUMN_G_S_STATUS_2);
4828
4829 String sql = query.toString();
4830
4831 Session session = null;
4832
4833 try {
4834 session = openSession();
4835
4836 Query q = session.createQuery(sql);
4837
4838 QueryPos qPos = QueryPos.getInstance(q);
4839
4840 qPos.add(groupId);
4841
4842 qPos.add(status);
4843
4844 count = (Long)q.uniqueResult();
4845 }
4846 catch (Exception e) {
4847 throw processException(e);
4848 }
4849 finally {
4850 if (count == null) {
4851 count = Long.valueOf(0);
4852 }
4853
4854 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_S, finderArgs,
4855 count);
4856
4857 closeSession(session);
4858 }
4859 }
4860
4861 return count.intValue();
4862 }
4863
4864
4872 public int filterCountByG_S(long groupId, int status)
4873 throws SystemException {
4874 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
4875 return countByG_S(groupId, status);
4876 }
4877
4878 StringBundler query = new StringBundler(3);
4879
4880 query.append(_FILTER_SQL_COUNT_WIKINODE_WHERE);
4881
4882 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
4883
4884 query.append(_FINDER_COLUMN_G_S_STATUS_2);
4885
4886 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
4887 WikiNode.class.getName(),
4888 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
4889
4890 Session session = null;
4891
4892 try {
4893 session = openSession();
4894
4895 SQLQuery q = session.createSQLQuery(sql);
4896
4897 q.addScalar(COUNT_COLUMN_NAME,
4898 com.liferay.portal.kernel.dao.orm.Type.LONG);
4899
4900 QueryPos qPos = QueryPos.getInstance(q);
4901
4902 qPos.add(groupId);
4903
4904 qPos.add(status);
4905
4906 Long count = (Long)q.uniqueResult();
4907
4908 return count.intValue();
4909 }
4910 catch (Exception e) {
4911 throw processException(e);
4912 }
4913 finally {
4914 closeSession(session);
4915 }
4916 }
4917
4918
4926 public int countByC_S(long companyId, int status) throws SystemException {
4927 Object[] finderArgs = new Object[] { companyId, status };
4928
4929 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_S,
4930 finderArgs, this);
4931
4932 if (count == null) {
4933 StringBundler query = new StringBundler(3);
4934
4935 query.append(_SQL_COUNT_WIKINODE_WHERE);
4936
4937 query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
4938
4939 query.append(_FINDER_COLUMN_C_S_STATUS_2);
4940
4941 String sql = query.toString();
4942
4943 Session session = null;
4944
4945 try {
4946 session = openSession();
4947
4948 Query q = session.createQuery(sql);
4949
4950 QueryPos qPos = QueryPos.getInstance(q);
4951
4952 qPos.add(companyId);
4953
4954 qPos.add(status);
4955
4956 count = (Long)q.uniqueResult();
4957 }
4958 catch (Exception e) {
4959 throw processException(e);
4960 }
4961 finally {
4962 if (count == null) {
4963 count = Long.valueOf(0);
4964 }
4965
4966 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_S, finderArgs,
4967 count);
4968
4969 closeSession(session);
4970 }
4971 }
4972
4973 return count.intValue();
4974 }
4975
4976
4982 public int countAll() throws SystemException {
4983 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
4984 FINDER_ARGS_EMPTY, this);
4985
4986 if (count == null) {
4987 Session session = null;
4988
4989 try {
4990 session = openSession();
4991
4992 Query q = session.createQuery(_SQL_COUNT_WIKINODE);
4993
4994 count = (Long)q.uniqueResult();
4995 }
4996 catch (Exception e) {
4997 throw processException(e);
4998 }
4999 finally {
5000 if (count == null) {
5001 count = Long.valueOf(0);
5002 }
5003
5004 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
5005 FINDER_ARGS_EMPTY, count);
5006
5007 closeSession(session);
5008 }
5009 }
5010
5011 return count.intValue();
5012 }
5013
5014
5017 public void afterPropertiesSet() {
5018 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
5019 com.liferay.portal.util.PropsUtil.get(
5020 "value.object.listener.com.liferay.portlet.wiki.model.WikiNode")));
5021
5022 if (listenerClassNames.length > 0) {
5023 try {
5024 List<ModelListener<WikiNode>> listenersList = new ArrayList<ModelListener<WikiNode>>();
5025
5026 for (String listenerClassName : listenerClassNames) {
5027 listenersList.add((ModelListener<WikiNode>)InstanceFactory.newInstance(
5028 listenerClassName));
5029 }
5030
5031 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
5032 }
5033 catch (Exception e) {
5034 _log.error(e);
5035 }
5036 }
5037 }
5038
5039 public void destroy() {
5040 EntityCacheUtil.removeCache(WikiNodeImpl.class.getName());
5041 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
5042 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
5043 }
5044
5045 @BeanReference(type = WikiNodePersistence.class)
5046 protected WikiNodePersistence wikiNodePersistence;
5047 @BeanReference(type = WikiPagePersistence.class)
5048 protected WikiPagePersistence wikiPagePersistence;
5049 @BeanReference(type = WikiPageResourcePersistence.class)
5050 protected WikiPageResourcePersistence wikiPageResourcePersistence;
5051 @BeanReference(type = GroupPersistence.class)
5052 protected GroupPersistence groupPersistence;
5053 @BeanReference(type = SubscriptionPersistence.class)
5054 protected SubscriptionPersistence subscriptionPersistence;
5055 @BeanReference(type = UserPersistence.class)
5056 protected UserPersistence userPersistence;
5057 @BeanReference(type = TrashEntryPersistence.class)
5058 protected TrashEntryPersistence trashEntryPersistence;
5059 private static final String _SQL_SELECT_WIKINODE = "SELECT wikiNode FROM WikiNode wikiNode";
5060 private static final String _SQL_SELECT_WIKINODE_WHERE = "SELECT wikiNode FROM WikiNode wikiNode WHERE ";
5061 private static final String _SQL_COUNT_WIKINODE = "SELECT COUNT(wikiNode) FROM WikiNode wikiNode";
5062 private static final String _SQL_COUNT_WIKINODE_WHERE = "SELECT COUNT(wikiNode) FROM WikiNode wikiNode WHERE ";
5063 private static final String _FINDER_COLUMN_UUID_UUID_1 = "wikiNode.uuid IS NULL";
5064 private static final String _FINDER_COLUMN_UUID_UUID_2 = "wikiNode.uuid = ?";
5065 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(wikiNode.uuid IS NULL OR wikiNode.uuid = ?)";
5066 private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "wikiNode.uuid IS NULL AND ";
5067 private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "wikiNode.uuid = ? AND ";
5068 private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(wikiNode.uuid IS NULL OR wikiNode.uuid = ?) AND ";
5069 private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "wikiNode.groupId = ?";
5070 private static final String _FINDER_COLUMN_UUID_C_UUID_1 = "wikiNode.uuid IS NULL AND ";
5071 private static final String _FINDER_COLUMN_UUID_C_UUID_2 = "wikiNode.uuid = ? AND ";
5072 private static final String _FINDER_COLUMN_UUID_C_UUID_3 = "(wikiNode.uuid IS NULL OR wikiNode.uuid = ?) AND ";
5073 private static final String _FINDER_COLUMN_UUID_C_COMPANYID_2 = "wikiNode.companyId = ?";
5074 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "wikiNode.groupId = ?";
5075 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "wikiNode.companyId = ?";
5076 private static final String _FINDER_COLUMN_G_N_GROUPID_2 = "wikiNode.groupId = ? AND ";
5077 private static final String _FINDER_COLUMN_G_N_NAME_1 = "wikiNode.name IS NULL";
5078 private static final String _FINDER_COLUMN_G_N_NAME_2 = "wikiNode.name = ?";
5079 private static final String _FINDER_COLUMN_G_N_NAME_3 = "(wikiNode.name IS NULL OR wikiNode.name = ?)";
5080 private static final String _FINDER_COLUMN_G_S_GROUPID_2 = "wikiNode.groupId = ? AND ";
5081 private static final String _FINDER_COLUMN_G_S_STATUS_2 = "wikiNode.status = ?";
5082 private static final String _FINDER_COLUMN_C_S_COMPANYID_2 = "wikiNode.companyId = ? AND ";
5083 private static final String _FINDER_COLUMN_C_S_STATUS_2 = "wikiNode.status = ?";
5084 private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "wikiNode.nodeId";
5085 private static final String _FILTER_SQL_SELECT_WIKINODE_WHERE = "SELECT DISTINCT {wikiNode.*} FROM WikiNode wikiNode WHERE ";
5086 private static final String _FILTER_SQL_SELECT_WIKINODE_NO_INLINE_DISTINCT_WHERE_1 =
5087 "SELECT {WikiNode.*} FROM (SELECT DISTINCT wikiNode.nodeId FROM WikiNode wikiNode WHERE ";
5088 private static final String _FILTER_SQL_SELECT_WIKINODE_NO_INLINE_DISTINCT_WHERE_2 =
5089 ") TEMP_TABLE INNER JOIN WikiNode ON TEMP_TABLE.nodeId = WikiNode.nodeId";
5090 private static final String _FILTER_SQL_COUNT_WIKINODE_WHERE = "SELECT COUNT(DISTINCT wikiNode.nodeId) AS COUNT_VALUE FROM WikiNode wikiNode WHERE ";
5091 private static final String _FILTER_ENTITY_ALIAS = "wikiNode";
5092 private static final String _FILTER_ENTITY_TABLE = "WikiNode";
5093 private static final String _ORDER_BY_ENTITY_ALIAS = "wikiNode.";
5094 private static final String _ORDER_BY_ENTITY_TABLE = "WikiNode.";
5095 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No WikiNode exists with the primary key ";
5096 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No WikiNode exists with the key {";
5097 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
5098 private static Log _log = LogFactoryUtil.getLog(WikiNodePersistenceImpl.class);
5099 private static WikiNode _nullWikiNode = new WikiNodeImpl() {
5100 @Override
5101 public Object clone() {
5102 return this;
5103 }
5104
5105 @Override
5106 public CacheModel<WikiNode> toCacheModel() {
5107 return _nullWikiNodeCacheModel;
5108 }
5109 };
5110
5111 private static CacheModel<WikiNode> _nullWikiNodeCacheModel = new CacheModel<WikiNode>() {
5112 public WikiNode toEntityModel() {
5113 return _nullWikiNode;
5114 }
5115 };
5116 }