001
014
015 package com.liferay.portlet.expando.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.expando.NoSuchValueException;
044 import com.liferay.portlet.expando.model.ExpandoValue;
045 import com.liferay.portlet.expando.model.impl.ExpandoValueImpl;
046 import com.liferay.portlet.expando.model.impl.ExpandoValueModelImpl;
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 ExpandoValuePersistenceImpl extends BasePersistenceImpl<ExpandoValue>
067 implements ExpandoValuePersistence {
068
073 public static final String FINDER_CLASS_NAME_ENTITY = ExpandoValueImpl.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_TABLEID = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
079 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, ExpandoValueImpl.class,
080 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByTableId",
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_TABLEID =
088 new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
089 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, ExpandoValueImpl.class,
090 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByTableId",
091 new String[] { Long.class.getName() },
092 ExpandoValueModelImpl.TABLEID_COLUMN_BITMASK);
093 public static final FinderPath FINDER_PATH_COUNT_BY_TABLEID = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
094 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, Long.class,
095 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByTableId",
096 new String[] { Long.class.getName() });
097 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_COLUMNID = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
098 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, ExpandoValueImpl.class,
099 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByColumnId",
100 new String[] {
101 Long.class.getName(),
102
103 "java.lang.Integer", "java.lang.Integer",
104 "com.liferay.portal.kernel.util.OrderByComparator"
105 });
106 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COLUMNID =
107 new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
108 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, ExpandoValueImpl.class,
109 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByColumnId",
110 new String[] { Long.class.getName() },
111 ExpandoValueModelImpl.COLUMNID_COLUMN_BITMASK);
112 public static final FinderPath FINDER_PATH_COUNT_BY_COLUMNID = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
113 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, Long.class,
114 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByColumnId",
115 new String[] { Long.class.getName() });
116 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_ROWID = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
117 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, ExpandoValueImpl.class,
118 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByRowId",
119 new String[] {
120 Long.class.getName(),
121
122 "java.lang.Integer", "java.lang.Integer",
123 "com.liferay.portal.kernel.util.OrderByComparator"
124 });
125 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ROWID = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
126 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, ExpandoValueImpl.class,
127 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByRowId",
128 new String[] { Long.class.getName() },
129 ExpandoValueModelImpl.ROWID_COLUMN_BITMASK);
130 public static final FinderPath FINDER_PATH_COUNT_BY_ROWID = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
131 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, Long.class,
132 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByRowId",
133 new String[] { Long.class.getName() });
134 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_T_C = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
135 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, ExpandoValueImpl.class,
136 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByT_C",
137 new String[] {
138 Long.class.getName(), Long.class.getName(),
139
140 "java.lang.Integer", "java.lang.Integer",
141 "com.liferay.portal.kernel.util.OrderByComparator"
142 });
143 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_C = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
144 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, ExpandoValueImpl.class,
145 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByT_C",
146 new String[] { Long.class.getName(), Long.class.getName() },
147 ExpandoValueModelImpl.TABLEID_COLUMN_BITMASK |
148 ExpandoValueModelImpl.COLUMNID_COLUMN_BITMASK);
149 public static final FinderPath FINDER_PATH_COUNT_BY_T_C = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
150 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, Long.class,
151 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByT_C",
152 new String[] { Long.class.getName(), Long.class.getName() });
153 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_T_CPK = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
154 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, ExpandoValueImpl.class,
155 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByT_CPK",
156 new String[] {
157 Long.class.getName(), Long.class.getName(),
158
159 "java.lang.Integer", "java.lang.Integer",
160 "com.liferay.portal.kernel.util.OrderByComparator"
161 });
162 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_CPK = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
163 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, ExpandoValueImpl.class,
164 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByT_CPK",
165 new String[] { Long.class.getName(), Long.class.getName() },
166 ExpandoValueModelImpl.TABLEID_COLUMN_BITMASK |
167 ExpandoValueModelImpl.CLASSPK_COLUMN_BITMASK);
168 public static final FinderPath FINDER_PATH_COUNT_BY_T_CPK = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
169 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, Long.class,
170 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByT_CPK",
171 new String[] { Long.class.getName(), Long.class.getName() });
172 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_T_R = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
173 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, ExpandoValueImpl.class,
174 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByT_R",
175 new String[] {
176 Long.class.getName(), Long.class.getName(),
177
178 "java.lang.Integer", "java.lang.Integer",
179 "com.liferay.portal.kernel.util.OrderByComparator"
180 });
181 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_R = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
182 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, ExpandoValueImpl.class,
183 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByT_R",
184 new String[] { Long.class.getName(), Long.class.getName() },
185 ExpandoValueModelImpl.TABLEID_COLUMN_BITMASK |
186 ExpandoValueModelImpl.ROWID_COLUMN_BITMASK);
187 public static final FinderPath FINDER_PATH_COUNT_BY_T_R = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
188 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, Long.class,
189 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByT_R",
190 new String[] { Long.class.getName(), Long.class.getName() });
191 public static final FinderPath FINDER_PATH_FETCH_BY_C_R = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
192 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, ExpandoValueImpl.class,
193 FINDER_CLASS_NAME_ENTITY, "fetchByC_R",
194 new String[] { Long.class.getName(), Long.class.getName() },
195 ExpandoValueModelImpl.COLUMNID_COLUMN_BITMASK |
196 ExpandoValueModelImpl.ROWID_COLUMN_BITMASK);
197 public static final FinderPath FINDER_PATH_COUNT_BY_C_R = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
198 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, Long.class,
199 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_R",
200 new String[] { Long.class.getName(), Long.class.getName() });
201 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
202 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, ExpandoValueImpl.class,
203 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_C",
204 new String[] {
205 Long.class.getName(), Long.class.getName(),
206
207 "java.lang.Integer", "java.lang.Integer",
208 "com.liferay.portal.kernel.util.OrderByComparator"
209 });
210 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
211 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, ExpandoValueImpl.class,
212 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_C",
213 new String[] { Long.class.getName(), Long.class.getName() },
214 ExpandoValueModelImpl.CLASSNAMEID_COLUMN_BITMASK |
215 ExpandoValueModelImpl.CLASSPK_COLUMN_BITMASK);
216 public static final FinderPath FINDER_PATH_COUNT_BY_C_C = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
217 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, Long.class,
218 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_C",
219 new String[] { Long.class.getName(), Long.class.getName() });
220 public static final FinderPath FINDER_PATH_FETCH_BY_T_C_C = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
221 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, ExpandoValueImpl.class,
222 FINDER_CLASS_NAME_ENTITY, "fetchByT_C_C",
223 new String[] {
224 Long.class.getName(), Long.class.getName(), Long.class.getName()
225 },
226 ExpandoValueModelImpl.TABLEID_COLUMN_BITMASK |
227 ExpandoValueModelImpl.COLUMNID_COLUMN_BITMASK |
228 ExpandoValueModelImpl.CLASSPK_COLUMN_BITMASK);
229 public static final FinderPath FINDER_PATH_COUNT_BY_T_C_C = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
230 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, Long.class,
231 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByT_C_C",
232 new String[] {
233 Long.class.getName(), Long.class.getName(), Long.class.getName()
234 });
235 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_T_C_D = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
236 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, ExpandoValueImpl.class,
237 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByT_C_D",
238 new String[] {
239 Long.class.getName(), Long.class.getName(),
240 String.class.getName(),
241
242 "java.lang.Integer", "java.lang.Integer",
243 "com.liferay.portal.kernel.util.OrderByComparator"
244 });
245 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_C_D = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
246 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, ExpandoValueImpl.class,
247 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByT_C_D",
248 new String[] {
249 Long.class.getName(), Long.class.getName(),
250 String.class.getName()
251 },
252 ExpandoValueModelImpl.TABLEID_COLUMN_BITMASK |
253 ExpandoValueModelImpl.COLUMNID_COLUMN_BITMASK |
254 ExpandoValueModelImpl.DATA_COLUMN_BITMASK);
255 public static final FinderPath FINDER_PATH_COUNT_BY_T_C_D = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
256 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, Long.class,
257 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByT_C_D",
258 new String[] {
259 Long.class.getName(), Long.class.getName(),
260 String.class.getName()
261 });
262 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
263 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, ExpandoValueImpl.class,
264 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
265 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
266 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, ExpandoValueImpl.class,
267 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
268 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
269 ExpandoValueModelImpl.FINDER_CACHE_ENABLED, Long.class,
270 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
271
272
277 public void cacheResult(ExpandoValue expandoValue) {
278 EntityCacheUtil.putResult(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
279 ExpandoValueImpl.class, expandoValue.getPrimaryKey(), expandoValue);
280
281 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_R,
282 new Object[] {
283 Long.valueOf(expandoValue.getColumnId()),
284 Long.valueOf(expandoValue.getRowId())
285 }, expandoValue);
286
287 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_C_C,
288 new Object[] {
289 Long.valueOf(expandoValue.getTableId()),
290 Long.valueOf(expandoValue.getColumnId()),
291 Long.valueOf(expandoValue.getClassPK())
292 }, expandoValue);
293
294 expandoValue.resetOriginalValues();
295 }
296
297
302 public void cacheResult(List<ExpandoValue> expandoValues) {
303 for (ExpandoValue expandoValue : expandoValues) {
304 if (EntityCacheUtil.getResult(
305 ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
306 ExpandoValueImpl.class, expandoValue.getPrimaryKey()) == null) {
307 cacheResult(expandoValue);
308 }
309 else {
310 expandoValue.resetOriginalValues();
311 }
312 }
313 }
314
315
322 @Override
323 public void clearCache() {
324 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
325 CacheRegistryUtil.clear(ExpandoValueImpl.class.getName());
326 }
327
328 EntityCacheUtil.clearCache(ExpandoValueImpl.class.getName());
329
330 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
331 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
332 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
333 }
334
335
342 @Override
343 public void clearCache(ExpandoValue expandoValue) {
344 EntityCacheUtil.removeResult(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
345 ExpandoValueImpl.class, expandoValue.getPrimaryKey());
346
347 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
348 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
349
350 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_R,
351 new Object[] {
352 Long.valueOf(expandoValue.getColumnId()),
353 Long.valueOf(expandoValue.getRowId())
354 });
355
356 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_T_C_C,
357 new Object[] {
358 Long.valueOf(expandoValue.getTableId()),
359 Long.valueOf(expandoValue.getColumnId()),
360 Long.valueOf(expandoValue.getClassPK())
361 });
362 }
363
364
370 public ExpandoValue create(long valueId) {
371 ExpandoValue expandoValue = new ExpandoValueImpl();
372
373 expandoValue.setNew(true);
374 expandoValue.setPrimaryKey(valueId);
375
376 return expandoValue;
377 }
378
379
387 @Override
388 public ExpandoValue remove(Serializable primaryKey)
389 throws NoSuchModelException, SystemException {
390 return remove(((Long)primaryKey).longValue());
391 }
392
393
401 public ExpandoValue remove(long valueId)
402 throws NoSuchValueException, SystemException {
403 Session session = null;
404
405 try {
406 session = openSession();
407
408 ExpandoValue expandoValue = (ExpandoValue)session.get(ExpandoValueImpl.class,
409 Long.valueOf(valueId));
410
411 if (expandoValue == null) {
412 if (_log.isWarnEnabled()) {
413 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + valueId);
414 }
415
416 throw new NoSuchValueException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
417 valueId);
418 }
419
420 return expandoValuePersistence.remove(expandoValue);
421 }
422 catch (NoSuchValueException nsee) {
423 throw nsee;
424 }
425 catch (Exception e) {
426 throw processException(e);
427 }
428 finally {
429 closeSession(session);
430 }
431 }
432
433
440 @Override
441 public ExpandoValue remove(ExpandoValue expandoValue)
442 throws SystemException {
443 return super.remove(expandoValue);
444 }
445
446 @Override
447 protected ExpandoValue removeImpl(ExpandoValue expandoValue)
448 throws SystemException {
449 expandoValue = toUnwrappedModel(expandoValue);
450
451 Session session = null;
452
453 try {
454 session = openSession();
455
456 BatchSessionUtil.delete(session, expandoValue);
457 }
458 catch (Exception e) {
459 throw processException(e);
460 }
461 finally {
462 closeSession(session);
463 }
464
465 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
466 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
467
468 ExpandoValueModelImpl expandoValueModelImpl = (ExpandoValueModelImpl)expandoValue;
469
470 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_R,
471 new Object[] {
472 Long.valueOf(expandoValueModelImpl.getColumnId()),
473 Long.valueOf(expandoValueModelImpl.getRowId())
474 });
475
476 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_T_C_C,
477 new Object[] {
478 Long.valueOf(expandoValueModelImpl.getTableId()),
479 Long.valueOf(expandoValueModelImpl.getColumnId()),
480 Long.valueOf(expandoValueModelImpl.getClassPK())
481 });
482
483 EntityCacheUtil.removeResult(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
484 ExpandoValueImpl.class, expandoValue.getPrimaryKey());
485
486 return expandoValue;
487 }
488
489 @Override
490 public ExpandoValue updateImpl(
491 com.liferay.portlet.expando.model.ExpandoValue expandoValue,
492 boolean merge) throws SystemException {
493 expandoValue = toUnwrappedModel(expandoValue);
494
495 boolean isNew = expandoValue.isNew();
496
497 ExpandoValueModelImpl expandoValueModelImpl = (ExpandoValueModelImpl)expandoValue;
498
499 Session session = null;
500
501 try {
502 session = openSession();
503
504 BatchSessionUtil.update(session, expandoValue, merge);
505
506 expandoValue.setNew(false);
507 }
508 catch (Exception e) {
509 throw processException(e);
510 }
511 finally {
512 closeSession(session);
513 }
514
515 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
516
517 if (isNew || !ExpandoValueModelImpl.COLUMN_BITMASK_ENABLED) {
518 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
519 }
520
521 else {
522 if ((expandoValueModelImpl.getColumnBitmask() &
523 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TABLEID.getColumnBitmask()) != 0) {
524 Object[] args = new Object[] {
525 Long.valueOf(expandoValueModelImpl.getOriginalTableId())
526 };
527
528 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TABLEID, args);
529 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TABLEID,
530 args);
531
532 args = new Object[] {
533 Long.valueOf(expandoValueModelImpl.getTableId())
534 };
535
536 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TABLEID, args);
537 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TABLEID,
538 args);
539 }
540
541 if ((expandoValueModelImpl.getColumnBitmask() &
542 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COLUMNID.getColumnBitmask()) != 0) {
543 Object[] args = new Object[] {
544 Long.valueOf(expandoValueModelImpl.getOriginalColumnId())
545 };
546
547 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COLUMNID, args);
548 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COLUMNID,
549 args);
550
551 args = new Object[] {
552 Long.valueOf(expandoValueModelImpl.getColumnId())
553 };
554
555 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COLUMNID, args);
556 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COLUMNID,
557 args);
558 }
559
560 if ((expandoValueModelImpl.getColumnBitmask() &
561 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ROWID.getColumnBitmask()) != 0) {
562 Object[] args = new Object[] {
563 Long.valueOf(expandoValueModelImpl.getOriginalRowId())
564 };
565
566 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ROWID, args);
567 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ROWID,
568 args);
569
570 args = new Object[] {
571 Long.valueOf(expandoValueModelImpl.getRowId())
572 };
573
574 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ROWID, args);
575 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ROWID,
576 args);
577 }
578
579 if ((expandoValueModelImpl.getColumnBitmask() &
580 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_C.getColumnBitmask()) != 0) {
581 Object[] args = new Object[] {
582 Long.valueOf(expandoValueModelImpl.getOriginalTableId()),
583 Long.valueOf(expandoValueModelImpl.getOriginalColumnId())
584 };
585
586 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_T_C, args);
587 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_C,
588 args);
589
590 args = new Object[] {
591 Long.valueOf(expandoValueModelImpl.getTableId()),
592 Long.valueOf(expandoValueModelImpl.getColumnId())
593 };
594
595 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_T_C, args);
596 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_C,
597 args);
598 }
599
600 if ((expandoValueModelImpl.getColumnBitmask() &
601 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_CPK.getColumnBitmask()) != 0) {
602 Object[] args = new Object[] {
603 Long.valueOf(expandoValueModelImpl.getOriginalTableId()),
604 Long.valueOf(expandoValueModelImpl.getOriginalClassPK())
605 };
606
607 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_T_CPK, args);
608 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_CPK,
609 args);
610
611 args = new Object[] {
612 Long.valueOf(expandoValueModelImpl.getTableId()),
613 Long.valueOf(expandoValueModelImpl.getClassPK())
614 };
615
616 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_T_CPK, args);
617 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_CPK,
618 args);
619 }
620
621 if ((expandoValueModelImpl.getColumnBitmask() &
622 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_R.getColumnBitmask()) != 0) {
623 Object[] args = new Object[] {
624 Long.valueOf(expandoValueModelImpl.getOriginalTableId()),
625 Long.valueOf(expandoValueModelImpl.getOriginalRowId())
626 };
627
628 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_T_R, args);
629 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_R,
630 args);
631
632 args = new Object[] {
633 Long.valueOf(expandoValueModelImpl.getTableId()),
634 Long.valueOf(expandoValueModelImpl.getRowId())
635 };
636
637 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_T_R, args);
638 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_R,
639 args);
640 }
641
642 if ((expandoValueModelImpl.getColumnBitmask() &
643 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C.getColumnBitmask()) != 0) {
644 Object[] args = new Object[] {
645 Long.valueOf(expandoValueModelImpl.getOriginalClassNameId()),
646 Long.valueOf(expandoValueModelImpl.getOriginalClassPK())
647 };
648
649 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
650 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C,
651 args);
652
653 args = new Object[] {
654 Long.valueOf(expandoValueModelImpl.getClassNameId()),
655 Long.valueOf(expandoValueModelImpl.getClassPK())
656 };
657
658 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
659 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C,
660 args);
661 }
662
663 if ((expandoValueModelImpl.getColumnBitmask() &
664 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_C_D.getColumnBitmask()) != 0) {
665 Object[] args = new Object[] {
666 Long.valueOf(expandoValueModelImpl.getOriginalTableId()),
667 Long.valueOf(expandoValueModelImpl.getOriginalColumnId()),
668
669 expandoValueModelImpl.getOriginalData()
670 };
671
672 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_T_C_D, args);
673 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_C_D,
674 args);
675
676 args = new Object[] {
677 Long.valueOf(expandoValueModelImpl.getTableId()),
678 Long.valueOf(expandoValueModelImpl.getColumnId()),
679
680 expandoValueModelImpl.getData()
681 };
682
683 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_T_C_D, args);
684 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_C_D,
685 args);
686 }
687 }
688
689 EntityCacheUtil.putResult(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
690 ExpandoValueImpl.class, expandoValue.getPrimaryKey(), expandoValue);
691
692 if (isNew) {
693 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_R,
694 new Object[] {
695 Long.valueOf(expandoValue.getColumnId()),
696 Long.valueOf(expandoValue.getRowId())
697 }, expandoValue);
698
699 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_C_C,
700 new Object[] {
701 Long.valueOf(expandoValue.getTableId()),
702 Long.valueOf(expandoValue.getColumnId()),
703 Long.valueOf(expandoValue.getClassPK())
704 }, expandoValue);
705 }
706 else {
707 if ((expandoValueModelImpl.getColumnBitmask() &
708 FINDER_PATH_FETCH_BY_C_R.getColumnBitmask()) != 0) {
709 Object[] args = new Object[] {
710 Long.valueOf(expandoValueModelImpl.getOriginalColumnId()),
711 Long.valueOf(expandoValueModelImpl.getOriginalRowId())
712 };
713
714 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_R, args);
715 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_R, args);
716
717 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_R,
718 new Object[] {
719 Long.valueOf(expandoValue.getColumnId()),
720 Long.valueOf(expandoValue.getRowId())
721 }, expandoValue);
722 }
723
724 if ((expandoValueModelImpl.getColumnBitmask() &
725 FINDER_PATH_FETCH_BY_T_C_C.getColumnBitmask()) != 0) {
726 Object[] args = new Object[] {
727 Long.valueOf(expandoValueModelImpl.getOriginalTableId()),
728 Long.valueOf(expandoValueModelImpl.getOriginalColumnId()),
729 Long.valueOf(expandoValueModelImpl.getOriginalClassPK())
730 };
731
732 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_T_C_C, args);
733 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_T_C_C, args);
734
735 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_C_C,
736 new Object[] {
737 Long.valueOf(expandoValue.getTableId()),
738 Long.valueOf(expandoValue.getColumnId()),
739 Long.valueOf(expandoValue.getClassPK())
740 }, expandoValue);
741 }
742 }
743
744 return expandoValue;
745 }
746
747 protected ExpandoValue toUnwrappedModel(ExpandoValue expandoValue) {
748 if (expandoValue instanceof ExpandoValueImpl) {
749 return expandoValue;
750 }
751
752 ExpandoValueImpl expandoValueImpl = new ExpandoValueImpl();
753
754 expandoValueImpl.setNew(expandoValue.isNew());
755 expandoValueImpl.setPrimaryKey(expandoValue.getPrimaryKey());
756
757 expandoValueImpl.setValueId(expandoValue.getValueId());
758 expandoValueImpl.setCompanyId(expandoValue.getCompanyId());
759 expandoValueImpl.setTableId(expandoValue.getTableId());
760 expandoValueImpl.setColumnId(expandoValue.getColumnId());
761 expandoValueImpl.setRowId(expandoValue.getRowId());
762 expandoValueImpl.setClassNameId(expandoValue.getClassNameId());
763 expandoValueImpl.setClassPK(expandoValue.getClassPK());
764 expandoValueImpl.setData(expandoValue.getData());
765
766 return expandoValueImpl;
767 }
768
769
777 @Override
778 public ExpandoValue findByPrimaryKey(Serializable primaryKey)
779 throws NoSuchModelException, SystemException {
780 return findByPrimaryKey(((Long)primaryKey).longValue());
781 }
782
783
791 public ExpandoValue findByPrimaryKey(long valueId)
792 throws NoSuchValueException, SystemException {
793 ExpandoValue expandoValue = fetchByPrimaryKey(valueId);
794
795 if (expandoValue == null) {
796 if (_log.isWarnEnabled()) {
797 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + valueId);
798 }
799
800 throw new NoSuchValueException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
801 valueId);
802 }
803
804 return expandoValue;
805 }
806
807
814 @Override
815 public ExpandoValue fetchByPrimaryKey(Serializable primaryKey)
816 throws SystemException {
817 return fetchByPrimaryKey(((Long)primaryKey).longValue());
818 }
819
820
827 public ExpandoValue fetchByPrimaryKey(long valueId)
828 throws SystemException {
829 ExpandoValue expandoValue = (ExpandoValue)EntityCacheUtil.getResult(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
830 ExpandoValueImpl.class, valueId);
831
832 if (expandoValue == _nullExpandoValue) {
833 return null;
834 }
835
836 if (expandoValue == null) {
837 Session session = null;
838
839 boolean hasException = false;
840
841 try {
842 session = openSession();
843
844 expandoValue = (ExpandoValue)session.get(ExpandoValueImpl.class,
845 Long.valueOf(valueId));
846 }
847 catch (Exception e) {
848 hasException = true;
849
850 throw processException(e);
851 }
852 finally {
853 if (expandoValue != null) {
854 cacheResult(expandoValue);
855 }
856 else if (!hasException) {
857 EntityCacheUtil.putResult(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
858 ExpandoValueImpl.class, valueId, _nullExpandoValue);
859 }
860
861 closeSession(session);
862 }
863 }
864
865 return expandoValue;
866 }
867
868
875 public List<ExpandoValue> findByTableId(long tableId)
876 throws SystemException {
877 return findByTableId(tableId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
878 }
879
880
893 public List<ExpandoValue> findByTableId(long tableId, int start, int end)
894 throws SystemException {
895 return findByTableId(tableId, start, end, null);
896 }
897
898
912 public List<ExpandoValue> findByTableId(long tableId, int start, int end,
913 OrderByComparator orderByComparator) throws SystemException {
914 FinderPath finderPath = null;
915 Object[] finderArgs = null;
916
917 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
918 (orderByComparator == null)) {
919 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TABLEID;
920 finderArgs = new Object[] { tableId };
921 }
922 else {
923 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_TABLEID;
924 finderArgs = new Object[] { tableId, start, end, orderByComparator };
925 }
926
927 List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(finderPath,
928 finderArgs, this);
929
930 if (list == null) {
931 StringBundler query = null;
932
933 if (orderByComparator != null) {
934 query = new StringBundler(3 +
935 (orderByComparator.getOrderByFields().length * 3));
936 }
937 else {
938 query = new StringBundler(3);
939 }
940
941 query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
942
943 query.append(_FINDER_COLUMN_TABLEID_TABLEID_2);
944
945 if (orderByComparator != null) {
946 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
947 orderByComparator);
948 }
949
950 else {
951 query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
952 }
953
954 String sql = query.toString();
955
956 Session session = null;
957
958 try {
959 session = openSession();
960
961 Query q = session.createQuery(sql);
962
963 QueryPos qPos = QueryPos.getInstance(q);
964
965 qPos.add(tableId);
966
967 list = (List<ExpandoValue>)QueryUtil.list(q, getDialect(),
968 start, end);
969 }
970 catch (Exception e) {
971 throw processException(e);
972 }
973 finally {
974 if (list == null) {
975 FinderCacheUtil.removeResult(finderPath, finderArgs);
976 }
977 else {
978 cacheResult(list);
979
980 FinderCacheUtil.putResult(finderPath, finderArgs, list);
981 }
982
983 closeSession(session);
984 }
985 }
986
987 return list;
988 }
989
990
1003 public ExpandoValue findByTableId_First(long tableId,
1004 OrderByComparator orderByComparator)
1005 throws NoSuchValueException, SystemException {
1006 List<ExpandoValue> list = findByTableId(tableId, 0, 1, orderByComparator);
1007
1008 if (list.isEmpty()) {
1009 StringBundler msg = new StringBundler(4);
1010
1011 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1012
1013 msg.append("tableId=");
1014 msg.append(tableId);
1015
1016 msg.append(StringPool.CLOSE_CURLY_BRACE);
1017
1018 throw new NoSuchValueException(msg.toString());
1019 }
1020 else {
1021 return list.get(0);
1022 }
1023 }
1024
1025
1038 public ExpandoValue findByTableId_Last(long tableId,
1039 OrderByComparator orderByComparator)
1040 throws NoSuchValueException, SystemException {
1041 int count = countByTableId(tableId);
1042
1043 List<ExpandoValue> list = findByTableId(tableId, count - 1, count,
1044 orderByComparator);
1045
1046 if (list.isEmpty()) {
1047 StringBundler msg = new StringBundler(4);
1048
1049 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1050
1051 msg.append("tableId=");
1052 msg.append(tableId);
1053
1054 msg.append(StringPool.CLOSE_CURLY_BRACE);
1055
1056 throw new NoSuchValueException(msg.toString());
1057 }
1058 else {
1059 return list.get(0);
1060 }
1061 }
1062
1063
1077 public ExpandoValue[] findByTableId_PrevAndNext(long valueId, long tableId,
1078 OrderByComparator orderByComparator)
1079 throws NoSuchValueException, SystemException {
1080 ExpandoValue expandoValue = findByPrimaryKey(valueId);
1081
1082 Session session = null;
1083
1084 try {
1085 session = openSession();
1086
1087 ExpandoValue[] array = new ExpandoValueImpl[3];
1088
1089 array[0] = getByTableId_PrevAndNext(session, expandoValue, tableId,
1090 orderByComparator, true);
1091
1092 array[1] = expandoValue;
1093
1094 array[2] = getByTableId_PrevAndNext(session, expandoValue, tableId,
1095 orderByComparator, false);
1096
1097 return array;
1098 }
1099 catch (Exception e) {
1100 throw processException(e);
1101 }
1102 finally {
1103 closeSession(session);
1104 }
1105 }
1106
1107 protected ExpandoValue getByTableId_PrevAndNext(Session session,
1108 ExpandoValue expandoValue, long tableId,
1109 OrderByComparator orderByComparator, boolean previous) {
1110 StringBundler query = null;
1111
1112 if (orderByComparator != null) {
1113 query = new StringBundler(6 +
1114 (orderByComparator.getOrderByFields().length * 6));
1115 }
1116 else {
1117 query = new StringBundler(3);
1118 }
1119
1120 query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
1121
1122 query.append(_FINDER_COLUMN_TABLEID_TABLEID_2);
1123
1124 if (orderByComparator != null) {
1125 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1126
1127 if (orderByConditionFields.length > 0) {
1128 query.append(WHERE_AND);
1129 }
1130
1131 for (int i = 0; i < orderByConditionFields.length; i++) {
1132 query.append(_ORDER_BY_ENTITY_ALIAS);
1133 query.append(orderByConditionFields[i]);
1134
1135 if ((i + 1) < orderByConditionFields.length) {
1136 if (orderByComparator.isAscending() ^ previous) {
1137 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1138 }
1139 else {
1140 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1141 }
1142 }
1143 else {
1144 if (orderByComparator.isAscending() ^ previous) {
1145 query.append(WHERE_GREATER_THAN);
1146 }
1147 else {
1148 query.append(WHERE_LESSER_THAN);
1149 }
1150 }
1151 }
1152
1153 query.append(ORDER_BY_CLAUSE);
1154
1155 String[] orderByFields = orderByComparator.getOrderByFields();
1156
1157 for (int i = 0; i < orderByFields.length; i++) {
1158 query.append(_ORDER_BY_ENTITY_ALIAS);
1159 query.append(orderByFields[i]);
1160
1161 if ((i + 1) < orderByFields.length) {
1162 if (orderByComparator.isAscending() ^ previous) {
1163 query.append(ORDER_BY_ASC_HAS_NEXT);
1164 }
1165 else {
1166 query.append(ORDER_BY_DESC_HAS_NEXT);
1167 }
1168 }
1169 else {
1170 if (orderByComparator.isAscending() ^ previous) {
1171 query.append(ORDER_BY_ASC);
1172 }
1173 else {
1174 query.append(ORDER_BY_DESC);
1175 }
1176 }
1177 }
1178 }
1179
1180 else {
1181 query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
1182 }
1183
1184 String sql = query.toString();
1185
1186 Query q = session.createQuery(sql);
1187
1188 q.setFirstResult(0);
1189 q.setMaxResults(2);
1190
1191 QueryPos qPos = QueryPos.getInstance(q);
1192
1193 qPos.add(tableId);
1194
1195 if (orderByComparator != null) {
1196 Object[] values = orderByComparator.getOrderByConditionValues(expandoValue);
1197
1198 for (Object value : values) {
1199 qPos.add(value);
1200 }
1201 }
1202
1203 List<ExpandoValue> list = q.list();
1204
1205 if (list.size() == 2) {
1206 return list.get(1);
1207 }
1208 else {
1209 return null;
1210 }
1211 }
1212
1213
1220 public List<ExpandoValue> findByColumnId(long columnId)
1221 throws SystemException {
1222 return findByColumnId(columnId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1223 null);
1224 }
1225
1226
1239 public List<ExpandoValue> findByColumnId(long columnId, int start, int end)
1240 throws SystemException {
1241 return findByColumnId(columnId, start, end, null);
1242 }
1243
1244
1258 public List<ExpandoValue> findByColumnId(long columnId, int start, int end,
1259 OrderByComparator orderByComparator) throws SystemException {
1260 FinderPath finderPath = null;
1261 Object[] finderArgs = null;
1262
1263 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1264 (orderByComparator == null)) {
1265 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COLUMNID;
1266 finderArgs = new Object[] { columnId };
1267 }
1268 else {
1269 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_COLUMNID;
1270 finderArgs = new Object[] { columnId, start, end, orderByComparator };
1271 }
1272
1273 List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(finderPath,
1274 finderArgs, this);
1275
1276 if (list == null) {
1277 StringBundler query = null;
1278
1279 if (orderByComparator != null) {
1280 query = new StringBundler(3 +
1281 (orderByComparator.getOrderByFields().length * 3));
1282 }
1283 else {
1284 query = new StringBundler(3);
1285 }
1286
1287 query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
1288
1289 query.append(_FINDER_COLUMN_COLUMNID_COLUMNID_2);
1290
1291 if (orderByComparator != null) {
1292 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1293 orderByComparator);
1294 }
1295
1296 else {
1297 query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
1298 }
1299
1300 String sql = query.toString();
1301
1302 Session session = null;
1303
1304 try {
1305 session = openSession();
1306
1307 Query q = session.createQuery(sql);
1308
1309 QueryPos qPos = QueryPos.getInstance(q);
1310
1311 qPos.add(columnId);
1312
1313 list = (List<ExpandoValue>)QueryUtil.list(q, getDialect(),
1314 start, end);
1315 }
1316 catch (Exception e) {
1317 throw processException(e);
1318 }
1319 finally {
1320 if (list == null) {
1321 FinderCacheUtil.removeResult(finderPath, finderArgs);
1322 }
1323 else {
1324 cacheResult(list);
1325
1326 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1327 }
1328
1329 closeSession(session);
1330 }
1331 }
1332
1333 return list;
1334 }
1335
1336
1349 public ExpandoValue findByColumnId_First(long columnId,
1350 OrderByComparator orderByComparator)
1351 throws NoSuchValueException, SystemException {
1352 List<ExpandoValue> list = findByColumnId(columnId, 0, 1,
1353 orderByComparator);
1354
1355 if (list.isEmpty()) {
1356 StringBundler msg = new StringBundler(4);
1357
1358 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1359
1360 msg.append("columnId=");
1361 msg.append(columnId);
1362
1363 msg.append(StringPool.CLOSE_CURLY_BRACE);
1364
1365 throw new NoSuchValueException(msg.toString());
1366 }
1367 else {
1368 return list.get(0);
1369 }
1370 }
1371
1372
1385 public ExpandoValue findByColumnId_Last(long columnId,
1386 OrderByComparator orderByComparator)
1387 throws NoSuchValueException, SystemException {
1388 int count = countByColumnId(columnId);
1389
1390 List<ExpandoValue> list = findByColumnId(columnId, count - 1, count,
1391 orderByComparator);
1392
1393 if (list.isEmpty()) {
1394 StringBundler msg = new StringBundler(4);
1395
1396 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1397
1398 msg.append("columnId=");
1399 msg.append(columnId);
1400
1401 msg.append(StringPool.CLOSE_CURLY_BRACE);
1402
1403 throw new NoSuchValueException(msg.toString());
1404 }
1405 else {
1406 return list.get(0);
1407 }
1408 }
1409
1410
1424 public ExpandoValue[] findByColumnId_PrevAndNext(long valueId,
1425 long columnId, OrderByComparator orderByComparator)
1426 throws NoSuchValueException, SystemException {
1427 ExpandoValue expandoValue = findByPrimaryKey(valueId);
1428
1429 Session session = null;
1430
1431 try {
1432 session = openSession();
1433
1434 ExpandoValue[] array = new ExpandoValueImpl[3];
1435
1436 array[0] = getByColumnId_PrevAndNext(session, expandoValue,
1437 columnId, orderByComparator, true);
1438
1439 array[1] = expandoValue;
1440
1441 array[2] = getByColumnId_PrevAndNext(session, expandoValue,
1442 columnId, orderByComparator, false);
1443
1444 return array;
1445 }
1446 catch (Exception e) {
1447 throw processException(e);
1448 }
1449 finally {
1450 closeSession(session);
1451 }
1452 }
1453
1454 protected ExpandoValue getByColumnId_PrevAndNext(Session session,
1455 ExpandoValue expandoValue, long columnId,
1456 OrderByComparator orderByComparator, boolean previous) {
1457 StringBundler query = null;
1458
1459 if (orderByComparator != null) {
1460 query = new StringBundler(6 +
1461 (orderByComparator.getOrderByFields().length * 6));
1462 }
1463 else {
1464 query = new StringBundler(3);
1465 }
1466
1467 query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
1468
1469 query.append(_FINDER_COLUMN_COLUMNID_COLUMNID_2);
1470
1471 if (orderByComparator != null) {
1472 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1473
1474 if (orderByConditionFields.length > 0) {
1475 query.append(WHERE_AND);
1476 }
1477
1478 for (int i = 0; i < orderByConditionFields.length; i++) {
1479 query.append(_ORDER_BY_ENTITY_ALIAS);
1480 query.append(orderByConditionFields[i]);
1481
1482 if ((i + 1) < orderByConditionFields.length) {
1483 if (orderByComparator.isAscending() ^ previous) {
1484 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1485 }
1486 else {
1487 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1488 }
1489 }
1490 else {
1491 if (orderByComparator.isAscending() ^ previous) {
1492 query.append(WHERE_GREATER_THAN);
1493 }
1494 else {
1495 query.append(WHERE_LESSER_THAN);
1496 }
1497 }
1498 }
1499
1500 query.append(ORDER_BY_CLAUSE);
1501
1502 String[] orderByFields = orderByComparator.getOrderByFields();
1503
1504 for (int i = 0; i < orderByFields.length; i++) {
1505 query.append(_ORDER_BY_ENTITY_ALIAS);
1506 query.append(orderByFields[i]);
1507
1508 if ((i + 1) < orderByFields.length) {
1509 if (orderByComparator.isAscending() ^ previous) {
1510 query.append(ORDER_BY_ASC_HAS_NEXT);
1511 }
1512 else {
1513 query.append(ORDER_BY_DESC_HAS_NEXT);
1514 }
1515 }
1516 else {
1517 if (orderByComparator.isAscending() ^ previous) {
1518 query.append(ORDER_BY_ASC);
1519 }
1520 else {
1521 query.append(ORDER_BY_DESC);
1522 }
1523 }
1524 }
1525 }
1526
1527 else {
1528 query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
1529 }
1530
1531 String sql = query.toString();
1532
1533 Query q = session.createQuery(sql);
1534
1535 q.setFirstResult(0);
1536 q.setMaxResults(2);
1537
1538 QueryPos qPos = QueryPos.getInstance(q);
1539
1540 qPos.add(columnId);
1541
1542 if (orderByComparator != null) {
1543 Object[] values = orderByComparator.getOrderByConditionValues(expandoValue);
1544
1545 for (Object value : values) {
1546 qPos.add(value);
1547 }
1548 }
1549
1550 List<ExpandoValue> list = q.list();
1551
1552 if (list.size() == 2) {
1553 return list.get(1);
1554 }
1555 else {
1556 return null;
1557 }
1558 }
1559
1560
1567 public List<ExpandoValue> findByRowId(long rowId) throws SystemException {
1568 return findByRowId(rowId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1569 }
1570
1571
1584 public List<ExpandoValue> findByRowId(long rowId, int start, int end)
1585 throws SystemException {
1586 return findByRowId(rowId, start, end, null);
1587 }
1588
1589
1603 public List<ExpandoValue> findByRowId(long rowId, int start, int end,
1604 OrderByComparator orderByComparator) throws SystemException {
1605 FinderPath finderPath = null;
1606 Object[] finderArgs = null;
1607
1608 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1609 (orderByComparator == null)) {
1610 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ROWID;
1611 finderArgs = new Object[] { rowId };
1612 }
1613 else {
1614 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_ROWID;
1615 finderArgs = new Object[] { rowId, start, end, orderByComparator };
1616 }
1617
1618 List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(finderPath,
1619 finderArgs, this);
1620
1621 if (list == null) {
1622 StringBundler query = null;
1623
1624 if (orderByComparator != null) {
1625 query = new StringBundler(3 +
1626 (orderByComparator.getOrderByFields().length * 3));
1627 }
1628 else {
1629 query = new StringBundler(3);
1630 }
1631
1632 query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
1633
1634 query.append(_FINDER_COLUMN_ROWID_ROWID_2);
1635
1636 if (orderByComparator != null) {
1637 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1638 orderByComparator);
1639 }
1640
1641 else {
1642 query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
1643 }
1644
1645 String sql = query.toString();
1646
1647 Session session = null;
1648
1649 try {
1650 session = openSession();
1651
1652 Query q = session.createQuery(sql);
1653
1654 QueryPos qPos = QueryPos.getInstance(q);
1655
1656 qPos.add(rowId);
1657
1658 list = (List<ExpandoValue>)QueryUtil.list(q, getDialect(),
1659 start, end);
1660 }
1661 catch (Exception e) {
1662 throw processException(e);
1663 }
1664 finally {
1665 if (list == null) {
1666 FinderCacheUtil.removeResult(finderPath, finderArgs);
1667 }
1668 else {
1669 cacheResult(list);
1670
1671 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1672 }
1673
1674 closeSession(session);
1675 }
1676 }
1677
1678 return list;
1679 }
1680
1681
1694 public ExpandoValue findByRowId_First(long rowId,
1695 OrderByComparator orderByComparator)
1696 throws NoSuchValueException, SystemException {
1697 List<ExpandoValue> list = findByRowId(rowId, 0, 1, orderByComparator);
1698
1699 if (list.isEmpty()) {
1700 StringBundler msg = new StringBundler(4);
1701
1702 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1703
1704 msg.append("rowId=");
1705 msg.append(rowId);
1706
1707 msg.append(StringPool.CLOSE_CURLY_BRACE);
1708
1709 throw new NoSuchValueException(msg.toString());
1710 }
1711 else {
1712 return list.get(0);
1713 }
1714 }
1715
1716
1729 public ExpandoValue findByRowId_Last(long rowId,
1730 OrderByComparator orderByComparator)
1731 throws NoSuchValueException, SystemException {
1732 int count = countByRowId(rowId);
1733
1734 List<ExpandoValue> list = findByRowId(rowId, count - 1, count,
1735 orderByComparator);
1736
1737 if (list.isEmpty()) {
1738 StringBundler msg = new StringBundler(4);
1739
1740 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1741
1742 msg.append("rowId=");
1743 msg.append(rowId);
1744
1745 msg.append(StringPool.CLOSE_CURLY_BRACE);
1746
1747 throw new NoSuchValueException(msg.toString());
1748 }
1749 else {
1750 return list.get(0);
1751 }
1752 }
1753
1754
1768 public ExpandoValue[] findByRowId_PrevAndNext(long valueId, long rowId,
1769 OrderByComparator orderByComparator)
1770 throws NoSuchValueException, SystemException {
1771 ExpandoValue expandoValue = findByPrimaryKey(valueId);
1772
1773 Session session = null;
1774
1775 try {
1776 session = openSession();
1777
1778 ExpandoValue[] array = new ExpandoValueImpl[3];
1779
1780 array[0] = getByRowId_PrevAndNext(session, expandoValue, rowId,
1781 orderByComparator, true);
1782
1783 array[1] = expandoValue;
1784
1785 array[2] = getByRowId_PrevAndNext(session, expandoValue, rowId,
1786 orderByComparator, false);
1787
1788 return array;
1789 }
1790 catch (Exception e) {
1791 throw processException(e);
1792 }
1793 finally {
1794 closeSession(session);
1795 }
1796 }
1797
1798 protected ExpandoValue getByRowId_PrevAndNext(Session session,
1799 ExpandoValue expandoValue, long rowId,
1800 OrderByComparator orderByComparator, boolean previous) {
1801 StringBundler query = null;
1802
1803 if (orderByComparator != null) {
1804 query = new StringBundler(6 +
1805 (orderByComparator.getOrderByFields().length * 6));
1806 }
1807 else {
1808 query = new StringBundler(3);
1809 }
1810
1811 query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
1812
1813 query.append(_FINDER_COLUMN_ROWID_ROWID_2);
1814
1815 if (orderByComparator != null) {
1816 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1817
1818 if (orderByConditionFields.length > 0) {
1819 query.append(WHERE_AND);
1820 }
1821
1822 for (int i = 0; i < orderByConditionFields.length; i++) {
1823 query.append(_ORDER_BY_ENTITY_ALIAS);
1824 query.append(orderByConditionFields[i]);
1825
1826 if ((i + 1) < orderByConditionFields.length) {
1827 if (orderByComparator.isAscending() ^ previous) {
1828 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1829 }
1830 else {
1831 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1832 }
1833 }
1834 else {
1835 if (orderByComparator.isAscending() ^ previous) {
1836 query.append(WHERE_GREATER_THAN);
1837 }
1838 else {
1839 query.append(WHERE_LESSER_THAN);
1840 }
1841 }
1842 }
1843
1844 query.append(ORDER_BY_CLAUSE);
1845
1846 String[] orderByFields = orderByComparator.getOrderByFields();
1847
1848 for (int i = 0; i < orderByFields.length; i++) {
1849 query.append(_ORDER_BY_ENTITY_ALIAS);
1850 query.append(orderByFields[i]);
1851
1852 if ((i + 1) < orderByFields.length) {
1853 if (orderByComparator.isAscending() ^ previous) {
1854 query.append(ORDER_BY_ASC_HAS_NEXT);
1855 }
1856 else {
1857 query.append(ORDER_BY_DESC_HAS_NEXT);
1858 }
1859 }
1860 else {
1861 if (orderByComparator.isAscending() ^ previous) {
1862 query.append(ORDER_BY_ASC);
1863 }
1864 else {
1865 query.append(ORDER_BY_DESC);
1866 }
1867 }
1868 }
1869 }
1870
1871 else {
1872 query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
1873 }
1874
1875 String sql = query.toString();
1876
1877 Query q = session.createQuery(sql);
1878
1879 q.setFirstResult(0);
1880 q.setMaxResults(2);
1881
1882 QueryPos qPos = QueryPos.getInstance(q);
1883
1884 qPos.add(rowId);
1885
1886 if (orderByComparator != null) {
1887 Object[] values = orderByComparator.getOrderByConditionValues(expandoValue);
1888
1889 for (Object value : values) {
1890 qPos.add(value);
1891 }
1892 }
1893
1894 List<ExpandoValue> list = q.list();
1895
1896 if (list.size() == 2) {
1897 return list.get(1);
1898 }
1899 else {
1900 return null;
1901 }
1902 }
1903
1904
1912 public List<ExpandoValue> findByT_C(long tableId, long columnId)
1913 throws SystemException {
1914 return findByT_C(tableId, columnId, QueryUtil.ALL_POS,
1915 QueryUtil.ALL_POS, null);
1916 }
1917
1918
1932 public List<ExpandoValue> findByT_C(long tableId, long columnId, int start,
1933 int end) throws SystemException {
1934 return findByT_C(tableId, columnId, start, end, null);
1935 }
1936
1937
1952 public List<ExpandoValue> findByT_C(long tableId, long columnId, int start,
1953 int end, OrderByComparator orderByComparator) throws SystemException {
1954 FinderPath finderPath = null;
1955 Object[] finderArgs = null;
1956
1957 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1958 (orderByComparator == null)) {
1959 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_C;
1960 finderArgs = new Object[] { tableId, columnId };
1961 }
1962 else {
1963 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_T_C;
1964 finderArgs = new Object[] {
1965 tableId, columnId,
1966
1967 start, end, orderByComparator
1968 };
1969 }
1970
1971 List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(finderPath,
1972 finderArgs, this);
1973
1974 if (list == null) {
1975 StringBundler query = null;
1976
1977 if (orderByComparator != null) {
1978 query = new StringBundler(4 +
1979 (orderByComparator.getOrderByFields().length * 3));
1980 }
1981 else {
1982 query = new StringBundler(4);
1983 }
1984
1985 query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
1986
1987 query.append(_FINDER_COLUMN_T_C_TABLEID_2);
1988
1989 query.append(_FINDER_COLUMN_T_C_COLUMNID_2);
1990
1991 if (orderByComparator != null) {
1992 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1993 orderByComparator);
1994 }
1995
1996 else {
1997 query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
1998 }
1999
2000 String sql = query.toString();
2001
2002 Session session = null;
2003
2004 try {
2005 session = openSession();
2006
2007 Query q = session.createQuery(sql);
2008
2009 QueryPos qPos = QueryPos.getInstance(q);
2010
2011 qPos.add(tableId);
2012
2013 qPos.add(columnId);
2014
2015 list = (List<ExpandoValue>)QueryUtil.list(q, getDialect(),
2016 start, end);
2017 }
2018 catch (Exception e) {
2019 throw processException(e);
2020 }
2021 finally {
2022 if (list == null) {
2023 FinderCacheUtil.removeResult(finderPath, finderArgs);
2024 }
2025 else {
2026 cacheResult(list);
2027
2028 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2029 }
2030
2031 closeSession(session);
2032 }
2033 }
2034
2035 return list;
2036 }
2037
2038
2052 public ExpandoValue findByT_C_First(long tableId, long columnId,
2053 OrderByComparator orderByComparator)
2054 throws NoSuchValueException, SystemException {
2055 List<ExpandoValue> list = findByT_C(tableId, columnId, 0, 1,
2056 orderByComparator);
2057
2058 if (list.isEmpty()) {
2059 StringBundler msg = new StringBundler(6);
2060
2061 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2062
2063 msg.append("tableId=");
2064 msg.append(tableId);
2065
2066 msg.append(", columnId=");
2067 msg.append(columnId);
2068
2069 msg.append(StringPool.CLOSE_CURLY_BRACE);
2070
2071 throw new NoSuchValueException(msg.toString());
2072 }
2073 else {
2074 return list.get(0);
2075 }
2076 }
2077
2078
2092 public ExpandoValue findByT_C_Last(long tableId, long columnId,
2093 OrderByComparator orderByComparator)
2094 throws NoSuchValueException, SystemException {
2095 int count = countByT_C(tableId, columnId);
2096
2097 List<ExpandoValue> list = findByT_C(tableId, columnId, count - 1,
2098 count, orderByComparator);
2099
2100 if (list.isEmpty()) {
2101 StringBundler msg = new StringBundler(6);
2102
2103 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2104
2105 msg.append("tableId=");
2106 msg.append(tableId);
2107
2108 msg.append(", columnId=");
2109 msg.append(columnId);
2110
2111 msg.append(StringPool.CLOSE_CURLY_BRACE);
2112
2113 throw new NoSuchValueException(msg.toString());
2114 }
2115 else {
2116 return list.get(0);
2117 }
2118 }
2119
2120
2135 public ExpandoValue[] findByT_C_PrevAndNext(long valueId, long tableId,
2136 long columnId, OrderByComparator orderByComparator)
2137 throws NoSuchValueException, SystemException {
2138 ExpandoValue expandoValue = findByPrimaryKey(valueId);
2139
2140 Session session = null;
2141
2142 try {
2143 session = openSession();
2144
2145 ExpandoValue[] array = new ExpandoValueImpl[3];
2146
2147 array[0] = getByT_C_PrevAndNext(session, expandoValue, tableId,
2148 columnId, orderByComparator, true);
2149
2150 array[1] = expandoValue;
2151
2152 array[2] = getByT_C_PrevAndNext(session, expandoValue, tableId,
2153 columnId, orderByComparator, false);
2154
2155 return array;
2156 }
2157 catch (Exception e) {
2158 throw processException(e);
2159 }
2160 finally {
2161 closeSession(session);
2162 }
2163 }
2164
2165 protected ExpandoValue getByT_C_PrevAndNext(Session session,
2166 ExpandoValue expandoValue, long tableId, long columnId,
2167 OrderByComparator orderByComparator, boolean previous) {
2168 StringBundler query = null;
2169
2170 if (orderByComparator != null) {
2171 query = new StringBundler(6 +
2172 (orderByComparator.getOrderByFields().length * 6));
2173 }
2174 else {
2175 query = new StringBundler(3);
2176 }
2177
2178 query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
2179
2180 query.append(_FINDER_COLUMN_T_C_TABLEID_2);
2181
2182 query.append(_FINDER_COLUMN_T_C_COLUMNID_2);
2183
2184 if (orderByComparator != null) {
2185 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2186
2187 if (orderByConditionFields.length > 0) {
2188 query.append(WHERE_AND);
2189 }
2190
2191 for (int i = 0; i < orderByConditionFields.length; i++) {
2192 query.append(_ORDER_BY_ENTITY_ALIAS);
2193 query.append(orderByConditionFields[i]);
2194
2195 if ((i + 1) < orderByConditionFields.length) {
2196 if (orderByComparator.isAscending() ^ previous) {
2197 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2198 }
2199 else {
2200 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2201 }
2202 }
2203 else {
2204 if (orderByComparator.isAscending() ^ previous) {
2205 query.append(WHERE_GREATER_THAN);
2206 }
2207 else {
2208 query.append(WHERE_LESSER_THAN);
2209 }
2210 }
2211 }
2212
2213 query.append(ORDER_BY_CLAUSE);
2214
2215 String[] orderByFields = orderByComparator.getOrderByFields();
2216
2217 for (int i = 0; i < orderByFields.length; i++) {
2218 query.append(_ORDER_BY_ENTITY_ALIAS);
2219 query.append(orderByFields[i]);
2220
2221 if ((i + 1) < orderByFields.length) {
2222 if (orderByComparator.isAscending() ^ previous) {
2223 query.append(ORDER_BY_ASC_HAS_NEXT);
2224 }
2225 else {
2226 query.append(ORDER_BY_DESC_HAS_NEXT);
2227 }
2228 }
2229 else {
2230 if (orderByComparator.isAscending() ^ previous) {
2231 query.append(ORDER_BY_ASC);
2232 }
2233 else {
2234 query.append(ORDER_BY_DESC);
2235 }
2236 }
2237 }
2238 }
2239
2240 else {
2241 query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
2242 }
2243
2244 String sql = query.toString();
2245
2246 Query q = session.createQuery(sql);
2247
2248 q.setFirstResult(0);
2249 q.setMaxResults(2);
2250
2251 QueryPos qPos = QueryPos.getInstance(q);
2252
2253 qPos.add(tableId);
2254
2255 qPos.add(columnId);
2256
2257 if (orderByComparator != null) {
2258 Object[] values = orderByComparator.getOrderByConditionValues(expandoValue);
2259
2260 for (Object value : values) {
2261 qPos.add(value);
2262 }
2263 }
2264
2265 List<ExpandoValue> list = q.list();
2266
2267 if (list.size() == 2) {
2268 return list.get(1);
2269 }
2270 else {
2271 return null;
2272 }
2273 }
2274
2275
2283 public List<ExpandoValue> findByT_CPK(long tableId, long classPK)
2284 throws SystemException {
2285 return findByT_CPK(tableId, classPK, QueryUtil.ALL_POS,
2286 QueryUtil.ALL_POS, null);
2287 }
2288
2289
2303 public List<ExpandoValue> findByT_CPK(long tableId, long classPK,
2304 int start, int end) throws SystemException {
2305 return findByT_CPK(tableId, classPK, start, end, null);
2306 }
2307
2308
2323 public List<ExpandoValue> findByT_CPK(long tableId, long classPK,
2324 int start, int end, OrderByComparator orderByComparator)
2325 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_T_CPK;
2332 finderArgs = new Object[] { tableId, classPK };
2333 }
2334 else {
2335 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_T_CPK;
2336 finderArgs = new Object[] {
2337 tableId, classPK,
2338
2339 start, end, orderByComparator
2340 };
2341 }
2342
2343 List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(finderPath,
2344 finderArgs, this);
2345
2346 if (list == null) {
2347 StringBundler query = null;
2348
2349 if (orderByComparator != null) {
2350 query = new StringBundler(4 +
2351 (orderByComparator.getOrderByFields().length * 3));
2352 }
2353 else {
2354 query = new StringBundler(4);
2355 }
2356
2357 query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
2358
2359 query.append(_FINDER_COLUMN_T_CPK_TABLEID_2);
2360
2361 query.append(_FINDER_COLUMN_T_CPK_CLASSPK_2);
2362
2363 if (orderByComparator != null) {
2364 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2365 orderByComparator);
2366 }
2367
2368 else {
2369 query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
2370 }
2371
2372 String sql = query.toString();
2373
2374 Session session = null;
2375
2376 try {
2377 session = openSession();
2378
2379 Query q = session.createQuery(sql);
2380
2381 QueryPos qPos = QueryPos.getInstance(q);
2382
2383 qPos.add(tableId);
2384
2385 qPos.add(classPK);
2386
2387 list = (List<ExpandoValue>)QueryUtil.list(q, getDialect(),
2388 start, end);
2389 }
2390 catch (Exception e) {
2391 throw processException(e);
2392 }
2393 finally {
2394 if (list == null) {
2395 FinderCacheUtil.removeResult(finderPath, finderArgs);
2396 }
2397 else {
2398 cacheResult(list);
2399
2400 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2401 }
2402
2403 closeSession(session);
2404 }
2405 }
2406
2407 return list;
2408 }
2409
2410
2424 public ExpandoValue findByT_CPK_First(long tableId, long classPK,
2425 OrderByComparator orderByComparator)
2426 throws NoSuchValueException, SystemException {
2427 List<ExpandoValue> list = findByT_CPK(tableId, classPK, 0, 1,
2428 orderByComparator);
2429
2430 if (list.isEmpty()) {
2431 StringBundler msg = new StringBundler(6);
2432
2433 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2434
2435 msg.append("tableId=");
2436 msg.append(tableId);
2437
2438 msg.append(", classPK=");
2439 msg.append(classPK);
2440
2441 msg.append(StringPool.CLOSE_CURLY_BRACE);
2442
2443 throw new NoSuchValueException(msg.toString());
2444 }
2445 else {
2446 return list.get(0);
2447 }
2448 }
2449
2450
2464 public ExpandoValue findByT_CPK_Last(long tableId, long classPK,
2465 OrderByComparator orderByComparator)
2466 throws NoSuchValueException, SystemException {
2467 int count = countByT_CPK(tableId, classPK);
2468
2469 List<ExpandoValue> list = findByT_CPK(tableId, classPK, count - 1,
2470 count, orderByComparator);
2471
2472 if (list.isEmpty()) {
2473 StringBundler msg = new StringBundler(6);
2474
2475 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2476
2477 msg.append("tableId=");
2478 msg.append(tableId);
2479
2480 msg.append(", classPK=");
2481 msg.append(classPK);
2482
2483 msg.append(StringPool.CLOSE_CURLY_BRACE);
2484
2485 throw new NoSuchValueException(msg.toString());
2486 }
2487 else {
2488 return list.get(0);
2489 }
2490 }
2491
2492
2507 public ExpandoValue[] findByT_CPK_PrevAndNext(long valueId, long tableId,
2508 long classPK, OrderByComparator orderByComparator)
2509 throws NoSuchValueException, SystemException {
2510 ExpandoValue expandoValue = findByPrimaryKey(valueId);
2511
2512 Session session = null;
2513
2514 try {
2515 session = openSession();
2516
2517 ExpandoValue[] array = new ExpandoValueImpl[3];
2518
2519 array[0] = getByT_CPK_PrevAndNext(session, expandoValue, tableId,
2520 classPK, orderByComparator, true);
2521
2522 array[1] = expandoValue;
2523
2524 array[2] = getByT_CPK_PrevAndNext(session, expandoValue, tableId,
2525 classPK, orderByComparator, false);
2526
2527 return array;
2528 }
2529 catch (Exception e) {
2530 throw processException(e);
2531 }
2532 finally {
2533 closeSession(session);
2534 }
2535 }
2536
2537 protected ExpandoValue getByT_CPK_PrevAndNext(Session session,
2538 ExpandoValue expandoValue, long tableId, long classPK,
2539 OrderByComparator orderByComparator, boolean previous) {
2540 StringBundler query = null;
2541
2542 if (orderByComparator != null) {
2543 query = new StringBundler(6 +
2544 (orderByComparator.getOrderByFields().length * 6));
2545 }
2546 else {
2547 query = new StringBundler(3);
2548 }
2549
2550 query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
2551
2552 query.append(_FINDER_COLUMN_T_CPK_TABLEID_2);
2553
2554 query.append(_FINDER_COLUMN_T_CPK_CLASSPK_2);
2555
2556 if (orderByComparator != null) {
2557 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2558
2559 if (orderByConditionFields.length > 0) {
2560 query.append(WHERE_AND);
2561 }
2562
2563 for (int i = 0; i < orderByConditionFields.length; i++) {
2564 query.append(_ORDER_BY_ENTITY_ALIAS);
2565 query.append(orderByConditionFields[i]);
2566
2567 if ((i + 1) < orderByConditionFields.length) {
2568 if (orderByComparator.isAscending() ^ previous) {
2569 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2570 }
2571 else {
2572 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2573 }
2574 }
2575 else {
2576 if (orderByComparator.isAscending() ^ previous) {
2577 query.append(WHERE_GREATER_THAN);
2578 }
2579 else {
2580 query.append(WHERE_LESSER_THAN);
2581 }
2582 }
2583 }
2584
2585 query.append(ORDER_BY_CLAUSE);
2586
2587 String[] orderByFields = orderByComparator.getOrderByFields();
2588
2589 for (int i = 0; i < orderByFields.length; i++) {
2590 query.append(_ORDER_BY_ENTITY_ALIAS);
2591 query.append(orderByFields[i]);
2592
2593 if ((i + 1) < orderByFields.length) {
2594 if (orderByComparator.isAscending() ^ previous) {
2595 query.append(ORDER_BY_ASC_HAS_NEXT);
2596 }
2597 else {
2598 query.append(ORDER_BY_DESC_HAS_NEXT);
2599 }
2600 }
2601 else {
2602 if (orderByComparator.isAscending() ^ previous) {
2603 query.append(ORDER_BY_ASC);
2604 }
2605 else {
2606 query.append(ORDER_BY_DESC);
2607 }
2608 }
2609 }
2610 }
2611
2612 else {
2613 query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
2614 }
2615
2616 String sql = query.toString();
2617
2618 Query q = session.createQuery(sql);
2619
2620 q.setFirstResult(0);
2621 q.setMaxResults(2);
2622
2623 QueryPos qPos = QueryPos.getInstance(q);
2624
2625 qPos.add(tableId);
2626
2627 qPos.add(classPK);
2628
2629 if (orderByComparator != null) {
2630 Object[] values = orderByComparator.getOrderByConditionValues(expandoValue);
2631
2632 for (Object value : values) {
2633 qPos.add(value);
2634 }
2635 }
2636
2637 List<ExpandoValue> list = q.list();
2638
2639 if (list.size() == 2) {
2640 return list.get(1);
2641 }
2642 else {
2643 return null;
2644 }
2645 }
2646
2647
2655 public List<ExpandoValue> findByT_R(long tableId, long rowId)
2656 throws SystemException {
2657 return findByT_R(tableId, rowId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
2658 null);
2659 }
2660
2661
2675 public List<ExpandoValue> findByT_R(long tableId, long rowId, int start,
2676 int end) throws SystemException {
2677 return findByT_R(tableId, rowId, start, end, null);
2678 }
2679
2680
2695 public List<ExpandoValue> findByT_R(long tableId, long rowId, int start,
2696 int end, OrderByComparator orderByComparator) throws SystemException {
2697 FinderPath finderPath = null;
2698 Object[] finderArgs = null;
2699
2700 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2701 (orderByComparator == null)) {
2702 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_R;
2703 finderArgs = new Object[] { tableId, rowId };
2704 }
2705 else {
2706 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_T_R;
2707 finderArgs = new Object[] {
2708 tableId, rowId,
2709
2710 start, end, orderByComparator
2711 };
2712 }
2713
2714 List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(finderPath,
2715 finderArgs, this);
2716
2717 if (list == null) {
2718 StringBundler query = null;
2719
2720 if (orderByComparator != null) {
2721 query = new StringBundler(4 +
2722 (orderByComparator.getOrderByFields().length * 3));
2723 }
2724 else {
2725 query = new StringBundler(4);
2726 }
2727
2728 query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
2729
2730 query.append(_FINDER_COLUMN_T_R_TABLEID_2);
2731
2732 query.append(_FINDER_COLUMN_T_R_ROWID_2);
2733
2734 if (orderByComparator != null) {
2735 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2736 orderByComparator);
2737 }
2738
2739 else {
2740 query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
2741 }
2742
2743 String sql = query.toString();
2744
2745 Session session = null;
2746
2747 try {
2748 session = openSession();
2749
2750 Query q = session.createQuery(sql);
2751
2752 QueryPos qPos = QueryPos.getInstance(q);
2753
2754 qPos.add(tableId);
2755
2756 qPos.add(rowId);
2757
2758 list = (List<ExpandoValue>)QueryUtil.list(q, getDialect(),
2759 start, end);
2760 }
2761 catch (Exception e) {
2762 throw processException(e);
2763 }
2764 finally {
2765 if (list == null) {
2766 FinderCacheUtil.removeResult(finderPath, finderArgs);
2767 }
2768 else {
2769 cacheResult(list);
2770
2771 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2772 }
2773
2774 closeSession(session);
2775 }
2776 }
2777
2778 return list;
2779 }
2780
2781
2795 public ExpandoValue findByT_R_First(long tableId, long rowId,
2796 OrderByComparator orderByComparator)
2797 throws NoSuchValueException, SystemException {
2798 List<ExpandoValue> list = findByT_R(tableId, rowId, 0, 1,
2799 orderByComparator);
2800
2801 if (list.isEmpty()) {
2802 StringBundler msg = new StringBundler(6);
2803
2804 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2805
2806 msg.append("tableId=");
2807 msg.append(tableId);
2808
2809 msg.append(", rowId=");
2810 msg.append(rowId);
2811
2812 msg.append(StringPool.CLOSE_CURLY_BRACE);
2813
2814 throw new NoSuchValueException(msg.toString());
2815 }
2816 else {
2817 return list.get(0);
2818 }
2819 }
2820
2821
2835 public ExpandoValue findByT_R_Last(long tableId, long rowId,
2836 OrderByComparator orderByComparator)
2837 throws NoSuchValueException, SystemException {
2838 int count = countByT_R(tableId, rowId);
2839
2840 List<ExpandoValue> list = findByT_R(tableId, rowId, count - 1, count,
2841 orderByComparator);
2842
2843 if (list.isEmpty()) {
2844 StringBundler msg = new StringBundler(6);
2845
2846 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2847
2848 msg.append("tableId=");
2849 msg.append(tableId);
2850
2851 msg.append(", rowId=");
2852 msg.append(rowId);
2853
2854 msg.append(StringPool.CLOSE_CURLY_BRACE);
2855
2856 throw new NoSuchValueException(msg.toString());
2857 }
2858 else {
2859 return list.get(0);
2860 }
2861 }
2862
2863
2878 public ExpandoValue[] findByT_R_PrevAndNext(long valueId, long tableId,
2879 long rowId, OrderByComparator orderByComparator)
2880 throws NoSuchValueException, SystemException {
2881 ExpandoValue expandoValue = findByPrimaryKey(valueId);
2882
2883 Session session = null;
2884
2885 try {
2886 session = openSession();
2887
2888 ExpandoValue[] array = new ExpandoValueImpl[3];
2889
2890 array[0] = getByT_R_PrevAndNext(session, expandoValue, tableId,
2891 rowId, orderByComparator, true);
2892
2893 array[1] = expandoValue;
2894
2895 array[2] = getByT_R_PrevAndNext(session, expandoValue, tableId,
2896 rowId, orderByComparator, false);
2897
2898 return array;
2899 }
2900 catch (Exception e) {
2901 throw processException(e);
2902 }
2903 finally {
2904 closeSession(session);
2905 }
2906 }
2907
2908 protected ExpandoValue getByT_R_PrevAndNext(Session session,
2909 ExpandoValue expandoValue, long tableId, long rowId,
2910 OrderByComparator orderByComparator, boolean previous) {
2911 StringBundler query = null;
2912
2913 if (orderByComparator != null) {
2914 query = new StringBundler(6 +
2915 (orderByComparator.getOrderByFields().length * 6));
2916 }
2917 else {
2918 query = new StringBundler(3);
2919 }
2920
2921 query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
2922
2923 query.append(_FINDER_COLUMN_T_R_TABLEID_2);
2924
2925 query.append(_FINDER_COLUMN_T_R_ROWID_2);
2926
2927 if (orderByComparator != null) {
2928 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2929
2930 if (orderByConditionFields.length > 0) {
2931 query.append(WHERE_AND);
2932 }
2933
2934 for (int i = 0; i < orderByConditionFields.length; i++) {
2935 query.append(_ORDER_BY_ENTITY_ALIAS);
2936 query.append(orderByConditionFields[i]);
2937
2938 if ((i + 1) < orderByConditionFields.length) {
2939 if (orderByComparator.isAscending() ^ previous) {
2940 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2941 }
2942 else {
2943 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2944 }
2945 }
2946 else {
2947 if (orderByComparator.isAscending() ^ previous) {
2948 query.append(WHERE_GREATER_THAN);
2949 }
2950 else {
2951 query.append(WHERE_LESSER_THAN);
2952 }
2953 }
2954 }
2955
2956 query.append(ORDER_BY_CLAUSE);
2957
2958 String[] orderByFields = orderByComparator.getOrderByFields();
2959
2960 for (int i = 0; i < orderByFields.length; i++) {
2961 query.append(_ORDER_BY_ENTITY_ALIAS);
2962 query.append(orderByFields[i]);
2963
2964 if ((i + 1) < orderByFields.length) {
2965 if (orderByComparator.isAscending() ^ previous) {
2966 query.append(ORDER_BY_ASC_HAS_NEXT);
2967 }
2968 else {
2969 query.append(ORDER_BY_DESC_HAS_NEXT);
2970 }
2971 }
2972 else {
2973 if (orderByComparator.isAscending() ^ previous) {
2974 query.append(ORDER_BY_ASC);
2975 }
2976 else {
2977 query.append(ORDER_BY_DESC);
2978 }
2979 }
2980 }
2981 }
2982
2983 else {
2984 query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
2985 }
2986
2987 String sql = query.toString();
2988
2989 Query q = session.createQuery(sql);
2990
2991 q.setFirstResult(0);
2992 q.setMaxResults(2);
2993
2994 QueryPos qPos = QueryPos.getInstance(q);
2995
2996 qPos.add(tableId);
2997
2998 qPos.add(rowId);
2999
3000 if (orderByComparator != null) {
3001 Object[] values = orderByComparator.getOrderByConditionValues(expandoValue);
3002
3003 for (Object value : values) {
3004 qPos.add(value);
3005 }
3006 }
3007
3008 List<ExpandoValue> list = q.list();
3009
3010 if (list.size() == 2) {
3011 return list.get(1);
3012 }
3013 else {
3014 return null;
3015 }
3016 }
3017
3018
3027 public ExpandoValue findByC_R(long columnId, long rowId)
3028 throws NoSuchValueException, SystemException {
3029 ExpandoValue expandoValue = fetchByC_R(columnId, rowId);
3030
3031 if (expandoValue == null) {
3032 StringBundler msg = new StringBundler(6);
3033
3034 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3035
3036 msg.append("columnId=");
3037 msg.append(columnId);
3038
3039 msg.append(", rowId=");
3040 msg.append(rowId);
3041
3042 msg.append(StringPool.CLOSE_CURLY_BRACE);
3043
3044 if (_log.isWarnEnabled()) {
3045 _log.warn(msg.toString());
3046 }
3047
3048 throw new NoSuchValueException(msg.toString());
3049 }
3050
3051 return expandoValue;
3052 }
3053
3054
3062 public ExpandoValue fetchByC_R(long columnId, long rowId)
3063 throws SystemException {
3064 return fetchByC_R(columnId, rowId, true);
3065 }
3066
3067
3076 public ExpandoValue fetchByC_R(long columnId, long rowId,
3077 boolean retrieveFromCache) throws SystemException {
3078 Object[] finderArgs = new Object[] { columnId, rowId };
3079
3080 Object result = null;
3081
3082 if (retrieveFromCache) {
3083 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_R,
3084 finderArgs, this);
3085 }
3086
3087 if (result == null) {
3088 StringBundler query = new StringBundler(4);
3089
3090 query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
3091
3092 query.append(_FINDER_COLUMN_C_R_COLUMNID_2);
3093
3094 query.append(_FINDER_COLUMN_C_R_ROWID_2);
3095
3096 query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
3097
3098 String sql = query.toString();
3099
3100 Session session = null;
3101
3102 try {
3103 session = openSession();
3104
3105 Query q = session.createQuery(sql);
3106
3107 QueryPos qPos = QueryPos.getInstance(q);
3108
3109 qPos.add(columnId);
3110
3111 qPos.add(rowId);
3112
3113 List<ExpandoValue> list = q.list();
3114
3115 result = list;
3116
3117 ExpandoValue expandoValue = null;
3118
3119 if (list.isEmpty()) {
3120 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_R,
3121 finderArgs, list);
3122 }
3123 else {
3124 expandoValue = list.get(0);
3125
3126 cacheResult(expandoValue);
3127
3128 if ((expandoValue.getColumnId() != columnId) ||
3129 (expandoValue.getRowId() != rowId)) {
3130 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_R,
3131 finderArgs, expandoValue);
3132 }
3133 }
3134
3135 return expandoValue;
3136 }
3137 catch (Exception e) {
3138 throw processException(e);
3139 }
3140 finally {
3141 if (result == null) {
3142 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_R,
3143 finderArgs);
3144 }
3145
3146 closeSession(session);
3147 }
3148 }
3149 else {
3150 if (result instanceof List<?>) {
3151 return null;
3152 }
3153 else {
3154 return (ExpandoValue)result;
3155 }
3156 }
3157 }
3158
3159
3167 public List<ExpandoValue> findByC_C(long classNameId, long classPK)
3168 throws SystemException {
3169 return findByC_C(classNameId, classPK, QueryUtil.ALL_POS,
3170 QueryUtil.ALL_POS, null);
3171 }
3172
3173
3187 public List<ExpandoValue> findByC_C(long classNameId, long classPK,
3188 int start, int end) throws SystemException {
3189 return findByC_C(classNameId, classPK, start, end, null);
3190 }
3191
3192
3207 public List<ExpandoValue> findByC_C(long classNameId, long classPK,
3208 int start, int end, OrderByComparator orderByComparator)
3209 throws SystemException {
3210 FinderPath finderPath = null;
3211 Object[] finderArgs = null;
3212
3213 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
3214 (orderByComparator == null)) {
3215 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C;
3216 finderArgs = new Object[] { classNameId, classPK };
3217 }
3218 else {
3219 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C;
3220 finderArgs = new Object[] {
3221 classNameId, classPK,
3222
3223 start, end, orderByComparator
3224 };
3225 }
3226
3227 List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(finderPath,
3228 finderArgs, this);
3229
3230 if (list == null) {
3231 StringBundler query = null;
3232
3233 if (orderByComparator != null) {
3234 query = new StringBundler(4 +
3235 (orderByComparator.getOrderByFields().length * 3));
3236 }
3237 else {
3238 query = new StringBundler(4);
3239 }
3240
3241 query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
3242
3243 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
3244
3245 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
3246
3247 if (orderByComparator != null) {
3248 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3249 orderByComparator);
3250 }
3251
3252 else {
3253 query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
3254 }
3255
3256 String sql = query.toString();
3257
3258 Session session = null;
3259
3260 try {
3261 session = openSession();
3262
3263 Query q = session.createQuery(sql);
3264
3265 QueryPos qPos = QueryPos.getInstance(q);
3266
3267 qPos.add(classNameId);
3268
3269 qPos.add(classPK);
3270
3271 list = (List<ExpandoValue>)QueryUtil.list(q, getDialect(),
3272 start, end);
3273 }
3274 catch (Exception e) {
3275 throw processException(e);
3276 }
3277 finally {
3278 if (list == null) {
3279 FinderCacheUtil.removeResult(finderPath, finderArgs);
3280 }
3281 else {
3282 cacheResult(list);
3283
3284 FinderCacheUtil.putResult(finderPath, finderArgs, list);
3285 }
3286
3287 closeSession(session);
3288 }
3289 }
3290
3291 return list;
3292 }
3293
3294
3308 public ExpandoValue findByC_C_First(long classNameId, long classPK,
3309 OrderByComparator orderByComparator)
3310 throws NoSuchValueException, SystemException {
3311 List<ExpandoValue> list = findByC_C(classNameId, classPK, 0, 1,
3312 orderByComparator);
3313
3314 if (list.isEmpty()) {
3315 StringBundler msg = new StringBundler(6);
3316
3317 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3318
3319 msg.append("classNameId=");
3320 msg.append(classNameId);
3321
3322 msg.append(", classPK=");
3323 msg.append(classPK);
3324
3325 msg.append(StringPool.CLOSE_CURLY_BRACE);
3326
3327 throw new NoSuchValueException(msg.toString());
3328 }
3329 else {
3330 return list.get(0);
3331 }
3332 }
3333
3334
3348 public ExpandoValue findByC_C_Last(long classNameId, long classPK,
3349 OrderByComparator orderByComparator)
3350 throws NoSuchValueException, SystemException {
3351 int count = countByC_C(classNameId, classPK);
3352
3353 List<ExpandoValue> list = findByC_C(classNameId, classPK, count - 1,
3354 count, orderByComparator);
3355
3356 if (list.isEmpty()) {
3357 StringBundler msg = new StringBundler(6);
3358
3359 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3360
3361 msg.append("classNameId=");
3362 msg.append(classNameId);
3363
3364 msg.append(", classPK=");
3365 msg.append(classPK);
3366
3367 msg.append(StringPool.CLOSE_CURLY_BRACE);
3368
3369 throw new NoSuchValueException(msg.toString());
3370 }
3371 else {
3372 return list.get(0);
3373 }
3374 }
3375
3376
3391 public ExpandoValue[] findByC_C_PrevAndNext(long valueId, long classNameId,
3392 long classPK, OrderByComparator orderByComparator)
3393 throws NoSuchValueException, SystemException {
3394 ExpandoValue expandoValue = findByPrimaryKey(valueId);
3395
3396 Session session = null;
3397
3398 try {
3399 session = openSession();
3400
3401 ExpandoValue[] array = new ExpandoValueImpl[3];
3402
3403 array[0] = getByC_C_PrevAndNext(session, expandoValue, classNameId,
3404 classPK, orderByComparator, true);
3405
3406 array[1] = expandoValue;
3407
3408 array[2] = getByC_C_PrevAndNext(session, expandoValue, classNameId,
3409 classPK, orderByComparator, false);
3410
3411 return array;
3412 }
3413 catch (Exception e) {
3414 throw processException(e);
3415 }
3416 finally {
3417 closeSession(session);
3418 }
3419 }
3420
3421 protected ExpandoValue getByC_C_PrevAndNext(Session session,
3422 ExpandoValue expandoValue, long classNameId, long classPK,
3423 OrderByComparator orderByComparator, boolean previous) {
3424 StringBundler query = null;
3425
3426 if (orderByComparator != null) {
3427 query = new StringBundler(6 +
3428 (orderByComparator.getOrderByFields().length * 6));
3429 }
3430 else {
3431 query = new StringBundler(3);
3432 }
3433
3434 query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
3435
3436 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
3437
3438 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
3439
3440 if (orderByComparator != null) {
3441 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
3442
3443 if (orderByConditionFields.length > 0) {
3444 query.append(WHERE_AND);
3445 }
3446
3447 for (int i = 0; i < orderByConditionFields.length; i++) {
3448 query.append(_ORDER_BY_ENTITY_ALIAS);
3449 query.append(orderByConditionFields[i]);
3450
3451 if ((i + 1) < orderByConditionFields.length) {
3452 if (orderByComparator.isAscending() ^ previous) {
3453 query.append(WHERE_GREATER_THAN_HAS_NEXT);
3454 }
3455 else {
3456 query.append(WHERE_LESSER_THAN_HAS_NEXT);
3457 }
3458 }
3459 else {
3460 if (orderByComparator.isAscending() ^ previous) {
3461 query.append(WHERE_GREATER_THAN);
3462 }
3463 else {
3464 query.append(WHERE_LESSER_THAN);
3465 }
3466 }
3467 }
3468
3469 query.append(ORDER_BY_CLAUSE);
3470
3471 String[] orderByFields = orderByComparator.getOrderByFields();
3472
3473 for (int i = 0; i < orderByFields.length; i++) {
3474 query.append(_ORDER_BY_ENTITY_ALIAS);
3475 query.append(orderByFields[i]);
3476
3477 if ((i + 1) < orderByFields.length) {
3478 if (orderByComparator.isAscending() ^ previous) {
3479 query.append(ORDER_BY_ASC_HAS_NEXT);
3480 }
3481 else {
3482 query.append(ORDER_BY_DESC_HAS_NEXT);
3483 }
3484 }
3485 else {
3486 if (orderByComparator.isAscending() ^ previous) {
3487 query.append(ORDER_BY_ASC);
3488 }
3489 else {
3490 query.append(ORDER_BY_DESC);
3491 }
3492 }
3493 }
3494 }
3495
3496 else {
3497 query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
3498 }
3499
3500 String sql = query.toString();
3501
3502 Query q = session.createQuery(sql);
3503
3504 q.setFirstResult(0);
3505 q.setMaxResults(2);
3506
3507 QueryPos qPos = QueryPos.getInstance(q);
3508
3509 qPos.add(classNameId);
3510
3511 qPos.add(classPK);
3512
3513 if (orderByComparator != null) {
3514 Object[] values = orderByComparator.getOrderByConditionValues(expandoValue);
3515
3516 for (Object value : values) {
3517 qPos.add(value);
3518 }
3519 }
3520
3521 List<ExpandoValue> list = q.list();
3522
3523 if (list.size() == 2) {
3524 return list.get(1);
3525 }
3526 else {
3527 return null;
3528 }
3529 }
3530
3531
3541 public ExpandoValue findByT_C_C(long tableId, long columnId, long classPK)
3542 throws NoSuchValueException, SystemException {
3543 ExpandoValue expandoValue = fetchByT_C_C(tableId, columnId, classPK);
3544
3545 if (expandoValue == null) {
3546 StringBundler msg = new StringBundler(8);
3547
3548 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3549
3550 msg.append("tableId=");
3551 msg.append(tableId);
3552
3553 msg.append(", columnId=");
3554 msg.append(columnId);
3555
3556 msg.append(", classPK=");
3557 msg.append(classPK);
3558
3559 msg.append(StringPool.CLOSE_CURLY_BRACE);
3560
3561 if (_log.isWarnEnabled()) {
3562 _log.warn(msg.toString());
3563 }
3564
3565 throw new NoSuchValueException(msg.toString());
3566 }
3567
3568 return expandoValue;
3569 }
3570
3571
3580 public ExpandoValue fetchByT_C_C(long tableId, long columnId, long classPK)
3581 throws SystemException {
3582 return fetchByT_C_C(tableId, columnId, classPK, true);
3583 }
3584
3585
3595 public ExpandoValue fetchByT_C_C(long tableId, long columnId, long classPK,
3596 boolean retrieveFromCache) throws SystemException {
3597 Object[] finderArgs = new Object[] { tableId, columnId, classPK };
3598
3599 Object result = null;
3600
3601 if (retrieveFromCache) {
3602 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_T_C_C,
3603 finderArgs, this);
3604 }
3605
3606 if (result == null) {
3607 StringBundler query = new StringBundler(5);
3608
3609 query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
3610
3611 query.append(_FINDER_COLUMN_T_C_C_TABLEID_2);
3612
3613 query.append(_FINDER_COLUMN_T_C_C_COLUMNID_2);
3614
3615 query.append(_FINDER_COLUMN_T_C_C_CLASSPK_2);
3616
3617 query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
3618
3619 String sql = query.toString();
3620
3621 Session session = null;
3622
3623 try {
3624 session = openSession();
3625
3626 Query q = session.createQuery(sql);
3627
3628 QueryPos qPos = QueryPos.getInstance(q);
3629
3630 qPos.add(tableId);
3631
3632 qPos.add(columnId);
3633
3634 qPos.add(classPK);
3635
3636 List<ExpandoValue> list = q.list();
3637
3638 result = list;
3639
3640 ExpandoValue expandoValue = null;
3641
3642 if (list.isEmpty()) {
3643 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_C_C,
3644 finderArgs, list);
3645 }
3646 else {
3647 expandoValue = list.get(0);
3648
3649 cacheResult(expandoValue);
3650
3651 if ((expandoValue.getTableId() != tableId) ||
3652 (expandoValue.getColumnId() != columnId) ||
3653 (expandoValue.getClassPK() != classPK)) {
3654 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_C_C,
3655 finderArgs, expandoValue);
3656 }
3657 }
3658
3659 return expandoValue;
3660 }
3661 catch (Exception e) {
3662 throw processException(e);
3663 }
3664 finally {
3665 if (result == null) {
3666 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_T_C_C,
3667 finderArgs);
3668 }
3669
3670 closeSession(session);
3671 }
3672 }
3673 else {
3674 if (result instanceof List<?>) {
3675 return null;
3676 }
3677 else {
3678 return (ExpandoValue)result;
3679 }
3680 }
3681 }
3682
3683
3692 public List<ExpandoValue> findByT_C_D(long tableId, long columnId,
3693 String data) throws SystemException {
3694 return findByT_C_D(tableId, columnId, data, QueryUtil.ALL_POS,
3695 QueryUtil.ALL_POS, null);
3696 }
3697
3698
3713 public List<ExpandoValue> findByT_C_D(long tableId, long columnId,
3714 String data, int start, int end) throws SystemException {
3715 return findByT_C_D(tableId, columnId, data, start, end, null);
3716 }
3717
3718
3734 public List<ExpandoValue> findByT_C_D(long tableId, long columnId,
3735 String data, int start, int end, OrderByComparator orderByComparator)
3736 throws SystemException {
3737 FinderPath finderPath = null;
3738 Object[] finderArgs = null;
3739
3740 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
3741 (orderByComparator == null)) {
3742 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_T_C_D;
3743 finderArgs = new Object[] { tableId, columnId, data };
3744 }
3745 else {
3746 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_T_C_D;
3747 finderArgs = new Object[] {
3748 tableId, columnId, data,
3749
3750 start, end, orderByComparator
3751 };
3752 }
3753
3754 List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(finderPath,
3755 finderArgs, this);
3756
3757 if (list == null) {
3758 StringBundler query = null;
3759
3760 if (orderByComparator != null) {
3761 query = new StringBundler(5 +
3762 (orderByComparator.getOrderByFields().length * 3));
3763 }
3764 else {
3765 query = new StringBundler(5);
3766 }
3767
3768 query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
3769
3770 query.append(_FINDER_COLUMN_T_C_D_TABLEID_2);
3771
3772 query.append(_FINDER_COLUMN_T_C_D_COLUMNID_2);
3773
3774 if (data == null) {
3775 query.append(_FINDER_COLUMN_T_C_D_DATA_1);
3776 }
3777 else {
3778 if (data.equals(StringPool.BLANK)) {
3779 query.append(_FINDER_COLUMN_T_C_D_DATA_3);
3780 }
3781 else {
3782 query.append(_FINDER_COLUMN_T_C_D_DATA_2);
3783 }
3784 }
3785
3786 if (orderByComparator != null) {
3787 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3788 orderByComparator);
3789 }
3790
3791 else {
3792 query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
3793 }
3794
3795 String sql = query.toString();
3796
3797 Session session = null;
3798
3799 try {
3800 session = openSession();
3801
3802 Query q = session.createQuery(sql);
3803
3804 QueryPos qPos = QueryPos.getInstance(q);
3805
3806 qPos.add(tableId);
3807
3808 qPos.add(columnId);
3809
3810 if (data != null) {
3811 qPos.add(data);
3812 }
3813
3814 list = (List<ExpandoValue>)QueryUtil.list(q, getDialect(),
3815 start, end);
3816 }
3817 catch (Exception e) {
3818 throw processException(e);
3819 }
3820 finally {
3821 if (list == null) {
3822 FinderCacheUtil.removeResult(finderPath, finderArgs);
3823 }
3824 else {
3825 cacheResult(list);
3826
3827 FinderCacheUtil.putResult(finderPath, finderArgs, list);
3828 }
3829
3830 closeSession(session);
3831 }
3832 }
3833
3834 return list;
3835 }
3836
3837
3852 public ExpandoValue findByT_C_D_First(long tableId, long columnId,
3853 String data, OrderByComparator orderByComparator)
3854 throws NoSuchValueException, SystemException {
3855 List<ExpandoValue> list = findByT_C_D(tableId, columnId, data, 0, 1,
3856 orderByComparator);
3857
3858 if (list.isEmpty()) {
3859 StringBundler msg = new StringBundler(8);
3860
3861 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3862
3863 msg.append("tableId=");
3864 msg.append(tableId);
3865
3866 msg.append(", columnId=");
3867 msg.append(columnId);
3868
3869 msg.append(", data=");
3870 msg.append(data);
3871
3872 msg.append(StringPool.CLOSE_CURLY_BRACE);
3873
3874 throw new NoSuchValueException(msg.toString());
3875 }
3876 else {
3877 return list.get(0);
3878 }
3879 }
3880
3881
3896 public ExpandoValue findByT_C_D_Last(long tableId, long columnId,
3897 String data, OrderByComparator orderByComparator)
3898 throws NoSuchValueException, SystemException {
3899 int count = countByT_C_D(tableId, columnId, data);
3900
3901 List<ExpandoValue> list = findByT_C_D(tableId, columnId, data,
3902 count - 1, count, orderByComparator);
3903
3904 if (list.isEmpty()) {
3905 StringBundler msg = new StringBundler(8);
3906
3907 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3908
3909 msg.append("tableId=");
3910 msg.append(tableId);
3911
3912 msg.append(", columnId=");
3913 msg.append(columnId);
3914
3915 msg.append(", data=");
3916 msg.append(data);
3917
3918 msg.append(StringPool.CLOSE_CURLY_BRACE);
3919
3920 throw new NoSuchValueException(msg.toString());
3921 }
3922 else {
3923 return list.get(0);
3924 }
3925 }
3926
3927
3943 public ExpandoValue[] findByT_C_D_PrevAndNext(long valueId, long tableId,
3944 long columnId, String data, OrderByComparator orderByComparator)
3945 throws NoSuchValueException, SystemException {
3946 ExpandoValue expandoValue = findByPrimaryKey(valueId);
3947
3948 Session session = null;
3949
3950 try {
3951 session = openSession();
3952
3953 ExpandoValue[] array = new ExpandoValueImpl[3];
3954
3955 array[0] = getByT_C_D_PrevAndNext(session, expandoValue, tableId,
3956 columnId, data, orderByComparator, true);
3957
3958 array[1] = expandoValue;
3959
3960 array[2] = getByT_C_D_PrevAndNext(session, expandoValue, tableId,
3961 columnId, data, orderByComparator, false);
3962
3963 return array;
3964 }
3965 catch (Exception e) {
3966 throw processException(e);
3967 }
3968 finally {
3969 closeSession(session);
3970 }
3971 }
3972
3973 protected ExpandoValue getByT_C_D_PrevAndNext(Session session,
3974 ExpandoValue expandoValue, long tableId, long columnId, String data,
3975 OrderByComparator orderByComparator, boolean previous) {
3976 StringBundler query = null;
3977
3978 if (orderByComparator != null) {
3979 query = new StringBundler(6 +
3980 (orderByComparator.getOrderByFields().length * 6));
3981 }
3982 else {
3983 query = new StringBundler(3);
3984 }
3985
3986 query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
3987
3988 query.append(_FINDER_COLUMN_T_C_D_TABLEID_2);
3989
3990 query.append(_FINDER_COLUMN_T_C_D_COLUMNID_2);
3991
3992 if (data == null) {
3993 query.append(_FINDER_COLUMN_T_C_D_DATA_1);
3994 }
3995 else {
3996 if (data.equals(StringPool.BLANK)) {
3997 query.append(_FINDER_COLUMN_T_C_D_DATA_3);
3998 }
3999 else {
4000 query.append(_FINDER_COLUMN_T_C_D_DATA_2);
4001 }
4002 }
4003
4004 if (orderByComparator != null) {
4005 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
4006
4007 if (orderByConditionFields.length > 0) {
4008 query.append(WHERE_AND);
4009 }
4010
4011 for (int i = 0; i < orderByConditionFields.length; i++) {
4012 query.append(_ORDER_BY_ENTITY_ALIAS);
4013 query.append(orderByConditionFields[i]);
4014
4015 if ((i + 1) < orderByConditionFields.length) {
4016 if (orderByComparator.isAscending() ^ previous) {
4017 query.append(WHERE_GREATER_THAN_HAS_NEXT);
4018 }
4019 else {
4020 query.append(WHERE_LESSER_THAN_HAS_NEXT);
4021 }
4022 }
4023 else {
4024 if (orderByComparator.isAscending() ^ previous) {
4025 query.append(WHERE_GREATER_THAN);
4026 }
4027 else {
4028 query.append(WHERE_LESSER_THAN);
4029 }
4030 }
4031 }
4032
4033 query.append(ORDER_BY_CLAUSE);
4034
4035 String[] orderByFields = orderByComparator.getOrderByFields();
4036
4037 for (int i = 0; i < orderByFields.length; i++) {
4038 query.append(_ORDER_BY_ENTITY_ALIAS);
4039 query.append(orderByFields[i]);
4040
4041 if ((i + 1) < orderByFields.length) {
4042 if (orderByComparator.isAscending() ^ previous) {
4043 query.append(ORDER_BY_ASC_HAS_NEXT);
4044 }
4045 else {
4046 query.append(ORDER_BY_DESC_HAS_NEXT);
4047 }
4048 }
4049 else {
4050 if (orderByComparator.isAscending() ^ previous) {
4051 query.append(ORDER_BY_ASC);
4052 }
4053 else {
4054 query.append(ORDER_BY_DESC);
4055 }
4056 }
4057 }
4058 }
4059
4060 else {
4061 query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
4062 }
4063
4064 String sql = query.toString();
4065
4066 Query q = session.createQuery(sql);
4067
4068 q.setFirstResult(0);
4069 q.setMaxResults(2);
4070
4071 QueryPos qPos = QueryPos.getInstance(q);
4072
4073 qPos.add(tableId);
4074
4075 qPos.add(columnId);
4076
4077 if (data != null) {
4078 qPos.add(data);
4079 }
4080
4081 if (orderByComparator != null) {
4082 Object[] values = orderByComparator.getOrderByConditionValues(expandoValue);
4083
4084 for (Object value : values) {
4085 qPos.add(value);
4086 }
4087 }
4088
4089 List<ExpandoValue> list = q.list();
4090
4091 if (list.size() == 2) {
4092 return list.get(1);
4093 }
4094 else {
4095 return null;
4096 }
4097 }
4098
4099
4105 public List<ExpandoValue> findAll() throws SystemException {
4106 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
4107 }
4108
4109
4121 public List<ExpandoValue> findAll(int start, int end)
4122 throws SystemException {
4123 return findAll(start, end, null);
4124 }
4125
4126
4139 public List<ExpandoValue> findAll(int start, int end,
4140 OrderByComparator orderByComparator) throws SystemException {
4141 FinderPath finderPath = null;
4142 Object[] finderArgs = new Object[] { start, end, orderByComparator };
4143
4144 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
4145 (orderByComparator == null)) {
4146 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
4147 finderArgs = FINDER_ARGS_EMPTY;
4148 }
4149 else {
4150 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
4151 finderArgs = new Object[] { start, end, orderByComparator };
4152 }
4153
4154 List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(finderPath,
4155 finderArgs, this);
4156
4157 if (list == null) {
4158 StringBundler query = null;
4159 String sql = null;
4160
4161 if (orderByComparator != null) {
4162 query = new StringBundler(2 +
4163 (orderByComparator.getOrderByFields().length * 3));
4164
4165 query.append(_SQL_SELECT_EXPANDOVALUE);
4166
4167 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4168 orderByComparator);
4169
4170 sql = query.toString();
4171 }
4172 else {
4173 sql = _SQL_SELECT_EXPANDOVALUE.concat(ExpandoValueModelImpl.ORDER_BY_JPQL);
4174 }
4175
4176 Session session = null;
4177
4178 try {
4179 session = openSession();
4180
4181 Query q = session.createQuery(sql);
4182
4183 if (orderByComparator == null) {
4184 list = (List<ExpandoValue>)QueryUtil.list(q, getDialect(),
4185 start, end, false);
4186
4187 Collections.sort(list);
4188 }
4189 else {
4190 list = (List<ExpandoValue>)QueryUtil.list(q, getDialect(),
4191 start, end);
4192 }
4193 }
4194 catch (Exception e) {
4195 throw processException(e);
4196 }
4197 finally {
4198 if (list == null) {
4199 FinderCacheUtil.removeResult(finderPath, finderArgs);
4200 }
4201 else {
4202 cacheResult(list);
4203
4204 FinderCacheUtil.putResult(finderPath, finderArgs, list);
4205 }
4206
4207 closeSession(session);
4208 }
4209 }
4210
4211 return list;
4212 }
4213
4214
4220 public void removeByTableId(long tableId) throws SystemException {
4221 for (ExpandoValue expandoValue : findByTableId(tableId)) {
4222 expandoValuePersistence.remove(expandoValue);
4223 }
4224 }
4225
4226
4232 public void removeByColumnId(long columnId) throws SystemException {
4233 for (ExpandoValue expandoValue : findByColumnId(columnId)) {
4234 expandoValuePersistence.remove(expandoValue);
4235 }
4236 }
4237
4238
4244 public void removeByRowId(long rowId) throws SystemException {
4245 for (ExpandoValue expandoValue : findByRowId(rowId)) {
4246 expandoValuePersistence.remove(expandoValue);
4247 }
4248 }
4249
4250
4257 public void removeByT_C(long tableId, long columnId)
4258 throws SystemException {
4259 for (ExpandoValue expandoValue : findByT_C(tableId, columnId)) {
4260 expandoValuePersistence.remove(expandoValue);
4261 }
4262 }
4263
4264
4271 public void removeByT_CPK(long tableId, long classPK)
4272 throws SystemException {
4273 for (ExpandoValue expandoValue : findByT_CPK(tableId, classPK)) {
4274 expandoValuePersistence.remove(expandoValue);
4275 }
4276 }
4277
4278
4285 public void removeByT_R(long tableId, long rowId) throws SystemException {
4286 for (ExpandoValue expandoValue : findByT_R(tableId, rowId)) {
4287 expandoValuePersistence.remove(expandoValue);
4288 }
4289 }
4290
4291
4298 public void removeByC_R(long columnId, long rowId)
4299 throws NoSuchValueException, SystemException {
4300 ExpandoValue expandoValue = findByC_R(columnId, rowId);
4301
4302 expandoValuePersistence.remove(expandoValue);
4303 }
4304
4305
4312 public void removeByC_C(long classNameId, long classPK)
4313 throws SystemException {
4314 for (ExpandoValue expandoValue : findByC_C(classNameId, classPK)) {
4315 expandoValuePersistence.remove(expandoValue);
4316 }
4317 }
4318
4319
4327 public void removeByT_C_C(long tableId, long columnId, long classPK)
4328 throws NoSuchValueException, SystemException {
4329 ExpandoValue expandoValue = findByT_C_C(tableId, columnId, classPK);
4330
4331 expandoValuePersistence.remove(expandoValue);
4332 }
4333
4334
4342 public void removeByT_C_D(long tableId, long columnId, String data)
4343 throws SystemException {
4344 for (ExpandoValue expandoValue : findByT_C_D(tableId, columnId, data)) {
4345 expandoValuePersistence.remove(expandoValue);
4346 }
4347 }
4348
4349
4354 public void removeAll() throws SystemException {
4355 for (ExpandoValue expandoValue : findAll()) {
4356 expandoValuePersistence.remove(expandoValue);
4357 }
4358 }
4359
4360
4367 public int countByTableId(long tableId) throws SystemException {
4368 Object[] finderArgs = new Object[] { tableId };
4369
4370 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_TABLEID,
4371 finderArgs, this);
4372
4373 if (count == null) {
4374 StringBundler query = new StringBundler(2);
4375
4376 query.append(_SQL_COUNT_EXPANDOVALUE_WHERE);
4377
4378 query.append(_FINDER_COLUMN_TABLEID_TABLEID_2);
4379
4380 String sql = query.toString();
4381
4382 Session session = null;
4383
4384 try {
4385 session = openSession();
4386
4387 Query q = session.createQuery(sql);
4388
4389 QueryPos qPos = QueryPos.getInstance(q);
4390
4391 qPos.add(tableId);
4392
4393 count = (Long)q.uniqueResult();
4394 }
4395 catch (Exception e) {
4396 throw processException(e);
4397 }
4398 finally {
4399 if (count == null) {
4400 count = Long.valueOf(0);
4401 }
4402
4403 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TABLEID,
4404 finderArgs, count);
4405
4406 closeSession(session);
4407 }
4408 }
4409
4410 return count.intValue();
4411 }
4412
4413
4420 public int countByColumnId(long columnId) throws SystemException {
4421 Object[] finderArgs = new Object[] { columnId };
4422
4423 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COLUMNID,
4424 finderArgs, this);
4425
4426 if (count == null) {
4427 StringBundler query = new StringBundler(2);
4428
4429 query.append(_SQL_COUNT_EXPANDOVALUE_WHERE);
4430
4431 query.append(_FINDER_COLUMN_COLUMNID_COLUMNID_2);
4432
4433 String sql = query.toString();
4434
4435 Session session = null;
4436
4437 try {
4438 session = openSession();
4439
4440 Query q = session.createQuery(sql);
4441
4442 QueryPos qPos = QueryPos.getInstance(q);
4443
4444 qPos.add(columnId);
4445
4446 count = (Long)q.uniqueResult();
4447 }
4448 catch (Exception e) {
4449 throw processException(e);
4450 }
4451 finally {
4452 if (count == null) {
4453 count = Long.valueOf(0);
4454 }
4455
4456 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COLUMNID,
4457 finderArgs, count);
4458
4459 closeSession(session);
4460 }
4461 }
4462
4463 return count.intValue();
4464 }
4465
4466
4473 public int countByRowId(long rowId) throws SystemException {
4474 Object[] finderArgs = new Object[] { rowId };
4475
4476 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ROWID,
4477 finderArgs, this);
4478
4479 if (count == null) {
4480 StringBundler query = new StringBundler(2);
4481
4482 query.append(_SQL_COUNT_EXPANDOVALUE_WHERE);
4483
4484 query.append(_FINDER_COLUMN_ROWID_ROWID_2);
4485
4486 String sql = query.toString();
4487
4488 Session session = null;
4489
4490 try {
4491 session = openSession();
4492
4493 Query q = session.createQuery(sql);
4494
4495 QueryPos qPos = QueryPos.getInstance(q);
4496
4497 qPos.add(rowId);
4498
4499 count = (Long)q.uniqueResult();
4500 }
4501 catch (Exception e) {
4502 throw processException(e);
4503 }
4504 finally {
4505 if (count == null) {
4506 count = Long.valueOf(0);
4507 }
4508
4509 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ROWID,
4510 finderArgs, count);
4511
4512 closeSession(session);
4513 }
4514 }
4515
4516 return count.intValue();
4517 }
4518
4519
4527 public int countByT_C(long tableId, long columnId)
4528 throws SystemException {
4529 Object[] finderArgs = new Object[] { tableId, columnId };
4530
4531 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_T_C,
4532 finderArgs, this);
4533
4534 if (count == null) {
4535 StringBundler query = new StringBundler(3);
4536
4537 query.append(_SQL_COUNT_EXPANDOVALUE_WHERE);
4538
4539 query.append(_FINDER_COLUMN_T_C_TABLEID_2);
4540
4541 query.append(_FINDER_COLUMN_T_C_COLUMNID_2);
4542
4543 String sql = query.toString();
4544
4545 Session session = null;
4546
4547 try {
4548 session = openSession();
4549
4550 Query q = session.createQuery(sql);
4551
4552 QueryPos qPos = QueryPos.getInstance(q);
4553
4554 qPos.add(tableId);
4555
4556 qPos.add(columnId);
4557
4558 count = (Long)q.uniqueResult();
4559 }
4560 catch (Exception e) {
4561 throw processException(e);
4562 }
4563 finally {
4564 if (count == null) {
4565 count = Long.valueOf(0);
4566 }
4567
4568 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_T_C, finderArgs,
4569 count);
4570
4571 closeSession(session);
4572 }
4573 }
4574
4575 return count.intValue();
4576 }
4577
4578
4586 public int countByT_CPK(long tableId, long classPK)
4587 throws SystemException {
4588 Object[] finderArgs = new Object[] { tableId, classPK };
4589
4590 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_T_CPK,
4591 finderArgs, this);
4592
4593 if (count == null) {
4594 StringBundler query = new StringBundler(3);
4595
4596 query.append(_SQL_COUNT_EXPANDOVALUE_WHERE);
4597
4598 query.append(_FINDER_COLUMN_T_CPK_TABLEID_2);
4599
4600 query.append(_FINDER_COLUMN_T_CPK_CLASSPK_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(tableId);
4614
4615 qPos.add(classPK);
4616
4617 count = (Long)q.uniqueResult();
4618 }
4619 catch (Exception e) {
4620 throw processException(e);
4621 }
4622 finally {
4623 if (count == null) {
4624 count = Long.valueOf(0);
4625 }
4626
4627 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_T_CPK,
4628 finderArgs, count);
4629
4630 closeSession(session);
4631 }
4632 }
4633
4634 return count.intValue();
4635 }
4636
4637
4645 public int countByT_R(long tableId, long rowId) throws SystemException {
4646 Object[] finderArgs = new Object[] { tableId, rowId };
4647
4648 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_T_R,
4649 finderArgs, this);
4650
4651 if (count == null) {
4652 StringBundler query = new StringBundler(3);
4653
4654 query.append(_SQL_COUNT_EXPANDOVALUE_WHERE);
4655
4656 query.append(_FINDER_COLUMN_T_R_TABLEID_2);
4657
4658 query.append(_FINDER_COLUMN_T_R_ROWID_2);
4659
4660 String sql = query.toString();
4661
4662 Session session = null;
4663
4664 try {
4665 session = openSession();
4666
4667 Query q = session.createQuery(sql);
4668
4669 QueryPos qPos = QueryPos.getInstance(q);
4670
4671 qPos.add(tableId);
4672
4673 qPos.add(rowId);
4674
4675 count = (Long)q.uniqueResult();
4676 }
4677 catch (Exception e) {
4678 throw processException(e);
4679 }
4680 finally {
4681 if (count == null) {
4682 count = Long.valueOf(0);
4683 }
4684
4685 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_T_R, finderArgs,
4686 count);
4687
4688 closeSession(session);
4689 }
4690 }
4691
4692 return count.intValue();
4693 }
4694
4695
4703 public int countByC_R(long columnId, long rowId) throws SystemException {
4704 Object[] finderArgs = new Object[] { columnId, rowId };
4705
4706 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_R,
4707 finderArgs, this);
4708
4709 if (count == null) {
4710 StringBundler query = new StringBundler(3);
4711
4712 query.append(_SQL_COUNT_EXPANDOVALUE_WHERE);
4713
4714 query.append(_FINDER_COLUMN_C_R_COLUMNID_2);
4715
4716 query.append(_FINDER_COLUMN_C_R_ROWID_2);
4717
4718 String sql = query.toString();
4719
4720 Session session = null;
4721
4722 try {
4723 session = openSession();
4724
4725 Query q = session.createQuery(sql);
4726
4727 QueryPos qPos = QueryPos.getInstance(q);
4728
4729 qPos.add(columnId);
4730
4731 qPos.add(rowId);
4732
4733 count = (Long)q.uniqueResult();
4734 }
4735 catch (Exception e) {
4736 throw processException(e);
4737 }
4738 finally {
4739 if (count == null) {
4740 count = Long.valueOf(0);
4741 }
4742
4743 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_R, finderArgs,
4744 count);
4745
4746 closeSession(session);
4747 }
4748 }
4749
4750 return count.intValue();
4751 }
4752
4753
4761 public int countByC_C(long classNameId, long classPK)
4762 throws SystemException {
4763 Object[] finderArgs = new Object[] { classNameId, classPK };
4764
4765 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C,
4766 finderArgs, this);
4767
4768 if (count == null) {
4769 StringBundler query = new StringBundler(3);
4770
4771 query.append(_SQL_COUNT_EXPANDOVALUE_WHERE);
4772
4773 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
4774
4775 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
4776
4777 String sql = query.toString();
4778
4779 Session session = null;
4780
4781 try {
4782 session = openSession();
4783
4784 Query q = session.createQuery(sql);
4785
4786 QueryPos qPos = QueryPos.getInstance(q);
4787
4788 qPos.add(classNameId);
4789
4790 qPos.add(classPK);
4791
4792 count = (Long)q.uniqueResult();
4793 }
4794 catch (Exception e) {
4795 throw processException(e);
4796 }
4797 finally {
4798 if (count == null) {
4799 count = Long.valueOf(0);
4800 }
4801
4802 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, finderArgs,
4803 count);
4804
4805 closeSession(session);
4806 }
4807 }
4808
4809 return count.intValue();
4810 }
4811
4812
4821 public int countByT_C_C(long tableId, long columnId, long classPK)
4822 throws SystemException {
4823 Object[] finderArgs = new Object[] { tableId, columnId, classPK };
4824
4825 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_T_C_C,
4826 finderArgs, this);
4827
4828 if (count == null) {
4829 StringBundler query = new StringBundler(4);
4830
4831 query.append(_SQL_COUNT_EXPANDOVALUE_WHERE);
4832
4833 query.append(_FINDER_COLUMN_T_C_C_TABLEID_2);
4834
4835 query.append(_FINDER_COLUMN_T_C_C_COLUMNID_2);
4836
4837 query.append(_FINDER_COLUMN_T_C_C_CLASSPK_2);
4838
4839 String sql = query.toString();
4840
4841 Session session = null;
4842
4843 try {
4844 session = openSession();
4845
4846 Query q = session.createQuery(sql);
4847
4848 QueryPos qPos = QueryPos.getInstance(q);
4849
4850 qPos.add(tableId);
4851
4852 qPos.add(columnId);
4853
4854 qPos.add(classPK);
4855
4856 count = (Long)q.uniqueResult();
4857 }
4858 catch (Exception e) {
4859 throw processException(e);
4860 }
4861 finally {
4862 if (count == null) {
4863 count = Long.valueOf(0);
4864 }
4865
4866 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_T_C_C,
4867 finderArgs, count);
4868
4869 closeSession(session);
4870 }
4871 }
4872
4873 return count.intValue();
4874 }
4875
4876
4885 public int countByT_C_D(long tableId, long columnId, String data)
4886 throws SystemException {
4887 Object[] finderArgs = new Object[] { tableId, columnId, data };
4888
4889 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_T_C_D,
4890 finderArgs, this);
4891
4892 if (count == null) {
4893 StringBundler query = new StringBundler(4);
4894
4895 query.append(_SQL_COUNT_EXPANDOVALUE_WHERE);
4896
4897 query.append(_FINDER_COLUMN_T_C_D_TABLEID_2);
4898
4899 query.append(_FINDER_COLUMN_T_C_D_COLUMNID_2);
4900
4901 if (data == null) {
4902 query.append(_FINDER_COLUMN_T_C_D_DATA_1);
4903 }
4904 else {
4905 if (data.equals(StringPool.BLANK)) {
4906 query.append(_FINDER_COLUMN_T_C_D_DATA_3);
4907 }
4908 else {
4909 query.append(_FINDER_COLUMN_T_C_D_DATA_2);
4910 }
4911 }
4912
4913 String sql = query.toString();
4914
4915 Session session = null;
4916
4917 try {
4918 session = openSession();
4919
4920 Query q = session.createQuery(sql);
4921
4922 QueryPos qPos = QueryPos.getInstance(q);
4923
4924 qPos.add(tableId);
4925
4926 qPos.add(columnId);
4927
4928 if (data != null) {
4929 qPos.add(data);
4930 }
4931
4932 count = (Long)q.uniqueResult();
4933 }
4934 catch (Exception e) {
4935 throw processException(e);
4936 }
4937 finally {
4938 if (count == null) {
4939 count = Long.valueOf(0);
4940 }
4941
4942 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_T_C_D,
4943 finderArgs, count);
4944
4945 closeSession(session);
4946 }
4947 }
4948
4949 return count.intValue();
4950 }
4951
4952
4958 public int countAll() throws SystemException {
4959 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
4960 FINDER_ARGS_EMPTY, this);
4961
4962 if (count == null) {
4963 Session session = null;
4964
4965 try {
4966 session = openSession();
4967
4968 Query q = session.createQuery(_SQL_COUNT_EXPANDOVALUE);
4969
4970 count = (Long)q.uniqueResult();
4971 }
4972 catch (Exception e) {
4973 throw processException(e);
4974 }
4975 finally {
4976 if (count == null) {
4977 count = Long.valueOf(0);
4978 }
4979
4980 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
4981 FINDER_ARGS_EMPTY, count);
4982
4983 closeSession(session);
4984 }
4985 }
4986
4987 return count.intValue();
4988 }
4989
4990
4993 public void afterPropertiesSet() {
4994 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
4995 com.liferay.portal.util.PropsUtil.get(
4996 "value.object.listener.com.liferay.portlet.expando.model.ExpandoValue")));
4997
4998 if (listenerClassNames.length > 0) {
4999 try {
5000 List<ModelListener<ExpandoValue>> listenersList = new ArrayList<ModelListener<ExpandoValue>>();
5001
5002 for (String listenerClassName : listenerClassNames) {
5003 listenersList.add((ModelListener<ExpandoValue>)InstanceFactory.newInstance(
5004 listenerClassName));
5005 }
5006
5007 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
5008 }
5009 catch (Exception e) {
5010 _log.error(e);
5011 }
5012 }
5013 }
5014
5015 public void destroy() {
5016 EntityCacheUtil.removeCache(ExpandoValueImpl.class.getName());
5017 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
5018 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
5019 }
5020
5021 @BeanReference(type = ExpandoColumnPersistence.class)
5022 protected ExpandoColumnPersistence expandoColumnPersistence;
5023 @BeanReference(type = ExpandoRowPersistence.class)
5024 protected ExpandoRowPersistence expandoRowPersistence;
5025 @BeanReference(type = ExpandoTablePersistence.class)
5026 protected ExpandoTablePersistence expandoTablePersistence;
5027 @BeanReference(type = ExpandoValuePersistence.class)
5028 protected ExpandoValuePersistence expandoValuePersistence;
5029 @BeanReference(type = ResourcePersistence.class)
5030 protected ResourcePersistence resourcePersistence;
5031 @BeanReference(type = UserPersistence.class)
5032 protected UserPersistence userPersistence;
5033 private static final String _SQL_SELECT_EXPANDOVALUE = "SELECT expandoValue FROM ExpandoValue expandoValue";
5034 private static final String _SQL_SELECT_EXPANDOVALUE_WHERE = "SELECT expandoValue FROM ExpandoValue expandoValue WHERE ";
5035 private static final String _SQL_COUNT_EXPANDOVALUE = "SELECT COUNT(expandoValue) FROM ExpandoValue expandoValue";
5036 private static final String _SQL_COUNT_EXPANDOVALUE_WHERE = "SELECT COUNT(expandoValue) FROM ExpandoValue expandoValue WHERE ";
5037 private static final String _FINDER_COLUMN_TABLEID_TABLEID_2 = "expandoValue.tableId = ?";
5038 private static final String _FINDER_COLUMN_COLUMNID_COLUMNID_2 = "expandoValue.columnId = ?";
5039 private static final String _FINDER_COLUMN_ROWID_ROWID_2 = "expandoValue.rowId = ?";
5040 private static final String _FINDER_COLUMN_T_C_TABLEID_2 = "expandoValue.tableId = ? AND ";
5041 private static final String _FINDER_COLUMN_T_C_COLUMNID_2 = "expandoValue.columnId = ?";
5042 private static final String _FINDER_COLUMN_T_CPK_TABLEID_2 = "expandoValue.tableId = ? AND ";
5043 private static final String _FINDER_COLUMN_T_CPK_CLASSPK_2 = "expandoValue.classPK = ?";
5044 private static final String _FINDER_COLUMN_T_R_TABLEID_2 = "expandoValue.tableId = ? AND ";
5045 private static final String _FINDER_COLUMN_T_R_ROWID_2 = "expandoValue.rowId = ?";
5046 private static final String _FINDER_COLUMN_C_R_COLUMNID_2 = "expandoValue.columnId = ? AND ";
5047 private static final String _FINDER_COLUMN_C_R_ROWID_2 = "expandoValue.rowId = ?";
5048 private static final String _FINDER_COLUMN_C_C_CLASSNAMEID_2 = "expandoValue.classNameId = ? AND ";
5049 private static final String _FINDER_COLUMN_C_C_CLASSPK_2 = "expandoValue.classPK = ?";
5050 private static final String _FINDER_COLUMN_T_C_C_TABLEID_2 = "expandoValue.tableId = ? AND ";
5051 private static final String _FINDER_COLUMN_T_C_C_COLUMNID_2 = "expandoValue.columnId = ? AND ";
5052 private static final String _FINDER_COLUMN_T_C_C_CLASSPK_2 = "expandoValue.classPK = ?";
5053 private static final String _FINDER_COLUMN_T_C_D_TABLEID_2 = "expandoValue.tableId = ? AND ";
5054 private static final String _FINDER_COLUMN_T_C_D_COLUMNID_2 = "expandoValue.columnId = ? AND ";
5055 private static final String _FINDER_COLUMN_T_C_D_DATA_1 = "expandoValue.data IS NULL";
5056 private static final String _FINDER_COLUMN_T_C_D_DATA_2 = "expandoValue.data = ?";
5057 private static final String _FINDER_COLUMN_T_C_D_DATA_3 = "(expandoValue.data IS NULL OR expandoValue.data = ?)";
5058 private static final String _ORDER_BY_ENTITY_ALIAS = "expandoValue.";
5059 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No ExpandoValue exists with the primary key ";
5060 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No ExpandoValue exists with the key {";
5061 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
5062 private static Log _log = LogFactoryUtil.getLog(ExpandoValuePersistenceImpl.class);
5063 private static ExpandoValue _nullExpandoValue = new ExpandoValueImpl() {
5064 @Override
5065 public Object clone() {
5066 return this;
5067 }
5068
5069 @Override
5070 public CacheModel<ExpandoValue> toCacheModel() {
5071 return _nullExpandoValueCacheModel;
5072 }
5073 };
5074
5075 private static CacheModel<ExpandoValue> _nullExpandoValueCacheModel = new CacheModel<ExpandoValue>() {
5076 public ExpandoValue toEntityModel() {
5077 return _nullExpandoValue;
5078 }
5079 };
5080 }