001
014
015 package com.liferay.portlet.asset.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.Session;
027 import com.liferay.portal.kernel.exception.SystemException;
028 import com.liferay.portal.kernel.log.Log;
029 import com.liferay.portal.kernel.log.LogFactoryUtil;
030 import com.liferay.portal.kernel.util.GetterUtil;
031 import com.liferay.portal.kernel.util.InstanceFactory;
032 import com.liferay.portal.kernel.util.OrderByComparator;
033 import com.liferay.portal.kernel.util.StringBundler;
034 import com.liferay.portal.kernel.util.StringPool;
035 import com.liferay.portal.kernel.util.StringUtil;
036 import com.liferay.portal.model.CacheModel;
037 import com.liferay.portal.model.ModelListener;
038 import com.liferay.portal.service.persistence.BatchSessionUtil;
039 import com.liferay.portal.service.persistence.ResourcePersistence;
040 import com.liferay.portal.service.persistence.UserPersistence;
041 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
042
043 import com.liferay.portlet.asset.NoSuchLinkException;
044 import com.liferay.portlet.asset.model.AssetLink;
045 import com.liferay.portlet.asset.model.impl.AssetLinkImpl;
046 import com.liferay.portlet.asset.model.impl.AssetLinkModelImpl;
047
048 import java.io.Serializable;
049
050 import java.util.ArrayList;
051 import java.util.Collections;
052 import java.util.List;
053
054
066 public class AssetLinkPersistenceImpl extends BasePersistenceImpl<AssetLink>
067 implements AssetLinkPersistence {
068
073 public static final String FINDER_CLASS_NAME_ENTITY = AssetLinkImpl.class.getName();
074 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
075 ".List1";
076 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
077 ".List2";
078 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_E1 = new FinderPath(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
079 AssetLinkModelImpl.FINDER_CACHE_ENABLED, AssetLinkImpl.class,
080 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByE1",
081 new String[] {
082 Long.class.getName(),
083
084 "java.lang.Integer", "java.lang.Integer",
085 "com.liferay.portal.kernel.util.OrderByComparator"
086 });
087 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E1 = new FinderPath(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
088 AssetLinkModelImpl.FINDER_CACHE_ENABLED, AssetLinkImpl.class,
089 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByE1",
090 new String[] { Long.class.getName() },
091 AssetLinkModelImpl.ENTRYID1_COLUMN_BITMASK);
092 public static final FinderPath FINDER_PATH_COUNT_BY_E1 = new FinderPath(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
093 AssetLinkModelImpl.FINDER_CACHE_ENABLED, Long.class,
094 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByE1",
095 new String[] { Long.class.getName() });
096 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_E2 = new FinderPath(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
097 AssetLinkModelImpl.FINDER_CACHE_ENABLED, AssetLinkImpl.class,
098 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByE2",
099 new String[] {
100 Long.class.getName(),
101
102 "java.lang.Integer", "java.lang.Integer",
103 "com.liferay.portal.kernel.util.OrderByComparator"
104 });
105 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E2 = new FinderPath(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
106 AssetLinkModelImpl.FINDER_CACHE_ENABLED, AssetLinkImpl.class,
107 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByE2",
108 new String[] { Long.class.getName() },
109 AssetLinkModelImpl.ENTRYID2_COLUMN_BITMASK);
110 public static final FinderPath FINDER_PATH_COUNT_BY_E2 = new FinderPath(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
111 AssetLinkModelImpl.FINDER_CACHE_ENABLED, Long.class,
112 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByE2",
113 new String[] { Long.class.getName() });
114 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_E_E = new FinderPath(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
115 AssetLinkModelImpl.FINDER_CACHE_ENABLED, AssetLinkImpl.class,
116 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByE_E",
117 new String[] {
118 Long.class.getName(), Long.class.getName(),
119
120 "java.lang.Integer", "java.lang.Integer",
121 "com.liferay.portal.kernel.util.OrderByComparator"
122 });
123 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E_E = new FinderPath(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
124 AssetLinkModelImpl.FINDER_CACHE_ENABLED, AssetLinkImpl.class,
125 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByE_E",
126 new String[] { Long.class.getName(), Long.class.getName() },
127 AssetLinkModelImpl.ENTRYID1_COLUMN_BITMASK |
128 AssetLinkModelImpl.ENTRYID2_COLUMN_BITMASK);
129 public static final FinderPath FINDER_PATH_COUNT_BY_E_E = new FinderPath(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
130 AssetLinkModelImpl.FINDER_CACHE_ENABLED, Long.class,
131 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByE_E",
132 new String[] { Long.class.getName(), Long.class.getName() });
133 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_E1_T = new FinderPath(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
134 AssetLinkModelImpl.FINDER_CACHE_ENABLED, AssetLinkImpl.class,
135 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByE1_T",
136 new String[] {
137 Long.class.getName(), Integer.class.getName(),
138
139 "java.lang.Integer", "java.lang.Integer",
140 "com.liferay.portal.kernel.util.OrderByComparator"
141 });
142 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E1_T = new FinderPath(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
143 AssetLinkModelImpl.FINDER_CACHE_ENABLED, AssetLinkImpl.class,
144 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByE1_T",
145 new String[] { Long.class.getName(), Integer.class.getName() },
146 AssetLinkModelImpl.ENTRYID1_COLUMN_BITMASK |
147 AssetLinkModelImpl.TYPE_COLUMN_BITMASK);
148 public static final FinderPath FINDER_PATH_COUNT_BY_E1_T = new FinderPath(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
149 AssetLinkModelImpl.FINDER_CACHE_ENABLED, Long.class,
150 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByE1_T",
151 new String[] { Long.class.getName(), Integer.class.getName() });
152 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_E2_T = new FinderPath(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
153 AssetLinkModelImpl.FINDER_CACHE_ENABLED, AssetLinkImpl.class,
154 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByE2_T",
155 new String[] {
156 Long.class.getName(), Integer.class.getName(),
157
158 "java.lang.Integer", "java.lang.Integer",
159 "com.liferay.portal.kernel.util.OrderByComparator"
160 });
161 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E2_T = new FinderPath(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
162 AssetLinkModelImpl.FINDER_CACHE_ENABLED, AssetLinkImpl.class,
163 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByE2_T",
164 new String[] { Long.class.getName(), Integer.class.getName() },
165 AssetLinkModelImpl.ENTRYID2_COLUMN_BITMASK |
166 AssetLinkModelImpl.TYPE_COLUMN_BITMASK);
167 public static final FinderPath FINDER_PATH_COUNT_BY_E2_T = new FinderPath(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
168 AssetLinkModelImpl.FINDER_CACHE_ENABLED, Long.class,
169 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByE2_T",
170 new String[] { Long.class.getName(), Integer.class.getName() });
171 public static final FinderPath FINDER_PATH_FETCH_BY_E_E_T = new FinderPath(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
172 AssetLinkModelImpl.FINDER_CACHE_ENABLED, AssetLinkImpl.class,
173 FINDER_CLASS_NAME_ENTITY, "fetchByE_E_T",
174 new String[] {
175 Long.class.getName(), Long.class.getName(),
176 Integer.class.getName()
177 },
178 AssetLinkModelImpl.ENTRYID1_COLUMN_BITMASK |
179 AssetLinkModelImpl.ENTRYID2_COLUMN_BITMASK |
180 AssetLinkModelImpl.TYPE_COLUMN_BITMASK);
181 public static final FinderPath FINDER_PATH_COUNT_BY_E_E_T = new FinderPath(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
182 AssetLinkModelImpl.FINDER_CACHE_ENABLED, Long.class,
183 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByE_E_T",
184 new String[] {
185 Long.class.getName(), Long.class.getName(),
186 Integer.class.getName()
187 });
188 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
189 AssetLinkModelImpl.FINDER_CACHE_ENABLED, AssetLinkImpl.class,
190 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
191 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
192 AssetLinkModelImpl.FINDER_CACHE_ENABLED, AssetLinkImpl.class,
193 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
194 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
195 AssetLinkModelImpl.FINDER_CACHE_ENABLED, Long.class,
196 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
197
198
203 public void cacheResult(AssetLink assetLink) {
204 EntityCacheUtil.putResult(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
205 AssetLinkImpl.class, assetLink.getPrimaryKey(), assetLink);
206
207 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_E_E_T,
208 new Object[] {
209 Long.valueOf(assetLink.getEntryId1()),
210 Long.valueOf(assetLink.getEntryId2()),
211 Integer.valueOf(assetLink.getType())
212 }, assetLink);
213
214 assetLink.resetOriginalValues();
215 }
216
217
222 public void cacheResult(List<AssetLink> assetLinks) {
223 for (AssetLink assetLink : assetLinks) {
224 if (EntityCacheUtil.getResult(
225 AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
226 AssetLinkImpl.class, assetLink.getPrimaryKey()) == null) {
227 cacheResult(assetLink);
228 }
229 else {
230 assetLink.resetOriginalValues();
231 }
232 }
233 }
234
235
242 @Override
243 public void clearCache() {
244 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
245 CacheRegistryUtil.clear(AssetLinkImpl.class.getName());
246 }
247
248 EntityCacheUtil.clearCache(AssetLinkImpl.class.getName());
249
250 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
251 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
252 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
253 }
254
255
262 @Override
263 public void clearCache(AssetLink assetLink) {
264 EntityCacheUtil.removeResult(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
265 AssetLinkImpl.class, assetLink.getPrimaryKey());
266
267 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
268 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
269
270 clearUniqueFindersCache(assetLink);
271 }
272
273 @Override
274 public void clearCache(List<AssetLink> assetLinks) {
275 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
276 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
277
278 for (AssetLink assetLink : assetLinks) {
279 EntityCacheUtil.removeResult(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
280 AssetLinkImpl.class, assetLink.getPrimaryKey());
281
282 clearUniqueFindersCache(assetLink);
283 }
284 }
285
286 protected void cacheUniqueFindersCache(AssetLink assetLink) {
287 if (assetLink.isNew()) {
288 Object[] args = new Object[] {
289 Long.valueOf(assetLink.getEntryId1()),
290 Long.valueOf(assetLink.getEntryId2()),
291 Integer.valueOf(assetLink.getType())
292 };
293
294 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_E_E_T, args,
295 Long.valueOf(1));
296 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_E_E_T, args,
297 assetLink);
298 }
299 else {
300 AssetLinkModelImpl assetLinkModelImpl = (AssetLinkModelImpl)assetLink;
301
302 if ((assetLinkModelImpl.getColumnBitmask() &
303 FINDER_PATH_FETCH_BY_E_E_T.getColumnBitmask()) != 0) {
304 Object[] args = new Object[] {
305 Long.valueOf(assetLink.getEntryId1()),
306 Long.valueOf(assetLink.getEntryId2()),
307 Integer.valueOf(assetLink.getType())
308 };
309
310 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_E_E_T, args,
311 Long.valueOf(1));
312 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_E_E_T, args,
313 assetLink);
314 }
315 }
316 }
317
318 protected void clearUniqueFindersCache(AssetLink assetLink) {
319 AssetLinkModelImpl assetLinkModelImpl = (AssetLinkModelImpl)assetLink;
320
321 Object[] args = new Object[] {
322 Long.valueOf(assetLink.getEntryId1()),
323 Long.valueOf(assetLink.getEntryId2()),
324 Integer.valueOf(assetLink.getType())
325 };
326
327 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_E_E_T, args);
328 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_E_E_T, args);
329
330 if ((assetLinkModelImpl.getColumnBitmask() &
331 FINDER_PATH_FETCH_BY_E_E_T.getColumnBitmask()) != 0) {
332 args = new Object[] {
333 Long.valueOf(assetLinkModelImpl.getOriginalEntryId1()),
334 Long.valueOf(assetLinkModelImpl.getOriginalEntryId2()),
335 Integer.valueOf(assetLinkModelImpl.getOriginalType())
336 };
337
338 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_E_E_T, args);
339 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_E_E_T, args);
340 }
341 }
342
343
349 public AssetLink create(long linkId) {
350 AssetLink assetLink = new AssetLinkImpl();
351
352 assetLink.setNew(true);
353 assetLink.setPrimaryKey(linkId);
354
355 return assetLink;
356 }
357
358
366 public AssetLink remove(long linkId)
367 throws NoSuchLinkException, SystemException {
368 return remove(Long.valueOf(linkId));
369 }
370
371
379 @Override
380 public AssetLink remove(Serializable primaryKey)
381 throws NoSuchLinkException, SystemException {
382 Session session = null;
383
384 try {
385 session = openSession();
386
387 AssetLink assetLink = (AssetLink)session.get(AssetLinkImpl.class,
388 primaryKey);
389
390 if (assetLink == null) {
391 if (_log.isWarnEnabled()) {
392 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
393 }
394
395 throw new NoSuchLinkException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
396 primaryKey);
397 }
398
399 return remove(assetLink);
400 }
401 catch (NoSuchLinkException nsee) {
402 throw nsee;
403 }
404 catch (Exception e) {
405 throw processException(e);
406 }
407 finally {
408 closeSession(session);
409 }
410 }
411
412 @Override
413 protected AssetLink removeImpl(AssetLink assetLink)
414 throws SystemException {
415 assetLink = toUnwrappedModel(assetLink);
416
417 Session session = null;
418
419 try {
420 session = openSession();
421
422 BatchSessionUtil.delete(session, assetLink);
423 }
424 catch (Exception e) {
425 throw processException(e);
426 }
427 finally {
428 closeSession(session);
429 }
430
431 clearCache(assetLink);
432
433 return assetLink;
434 }
435
436 @Override
437 public AssetLink updateImpl(
438 com.liferay.portlet.asset.model.AssetLink assetLink, boolean merge)
439 throws SystemException {
440 assetLink = toUnwrappedModel(assetLink);
441
442 boolean isNew = assetLink.isNew();
443
444 AssetLinkModelImpl assetLinkModelImpl = (AssetLinkModelImpl)assetLink;
445
446 Session session = null;
447
448 try {
449 session = openSession();
450
451 BatchSessionUtil.update(session, assetLink, merge);
452
453 assetLink.setNew(false);
454 }
455 catch (Exception e) {
456 throw processException(e);
457 }
458 finally {
459 closeSession(session);
460 }
461
462 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
463
464 if (isNew || !AssetLinkModelImpl.COLUMN_BITMASK_ENABLED) {
465 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
466 }
467
468 else {
469 if ((assetLinkModelImpl.getColumnBitmask() &
470 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E1.getColumnBitmask()) != 0) {
471 Object[] args = new Object[] {
472 Long.valueOf(assetLinkModelImpl.getOriginalEntryId1())
473 };
474
475 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_E1, args);
476 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E1,
477 args);
478
479 args = new Object[] {
480 Long.valueOf(assetLinkModelImpl.getEntryId1())
481 };
482
483 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_E1, args);
484 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E1,
485 args);
486 }
487
488 if ((assetLinkModelImpl.getColumnBitmask() &
489 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E2.getColumnBitmask()) != 0) {
490 Object[] args = new Object[] {
491 Long.valueOf(assetLinkModelImpl.getOriginalEntryId2())
492 };
493
494 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_E2, args);
495 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E2,
496 args);
497
498 args = new Object[] {
499 Long.valueOf(assetLinkModelImpl.getEntryId2())
500 };
501
502 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_E2, args);
503 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E2,
504 args);
505 }
506
507 if ((assetLinkModelImpl.getColumnBitmask() &
508 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E_E.getColumnBitmask()) != 0) {
509 Object[] args = new Object[] {
510 Long.valueOf(assetLinkModelImpl.getOriginalEntryId1()),
511 Long.valueOf(assetLinkModelImpl.getOriginalEntryId2())
512 };
513
514 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_E_E, args);
515 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E_E,
516 args);
517
518 args = new Object[] {
519 Long.valueOf(assetLinkModelImpl.getEntryId1()),
520 Long.valueOf(assetLinkModelImpl.getEntryId2())
521 };
522
523 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_E_E, args);
524 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E_E,
525 args);
526 }
527
528 if ((assetLinkModelImpl.getColumnBitmask() &
529 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E1_T.getColumnBitmask()) != 0) {
530 Object[] args = new Object[] {
531 Long.valueOf(assetLinkModelImpl.getOriginalEntryId1()),
532 Integer.valueOf(assetLinkModelImpl.getOriginalType())
533 };
534
535 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_E1_T, args);
536 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E1_T,
537 args);
538
539 args = new Object[] {
540 Long.valueOf(assetLinkModelImpl.getEntryId1()),
541 Integer.valueOf(assetLinkModelImpl.getType())
542 };
543
544 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_E1_T, args);
545 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E1_T,
546 args);
547 }
548
549 if ((assetLinkModelImpl.getColumnBitmask() &
550 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E2_T.getColumnBitmask()) != 0) {
551 Object[] args = new Object[] {
552 Long.valueOf(assetLinkModelImpl.getOriginalEntryId2()),
553 Integer.valueOf(assetLinkModelImpl.getOriginalType())
554 };
555
556 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_E2_T, args);
557 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E2_T,
558 args);
559
560 args = new Object[] {
561 Long.valueOf(assetLinkModelImpl.getEntryId2()),
562 Integer.valueOf(assetLinkModelImpl.getType())
563 };
564
565 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_E2_T, args);
566 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E2_T,
567 args);
568 }
569 }
570
571 EntityCacheUtil.putResult(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
572 AssetLinkImpl.class, assetLink.getPrimaryKey(), assetLink);
573
574 clearUniqueFindersCache(assetLink);
575 cacheUniqueFindersCache(assetLink);
576
577 return assetLink;
578 }
579
580 protected AssetLink toUnwrappedModel(AssetLink assetLink) {
581 if (assetLink instanceof AssetLinkImpl) {
582 return assetLink;
583 }
584
585 AssetLinkImpl assetLinkImpl = new AssetLinkImpl();
586
587 assetLinkImpl.setNew(assetLink.isNew());
588 assetLinkImpl.setPrimaryKey(assetLink.getPrimaryKey());
589
590 assetLinkImpl.setLinkId(assetLink.getLinkId());
591 assetLinkImpl.setCompanyId(assetLink.getCompanyId());
592 assetLinkImpl.setUserId(assetLink.getUserId());
593 assetLinkImpl.setUserName(assetLink.getUserName());
594 assetLinkImpl.setCreateDate(assetLink.getCreateDate());
595 assetLinkImpl.setEntryId1(assetLink.getEntryId1());
596 assetLinkImpl.setEntryId2(assetLink.getEntryId2());
597 assetLinkImpl.setType(assetLink.getType());
598 assetLinkImpl.setWeight(assetLink.getWeight());
599
600 return assetLinkImpl;
601 }
602
603
611 @Override
612 public AssetLink findByPrimaryKey(Serializable primaryKey)
613 throws NoSuchModelException, SystemException {
614 return findByPrimaryKey(((Long)primaryKey).longValue());
615 }
616
617
625 public AssetLink findByPrimaryKey(long linkId)
626 throws NoSuchLinkException, SystemException {
627 AssetLink assetLink = fetchByPrimaryKey(linkId);
628
629 if (assetLink == null) {
630 if (_log.isWarnEnabled()) {
631 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + linkId);
632 }
633
634 throw new NoSuchLinkException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
635 linkId);
636 }
637
638 return assetLink;
639 }
640
641
648 @Override
649 public AssetLink fetchByPrimaryKey(Serializable primaryKey)
650 throws SystemException {
651 return fetchByPrimaryKey(((Long)primaryKey).longValue());
652 }
653
654
661 public AssetLink fetchByPrimaryKey(long linkId) throws SystemException {
662 AssetLink assetLink = (AssetLink)EntityCacheUtil.getResult(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
663 AssetLinkImpl.class, linkId);
664
665 if (assetLink == _nullAssetLink) {
666 return null;
667 }
668
669 if (assetLink == null) {
670 Session session = null;
671
672 boolean hasException = false;
673
674 try {
675 session = openSession();
676
677 assetLink = (AssetLink)session.get(AssetLinkImpl.class,
678 Long.valueOf(linkId));
679 }
680 catch (Exception e) {
681 hasException = true;
682
683 throw processException(e);
684 }
685 finally {
686 if (assetLink != null) {
687 cacheResult(assetLink);
688 }
689 else if (!hasException) {
690 EntityCacheUtil.putResult(AssetLinkModelImpl.ENTITY_CACHE_ENABLED,
691 AssetLinkImpl.class, linkId, _nullAssetLink);
692 }
693
694 closeSession(session);
695 }
696 }
697
698 return assetLink;
699 }
700
701
708 public List<AssetLink> findByE1(long entryId1) throws SystemException {
709 return findByE1(entryId1, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
710 }
711
712
725 public List<AssetLink> findByE1(long entryId1, int start, int end)
726 throws SystemException {
727 return findByE1(entryId1, start, end, null);
728 }
729
730
744 public List<AssetLink> findByE1(long entryId1, int start, int end,
745 OrderByComparator orderByComparator) throws SystemException {
746 FinderPath finderPath = null;
747 Object[] finderArgs = null;
748
749 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
750 (orderByComparator == null)) {
751 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E1;
752 finderArgs = new Object[] { entryId1 };
753 }
754 else {
755 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_E1;
756 finderArgs = new Object[] { entryId1, start, end, orderByComparator };
757 }
758
759 List<AssetLink> list = (List<AssetLink>)FinderCacheUtil.getResult(finderPath,
760 finderArgs, this);
761
762 if ((list != null) && !list.isEmpty()) {
763 for (AssetLink assetLink : list) {
764 if ((entryId1 != assetLink.getEntryId1())) {
765 list = null;
766
767 break;
768 }
769 }
770 }
771
772 if (list == null) {
773 StringBundler query = null;
774
775 if (orderByComparator != null) {
776 query = new StringBundler(3 +
777 (orderByComparator.getOrderByFields().length * 3));
778 }
779 else {
780 query = new StringBundler(3);
781 }
782
783 query.append(_SQL_SELECT_ASSETLINK_WHERE);
784
785 query.append(_FINDER_COLUMN_E1_ENTRYID1_2);
786
787 if (orderByComparator != null) {
788 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
789 orderByComparator);
790 }
791
792 else {
793 query.append(AssetLinkModelImpl.ORDER_BY_JPQL);
794 }
795
796 String sql = query.toString();
797
798 Session session = null;
799
800 try {
801 session = openSession();
802
803 Query q = session.createQuery(sql);
804
805 QueryPos qPos = QueryPos.getInstance(q);
806
807 qPos.add(entryId1);
808
809 list = (List<AssetLink>)QueryUtil.list(q, getDialect(), start,
810 end);
811 }
812 catch (Exception e) {
813 throw processException(e);
814 }
815 finally {
816 if (list == null) {
817 FinderCacheUtil.removeResult(finderPath, finderArgs);
818 }
819 else {
820 cacheResult(list);
821
822 FinderCacheUtil.putResult(finderPath, finderArgs, list);
823 }
824
825 closeSession(session);
826 }
827 }
828
829 return list;
830 }
831
832
841 public AssetLink findByE1_First(long entryId1,
842 OrderByComparator orderByComparator)
843 throws NoSuchLinkException, SystemException {
844 AssetLink assetLink = fetchByE1_First(entryId1, orderByComparator);
845
846 if (assetLink != null) {
847 return assetLink;
848 }
849
850 StringBundler msg = new StringBundler(4);
851
852 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
853
854 msg.append("entryId1=");
855 msg.append(entryId1);
856
857 msg.append(StringPool.CLOSE_CURLY_BRACE);
858
859 throw new NoSuchLinkException(msg.toString());
860 }
861
862
870 public AssetLink fetchByE1_First(long entryId1,
871 OrderByComparator orderByComparator) throws SystemException {
872 List<AssetLink> list = findByE1(entryId1, 0, 1, orderByComparator);
873
874 if (!list.isEmpty()) {
875 return list.get(0);
876 }
877
878 return null;
879 }
880
881
890 public AssetLink findByE1_Last(long entryId1,
891 OrderByComparator orderByComparator)
892 throws NoSuchLinkException, SystemException {
893 AssetLink assetLink = fetchByE1_Last(entryId1, orderByComparator);
894
895 if (assetLink != null) {
896 return assetLink;
897 }
898
899 StringBundler msg = new StringBundler(4);
900
901 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
902
903 msg.append("entryId1=");
904 msg.append(entryId1);
905
906 msg.append(StringPool.CLOSE_CURLY_BRACE);
907
908 throw new NoSuchLinkException(msg.toString());
909 }
910
911
919 public AssetLink fetchByE1_Last(long entryId1,
920 OrderByComparator orderByComparator) throws SystemException {
921 int count = countByE1(entryId1);
922
923 List<AssetLink> list = findByE1(entryId1, count - 1, count,
924 orderByComparator);
925
926 if (!list.isEmpty()) {
927 return list.get(0);
928 }
929
930 return null;
931 }
932
933
943 public AssetLink[] findByE1_PrevAndNext(long linkId, long entryId1,
944 OrderByComparator orderByComparator)
945 throws NoSuchLinkException, SystemException {
946 AssetLink assetLink = findByPrimaryKey(linkId);
947
948 Session session = null;
949
950 try {
951 session = openSession();
952
953 AssetLink[] array = new AssetLinkImpl[3];
954
955 array[0] = getByE1_PrevAndNext(session, assetLink, entryId1,
956 orderByComparator, true);
957
958 array[1] = assetLink;
959
960 array[2] = getByE1_PrevAndNext(session, assetLink, entryId1,
961 orderByComparator, false);
962
963 return array;
964 }
965 catch (Exception e) {
966 throw processException(e);
967 }
968 finally {
969 closeSession(session);
970 }
971 }
972
973 protected AssetLink getByE1_PrevAndNext(Session session,
974 AssetLink assetLink, long entryId1,
975 OrderByComparator orderByComparator, boolean previous) {
976 StringBundler query = null;
977
978 if (orderByComparator != null) {
979 query = new StringBundler(6 +
980 (orderByComparator.getOrderByFields().length * 6));
981 }
982 else {
983 query = new StringBundler(3);
984 }
985
986 query.append(_SQL_SELECT_ASSETLINK_WHERE);
987
988 query.append(_FINDER_COLUMN_E1_ENTRYID1_2);
989
990 if (orderByComparator != null) {
991 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
992
993 if (orderByConditionFields.length > 0) {
994 query.append(WHERE_AND);
995 }
996
997 for (int i = 0; i < orderByConditionFields.length; i++) {
998 query.append(_ORDER_BY_ENTITY_ALIAS);
999 query.append(orderByConditionFields[i]);
1000
1001 if ((i + 1) < orderByConditionFields.length) {
1002 if (orderByComparator.isAscending() ^ previous) {
1003 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1004 }
1005 else {
1006 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1007 }
1008 }
1009 else {
1010 if (orderByComparator.isAscending() ^ previous) {
1011 query.append(WHERE_GREATER_THAN);
1012 }
1013 else {
1014 query.append(WHERE_LESSER_THAN);
1015 }
1016 }
1017 }
1018
1019 query.append(ORDER_BY_CLAUSE);
1020
1021 String[] orderByFields = orderByComparator.getOrderByFields();
1022
1023 for (int i = 0; i < orderByFields.length; i++) {
1024 query.append(_ORDER_BY_ENTITY_ALIAS);
1025 query.append(orderByFields[i]);
1026
1027 if ((i + 1) < orderByFields.length) {
1028 if (orderByComparator.isAscending() ^ previous) {
1029 query.append(ORDER_BY_ASC_HAS_NEXT);
1030 }
1031 else {
1032 query.append(ORDER_BY_DESC_HAS_NEXT);
1033 }
1034 }
1035 else {
1036 if (orderByComparator.isAscending() ^ previous) {
1037 query.append(ORDER_BY_ASC);
1038 }
1039 else {
1040 query.append(ORDER_BY_DESC);
1041 }
1042 }
1043 }
1044 }
1045
1046 else {
1047 query.append(AssetLinkModelImpl.ORDER_BY_JPQL);
1048 }
1049
1050 String sql = query.toString();
1051
1052 Query q = session.createQuery(sql);
1053
1054 q.setFirstResult(0);
1055 q.setMaxResults(2);
1056
1057 QueryPos qPos = QueryPos.getInstance(q);
1058
1059 qPos.add(entryId1);
1060
1061 if (orderByComparator != null) {
1062 Object[] values = orderByComparator.getOrderByConditionValues(assetLink);
1063
1064 for (Object value : values) {
1065 qPos.add(value);
1066 }
1067 }
1068
1069 List<AssetLink> list = q.list();
1070
1071 if (list.size() == 2) {
1072 return list.get(1);
1073 }
1074 else {
1075 return null;
1076 }
1077 }
1078
1079
1086 public List<AssetLink> findByE2(long entryId2) throws SystemException {
1087 return findByE2(entryId2, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1088 }
1089
1090
1103 public List<AssetLink> findByE2(long entryId2, int start, int end)
1104 throws SystemException {
1105 return findByE2(entryId2, start, end, null);
1106 }
1107
1108
1122 public List<AssetLink> findByE2(long entryId2, int start, int end,
1123 OrderByComparator orderByComparator) throws SystemException {
1124 FinderPath finderPath = null;
1125 Object[] finderArgs = null;
1126
1127 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1128 (orderByComparator == null)) {
1129 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E2;
1130 finderArgs = new Object[] { entryId2 };
1131 }
1132 else {
1133 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_E2;
1134 finderArgs = new Object[] { entryId2, start, end, orderByComparator };
1135 }
1136
1137 List<AssetLink> list = (List<AssetLink>)FinderCacheUtil.getResult(finderPath,
1138 finderArgs, this);
1139
1140 if ((list != null) && !list.isEmpty()) {
1141 for (AssetLink assetLink : list) {
1142 if ((entryId2 != assetLink.getEntryId2())) {
1143 list = null;
1144
1145 break;
1146 }
1147 }
1148 }
1149
1150 if (list == null) {
1151 StringBundler query = null;
1152
1153 if (orderByComparator != null) {
1154 query = new StringBundler(3 +
1155 (orderByComparator.getOrderByFields().length * 3));
1156 }
1157 else {
1158 query = new StringBundler(3);
1159 }
1160
1161 query.append(_SQL_SELECT_ASSETLINK_WHERE);
1162
1163 query.append(_FINDER_COLUMN_E2_ENTRYID2_2);
1164
1165 if (orderByComparator != null) {
1166 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1167 orderByComparator);
1168 }
1169
1170 else {
1171 query.append(AssetLinkModelImpl.ORDER_BY_JPQL);
1172 }
1173
1174 String sql = query.toString();
1175
1176 Session session = null;
1177
1178 try {
1179 session = openSession();
1180
1181 Query q = session.createQuery(sql);
1182
1183 QueryPos qPos = QueryPos.getInstance(q);
1184
1185 qPos.add(entryId2);
1186
1187 list = (List<AssetLink>)QueryUtil.list(q, getDialect(), start,
1188 end);
1189 }
1190 catch (Exception e) {
1191 throw processException(e);
1192 }
1193 finally {
1194 if (list == null) {
1195 FinderCacheUtil.removeResult(finderPath, finderArgs);
1196 }
1197 else {
1198 cacheResult(list);
1199
1200 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1201 }
1202
1203 closeSession(session);
1204 }
1205 }
1206
1207 return list;
1208 }
1209
1210
1219 public AssetLink findByE2_First(long entryId2,
1220 OrderByComparator orderByComparator)
1221 throws NoSuchLinkException, SystemException {
1222 AssetLink assetLink = fetchByE2_First(entryId2, orderByComparator);
1223
1224 if (assetLink != null) {
1225 return assetLink;
1226 }
1227
1228 StringBundler msg = new StringBundler(4);
1229
1230 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1231
1232 msg.append("entryId2=");
1233 msg.append(entryId2);
1234
1235 msg.append(StringPool.CLOSE_CURLY_BRACE);
1236
1237 throw new NoSuchLinkException(msg.toString());
1238 }
1239
1240
1248 public AssetLink fetchByE2_First(long entryId2,
1249 OrderByComparator orderByComparator) throws SystemException {
1250 List<AssetLink> list = findByE2(entryId2, 0, 1, orderByComparator);
1251
1252 if (!list.isEmpty()) {
1253 return list.get(0);
1254 }
1255
1256 return null;
1257 }
1258
1259
1268 public AssetLink findByE2_Last(long entryId2,
1269 OrderByComparator orderByComparator)
1270 throws NoSuchLinkException, SystemException {
1271 AssetLink assetLink = fetchByE2_Last(entryId2, orderByComparator);
1272
1273 if (assetLink != null) {
1274 return assetLink;
1275 }
1276
1277 StringBundler msg = new StringBundler(4);
1278
1279 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1280
1281 msg.append("entryId2=");
1282 msg.append(entryId2);
1283
1284 msg.append(StringPool.CLOSE_CURLY_BRACE);
1285
1286 throw new NoSuchLinkException(msg.toString());
1287 }
1288
1289
1297 public AssetLink fetchByE2_Last(long entryId2,
1298 OrderByComparator orderByComparator) throws SystemException {
1299 int count = countByE2(entryId2);
1300
1301 List<AssetLink> list = findByE2(entryId2, count - 1, count,
1302 orderByComparator);
1303
1304 if (!list.isEmpty()) {
1305 return list.get(0);
1306 }
1307
1308 return null;
1309 }
1310
1311
1321 public AssetLink[] findByE2_PrevAndNext(long linkId, long entryId2,
1322 OrderByComparator orderByComparator)
1323 throws NoSuchLinkException, SystemException {
1324 AssetLink assetLink = findByPrimaryKey(linkId);
1325
1326 Session session = null;
1327
1328 try {
1329 session = openSession();
1330
1331 AssetLink[] array = new AssetLinkImpl[3];
1332
1333 array[0] = getByE2_PrevAndNext(session, assetLink, entryId2,
1334 orderByComparator, true);
1335
1336 array[1] = assetLink;
1337
1338 array[2] = getByE2_PrevAndNext(session, assetLink, entryId2,
1339 orderByComparator, false);
1340
1341 return array;
1342 }
1343 catch (Exception e) {
1344 throw processException(e);
1345 }
1346 finally {
1347 closeSession(session);
1348 }
1349 }
1350
1351 protected AssetLink getByE2_PrevAndNext(Session session,
1352 AssetLink assetLink, long entryId2,
1353 OrderByComparator orderByComparator, boolean previous) {
1354 StringBundler query = null;
1355
1356 if (orderByComparator != null) {
1357 query = new StringBundler(6 +
1358 (orderByComparator.getOrderByFields().length * 6));
1359 }
1360 else {
1361 query = new StringBundler(3);
1362 }
1363
1364 query.append(_SQL_SELECT_ASSETLINK_WHERE);
1365
1366 query.append(_FINDER_COLUMN_E2_ENTRYID2_2);
1367
1368 if (orderByComparator != null) {
1369 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1370
1371 if (orderByConditionFields.length > 0) {
1372 query.append(WHERE_AND);
1373 }
1374
1375 for (int i = 0; i < orderByConditionFields.length; i++) {
1376 query.append(_ORDER_BY_ENTITY_ALIAS);
1377 query.append(orderByConditionFields[i]);
1378
1379 if ((i + 1) < orderByConditionFields.length) {
1380 if (orderByComparator.isAscending() ^ previous) {
1381 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1382 }
1383 else {
1384 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1385 }
1386 }
1387 else {
1388 if (orderByComparator.isAscending() ^ previous) {
1389 query.append(WHERE_GREATER_THAN);
1390 }
1391 else {
1392 query.append(WHERE_LESSER_THAN);
1393 }
1394 }
1395 }
1396
1397 query.append(ORDER_BY_CLAUSE);
1398
1399 String[] orderByFields = orderByComparator.getOrderByFields();
1400
1401 for (int i = 0; i < orderByFields.length; i++) {
1402 query.append(_ORDER_BY_ENTITY_ALIAS);
1403 query.append(orderByFields[i]);
1404
1405 if ((i + 1) < orderByFields.length) {
1406 if (orderByComparator.isAscending() ^ previous) {
1407 query.append(ORDER_BY_ASC_HAS_NEXT);
1408 }
1409 else {
1410 query.append(ORDER_BY_DESC_HAS_NEXT);
1411 }
1412 }
1413 else {
1414 if (orderByComparator.isAscending() ^ previous) {
1415 query.append(ORDER_BY_ASC);
1416 }
1417 else {
1418 query.append(ORDER_BY_DESC);
1419 }
1420 }
1421 }
1422 }
1423
1424 else {
1425 query.append(AssetLinkModelImpl.ORDER_BY_JPQL);
1426 }
1427
1428 String sql = query.toString();
1429
1430 Query q = session.createQuery(sql);
1431
1432 q.setFirstResult(0);
1433 q.setMaxResults(2);
1434
1435 QueryPos qPos = QueryPos.getInstance(q);
1436
1437 qPos.add(entryId2);
1438
1439 if (orderByComparator != null) {
1440 Object[] values = orderByComparator.getOrderByConditionValues(assetLink);
1441
1442 for (Object value : values) {
1443 qPos.add(value);
1444 }
1445 }
1446
1447 List<AssetLink> list = q.list();
1448
1449 if (list.size() == 2) {
1450 return list.get(1);
1451 }
1452 else {
1453 return null;
1454 }
1455 }
1456
1457
1465 public List<AssetLink> findByE_E(long entryId1, long entryId2)
1466 throws SystemException {
1467 return findByE_E(entryId1, entryId2, QueryUtil.ALL_POS,
1468 QueryUtil.ALL_POS, null);
1469 }
1470
1471
1485 public List<AssetLink> findByE_E(long entryId1, long entryId2, int start,
1486 int end) throws SystemException {
1487 return findByE_E(entryId1, entryId2, start, end, null);
1488 }
1489
1490
1505 public List<AssetLink> findByE_E(long entryId1, long entryId2, int start,
1506 int end, OrderByComparator orderByComparator) throws SystemException {
1507 FinderPath finderPath = null;
1508 Object[] finderArgs = null;
1509
1510 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1511 (orderByComparator == null)) {
1512 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E_E;
1513 finderArgs = new Object[] { entryId1, entryId2 };
1514 }
1515 else {
1516 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_E_E;
1517 finderArgs = new Object[] {
1518 entryId1, entryId2,
1519
1520 start, end, orderByComparator
1521 };
1522 }
1523
1524 List<AssetLink> list = (List<AssetLink>)FinderCacheUtil.getResult(finderPath,
1525 finderArgs, this);
1526
1527 if ((list != null) && !list.isEmpty()) {
1528 for (AssetLink assetLink : list) {
1529 if ((entryId1 != assetLink.getEntryId1()) ||
1530 (entryId2 != assetLink.getEntryId2())) {
1531 list = null;
1532
1533 break;
1534 }
1535 }
1536 }
1537
1538 if (list == null) {
1539 StringBundler query = null;
1540
1541 if (orderByComparator != null) {
1542 query = new StringBundler(4 +
1543 (orderByComparator.getOrderByFields().length * 3));
1544 }
1545 else {
1546 query = new StringBundler(4);
1547 }
1548
1549 query.append(_SQL_SELECT_ASSETLINK_WHERE);
1550
1551 query.append(_FINDER_COLUMN_E_E_ENTRYID1_2);
1552
1553 query.append(_FINDER_COLUMN_E_E_ENTRYID2_2);
1554
1555 if (orderByComparator != null) {
1556 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1557 orderByComparator);
1558 }
1559
1560 else {
1561 query.append(AssetLinkModelImpl.ORDER_BY_JPQL);
1562 }
1563
1564 String sql = query.toString();
1565
1566 Session session = null;
1567
1568 try {
1569 session = openSession();
1570
1571 Query q = session.createQuery(sql);
1572
1573 QueryPos qPos = QueryPos.getInstance(q);
1574
1575 qPos.add(entryId1);
1576
1577 qPos.add(entryId2);
1578
1579 list = (List<AssetLink>)QueryUtil.list(q, getDialect(), start,
1580 end);
1581 }
1582 catch (Exception e) {
1583 throw processException(e);
1584 }
1585 finally {
1586 if (list == null) {
1587 FinderCacheUtil.removeResult(finderPath, finderArgs);
1588 }
1589 else {
1590 cacheResult(list);
1591
1592 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1593 }
1594
1595 closeSession(session);
1596 }
1597 }
1598
1599 return list;
1600 }
1601
1602
1612 public AssetLink findByE_E_First(long entryId1, long entryId2,
1613 OrderByComparator orderByComparator)
1614 throws NoSuchLinkException, SystemException {
1615 AssetLink assetLink = fetchByE_E_First(entryId1, entryId2,
1616 orderByComparator);
1617
1618 if (assetLink != null) {
1619 return assetLink;
1620 }
1621
1622 StringBundler msg = new StringBundler(6);
1623
1624 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1625
1626 msg.append("entryId1=");
1627 msg.append(entryId1);
1628
1629 msg.append(", entryId2=");
1630 msg.append(entryId2);
1631
1632 msg.append(StringPool.CLOSE_CURLY_BRACE);
1633
1634 throw new NoSuchLinkException(msg.toString());
1635 }
1636
1637
1646 public AssetLink fetchByE_E_First(long entryId1, long entryId2,
1647 OrderByComparator orderByComparator) throws SystemException {
1648 List<AssetLink> list = findByE_E(entryId1, entryId2, 0, 1,
1649 orderByComparator);
1650
1651 if (!list.isEmpty()) {
1652 return list.get(0);
1653 }
1654
1655 return null;
1656 }
1657
1658
1668 public AssetLink findByE_E_Last(long entryId1, long entryId2,
1669 OrderByComparator orderByComparator)
1670 throws NoSuchLinkException, SystemException {
1671 AssetLink assetLink = fetchByE_E_Last(entryId1, entryId2,
1672 orderByComparator);
1673
1674 if (assetLink != null) {
1675 return assetLink;
1676 }
1677
1678 StringBundler msg = new StringBundler(6);
1679
1680 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1681
1682 msg.append("entryId1=");
1683 msg.append(entryId1);
1684
1685 msg.append(", entryId2=");
1686 msg.append(entryId2);
1687
1688 msg.append(StringPool.CLOSE_CURLY_BRACE);
1689
1690 throw new NoSuchLinkException(msg.toString());
1691 }
1692
1693
1702 public AssetLink fetchByE_E_Last(long entryId1, long entryId2,
1703 OrderByComparator orderByComparator) throws SystemException {
1704 int count = countByE_E(entryId1, entryId2);
1705
1706 List<AssetLink> list = findByE_E(entryId1, entryId2, count - 1, count,
1707 orderByComparator);
1708
1709 if (!list.isEmpty()) {
1710 return list.get(0);
1711 }
1712
1713 return null;
1714 }
1715
1716
1727 public AssetLink[] findByE_E_PrevAndNext(long linkId, long entryId1,
1728 long entryId2, OrderByComparator orderByComparator)
1729 throws NoSuchLinkException, SystemException {
1730 AssetLink assetLink = findByPrimaryKey(linkId);
1731
1732 Session session = null;
1733
1734 try {
1735 session = openSession();
1736
1737 AssetLink[] array = new AssetLinkImpl[3];
1738
1739 array[0] = getByE_E_PrevAndNext(session, assetLink, entryId1,
1740 entryId2, orderByComparator, true);
1741
1742 array[1] = assetLink;
1743
1744 array[2] = getByE_E_PrevAndNext(session, assetLink, entryId1,
1745 entryId2, orderByComparator, false);
1746
1747 return array;
1748 }
1749 catch (Exception e) {
1750 throw processException(e);
1751 }
1752 finally {
1753 closeSession(session);
1754 }
1755 }
1756
1757 protected AssetLink getByE_E_PrevAndNext(Session session,
1758 AssetLink assetLink, long entryId1, long entryId2,
1759 OrderByComparator orderByComparator, boolean previous) {
1760 StringBundler query = null;
1761
1762 if (orderByComparator != null) {
1763 query = new StringBundler(6 +
1764 (orderByComparator.getOrderByFields().length * 6));
1765 }
1766 else {
1767 query = new StringBundler(3);
1768 }
1769
1770 query.append(_SQL_SELECT_ASSETLINK_WHERE);
1771
1772 query.append(_FINDER_COLUMN_E_E_ENTRYID1_2);
1773
1774 query.append(_FINDER_COLUMN_E_E_ENTRYID2_2);
1775
1776 if (orderByComparator != null) {
1777 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1778
1779 if (orderByConditionFields.length > 0) {
1780 query.append(WHERE_AND);
1781 }
1782
1783 for (int i = 0; i < orderByConditionFields.length; i++) {
1784 query.append(_ORDER_BY_ENTITY_ALIAS);
1785 query.append(orderByConditionFields[i]);
1786
1787 if ((i + 1) < orderByConditionFields.length) {
1788 if (orderByComparator.isAscending() ^ previous) {
1789 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1790 }
1791 else {
1792 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1793 }
1794 }
1795 else {
1796 if (orderByComparator.isAscending() ^ previous) {
1797 query.append(WHERE_GREATER_THAN);
1798 }
1799 else {
1800 query.append(WHERE_LESSER_THAN);
1801 }
1802 }
1803 }
1804
1805 query.append(ORDER_BY_CLAUSE);
1806
1807 String[] orderByFields = orderByComparator.getOrderByFields();
1808
1809 for (int i = 0; i < orderByFields.length; i++) {
1810 query.append(_ORDER_BY_ENTITY_ALIAS);
1811 query.append(orderByFields[i]);
1812
1813 if ((i + 1) < orderByFields.length) {
1814 if (orderByComparator.isAscending() ^ previous) {
1815 query.append(ORDER_BY_ASC_HAS_NEXT);
1816 }
1817 else {
1818 query.append(ORDER_BY_DESC_HAS_NEXT);
1819 }
1820 }
1821 else {
1822 if (orderByComparator.isAscending() ^ previous) {
1823 query.append(ORDER_BY_ASC);
1824 }
1825 else {
1826 query.append(ORDER_BY_DESC);
1827 }
1828 }
1829 }
1830 }
1831
1832 else {
1833 query.append(AssetLinkModelImpl.ORDER_BY_JPQL);
1834 }
1835
1836 String sql = query.toString();
1837
1838 Query q = session.createQuery(sql);
1839
1840 q.setFirstResult(0);
1841 q.setMaxResults(2);
1842
1843 QueryPos qPos = QueryPos.getInstance(q);
1844
1845 qPos.add(entryId1);
1846
1847 qPos.add(entryId2);
1848
1849 if (orderByComparator != null) {
1850 Object[] values = orderByComparator.getOrderByConditionValues(assetLink);
1851
1852 for (Object value : values) {
1853 qPos.add(value);
1854 }
1855 }
1856
1857 List<AssetLink> list = q.list();
1858
1859 if (list.size() == 2) {
1860 return list.get(1);
1861 }
1862 else {
1863 return null;
1864 }
1865 }
1866
1867
1875 public List<AssetLink> findByE1_T(long entryId1, int type)
1876 throws SystemException {
1877 return findByE1_T(entryId1, type, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1878 null);
1879 }
1880
1881
1895 public List<AssetLink> findByE1_T(long entryId1, int type, int start,
1896 int end) throws SystemException {
1897 return findByE1_T(entryId1, type, start, end, null);
1898 }
1899
1900
1915 public List<AssetLink> findByE1_T(long entryId1, int type, int start,
1916 int end, OrderByComparator orderByComparator) throws SystemException {
1917 FinderPath finderPath = null;
1918 Object[] finderArgs = null;
1919
1920 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1921 (orderByComparator == null)) {
1922 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E1_T;
1923 finderArgs = new Object[] { entryId1, type };
1924 }
1925 else {
1926 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_E1_T;
1927 finderArgs = new Object[] {
1928 entryId1, type,
1929
1930 start, end, orderByComparator
1931 };
1932 }
1933
1934 List<AssetLink> list = (List<AssetLink>)FinderCacheUtil.getResult(finderPath,
1935 finderArgs, this);
1936
1937 if ((list != null) && !list.isEmpty()) {
1938 for (AssetLink assetLink : list) {
1939 if ((entryId1 != assetLink.getEntryId1()) ||
1940 (type != assetLink.getType())) {
1941 list = null;
1942
1943 break;
1944 }
1945 }
1946 }
1947
1948 if (list == null) {
1949 StringBundler query = null;
1950
1951 if (orderByComparator != null) {
1952 query = new StringBundler(4 +
1953 (orderByComparator.getOrderByFields().length * 3));
1954 }
1955 else {
1956 query = new StringBundler(4);
1957 }
1958
1959 query.append(_SQL_SELECT_ASSETLINK_WHERE);
1960
1961 query.append(_FINDER_COLUMN_E1_T_ENTRYID1_2);
1962
1963 query.append(_FINDER_COLUMN_E1_T_TYPE_2);
1964
1965 if (orderByComparator != null) {
1966 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1967 orderByComparator);
1968 }
1969
1970 else {
1971 query.append(AssetLinkModelImpl.ORDER_BY_JPQL);
1972 }
1973
1974 String sql = query.toString();
1975
1976 Session session = null;
1977
1978 try {
1979 session = openSession();
1980
1981 Query q = session.createQuery(sql);
1982
1983 QueryPos qPos = QueryPos.getInstance(q);
1984
1985 qPos.add(entryId1);
1986
1987 qPos.add(type);
1988
1989 list = (List<AssetLink>)QueryUtil.list(q, getDialect(), start,
1990 end);
1991 }
1992 catch (Exception e) {
1993 throw processException(e);
1994 }
1995 finally {
1996 if (list == null) {
1997 FinderCacheUtil.removeResult(finderPath, finderArgs);
1998 }
1999 else {
2000 cacheResult(list);
2001
2002 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2003 }
2004
2005 closeSession(session);
2006 }
2007 }
2008
2009 return list;
2010 }
2011
2012
2022 public AssetLink findByE1_T_First(long entryId1, int type,
2023 OrderByComparator orderByComparator)
2024 throws NoSuchLinkException, SystemException {
2025 AssetLink assetLink = fetchByE1_T_First(entryId1, type,
2026 orderByComparator);
2027
2028 if (assetLink != null) {
2029 return assetLink;
2030 }
2031
2032 StringBundler msg = new StringBundler(6);
2033
2034 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2035
2036 msg.append("entryId1=");
2037 msg.append(entryId1);
2038
2039 msg.append(", type=");
2040 msg.append(type);
2041
2042 msg.append(StringPool.CLOSE_CURLY_BRACE);
2043
2044 throw new NoSuchLinkException(msg.toString());
2045 }
2046
2047
2056 public AssetLink fetchByE1_T_First(long entryId1, int type,
2057 OrderByComparator orderByComparator) throws SystemException {
2058 List<AssetLink> list = findByE1_T(entryId1, type, 0, 1,
2059 orderByComparator);
2060
2061 if (!list.isEmpty()) {
2062 return list.get(0);
2063 }
2064
2065 return null;
2066 }
2067
2068
2078 public AssetLink findByE1_T_Last(long entryId1, int type,
2079 OrderByComparator orderByComparator)
2080 throws NoSuchLinkException, SystemException {
2081 AssetLink assetLink = fetchByE1_T_Last(entryId1, type, orderByComparator);
2082
2083 if (assetLink != null) {
2084 return assetLink;
2085 }
2086
2087 StringBundler msg = new StringBundler(6);
2088
2089 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2090
2091 msg.append("entryId1=");
2092 msg.append(entryId1);
2093
2094 msg.append(", type=");
2095 msg.append(type);
2096
2097 msg.append(StringPool.CLOSE_CURLY_BRACE);
2098
2099 throw new NoSuchLinkException(msg.toString());
2100 }
2101
2102
2111 public AssetLink fetchByE1_T_Last(long entryId1, int type,
2112 OrderByComparator orderByComparator) throws SystemException {
2113 int count = countByE1_T(entryId1, type);
2114
2115 List<AssetLink> list = findByE1_T(entryId1, type, count - 1, count,
2116 orderByComparator);
2117
2118 if (!list.isEmpty()) {
2119 return list.get(0);
2120 }
2121
2122 return null;
2123 }
2124
2125
2136 public AssetLink[] findByE1_T_PrevAndNext(long linkId, long entryId1,
2137 int type, OrderByComparator orderByComparator)
2138 throws NoSuchLinkException, SystemException {
2139 AssetLink assetLink = findByPrimaryKey(linkId);
2140
2141 Session session = null;
2142
2143 try {
2144 session = openSession();
2145
2146 AssetLink[] array = new AssetLinkImpl[3];
2147
2148 array[0] = getByE1_T_PrevAndNext(session, assetLink, entryId1,
2149 type, orderByComparator, true);
2150
2151 array[1] = assetLink;
2152
2153 array[2] = getByE1_T_PrevAndNext(session, assetLink, entryId1,
2154 type, orderByComparator, false);
2155
2156 return array;
2157 }
2158 catch (Exception e) {
2159 throw processException(e);
2160 }
2161 finally {
2162 closeSession(session);
2163 }
2164 }
2165
2166 protected AssetLink getByE1_T_PrevAndNext(Session session,
2167 AssetLink assetLink, long entryId1, int type,
2168 OrderByComparator orderByComparator, boolean previous) {
2169 StringBundler query = null;
2170
2171 if (orderByComparator != null) {
2172 query = new StringBundler(6 +
2173 (orderByComparator.getOrderByFields().length * 6));
2174 }
2175 else {
2176 query = new StringBundler(3);
2177 }
2178
2179 query.append(_SQL_SELECT_ASSETLINK_WHERE);
2180
2181 query.append(_FINDER_COLUMN_E1_T_ENTRYID1_2);
2182
2183 query.append(_FINDER_COLUMN_E1_T_TYPE_2);
2184
2185 if (orderByComparator != null) {
2186 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2187
2188 if (orderByConditionFields.length > 0) {
2189 query.append(WHERE_AND);
2190 }
2191
2192 for (int i = 0; i < orderByConditionFields.length; i++) {
2193 query.append(_ORDER_BY_ENTITY_ALIAS);
2194 query.append(orderByConditionFields[i]);
2195
2196 if ((i + 1) < orderByConditionFields.length) {
2197 if (orderByComparator.isAscending() ^ previous) {
2198 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2199 }
2200 else {
2201 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2202 }
2203 }
2204 else {
2205 if (orderByComparator.isAscending() ^ previous) {
2206 query.append(WHERE_GREATER_THAN);
2207 }
2208 else {
2209 query.append(WHERE_LESSER_THAN);
2210 }
2211 }
2212 }
2213
2214 query.append(ORDER_BY_CLAUSE);
2215
2216 String[] orderByFields = orderByComparator.getOrderByFields();
2217
2218 for (int i = 0; i < orderByFields.length; i++) {
2219 query.append(_ORDER_BY_ENTITY_ALIAS);
2220 query.append(orderByFields[i]);
2221
2222 if ((i + 1) < orderByFields.length) {
2223 if (orderByComparator.isAscending() ^ previous) {
2224 query.append(ORDER_BY_ASC_HAS_NEXT);
2225 }
2226 else {
2227 query.append(ORDER_BY_DESC_HAS_NEXT);
2228 }
2229 }
2230 else {
2231 if (orderByComparator.isAscending() ^ previous) {
2232 query.append(ORDER_BY_ASC);
2233 }
2234 else {
2235 query.append(ORDER_BY_DESC);
2236 }
2237 }
2238 }
2239 }
2240
2241 else {
2242 query.append(AssetLinkModelImpl.ORDER_BY_JPQL);
2243 }
2244
2245 String sql = query.toString();
2246
2247 Query q = session.createQuery(sql);
2248
2249 q.setFirstResult(0);
2250 q.setMaxResults(2);
2251
2252 QueryPos qPos = QueryPos.getInstance(q);
2253
2254 qPos.add(entryId1);
2255
2256 qPos.add(type);
2257
2258 if (orderByComparator != null) {
2259 Object[] values = orderByComparator.getOrderByConditionValues(assetLink);
2260
2261 for (Object value : values) {
2262 qPos.add(value);
2263 }
2264 }
2265
2266 List<AssetLink> list = q.list();
2267
2268 if (list.size() == 2) {
2269 return list.get(1);
2270 }
2271 else {
2272 return null;
2273 }
2274 }
2275
2276
2284 public List<AssetLink> findByE2_T(long entryId2, int type)
2285 throws SystemException {
2286 return findByE2_T(entryId2, type, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
2287 null);
2288 }
2289
2290
2304 public List<AssetLink> findByE2_T(long entryId2, int type, int start,
2305 int end) throws SystemException {
2306 return findByE2_T(entryId2, type, start, end, null);
2307 }
2308
2309
2324 public List<AssetLink> findByE2_T(long entryId2, int type, int start,
2325 int end, OrderByComparator orderByComparator) throws SystemException {
2326 FinderPath finderPath = null;
2327 Object[] finderArgs = null;
2328
2329 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2330 (orderByComparator == null)) {
2331 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_E2_T;
2332 finderArgs = new Object[] { entryId2, type };
2333 }
2334 else {
2335 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_E2_T;
2336 finderArgs = new Object[] {
2337 entryId2, type,
2338
2339 start, end, orderByComparator
2340 };
2341 }
2342
2343 List<AssetLink> list = (List<AssetLink>)FinderCacheUtil.getResult(finderPath,
2344 finderArgs, this);
2345
2346 if ((list != null) && !list.isEmpty()) {
2347 for (AssetLink assetLink : list) {
2348 if ((entryId2 != assetLink.getEntryId2()) ||
2349 (type != assetLink.getType())) {
2350 list = null;
2351
2352 break;
2353 }
2354 }
2355 }
2356
2357 if (list == null) {
2358 StringBundler query = null;
2359
2360 if (orderByComparator != null) {
2361 query = new StringBundler(4 +
2362 (orderByComparator.getOrderByFields().length * 3));
2363 }
2364 else {
2365 query = new StringBundler(4);
2366 }
2367
2368 query.append(_SQL_SELECT_ASSETLINK_WHERE);
2369
2370 query.append(_FINDER_COLUMN_E2_T_ENTRYID2_2);
2371
2372 query.append(_FINDER_COLUMN_E2_T_TYPE_2);
2373
2374 if (orderByComparator != null) {
2375 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2376 orderByComparator);
2377 }
2378
2379 else {
2380 query.append(AssetLinkModelImpl.ORDER_BY_JPQL);
2381 }
2382
2383 String sql = query.toString();
2384
2385 Session session = null;
2386
2387 try {
2388 session = openSession();
2389
2390 Query q = session.createQuery(sql);
2391
2392 QueryPos qPos = QueryPos.getInstance(q);
2393
2394 qPos.add(entryId2);
2395
2396 qPos.add(type);
2397
2398 list = (List<AssetLink>)QueryUtil.list(q, getDialect(), start,
2399 end);
2400 }
2401 catch (Exception e) {
2402 throw processException(e);
2403 }
2404 finally {
2405 if (list == null) {
2406 FinderCacheUtil.removeResult(finderPath, finderArgs);
2407 }
2408 else {
2409 cacheResult(list);
2410
2411 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2412 }
2413
2414 closeSession(session);
2415 }
2416 }
2417
2418 return list;
2419 }
2420
2421
2431 public AssetLink findByE2_T_First(long entryId2, int type,
2432 OrderByComparator orderByComparator)
2433 throws NoSuchLinkException, SystemException {
2434 AssetLink assetLink = fetchByE2_T_First(entryId2, type,
2435 orderByComparator);
2436
2437 if (assetLink != null) {
2438 return assetLink;
2439 }
2440
2441 StringBundler msg = new StringBundler(6);
2442
2443 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2444
2445 msg.append("entryId2=");
2446 msg.append(entryId2);
2447
2448 msg.append(", type=");
2449 msg.append(type);
2450
2451 msg.append(StringPool.CLOSE_CURLY_BRACE);
2452
2453 throw new NoSuchLinkException(msg.toString());
2454 }
2455
2456
2465 public AssetLink fetchByE2_T_First(long entryId2, int type,
2466 OrderByComparator orderByComparator) throws SystemException {
2467 List<AssetLink> list = findByE2_T(entryId2, type, 0, 1,
2468 orderByComparator);
2469
2470 if (!list.isEmpty()) {
2471 return list.get(0);
2472 }
2473
2474 return null;
2475 }
2476
2477
2487 public AssetLink findByE2_T_Last(long entryId2, int type,
2488 OrderByComparator orderByComparator)
2489 throws NoSuchLinkException, SystemException {
2490 AssetLink assetLink = fetchByE2_T_Last(entryId2, type, orderByComparator);
2491
2492 if (assetLink != null) {
2493 return assetLink;
2494 }
2495
2496 StringBundler msg = new StringBundler(6);
2497
2498 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2499
2500 msg.append("entryId2=");
2501 msg.append(entryId2);
2502
2503 msg.append(", type=");
2504 msg.append(type);
2505
2506 msg.append(StringPool.CLOSE_CURLY_BRACE);
2507
2508 throw new NoSuchLinkException(msg.toString());
2509 }
2510
2511
2520 public AssetLink fetchByE2_T_Last(long entryId2, int type,
2521 OrderByComparator orderByComparator) throws SystemException {
2522 int count = countByE2_T(entryId2, type);
2523
2524 List<AssetLink> list = findByE2_T(entryId2, type, count - 1, count,
2525 orderByComparator);
2526
2527 if (!list.isEmpty()) {
2528 return list.get(0);
2529 }
2530
2531 return null;
2532 }
2533
2534
2545 public AssetLink[] findByE2_T_PrevAndNext(long linkId, long entryId2,
2546 int type, OrderByComparator orderByComparator)
2547 throws NoSuchLinkException, SystemException {
2548 AssetLink assetLink = findByPrimaryKey(linkId);
2549
2550 Session session = null;
2551
2552 try {
2553 session = openSession();
2554
2555 AssetLink[] array = new AssetLinkImpl[3];
2556
2557 array[0] = getByE2_T_PrevAndNext(session, assetLink, entryId2,
2558 type, orderByComparator, true);
2559
2560 array[1] = assetLink;
2561
2562 array[2] = getByE2_T_PrevAndNext(session, assetLink, entryId2,
2563 type, orderByComparator, false);
2564
2565 return array;
2566 }
2567 catch (Exception e) {
2568 throw processException(e);
2569 }
2570 finally {
2571 closeSession(session);
2572 }
2573 }
2574
2575 protected AssetLink getByE2_T_PrevAndNext(Session session,
2576 AssetLink assetLink, long entryId2, int type,
2577 OrderByComparator orderByComparator, boolean previous) {
2578 StringBundler query = null;
2579
2580 if (orderByComparator != null) {
2581 query = new StringBundler(6 +
2582 (orderByComparator.getOrderByFields().length * 6));
2583 }
2584 else {
2585 query = new StringBundler(3);
2586 }
2587
2588 query.append(_SQL_SELECT_ASSETLINK_WHERE);
2589
2590 query.append(_FINDER_COLUMN_E2_T_ENTRYID2_2);
2591
2592 query.append(_FINDER_COLUMN_E2_T_TYPE_2);
2593
2594 if (orderByComparator != null) {
2595 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2596
2597 if (orderByConditionFields.length > 0) {
2598 query.append(WHERE_AND);
2599 }
2600
2601 for (int i = 0; i < orderByConditionFields.length; i++) {
2602 query.append(_ORDER_BY_ENTITY_ALIAS);
2603 query.append(orderByConditionFields[i]);
2604
2605 if ((i + 1) < orderByConditionFields.length) {
2606 if (orderByComparator.isAscending() ^ previous) {
2607 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2608 }
2609 else {
2610 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2611 }
2612 }
2613 else {
2614 if (orderByComparator.isAscending() ^ previous) {
2615 query.append(WHERE_GREATER_THAN);
2616 }
2617 else {
2618 query.append(WHERE_LESSER_THAN);
2619 }
2620 }
2621 }
2622
2623 query.append(ORDER_BY_CLAUSE);
2624
2625 String[] orderByFields = orderByComparator.getOrderByFields();
2626
2627 for (int i = 0; i < orderByFields.length; i++) {
2628 query.append(_ORDER_BY_ENTITY_ALIAS);
2629 query.append(orderByFields[i]);
2630
2631 if ((i + 1) < orderByFields.length) {
2632 if (orderByComparator.isAscending() ^ previous) {
2633 query.append(ORDER_BY_ASC_HAS_NEXT);
2634 }
2635 else {
2636 query.append(ORDER_BY_DESC_HAS_NEXT);
2637 }
2638 }
2639 else {
2640 if (orderByComparator.isAscending() ^ previous) {
2641 query.append(ORDER_BY_ASC);
2642 }
2643 else {
2644 query.append(ORDER_BY_DESC);
2645 }
2646 }
2647 }
2648 }
2649
2650 else {
2651 query.append(AssetLinkModelImpl.ORDER_BY_JPQL);
2652 }
2653
2654 String sql = query.toString();
2655
2656 Query q = session.createQuery(sql);
2657
2658 q.setFirstResult(0);
2659 q.setMaxResults(2);
2660
2661 QueryPos qPos = QueryPos.getInstance(q);
2662
2663 qPos.add(entryId2);
2664
2665 qPos.add(type);
2666
2667 if (orderByComparator != null) {
2668 Object[] values = orderByComparator.getOrderByConditionValues(assetLink);
2669
2670 for (Object value : values) {
2671 qPos.add(value);
2672 }
2673 }
2674
2675 List<AssetLink> list = q.list();
2676
2677 if (list.size() == 2) {
2678 return list.get(1);
2679 }
2680 else {
2681 return null;
2682 }
2683 }
2684
2685
2695 public AssetLink findByE_E_T(long entryId1, long entryId2, int type)
2696 throws NoSuchLinkException, SystemException {
2697 AssetLink assetLink = fetchByE_E_T(entryId1, entryId2, type);
2698
2699 if (assetLink == null) {
2700 StringBundler msg = new StringBundler(8);
2701
2702 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2703
2704 msg.append("entryId1=");
2705 msg.append(entryId1);
2706
2707 msg.append(", entryId2=");
2708 msg.append(entryId2);
2709
2710 msg.append(", type=");
2711 msg.append(type);
2712
2713 msg.append(StringPool.CLOSE_CURLY_BRACE);
2714
2715 if (_log.isWarnEnabled()) {
2716 _log.warn(msg.toString());
2717 }
2718
2719 throw new NoSuchLinkException(msg.toString());
2720 }
2721
2722 return assetLink;
2723 }
2724
2725
2734 public AssetLink fetchByE_E_T(long entryId1, long entryId2, int type)
2735 throws SystemException {
2736 return fetchByE_E_T(entryId1, entryId2, type, true);
2737 }
2738
2739
2749 public AssetLink fetchByE_E_T(long entryId1, long entryId2, int type,
2750 boolean retrieveFromCache) throws SystemException {
2751 Object[] finderArgs = new Object[] { entryId1, entryId2, type };
2752
2753 Object result = null;
2754
2755 if (retrieveFromCache) {
2756 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_E_E_T,
2757 finderArgs, this);
2758 }
2759
2760 if (result instanceof AssetLink) {
2761 AssetLink assetLink = (AssetLink)result;
2762
2763 if ((entryId1 != assetLink.getEntryId1()) ||
2764 (entryId2 != assetLink.getEntryId2()) ||
2765 (type != assetLink.getType())) {
2766 result = null;
2767 }
2768 }
2769
2770 if (result == null) {
2771 StringBundler query = new StringBundler(5);
2772
2773 query.append(_SQL_SELECT_ASSETLINK_WHERE);
2774
2775 query.append(_FINDER_COLUMN_E_E_T_ENTRYID1_2);
2776
2777 query.append(_FINDER_COLUMN_E_E_T_ENTRYID2_2);
2778
2779 query.append(_FINDER_COLUMN_E_E_T_TYPE_2);
2780
2781 query.append(AssetLinkModelImpl.ORDER_BY_JPQL);
2782
2783 String sql = query.toString();
2784
2785 Session session = null;
2786
2787 try {
2788 session = openSession();
2789
2790 Query q = session.createQuery(sql);
2791
2792 QueryPos qPos = QueryPos.getInstance(q);
2793
2794 qPos.add(entryId1);
2795
2796 qPos.add(entryId2);
2797
2798 qPos.add(type);
2799
2800 List<AssetLink> list = q.list();
2801
2802 result = list;
2803
2804 AssetLink assetLink = null;
2805
2806 if (list.isEmpty()) {
2807 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_E_E_T,
2808 finderArgs, list);
2809 }
2810 else {
2811 assetLink = list.get(0);
2812
2813 cacheResult(assetLink);
2814
2815 if ((assetLink.getEntryId1() != entryId1) ||
2816 (assetLink.getEntryId2() != entryId2) ||
2817 (assetLink.getType() != type)) {
2818 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_E_E_T,
2819 finderArgs, assetLink);
2820 }
2821 }
2822
2823 return assetLink;
2824 }
2825 catch (Exception e) {
2826 throw processException(e);
2827 }
2828 finally {
2829 if (result == null) {
2830 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_E_E_T,
2831 finderArgs);
2832 }
2833
2834 closeSession(session);
2835 }
2836 }
2837 else {
2838 if (result instanceof List<?>) {
2839 return null;
2840 }
2841 else {
2842 return (AssetLink)result;
2843 }
2844 }
2845 }
2846
2847
2853 public List<AssetLink> findAll() throws SystemException {
2854 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2855 }
2856
2857
2869 public List<AssetLink> findAll(int start, int end)
2870 throws SystemException {
2871 return findAll(start, end, null);
2872 }
2873
2874
2887 public List<AssetLink> findAll(int start, int end,
2888 OrderByComparator orderByComparator) throws SystemException {
2889 FinderPath finderPath = null;
2890 Object[] finderArgs = new Object[] { start, end, orderByComparator };
2891
2892 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2893 (orderByComparator == null)) {
2894 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
2895 finderArgs = FINDER_ARGS_EMPTY;
2896 }
2897 else {
2898 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2899 finderArgs = new Object[] { start, end, orderByComparator };
2900 }
2901
2902 List<AssetLink> list = (List<AssetLink>)FinderCacheUtil.getResult(finderPath,
2903 finderArgs, this);
2904
2905 if (list == null) {
2906 StringBundler query = null;
2907 String sql = null;
2908
2909 if (orderByComparator != null) {
2910 query = new StringBundler(2 +
2911 (orderByComparator.getOrderByFields().length * 3));
2912
2913 query.append(_SQL_SELECT_ASSETLINK);
2914
2915 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2916 orderByComparator);
2917
2918 sql = query.toString();
2919 }
2920 else {
2921 sql = _SQL_SELECT_ASSETLINK.concat(AssetLinkModelImpl.ORDER_BY_JPQL);
2922 }
2923
2924 Session session = null;
2925
2926 try {
2927 session = openSession();
2928
2929 Query q = session.createQuery(sql);
2930
2931 if (orderByComparator == null) {
2932 list = (List<AssetLink>)QueryUtil.list(q, getDialect(),
2933 start, end, false);
2934
2935 Collections.sort(list);
2936 }
2937 else {
2938 list = (List<AssetLink>)QueryUtil.list(q, getDialect(),
2939 start, end);
2940 }
2941 }
2942 catch (Exception e) {
2943 throw processException(e);
2944 }
2945 finally {
2946 if (list == null) {
2947 FinderCacheUtil.removeResult(finderPath, finderArgs);
2948 }
2949 else {
2950 cacheResult(list);
2951
2952 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2953 }
2954
2955 closeSession(session);
2956 }
2957 }
2958
2959 return list;
2960 }
2961
2962
2968 public void removeByE1(long entryId1) throws SystemException {
2969 for (AssetLink assetLink : findByE1(entryId1)) {
2970 remove(assetLink);
2971 }
2972 }
2973
2974
2980 public void removeByE2(long entryId2) throws SystemException {
2981 for (AssetLink assetLink : findByE2(entryId2)) {
2982 remove(assetLink);
2983 }
2984 }
2985
2986
2993 public void removeByE_E(long entryId1, long entryId2)
2994 throws SystemException {
2995 for (AssetLink assetLink : findByE_E(entryId1, entryId2)) {
2996 remove(assetLink);
2997 }
2998 }
2999
3000
3007 public void removeByE1_T(long entryId1, int type) throws SystemException {
3008 for (AssetLink assetLink : findByE1_T(entryId1, type)) {
3009 remove(assetLink);
3010 }
3011 }
3012
3013
3020 public void removeByE2_T(long entryId2, int type) throws SystemException {
3021 for (AssetLink assetLink : findByE2_T(entryId2, type)) {
3022 remove(assetLink);
3023 }
3024 }
3025
3026
3035 public AssetLink removeByE_E_T(long entryId1, long entryId2, int type)
3036 throws NoSuchLinkException, SystemException {
3037 AssetLink assetLink = findByE_E_T(entryId1, entryId2, type);
3038
3039 return remove(assetLink);
3040 }
3041
3042
3047 public void removeAll() throws SystemException {
3048 for (AssetLink assetLink : findAll()) {
3049 remove(assetLink);
3050 }
3051 }
3052
3053
3060 public int countByE1(long entryId1) throws SystemException {
3061 Object[] finderArgs = new Object[] { entryId1 };
3062
3063 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_E1,
3064 finderArgs, this);
3065
3066 if (count == null) {
3067 StringBundler query = new StringBundler(2);
3068
3069 query.append(_SQL_COUNT_ASSETLINK_WHERE);
3070
3071 query.append(_FINDER_COLUMN_E1_ENTRYID1_2);
3072
3073 String sql = query.toString();
3074
3075 Session session = null;
3076
3077 try {
3078 session = openSession();
3079
3080 Query q = session.createQuery(sql);
3081
3082 QueryPos qPos = QueryPos.getInstance(q);
3083
3084 qPos.add(entryId1);
3085
3086 count = (Long)q.uniqueResult();
3087 }
3088 catch (Exception e) {
3089 throw processException(e);
3090 }
3091 finally {
3092 if (count == null) {
3093 count = Long.valueOf(0);
3094 }
3095
3096 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_E1, finderArgs,
3097 count);
3098
3099 closeSession(session);
3100 }
3101 }
3102
3103 return count.intValue();
3104 }
3105
3106
3113 public int countByE2(long entryId2) throws SystemException {
3114 Object[] finderArgs = new Object[] { entryId2 };
3115
3116 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_E2,
3117 finderArgs, this);
3118
3119 if (count == null) {
3120 StringBundler query = new StringBundler(2);
3121
3122 query.append(_SQL_COUNT_ASSETLINK_WHERE);
3123
3124 query.append(_FINDER_COLUMN_E2_ENTRYID2_2);
3125
3126 String sql = query.toString();
3127
3128 Session session = null;
3129
3130 try {
3131 session = openSession();
3132
3133 Query q = session.createQuery(sql);
3134
3135 QueryPos qPos = QueryPos.getInstance(q);
3136
3137 qPos.add(entryId2);
3138
3139 count = (Long)q.uniqueResult();
3140 }
3141 catch (Exception e) {
3142 throw processException(e);
3143 }
3144 finally {
3145 if (count == null) {
3146 count = Long.valueOf(0);
3147 }
3148
3149 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_E2, finderArgs,
3150 count);
3151
3152 closeSession(session);
3153 }
3154 }
3155
3156 return count.intValue();
3157 }
3158
3159
3167 public int countByE_E(long entryId1, long entryId2)
3168 throws SystemException {
3169 Object[] finderArgs = new Object[] { entryId1, entryId2 };
3170
3171 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_E_E,
3172 finderArgs, this);
3173
3174 if (count == null) {
3175 StringBundler query = new StringBundler(3);
3176
3177 query.append(_SQL_COUNT_ASSETLINK_WHERE);
3178
3179 query.append(_FINDER_COLUMN_E_E_ENTRYID1_2);
3180
3181 query.append(_FINDER_COLUMN_E_E_ENTRYID2_2);
3182
3183 String sql = query.toString();
3184
3185 Session session = null;
3186
3187 try {
3188 session = openSession();
3189
3190 Query q = session.createQuery(sql);
3191
3192 QueryPos qPos = QueryPos.getInstance(q);
3193
3194 qPos.add(entryId1);
3195
3196 qPos.add(entryId2);
3197
3198 count = (Long)q.uniqueResult();
3199 }
3200 catch (Exception e) {
3201 throw processException(e);
3202 }
3203 finally {
3204 if (count == null) {
3205 count = Long.valueOf(0);
3206 }
3207
3208 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_E_E, finderArgs,
3209 count);
3210
3211 closeSession(session);
3212 }
3213 }
3214
3215 return count.intValue();
3216 }
3217
3218
3226 public int countByE1_T(long entryId1, int type) throws SystemException {
3227 Object[] finderArgs = new Object[] { entryId1, type };
3228
3229 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_E1_T,
3230 finderArgs, this);
3231
3232 if (count == null) {
3233 StringBundler query = new StringBundler(3);
3234
3235 query.append(_SQL_COUNT_ASSETLINK_WHERE);
3236
3237 query.append(_FINDER_COLUMN_E1_T_ENTRYID1_2);
3238
3239 query.append(_FINDER_COLUMN_E1_T_TYPE_2);
3240
3241 String sql = query.toString();
3242
3243 Session session = null;
3244
3245 try {
3246 session = openSession();
3247
3248 Query q = session.createQuery(sql);
3249
3250 QueryPos qPos = QueryPos.getInstance(q);
3251
3252 qPos.add(entryId1);
3253
3254 qPos.add(type);
3255
3256 count = (Long)q.uniqueResult();
3257 }
3258 catch (Exception e) {
3259 throw processException(e);
3260 }
3261 finally {
3262 if (count == null) {
3263 count = Long.valueOf(0);
3264 }
3265
3266 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_E1_T,
3267 finderArgs, count);
3268
3269 closeSession(session);
3270 }
3271 }
3272
3273 return count.intValue();
3274 }
3275
3276
3284 public int countByE2_T(long entryId2, int type) throws SystemException {
3285 Object[] finderArgs = new Object[] { entryId2, type };
3286
3287 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_E2_T,
3288 finderArgs, this);
3289
3290 if (count == null) {
3291 StringBundler query = new StringBundler(3);
3292
3293 query.append(_SQL_COUNT_ASSETLINK_WHERE);
3294
3295 query.append(_FINDER_COLUMN_E2_T_ENTRYID2_2);
3296
3297 query.append(_FINDER_COLUMN_E2_T_TYPE_2);
3298
3299 String sql = query.toString();
3300
3301 Session session = null;
3302
3303 try {
3304 session = openSession();
3305
3306 Query q = session.createQuery(sql);
3307
3308 QueryPos qPos = QueryPos.getInstance(q);
3309
3310 qPos.add(entryId2);
3311
3312 qPos.add(type);
3313
3314 count = (Long)q.uniqueResult();
3315 }
3316 catch (Exception e) {
3317 throw processException(e);
3318 }
3319 finally {
3320 if (count == null) {
3321 count = Long.valueOf(0);
3322 }
3323
3324 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_E2_T,
3325 finderArgs, count);
3326
3327 closeSession(session);
3328 }
3329 }
3330
3331 return count.intValue();
3332 }
3333
3334
3343 public int countByE_E_T(long entryId1, long entryId2, int type)
3344 throws SystemException {
3345 Object[] finderArgs = new Object[] { entryId1, entryId2, type };
3346
3347 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_E_E_T,
3348 finderArgs, this);
3349
3350 if (count == null) {
3351 StringBundler query = new StringBundler(4);
3352
3353 query.append(_SQL_COUNT_ASSETLINK_WHERE);
3354
3355 query.append(_FINDER_COLUMN_E_E_T_ENTRYID1_2);
3356
3357 query.append(_FINDER_COLUMN_E_E_T_ENTRYID2_2);
3358
3359 query.append(_FINDER_COLUMN_E_E_T_TYPE_2);
3360
3361 String sql = query.toString();
3362
3363 Session session = null;
3364
3365 try {
3366 session = openSession();
3367
3368 Query q = session.createQuery(sql);
3369
3370 QueryPos qPos = QueryPos.getInstance(q);
3371
3372 qPos.add(entryId1);
3373
3374 qPos.add(entryId2);
3375
3376 qPos.add(type);
3377
3378 count = (Long)q.uniqueResult();
3379 }
3380 catch (Exception e) {
3381 throw processException(e);
3382 }
3383 finally {
3384 if (count == null) {
3385 count = Long.valueOf(0);
3386 }
3387
3388 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_E_E_T,
3389 finderArgs, count);
3390
3391 closeSession(session);
3392 }
3393 }
3394
3395 return count.intValue();
3396 }
3397
3398
3404 public int countAll() throws SystemException {
3405 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3406 FINDER_ARGS_EMPTY, this);
3407
3408 if (count == null) {
3409 Session session = null;
3410
3411 try {
3412 session = openSession();
3413
3414 Query q = session.createQuery(_SQL_COUNT_ASSETLINK);
3415
3416 count = (Long)q.uniqueResult();
3417 }
3418 catch (Exception e) {
3419 throw processException(e);
3420 }
3421 finally {
3422 if (count == null) {
3423 count = Long.valueOf(0);
3424 }
3425
3426 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
3427 FINDER_ARGS_EMPTY, count);
3428
3429 closeSession(session);
3430 }
3431 }
3432
3433 return count.intValue();
3434 }
3435
3436
3439 public void afterPropertiesSet() {
3440 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3441 com.liferay.portal.util.PropsUtil.get(
3442 "value.object.listener.com.liferay.portlet.asset.model.AssetLink")));
3443
3444 if (listenerClassNames.length > 0) {
3445 try {
3446 List<ModelListener<AssetLink>> listenersList = new ArrayList<ModelListener<AssetLink>>();
3447
3448 for (String listenerClassName : listenerClassNames) {
3449 Class<?> clazz = getClass();
3450
3451 listenersList.add((ModelListener<AssetLink>)InstanceFactory.newInstance(
3452 clazz.getClassLoader(), listenerClassName));
3453 }
3454
3455 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3456 }
3457 catch (Exception e) {
3458 _log.error(e);
3459 }
3460 }
3461 }
3462
3463 public void destroy() {
3464 EntityCacheUtil.removeCache(AssetLinkImpl.class.getName());
3465 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3466 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
3467 }
3468
3469 @BeanReference(type = AssetCategoryPersistence.class)
3470 protected AssetCategoryPersistence assetCategoryPersistence;
3471 @BeanReference(type = AssetCategoryPropertyPersistence.class)
3472 protected AssetCategoryPropertyPersistence assetCategoryPropertyPersistence;
3473 @BeanReference(type = AssetEntryPersistence.class)
3474 protected AssetEntryPersistence assetEntryPersistence;
3475 @BeanReference(type = AssetLinkPersistence.class)
3476 protected AssetLinkPersistence assetLinkPersistence;
3477 @BeanReference(type = AssetTagPersistence.class)
3478 protected AssetTagPersistence assetTagPersistence;
3479 @BeanReference(type = AssetTagPropertyPersistence.class)
3480 protected AssetTagPropertyPersistence assetTagPropertyPersistence;
3481 @BeanReference(type = AssetTagStatsPersistence.class)
3482 protected AssetTagStatsPersistence assetTagStatsPersistence;
3483 @BeanReference(type = AssetVocabularyPersistence.class)
3484 protected AssetVocabularyPersistence assetVocabularyPersistence;
3485 @BeanReference(type = ResourcePersistence.class)
3486 protected ResourcePersistence resourcePersistence;
3487 @BeanReference(type = UserPersistence.class)
3488 protected UserPersistence userPersistence;
3489 private static final String _SQL_SELECT_ASSETLINK = "SELECT assetLink FROM AssetLink assetLink";
3490 private static final String _SQL_SELECT_ASSETLINK_WHERE = "SELECT assetLink FROM AssetLink assetLink WHERE ";
3491 private static final String _SQL_COUNT_ASSETLINK = "SELECT COUNT(assetLink) FROM AssetLink assetLink";
3492 private static final String _SQL_COUNT_ASSETLINK_WHERE = "SELECT COUNT(assetLink) FROM AssetLink assetLink WHERE ";
3493 private static final String _FINDER_COLUMN_E1_ENTRYID1_2 = "assetLink.entryId1 = ?";
3494 private static final String _FINDER_COLUMN_E2_ENTRYID2_2 = "assetLink.entryId2 = ?";
3495 private static final String _FINDER_COLUMN_E_E_ENTRYID1_2 = "assetLink.entryId1 = ? AND ";
3496 private static final String _FINDER_COLUMN_E_E_ENTRYID2_2 = "assetLink.entryId2 = ?";
3497 private static final String _FINDER_COLUMN_E1_T_ENTRYID1_2 = "assetLink.entryId1 = ? AND ";
3498 private static final String _FINDER_COLUMN_E1_T_TYPE_2 = "assetLink.type = ?";
3499 private static final String _FINDER_COLUMN_E2_T_ENTRYID2_2 = "assetLink.entryId2 = ? AND ";
3500 private static final String _FINDER_COLUMN_E2_T_TYPE_2 = "assetLink.type = ?";
3501 private static final String _FINDER_COLUMN_E_E_T_ENTRYID1_2 = "assetLink.entryId1 = ? AND ";
3502 private static final String _FINDER_COLUMN_E_E_T_ENTRYID2_2 = "assetLink.entryId2 = ? AND ";
3503 private static final String _FINDER_COLUMN_E_E_T_TYPE_2 = "assetLink.type = ?";
3504 private static final String _ORDER_BY_ENTITY_ALIAS = "assetLink.";
3505 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No AssetLink exists with the primary key ";
3506 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No AssetLink exists with the key {";
3507 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
3508 private static Log _log = LogFactoryUtil.getLog(AssetLinkPersistenceImpl.class);
3509 private static AssetLink _nullAssetLink = new AssetLinkImpl() {
3510 @Override
3511 public Object clone() {
3512 return this;
3513 }
3514
3515 @Override
3516 public CacheModel<AssetLink> toCacheModel() {
3517 return _nullAssetLinkCacheModel;
3518 }
3519 };
3520
3521 private static CacheModel<AssetLink> _nullAssetLinkCacheModel = new CacheModel<AssetLink>() {
3522 public AssetLink toEntityModel() {
3523 return _nullAssetLink;
3524 }
3525 };
3526 }