001
014
015 package com.liferay.portlet.blogs.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.kernel.bean.BeanReference;
019 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
022 import com.liferay.portal.kernel.dao.orm.FinderPath;
023 import com.liferay.portal.kernel.dao.orm.Query;
024 import com.liferay.portal.kernel.dao.orm.QueryPos;
025 import com.liferay.portal.kernel.dao.orm.QueryUtil;
026 import com.liferay.portal.kernel.dao.orm.SQLQuery;
027 import com.liferay.portal.kernel.dao.orm.Session;
028 import com.liferay.portal.kernel.exception.SystemException;
029 import com.liferay.portal.kernel.log.Log;
030 import com.liferay.portal.kernel.log.LogFactoryUtil;
031 import com.liferay.portal.kernel.sanitizer.Sanitizer;
032 import com.liferay.portal.kernel.sanitizer.SanitizerException;
033 import com.liferay.portal.kernel.sanitizer.SanitizerUtil;
034 import com.liferay.portal.kernel.util.CalendarUtil;
035 import com.liferay.portal.kernel.util.ContentTypes;
036 import com.liferay.portal.kernel.util.GetterUtil;
037 import com.liferay.portal.kernel.util.InstanceFactory;
038 import com.liferay.portal.kernel.util.OrderByComparator;
039 import com.liferay.portal.kernel.util.StringBundler;
040 import com.liferay.portal.kernel.util.StringPool;
041 import com.liferay.portal.kernel.util.StringUtil;
042 import com.liferay.portal.kernel.util.Validator;
043 import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
044 import com.liferay.portal.model.CacheModel;
045 import com.liferay.portal.model.ModelListener;
046 import com.liferay.portal.security.auth.PrincipalThreadLocal;
047 import com.liferay.portal.security.permission.InlineSQLHelperUtil;
048 import com.liferay.portal.service.persistence.BatchSessionUtil;
049 import com.liferay.portal.service.persistence.CompanyPersistence;
050 import com.liferay.portal.service.persistence.GroupPersistence;
051 import com.liferay.portal.service.persistence.ImagePersistence;
052 import com.liferay.portal.service.persistence.OrganizationPersistence;
053 import com.liferay.portal.service.persistence.PortletPreferencesPersistence;
054 import com.liferay.portal.service.persistence.ResourcePersistence;
055 import com.liferay.portal.service.persistence.SubscriptionPersistence;
056 import com.liferay.portal.service.persistence.UserPersistence;
057 import com.liferay.portal.service.persistence.WorkflowInstanceLinkPersistence;
058 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
059
060 import com.liferay.portlet.asset.service.persistence.AssetEntryPersistence;
061 import com.liferay.portlet.asset.service.persistence.AssetLinkPersistence;
062 import com.liferay.portlet.asset.service.persistence.AssetTagPersistence;
063 import com.liferay.portlet.blogs.NoSuchEntryException;
064 import com.liferay.portlet.blogs.model.BlogsEntry;
065 import com.liferay.portlet.blogs.model.impl.BlogsEntryImpl;
066 import com.liferay.portlet.blogs.model.impl.BlogsEntryModelImpl;
067 import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
068 import com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence;
069 import com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence;
070 import com.liferay.portlet.social.service.persistence.SocialActivityPersistence;
071
072 import java.io.Serializable;
073
074 import java.util.ArrayList;
075 import java.util.Collections;
076 import java.util.Date;
077 import java.util.List;
078
079
091 public class BlogsEntryPersistenceImpl extends BasePersistenceImpl<BlogsEntry>
092 implements BlogsEntryPersistence {
093
098 public static final String FINDER_CLASS_NAME_ENTITY = BlogsEntryImpl.class.getName();
099 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
100 ".List1";
101 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
102 ".List2";
103 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
104 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
105 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUuid",
106 new String[] {
107 String.class.getName(),
108
109 "java.lang.Integer", "java.lang.Integer",
110 "com.liferay.portal.kernel.util.OrderByComparator"
111 });
112 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
113 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
114 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid",
115 new String[] { String.class.getName() },
116 BlogsEntryModelImpl.UUID_COLUMN_BITMASK);
117 public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
118 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
119 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid",
120 new String[] { String.class.getName() });
121 public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
122 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
123 FINDER_CLASS_NAME_ENTITY, "fetchByUUID_G",
124 new String[] { String.class.getName(), Long.class.getName() },
125 BlogsEntryModelImpl.UUID_COLUMN_BITMASK |
126 BlogsEntryModelImpl.GROUPID_COLUMN_BITMASK);
127 public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
128 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
129 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUUID_G",
130 new String[] { String.class.getName(), Long.class.getName() });
131 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
132 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
133 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByGroupId",
134 new String[] {
135 Long.class.getName(),
136
137 "java.lang.Integer", "java.lang.Integer",
138 "com.liferay.portal.kernel.util.OrderByComparator"
139 });
140 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID =
141 new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
142 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
143 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByGroupId",
144 new String[] { Long.class.getName() },
145 BlogsEntryModelImpl.GROUPID_COLUMN_BITMASK);
146 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
147 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
148 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByGroupId",
149 new String[] { Long.class.getName() });
150 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID =
151 new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
152 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
153 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByCompanyId",
154 new String[] {
155 Long.class.getName(),
156
157 "java.lang.Integer", "java.lang.Integer",
158 "com.liferay.portal.kernel.util.OrderByComparator"
159 });
160 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID =
161 new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
162 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
163 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByCompanyId",
164 new String[] { Long.class.getName() },
165 BlogsEntryModelImpl.COMPANYID_COLUMN_BITMASK);
166 public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
167 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
168 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByCompanyId",
169 new String[] { Long.class.getName() });
170 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_U = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
171 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
172 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_U",
173 new String[] {
174 Long.class.getName(), Long.class.getName(),
175
176 "java.lang.Integer", "java.lang.Integer",
177 "com.liferay.portal.kernel.util.OrderByComparator"
178 });
179 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_U = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
180 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
181 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_U",
182 new String[] { Long.class.getName(), Long.class.getName() },
183 BlogsEntryModelImpl.COMPANYID_COLUMN_BITMASK |
184 BlogsEntryModelImpl.USERID_COLUMN_BITMASK);
185 public static final FinderPath FINDER_PATH_COUNT_BY_C_U = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
186 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
187 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_U",
188 new String[] { Long.class.getName(), Long.class.getName() });
189 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_LTD = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
190 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
191 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_LtD",
192 new String[] {
193 Long.class.getName(), Date.class.getName(),
194
195 "java.lang.Integer", "java.lang.Integer",
196 "com.liferay.portal.kernel.util.OrderByComparator"
197 });
198 public static final FinderPath FINDER_PATH_WITH_PAGINATION_COUNT_BY_C_LTD = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
199 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
200 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByC_LtD",
201 new String[] { Long.class.getName(), Date.class.getName() });
202 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
203 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
204 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_S",
205 new String[] {
206 Long.class.getName(), Integer.class.getName(),
207
208 "java.lang.Integer", "java.lang.Integer",
209 "com.liferay.portal.kernel.util.OrderByComparator"
210 });
211 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
212 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
213 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_S",
214 new String[] { Long.class.getName(), Integer.class.getName() },
215 BlogsEntryModelImpl.COMPANYID_COLUMN_BITMASK |
216 BlogsEntryModelImpl.STATUS_COLUMN_BITMASK);
217 public static final FinderPath FINDER_PATH_COUNT_BY_C_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
218 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
219 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_S",
220 new String[] { Long.class.getName(), Integer.class.getName() });
221 public static final FinderPath FINDER_PATH_FETCH_BY_G_UT = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
222 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
223 FINDER_CLASS_NAME_ENTITY, "fetchByG_UT",
224 new String[] { Long.class.getName(), String.class.getName() },
225 BlogsEntryModelImpl.GROUPID_COLUMN_BITMASK |
226 BlogsEntryModelImpl.URLTITLE_COLUMN_BITMASK);
227 public static final FinderPath FINDER_PATH_COUNT_BY_G_UT = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
228 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
229 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_UT",
230 new String[] { Long.class.getName(), String.class.getName() });
231 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_LTD = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
232 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
233 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_LtD",
234 new String[] {
235 Long.class.getName(), Date.class.getName(),
236
237 "java.lang.Integer", "java.lang.Integer",
238 "com.liferay.portal.kernel.util.OrderByComparator"
239 });
240 public static final FinderPath FINDER_PATH_WITH_PAGINATION_COUNT_BY_G_LTD = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
241 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
242 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByG_LtD",
243 new String[] { Long.class.getName(), Date.class.getName() });
244 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
245 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
246 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_S",
247 new String[] {
248 Long.class.getName(), Integer.class.getName(),
249
250 "java.lang.Integer", "java.lang.Integer",
251 "com.liferay.portal.kernel.util.OrderByComparator"
252 });
253 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
254 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
255 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_S",
256 new String[] { Long.class.getName(), Integer.class.getName() },
257 BlogsEntryModelImpl.GROUPID_COLUMN_BITMASK |
258 BlogsEntryModelImpl.STATUS_COLUMN_BITMASK);
259 public static final FinderPath FINDER_PATH_COUNT_BY_G_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
260 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
261 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_S",
262 new String[] { Long.class.getName(), Integer.class.getName() });
263 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_LTD_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
264 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
265 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByLtD_S",
266 new String[] {
267 Date.class.getName(), Integer.class.getName(),
268
269 "java.lang.Integer", "java.lang.Integer",
270 "com.liferay.portal.kernel.util.OrderByComparator"
271 });
272 public static final FinderPath FINDER_PATH_WITH_PAGINATION_COUNT_BY_LTD_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
273 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
274 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByLtD_S",
275 new String[] { Date.class.getName(), Integer.class.getName() });
276 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_U_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
277 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
278 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_U_S",
279 new String[] {
280 Long.class.getName(), Long.class.getName(),
281 Integer.class.getName(),
282
283 "java.lang.Integer", "java.lang.Integer",
284 "com.liferay.portal.kernel.util.OrderByComparator"
285 });
286 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_U_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
287 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
288 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_U_S",
289 new String[] {
290 Long.class.getName(), Long.class.getName(),
291 Integer.class.getName()
292 },
293 BlogsEntryModelImpl.COMPANYID_COLUMN_BITMASK |
294 BlogsEntryModelImpl.USERID_COLUMN_BITMASK |
295 BlogsEntryModelImpl.STATUS_COLUMN_BITMASK);
296 public static final FinderPath FINDER_PATH_COUNT_BY_C_U_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
297 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
298 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_U_S",
299 new String[] {
300 Long.class.getName(), Long.class.getName(),
301 Integer.class.getName()
302 });
303 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_LTD_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
304 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
305 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_LtD_S",
306 new String[] {
307 Long.class.getName(), Date.class.getName(),
308 Integer.class.getName(),
309
310 "java.lang.Integer", "java.lang.Integer",
311 "com.liferay.portal.kernel.util.OrderByComparator"
312 });
313 public static final FinderPath FINDER_PATH_WITH_PAGINATION_COUNT_BY_C_LTD_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
314 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
315 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByC_LtD_S",
316 new String[] {
317 Long.class.getName(), Date.class.getName(),
318 Integer.class.getName()
319 });
320 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_U_LTD = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
321 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
322 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_U_LtD",
323 new String[] {
324 Long.class.getName(), Long.class.getName(), Date.class.getName(),
325
326 "java.lang.Integer", "java.lang.Integer",
327 "com.liferay.portal.kernel.util.OrderByComparator"
328 });
329 public static final FinderPath FINDER_PATH_WITH_PAGINATION_COUNT_BY_G_U_LTD = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
330 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
331 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByG_U_LtD",
332 new String[] {
333 Long.class.getName(), Long.class.getName(), Date.class.getName()
334 });
335 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_U_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
336 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
337 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_U_S",
338 new String[] {
339 Long.class.getName(), Long.class.getName(),
340 Integer.class.getName(),
341
342 "java.lang.Integer", "java.lang.Integer",
343 "com.liferay.portal.kernel.util.OrderByComparator"
344 });
345 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
346 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
347 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_U_S",
348 new String[] {
349 Long.class.getName(), Long.class.getName(),
350 Integer.class.getName()
351 },
352 BlogsEntryModelImpl.GROUPID_COLUMN_BITMASK |
353 BlogsEntryModelImpl.USERID_COLUMN_BITMASK |
354 BlogsEntryModelImpl.STATUS_COLUMN_BITMASK);
355 public static final FinderPath FINDER_PATH_COUNT_BY_G_U_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
356 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
357 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_U_S",
358 new String[] {
359 Long.class.getName(), Long.class.getName(),
360 Integer.class.getName()
361 });
362 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_LTD_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
363 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
364 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_LtD_S",
365 new String[] {
366 Long.class.getName(), Date.class.getName(),
367 Integer.class.getName(),
368
369 "java.lang.Integer", "java.lang.Integer",
370 "com.liferay.portal.kernel.util.OrderByComparator"
371 });
372 public static final FinderPath FINDER_PATH_WITH_PAGINATION_COUNT_BY_G_LTD_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
373 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
374 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByG_LtD_S",
375 new String[] {
376 Long.class.getName(), Date.class.getName(),
377 Integer.class.getName()
378 });
379 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_U_LTD_S =
380 new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
381 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
382 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_U_LtD_S",
383 new String[] {
384 Long.class.getName(), Long.class.getName(), Date.class.getName(),
385 Integer.class.getName(),
386
387 "java.lang.Integer", "java.lang.Integer",
388 "com.liferay.portal.kernel.util.OrderByComparator"
389 });
390 public static final FinderPath FINDER_PATH_WITH_PAGINATION_COUNT_BY_G_U_LTD_S =
391 new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
392 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
393 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByG_U_LtD_S",
394 new String[] {
395 Long.class.getName(), Long.class.getName(), Date.class.getName(),
396 Integer.class.getName()
397 });
398 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
399 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
400 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
401 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
402 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
403 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
404 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
405 BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
406 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
407
408
413 public void cacheResult(BlogsEntry blogsEntry) {
414 EntityCacheUtil.putResult(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
415 BlogsEntryImpl.class, blogsEntry.getPrimaryKey(), blogsEntry);
416
417 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
418 new Object[] {
419 blogsEntry.getUuid(), Long.valueOf(blogsEntry.getGroupId())
420 }, blogsEntry);
421
422 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_UT,
423 new Object[] {
424 Long.valueOf(blogsEntry.getGroupId()),
425
426 blogsEntry.getUrlTitle()
427 }, blogsEntry);
428
429 blogsEntry.resetOriginalValues();
430 }
431
432
437 public void cacheResult(List<BlogsEntry> blogsEntries) {
438 for (BlogsEntry blogsEntry : blogsEntries) {
439 if (EntityCacheUtil.getResult(
440 BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
441 BlogsEntryImpl.class, blogsEntry.getPrimaryKey()) == null) {
442 cacheResult(blogsEntry);
443 }
444 else {
445 blogsEntry.resetOriginalValues();
446 }
447 }
448 }
449
450
457 @Override
458 public void clearCache() {
459 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
460 CacheRegistryUtil.clear(BlogsEntryImpl.class.getName());
461 }
462
463 EntityCacheUtil.clearCache(BlogsEntryImpl.class.getName());
464
465 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
466 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
467 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
468 }
469
470
477 @Override
478 public void clearCache(BlogsEntry blogsEntry) {
479 EntityCacheUtil.removeResult(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
480 BlogsEntryImpl.class, blogsEntry.getPrimaryKey());
481
482 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
483 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
484
485 clearUniqueFindersCache(blogsEntry);
486 }
487
488 @Override
489 public void clearCache(List<BlogsEntry> blogsEntries) {
490 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
491 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
492
493 for (BlogsEntry blogsEntry : blogsEntries) {
494 EntityCacheUtil.removeResult(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
495 BlogsEntryImpl.class, blogsEntry.getPrimaryKey());
496
497 clearUniqueFindersCache(blogsEntry);
498 }
499 }
500
501 protected void clearUniqueFindersCache(BlogsEntry blogsEntry) {
502 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
503 new Object[] {
504 blogsEntry.getUuid(), Long.valueOf(blogsEntry.getGroupId())
505 });
506
507 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_UT,
508 new Object[] {
509 Long.valueOf(blogsEntry.getGroupId()),
510
511 blogsEntry.getUrlTitle()
512 });
513 }
514
515
521 public BlogsEntry create(long entryId) {
522 BlogsEntry blogsEntry = new BlogsEntryImpl();
523
524 blogsEntry.setNew(true);
525 blogsEntry.setPrimaryKey(entryId);
526
527 String uuid = PortalUUIDUtil.generate();
528
529 blogsEntry.setUuid(uuid);
530
531 return blogsEntry;
532 }
533
534
542 public BlogsEntry remove(long entryId)
543 throws NoSuchEntryException, SystemException {
544 return remove(Long.valueOf(entryId));
545 }
546
547
555 @Override
556 public BlogsEntry remove(Serializable primaryKey)
557 throws NoSuchEntryException, SystemException {
558 Session session = null;
559
560 try {
561 session = openSession();
562
563 BlogsEntry blogsEntry = (BlogsEntry)session.get(BlogsEntryImpl.class,
564 primaryKey);
565
566 if (blogsEntry == null) {
567 if (_log.isWarnEnabled()) {
568 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
569 }
570
571 throw new NoSuchEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
572 primaryKey);
573 }
574
575 return remove(blogsEntry);
576 }
577 catch (NoSuchEntryException nsee) {
578 throw nsee;
579 }
580 catch (Exception e) {
581 throw processException(e);
582 }
583 finally {
584 closeSession(session);
585 }
586 }
587
588 @Override
589 protected BlogsEntry removeImpl(BlogsEntry blogsEntry)
590 throws SystemException {
591 blogsEntry = toUnwrappedModel(blogsEntry);
592
593 Session session = null;
594
595 try {
596 session = openSession();
597
598 BatchSessionUtil.delete(session, blogsEntry);
599 }
600 catch (Exception e) {
601 throw processException(e);
602 }
603 finally {
604 closeSession(session);
605 }
606
607 clearCache(blogsEntry);
608
609 return blogsEntry;
610 }
611
612 @Override
613 public BlogsEntry updateImpl(
614 com.liferay.portlet.blogs.model.BlogsEntry blogsEntry, boolean merge)
615 throws SystemException {
616 blogsEntry = toUnwrappedModel(blogsEntry);
617
618 boolean isNew = blogsEntry.isNew();
619
620 BlogsEntryModelImpl blogsEntryModelImpl = (BlogsEntryModelImpl)blogsEntry;
621
622 if (Validator.isNull(blogsEntry.getUuid())) {
623 String uuid = PortalUUIDUtil.generate();
624
625 blogsEntry.setUuid(uuid);
626 }
627
628 long userId = GetterUtil.getLong(PrincipalThreadLocal.getName());
629
630 if (userId > 0) {
631 long companyId = blogsEntry.getCompanyId();
632
633 long groupId = blogsEntry.getGroupId();
634
635 long entryId = 0;
636
637 if (!isNew) {
638 entryId = blogsEntry.getPrimaryKey();
639 }
640
641 try {
642 blogsEntry.setTitle(SanitizerUtil.sanitize(companyId, groupId,
643 userId,
644 com.liferay.portlet.blogs.model.BlogsEntry.class.getName(),
645 entryId, ContentTypes.TEXT_PLAIN, Sanitizer.MODE_ALL,
646 blogsEntry.getTitle(), null));
647
648 blogsEntry.setContent(SanitizerUtil.sanitize(companyId,
649 groupId, userId,
650 com.liferay.portlet.blogs.model.BlogsEntry.class.getName(),
651 entryId, ContentTypes.TEXT_HTML, Sanitizer.MODE_ALL,
652 blogsEntry.getContent(), null));
653 }
654 catch (SanitizerException se) {
655 throw new SystemException(se);
656 }
657 }
658
659 Session session = null;
660
661 try {
662 session = openSession();
663
664 BatchSessionUtil.update(session, blogsEntry, merge);
665
666 blogsEntry.setNew(false);
667 }
668 catch (Exception e) {
669 throw processException(e);
670 }
671 finally {
672 closeSession(session);
673 }
674
675 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
676
677 if (isNew || !BlogsEntryModelImpl.COLUMN_BITMASK_ENABLED) {
678 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
679 }
680
681 else {
682 if ((blogsEntryModelImpl.getColumnBitmask() &
683 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID.getColumnBitmask()) != 0) {
684 Object[] args = new Object[] {
685 blogsEntryModelImpl.getOriginalUuid()
686 };
687
688 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
689 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
690 args);
691
692 args = new Object[] { blogsEntryModelImpl.getUuid() };
693
694 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
695 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
696 args);
697 }
698
699 if ((blogsEntryModelImpl.getColumnBitmask() &
700 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
701 Object[] args = new Object[] {
702 Long.valueOf(blogsEntryModelImpl.getOriginalGroupId())
703 };
704
705 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
706 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
707 args);
708
709 args = new Object[] {
710 Long.valueOf(blogsEntryModelImpl.getGroupId())
711 };
712
713 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
714 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
715 args);
716 }
717
718 if ((blogsEntryModelImpl.getColumnBitmask() &
719 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID.getColumnBitmask()) != 0) {
720 Object[] args = new Object[] {
721 Long.valueOf(blogsEntryModelImpl.getOriginalCompanyId())
722 };
723
724 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
725 args);
726 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
727 args);
728
729 args = new Object[] {
730 Long.valueOf(blogsEntryModelImpl.getCompanyId())
731 };
732
733 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
734 args);
735 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
736 args);
737 }
738
739 if ((blogsEntryModelImpl.getColumnBitmask() &
740 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_U.getColumnBitmask()) != 0) {
741 Object[] args = new Object[] {
742 Long.valueOf(blogsEntryModelImpl.getOriginalCompanyId()),
743 Long.valueOf(blogsEntryModelImpl.getOriginalUserId())
744 };
745
746 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_U, args);
747 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_U,
748 args);
749
750 args = new Object[] {
751 Long.valueOf(blogsEntryModelImpl.getCompanyId()),
752 Long.valueOf(blogsEntryModelImpl.getUserId())
753 };
754
755 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_U, args);
756 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_U,
757 args);
758 }
759
760 if ((blogsEntryModelImpl.getColumnBitmask() &
761 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_S.getColumnBitmask()) != 0) {
762 Object[] args = new Object[] {
763 Long.valueOf(blogsEntryModelImpl.getOriginalCompanyId()),
764 Integer.valueOf(blogsEntryModelImpl.getOriginalStatus())
765 };
766
767 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_S, args);
768 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_S,
769 args);
770
771 args = new Object[] {
772 Long.valueOf(blogsEntryModelImpl.getCompanyId()),
773 Integer.valueOf(blogsEntryModelImpl.getStatus())
774 };
775
776 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_S, args);
777 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_S,
778 args);
779 }
780
781 if ((blogsEntryModelImpl.getColumnBitmask() &
782 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S.getColumnBitmask()) != 0) {
783 Object[] args = new Object[] {
784 Long.valueOf(blogsEntryModelImpl.getOriginalGroupId()),
785 Integer.valueOf(blogsEntryModelImpl.getOriginalStatus())
786 };
787
788 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_S, args);
789 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S,
790 args);
791
792 args = new Object[] {
793 Long.valueOf(blogsEntryModelImpl.getGroupId()),
794 Integer.valueOf(blogsEntryModelImpl.getStatus())
795 };
796
797 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_S, args);
798 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S,
799 args);
800 }
801
802 if ((blogsEntryModelImpl.getColumnBitmask() &
803 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_U_S.getColumnBitmask()) != 0) {
804 Object[] args = new Object[] {
805 Long.valueOf(blogsEntryModelImpl.getOriginalCompanyId()),
806 Long.valueOf(blogsEntryModelImpl.getOriginalUserId()),
807 Integer.valueOf(blogsEntryModelImpl.getOriginalStatus())
808 };
809
810 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_U_S, args);
811 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_U_S,
812 args);
813
814 args = new Object[] {
815 Long.valueOf(blogsEntryModelImpl.getCompanyId()),
816 Long.valueOf(blogsEntryModelImpl.getUserId()),
817 Integer.valueOf(blogsEntryModelImpl.getStatus())
818 };
819
820 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_U_S, args);
821 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_U_S,
822 args);
823 }
824
825 if ((blogsEntryModelImpl.getColumnBitmask() &
826 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U_S.getColumnBitmask()) != 0) {
827 Object[] args = new Object[] {
828 Long.valueOf(blogsEntryModelImpl.getOriginalGroupId()),
829 Long.valueOf(blogsEntryModelImpl.getOriginalUserId()),
830 Integer.valueOf(blogsEntryModelImpl.getOriginalStatus())
831 };
832
833 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_U_S, args);
834 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U_S,
835 args);
836
837 args = new Object[] {
838 Long.valueOf(blogsEntryModelImpl.getGroupId()),
839 Long.valueOf(blogsEntryModelImpl.getUserId()),
840 Integer.valueOf(blogsEntryModelImpl.getStatus())
841 };
842
843 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_U_S, args);
844 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U_S,
845 args);
846 }
847 }
848
849 EntityCacheUtil.putResult(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
850 BlogsEntryImpl.class, blogsEntry.getPrimaryKey(), blogsEntry);
851
852 if (isNew) {
853 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
854 new Object[] {
855 blogsEntry.getUuid(), Long.valueOf(blogsEntry.getGroupId())
856 }, blogsEntry);
857
858 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_UT,
859 new Object[] {
860 Long.valueOf(blogsEntry.getGroupId()),
861
862 blogsEntry.getUrlTitle()
863 }, blogsEntry);
864 }
865 else {
866 if ((blogsEntryModelImpl.getColumnBitmask() &
867 FINDER_PATH_FETCH_BY_UUID_G.getColumnBitmask()) != 0) {
868 Object[] args = new Object[] {
869 blogsEntryModelImpl.getOriginalUuid(),
870 Long.valueOf(blogsEntryModelImpl.getOriginalGroupId())
871 };
872
873 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_G, args);
874
875 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G, args);
876
877 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
878 new Object[] {
879 blogsEntry.getUuid(),
880 Long.valueOf(blogsEntry.getGroupId())
881 }, blogsEntry);
882 }
883
884 if ((blogsEntryModelImpl.getColumnBitmask() &
885 FINDER_PATH_FETCH_BY_G_UT.getColumnBitmask()) != 0) {
886 Object[] args = new Object[] {
887 Long.valueOf(blogsEntryModelImpl.getOriginalGroupId()),
888
889 blogsEntryModelImpl.getOriginalUrlTitle()
890 };
891
892 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_UT, args);
893
894 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_UT, args);
895
896 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_UT,
897 new Object[] {
898 Long.valueOf(blogsEntry.getGroupId()),
899
900 blogsEntry.getUrlTitle()
901 }, blogsEntry);
902 }
903 }
904
905 return blogsEntry;
906 }
907
908 protected BlogsEntry toUnwrappedModel(BlogsEntry blogsEntry) {
909 if (blogsEntry instanceof BlogsEntryImpl) {
910 return blogsEntry;
911 }
912
913 BlogsEntryImpl blogsEntryImpl = new BlogsEntryImpl();
914
915 blogsEntryImpl.setNew(blogsEntry.isNew());
916 blogsEntryImpl.setPrimaryKey(blogsEntry.getPrimaryKey());
917
918 blogsEntryImpl.setUuid(blogsEntry.getUuid());
919 blogsEntryImpl.setEntryId(blogsEntry.getEntryId());
920 blogsEntryImpl.setGroupId(blogsEntry.getGroupId());
921 blogsEntryImpl.setCompanyId(blogsEntry.getCompanyId());
922 blogsEntryImpl.setUserId(blogsEntry.getUserId());
923 blogsEntryImpl.setUserName(blogsEntry.getUserName());
924 blogsEntryImpl.setCreateDate(blogsEntry.getCreateDate());
925 blogsEntryImpl.setModifiedDate(blogsEntry.getModifiedDate());
926 blogsEntryImpl.setTitle(blogsEntry.getTitle());
927 blogsEntryImpl.setUrlTitle(blogsEntry.getUrlTitle());
928 blogsEntryImpl.setDescription(blogsEntry.getDescription());
929 blogsEntryImpl.setContent(blogsEntry.getContent());
930 blogsEntryImpl.setDisplayDate(blogsEntry.getDisplayDate());
931 blogsEntryImpl.setAllowPingbacks(blogsEntry.isAllowPingbacks());
932 blogsEntryImpl.setAllowTrackbacks(blogsEntry.isAllowTrackbacks());
933 blogsEntryImpl.setTrackbacks(blogsEntry.getTrackbacks());
934 blogsEntryImpl.setSmallImage(blogsEntry.isSmallImage());
935 blogsEntryImpl.setSmallImageId(blogsEntry.getSmallImageId());
936 blogsEntryImpl.setSmallImageURL(blogsEntry.getSmallImageURL());
937 blogsEntryImpl.setStatus(blogsEntry.getStatus());
938 blogsEntryImpl.setStatusByUserId(blogsEntry.getStatusByUserId());
939 blogsEntryImpl.setStatusByUserName(blogsEntry.getStatusByUserName());
940 blogsEntryImpl.setStatusDate(blogsEntry.getStatusDate());
941
942 return blogsEntryImpl;
943 }
944
945
953 @Override
954 public BlogsEntry findByPrimaryKey(Serializable primaryKey)
955 throws NoSuchModelException, SystemException {
956 return findByPrimaryKey(((Long)primaryKey).longValue());
957 }
958
959
967 public BlogsEntry findByPrimaryKey(long entryId)
968 throws NoSuchEntryException, SystemException {
969 BlogsEntry blogsEntry = fetchByPrimaryKey(entryId);
970
971 if (blogsEntry == null) {
972 if (_log.isWarnEnabled()) {
973 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + entryId);
974 }
975
976 throw new NoSuchEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
977 entryId);
978 }
979
980 return blogsEntry;
981 }
982
983
990 @Override
991 public BlogsEntry fetchByPrimaryKey(Serializable primaryKey)
992 throws SystemException {
993 return fetchByPrimaryKey(((Long)primaryKey).longValue());
994 }
995
996
1003 public BlogsEntry fetchByPrimaryKey(long entryId) throws SystemException {
1004 BlogsEntry blogsEntry = (BlogsEntry)EntityCacheUtil.getResult(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
1005 BlogsEntryImpl.class, entryId);
1006
1007 if (blogsEntry == _nullBlogsEntry) {
1008 return null;
1009 }
1010
1011 if (blogsEntry == null) {
1012 Session session = null;
1013
1014 boolean hasException = false;
1015
1016 try {
1017 session = openSession();
1018
1019 blogsEntry = (BlogsEntry)session.get(BlogsEntryImpl.class,
1020 Long.valueOf(entryId));
1021 }
1022 catch (Exception e) {
1023 hasException = true;
1024
1025 throw processException(e);
1026 }
1027 finally {
1028 if (blogsEntry != null) {
1029 cacheResult(blogsEntry);
1030 }
1031 else if (!hasException) {
1032 EntityCacheUtil.putResult(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
1033 BlogsEntryImpl.class, entryId, _nullBlogsEntry);
1034 }
1035
1036 closeSession(session);
1037 }
1038 }
1039
1040 return blogsEntry;
1041 }
1042
1043
1050 public List<BlogsEntry> findByUuid(String uuid) throws SystemException {
1051 return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1052 }
1053
1054
1067 public List<BlogsEntry> findByUuid(String uuid, int start, int end)
1068 throws SystemException {
1069 return findByUuid(uuid, start, end, null);
1070 }
1071
1072
1086 public List<BlogsEntry> findByUuid(String uuid, int start, int end,
1087 OrderByComparator orderByComparator) throws SystemException {
1088 FinderPath finderPath = null;
1089 Object[] finderArgs = null;
1090
1091 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1092 (orderByComparator == null)) {
1093 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID;
1094 finderArgs = new Object[] { uuid };
1095 }
1096 else {
1097 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID;
1098 finderArgs = new Object[] { uuid, start, end, orderByComparator };
1099 }
1100
1101 List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
1102 finderArgs, this);
1103
1104 if ((list != null) && !list.isEmpty()) {
1105 for (BlogsEntry blogsEntry : list) {
1106 if (!Validator.equals(uuid, blogsEntry.getUuid())) {
1107 list = null;
1108
1109 break;
1110 }
1111 }
1112 }
1113
1114 if (list == null) {
1115 StringBundler query = null;
1116
1117 if (orderByComparator != null) {
1118 query = new StringBundler(3 +
1119 (orderByComparator.getOrderByFields().length * 3));
1120 }
1121 else {
1122 query = new StringBundler(3);
1123 }
1124
1125 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1126
1127 if (uuid == null) {
1128 query.append(_FINDER_COLUMN_UUID_UUID_1);
1129 }
1130 else {
1131 if (uuid.equals(StringPool.BLANK)) {
1132 query.append(_FINDER_COLUMN_UUID_UUID_3);
1133 }
1134 else {
1135 query.append(_FINDER_COLUMN_UUID_UUID_2);
1136 }
1137 }
1138
1139 if (orderByComparator != null) {
1140 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1141 orderByComparator);
1142 }
1143
1144 else {
1145 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1146 }
1147
1148 String sql = query.toString();
1149
1150 Session session = null;
1151
1152 try {
1153 session = openSession();
1154
1155 Query q = session.createQuery(sql);
1156
1157 QueryPos qPos = QueryPos.getInstance(q);
1158
1159 if (uuid != null) {
1160 qPos.add(uuid);
1161 }
1162
1163 list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
1164 end);
1165 }
1166 catch (Exception e) {
1167 throw processException(e);
1168 }
1169 finally {
1170 if (list == null) {
1171 FinderCacheUtil.removeResult(finderPath, finderArgs);
1172 }
1173 else {
1174 cacheResult(list);
1175
1176 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1177 }
1178
1179 closeSession(session);
1180 }
1181 }
1182
1183 return list;
1184 }
1185
1186
1195 public BlogsEntry findByUuid_First(String uuid,
1196 OrderByComparator orderByComparator)
1197 throws NoSuchEntryException, SystemException {
1198 BlogsEntry blogsEntry = fetchByUuid_First(uuid, orderByComparator);
1199
1200 if (blogsEntry != null) {
1201 return blogsEntry;
1202 }
1203
1204 StringBundler msg = new StringBundler(4);
1205
1206 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1207
1208 msg.append("uuid=");
1209 msg.append(uuid);
1210
1211 msg.append(StringPool.CLOSE_CURLY_BRACE);
1212
1213 throw new NoSuchEntryException(msg.toString());
1214 }
1215
1216
1224 public BlogsEntry fetchByUuid_First(String uuid,
1225 OrderByComparator orderByComparator) throws SystemException {
1226 List<BlogsEntry> list = findByUuid(uuid, 0, 1, orderByComparator);
1227
1228 if (!list.isEmpty()) {
1229 return list.get(0);
1230 }
1231
1232 return null;
1233 }
1234
1235
1244 public BlogsEntry findByUuid_Last(String uuid,
1245 OrderByComparator orderByComparator)
1246 throws NoSuchEntryException, SystemException {
1247 BlogsEntry blogsEntry = fetchByUuid_Last(uuid, orderByComparator);
1248
1249 if (blogsEntry != null) {
1250 return blogsEntry;
1251 }
1252
1253 StringBundler msg = new StringBundler(4);
1254
1255 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1256
1257 msg.append("uuid=");
1258 msg.append(uuid);
1259
1260 msg.append(StringPool.CLOSE_CURLY_BRACE);
1261
1262 throw new NoSuchEntryException(msg.toString());
1263 }
1264
1265
1273 public BlogsEntry fetchByUuid_Last(String uuid,
1274 OrderByComparator orderByComparator) throws SystemException {
1275 int count = countByUuid(uuid);
1276
1277 List<BlogsEntry> list = findByUuid(uuid, count - 1, count,
1278 orderByComparator);
1279
1280 if (!list.isEmpty()) {
1281 return list.get(0);
1282 }
1283
1284 return null;
1285 }
1286
1287
1297 public BlogsEntry[] findByUuid_PrevAndNext(long entryId, String uuid,
1298 OrderByComparator orderByComparator)
1299 throws NoSuchEntryException, SystemException {
1300 BlogsEntry blogsEntry = findByPrimaryKey(entryId);
1301
1302 Session session = null;
1303
1304 try {
1305 session = openSession();
1306
1307 BlogsEntry[] array = new BlogsEntryImpl[3];
1308
1309 array[0] = getByUuid_PrevAndNext(session, blogsEntry, uuid,
1310 orderByComparator, true);
1311
1312 array[1] = blogsEntry;
1313
1314 array[2] = getByUuid_PrevAndNext(session, blogsEntry, uuid,
1315 orderByComparator, false);
1316
1317 return array;
1318 }
1319 catch (Exception e) {
1320 throw processException(e);
1321 }
1322 finally {
1323 closeSession(session);
1324 }
1325 }
1326
1327 protected BlogsEntry getByUuid_PrevAndNext(Session session,
1328 BlogsEntry blogsEntry, String uuid,
1329 OrderByComparator orderByComparator, boolean previous) {
1330 StringBundler query = null;
1331
1332 if (orderByComparator != null) {
1333 query = new StringBundler(6 +
1334 (orderByComparator.getOrderByFields().length * 6));
1335 }
1336 else {
1337 query = new StringBundler(3);
1338 }
1339
1340 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1341
1342 if (uuid == null) {
1343 query.append(_FINDER_COLUMN_UUID_UUID_1);
1344 }
1345 else {
1346 if (uuid.equals(StringPool.BLANK)) {
1347 query.append(_FINDER_COLUMN_UUID_UUID_3);
1348 }
1349 else {
1350 query.append(_FINDER_COLUMN_UUID_UUID_2);
1351 }
1352 }
1353
1354 if (orderByComparator != null) {
1355 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1356
1357 if (orderByConditionFields.length > 0) {
1358 query.append(WHERE_AND);
1359 }
1360
1361 for (int i = 0; i < orderByConditionFields.length; i++) {
1362 query.append(_ORDER_BY_ENTITY_ALIAS);
1363 query.append(orderByConditionFields[i]);
1364
1365 if ((i + 1) < orderByConditionFields.length) {
1366 if (orderByComparator.isAscending() ^ previous) {
1367 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1368 }
1369 else {
1370 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1371 }
1372 }
1373 else {
1374 if (orderByComparator.isAscending() ^ previous) {
1375 query.append(WHERE_GREATER_THAN);
1376 }
1377 else {
1378 query.append(WHERE_LESSER_THAN);
1379 }
1380 }
1381 }
1382
1383 query.append(ORDER_BY_CLAUSE);
1384
1385 String[] orderByFields = orderByComparator.getOrderByFields();
1386
1387 for (int i = 0; i < orderByFields.length; i++) {
1388 query.append(_ORDER_BY_ENTITY_ALIAS);
1389 query.append(orderByFields[i]);
1390
1391 if ((i + 1) < orderByFields.length) {
1392 if (orderByComparator.isAscending() ^ previous) {
1393 query.append(ORDER_BY_ASC_HAS_NEXT);
1394 }
1395 else {
1396 query.append(ORDER_BY_DESC_HAS_NEXT);
1397 }
1398 }
1399 else {
1400 if (orderByComparator.isAscending() ^ previous) {
1401 query.append(ORDER_BY_ASC);
1402 }
1403 else {
1404 query.append(ORDER_BY_DESC);
1405 }
1406 }
1407 }
1408 }
1409
1410 else {
1411 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1412 }
1413
1414 String sql = query.toString();
1415
1416 Query q = session.createQuery(sql);
1417
1418 q.setFirstResult(0);
1419 q.setMaxResults(2);
1420
1421 QueryPos qPos = QueryPos.getInstance(q);
1422
1423 if (uuid != null) {
1424 qPos.add(uuid);
1425 }
1426
1427 if (orderByComparator != null) {
1428 Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
1429
1430 for (Object value : values) {
1431 qPos.add(value);
1432 }
1433 }
1434
1435 List<BlogsEntry> list = q.list();
1436
1437 if (list.size() == 2) {
1438 return list.get(1);
1439 }
1440 else {
1441 return null;
1442 }
1443 }
1444
1445
1454 public BlogsEntry findByUUID_G(String uuid, long groupId)
1455 throws NoSuchEntryException, SystemException {
1456 BlogsEntry blogsEntry = fetchByUUID_G(uuid, groupId);
1457
1458 if (blogsEntry == null) {
1459 StringBundler msg = new StringBundler(6);
1460
1461 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1462
1463 msg.append("uuid=");
1464 msg.append(uuid);
1465
1466 msg.append(", groupId=");
1467 msg.append(groupId);
1468
1469 msg.append(StringPool.CLOSE_CURLY_BRACE);
1470
1471 if (_log.isWarnEnabled()) {
1472 _log.warn(msg.toString());
1473 }
1474
1475 throw new NoSuchEntryException(msg.toString());
1476 }
1477
1478 return blogsEntry;
1479 }
1480
1481
1489 public BlogsEntry fetchByUUID_G(String uuid, long groupId)
1490 throws SystemException {
1491 return fetchByUUID_G(uuid, groupId, true);
1492 }
1493
1494
1503 public BlogsEntry fetchByUUID_G(String uuid, long groupId,
1504 boolean retrieveFromCache) throws SystemException {
1505 Object[] finderArgs = new Object[] { uuid, groupId };
1506
1507 Object result = null;
1508
1509 if (retrieveFromCache) {
1510 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
1511 finderArgs, this);
1512 }
1513
1514 if (result instanceof BlogsEntry) {
1515 BlogsEntry blogsEntry = (BlogsEntry)result;
1516
1517 if (!Validator.equals(uuid, blogsEntry.getUuid()) ||
1518 (groupId != blogsEntry.getGroupId())) {
1519 result = null;
1520 }
1521 }
1522
1523 if (result == null) {
1524 StringBundler query = new StringBundler(4);
1525
1526 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1527
1528 if (uuid == null) {
1529 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
1530 }
1531 else {
1532 if (uuid.equals(StringPool.BLANK)) {
1533 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
1534 }
1535 else {
1536 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1537 }
1538 }
1539
1540 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1541
1542 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1543
1544 String sql = query.toString();
1545
1546 Session session = null;
1547
1548 try {
1549 session = openSession();
1550
1551 Query q = session.createQuery(sql);
1552
1553 QueryPos qPos = QueryPos.getInstance(q);
1554
1555 if (uuid != null) {
1556 qPos.add(uuid);
1557 }
1558
1559 qPos.add(groupId);
1560
1561 List<BlogsEntry> list = q.list();
1562
1563 result = list;
1564
1565 BlogsEntry blogsEntry = null;
1566
1567 if (list.isEmpty()) {
1568 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1569 finderArgs, list);
1570 }
1571 else {
1572 blogsEntry = list.get(0);
1573
1574 cacheResult(blogsEntry);
1575
1576 if ((blogsEntry.getUuid() == null) ||
1577 !blogsEntry.getUuid().equals(uuid) ||
1578 (blogsEntry.getGroupId() != groupId)) {
1579 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1580 finderArgs, blogsEntry);
1581 }
1582 }
1583
1584 return blogsEntry;
1585 }
1586 catch (Exception e) {
1587 throw processException(e);
1588 }
1589 finally {
1590 if (result == null) {
1591 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
1592 finderArgs);
1593 }
1594
1595 closeSession(session);
1596 }
1597 }
1598 else {
1599 if (result instanceof List<?>) {
1600 return null;
1601 }
1602 else {
1603 return (BlogsEntry)result;
1604 }
1605 }
1606 }
1607
1608
1615 public List<BlogsEntry> findByGroupId(long groupId)
1616 throws SystemException {
1617 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1618 }
1619
1620
1633 public List<BlogsEntry> findByGroupId(long groupId, int start, int end)
1634 throws SystemException {
1635 return findByGroupId(groupId, start, end, null);
1636 }
1637
1638
1652 public List<BlogsEntry> findByGroupId(long groupId, int start, int end,
1653 OrderByComparator orderByComparator) throws SystemException {
1654 FinderPath finderPath = null;
1655 Object[] finderArgs = null;
1656
1657 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1658 (orderByComparator == null)) {
1659 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
1660 finderArgs = new Object[] { groupId };
1661 }
1662 else {
1663 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
1664 finderArgs = new Object[] { groupId, start, end, orderByComparator };
1665 }
1666
1667 List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
1668 finderArgs, this);
1669
1670 if ((list != null) && !list.isEmpty()) {
1671 for (BlogsEntry blogsEntry : list) {
1672 if ((groupId != blogsEntry.getGroupId())) {
1673 list = null;
1674
1675 break;
1676 }
1677 }
1678 }
1679
1680 if (list == null) {
1681 StringBundler query = null;
1682
1683 if (orderByComparator != null) {
1684 query = new StringBundler(3 +
1685 (orderByComparator.getOrderByFields().length * 3));
1686 }
1687 else {
1688 query = new StringBundler(3);
1689 }
1690
1691 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1692
1693 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1694
1695 if (orderByComparator != null) {
1696 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1697 orderByComparator);
1698 }
1699
1700 else {
1701 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1702 }
1703
1704 String sql = query.toString();
1705
1706 Session session = null;
1707
1708 try {
1709 session = openSession();
1710
1711 Query q = session.createQuery(sql);
1712
1713 QueryPos qPos = QueryPos.getInstance(q);
1714
1715 qPos.add(groupId);
1716
1717 list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
1718 end);
1719 }
1720 catch (Exception e) {
1721 throw processException(e);
1722 }
1723 finally {
1724 if (list == null) {
1725 FinderCacheUtil.removeResult(finderPath, finderArgs);
1726 }
1727 else {
1728 cacheResult(list);
1729
1730 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1731 }
1732
1733 closeSession(session);
1734 }
1735 }
1736
1737 return list;
1738 }
1739
1740
1749 public BlogsEntry findByGroupId_First(long groupId,
1750 OrderByComparator orderByComparator)
1751 throws NoSuchEntryException, SystemException {
1752 BlogsEntry blogsEntry = fetchByGroupId_First(groupId, orderByComparator);
1753
1754 if (blogsEntry != null) {
1755 return blogsEntry;
1756 }
1757
1758 StringBundler msg = new StringBundler(4);
1759
1760 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1761
1762 msg.append("groupId=");
1763 msg.append(groupId);
1764
1765 msg.append(StringPool.CLOSE_CURLY_BRACE);
1766
1767 throw new NoSuchEntryException(msg.toString());
1768 }
1769
1770
1778 public BlogsEntry fetchByGroupId_First(long groupId,
1779 OrderByComparator orderByComparator) throws SystemException {
1780 List<BlogsEntry> list = findByGroupId(groupId, 0, 1, orderByComparator);
1781
1782 if (!list.isEmpty()) {
1783 return list.get(0);
1784 }
1785
1786 return null;
1787 }
1788
1789
1798 public BlogsEntry findByGroupId_Last(long groupId,
1799 OrderByComparator orderByComparator)
1800 throws NoSuchEntryException, SystemException {
1801 BlogsEntry blogsEntry = fetchByGroupId_Last(groupId, orderByComparator);
1802
1803 if (blogsEntry != null) {
1804 return blogsEntry;
1805 }
1806
1807 StringBundler msg = new StringBundler(4);
1808
1809 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1810
1811 msg.append("groupId=");
1812 msg.append(groupId);
1813
1814 msg.append(StringPool.CLOSE_CURLY_BRACE);
1815
1816 throw new NoSuchEntryException(msg.toString());
1817 }
1818
1819
1827 public BlogsEntry fetchByGroupId_Last(long groupId,
1828 OrderByComparator orderByComparator) throws SystemException {
1829 int count = countByGroupId(groupId);
1830
1831 List<BlogsEntry> list = findByGroupId(groupId, count - 1, count,
1832 orderByComparator);
1833
1834 if (!list.isEmpty()) {
1835 return list.get(0);
1836 }
1837
1838 return null;
1839 }
1840
1841
1851 public BlogsEntry[] findByGroupId_PrevAndNext(long entryId, long groupId,
1852 OrderByComparator orderByComparator)
1853 throws NoSuchEntryException, SystemException {
1854 BlogsEntry blogsEntry = findByPrimaryKey(entryId);
1855
1856 Session session = null;
1857
1858 try {
1859 session = openSession();
1860
1861 BlogsEntry[] array = new BlogsEntryImpl[3];
1862
1863 array[0] = getByGroupId_PrevAndNext(session, blogsEntry, groupId,
1864 orderByComparator, true);
1865
1866 array[1] = blogsEntry;
1867
1868 array[2] = getByGroupId_PrevAndNext(session, blogsEntry, groupId,
1869 orderByComparator, false);
1870
1871 return array;
1872 }
1873 catch (Exception e) {
1874 throw processException(e);
1875 }
1876 finally {
1877 closeSession(session);
1878 }
1879 }
1880
1881 protected BlogsEntry getByGroupId_PrevAndNext(Session session,
1882 BlogsEntry blogsEntry, long groupId,
1883 OrderByComparator orderByComparator, boolean previous) {
1884 StringBundler query = null;
1885
1886 if (orderByComparator != null) {
1887 query = new StringBundler(6 +
1888 (orderByComparator.getOrderByFields().length * 6));
1889 }
1890 else {
1891 query = new StringBundler(3);
1892 }
1893
1894 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1895
1896 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1897
1898 if (orderByComparator != null) {
1899 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1900
1901 if (orderByConditionFields.length > 0) {
1902 query.append(WHERE_AND);
1903 }
1904
1905 for (int i = 0; i < orderByConditionFields.length; i++) {
1906 query.append(_ORDER_BY_ENTITY_ALIAS);
1907 query.append(orderByConditionFields[i]);
1908
1909 if ((i + 1) < orderByConditionFields.length) {
1910 if (orderByComparator.isAscending() ^ previous) {
1911 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1912 }
1913 else {
1914 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1915 }
1916 }
1917 else {
1918 if (orderByComparator.isAscending() ^ previous) {
1919 query.append(WHERE_GREATER_THAN);
1920 }
1921 else {
1922 query.append(WHERE_LESSER_THAN);
1923 }
1924 }
1925 }
1926
1927 query.append(ORDER_BY_CLAUSE);
1928
1929 String[] orderByFields = orderByComparator.getOrderByFields();
1930
1931 for (int i = 0; i < orderByFields.length; i++) {
1932 query.append(_ORDER_BY_ENTITY_ALIAS);
1933 query.append(orderByFields[i]);
1934
1935 if ((i + 1) < orderByFields.length) {
1936 if (orderByComparator.isAscending() ^ previous) {
1937 query.append(ORDER_BY_ASC_HAS_NEXT);
1938 }
1939 else {
1940 query.append(ORDER_BY_DESC_HAS_NEXT);
1941 }
1942 }
1943 else {
1944 if (orderByComparator.isAscending() ^ previous) {
1945 query.append(ORDER_BY_ASC);
1946 }
1947 else {
1948 query.append(ORDER_BY_DESC);
1949 }
1950 }
1951 }
1952 }
1953
1954 else {
1955 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1956 }
1957
1958 String sql = query.toString();
1959
1960 Query q = session.createQuery(sql);
1961
1962 q.setFirstResult(0);
1963 q.setMaxResults(2);
1964
1965 QueryPos qPos = QueryPos.getInstance(q);
1966
1967 qPos.add(groupId);
1968
1969 if (orderByComparator != null) {
1970 Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
1971
1972 for (Object value : values) {
1973 qPos.add(value);
1974 }
1975 }
1976
1977 List<BlogsEntry> list = q.list();
1978
1979 if (list.size() == 2) {
1980 return list.get(1);
1981 }
1982 else {
1983 return null;
1984 }
1985 }
1986
1987
1994 public List<BlogsEntry> filterFindByGroupId(long groupId)
1995 throws SystemException {
1996 return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
1997 QueryUtil.ALL_POS, null);
1998 }
1999
2000
2013 public List<BlogsEntry> filterFindByGroupId(long groupId, int start, int end)
2014 throws SystemException {
2015 return filterFindByGroupId(groupId, start, end, null);
2016 }
2017
2018
2032 public List<BlogsEntry> filterFindByGroupId(long groupId, int start,
2033 int end, OrderByComparator orderByComparator) throws SystemException {
2034 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2035 return findByGroupId(groupId, start, end, orderByComparator);
2036 }
2037
2038 StringBundler query = null;
2039
2040 if (orderByComparator != null) {
2041 query = new StringBundler(3 +
2042 (orderByComparator.getOrderByFields().length * 3));
2043 }
2044 else {
2045 query = new StringBundler(3);
2046 }
2047
2048 if (getDB().isSupportsInlineDistinct()) {
2049 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
2050 }
2051 else {
2052 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
2053 }
2054
2055 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2056
2057 if (!getDB().isSupportsInlineDistinct()) {
2058 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
2059 }
2060
2061 if (orderByComparator != null) {
2062 if (getDB().isSupportsInlineDistinct()) {
2063 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2064 orderByComparator);
2065 }
2066 else {
2067 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
2068 orderByComparator);
2069 }
2070 }
2071
2072 else {
2073 if (getDB().isSupportsInlineDistinct()) {
2074 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2075 }
2076 else {
2077 query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
2078 }
2079 }
2080
2081 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2082 BlogsEntry.class.getName(),
2083 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2084
2085 Session session = null;
2086
2087 try {
2088 session = openSession();
2089
2090 SQLQuery q = session.createSQLQuery(sql);
2091
2092 if (getDB().isSupportsInlineDistinct()) {
2093 q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
2094 }
2095 else {
2096 q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
2097 }
2098
2099 QueryPos qPos = QueryPos.getInstance(q);
2100
2101 qPos.add(groupId);
2102
2103 return (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start, end);
2104 }
2105 catch (Exception e) {
2106 throw processException(e);
2107 }
2108 finally {
2109 closeSession(session);
2110 }
2111 }
2112
2113
2123 public BlogsEntry[] filterFindByGroupId_PrevAndNext(long entryId,
2124 long groupId, OrderByComparator orderByComparator)
2125 throws NoSuchEntryException, SystemException {
2126 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2127 return findByGroupId_PrevAndNext(entryId, groupId, orderByComparator);
2128 }
2129
2130 BlogsEntry blogsEntry = findByPrimaryKey(entryId);
2131
2132 Session session = null;
2133
2134 try {
2135 session = openSession();
2136
2137 BlogsEntry[] array = new BlogsEntryImpl[3];
2138
2139 array[0] = filterGetByGroupId_PrevAndNext(session, blogsEntry,
2140 groupId, orderByComparator, true);
2141
2142 array[1] = blogsEntry;
2143
2144 array[2] = filterGetByGroupId_PrevAndNext(session, blogsEntry,
2145 groupId, orderByComparator, false);
2146
2147 return array;
2148 }
2149 catch (Exception e) {
2150 throw processException(e);
2151 }
2152 finally {
2153 closeSession(session);
2154 }
2155 }
2156
2157 protected BlogsEntry filterGetByGroupId_PrevAndNext(Session session,
2158 BlogsEntry blogsEntry, long groupId,
2159 OrderByComparator orderByComparator, boolean previous) {
2160 StringBundler query = null;
2161
2162 if (orderByComparator != null) {
2163 query = new StringBundler(6 +
2164 (orderByComparator.getOrderByFields().length * 6));
2165 }
2166 else {
2167 query = new StringBundler(3);
2168 }
2169
2170 if (getDB().isSupportsInlineDistinct()) {
2171 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
2172 }
2173 else {
2174 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
2175 }
2176
2177 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2178
2179 if (!getDB().isSupportsInlineDistinct()) {
2180 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
2181 }
2182
2183 if (orderByComparator != null) {
2184 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2185
2186 if (orderByConditionFields.length > 0) {
2187 query.append(WHERE_AND);
2188 }
2189
2190 for (int i = 0; i < orderByConditionFields.length; i++) {
2191 if (getDB().isSupportsInlineDistinct()) {
2192 query.append(_ORDER_BY_ENTITY_ALIAS);
2193 }
2194 else {
2195 query.append(_ORDER_BY_ENTITY_TABLE);
2196 }
2197
2198 query.append(orderByConditionFields[i]);
2199
2200 if ((i + 1) < orderByConditionFields.length) {
2201 if (orderByComparator.isAscending() ^ previous) {
2202 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2203 }
2204 else {
2205 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2206 }
2207 }
2208 else {
2209 if (orderByComparator.isAscending() ^ previous) {
2210 query.append(WHERE_GREATER_THAN);
2211 }
2212 else {
2213 query.append(WHERE_LESSER_THAN);
2214 }
2215 }
2216 }
2217
2218 query.append(ORDER_BY_CLAUSE);
2219
2220 String[] orderByFields = orderByComparator.getOrderByFields();
2221
2222 for (int i = 0; i < orderByFields.length; i++) {
2223 if (getDB().isSupportsInlineDistinct()) {
2224 query.append(_ORDER_BY_ENTITY_ALIAS);
2225 }
2226 else {
2227 query.append(_ORDER_BY_ENTITY_TABLE);
2228 }
2229
2230 query.append(orderByFields[i]);
2231
2232 if ((i + 1) < orderByFields.length) {
2233 if (orderByComparator.isAscending() ^ previous) {
2234 query.append(ORDER_BY_ASC_HAS_NEXT);
2235 }
2236 else {
2237 query.append(ORDER_BY_DESC_HAS_NEXT);
2238 }
2239 }
2240 else {
2241 if (orderByComparator.isAscending() ^ previous) {
2242 query.append(ORDER_BY_ASC);
2243 }
2244 else {
2245 query.append(ORDER_BY_DESC);
2246 }
2247 }
2248 }
2249 }
2250
2251 else {
2252 if (getDB().isSupportsInlineDistinct()) {
2253 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2254 }
2255 else {
2256 query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
2257 }
2258 }
2259
2260 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2261 BlogsEntry.class.getName(),
2262 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2263
2264 SQLQuery q = session.createSQLQuery(sql);
2265
2266 q.setFirstResult(0);
2267 q.setMaxResults(2);
2268
2269 if (getDB().isSupportsInlineDistinct()) {
2270 q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
2271 }
2272 else {
2273 q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
2274 }
2275
2276 QueryPos qPos = QueryPos.getInstance(q);
2277
2278 qPos.add(groupId);
2279
2280 if (orderByComparator != null) {
2281 Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
2282
2283 for (Object value : values) {
2284 qPos.add(value);
2285 }
2286 }
2287
2288 List<BlogsEntry> list = q.list();
2289
2290 if (list.size() == 2) {
2291 return list.get(1);
2292 }
2293 else {
2294 return null;
2295 }
2296 }
2297
2298
2305 public List<BlogsEntry> findByCompanyId(long companyId)
2306 throws SystemException {
2307 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
2308 null);
2309 }
2310
2311
2324 public List<BlogsEntry> findByCompanyId(long companyId, int start, int end)
2325 throws SystemException {
2326 return findByCompanyId(companyId, start, end, null);
2327 }
2328
2329
2343 public List<BlogsEntry> findByCompanyId(long companyId, int start, int end,
2344 OrderByComparator orderByComparator) throws SystemException {
2345 FinderPath finderPath = null;
2346 Object[] finderArgs = null;
2347
2348 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2349 (orderByComparator == null)) {
2350 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID;
2351 finderArgs = new Object[] { companyId };
2352 }
2353 else {
2354 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID;
2355 finderArgs = new Object[] { companyId, start, end, orderByComparator };
2356 }
2357
2358 List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
2359 finderArgs, this);
2360
2361 if ((list != null) && !list.isEmpty()) {
2362 for (BlogsEntry blogsEntry : list) {
2363 if ((companyId != blogsEntry.getCompanyId())) {
2364 list = null;
2365
2366 break;
2367 }
2368 }
2369 }
2370
2371 if (list == null) {
2372 StringBundler query = null;
2373
2374 if (orderByComparator != null) {
2375 query = new StringBundler(3 +
2376 (orderByComparator.getOrderByFields().length * 3));
2377 }
2378 else {
2379 query = new StringBundler(3);
2380 }
2381
2382 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2383
2384 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2385
2386 if (orderByComparator != null) {
2387 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2388 orderByComparator);
2389 }
2390
2391 else {
2392 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2393 }
2394
2395 String sql = query.toString();
2396
2397 Session session = null;
2398
2399 try {
2400 session = openSession();
2401
2402 Query q = session.createQuery(sql);
2403
2404 QueryPos qPos = QueryPos.getInstance(q);
2405
2406 qPos.add(companyId);
2407
2408 list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
2409 end);
2410 }
2411 catch (Exception e) {
2412 throw processException(e);
2413 }
2414 finally {
2415 if (list == null) {
2416 FinderCacheUtil.removeResult(finderPath, finderArgs);
2417 }
2418 else {
2419 cacheResult(list);
2420
2421 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2422 }
2423
2424 closeSession(session);
2425 }
2426 }
2427
2428 return list;
2429 }
2430
2431
2440 public BlogsEntry findByCompanyId_First(long companyId,
2441 OrderByComparator orderByComparator)
2442 throws NoSuchEntryException, SystemException {
2443 BlogsEntry blogsEntry = fetchByCompanyId_First(companyId,
2444 orderByComparator);
2445
2446 if (blogsEntry != null) {
2447 return blogsEntry;
2448 }
2449
2450 StringBundler msg = new StringBundler(4);
2451
2452 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2453
2454 msg.append("companyId=");
2455 msg.append(companyId);
2456
2457 msg.append(StringPool.CLOSE_CURLY_BRACE);
2458
2459 throw new NoSuchEntryException(msg.toString());
2460 }
2461
2462
2470 public BlogsEntry fetchByCompanyId_First(long companyId,
2471 OrderByComparator orderByComparator) throws SystemException {
2472 List<BlogsEntry> list = findByCompanyId(companyId, 0, 1,
2473 orderByComparator);
2474
2475 if (!list.isEmpty()) {
2476 return list.get(0);
2477 }
2478
2479 return null;
2480 }
2481
2482
2491 public BlogsEntry findByCompanyId_Last(long companyId,
2492 OrderByComparator orderByComparator)
2493 throws NoSuchEntryException, SystemException {
2494 BlogsEntry blogsEntry = fetchByCompanyId_Last(companyId,
2495 orderByComparator);
2496
2497 if (blogsEntry != null) {
2498 return blogsEntry;
2499 }
2500
2501 StringBundler msg = new StringBundler(4);
2502
2503 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2504
2505 msg.append("companyId=");
2506 msg.append(companyId);
2507
2508 msg.append(StringPool.CLOSE_CURLY_BRACE);
2509
2510 throw new NoSuchEntryException(msg.toString());
2511 }
2512
2513
2521 public BlogsEntry fetchByCompanyId_Last(long companyId,
2522 OrderByComparator orderByComparator) throws SystemException {
2523 int count = countByCompanyId(companyId);
2524
2525 List<BlogsEntry> list = findByCompanyId(companyId, count - 1, count,
2526 orderByComparator);
2527
2528 if (!list.isEmpty()) {
2529 return list.get(0);
2530 }
2531
2532 return null;
2533 }
2534
2535
2545 public BlogsEntry[] findByCompanyId_PrevAndNext(long entryId,
2546 long companyId, OrderByComparator orderByComparator)
2547 throws NoSuchEntryException, SystemException {
2548 BlogsEntry blogsEntry = findByPrimaryKey(entryId);
2549
2550 Session session = null;
2551
2552 try {
2553 session = openSession();
2554
2555 BlogsEntry[] array = new BlogsEntryImpl[3];
2556
2557 array[0] = getByCompanyId_PrevAndNext(session, blogsEntry,
2558 companyId, orderByComparator, true);
2559
2560 array[1] = blogsEntry;
2561
2562 array[2] = getByCompanyId_PrevAndNext(session, blogsEntry,
2563 companyId, orderByComparator, false);
2564
2565 return array;
2566 }
2567 catch (Exception e) {
2568 throw processException(e);
2569 }
2570 finally {
2571 closeSession(session);
2572 }
2573 }
2574
2575 protected BlogsEntry getByCompanyId_PrevAndNext(Session session,
2576 BlogsEntry blogsEntry, long companyId,
2577 OrderByComparator orderByComparator, boolean previous) {
2578 StringBundler query = null;
2579
2580 if (orderByComparator != null) {
2581 query = new StringBundler(6 +
2582 (orderByComparator.getOrderByFields().length * 6));
2583 }
2584 else {
2585 query = new StringBundler(3);
2586 }
2587
2588 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2589
2590 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2591
2592 if (orderByComparator != null) {
2593 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2594
2595 if (orderByConditionFields.length > 0) {
2596 query.append(WHERE_AND);
2597 }
2598
2599 for (int i = 0; i < orderByConditionFields.length; i++) {
2600 query.append(_ORDER_BY_ENTITY_ALIAS);
2601 query.append(orderByConditionFields[i]);
2602
2603 if ((i + 1) < orderByConditionFields.length) {
2604 if (orderByComparator.isAscending() ^ previous) {
2605 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2606 }
2607 else {
2608 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2609 }
2610 }
2611 else {
2612 if (orderByComparator.isAscending() ^ previous) {
2613 query.append(WHERE_GREATER_THAN);
2614 }
2615 else {
2616 query.append(WHERE_LESSER_THAN);
2617 }
2618 }
2619 }
2620
2621 query.append(ORDER_BY_CLAUSE);
2622
2623 String[] orderByFields = orderByComparator.getOrderByFields();
2624
2625 for (int i = 0; i < orderByFields.length; i++) {
2626 query.append(_ORDER_BY_ENTITY_ALIAS);
2627 query.append(orderByFields[i]);
2628
2629 if ((i + 1) < orderByFields.length) {
2630 if (orderByComparator.isAscending() ^ previous) {
2631 query.append(ORDER_BY_ASC_HAS_NEXT);
2632 }
2633 else {
2634 query.append(ORDER_BY_DESC_HAS_NEXT);
2635 }
2636 }
2637 else {
2638 if (orderByComparator.isAscending() ^ previous) {
2639 query.append(ORDER_BY_ASC);
2640 }
2641 else {
2642 query.append(ORDER_BY_DESC);
2643 }
2644 }
2645 }
2646 }
2647
2648 else {
2649 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2650 }
2651
2652 String sql = query.toString();
2653
2654 Query q = session.createQuery(sql);
2655
2656 q.setFirstResult(0);
2657 q.setMaxResults(2);
2658
2659 QueryPos qPos = QueryPos.getInstance(q);
2660
2661 qPos.add(companyId);
2662
2663 if (orderByComparator != null) {
2664 Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
2665
2666 for (Object value : values) {
2667 qPos.add(value);
2668 }
2669 }
2670
2671 List<BlogsEntry> list = q.list();
2672
2673 if (list.size() == 2) {
2674 return list.get(1);
2675 }
2676 else {
2677 return null;
2678 }
2679 }
2680
2681
2689 public List<BlogsEntry> findByC_U(long companyId, long userId)
2690 throws SystemException {
2691 return findByC_U(companyId, userId, QueryUtil.ALL_POS,
2692 QueryUtil.ALL_POS, null);
2693 }
2694
2695
2709 public List<BlogsEntry> findByC_U(long companyId, long userId, int start,
2710 int end) throws SystemException {
2711 return findByC_U(companyId, userId, start, end, null);
2712 }
2713
2714
2729 public List<BlogsEntry> findByC_U(long companyId, long userId, int start,
2730 int end, OrderByComparator orderByComparator) throws SystemException {
2731 FinderPath finderPath = null;
2732 Object[] finderArgs = null;
2733
2734 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2735 (orderByComparator == null)) {
2736 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_U;
2737 finderArgs = new Object[] { companyId, userId };
2738 }
2739 else {
2740 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_U;
2741 finderArgs = new Object[] {
2742 companyId, userId,
2743
2744 start, end, orderByComparator
2745 };
2746 }
2747
2748 List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
2749 finderArgs, this);
2750
2751 if ((list != null) && !list.isEmpty()) {
2752 for (BlogsEntry blogsEntry : list) {
2753 if ((companyId != blogsEntry.getCompanyId()) ||
2754 (userId != blogsEntry.getUserId())) {
2755 list = null;
2756
2757 break;
2758 }
2759 }
2760 }
2761
2762 if (list == null) {
2763 StringBundler query = null;
2764
2765 if (orderByComparator != null) {
2766 query = new StringBundler(4 +
2767 (orderByComparator.getOrderByFields().length * 3));
2768 }
2769 else {
2770 query = new StringBundler(4);
2771 }
2772
2773 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2774
2775 query.append(_FINDER_COLUMN_C_U_COMPANYID_2);
2776
2777 query.append(_FINDER_COLUMN_C_U_USERID_2);
2778
2779 if (orderByComparator != null) {
2780 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2781 orderByComparator);
2782 }
2783
2784 else {
2785 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2786 }
2787
2788 String sql = query.toString();
2789
2790 Session session = null;
2791
2792 try {
2793 session = openSession();
2794
2795 Query q = session.createQuery(sql);
2796
2797 QueryPos qPos = QueryPos.getInstance(q);
2798
2799 qPos.add(companyId);
2800
2801 qPos.add(userId);
2802
2803 list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
2804 end);
2805 }
2806 catch (Exception e) {
2807 throw processException(e);
2808 }
2809 finally {
2810 if (list == null) {
2811 FinderCacheUtil.removeResult(finderPath, finderArgs);
2812 }
2813 else {
2814 cacheResult(list);
2815
2816 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2817 }
2818
2819 closeSession(session);
2820 }
2821 }
2822
2823 return list;
2824 }
2825
2826
2836 public BlogsEntry findByC_U_First(long companyId, long userId,
2837 OrderByComparator orderByComparator)
2838 throws NoSuchEntryException, SystemException {
2839 BlogsEntry blogsEntry = fetchByC_U_First(companyId, userId,
2840 orderByComparator);
2841
2842 if (blogsEntry != null) {
2843 return blogsEntry;
2844 }
2845
2846 StringBundler msg = new StringBundler(6);
2847
2848 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2849
2850 msg.append("companyId=");
2851 msg.append(companyId);
2852
2853 msg.append(", userId=");
2854 msg.append(userId);
2855
2856 msg.append(StringPool.CLOSE_CURLY_BRACE);
2857
2858 throw new NoSuchEntryException(msg.toString());
2859 }
2860
2861
2870 public BlogsEntry fetchByC_U_First(long companyId, long userId,
2871 OrderByComparator orderByComparator) throws SystemException {
2872 List<BlogsEntry> list = findByC_U(companyId, userId, 0, 1,
2873 orderByComparator);
2874
2875 if (!list.isEmpty()) {
2876 return list.get(0);
2877 }
2878
2879 return null;
2880 }
2881
2882
2892 public BlogsEntry findByC_U_Last(long companyId, long userId,
2893 OrderByComparator orderByComparator)
2894 throws NoSuchEntryException, SystemException {
2895 BlogsEntry blogsEntry = fetchByC_U_Last(companyId, userId,
2896 orderByComparator);
2897
2898 if (blogsEntry != null) {
2899 return blogsEntry;
2900 }
2901
2902 StringBundler msg = new StringBundler(6);
2903
2904 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2905
2906 msg.append("companyId=");
2907 msg.append(companyId);
2908
2909 msg.append(", userId=");
2910 msg.append(userId);
2911
2912 msg.append(StringPool.CLOSE_CURLY_BRACE);
2913
2914 throw new NoSuchEntryException(msg.toString());
2915 }
2916
2917
2926 public BlogsEntry fetchByC_U_Last(long companyId, long userId,
2927 OrderByComparator orderByComparator) throws SystemException {
2928 int count = countByC_U(companyId, userId);
2929
2930 List<BlogsEntry> list = findByC_U(companyId, userId, count - 1, count,
2931 orderByComparator);
2932
2933 if (!list.isEmpty()) {
2934 return list.get(0);
2935 }
2936
2937 return null;
2938 }
2939
2940
2951 public BlogsEntry[] findByC_U_PrevAndNext(long entryId, long companyId,
2952 long userId, OrderByComparator orderByComparator)
2953 throws NoSuchEntryException, SystemException {
2954 BlogsEntry blogsEntry = findByPrimaryKey(entryId);
2955
2956 Session session = null;
2957
2958 try {
2959 session = openSession();
2960
2961 BlogsEntry[] array = new BlogsEntryImpl[3];
2962
2963 array[0] = getByC_U_PrevAndNext(session, blogsEntry, companyId,
2964 userId, orderByComparator, true);
2965
2966 array[1] = blogsEntry;
2967
2968 array[2] = getByC_U_PrevAndNext(session, blogsEntry, companyId,
2969 userId, orderByComparator, false);
2970
2971 return array;
2972 }
2973 catch (Exception e) {
2974 throw processException(e);
2975 }
2976 finally {
2977 closeSession(session);
2978 }
2979 }
2980
2981 protected BlogsEntry getByC_U_PrevAndNext(Session session,
2982 BlogsEntry blogsEntry, long companyId, long userId,
2983 OrderByComparator orderByComparator, boolean previous) {
2984 StringBundler query = null;
2985
2986 if (orderByComparator != null) {
2987 query = new StringBundler(6 +
2988 (orderByComparator.getOrderByFields().length * 6));
2989 }
2990 else {
2991 query = new StringBundler(3);
2992 }
2993
2994 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2995
2996 query.append(_FINDER_COLUMN_C_U_COMPANYID_2);
2997
2998 query.append(_FINDER_COLUMN_C_U_USERID_2);
2999
3000 if (orderByComparator != null) {
3001 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
3002
3003 if (orderByConditionFields.length > 0) {
3004 query.append(WHERE_AND);
3005 }
3006
3007 for (int i = 0; i < orderByConditionFields.length; i++) {
3008 query.append(_ORDER_BY_ENTITY_ALIAS);
3009 query.append(orderByConditionFields[i]);
3010
3011 if ((i + 1) < orderByConditionFields.length) {
3012 if (orderByComparator.isAscending() ^ previous) {
3013 query.append(WHERE_GREATER_THAN_HAS_NEXT);
3014 }
3015 else {
3016 query.append(WHERE_LESSER_THAN_HAS_NEXT);
3017 }
3018 }
3019 else {
3020 if (orderByComparator.isAscending() ^ previous) {
3021 query.append(WHERE_GREATER_THAN);
3022 }
3023 else {
3024 query.append(WHERE_LESSER_THAN);
3025 }
3026 }
3027 }
3028
3029 query.append(ORDER_BY_CLAUSE);
3030
3031 String[] orderByFields = orderByComparator.getOrderByFields();
3032
3033 for (int i = 0; i < orderByFields.length; i++) {
3034 query.append(_ORDER_BY_ENTITY_ALIAS);
3035 query.append(orderByFields[i]);
3036
3037 if ((i + 1) < orderByFields.length) {
3038 if (orderByComparator.isAscending() ^ previous) {
3039 query.append(ORDER_BY_ASC_HAS_NEXT);
3040 }
3041 else {
3042 query.append(ORDER_BY_DESC_HAS_NEXT);
3043 }
3044 }
3045 else {
3046 if (orderByComparator.isAscending() ^ previous) {
3047 query.append(ORDER_BY_ASC);
3048 }
3049 else {
3050 query.append(ORDER_BY_DESC);
3051 }
3052 }
3053 }
3054 }
3055
3056 else {
3057 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3058 }
3059
3060 String sql = query.toString();
3061
3062 Query q = session.createQuery(sql);
3063
3064 q.setFirstResult(0);
3065 q.setMaxResults(2);
3066
3067 QueryPos qPos = QueryPos.getInstance(q);
3068
3069 qPos.add(companyId);
3070
3071 qPos.add(userId);
3072
3073 if (orderByComparator != null) {
3074 Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
3075
3076 for (Object value : values) {
3077 qPos.add(value);
3078 }
3079 }
3080
3081 List<BlogsEntry> list = q.list();
3082
3083 if (list.size() == 2) {
3084 return list.get(1);
3085 }
3086 else {
3087 return null;
3088 }
3089 }
3090
3091
3099 public List<BlogsEntry> findByC_LtD(long companyId, Date displayDate)
3100 throws SystemException {
3101 return findByC_LtD(companyId, displayDate, QueryUtil.ALL_POS,
3102 QueryUtil.ALL_POS, null);
3103 }
3104
3105
3119 public List<BlogsEntry> findByC_LtD(long companyId, Date displayDate,
3120 int start, int end) throws SystemException {
3121 return findByC_LtD(companyId, displayDate, start, end, null);
3122 }
3123
3124
3139 public List<BlogsEntry> findByC_LtD(long companyId, Date displayDate,
3140 int start, int end, OrderByComparator orderByComparator)
3141 throws SystemException {
3142 FinderPath finderPath = null;
3143 Object[] finderArgs = null;
3144
3145 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_LTD;
3146 finderArgs = new Object[] {
3147 companyId, displayDate,
3148
3149 start, end, orderByComparator
3150 };
3151
3152 List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
3153 finderArgs, this);
3154
3155 if ((list != null) && !list.isEmpty()) {
3156 for (BlogsEntry blogsEntry : list) {
3157 if ((companyId != blogsEntry.getCompanyId()) ||
3158 !Validator.equals(displayDate,
3159 blogsEntry.getDisplayDate())) {
3160 list = null;
3161
3162 break;
3163 }
3164 }
3165 }
3166
3167 if (list == null) {
3168 StringBundler query = null;
3169
3170 if (orderByComparator != null) {
3171 query = new StringBundler(4 +
3172 (orderByComparator.getOrderByFields().length * 3));
3173 }
3174 else {
3175 query = new StringBundler(4);
3176 }
3177
3178 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
3179
3180 query.append(_FINDER_COLUMN_C_LTD_COMPANYID_2);
3181
3182 if (displayDate == null) {
3183 query.append(_FINDER_COLUMN_C_LTD_DISPLAYDATE_1);
3184 }
3185 else {
3186 query.append(_FINDER_COLUMN_C_LTD_DISPLAYDATE_2);
3187 }
3188
3189 if (orderByComparator != null) {
3190 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3191 orderByComparator);
3192 }
3193
3194 else {
3195 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3196 }
3197
3198 String sql = query.toString();
3199
3200 Session session = null;
3201
3202 try {
3203 session = openSession();
3204
3205 Query q = session.createQuery(sql);
3206
3207 QueryPos qPos = QueryPos.getInstance(q);
3208
3209 qPos.add(companyId);
3210
3211 if (displayDate != null) {
3212 qPos.add(CalendarUtil.getTimestamp(displayDate));
3213 }
3214
3215 list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
3216 end);
3217 }
3218 catch (Exception e) {
3219 throw processException(e);
3220 }
3221 finally {
3222 if (list == null) {
3223 FinderCacheUtil.removeResult(finderPath, finderArgs);
3224 }
3225 else {
3226 cacheResult(list);
3227
3228 FinderCacheUtil.putResult(finderPath, finderArgs, list);
3229 }
3230
3231 closeSession(session);
3232 }
3233 }
3234
3235 return list;
3236 }
3237
3238
3248 public BlogsEntry findByC_LtD_First(long companyId, Date displayDate,
3249 OrderByComparator orderByComparator)
3250 throws NoSuchEntryException, SystemException {
3251 BlogsEntry blogsEntry = fetchByC_LtD_First(companyId, displayDate,
3252 orderByComparator);
3253
3254 if (blogsEntry != null) {
3255 return blogsEntry;
3256 }
3257
3258 StringBundler msg = new StringBundler(6);
3259
3260 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3261
3262 msg.append("companyId=");
3263 msg.append(companyId);
3264
3265 msg.append(", displayDate=");
3266 msg.append(displayDate);
3267
3268 msg.append(StringPool.CLOSE_CURLY_BRACE);
3269
3270 throw new NoSuchEntryException(msg.toString());
3271 }
3272
3273
3282 public BlogsEntry fetchByC_LtD_First(long companyId, Date displayDate,
3283 OrderByComparator orderByComparator) throws SystemException {
3284 List<BlogsEntry> list = findByC_LtD(companyId, displayDate, 0, 1,
3285 orderByComparator);
3286
3287 if (!list.isEmpty()) {
3288 return list.get(0);
3289 }
3290
3291 return null;
3292 }
3293
3294
3304 public BlogsEntry findByC_LtD_Last(long companyId, Date displayDate,
3305 OrderByComparator orderByComparator)
3306 throws NoSuchEntryException, SystemException {
3307 BlogsEntry blogsEntry = fetchByC_LtD_Last(companyId, displayDate,
3308 orderByComparator);
3309
3310 if (blogsEntry != null) {
3311 return blogsEntry;
3312 }
3313
3314 StringBundler msg = new StringBundler(6);
3315
3316 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3317
3318 msg.append("companyId=");
3319 msg.append(companyId);
3320
3321 msg.append(", displayDate=");
3322 msg.append(displayDate);
3323
3324 msg.append(StringPool.CLOSE_CURLY_BRACE);
3325
3326 throw new NoSuchEntryException(msg.toString());
3327 }
3328
3329
3338 public BlogsEntry fetchByC_LtD_Last(long companyId, Date displayDate,
3339 OrderByComparator orderByComparator) throws SystemException {
3340 int count = countByC_LtD(companyId, displayDate);
3341
3342 List<BlogsEntry> list = findByC_LtD(companyId, displayDate, count - 1,
3343 count, orderByComparator);
3344
3345 if (!list.isEmpty()) {
3346 return list.get(0);
3347 }
3348
3349 return null;
3350 }
3351
3352
3363 public BlogsEntry[] findByC_LtD_PrevAndNext(long entryId, long companyId,
3364 Date displayDate, OrderByComparator orderByComparator)
3365 throws NoSuchEntryException, SystemException {
3366 BlogsEntry blogsEntry = findByPrimaryKey(entryId);
3367
3368 Session session = null;
3369
3370 try {
3371 session = openSession();
3372
3373 BlogsEntry[] array = new BlogsEntryImpl[3];
3374
3375 array[0] = getByC_LtD_PrevAndNext(session, blogsEntry, companyId,
3376 displayDate, orderByComparator, true);
3377
3378 array[1] = blogsEntry;
3379
3380 array[2] = getByC_LtD_PrevAndNext(session, blogsEntry, companyId,
3381 displayDate, orderByComparator, false);
3382
3383 return array;
3384 }
3385 catch (Exception e) {
3386 throw processException(e);
3387 }
3388 finally {
3389 closeSession(session);
3390 }
3391 }
3392
3393 protected BlogsEntry getByC_LtD_PrevAndNext(Session session,
3394 BlogsEntry blogsEntry, long companyId, Date displayDate,
3395 OrderByComparator orderByComparator, boolean previous) {
3396 StringBundler query = null;
3397
3398 if (orderByComparator != null) {
3399 query = new StringBundler(6 +
3400 (orderByComparator.getOrderByFields().length * 6));
3401 }
3402 else {
3403 query = new StringBundler(3);
3404 }
3405
3406 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
3407
3408 query.append(_FINDER_COLUMN_C_LTD_COMPANYID_2);
3409
3410 if (displayDate == null) {
3411 query.append(_FINDER_COLUMN_C_LTD_DISPLAYDATE_1);
3412 }
3413 else {
3414 query.append(_FINDER_COLUMN_C_LTD_DISPLAYDATE_2);
3415 }
3416
3417 if (orderByComparator != null) {
3418 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
3419
3420 if (orderByConditionFields.length > 0) {
3421 query.append(WHERE_AND);
3422 }
3423
3424 for (int i = 0; i < orderByConditionFields.length; i++) {
3425 query.append(_ORDER_BY_ENTITY_ALIAS);
3426 query.append(orderByConditionFields[i]);
3427
3428 if ((i + 1) < orderByConditionFields.length) {
3429 if (orderByComparator.isAscending() ^ previous) {
3430 query.append(WHERE_GREATER_THAN_HAS_NEXT);
3431 }
3432 else {
3433 query.append(WHERE_LESSER_THAN_HAS_NEXT);
3434 }
3435 }
3436 else {
3437 if (orderByComparator.isAscending() ^ previous) {
3438 query.append(WHERE_GREATER_THAN);
3439 }
3440 else {
3441 query.append(WHERE_LESSER_THAN);
3442 }
3443 }
3444 }
3445
3446 query.append(ORDER_BY_CLAUSE);
3447
3448 String[] orderByFields = orderByComparator.getOrderByFields();
3449
3450 for (int i = 0; i < orderByFields.length; i++) {
3451 query.append(_ORDER_BY_ENTITY_ALIAS);
3452 query.append(orderByFields[i]);
3453
3454 if ((i + 1) < orderByFields.length) {
3455 if (orderByComparator.isAscending() ^ previous) {
3456 query.append(ORDER_BY_ASC_HAS_NEXT);
3457 }
3458 else {
3459 query.append(ORDER_BY_DESC_HAS_NEXT);
3460 }
3461 }
3462 else {
3463 if (orderByComparator.isAscending() ^ previous) {
3464 query.append(ORDER_BY_ASC);
3465 }
3466 else {
3467 query.append(ORDER_BY_DESC);
3468 }
3469 }
3470 }
3471 }
3472
3473 else {
3474 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3475 }
3476
3477 String sql = query.toString();
3478
3479 Query q = session.createQuery(sql);
3480
3481 q.setFirstResult(0);
3482 q.setMaxResults(2);
3483
3484 QueryPos qPos = QueryPos.getInstance(q);
3485
3486 qPos.add(companyId);
3487
3488 if (displayDate != null) {
3489 qPos.add(CalendarUtil.getTimestamp(displayDate));
3490 }
3491
3492 if (orderByComparator != null) {
3493 Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
3494
3495 for (Object value : values) {
3496 qPos.add(value);
3497 }
3498 }
3499
3500 List<BlogsEntry> list = q.list();
3501
3502 if (list.size() == 2) {
3503 return list.get(1);
3504 }
3505 else {
3506 return null;
3507 }
3508 }
3509
3510
3518 public List<BlogsEntry> findByC_S(long companyId, int status)
3519 throws SystemException {
3520 return findByC_S(companyId, status, QueryUtil.ALL_POS,
3521 QueryUtil.ALL_POS, null);
3522 }
3523
3524
3538 public List<BlogsEntry> findByC_S(long companyId, int status, int start,
3539 int end) throws SystemException {
3540 return findByC_S(companyId, status, start, end, null);
3541 }
3542
3543
3558 public List<BlogsEntry> findByC_S(long companyId, int status, int start,
3559 int end, OrderByComparator orderByComparator) throws SystemException {
3560 FinderPath finderPath = null;
3561 Object[] finderArgs = null;
3562
3563 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
3564 (orderByComparator == null)) {
3565 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_S;
3566 finderArgs = new Object[] { companyId, status };
3567 }
3568 else {
3569 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_S;
3570 finderArgs = new Object[] {
3571 companyId, status,
3572
3573 start, end, orderByComparator
3574 };
3575 }
3576
3577 List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
3578 finderArgs, this);
3579
3580 if ((list != null) && !list.isEmpty()) {
3581 for (BlogsEntry blogsEntry : list) {
3582 if ((companyId != blogsEntry.getCompanyId()) ||
3583 (status != blogsEntry.getStatus())) {
3584 list = null;
3585
3586 break;
3587 }
3588 }
3589 }
3590
3591 if (list == null) {
3592 StringBundler query = null;
3593
3594 if (orderByComparator != null) {
3595 query = new StringBundler(4 +
3596 (orderByComparator.getOrderByFields().length * 3));
3597 }
3598 else {
3599 query = new StringBundler(4);
3600 }
3601
3602 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
3603
3604 query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
3605
3606 query.append(_FINDER_COLUMN_C_S_STATUS_2);
3607
3608 if (orderByComparator != null) {
3609 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3610 orderByComparator);
3611 }
3612
3613 else {
3614 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3615 }
3616
3617 String sql = query.toString();
3618
3619 Session session = null;
3620
3621 try {
3622 session = openSession();
3623
3624 Query q = session.createQuery(sql);
3625
3626 QueryPos qPos = QueryPos.getInstance(q);
3627
3628 qPos.add(companyId);
3629
3630 qPos.add(status);
3631
3632 list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
3633 end);
3634 }
3635 catch (Exception e) {
3636 throw processException(e);
3637 }
3638 finally {
3639 if (list == null) {
3640 FinderCacheUtil.removeResult(finderPath, finderArgs);
3641 }
3642 else {
3643 cacheResult(list);
3644
3645 FinderCacheUtil.putResult(finderPath, finderArgs, list);
3646 }
3647
3648 closeSession(session);
3649 }
3650 }
3651
3652 return list;
3653 }
3654
3655
3665 public BlogsEntry findByC_S_First(long companyId, int status,
3666 OrderByComparator orderByComparator)
3667 throws NoSuchEntryException, SystemException {
3668 BlogsEntry blogsEntry = fetchByC_S_First(companyId, status,
3669 orderByComparator);
3670
3671 if (blogsEntry != null) {
3672 return blogsEntry;
3673 }
3674
3675 StringBundler msg = new StringBundler(6);
3676
3677 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3678
3679 msg.append("companyId=");
3680 msg.append(companyId);
3681
3682 msg.append(", status=");
3683 msg.append(status);
3684
3685 msg.append(StringPool.CLOSE_CURLY_BRACE);
3686
3687 throw new NoSuchEntryException(msg.toString());
3688 }
3689
3690
3699 public BlogsEntry fetchByC_S_First(long companyId, int status,
3700 OrderByComparator orderByComparator) throws SystemException {
3701 List<BlogsEntry> list = findByC_S(companyId, status, 0, 1,
3702 orderByComparator);
3703
3704 if (!list.isEmpty()) {
3705 return list.get(0);
3706 }
3707
3708 return null;
3709 }
3710
3711
3721 public BlogsEntry findByC_S_Last(long companyId, int status,
3722 OrderByComparator orderByComparator)
3723 throws NoSuchEntryException, SystemException {
3724 BlogsEntry blogsEntry = fetchByC_S_Last(companyId, status,
3725 orderByComparator);
3726
3727 if (blogsEntry != null) {
3728 return blogsEntry;
3729 }
3730
3731 StringBundler msg = new StringBundler(6);
3732
3733 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3734
3735 msg.append("companyId=");
3736 msg.append(companyId);
3737
3738 msg.append(", status=");
3739 msg.append(status);
3740
3741 msg.append(StringPool.CLOSE_CURLY_BRACE);
3742
3743 throw new NoSuchEntryException(msg.toString());
3744 }
3745
3746
3755 public BlogsEntry fetchByC_S_Last(long companyId, int status,
3756 OrderByComparator orderByComparator) throws SystemException {
3757 int count = countByC_S(companyId, status);
3758
3759 List<BlogsEntry> list = findByC_S(companyId, status, count - 1, count,
3760 orderByComparator);
3761
3762 if (!list.isEmpty()) {
3763 return list.get(0);
3764 }
3765
3766 return null;
3767 }
3768
3769
3780 public BlogsEntry[] findByC_S_PrevAndNext(long entryId, long companyId,
3781 int status, OrderByComparator orderByComparator)
3782 throws NoSuchEntryException, SystemException {
3783 BlogsEntry blogsEntry = findByPrimaryKey(entryId);
3784
3785 Session session = null;
3786
3787 try {
3788 session = openSession();
3789
3790 BlogsEntry[] array = new BlogsEntryImpl[3];
3791
3792 array[0] = getByC_S_PrevAndNext(session, blogsEntry, companyId,
3793 status, orderByComparator, true);
3794
3795 array[1] = blogsEntry;
3796
3797 array[2] = getByC_S_PrevAndNext(session, blogsEntry, companyId,
3798 status, orderByComparator, false);
3799
3800 return array;
3801 }
3802 catch (Exception e) {
3803 throw processException(e);
3804 }
3805 finally {
3806 closeSession(session);
3807 }
3808 }
3809
3810 protected BlogsEntry getByC_S_PrevAndNext(Session session,
3811 BlogsEntry blogsEntry, long companyId, int status,
3812 OrderByComparator orderByComparator, boolean previous) {
3813 StringBundler query = null;
3814
3815 if (orderByComparator != null) {
3816 query = new StringBundler(6 +
3817 (orderByComparator.getOrderByFields().length * 6));
3818 }
3819 else {
3820 query = new StringBundler(3);
3821 }
3822
3823 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
3824
3825 query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
3826
3827 query.append(_FINDER_COLUMN_C_S_STATUS_2);
3828
3829 if (orderByComparator != null) {
3830 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
3831
3832 if (orderByConditionFields.length > 0) {
3833 query.append(WHERE_AND);
3834 }
3835
3836 for (int i = 0; i < orderByConditionFields.length; i++) {
3837 query.append(_ORDER_BY_ENTITY_ALIAS);
3838 query.append(orderByConditionFields[i]);
3839
3840 if ((i + 1) < orderByConditionFields.length) {
3841 if (orderByComparator.isAscending() ^ previous) {
3842 query.append(WHERE_GREATER_THAN_HAS_NEXT);
3843 }
3844 else {
3845 query.append(WHERE_LESSER_THAN_HAS_NEXT);
3846 }
3847 }
3848 else {
3849 if (orderByComparator.isAscending() ^ previous) {
3850 query.append(WHERE_GREATER_THAN);
3851 }
3852 else {
3853 query.append(WHERE_LESSER_THAN);
3854 }
3855 }
3856 }
3857
3858 query.append(ORDER_BY_CLAUSE);
3859
3860 String[] orderByFields = orderByComparator.getOrderByFields();
3861
3862 for (int i = 0; i < orderByFields.length; i++) {
3863 query.append(_ORDER_BY_ENTITY_ALIAS);
3864 query.append(orderByFields[i]);
3865
3866 if ((i + 1) < orderByFields.length) {
3867 if (orderByComparator.isAscending() ^ previous) {
3868 query.append(ORDER_BY_ASC_HAS_NEXT);
3869 }
3870 else {
3871 query.append(ORDER_BY_DESC_HAS_NEXT);
3872 }
3873 }
3874 else {
3875 if (orderByComparator.isAscending() ^ previous) {
3876 query.append(ORDER_BY_ASC);
3877 }
3878 else {
3879 query.append(ORDER_BY_DESC);
3880 }
3881 }
3882 }
3883 }
3884
3885 else {
3886 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3887 }
3888
3889 String sql = query.toString();
3890
3891 Query q = session.createQuery(sql);
3892
3893 q.setFirstResult(0);
3894 q.setMaxResults(2);
3895
3896 QueryPos qPos = QueryPos.getInstance(q);
3897
3898 qPos.add(companyId);
3899
3900 qPos.add(status);
3901
3902 if (orderByComparator != null) {
3903 Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
3904
3905 for (Object value : values) {
3906 qPos.add(value);
3907 }
3908 }
3909
3910 List<BlogsEntry> list = q.list();
3911
3912 if (list.size() == 2) {
3913 return list.get(1);
3914 }
3915 else {
3916 return null;
3917 }
3918 }
3919
3920
3929 public BlogsEntry findByG_UT(long groupId, String urlTitle)
3930 throws NoSuchEntryException, SystemException {
3931 BlogsEntry blogsEntry = fetchByG_UT(groupId, urlTitle);
3932
3933 if (blogsEntry == null) {
3934 StringBundler msg = new StringBundler(6);
3935
3936 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3937
3938 msg.append("groupId=");
3939 msg.append(groupId);
3940
3941 msg.append(", urlTitle=");
3942 msg.append(urlTitle);
3943
3944 msg.append(StringPool.CLOSE_CURLY_BRACE);
3945
3946 if (_log.isWarnEnabled()) {
3947 _log.warn(msg.toString());
3948 }
3949
3950 throw new NoSuchEntryException(msg.toString());
3951 }
3952
3953 return blogsEntry;
3954 }
3955
3956
3964 public BlogsEntry fetchByG_UT(long groupId, String urlTitle)
3965 throws SystemException {
3966 return fetchByG_UT(groupId, urlTitle, true);
3967 }
3968
3969
3978 public BlogsEntry fetchByG_UT(long groupId, String urlTitle,
3979 boolean retrieveFromCache) throws SystemException {
3980 Object[] finderArgs = new Object[] { groupId, urlTitle };
3981
3982 Object result = null;
3983
3984 if (retrieveFromCache) {
3985 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_UT,
3986 finderArgs, this);
3987 }
3988
3989 if (result instanceof BlogsEntry) {
3990 BlogsEntry blogsEntry = (BlogsEntry)result;
3991
3992 if ((groupId != blogsEntry.getGroupId()) ||
3993 !Validator.equals(urlTitle, blogsEntry.getUrlTitle())) {
3994 result = null;
3995 }
3996 }
3997
3998 if (result == null) {
3999 StringBundler query = new StringBundler(4);
4000
4001 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
4002
4003 query.append(_FINDER_COLUMN_G_UT_GROUPID_2);
4004
4005 if (urlTitle == null) {
4006 query.append(_FINDER_COLUMN_G_UT_URLTITLE_1);
4007 }
4008 else {
4009 if (urlTitle.equals(StringPool.BLANK)) {
4010 query.append(_FINDER_COLUMN_G_UT_URLTITLE_3);
4011 }
4012 else {
4013 query.append(_FINDER_COLUMN_G_UT_URLTITLE_2);
4014 }
4015 }
4016
4017 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4018
4019 String sql = query.toString();
4020
4021 Session session = null;
4022
4023 try {
4024 session = openSession();
4025
4026 Query q = session.createQuery(sql);
4027
4028 QueryPos qPos = QueryPos.getInstance(q);
4029
4030 qPos.add(groupId);
4031
4032 if (urlTitle != null) {
4033 qPos.add(urlTitle);
4034 }
4035
4036 List<BlogsEntry> list = q.list();
4037
4038 result = list;
4039
4040 BlogsEntry blogsEntry = null;
4041
4042 if (list.isEmpty()) {
4043 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_UT,
4044 finderArgs, list);
4045 }
4046 else {
4047 blogsEntry = list.get(0);
4048
4049 cacheResult(blogsEntry);
4050
4051 if ((blogsEntry.getGroupId() != groupId) ||
4052 (blogsEntry.getUrlTitle() == null) ||
4053 !blogsEntry.getUrlTitle().equals(urlTitle)) {
4054 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_UT,
4055 finderArgs, blogsEntry);
4056 }
4057 }
4058
4059 return blogsEntry;
4060 }
4061 catch (Exception e) {
4062 throw processException(e);
4063 }
4064 finally {
4065 if (result == null) {
4066 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_UT,
4067 finderArgs);
4068 }
4069
4070 closeSession(session);
4071 }
4072 }
4073 else {
4074 if (result instanceof List<?>) {
4075 return null;
4076 }
4077 else {
4078 return (BlogsEntry)result;
4079 }
4080 }
4081 }
4082
4083
4091 public List<BlogsEntry> findByG_LtD(long groupId, Date displayDate)
4092 throws SystemException {
4093 return findByG_LtD(groupId, displayDate, QueryUtil.ALL_POS,
4094 QueryUtil.ALL_POS, null);
4095 }
4096
4097
4111 public List<BlogsEntry> findByG_LtD(long groupId, Date displayDate,
4112 int start, int end) throws SystemException {
4113 return findByG_LtD(groupId, displayDate, start, end, null);
4114 }
4115
4116
4131 public List<BlogsEntry> findByG_LtD(long groupId, Date displayDate,
4132 int start, int end, OrderByComparator orderByComparator)
4133 throws SystemException {
4134 FinderPath finderPath = null;
4135 Object[] finderArgs = null;
4136
4137 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_LTD;
4138 finderArgs = new Object[] {
4139 groupId, displayDate,
4140
4141 start, end, orderByComparator
4142 };
4143
4144 List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
4145 finderArgs, this);
4146
4147 if ((list != null) && !list.isEmpty()) {
4148 for (BlogsEntry blogsEntry : list) {
4149 if ((groupId != blogsEntry.getGroupId()) ||
4150 !Validator.equals(displayDate,
4151 blogsEntry.getDisplayDate())) {
4152 list = null;
4153
4154 break;
4155 }
4156 }
4157 }
4158
4159 if (list == null) {
4160 StringBundler query = null;
4161
4162 if (orderByComparator != null) {
4163 query = new StringBundler(4 +
4164 (orderByComparator.getOrderByFields().length * 3));
4165 }
4166 else {
4167 query = new StringBundler(4);
4168 }
4169
4170 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
4171
4172 query.append(_FINDER_COLUMN_G_LTD_GROUPID_2);
4173
4174 if (displayDate == null) {
4175 query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_1);
4176 }
4177 else {
4178 query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_2);
4179 }
4180
4181 if (orderByComparator != null) {
4182 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4183 orderByComparator);
4184 }
4185
4186 else {
4187 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4188 }
4189
4190 String sql = query.toString();
4191
4192 Session session = null;
4193
4194 try {
4195 session = openSession();
4196
4197 Query q = session.createQuery(sql);
4198
4199 QueryPos qPos = QueryPos.getInstance(q);
4200
4201 qPos.add(groupId);
4202
4203 if (displayDate != null) {
4204 qPos.add(CalendarUtil.getTimestamp(displayDate));
4205 }
4206
4207 list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
4208 end);
4209 }
4210 catch (Exception e) {
4211 throw processException(e);
4212 }
4213 finally {
4214 if (list == null) {
4215 FinderCacheUtil.removeResult(finderPath, finderArgs);
4216 }
4217 else {
4218 cacheResult(list);
4219
4220 FinderCacheUtil.putResult(finderPath, finderArgs, list);
4221 }
4222
4223 closeSession(session);
4224 }
4225 }
4226
4227 return list;
4228 }
4229
4230
4240 public BlogsEntry findByG_LtD_First(long groupId, Date displayDate,
4241 OrderByComparator orderByComparator)
4242 throws NoSuchEntryException, SystemException {
4243 BlogsEntry blogsEntry = fetchByG_LtD_First(groupId, displayDate,
4244 orderByComparator);
4245
4246 if (blogsEntry != null) {
4247 return blogsEntry;
4248 }
4249
4250 StringBundler msg = new StringBundler(6);
4251
4252 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4253
4254 msg.append("groupId=");
4255 msg.append(groupId);
4256
4257 msg.append(", displayDate=");
4258 msg.append(displayDate);
4259
4260 msg.append(StringPool.CLOSE_CURLY_BRACE);
4261
4262 throw new NoSuchEntryException(msg.toString());
4263 }
4264
4265
4274 public BlogsEntry fetchByG_LtD_First(long groupId, Date displayDate,
4275 OrderByComparator orderByComparator) throws SystemException {
4276 List<BlogsEntry> list = findByG_LtD(groupId, displayDate, 0, 1,
4277 orderByComparator);
4278
4279 if (!list.isEmpty()) {
4280 return list.get(0);
4281 }
4282
4283 return null;
4284 }
4285
4286
4296 public BlogsEntry findByG_LtD_Last(long groupId, Date displayDate,
4297 OrderByComparator orderByComparator)
4298 throws NoSuchEntryException, SystemException {
4299 BlogsEntry blogsEntry = fetchByG_LtD_Last(groupId, displayDate,
4300 orderByComparator);
4301
4302 if (blogsEntry != null) {
4303 return blogsEntry;
4304 }
4305
4306 StringBundler msg = new StringBundler(6);
4307
4308 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4309
4310 msg.append("groupId=");
4311 msg.append(groupId);
4312
4313 msg.append(", displayDate=");
4314 msg.append(displayDate);
4315
4316 msg.append(StringPool.CLOSE_CURLY_BRACE);
4317
4318 throw new NoSuchEntryException(msg.toString());
4319 }
4320
4321
4330 public BlogsEntry fetchByG_LtD_Last(long groupId, Date displayDate,
4331 OrderByComparator orderByComparator) throws SystemException {
4332 int count = countByG_LtD(groupId, displayDate);
4333
4334 List<BlogsEntry> list = findByG_LtD(groupId, displayDate, count - 1,
4335 count, orderByComparator);
4336
4337 if (!list.isEmpty()) {
4338 return list.get(0);
4339 }
4340
4341 return null;
4342 }
4343
4344
4355 public BlogsEntry[] findByG_LtD_PrevAndNext(long entryId, long groupId,
4356 Date displayDate, OrderByComparator orderByComparator)
4357 throws NoSuchEntryException, SystemException {
4358 BlogsEntry blogsEntry = findByPrimaryKey(entryId);
4359
4360 Session session = null;
4361
4362 try {
4363 session = openSession();
4364
4365 BlogsEntry[] array = new BlogsEntryImpl[3];
4366
4367 array[0] = getByG_LtD_PrevAndNext(session, blogsEntry, groupId,
4368 displayDate, orderByComparator, true);
4369
4370 array[1] = blogsEntry;
4371
4372 array[2] = getByG_LtD_PrevAndNext(session, blogsEntry, groupId,
4373 displayDate, orderByComparator, false);
4374
4375 return array;
4376 }
4377 catch (Exception e) {
4378 throw processException(e);
4379 }
4380 finally {
4381 closeSession(session);
4382 }
4383 }
4384
4385 protected BlogsEntry getByG_LtD_PrevAndNext(Session session,
4386 BlogsEntry blogsEntry, long groupId, Date displayDate,
4387 OrderByComparator orderByComparator, boolean previous) {
4388 StringBundler query = null;
4389
4390 if (orderByComparator != null) {
4391 query = new StringBundler(6 +
4392 (orderByComparator.getOrderByFields().length * 6));
4393 }
4394 else {
4395 query = new StringBundler(3);
4396 }
4397
4398 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
4399
4400 query.append(_FINDER_COLUMN_G_LTD_GROUPID_2);
4401
4402 if (displayDate == null) {
4403 query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_1);
4404 }
4405 else {
4406 query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_2);
4407 }
4408
4409 if (orderByComparator != null) {
4410 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
4411
4412 if (orderByConditionFields.length > 0) {
4413 query.append(WHERE_AND);
4414 }
4415
4416 for (int i = 0; i < orderByConditionFields.length; i++) {
4417 query.append(_ORDER_BY_ENTITY_ALIAS);
4418 query.append(orderByConditionFields[i]);
4419
4420 if ((i + 1) < orderByConditionFields.length) {
4421 if (orderByComparator.isAscending() ^ previous) {
4422 query.append(WHERE_GREATER_THAN_HAS_NEXT);
4423 }
4424 else {
4425 query.append(WHERE_LESSER_THAN_HAS_NEXT);
4426 }
4427 }
4428 else {
4429 if (orderByComparator.isAscending() ^ previous) {
4430 query.append(WHERE_GREATER_THAN);
4431 }
4432 else {
4433 query.append(WHERE_LESSER_THAN);
4434 }
4435 }
4436 }
4437
4438 query.append(ORDER_BY_CLAUSE);
4439
4440 String[] orderByFields = orderByComparator.getOrderByFields();
4441
4442 for (int i = 0; i < orderByFields.length; i++) {
4443 query.append(_ORDER_BY_ENTITY_ALIAS);
4444 query.append(orderByFields[i]);
4445
4446 if ((i + 1) < orderByFields.length) {
4447 if (orderByComparator.isAscending() ^ previous) {
4448 query.append(ORDER_BY_ASC_HAS_NEXT);
4449 }
4450 else {
4451 query.append(ORDER_BY_DESC_HAS_NEXT);
4452 }
4453 }
4454 else {
4455 if (orderByComparator.isAscending() ^ previous) {
4456 query.append(ORDER_BY_ASC);
4457 }
4458 else {
4459 query.append(ORDER_BY_DESC);
4460 }
4461 }
4462 }
4463 }
4464
4465 else {
4466 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4467 }
4468
4469 String sql = query.toString();
4470
4471 Query q = session.createQuery(sql);
4472
4473 q.setFirstResult(0);
4474 q.setMaxResults(2);
4475
4476 QueryPos qPos = QueryPos.getInstance(q);
4477
4478 qPos.add(groupId);
4479
4480 if (displayDate != null) {
4481 qPos.add(CalendarUtil.getTimestamp(displayDate));
4482 }
4483
4484 if (orderByComparator != null) {
4485 Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
4486
4487 for (Object value : values) {
4488 qPos.add(value);
4489 }
4490 }
4491
4492 List<BlogsEntry> list = q.list();
4493
4494 if (list.size() == 2) {
4495 return list.get(1);
4496 }
4497 else {
4498 return null;
4499 }
4500 }
4501
4502
4510 public List<BlogsEntry> filterFindByG_LtD(long groupId, Date displayDate)
4511 throws SystemException {
4512 return filterFindByG_LtD(groupId, displayDate, QueryUtil.ALL_POS,
4513 QueryUtil.ALL_POS, null);
4514 }
4515
4516
4530 public List<BlogsEntry> filterFindByG_LtD(long groupId, Date displayDate,
4531 int start, int end) throws SystemException {
4532 return filterFindByG_LtD(groupId, displayDate, start, end, null);
4533 }
4534
4535
4550 public List<BlogsEntry> filterFindByG_LtD(long groupId, Date displayDate,
4551 int start, int end, OrderByComparator orderByComparator)
4552 throws SystemException {
4553 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
4554 return findByG_LtD(groupId, displayDate, start, end,
4555 orderByComparator);
4556 }
4557
4558 StringBundler query = null;
4559
4560 if (orderByComparator != null) {
4561 query = new StringBundler(4 +
4562 (orderByComparator.getOrderByFields().length * 3));
4563 }
4564 else {
4565 query = new StringBundler(4);
4566 }
4567
4568 if (getDB().isSupportsInlineDistinct()) {
4569 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
4570 }
4571 else {
4572 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
4573 }
4574
4575 query.append(_FINDER_COLUMN_G_LTD_GROUPID_2);
4576
4577 if (displayDate == null) {
4578 query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_1);
4579 }
4580 else {
4581 query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_2);
4582 }
4583
4584 if (!getDB().isSupportsInlineDistinct()) {
4585 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
4586 }
4587
4588 if (orderByComparator != null) {
4589 if (getDB().isSupportsInlineDistinct()) {
4590 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4591 orderByComparator);
4592 }
4593 else {
4594 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
4595 orderByComparator);
4596 }
4597 }
4598
4599 else {
4600 if (getDB().isSupportsInlineDistinct()) {
4601 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4602 }
4603 else {
4604 query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
4605 }
4606 }
4607
4608 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
4609 BlogsEntry.class.getName(),
4610 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
4611
4612 Session session = null;
4613
4614 try {
4615 session = openSession();
4616
4617 SQLQuery q = session.createSQLQuery(sql);
4618
4619 if (getDB().isSupportsInlineDistinct()) {
4620 q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
4621 }
4622 else {
4623 q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
4624 }
4625
4626 QueryPos qPos = QueryPos.getInstance(q);
4627
4628 qPos.add(groupId);
4629
4630 if (displayDate != null) {
4631 qPos.add(CalendarUtil.getTimestamp(displayDate));
4632 }
4633
4634 return (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start, end);
4635 }
4636 catch (Exception e) {
4637 throw processException(e);
4638 }
4639 finally {
4640 closeSession(session);
4641 }
4642 }
4643
4644
4655 public BlogsEntry[] filterFindByG_LtD_PrevAndNext(long entryId,
4656 long groupId, Date displayDate, OrderByComparator orderByComparator)
4657 throws NoSuchEntryException, SystemException {
4658 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
4659 return findByG_LtD_PrevAndNext(entryId, groupId, displayDate,
4660 orderByComparator);
4661 }
4662
4663 BlogsEntry blogsEntry = findByPrimaryKey(entryId);
4664
4665 Session session = null;
4666
4667 try {
4668 session = openSession();
4669
4670 BlogsEntry[] array = new BlogsEntryImpl[3];
4671
4672 array[0] = filterGetByG_LtD_PrevAndNext(session, blogsEntry,
4673 groupId, displayDate, orderByComparator, true);
4674
4675 array[1] = blogsEntry;
4676
4677 array[2] = filterGetByG_LtD_PrevAndNext(session, blogsEntry,
4678 groupId, displayDate, orderByComparator, false);
4679
4680 return array;
4681 }
4682 catch (Exception e) {
4683 throw processException(e);
4684 }
4685 finally {
4686 closeSession(session);
4687 }
4688 }
4689
4690 protected BlogsEntry filterGetByG_LtD_PrevAndNext(Session session,
4691 BlogsEntry blogsEntry, long groupId, Date displayDate,
4692 OrderByComparator orderByComparator, boolean previous) {
4693 StringBundler query = null;
4694
4695 if (orderByComparator != null) {
4696 query = new StringBundler(6 +
4697 (orderByComparator.getOrderByFields().length * 6));
4698 }
4699 else {
4700 query = new StringBundler(3);
4701 }
4702
4703 if (getDB().isSupportsInlineDistinct()) {
4704 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
4705 }
4706 else {
4707 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
4708 }
4709
4710 query.append(_FINDER_COLUMN_G_LTD_GROUPID_2);
4711
4712 if (displayDate == null) {
4713 query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_1);
4714 }
4715 else {
4716 query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_2);
4717 }
4718
4719 if (!getDB().isSupportsInlineDistinct()) {
4720 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
4721 }
4722
4723 if (orderByComparator != null) {
4724 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
4725
4726 if (orderByConditionFields.length > 0) {
4727 query.append(WHERE_AND);
4728 }
4729
4730 for (int i = 0; i < orderByConditionFields.length; i++) {
4731 if (getDB().isSupportsInlineDistinct()) {
4732 query.append(_ORDER_BY_ENTITY_ALIAS);
4733 }
4734 else {
4735 query.append(_ORDER_BY_ENTITY_TABLE);
4736 }
4737
4738 query.append(orderByConditionFields[i]);
4739
4740 if ((i + 1) < orderByConditionFields.length) {
4741 if (orderByComparator.isAscending() ^ previous) {
4742 query.append(WHERE_GREATER_THAN_HAS_NEXT);
4743 }
4744 else {
4745 query.append(WHERE_LESSER_THAN_HAS_NEXT);
4746 }
4747 }
4748 else {
4749 if (orderByComparator.isAscending() ^ previous) {
4750 query.append(WHERE_GREATER_THAN);
4751 }
4752 else {
4753 query.append(WHERE_LESSER_THAN);
4754 }
4755 }
4756 }
4757
4758 query.append(ORDER_BY_CLAUSE);
4759
4760 String[] orderByFields = orderByComparator.getOrderByFields();
4761
4762 for (int i = 0; i < orderByFields.length; i++) {
4763 if (getDB().isSupportsInlineDistinct()) {
4764 query.append(_ORDER_BY_ENTITY_ALIAS);
4765 }
4766 else {
4767 query.append(_ORDER_BY_ENTITY_TABLE);
4768 }
4769
4770 query.append(orderByFields[i]);
4771
4772 if ((i + 1) < orderByFields.length) {
4773 if (orderByComparator.isAscending() ^ previous) {
4774 query.append(ORDER_BY_ASC_HAS_NEXT);
4775 }
4776 else {
4777 query.append(ORDER_BY_DESC_HAS_NEXT);
4778 }
4779 }
4780 else {
4781 if (orderByComparator.isAscending() ^ previous) {
4782 query.append(ORDER_BY_ASC);
4783 }
4784 else {
4785 query.append(ORDER_BY_DESC);
4786 }
4787 }
4788 }
4789 }
4790
4791 else {
4792 if (getDB().isSupportsInlineDistinct()) {
4793 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4794 }
4795 else {
4796 query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
4797 }
4798 }
4799
4800 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
4801 BlogsEntry.class.getName(),
4802 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
4803
4804 SQLQuery q = session.createSQLQuery(sql);
4805
4806 q.setFirstResult(0);
4807 q.setMaxResults(2);
4808
4809 if (getDB().isSupportsInlineDistinct()) {
4810 q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
4811 }
4812 else {
4813 q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
4814 }
4815
4816 QueryPos qPos = QueryPos.getInstance(q);
4817
4818 qPos.add(groupId);
4819
4820 if (displayDate != null) {
4821 qPos.add(CalendarUtil.getTimestamp(displayDate));
4822 }
4823
4824 if (orderByComparator != null) {
4825 Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
4826
4827 for (Object value : values) {
4828 qPos.add(value);
4829 }
4830 }
4831
4832 List<BlogsEntry> list = q.list();
4833
4834 if (list.size() == 2) {
4835 return list.get(1);
4836 }
4837 else {
4838 return null;
4839 }
4840 }
4841
4842
4850 public List<BlogsEntry> findByG_S(long groupId, int status)
4851 throws SystemException {
4852 return findByG_S(groupId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
4853 null);
4854 }
4855
4856
4870 public List<BlogsEntry> findByG_S(long groupId, int status, int start,
4871 int end) throws SystemException {
4872 return findByG_S(groupId, status, start, end, null);
4873 }
4874
4875
4890 public List<BlogsEntry> findByG_S(long groupId, int status, int start,
4891 int end, OrderByComparator orderByComparator) throws SystemException {
4892 FinderPath finderPath = null;
4893 Object[] finderArgs = null;
4894
4895 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
4896 (orderByComparator == null)) {
4897 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S;
4898 finderArgs = new Object[] { groupId, status };
4899 }
4900 else {
4901 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_S;
4902 finderArgs = new Object[] {
4903 groupId, status,
4904
4905 start, end, orderByComparator
4906 };
4907 }
4908
4909 List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
4910 finderArgs, this);
4911
4912 if ((list != null) && !list.isEmpty()) {
4913 for (BlogsEntry blogsEntry : list) {
4914 if ((groupId != blogsEntry.getGroupId()) ||
4915 (status != blogsEntry.getStatus())) {
4916 list = null;
4917
4918 break;
4919 }
4920 }
4921 }
4922
4923 if (list == null) {
4924 StringBundler query = null;
4925
4926 if (orderByComparator != null) {
4927 query = new StringBundler(4 +
4928 (orderByComparator.getOrderByFields().length * 3));
4929 }
4930 else {
4931 query = new StringBundler(4);
4932 }
4933
4934 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
4935
4936 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
4937
4938 query.append(_FINDER_COLUMN_G_S_STATUS_2);
4939
4940 if (orderByComparator != null) {
4941 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4942 orderByComparator);
4943 }
4944
4945 else {
4946 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4947 }
4948
4949 String sql = query.toString();
4950
4951 Session session = null;
4952
4953 try {
4954 session = openSession();
4955
4956 Query q = session.createQuery(sql);
4957
4958 QueryPos qPos = QueryPos.getInstance(q);
4959
4960 qPos.add(groupId);
4961
4962 qPos.add(status);
4963
4964 list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
4965 end);
4966 }
4967 catch (Exception e) {
4968 throw processException(e);
4969 }
4970 finally {
4971 if (list == null) {
4972 FinderCacheUtil.removeResult(finderPath, finderArgs);
4973 }
4974 else {
4975 cacheResult(list);
4976
4977 FinderCacheUtil.putResult(finderPath, finderArgs, list);
4978 }
4979
4980 closeSession(session);
4981 }
4982 }
4983
4984 return list;
4985 }
4986
4987
4997 public BlogsEntry findByG_S_First(long groupId, int status,
4998 OrderByComparator orderByComparator)
4999 throws NoSuchEntryException, SystemException {
5000 BlogsEntry blogsEntry = fetchByG_S_First(groupId, status,
5001 orderByComparator);
5002
5003 if (blogsEntry != null) {
5004 return blogsEntry;
5005 }
5006
5007 StringBundler msg = new StringBundler(6);
5008
5009 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5010
5011 msg.append("groupId=");
5012 msg.append(groupId);
5013
5014 msg.append(", status=");
5015 msg.append(status);
5016
5017 msg.append(StringPool.CLOSE_CURLY_BRACE);
5018
5019 throw new NoSuchEntryException(msg.toString());
5020 }
5021
5022
5031 public BlogsEntry fetchByG_S_First(long groupId, int status,
5032 OrderByComparator orderByComparator) throws SystemException {
5033 List<BlogsEntry> list = findByG_S(groupId, status, 0, 1,
5034 orderByComparator);
5035
5036 if (!list.isEmpty()) {
5037 return list.get(0);
5038 }
5039
5040 return null;
5041 }
5042
5043
5053 public BlogsEntry findByG_S_Last(long groupId, int status,
5054 OrderByComparator orderByComparator)
5055 throws NoSuchEntryException, SystemException {
5056 BlogsEntry blogsEntry = fetchByG_S_Last(groupId, status,
5057 orderByComparator);
5058
5059 if (blogsEntry != null) {
5060 return blogsEntry;
5061 }
5062
5063 StringBundler msg = new StringBundler(6);
5064
5065 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5066
5067 msg.append("groupId=");
5068 msg.append(groupId);
5069
5070 msg.append(", status=");
5071 msg.append(status);
5072
5073 msg.append(StringPool.CLOSE_CURLY_BRACE);
5074
5075 throw new NoSuchEntryException(msg.toString());
5076 }
5077
5078
5087 public BlogsEntry fetchByG_S_Last(long groupId, int status,
5088 OrderByComparator orderByComparator) throws SystemException {
5089 int count = countByG_S(groupId, status);
5090
5091 List<BlogsEntry> list = findByG_S(groupId, status, count - 1, count,
5092 orderByComparator);
5093
5094 if (!list.isEmpty()) {
5095 return list.get(0);
5096 }
5097
5098 return null;
5099 }
5100
5101
5112 public BlogsEntry[] findByG_S_PrevAndNext(long entryId, long groupId,
5113 int status, OrderByComparator orderByComparator)
5114 throws NoSuchEntryException, SystemException {
5115 BlogsEntry blogsEntry = findByPrimaryKey(entryId);
5116
5117 Session session = null;
5118
5119 try {
5120 session = openSession();
5121
5122 BlogsEntry[] array = new BlogsEntryImpl[3];
5123
5124 array[0] = getByG_S_PrevAndNext(session, blogsEntry, groupId,
5125 status, orderByComparator, true);
5126
5127 array[1] = blogsEntry;
5128
5129 array[2] = getByG_S_PrevAndNext(session, blogsEntry, groupId,
5130 status, orderByComparator, false);
5131
5132 return array;
5133 }
5134 catch (Exception e) {
5135 throw processException(e);
5136 }
5137 finally {
5138 closeSession(session);
5139 }
5140 }
5141
5142 protected BlogsEntry getByG_S_PrevAndNext(Session session,
5143 BlogsEntry blogsEntry, long groupId, int status,
5144 OrderByComparator orderByComparator, boolean previous) {
5145 StringBundler query = null;
5146
5147 if (orderByComparator != null) {
5148 query = new StringBundler(6 +
5149 (orderByComparator.getOrderByFields().length * 6));
5150 }
5151 else {
5152 query = new StringBundler(3);
5153 }
5154
5155 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
5156
5157 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
5158
5159 query.append(_FINDER_COLUMN_G_S_STATUS_2);
5160
5161 if (orderByComparator != null) {
5162 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
5163
5164 if (orderByConditionFields.length > 0) {
5165 query.append(WHERE_AND);
5166 }
5167
5168 for (int i = 0; i < orderByConditionFields.length; i++) {
5169 query.append(_ORDER_BY_ENTITY_ALIAS);
5170 query.append(orderByConditionFields[i]);
5171
5172 if ((i + 1) < orderByConditionFields.length) {
5173 if (orderByComparator.isAscending() ^ previous) {
5174 query.append(WHERE_GREATER_THAN_HAS_NEXT);
5175 }
5176 else {
5177 query.append(WHERE_LESSER_THAN_HAS_NEXT);
5178 }
5179 }
5180 else {
5181 if (orderByComparator.isAscending() ^ previous) {
5182 query.append(WHERE_GREATER_THAN);
5183 }
5184 else {
5185 query.append(WHERE_LESSER_THAN);
5186 }
5187 }
5188 }
5189
5190 query.append(ORDER_BY_CLAUSE);
5191
5192 String[] orderByFields = orderByComparator.getOrderByFields();
5193
5194 for (int i = 0; i < orderByFields.length; i++) {
5195 query.append(_ORDER_BY_ENTITY_ALIAS);
5196 query.append(orderByFields[i]);
5197
5198 if ((i + 1) < orderByFields.length) {
5199 if (orderByComparator.isAscending() ^ previous) {
5200 query.append(ORDER_BY_ASC_HAS_NEXT);
5201 }
5202 else {
5203 query.append(ORDER_BY_DESC_HAS_NEXT);
5204 }
5205 }
5206 else {
5207 if (orderByComparator.isAscending() ^ previous) {
5208 query.append(ORDER_BY_ASC);
5209 }
5210 else {
5211 query.append(ORDER_BY_DESC);
5212 }
5213 }
5214 }
5215 }
5216
5217 else {
5218 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
5219 }
5220
5221 String sql = query.toString();
5222
5223 Query q = session.createQuery(sql);
5224
5225 q.setFirstResult(0);
5226 q.setMaxResults(2);
5227
5228 QueryPos qPos = QueryPos.getInstance(q);
5229
5230 qPos.add(groupId);
5231
5232 qPos.add(status);
5233
5234 if (orderByComparator != null) {
5235 Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
5236
5237 for (Object value : values) {
5238 qPos.add(value);
5239 }
5240 }
5241
5242 List<BlogsEntry> list = q.list();
5243
5244 if (list.size() == 2) {
5245 return list.get(1);
5246 }
5247 else {
5248 return null;
5249 }
5250 }
5251
5252
5260 public List<BlogsEntry> filterFindByG_S(long groupId, int status)
5261 throws SystemException {
5262 return filterFindByG_S(groupId, status, QueryUtil.ALL_POS,
5263 QueryUtil.ALL_POS, null);
5264 }
5265
5266
5280 public List<BlogsEntry> filterFindByG_S(long groupId, int status,
5281 int start, int end) throws SystemException {
5282 return filterFindByG_S(groupId, status, start, end, null);
5283 }
5284
5285
5300 public List<BlogsEntry> filterFindByG_S(long groupId, int status,
5301 int start, int end, OrderByComparator orderByComparator)
5302 throws SystemException {
5303 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
5304 return findByG_S(groupId, status, start, end, orderByComparator);
5305 }
5306
5307 StringBundler query = null;
5308
5309 if (orderByComparator != null) {
5310 query = new StringBundler(4 +
5311 (orderByComparator.getOrderByFields().length * 3));
5312 }
5313 else {
5314 query = new StringBundler(4);
5315 }
5316
5317 if (getDB().isSupportsInlineDistinct()) {
5318 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
5319 }
5320 else {
5321 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
5322 }
5323
5324 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
5325
5326 query.append(_FINDER_COLUMN_G_S_STATUS_2);
5327
5328 if (!getDB().isSupportsInlineDistinct()) {
5329 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
5330 }
5331
5332 if (orderByComparator != null) {
5333 if (getDB().isSupportsInlineDistinct()) {
5334 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
5335 orderByComparator);
5336 }
5337 else {
5338 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
5339 orderByComparator);
5340 }
5341 }
5342
5343 else {
5344 if (getDB().isSupportsInlineDistinct()) {
5345 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
5346 }
5347 else {
5348 query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
5349 }
5350 }
5351
5352 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
5353 BlogsEntry.class.getName(),
5354 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
5355
5356 Session session = null;
5357
5358 try {
5359 session = openSession();
5360
5361 SQLQuery q = session.createSQLQuery(sql);
5362
5363 if (getDB().isSupportsInlineDistinct()) {
5364 q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
5365 }
5366 else {
5367 q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
5368 }
5369
5370 QueryPos qPos = QueryPos.getInstance(q);
5371
5372 qPos.add(groupId);
5373
5374 qPos.add(status);
5375
5376 return (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start, end);
5377 }
5378 catch (Exception e) {
5379 throw processException(e);
5380 }
5381 finally {
5382 closeSession(session);
5383 }
5384 }
5385
5386
5397 public BlogsEntry[] filterFindByG_S_PrevAndNext(long entryId, long groupId,
5398 int status, OrderByComparator orderByComparator)
5399 throws NoSuchEntryException, SystemException {
5400 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
5401 return findByG_S_PrevAndNext(entryId, groupId, status,
5402 orderByComparator);
5403 }
5404
5405 BlogsEntry blogsEntry = findByPrimaryKey(entryId);
5406
5407 Session session = null;
5408
5409 try {
5410 session = openSession();
5411
5412 BlogsEntry[] array = new BlogsEntryImpl[3];
5413
5414 array[0] = filterGetByG_S_PrevAndNext(session, blogsEntry, groupId,
5415 status, orderByComparator, true);
5416
5417 array[1] = blogsEntry;
5418
5419 array[2] = filterGetByG_S_PrevAndNext(session, blogsEntry, groupId,
5420 status, orderByComparator, false);
5421
5422 return array;
5423 }
5424 catch (Exception e) {
5425 throw processException(e);
5426 }
5427 finally {
5428 closeSession(session);
5429 }
5430 }
5431
5432 protected BlogsEntry filterGetByG_S_PrevAndNext(Session session,
5433 BlogsEntry blogsEntry, long groupId, int status,
5434 OrderByComparator orderByComparator, boolean previous) {
5435 StringBundler query = null;
5436
5437 if (orderByComparator != null) {
5438 query = new StringBundler(6 +
5439 (orderByComparator.getOrderByFields().length * 6));
5440 }
5441 else {
5442 query = new StringBundler(3);
5443 }
5444
5445 if (getDB().isSupportsInlineDistinct()) {
5446 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
5447 }
5448 else {
5449 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
5450 }
5451
5452 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
5453
5454 query.append(_FINDER_COLUMN_G_S_STATUS_2);
5455
5456 if (!getDB().isSupportsInlineDistinct()) {
5457 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
5458 }
5459
5460 if (orderByComparator != null) {
5461 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
5462
5463 if (orderByConditionFields.length > 0) {
5464 query.append(WHERE_AND);
5465 }
5466
5467 for (int i = 0; i < orderByConditionFields.length; i++) {
5468 if (getDB().isSupportsInlineDistinct()) {
5469 query.append(_ORDER_BY_ENTITY_ALIAS);
5470 }
5471 else {
5472 query.append(_ORDER_BY_ENTITY_TABLE);
5473 }
5474
5475 query.append(orderByConditionFields[i]);
5476
5477 if ((i + 1) < orderByConditionFields.length) {
5478 if (orderByComparator.isAscending() ^ previous) {
5479 query.append(WHERE_GREATER_THAN_HAS_NEXT);
5480 }
5481 else {
5482 query.append(WHERE_LESSER_THAN_HAS_NEXT);
5483 }
5484 }
5485 else {
5486 if (orderByComparator.isAscending() ^ previous) {
5487 query.append(WHERE_GREATER_THAN);
5488 }
5489 else {
5490 query.append(WHERE_LESSER_THAN);
5491 }
5492 }
5493 }
5494
5495 query.append(ORDER_BY_CLAUSE);
5496
5497 String[] orderByFields = orderByComparator.getOrderByFields();
5498
5499 for (int i = 0; i < orderByFields.length; i++) {
5500 if (getDB().isSupportsInlineDistinct()) {
5501 query.append(_ORDER_BY_ENTITY_ALIAS);
5502 }
5503 else {
5504 query.append(_ORDER_BY_ENTITY_TABLE);
5505 }
5506
5507 query.append(orderByFields[i]);
5508
5509 if ((i + 1) < orderByFields.length) {
5510 if (orderByComparator.isAscending() ^ previous) {
5511 query.append(ORDER_BY_ASC_HAS_NEXT);
5512 }
5513 else {
5514 query.append(ORDER_BY_DESC_HAS_NEXT);
5515 }
5516 }
5517 else {
5518 if (orderByComparator.isAscending() ^ previous) {
5519 query.append(ORDER_BY_ASC);
5520 }
5521 else {
5522 query.append(ORDER_BY_DESC);
5523 }
5524 }
5525 }
5526 }
5527
5528 else {
5529 if (getDB().isSupportsInlineDistinct()) {
5530 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
5531 }
5532 else {
5533 query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
5534 }
5535 }
5536
5537 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
5538 BlogsEntry.class.getName(),
5539 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
5540
5541 SQLQuery q = session.createSQLQuery(sql);
5542
5543 q.setFirstResult(0);
5544 q.setMaxResults(2);
5545
5546 if (getDB().isSupportsInlineDistinct()) {
5547 q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
5548 }
5549 else {
5550 q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
5551 }
5552
5553 QueryPos qPos = QueryPos.getInstance(q);
5554
5555 qPos.add(groupId);
5556
5557 qPos.add(status);
5558
5559 if (orderByComparator != null) {
5560 Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
5561
5562 for (Object value : values) {
5563 qPos.add(value);
5564 }
5565 }
5566
5567 List<BlogsEntry> list = q.list();
5568
5569 if (list.size() == 2) {
5570 return list.get(1);
5571 }
5572 else {
5573 return null;
5574 }
5575 }
5576
5577
5585 public List<BlogsEntry> findByLtD_S(Date displayDate, int status)
5586 throws SystemException {
5587 return findByLtD_S(displayDate, status, QueryUtil.ALL_POS,
5588 QueryUtil.ALL_POS, null);
5589 }
5590
5591
5605 public List<BlogsEntry> findByLtD_S(Date displayDate, int status,
5606 int start, int end) throws SystemException {
5607 return findByLtD_S(displayDate, status, start, end, null);
5608 }
5609
5610
5625 public List<BlogsEntry> findByLtD_S(Date displayDate, int status,
5626 int start, int end, OrderByComparator orderByComparator)
5627 throws SystemException {
5628 FinderPath finderPath = null;
5629 Object[] finderArgs = null;
5630
5631 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_LTD_S;
5632 finderArgs = new Object[] {
5633 displayDate, status,
5634
5635 start, end, orderByComparator
5636 };
5637
5638 List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
5639 finderArgs, this);
5640
5641 if ((list != null) && !list.isEmpty()) {
5642 for (BlogsEntry blogsEntry : list) {
5643 if (!Validator.equals(displayDate, blogsEntry.getDisplayDate()) ||
5644 (status != blogsEntry.getStatus())) {
5645 list = null;
5646
5647 break;
5648 }
5649 }
5650 }
5651
5652 if (list == null) {
5653 StringBundler query = null;
5654
5655 if (orderByComparator != null) {
5656 query = new StringBundler(4 +
5657 (orderByComparator.getOrderByFields().length * 3));
5658 }
5659 else {
5660 query = new StringBundler(4);
5661 }
5662
5663 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
5664
5665 if (displayDate == null) {
5666 query.append(_FINDER_COLUMN_LTD_S_DISPLAYDATE_1);
5667 }
5668 else {
5669 query.append(_FINDER_COLUMN_LTD_S_DISPLAYDATE_2);
5670 }
5671
5672 query.append(_FINDER_COLUMN_LTD_S_STATUS_2);
5673
5674 if (orderByComparator != null) {
5675 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
5676 orderByComparator);
5677 }
5678
5679 else {
5680 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
5681 }
5682
5683 String sql = query.toString();
5684
5685 Session session = null;
5686
5687 try {
5688 session = openSession();
5689
5690 Query q = session.createQuery(sql);
5691
5692 QueryPos qPos = QueryPos.getInstance(q);
5693
5694 if (displayDate != null) {
5695 qPos.add(CalendarUtil.getTimestamp(displayDate));
5696 }
5697
5698 qPos.add(status);
5699
5700 list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
5701 end);
5702 }
5703 catch (Exception e) {
5704 throw processException(e);
5705 }
5706 finally {
5707 if (list == null) {
5708 FinderCacheUtil.removeResult(finderPath, finderArgs);
5709 }
5710 else {
5711 cacheResult(list);
5712
5713 FinderCacheUtil.putResult(finderPath, finderArgs, list);
5714 }
5715
5716 closeSession(session);
5717 }
5718 }
5719
5720 return list;
5721 }
5722
5723
5733 public BlogsEntry findByLtD_S_First(Date displayDate, int status,
5734 OrderByComparator orderByComparator)
5735 throws NoSuchEntryException, SystemException {
5736 BlogsEntry blogsEntry = fetchByLtD_S_First(displayDate, status,
5737 orderByComparator);
5738
5739 if (blogsEntry != null) {
5740 return blogsEntry;
5741 }
5742
5743 StringBundler msg = new StringBundler(6);
5744
5745 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5746
5747 msg.append("displayDate=");
5748 msg.append(displayDate);
5749
5750 msg.append(", status=");
5751 msg.append(status);
5752
5753 msg.append(StringPool.CLOSE_CURLY_BRACE);
5754
5755 throw new NoSuchEntryException(msg.toString());
5756 }
5757
5758
5767 public BlogsEntry fetchByLtD_S_First(Date displayDate, int status,
5768 OrderByComparator orderByComparator) throws SystemException {
5769 List<BlogsEntry> list = findByLtD_S(displayDate, status, 0, 1,
5770 orderByComparator);
5771
5772 if (!list.isEmpty()) {
5773 return list.get(0);
5774 }
5775
5776 return null;
5777 }
5778
5779
5789 public BlogsEntry findByLtD_S_Last(Date displayDate, int status,
5790 OrderByComparator orderByComparator)
5791 throws NoSuchEntryException, SystemException {
5792 BlogsEntry blogsEntry = fetchByLtD_S_Last(displayDate, status,
5793 orderByComparator);
5794
5795 if (blogsEntry != null) {
5796 return blogsEntry;
5797 }
5798
5799 StringBundler msg = new StringBundler(6);
5800
5801 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5802
5803 msg.append("displayDate=");
5804 msg.append(displayDate);
5805
5806 msg.append(", status=");
5807 msg.append(status);
5808
5809 msg.append(StringPool.CLOSE_CURLY_BRACE);
5810
5811 throw new NoSuchEntryException(msg.toString());
5812 }
5813
5814
5823 public BlogsEntry fetchByLtD_S_Last(Date displayDate, int status,
5824 OrderByComparator orderByComparator) throws SystemException {
5825 int count = countByLtD_S(displayDate, status);
5826
5827 List<BlogsEntry> list = findByLtD_S(displayDate, status, count - 1,
5828 count, orderByComparator);
5829
5830 if (!list.isEmpty()) {
5831 return list.get(0);
5832 }
5833
5834 return null;
5835 }
5836
5837
5848 public BlogsEntry[] findByLtD_S_PrevAndNext(long entryId, Date displayDate,
5849 int status, OrderByComparator orderByComparator)
5850 throws NoSuchEntryException, SystemException {
5851 BlogsEntry blogsEntry = findByPrimaryKey(entryId);
5852
5853 Session session = null;
5854
5855 try {
5856 session = openSession();
5857
5858 BlogsEntry[] array = new BlogsEntryImpl[3];
5859
5860 array[0] = getByLtD_S_PrevAndNext(session, blogsEntry, displayDate,
5861 status, orderByComparator, true);
5862
5863 array[1] = blogsEntry;
5864
5865 array[2] = getByLtD_S_PrevAndNext(session, blogsEntry, displayDate,
5866 status, orderByComparator, false);
5867
5868 return array;
5869 }
5870 catch (Exception e) {
5871 throw processException(e);
5872 }
5873 finally {
5874 closeSession(session);
5875 }
5876 }
5877
5878 protected BlogsEntry getByLtD_S_PrevAndNext(Session session,
5879 BlogsEntry blogsEntry, Date displayDate, int status,
5880 OrderByComparator orderByComparator, boolean previous) {
5881 StringBundler query = null;
5882
5883 if (orderByComparator != null) {
5884 query = new StringBundler(6 +
5885 (orderByComparator.getOrderByFields().length * 6));
5886 }
5887 else {
5888 query = new StringBundler(3);
5889 }
5890
5891 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
5892
5893 if (displayDate == null) {
5894 query.append(_FINDER_COLUMN_LTD_S_DISPLAYDATE_1);
5895 }
5896 else {
5897 query.append(_FINDER_COLUMN_LTD_S_DISPLAYDATE_2);
5898 }
5899
5900 query.append(_FINDER_COLUMN_LTD_S_STATUS_2);
5901
5902 if (orderByComparator != null) {
5903 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
5904
5905 if (orderByConditionFields.length > 0) {
5906 query.append(WHERE_AND);
5907 }
5908
5909 for (int i = 0; i < orderByConditionFields.length; i++) {
5910 query.append(_ORDER_BY_ENTITY_ALIAS);
5911 query.append(orderByConditionFields[i]);
5912
5913 if ((i + 1) < orderByConditionFields.length) {
5914 if (orderByComparator.isAscending() ^ previous) {
5915 query.append(WHERE_GREATER_THAN_HAS_NEXT);
5916 }
5917 else {
5918 query.append(WHERE_LESSER_THAN_HAS_NEXT);
5919 }
5920 }
5921 else {
5922 if (orderByComparator.isAscending() ^ previous) {
5923 query.append(WHERE_GREATER_THAN);
5924 }
5925 else {
5926 query.append(WHERE_LESSER_THAN);
5927 }
5928 }
5929 }
5930
5931 query.append(ORDER_BY_CLAUSE);
5932
5933 String[] orderByFields = orderByComparator.getOrderByFields();
5934
5935 for (int i = 0; i < orderByFields.length; i++) {
5936 query.append(_ORDER_BY_ENTITY_ALIAS);
5937 query.append(orderByFields[i]);
5938
5939 if ((i + 1) < orderByFields.length) {
5940 if (orderByComparator.isAscending() ^ previous) {
5941 query.append(ORDER_BY_ASC_HAS_NEXT);
5942 }
5943 else {
5944 query.append(ORDER_BY_DESC_HAS_NEXT);
5945 }
5946 }
5947 else {
5948 if (orderByComparator.isAscending() ^ previous) {
5949 query.append(ORDER_BY_ASC);
5950 }
5951 else {
5952 query.append(ORDER_BY_DESC);
5953 }
5954 }
5955 }
5956 }
5957
5958 else {
5959 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
5960 }
5961
5962 String sql = query.toString();
5963
5964 Query q = session.createQuery(sql);
5965
5966 q.setFirstResult(0);
5967 q.setMaxResults(2);
5968
5969 QueryPos qPos = QueryPos.getInstance(q);
5970
5971 if (displayDate != null) {
5972 qPos.add(CalendarUtil.getTimestamp(displayDate));
5973 }
5974
5975 qPos.add(status);
5976
5977 if (orderByComparator != null) {
5978 Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
5979
5980 for (Object value : values) {
5981 qPos.add(value);
5982 }
5983 }
5984
5985 List<BlogsEntry> list = q.list();
5986
5987 if (list.size() == 2) {
5988 return list.get(1);
5989 }
5990 else {
5991 return null;
5992 }
5993 }
5994
5995
6004 public List<BlogsEntry> findByC_U_S(long companyId, long userId, int status)
6005 throws SystemException {
6006 return findByC_U_S(companyId, userId, status, QueryUtil.ALL_POS,
6007 QueryUtil.ALL_POS, null);
6008 }
6009
6010
6025 public List<BlogsEntry> findByC_U_S(long companyId, long userId,
6026 int status, int start, int end) throws SystemException {
6027 return findByC_U_S(companyId, userId, status, start, end, null);
6028 }
6029
6030
6046 public List<BlogsEntry> findByC_U_S(long companyId, long userId,
6047 int status, int start, int end, OrderByComparator orderByComparator)
6048 throws SystemException {
6049 FinderPath finderPath = null;
6050 Object[] finderArgs = null;
6051
6052 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
6053 (orderByComparator == null)) {
6054 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_U_S;
6055 finderArgs = new Object[] { companyId, userId, status };
6056 }
6057 else {
6058 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_U_S;
6059 finderArgs = new Object[] {
6060 companyId, userId, status,
6061
6062 start, end, orderByComparator
6063 };
6064 }
6065
6066 List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
6067 finderArgs, this);
6068
6069 if ((list != null) && !list.isEmpty()) {
6070 for (BlogsEntry blogsEntry : list) {
6071 if ((companyId != blogsEntry.getCompanyId()) ||
6072 (userId != blogsEntry.getUserId()) ||
6073 (status != blogsEntry.getStatus())) {
6074 list = null;
6075
6076 break;
6077 }
6078 }
6079 }
6080
6081 if (list == null) {
6082 StringBundler query = null;
6083
6084 if (orderByComparator != null) {
6085 query = new StringBundler(5 +
6086 (orderByComparator.getOrderByFields().length * 3));
6087 }
6088 else {
6089 query = new StringBundler(5);
6090 }
6091
6092 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
6093
6094 query.append(_FINDER_COLUMN_C_U_S_COMPANYID_2);
6095
6096 query.append(_FINDER_COLUMN_C_U_S_USERID_2);
6097
6098 query.append(_FINDER_COLUMN_C_U_S_STATUS_2);
6099
6100 if (orderByComparator != null) {
6101 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
6102 orderByComparator);
6103 }
6104
6105 else {
6106 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
6107 }
6108
6109 String sql = query.toString();
6110
6111 Session session = null;
6112
6113 try {
6114 session = openSession();
6115
6116 Query q = session.createQuery(sql);
6117
6118 QueryPos qPos = QueryPos.getInstance(q);
6119
6120 qPos.add(companyId);
6121
6122 qPos.add(userId);
6123
6124 qPos.add(status);
6125
6126 list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
6127 end);
6128 }
6129 catch (Exception e) {
6130 throw processException(e);
6131 }
6132 finally {
6133 if (list == null) {
6134 FinderCacheUtil.removeResult(finderPath, finderArgs);
6135 }
6136 else {
6137 cacheResult(list);
6138
6139 FinderCacheUtil.putResult(finderPath, finderArgs, list);
6140 }
6141
6142 closeSession(session);
6143 }
6144 }
6145
6146 return list;
6147 }
6148
6149
6160 public BlogsEntry findByC_U_S_First(long companyId, long userId,
6161 int status, OrderByComparator orderByComparator)
6162 throws NoSuchEntryException, SystemException {
6163 BlogsEntry blogsEntry = fetchByC_U_S_First(companyId, userId, status,
6164 orderByComparator);
6165
6166 if (blogsEntry != null) {
6167 return blogsEntry;
6168 }
6169
6170 StringBundler msg = new StringBundler(8);
6171
6172 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
6173
6174 msg.append("companyId=");
6175 msg.append(companyId);
6176
6177 msg.append(", userId=");
6178 msg.append(userId);
6179
6180 msg.append(", status=");
6181 msg.append(status);
6182
6183 msg.append(StringPool.CLOSE_CURLY_BRACE);
6184
6185 throw new NoSuchEntryException(msg.toString());
6186 }
6187
6188
6198 public BlogsEntry fetchByC_U_S_First(long companyId, long userId,
6199 int status, OrderByComparator orderByComparator)
6200 throws SystemException {
6201 List<BlogsEntry> list = findByC_U_S(companyId, userId, status, 0, 1,
6202 orderByComparator);
6203
6204 if (!list.isEmpty()) {
6205 return list.get(0);
6206 }
6207
6208 return null;
6209 }
6210
6211
6222 public BlogsEntry findByC_U_S_Last(long companyId, long userId, int status,
6223 OrderByComparator orderByComparator)
6224 throws NoSuchEntryException, SystemException {
6225 BlogsEntry blogsEntry = fetchByC_U_S_Last(companyId, userId, status,
6226 orderByComparator);
6227
6228 if (blogsEntry != null) {
6229 return blogsEntry;
6230 }
6231
6232 StringBundler msg = new StringBundler(8);
6233
6234 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
6235
6236 msg.append("companyId=");
6237 msg.append(companyId);
6238
6239 msg.append(", userId=");
6240 msg.append(userId);
6241
6242 msg.append(", status=");
6243 msg.append(status);
6244
6245 msg.append(StringPool.CLOSE_CURLY_BRACE);
6246
6247 throw new NoSuchEntryException(msg.toString());
6248 }
6249
6250
6260 public BlogsEntry fetchByC_U_S_Last(long companyId, long userId,
6261 int status, OrderByComparator orderByComparator)
6262 throws SystemException {
6263 int count = countByC_U_S(companyId, userId, status);
6264
6265 List<BlogsEntry> list = findByC_U_S(companyId, userId, status,
6266 count - 1, count, orderByComparator);
6267
6268 if (!list.isEmpty()) {
6269 return list.get(0);
6270 }
6271
6272 return null;
6273 }
6274
6275
6287 public BlogsEntry[] findByC_U_S_PrevAndNext(long entryId, long companyId,
6288 long userId, int status, OrderByComparator orderByComparator)
6289 throws NoSuchEntryException, SystemException {
6290 BlogsEntry blogsEntry = findByPrimaryKey(entryId);
6291
6292 Session session = null;
6293
6294 try {
6295 session = openSession();
6296
6297 BlogsEntry[] array = new BlogsEntryImpl[3];
6298
6299 array[0] = getByC_U_S_PrevAndNext(session, blogsEntry, companyId,
6300 userId, status, orderByComparator, true);
6301
6302 array[1] = blogsEntry;
6303
6304 array[2] = getByC_U_S_PrevAndNext(session, blogsEntry, companyId,
6305 userId, status, orderByComparator, false);
6306
6307 return array;
6308 }
6309 catch (Exception e) {
6310 throw processException(e);
6311 }
6312 finally {
6313 closeSession(session);
6314 }
6315 }
6316
6317 protected BlogsEntry getByC_U_S_PrevAndNext(Session session,
6318 BlogsEntry blogsEntry, long companyId, long userId, int status,
6319 OrderByComparator orderByComparator, boolean previous) {
6320 StringBundler query = null;
6321
6322 if (orderByComparator != null) {
6323 query = new StringBundler(6 +
6324 (orderByComparator.getOrderByFields().length * 6));
6325 }
6326 else {
6327 query = new StringBundler(3);
6328 }
6329
6330 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
6331
6332 query.append(_FINDER_COLUMN_C_U_S_COMPANYID_2);
6333
6334 query.append(_FINDER_COLUMN_C_U_S_USERID_2);
6335
6336 query.append(_FINDER_COLUMN_C_U_S_STATUS_2);
6337
6338 if (orderByComparator != null) {
6339 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
6340
6341 if (orderByConditionFields.length > 0) {
6342 query.append(WHERE_AND);
6343 }
6344
6345 for (int i = 0; i < orderByConditionFields.length; i++) {
6346 query.append(_ORDER_BY_ENTITY_ALIAS);
6347 query.append(orderByConditionFields[i]);
6348
6349 if ((i + 1) < orderByConditionFields.length) {
6350 if (orderByComparator.isAscending() ^ previous) {
6351 query.append(WHERE_GREATER_THAN_HAS_NEXT);
6352 }
6353 else {
6354 query.append(WHERE_LESSER_THAN_HAS_NEXT);
6355 }
6356 }
6357 else {
6358 if (orderByComparator.isAscending() ^ previous) {
6359 query.append(WHERE_GREATER_THAN);
6360 }
6361 else {
6362 query.append(WHERE_LESSER_THAN);
6363 }
6364 }
6365 }
6366
6367 query.append(ORDER_BY_CLAUSE);
6368
6369 String[] orderByFields = orderByComparator.getOrderByFields();
6370
6371 for (int i = 0; i < orderByFields.length; i++) {
6372 query.append(_ORDER_BY_ENTITY_ALIAS);
6373 query.append(orderByFields[i]);
6374
6375 if ((i + 1) < orderByFields.length) {
6376 if (orderByComparator.isAscending() ^ previous) {
6377 query.append(ORDER_BY_ASC_HAS_NEXT);
6378 }
6379 else {
6380 query.append(ORDER_BY_DESC_HAS_NEXT);
6381 }
6382 }
6383 else {
6384 if (orderByComparator.isAscending() ^ previous) {
6385 query.append(ORDER_BY_ASC);
6386 }
6387 else {
6388 query.append(ORDER_BY_DESC);
6389 }
6390 }
6391 }
6392 }
6393
6394 else {
6395 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
6396 }
6397
6398 String sql = query.toString();
6399
6400 Query q = session.createQuery(sql);
6401
6402 q.setFirstResult(0);
6403 q.setMaxResults(2);
6404
6405 QueryPos qPos = QueryPos.getInstance(q);
6406
6407 qPos.add(companyId);
6408
6409 qPos.add(userId);
6410
6411 qPos.add(status);
6412
6413 if (orderByComparator != null) {
6414 Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
6415
6416 for (Object value : values) {
6417 qPos.add(value);
6418 }
6419 }
6420
6421 List<BlogsEntry> list = q.list();
6422
6423 if (list.size() == 2) {
6424 return list.get(1);
6425 }
6426 else {
6427 return null;
6428 }
6429 }
6430
6431
6440 public List<BlogsEntry> findByC_LtD_S(long companyId, Date displayDate,
6441 int status) throws SystemException {
6442 return findByC_LtD_S(companyId, displayDate, status, QueryUtil.ALL_POS,
6443 QueryUtil.ALL_POS, null);
6444 }
6445
6446
6461 public List<BlogsEntry> findByC_LtD_S(long companyId, Date displayDate,
6462 int status, int start, int end) throws SystemException {
6463 return findByC_LtD_S(companyId, displayDate, status, start, end, null);
6464 }
6465
6466
6482 public List<BlogsEntry> findByC_LtD_S(long companyId, Date displayDate,
6483 int status, int start, int end, OrderByComparator orderByComparator)
6484 throws SystemException {
6485 FinderPath finderPath = null;
6486 Object[] finderArgs = null;
6487
6488 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_LTD_S;
6489 finderArgs = new Object[] {
6490 companyId, displayDate, status,
6491
6492 start, end, orderByComparator
6493 };
6494
6495 List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
6496 finderArgs, this);
6497
6498 if ((list != null) && !list.isEmpty()) {
6499 for (BlogsEntry blogsEntry : list) {
6500 if ((companyId != blogsEntry.getCompanyId()) ||
6501 !Validator.equals(displayDate,
6502 blogsEntry.getDisplayDate()) ||
6503 (status != blogsEntry.getStatus())) {
6504 list = null;
6505
6506 break;
6507 }
6508 }
6509 }
6510
6511 if (list == null) {
6512 StringBundler query = null;
6513
6514 if (orderByComparator != null) {
6515 query = new StringBundler(5 +
6516 (orderByComparator.getOrderByFields().length * 3));
6517 }
6518 else {
6519 query = new StringBundler(5);
6520 }
6521
6522 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
6523
6524 query.append(_FINDER_COLUMN_C_LTD_S_COMPANYID_2);
6525
6526 if (displayDate == null) {
6527 query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_1);
6528 }
6529 else {
6530 query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_2);
6531 }
6532
6533 query.append(_FINDER_COLUMN_C_LTD_S_STATUS_2);
6534
6535 if (orderByComparator != null) {
6536 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
6537 orderByComparator);
6538 }
6539
6540 else {
6541 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
6542 }
6543
6544 String sql = query.toString();
6545
6546 Session session = null;
6547
6548 try {
6549 session = openSession();
6550
6551 Query q = session.createQuery(sql);
6552
6553 QueryPos qPos = QueryPos.getInstance(q);
6554
6555 qPos.add(companyId);
6556
6557 if (displayDate != null) {
6558 qPos.add(CalendarUtil.getTimestamp(displayDate));
6559 }
6560
6561 qPos.add(status);
6562
6563 list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
6564 end);
6565 }
6566 catch (Exception e) {
6567 throw processException(e);
6568 }
6569 finally {
6570 if (list == null) {
6571 FinderCacheUtil.removeResult(finderPath, finderArgs);
6572 }
6573 else {
6574 cacheResult(list);
6575
6576 FinderCacheUtil.putResult(finderPath, finderArgs, list);
6577 }
6578
6579 closeSession(session);
6580 }
6581 }
6582
6583 return list;
6584 }
6585
6586
6597 public BlogsEntry findByC_LtD_S_First(long companyId, Date displayDate,
6598 int status, OrderByComparator orderByComparator)
6599 throws NoSuchEntryException, SystemException {
6600 BlogsEntry blogsEntry = fetchByC_LtD_S_First(companyId, displayDate,
6601 status, orderByComparator);
6602
6603 if (blogsEntry != null) {
6604 return blogsEntry;
6605 }
6606
6607 StringBundler msg = new StringBundler(8);
6608
6609 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
6610
6611 msg.append("companyId=");
6612 msg.append(companyId);
6613
6614 msg.append(", displayDate=");
6615 msg.append(displayDate);
6616
6617 msg.append(", status=");
6618 msg.append(status);
6619
6620 msg.append(StringPool.CLOSE_CURLY_BRACE);
6621
6622 throw new NoSuchEntryException(msg.toString());
6623 }
6624
6625
6635 public BlogsEntry fetchByC_LtD_S_First(long companyId, Date displayDate,
6636 int status, OrderByComparator orderByComparator)
6637 throws SystemException {
6638 List<BlogsEntry> list = findByC_LtD_S(companyId, displayDate, status,
6639 0, 1, orderByComparator);
6640
6641 if (!list.isEmpty()) {
6642 return list.get(0);
6643 }
6644
6645 return null;
6646 }
6647
6648
6659 public BlogsEntry findByC_LtD_S_Last(long companyId, Date displayDate,
6660 int status, OrderByComparator orderByComparator)
6661 throws NoSuchEntryException, SystemException {
6662 BlogsEntry blogsEntry = fetchByC_LtD_S_Last(companyId, displayDate,
6663 status, orderByComparator);
6664
6665 if (blogsEntry != null) {
6666 return blogsEntry;
6667 }
6668
6669 StringBundler msg = new StringBundler(8);
6670
6671 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
6672
6673 msg.append("companyId=");
6674 msg.append(companyId);
6675
6676 msg.append(", displayDate=");
6677 msg.append(displayDate);
6678
6679 msg.append(", status=");
6680 msg.append(status);
6681
6682 msg.append(StringPool.CLOSE_CURLY_BRACE);
6683
6684 throw new NoSuchEntryException(msg.toString());
6685 }
6686
6687
6697 public BlogsEntry fetchByC_LtD_S_Last(long companyId, Date displayDate,
6698 int status, OrderByComparator orderByComparator)
6699 throws SystemException {
6700 int count = countByC_LtD_S(companyId, displayDate, status);
6701
6702 List<BlogsEntry> list = findByC_LtD_S(companyId, displayDate, status,
6703 count - 1, count, orderByComparator);
6704
6705 if (!list.isEmpty()) {
6706 return list.get(0);
6707 }
6708
6709 return null;
6710 }
6711
6712
6724 public BlogsEntry[] findByC_LtD_S_PrevAndNext(long entryId, long companyId,
6725 Date displayDate, int status, OrderByComparator orderByComparator)
6726 throws NoSuchEntryException, SystemException {
6727 BlogsEntry blogsEntry = findByPrimaryKey(entryId);
6728
6729 Session session = null;
6730
6731 try {
6732 session = openSession();
6733
6734 BlogsEntry[] array = new BlogsEntryImpl[3];
6735
6736 array[0] = getByC_LtD_S_PrevAndNext(session, blogsEntry, companyId,
6737 displayDate, status, orderByComparator, true);
6738
6739 array[1] = blogsEntry;
6740
6741 array[2] = getByC_LtD_S_PrevAndNext(session, blogsEntry, companyId,
6742 displayDate, status, orderByComparator, false);
6743
6744 return array;
6745 }
6746 catch (Exception e) {
6747 throw processException(e);
6748 }
6749 finally {
6750 closeSession(session);
6751 }
6752 }
6753
6754 protected BlogsEntry getByC_LtD_S_PrevAndNext(Session session,
6755 BlogsEntry blogsEntry, long companyId, Date displayDate, int status,
6756 OrderByComparator orderByComparator, boolean previous) {
6757 StringBundler query = null;
6758
6759 if (orderByComparator != null) {
6760 query = new StringBundler(6 +
6761 (orderByComparator.getOrderByFields().length * 6));
6762 }
6763 else {
6764 query = new StringBundler(3);
6765 }
6766
6767 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
6768
6769 query.append(_FINDER_COLUMN_C_LTD_S_COMPANYID_2);
6770
6771 if (displayDate == null) {
6772 query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_1);
6773 }
6774 else {
6775 query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_2);
6776 }
6777
6778 query.append(_FINDER_COLUMN_C_LTD_S_STATUS_2);
6779
6780 if (orderByComparator != null) {
6781 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
6782
6783 if (orderByConditionFields.length > 0) {
6784 query.append(WHERE_AND);
6785 }
6786
6787 for (int i = 0; i < orderByConditionFields.length; i++) {
6788 query.append(_ORDER_BY_ENTITY_ALIAS);
6789 query.append(orderByConditionFields[i]);
6790
6791 if ((i + 1) < orderByConditionFields.length) {
6792 if (orderByComparator.isAscending() ^ previous) {
6793 query.append(WHERE_GREATER_THAN_HAS_NEXT);
6794 }
6795 else {
6796 query.append(WHERE_LESSER_THAN_HAS_NEXT);
6797 }
6798 }
6799 else {
6800 if (orderByComparator.isAscending() ^ previous) {
6801 query.append(WHERE_GREATER_THAN);
6802 }
6803 else {
6804 query.append(WHERE_LESSER_THAN);
6805 }
6806 }
6807 }
6808
6809 query.append(ORDER_BY_CLAUSE);
6810
6811 String[] orderByFields = orderByComparator.getOrderByFields();
6812
6813 for (int i = 0; i < orderByFields.length; i++) {
6814 query.append(_ORDER_BY_ENTITY_ALIAS);
6815 query.append(orderByFields[i]);
6816
6817 if ((i + 1) < orderByFields.length) {
6818 if (orderByComparator.isAscending() ^ previous) {
6819 query.append(ORDER_BY_ASC_HAS_NEXT);
6820 }
6821 else {
6822 query.append(ORDER_BY_DESC_HAS_NEXT);
6823 }
6824 }
6825 else {
6826 if (orderByComparator.isAscending() ^ previous) {
6827 query.append(ORDER_BY_ASC);
6828 }
6829 else {
6830 query.append(ORDER_BY_DESC);
6831 }
6832 }
6833 }
6834 }
6835
6836 else {
6837 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
6838 }
6839
6840 String sql = query.toString();
6841
6842 Query q = session.createQuery(sql);
6843
6844 q.setFirstResult(0);
6845 q.setMaxResults(2);
6846
6847 QueryPos qPos = QueryPos.getInstance(q);
6848
6849 qPos.add(companyId);
6850
6851 if (displayDate != null) {
6852 qPos.add(CalendarUtil.getTimestamp(displayDate));
6853 }
6854
6855 qPos.add(status);
6856
6857 if (orderByComparator != null) {
6858 Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
6859
6860 for (Object value : values) {
6861 qPos.add(value);
6862 }
6863 }
6864
6865 List<BlogsEntry> list = q.list();
6866
6867 if (list.size() == 2) {
6868 return list.get(1);
6869 }
6870 else {
6871 return null;
6872 }
6873 }
6874
6875
6884 public List<BlogsEntry> findByG_U_LtD(long groupId, long userId,
6885 Date displayDate) throws SystemException {
6886 return findByG_U_LtD(groupId, userId, displayDate, QueryUtil.ALL_POS,
6887 QueryUtil.ALL_POS, null);
6888 }
6889
6890
6905 public List<BlogsEntry> findByG_U_LtD(long groupId, long userId,
6906 Date displayDate, int start, int end) throws SystemException {
6907 return findByG_U_LtD(groupId, userId, displayDate, start, end, null);
6908 }
6909
6910
6926 public List<BlogsEntry> findByG_U_LtD(long groupId, long userId,
6927 Date displayDate, int start, int end,
6928 OrderByComparator orderByComparator) throws SystemException {
6929 FinderPath finderPath = null;
6930 Object[] finderArgs = null;
6931
6932 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_U_LTD;
6933 finderArgs = new Object[] {
6934 groupId, userId, displayDate,
6935
6936 start, end, orderByComparator
6937 };
6938
6939 List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
6940 finderArgs, this);
6941
6942 if ((list != null) && !list.isEmpty()) {
6943 for (BlogsEntry blogsEntry : list) {
6944 if ((groupId != blogsEntry.getGroupId()) ||
6945 (userId != blogsEntry.getUserId()) ||
6946 !Validator.equals(displayDate,
6947 blogsEntry.getDisplayDate())) {
6948 list = null;
6949
6950 break;
6951 }
6952 }
6953 }
6954
6955 if (list == null) {
6956 StringBundler query = null;
6957
6958 if (orderByComparator != null) {
6959 query = new StringBundler(5 +
6960 (orderByComparator.getOrderByFields().length * 3));
6961 }
6962 else {
6963 query = new StringBundler(5);
6964 }
6965
6966 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
6967
6968 query.append(_FINDER_COLUMN_G_U_LTD_GROUPID_2);
6969
6970 query.append(_FINDER_COLUMN_G_U_LTD_USERID_2);
6971
6972 if (displayDate == null) {
6973 query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1);
6974 }
6975 else {
6976 query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2);
6977 }
6978
6979 if (orderByComparator != null) {
6980 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
6981 orderByComparator);
6982 }
6983
6984 else {
6985 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
6986 }
6987
6988 String sql = query.toString();
6989
6990 Session session = null;
6991
6992 try {
6993 session = openSession();
6994
6995 Query q = session.createQuery(sql);
6996
6997 QueryPos qPos = QueryPos.getInstance(q);
6998
6999 qPos.add(groupId);
7000
7001 qPos.add(userId);
7002
7003 if (displayDate != null) {
7004 qPos.add(CalendarUtil.getTimestamp(displayDate));
7005 }
7006
7007 list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
7008 end);
7009 }
7010 catch (Exception e) {
7011 throw processException(e);
7012 }
7013 finally {
7014 if (list == null) {
7015 FinderCacheUtil.removeResult(finderPath, finderArgs);
7016 }
7017 else {
7018 cacheResult(list);
7019
7020 FinderCacheUtil.putResult(finderPath, finderArgs, list);
7021 }
7022
7023 closeSession(session);
7024 }
7025 }
7026
7027 return list;
7028 }
7029
7030
7041 public BlogsEntry findByG_U_LtD_First(long groupId, long userId,
7042 Date displayDate, OrderByComparator orderByComparator)
7043 throws NoSuchEntryException, SystemException {
7044 BlogsEntry blogsEntry = fetchByG_U_LtD_First(groupId, userId,
7045 displayDate, orderByComparator);
7046
7047 if (blogsEntry != null) {
7048 return blogsEntry;
7049 }
7050
7051 StringBundler msg = new StringBundler(8);
7052
7053 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
7054
7055 msg.append("groupId=");
7056 msg.append(groupId);
7057
7058 msg.append(", userId=");
7059 msg.append(userId);
7060
7061 msg.append(", displayDate=");
7062 msg.append(displayDate);
7063
7064 msg.append(StringPool.CLOSE_CURLY_BRACE);
7065
7066 throw new NoSuchEntryException(msg.toString());
7067 }
7068
7069
7079 public BlogsEntry fetchByG_U_LtD_First(long groupId, long userId,
7080 Date displayDate, OrderByComparator orderByComparator)
7081 throws SystemException {
7082 List<BlogsEntry> list = findByG_U_LtD(groupId, userId, displayDate, 0,
7083 1, orderByComparator);
7084
7085 if (!list.isEmpty()) {
7086 return list.get(0);
7087 }
7088
7089 return null;
7090 }
7091
7092
7103 public BlogsEntry findByG_U_LtD_Last(long groupId, long userId,
7104 Date displayDate, OrderByComparator orderByComparator)
7105 throws NoSuchEntryException, SystemException {
7106 BlogsEntry blogsEntry = fetchByG_U_LtD_Last(groupId, userId,
7107 displayDate, orderByComparator);
7108
7109 if (blogsEntry != null) {
7110 return blogsEntry;
7111 }
7112
7113 StringBundler msg = new StringBundler(8);
7114
7115 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
7116
7117 msg.append("groupId=");
7118 msg.append(groupId);
7119
7120 msg.append(", userId=");
7121 msg.append(userId);
7122
7123 msg.append(", displayDate=");
7124 msg.append(displayDate);
7125
7126 msg.append(StringPool.CLOSE_CURLY_BRACE);
7127
7128 throw new NoSuchEntryException(msg.toString());
7129 }
7130
7131
7141 public BlogsEntry fetchByG_U_LtD_Last(long groupId, long userId,
7142 Date displayDate, OrderByComparator orderByComparator)
7143 throws SystemException {
7144 int count = countByG_U_LtD(groupId, userId, displayDate);
7145
7146 List<BlogsEntry> list = findByG_U_LtD(groupId, userId, displayDate,
7147 count - 1, count, orderByComparator);
7148
7149 if (!list.isEmpty()) {
7150 return list.get(0);
7151 }
7152
7153 return null;
7154 }
7155
7156
7168 public BlogsEntry[] findByG_U_LtD_PrevAndNext(long entryId, long groupId,
7169 long userId, Date displayDate, OrderByComparator orderByComparator)
7170 throws NoSuchEntryException, SystemException {
7171 BlogsEntry blogsEntry = findByPrimaryKey(entryId);
7172
7173 Session session = null;
7174
7175 try {
7176 session = openSession();
7177
7178 BlogsEntry[] array = new BlogsEntryImpl[3];
7179
7180 array[0] = getByG_U_LtD_PrevAndNext(session, blogsEntry, groupId,
7181 userId, displayDate, orderByComparator, true);
7182
7183 array[1] = blogsEntry;
7184
7185 array[2] = getByG_U_LtD_PrevAndNext(session, blogsEntry, groupId,
7186 userId, displayDate, orderByComparator, false);
7187
7188 return array;
7189 }
7190 catch (Exception e) {
7191 throw processException(e);
7192 }
7193 finally {
7194 closeSession(session);
7195 }
7196 }
7197
7198 protected BlogsEntry getByG_U_LtD_PrevAndNext(Session session,
7199 BlogsEntry blogsEntry, long groupId, long userId, Date displayDate,
7200 OrderByComparator orderByComparator, boolean previous) {
7201 StringBundler query = null;
7202
7203 if (orderByComparator != null) {
7204 query = new StringBundler(6 +
7205 (orderByComparator.getOrderByFields().length * 6));
7206 }
7207 else {
7208 query = new StringBundler(3);
7209 }
7210
7211 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
7212
7213 query.append(_FINDER_COLUMN_G_U_LTD_GROUPID_2);
7214
7215 query.append(_FINDER_COLUMN_G_U_LTD_USERID_2);
7216
7217 if (displayDate == null) {
7218 query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1);
7219 }
7220 else {
7221 query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2);
7222 }
7223
7224 if (orderByComparator != null) {
7225 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
7226
7227 if (orderByConditionFields.length > 0) {
7228 query.append(WHERE_AND);
7229 }
7230
7231 for (int i = 0; i < orderByConditionFields.length; i++) {
7232 query.append(_ORDER_BY_ENTITY_ALIAS);
7233 query.append(orderByConditionFields[i]);
7234
7235 if ((i + 1) < orderByConditionFields.length) {
7236 if (orderByComparator.isAscending() ^ previous) {
7237 query.append(WHERE_GREATER_THAN_HAS_NEXT);
7238 }
7239 else {
7240 query.append(WHERE_LESSER_THAN_HAS_NEXT);
7241 }
7242 }
7243 else {
7244 if (orderByComparator.isAscending() ^ previous) {
7245 query.append(WHERE_GREATER_THAN);
7246 }
7247 else {
7248 query.append(WHERE_LESSER_THAN);
7249 }
7250 }
7251 }
7252
7253 query.append(ORDER_BY_CLAUSE);
7254
7255 String[] orderByFields = orderByComparator.getOrderByFields();
7256
7257 for (int i = 0; i < orderByFields.length; i++) {
7258 query.append(_ORDER_BY_ENTITY_ALIAS);
7259 query.append(orderByFields[i]);
7260
7261 if ((i + 1) < orderByFields.length) {
7262 if (orderByComparator.isAscending() ^ previous) {
7263 query.append(ORDER_BY_ASC_HAS_NEXT);
7264 }
7265 else {
7266 query.append(ORDER_BY_DESC_HAS_NEXT);
7267 }
7268 }
7269 else {
7270 if (orderByComparator.isAscending() ^ previous) {
7271 query.append(ORDER_BY_ASC);
7272 }
7273 else {
7274 query.append(ORDER_BY_DESC);
7275 }
7276 }
7277 }
7278 }
7279
7280 else {
7281 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
7282 }
7283
7284 String sql = query.toString();
7285
7286 Query q = session.createQuery(sql);
7287
7288 q.setFirstResult(0);
7289 q.setMaxResults(2);
7290
7291 QueryPos qPos = QueryPos.getInstance(q);
7292
7293 qPos.add(groupId);
7294
7295 qPos.add(userId);
7296
7297 if (displayDate != null) {
7298 qPos.add(CalendarUtil.getTimestamp(displayDate));
7299 }
7300
7301 if (orderByComparator != null) {
7302 Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
7303
7304 for (Object value : values) {
7305 qPos.add(value);
7306 }
7307 }
7308
7309 List<BlogsEntry> list = q.list();
7310
7311 if (list.size() == 2) {
7312 return list.get(1);
7313 }
7314 else {
7315 return null;
7316 }
7317 }
7318
7319
7328 public List<BlogsEntry> filterFindByG_U_LtD(long groupId, long userId,
7329 Date displayDate) throws SystemException {
7330 return filterFindByG_U_LtD(groupId, userId, displayDate,
7331 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
7332 }
7333
7334
7349 public List<BlogsEntry> filterFindByG_U_LtD(long groupId, long userId,
7350 Date displayDate, int start, int end) throws SystemException {
7351 return filterFindByG_U_LtD(groupId, userId, displayDate, start, end,
7352 null);
7353 }
7354
7355
7371 public List<BlogsEntry> filterFindByG_U_LtD(long groupId, long userId,
7372 Date displayDate, int start, int end,
7373 OrderByComparator orderByComparator) throws SystemException {
7374 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
7375 return findByG_U_LtD(groupId, userId, displayDate, start, end,
7376 orderByComparator);
7377 }
7378
7379 StringBundler query = null;
7380
7381 if (orderByComparator != null) {
7382 query = new StringBundler(5 +
7383 (orderByComparator.getOrderByFields().length * 3));
7384 }
7385 else {
7386 query = new StringBundler(5);
7387 }
7388
7389 if (getDB().isSupportsInlineDistinct()) {
7390 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
7391 }
7392 else {
7393 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
7394 }
7395
7396 query.append(_FINDER_COLUMN_G_U_LTD_GROUPID_2);
7397
7398 query.append(_FINDER_COLUMN_G_U_LTD_USERID_2);
7399
7400 if (displayDate == null) {
7401 query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1);
7402 }
7403 else {
7404 query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2);
7405 }
7406
7407 if (!getDB().isSupportsInlineDistinct()) {
7408 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
7409 }
7410
7411 if (orderByComparator != null) {
7412 if (getDB().isSupportsInlineDistinct()) {
7413 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
7414 orderByComparator);
7415 }
7416 else {
7417 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
7418 orderByComparator);
7419 }
7420 }
7421
7422 else {
7423 if (getDB().isSupportsInlineDistinct()) {
7424 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
7425 }
7426 else {
7427 query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
7428 }
7429 }
7430
7431 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
7432 BlogsEntry.class.getName(),
7433 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
7434
7435 Session session = null;
7436
7437 try {
7438 session = openSession();
7439
7440 SQLQuery q = session.createSQLQuery(sql);
7441
7442 if (getDB().isSupportsInlineDistinct()) {
7443 q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
7444 }
7445 else {
7446 q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
7447 }
7448
7449 QueryPos qPos = QueryPos.getInstance(q);
7450
7451 qPos.add(groupId);
7452
7453 qPos.add(userId);
7454
7455 if (displayDate != null) {
7456 qPos.add(CalendarUtil.getTimestamp(displayDate));
7457 }
7458
7459 return (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start, end);
7460 }
7461 catch (Exception e) {
7462 throw processException(e);
7463 }
7464 finally {
7465 closeSession(session);
7466 }
7467 }
7468
7469
7481 public BlogsEntry[] filterFindByG_U_LtD_PrevAndNext(long entryId,
7482 long groupId, long userId, Date displayDate,
7483 OrderByComparator orderByComparator)
7484 throws NoSuchEntryException, SystemException {
7485 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
7486 return findByG_U_LtD_PrevAndNext(entryId, groupId, userId,
7487 displayDate, orderByComparator);
7488 }
7489
7490 BlogsEntry blogsEntry = findByPrimaryKey(entryId);
7491
7492 Session session = null;
7493
7494 try {
7495 session = openSession();
7496
7497 BlogsEntry[] array = new BlogsEntryImpl[3];
7498
7499 array[0] = filterGetByG_U_LtD_PrevAndNext(session, blogsEntry,
7500 groupId, userId, displayDate, orderByComparator, true);
7501
7502 array[1] = blogsEntry;
7503
7504 array[2] = filterGetByG_U_LtD_PrevAndNext(session, blogsEntry,
7505 groupId, userId, displayDate, orderByComparator, false);
7506
7507 return array;
7508 }
7509 catch (Exception e) {
7510 throw processException(e);
7511 }
7512 finally {
7513 closeSession(session);
7514 }
7515 }
7516
7517 protected BlogsEntry filterGetByG_U_LtD_PrevAndNext(Session session,
7518 BlogsEntry blogsEntry, long groupId, long userId, Date displayDate,
7519 OrderByComparator orderByComparator, boolean previous) {
7520 StringBundler query = null;
7521
7522 if (orderByComparator != null) {
7523 query = new StringBundler(6 +
7524 (orderByComparator.getOrderByFields().length * 6));
7525 }
7526 else {
7527 query = new StringBundler(3);
7528 }
7529
7530 if (getDB().isSupportsInlineDistinct()) {
7531 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
7532 }
7533 else {
7534 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
7535 }
7536
7537 query.append(_FINDER_COLUMN_G_U_LTD_GROUPID_2);
7538
7539 query.append(_FINDER_COLUMN_G_U_LTD_USERID_2);
7540
7541 if (displayDate == null) {
7542 query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1);
7543 }
7544 else {
7545 query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2);
7546 }
7547
7548 if (!getDB().isSupportsInlineDistinct()) {
7549 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
7550 }
7551
7552 if (orderByComparator != null) {
7553 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
7554
7555 if (orderByConditionFields.length > 0) {
7556 query.append(WHERE_AND);
7557 }
7558
7559 for (int i = 0; i < orderByConditionFields.length; i++) {
7560 if (getDB().isSupportsInlineDistinct()) {
7561 query.append(_ORDER_BY_ENTITY_ALIAS);
7562 }
7563 else {
7564 query.append(_ORDER_BY_ENTITY_TABLE);
7565 }
7566
7567 query.append(orderByConditionFields[i]);
7568
7569 if ((i + 1) < orderByConditionFields.length) {
7570 if (orderByComparator.isAscending() ^ previous) {
7571 query.append(WHERE_GREATER_THAN_HAS_NEXT);
7572 }
7573 else {
7574 query.append(WHERE_LESSER_THAN_HAS_NEXT);
7575 }
7576 }
7577 else {
7578 if (orderByComparator.isAscending() ^ previous) {
7579 query.append(WHERE_GREATER_THAN);
7580 }
7581 else {
7582 query.append(WHERE_LESSER_THAN);
7583 }
7584 }
7585 }
7586
7587 query.append(ORDER_BY_CLAUSE);
7588
7589 String[] orderByFields = orderByComparator.getOrderByFields();
7590
7591 for (int i = 0; i < orderByFields.length; i++) {
7592 if (getDB().isSupportsInlineDistinct()) {
7593 query.append(_ORDER_BY_ENTITY_ALIAS);
7594 }
7595 else {
7596 query.append(_ORDER_BY_ENTITY_TABLE);
7597 }
7598
7599 query.append(orderByFields[i]);
7600
7601 if ((i + 1) < orderByFields.length) {
7602 if (orderByComparator.isAscending() ^ previous) {
7603 query.append(ORDER_BY_ASC_HAS_NEXT);
7604 }
7605 else {
7606 query.append(ORDER_BY_DESC_HAS_NEXT);
7607 }
7608 }
7609 else {
7610 if (orderByComparator.isAscending() ^ previous) {
7611 query.append(ORDER_BY_ASC);
7612 }
7613 else {
7614 query.append(ORDER_BY_DESC);
7615 }
7616 }
7617 }
7618 }
7619
7620 else {
7621 if (getDB().isSupportsInlineDistinct()) {
7622 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
7623 }
7624 else {
7625 query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
7626 }
7627 }
7628
7629 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
7630 BlogsEntry.class.getName(),
7631 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
7632
7633 SQLQuery q = session.createSQLQuery(sql);
7634
7635 q.setFirstResult(0);
7636 q.setMaxResults(2);
7637
7638 if (getDB().isSupportsInlineDistinct()) {
7639 q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
7640 }
7641 else {
7642 q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
7643 }
7644
7645 QueryPos qPos = QueryPos.getInstance(q);
7646
7647 qPos.add(groupId);
7648
7649 qPos.add(userId);
7650
7651 if (displayDate != null) {
7652 qPos.add(CalendarUtil.getTimestamp(displayDate));
7653 }
7654
7655 if (orderByComparator != null) {
7656 Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
7657
7658 for (Object value : values) {
7659 qPos.add(value);
7660 }
7661 }
7662
7663 List<BlogsEntry> list = q.list();
7664
7665 if (list.size() == 2) {
7666 return list.get(1);
7667 }
7668 else {
7669 return null;
7670 }
7671 }
7672
7673
7682 public List<BlogsEntry> findByG_U_S(long groupId, long userId, int status)
7683 throws SystemException {
7684 return findByG_U_S(groupId, userId, status, QueryUtil.ALL_POS,
7685 QueryUtil.ALL_POS, null);
7686 }
7687
7688
7703 public List<BlogsEntry> findByG_U_S(long groupId, long userId, int status,
7704 int start, int end) throws SystemException {
7705 return findByG_U_S(groupId, userId, status, start, end, null);
7706 }
7707
7708
7724 public List<BlogsEntry> findByG_U_S(long groupId, long userId, int status,
7725 int start, int end, OrderByComparator orderByComparator)
7726 throws SystemException {
7727 FinderPath finderPath = null;
7728 Object[] finderArgs = null;
7729
7730 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
7731 (orderByComparator == null)) {
7732 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U_S;
7733 finderArgs = new Object[] { groupId, userId, status };
7734 }
7735 else {
7736 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_U_S;
7737 finderArgs = new Object[] {
7738 groupId, userId, status,
7739
7740 start, end, orderByComparator
7741 };
7742 }
7743
7744 List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
7745 finderArgs, this);
7746
7747 if ((list != null) && !list.isEmpty()) {
7748 for (BlogsEntry blogsEntry : list) {
7749 if ((groupId != blogsEntry.getGroupId()) ||
7750 (userId != blogsEntry.getUserId()) ||
7751 (status != blogsEntry.getStatus())) {
7752 list = null;
7753
7754 break;
7755 }
7756 }
7757 }
7758
7759 if (list == null) {
7760 StringBundler query = null;
7761
7762 if (orderByComparator != null) {
7763 query = new StringBundler(5 +
7764 (orderByComparator.getOrderByFields().length * 3));
7765 }
7766 else {
7767 query = new StringBundler(5);
7768 }
7769
7770 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
7771
7772 query.append(_FINDER_COLUMN_G_U_S_GROUPID_2);
7773
7774 query.append(_FINDER_COLUMN_G_U_S_USERID_2);
7775
7776 query.append(_FINDER_COLUMN_G_U_S_STATUS_2);
7777
7778 if (orderByComparator != null) {
7779 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
7780 orderByComparator);
7781 }
7782
7783 else {
7784 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
7785 }
7786
7787 String sql = query.toString();
7788
7789 Session session = null;
7790
7791 try {
7792 session = openSession();
7793
7794 Query q = session.createQuery(sql);
7795
7796 QueryPos qPos = QueryPos.getInstance(q);
7797
7798 qPos.add(groupId);
7799
7800 qPos.add(userId);
7801
7802 qPos.add(status);
7803
7804 list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
7805 end);
7806 }
7807 catch (Exception e) {
7808 throw processException(e);
7809 }
7810 finally {
7811 if (list == null) {
7812 FinderCacheUtil.removeResult(finderPath, finderArgs);
7813 }
7814 else {
7815 cacheResult(list);
7816
7817 FinderCacheUtil.putResult(finderPath, finderArgs, list);
7818 }
7819
7820 closeSession(session);
7821 }
7822 }
7823
7824 return list;
7825 }
7826
7827
7838 public BlogsEntry findByG_U_S_First(long groupId, long userId, int status,
7839 OrderByComparator orderByComparator)
7840 throws NoSuchEntryException, SystemException {
7841 BlogsEntry blogsEntry = fetchByG_U_S_First(groupId, userId, status,
7842 orderByComparator);
7843
7844 if (blogsEntry != null) {
7845 return blogsEntry;
7846 }
7847
7848 StringBundler msg = new StringBundler(8);
7849
7850 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
7851
7852 msg.append("groupId=");
7853 msg.append(groupId);
7854
7855 msg.append(", userId=");
7856 msg.append(userId);
7857
7858 msg.append(", status=");
7859 msg.append(status);
7860
7861 msg.append(StringPool.CLOSE_CURLY_BRACE);
7862
7863 throw new NoSuchEntryException(msg.toString());
7864 }
7865
7866
7876 public BlogsEntry fetchByG_U_S_First(long groupId, long userId, int status,
7877 OrderByComparator orderByComparator) throws SystemException {
7878 List<BlogsEntry> list = findByG_U_S(groupId, userId, status, 0, 1,
7879 orderByComparator);
7880
7881 if (!list.isEmpty()) {
7882 return list.get(0);
7883 }
7884
7885 return null;
7886 }
7887
7888
7899 public BlogsEntry findByG_U_S_Last(long groupId, long userId, int status,
7900 OrderByComparator orderByComparator)
7901 throws NoSuchEntryException, SystemException {
7902 BlogsEntry blogsEntry = fetchByG_U_S_Last(groupId, userId, status,
7903 orderByComparator);
7904
7905 if (blogsEntry != null) {
7906 return blogsEntry;
7907 }
7908
7909 StringBundler msg = new StringBundler(8);
7910
7911 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
7912
7913 msg.append("groupId=");
7914 msg.append(groupId);
7915
7916 msg.append(", userId=");
7917 msg.append(userId);
7918
7919 msg.append(", status=");
7920 msg.append(status);
7921
7922 msg.append(StringPool.CLOSE_CURLY_BRACE);
7923
7924 throw new NoSuchEntryException(msg.toString());
7925 }
7926
7927
7937 public BlogsEntry fetchByG_U_S_Last(long groupId, long userId, int status,
7938 OrderByComparator orderByComparator) throws SystemException {
7939 int count = countByG_U_S(groupId, userId, status);
7940
7941 List<BlogsEntry> list = findByG_U_S(groupId, userId, status, count - 1,
7942 count, orderByComparator);
7943
7944 if (!list.isEmpty()) {
7945 return list.get(0);
7946 }
7947
7948 return null;
7949 }
7950
7951
7963 public BlogsEntry[] findByG_U_S_PrevAndNext(long entryId, long groupId,
7964 long userId, int status, OrderByComparator orderByComparator)
7965 throws NoSuchEntryException, SystemException {
7966 BlogsEntry blogsEntry = findByPrimaryKey(entryId);
7967
7968 Session session = null;
7969
7970 try {
7971 session = openSession();
7972
7973 BlogsEntry[] array = new BlogsEntryImpl[3];
7974
7975 array[0] = getByG_U_S_PrevAndNext(session, blogsEntry, groupId,
7976 userId, status, orderByComparator, true);
7977
7978 array[1] = blogsEntry;
7979
7980 array[2] = getByG_U_S_PrevAndNext(session, blogsEntry, groupId,
7981 userId, status, orderByComparator, false);
7982
7983 return array;
7984 }
7985 catch (Exception e) {
7986 throw processException(e);
7987 }
7988 finally {
7989 closeSession(session);
7990 }
7991 }
7992
7993 protected BlogsEntry getByG_U_S_PrevAndNext(Session session,
7994 BlogsEntry blogsEntry, long groupId, long userId, int status,
7995 OrderByComparator orderByComparator, boolean previous) {
7996 StringBundler query = null;
7997
7998 if (orderByComparator != null) {
7999 query = new StringBundler(6 +
8000 (orderByComparator.getOrderByFields().length * 6));
8001 }
8002 else {
8003 query = new StringBundler(3);
8004 }
8005
8006 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
8007
8008 query.append(_FINDER_COLUMN_G_U_S_GROUPID_2);
8009
8010 query.append(_FINDER_COLUMN_G_U_S_USERID_2);
8011
8012 query.append(_FINDER_COLUMN_G_U_S_STATUS_2);
8013
8014 if (orderByComparator != null) {
8015 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
8016
8017 if (orderByConditionFields.length > 0) {
8018 query.append(WHERE_AND);
8019 }
8020
8021 for (int i = 0; i < orderByConditionFields.length; i++) {
8022 query.append(_ORDER_BY_ENTITY_ALIAS);
8023 query.append(orderByConditionFields[i]);
8024
8025 if ((i + 1) < orderByConditionFields.length) {
8026 if (orderByComparator.isAscending() ^ previous) {
8027 query.append(WHERE_GREATER_THAN_HAS_NEXT);
8028 }
8029 else {
8030 query.append(WHERE_LESSER_THAN_HAS_NEXT);
8031 }
8032 }
8033 else {
8034 if (orderByComparator.isAscending() ^ previous) {
8035 query.append(WHERE_GREATER_THAN);
8036 }
8037 else {
8038 query.append(WHERE_LESSER_THAN);
8039 }
8040 }
8041 }
8042
8043 query.append(ORDER_BY_CLAUSE);
8044
8045 String[] orderByFields = orderByComparator.getOrderByFields();
8046
8047 for (int i = 0; i < orderByFields.length; i++) {
8048 query.append(_ORDER_BY_ENTITY_ALIAS);
8049 query.append(orderByFields[i]);
8050
8051 if ((i + 1) < orderByFields.length) {
8052 if (orderByComparator.isAscending() ^ previous) {
8053 query.append(ORDER_BY_ASC_HAS_NEXT);
8054 }
8055 else {
8056 query.append(ORDER_BY_DESC_HAS_NEXT);
8057 }
8058 }
8059 else {
8060 if (orderByComparator.isAscending() ^ previous) {
8061 query.append(ORDER_BY_ASC);
8062 }
8063 else {
8064 query.append(ORDER_BY_DESC);
8065 }
8066 }
8067 }
8068 }
8069
8070 else {
8071 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
8072 }
8073
8074 String sql = query.toString();
8075
8076 Query q = session.createQuery(sql);
8077
8078 q.setFirstResult(0);
8079 q.setMaxResults(2);
8080
8081 QueryPos qPos = QueryPos.getInstance(q);
8082
8083 qPos.add(groupId);
8084
8085 qPos.add(userId);
8086
8087 qPos.add(status);
8088
8089 if (orderByComparator != null) {
8090 Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
8091
8092 for (Object value : values) {
8093 qPos.add(value);
8094 }
8095 }
8096
8097 List<BlogsEntry> list = q.list();
8098
8099 if (list.size() == 2) {
8100 return list.get(1);
8101 }
8102 else {
8103 return null;
8104 }
8105 }
8106
8107
8116 public List<BlogsEntry> filterFindByG_U_S(long groupId, long userId,
8117 int status) throws SystemException {
8118 return filterFindByG_U_S(groupId, userId, status, QueryUtil.ALL_POS,
8119 QueryUtil.ALL_POS, null);
8120 }
8121
8122
8137 public List<BlogsEntry> filterFindByG_U_S(long groupId, long userId,
8138 int status, int start, int end) throws SystemException {
8139 return filterFindByG_U_S(groupId, userId, status, start, end, null);
8140 }
8141
8142
8158 public List<BlogsEntry> filterFindByG_U_S(long groupId, long userId,
8159 int status, int start, int end, OrderByComparator orderByComparator)
8160 throws SystemException {
8161 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
8162 return findByG_U_S(groupId, userId, status, start, end,
8163 orderByComparator);
8164 }
8165
8166 StringBundler query = null;
8167
8168 if (orderByComparator != null) {
8169 query = new StringBundler(5 +
8170 (orderByComparator.getOrderByFields().length * 3));
8171 }
8172 else {
8173 query = new StringBundler(5);
8174 }
8175
8176 if (getDB().isSupportsInlineDistinct()) {
8177 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
8178 }
8179 else {
8180 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
8181 }
8182
8183 query.append(_FINDER_COLUMN_G_U_S_GROUPID_2);
8184
8185 query.append(_FINDER_COLUMN_G_U_S_USERID_2);
8186
8187 query.append(_FINDER_COLUMN_G_U_S_STATUS_2);
8188
8189 if (!getDB().isSupportsInlineDistinct()) {
8190 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
8191 }
8192
8193 if (orderByComparator != null) {
8194 if (getDB().isSupportsInlineDistinct()) {
8195 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
8196 orderByComparator);
8197 }
8198 else {
8199 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
8200 orderByComparator);
8201 }
8202 }
8203
8204 else {
8205 if (getDB().isSupportsInlineDistinct()) {
8206 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
8207 }
8208 else {
8209 query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
8210 }
8211 }
8212
8213 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
8214 BlogsEntry.class.getName(),
8215 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
8216
8217 Session session = null;
8218
8219 try {
8220 session = openSession();
8221
8222 SQLQuery q = session.createSQLQuery(sql);
8223
8224 if (getDB().isSupportsInlineDistinct()) {
8225 q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
8226 }
8227 else {
8228 q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
8229 }
8230
8231 QueryPos qPos = QueryPos.getInstance(q);
8232
8233 qPos.add(groupId);
8234
8235 qPos.add(userId);
8236
8237 qPos.add(status);
8238
8239 return (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start, end);
8240 }
8241 catch (Exception e) {
8242 throw processException(e);
8243 }
8244 finally {
8245 closeSession(session);
8246 }
8247 }
8248
8249
8261 public BlogsEntry[] filterFindByG_U_S_PrevAndNext(long entryId,
8262 long groupId, long userId, int status,
8263 OrderByComparator orderByComparator)
8264 throws NoSuchEntryException, SystemException {
8265 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
8266 return findByG_U_S_PrevAndNext(entryId, groupId, userId, status,
8267 orderByComparator);
8268 }
8269
8270 BlogsEntry blogsEntry = findByPrimaryKey(entryId);
8271
8272 Session session = null;
8273
8274 try {
8275 session = openSession();
8276
8277 BlogsEntry[] array = new BlogsEntryImpl[3];
8278
8279 array[0] = filterGetByG_U_S_PrevAndNext(session, blogsEntry,
8280 groupId, userId, status, orderByComparator, true);
8281
8282 array[1] = blogsEntry;
8283
8284 array[2] = filterGetByG_U_S_PrevAndNext(session, blogsEntry,
8285 groupId, userId, status, orderByComparator, false);
8286
8287 return array;
8288 }
8289 catch (Exception e) {
8290 throw processException(e);
8291 }
8292 finally {
8293 closeSession(session);
8294 }
8295 }
8296
8297 protected BlogsEntry filterGetByG_U_S_PrevAndNext(Session session,
8298 BlogsEntry blogsEntry, long groupId, long userId, int status,
8299 OrderByComparator orderByComparator, boolean previous) {
8300 StringBundler query = null;
8301
8302 if (orderByComparator != null) {
8303 query = new StringBundler(6 +
8304 (orderByComparator.getOrderByFields().length * 6));
8305 }
8306 else {
8307 query = new StringBundler(3);
8308 }
8309
8310 if (getDB().isSupportsInlineDistinct()) {
8311 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
8312 }
8313 else {
8314 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
8315 }
8316
8317 query.append(_FINDER_COLUMN_G_U_S_GROUPID_2);
8318
8319 query.append(_FINDER_COLUMN_G_U_S_USERID_2);
8320
8321 query.append(_FINDER_COLUMN_G_U_S_STATUS_2);
8322
8323 if (!getDB().isSupportsInlineDistinct()) {
8324 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
8325 }
8326
8327 if (orderByComparator != null) {
8328 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
8329
8330 if (orderByConditionFields.length > 0) {
8331 query.append(WHERE_AND);
8332 }
8333
8334 for (int i = 0; i < orderByConditionFields.length; i++) {
8335 if (getDB().isSupportsInlineDistinct()) {
8336 query.append(_ORDER_BY_ENTITY_ALIAS);
8337 }
8338 else {
8339 query.append(_ORDER_BY_ENTITY_TABLE);
8340 }
8341
8342 query.append(orderByConditionFields[i]);
8343
8344 if ((i + 1) < orderByConditionFields.length) {
8345 if (orderByComparator.isAscending() ^ previous) {
8346 query.append(WHERE_GREATER_THAN_HAS_NEXT);
8347 }
8348 else {
8349 query.append(WHERE_LESSER_THAN_HAS_NEXT);
8350 }
8351 }
8352 else {
8353 if (orderByComparator.isAscending() ^ previous) {
8354 query.append(WHERE_GREATER_THAN);
8355 }
8356 else {
8357 query.append(WHERE_LESSER_THAN);
8358 }
8359 }
8360 }
8361
8362 query.append(ORDER_BY_CLAUSE);
8363
8364 String[] orderByFields = orderByComparator.getOrderByFields();
8365
8366 for (int i = 0; i < orderByFields.length; i++) {
8367 if (getDB().isSupportsInlineDistinct()) {
8368 query.append(_ORDER_BY_ENTITY_ALIAS);
8369 }
8370 else {
8371 query.append(_ORDER_BY_ENTITY_TABLE);
8372 }
8373
8374 query.append(orderByFields[i]);
8375
8376 if ((i + 1) < orderByFields.length) {
8377 if (orderByComparator.isAscending() ^ previous) {
8378 query.append(ORDER_BY_ASC_HAS_NEXT);
8379 }
8380 else {
8381 query.append(ORDER_BY_DESC_HAS_NEXT);
8382 }
8383 }
8384 else {
8385 if (orderByComparator.isAscending() ^ previous) {
8386 query.append(ORDER_BY_ASC);
8387 }
8388 else {
8389 query.append(ORDER_BY_DESC);
8390 }
8391 }
8392 }
8393 }
8394
8395 else {
8396 if (getDB().isSupportsInlineDistinct()) {
8397 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
8398 }
8399 else {
8400 query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
8401 }
8402 }
8403
8404 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
8405 BlogsEntry.class.getName(),
8406 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
8407
8408 SQLQuery q = session.createSQLQuery(sql);
8409
8410 q.setFirstResult(0);
8411 q.setMaxResults(2);
8412
8413 if (getDB().isSupportsInlineDistinct()) {
8414 q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
8415 }
8416 else {
8417 q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
8418 }
8419
8420 QueryPos qPos = QueryPos.getInstance(q);
8421
8422 qPos.add(groupId);
8423
8424 qPos.add(userId);
8425
8426 qPos.add(status);
8427
8428 if (orderByComparator != null) {
8429 Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
8430
8431 for (Object value : values) {
8432 qPos.add(value);
8433 }
8434 }
8435
8436 List<BlogsEntry> list = q.list();
8437
8438 if (list.size() == 2) {
8439 return list.get(1);
8440 }
8441 else {
8442 return null;
8443 }
8444 }
8445
8446
8455 public List<BlogsEntry> findByG_LtD_S(long groupId, Date displayDate,
8456 int status) throws SystemException {
8457 return findByG_LtD_S(groupId, displayDate, status, QueryUtil.ALL_POS,
8458 QueryUtil.ALL_POS, null);
8459 }
8460
8461
8476 public List<BlogsEntry> findByG_LtD_S(long groupId, Date displayDate,
8477 int status, int start, int end) throws SystemException {
8478 return findByG_LtD_S(groupId, displayDate, status, start, end, null);
8479 }
8480
8481
8497 public List<BlogsEntry> findByG_LtD_S(long groupId, Date displayDate,
8498 int status, int start, int end, OrderByComparator orderByComparator)
8499 throws SystemException {
8500 FinderPath finderPath = null;
8501 Object[] finderArgs = null;
8502
8503 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_LTD_S;
8504 finderArgs = new Object[] {
8505 groupId, displayDate, status,
8506
8507 start, end, orderByComparator
8508 };
8509
8510 List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
8511 finderArgs, this);
8512
8513 if ((list != null) && !list.isEmpty()) {
8514 for (BlogsEntry blogsEntry : list) {
8515 if ((groupId != blogsEntry.getGroupId()) ||
8516 !Validator.equals(displayDate,
8517 blogsEntry.getDisplayDate()) ||
8518 (status != blogsEntry.getStatus())) {
8519 list = null;
8520
8521 break;
8522 }
8523 }
8524 }
8525
8526 if (list == null) {
8527 StringBundler query = null;
8528
8529 if (orderByComparator != null) {
8530 query = new StringBundler(5 +
8531 (orderByComparator.getOrderByFields().length * 3));
8532 }
8533 else {
8534 query = new StringBundler(5);
8535 }
8536
8537 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
8538
8539 query.append(_FINDER_COLUMN_G_LTD_S_GROUPID_2);
8540
8541 if (displayDate == null) {
8542 query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1);
8543 }
8544 else {
8545 query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2);
8546 }
8547
8548 query.append(_FINDER_COLUMN_G_LTD_S_STATUS_2);
8549
8550 if (orderByComparator != null) {
8551 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
8552 orderByComparator);
8553 }
8554
8555 else {
8556 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
8557 }
8558
8559 String sql = query.toString();
8560
8561 Session session = null;
8562
8563 try {
8564 session = openSession();
8565
8566 Query q = session.createQuery(sql);
8567
8568 QueryPos qPos = QueryPos.getInstance(q);
8569
8570 qPos.add(groupId);
8571
8572 if (displayDate != null) {
8573 qPos.add(CalendarUtil.getTimestamp(displayDate));
8574 }
8575
8576 qPos.add(status);
8577
8578 list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
8579 end);
8580 }
8581 catch (Exception e) {
8582 throw processException(e);
8583 }
8584 finally {
8585 if (list == null) {
8586 FinderCacheUtil.removeResult(finderPath, finderArgs);
8587 }
8588 else {
8589 cacheResult(list);
8590
8591 FinderCacheUtil.putResult(finderPath, finderArgs, list);
8592 }
8593
8594 closeSession(session);
8595 }
8596 }
8597
8598 return list;
8599 }
8600
8601
8612 public BlogsEntry findByG_LtD_S_First(long groupId, Date displayDate,
8613 int status, OrderByComparator orderByComparator)
8614 throws NoSuchEntryException, SystemException {
8615 BlogsEntry blogsEntry = fetchByG_LtD_S_First(groupId, displayDate,
8616 status, orderByComparator);
8617
8618 if (blogsEntry != null) {
8619 return blogsEntry;
8620 }
8621
8622 StringBundler msg = new StringBundler(8);
8623
8624 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
8625
8626 msg.append("groupId=");
8627 msg.append(groupId);
8628
8629 msg.append(", displayDate=");
8630 msg.append(displayDate);
8631
8632 msg.append(", status=");
8633 msg.append(status);
8634
8635 msg.append(StringPool.CLOSE_CURLY_BRACE);
8636
8637 throw new NoSuchEntryException(msg.toString());
8638 }
8639
8640
8650 public BlogsEntry fetchByG_LtD_S_First(long groupId, Date displayDate,
8651 int status, OrderByComparator orderByComparator)
8652 throws SystemException {
8653 List<BlogsEntry> list = findByG_LtD_S(groupId, displayDate, status, 0,
8654 1, orderByComparator);
8655
8656 if (!list.isEmpty()) {
8657 return list.get(0);
8658 }
8659
8660 return null;
8661 }
8662
8663
8674 public BlogsEntry findByG_LtD_S_Last(long groupId, Date displayDate,
8675 int status, OrderByComparator orderByComparator)
8676 throws NoSuchEntryException, SystemException {
8677 BlogsEntry blogsEntry = fetchByG_LtD_S_Last(groupId, displayDate,
8678 status, orderByComparator);
8679
8680 if (blogsEntry != null) {
8681 return blogsEntry;
8682 }
8683
8684 StringBundler msg = new StringBundler(8);
8685
8686 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
8687
8688 msg.append("groupId=");
8689 msg.append(groupId);
8690
8691 msg.append(", displayDate=");
8692 msg.append(displayDate);
8693
8694 msg.append(", status=");
8695 msg.append(status);
8696
8697 msg.append(StringPool.CLOSE_CURLY_BRACE);
8698
8699 throw new NoSuchEntryException(msg.toString());
8700 }
8701
8702
8712 public BlogsEntry fetchByG_LtD_S_Last(long groupId, Date displayDate,
8713 int status, OrderByComparator orderByComparator)
8714 throws SystemException {
8715 int count = countByG_LtD_S(groupId, displayDate, status);
8716
8717 List<BlogsEntry> list = findByG_LtD_S(groupId, displayDate, status,
8718 count - 1, count, orderByComparator);
8719
8720 if (!list.isEmpty()) {
8721 return list.get(0);
8722 }
8723
8724 return null;
8725 }
8726
8727
8739 public BlogsEntry[] findByG_LtD_S_PrevAndNext(long entryId, long groupId,
8740 Date displayDate, int status, OrderByComparator orderByComparator)
8741 throws NoSuchEntryException, SystemException {
8742 BlogsEntry blogsEntry = findByPrimaryKey(entryId);
8743
8744 Session session = null;
8745
8746 try {
8747 session = openSession();
8748
8749 BlogsEntry[] array = new BlogsEntryImpl[3];
8750
8751 array[0] = getByG_LtD_S_PrevAndNext(session, blogsEntry, groupId,
8752 displayDate, status, orderByComparator, true);
8753
8754 array[1] = blogsEntry;
8755
8756 array[2] = getByG_LtD_S_PrevAndNext(session, blogsEntry, groupId,
8757 displayDate, status, orderByComparator, false);
8758
8759 return array;
8760 }
8761 catch (Exception e) {
8762 throw processException(e);
8763 }
8764 finally {
8765 closeSession(session);
8766 }
8767 }
8768
8769 protected BlogsEntry getByG_LtD_S_PrevAndNext(Session session,
8770 BlogsEntry blogsEntry, long groupId, Date displayDate, int status,
8771 OrderByComparator orderByComparator, boolean previous) {
8772 StringBundler query = null;
8773
8774 if (orderByComparator != null) {
8775 query = new StringBundler(6 +
8776 (orderByComparator.getOrderByFields().length * 6));
8777 }
8778 else {
8779 query = new StringBundler(3);
8780 }
8781
8782 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
8783
8784 query.append(_FINDER_COLUMN_G_LTD_S_GROUPID_2);
8785
8786 if (displayDate == null) {
8787 query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1);
8788 }
8789 else {
8790 query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2);
8791 }
8792
8793 query.append(_FINDER_COLUMN_G_LTD_S_STATUS_2);
8794
8795 if (orderByComparator != null) {
8796 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
8797
8798 if (orderByConditionFields.length > 0) {
8799 query.append(WHERE_AND);
8800 }
8801
8802 for (int i = 0; i < orderByConditionFields.length; i++) {
8803 query.append(_ORDER_BY_ENTITY_ALIAS);
8804 query.append(orderByConditionFields[i]);
8805
8806 if ((i + 1) < orderByConditionFields.length) {
8807 if (orderByComparator.isAscending() ^ previous) {
8808 query.append(WHERE_GREATER_THAN_HAS_NEXT);
8809 }
8810 else {
8811 query.append(WHERE_LESSER_THAN_HAS_NEXT);
8812 }
8813 }
8814 else {
8815 if (orderByComparator.isAscending() ^ previous) {
8816 query.append(WHERE_GREATER_THAN);
8817 }
8818 else {
8819 query.append(WHERE_LESSER_THAN);
8820 }
8821 }
8822 }
8823
8824 query.append(ORDER_BY_CLAUSE);
8825
8826 String[] orderByFields = orderByComparator.getOrderByFields();
8827
8828 for (int i = 0; i < orderByFields.length; i++) {
8829 query.append(_ORDER_BY_ENTITY_ALIAS);
8830 query.append(orderByFields[i]);
8831
8832 if ((i + 1) < orderByFields.length) {
8833 if (orderByComparator.isAscending() ^ previous) {
8834 query.append(ORDER_BY_ASC_HAS_NEXT);
8835 }
8836 else {
8837 query.append(ORDER_BY_DESC_HAS_NEXT);
8838 }
8839 }
8840 else {
8841 if (orderByComparator.isAscending() ^ previous) {
8842 query.append(ORDER_BY_ASC);
8843 }
8844 else {
8845 query.append(ORDER_BY_DESC);
8846 }
8847 }
8848 }
8849 }
8850
8851 else {
8852 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
8853 }
8854
8855 String sql = query.toString();
8856
8857 Query q = session.createQuery(sql);
8858
8859 q.setFirstResult(0);
8860 q.setMaxResults(2);
8861
8862 QueryPos qPos = QueryPos.getInstance(q);
8863
8864 qPos.add(groupId);
8865
8866 if (displayDate != null) {
8867 qPos.add(CalendarUtil.getTimestamp(displayDate));
8868 }
8869
8870 qPos.add(status);
8871
8872 if (orderByComparator != null) {
8873 Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
8874
8875 for (Object value : values) {
8876 qPos.add(value);
8877 }
8878 }
8879
8880 List<BlogsEntry> list = q.list();
8881
8882 if (list.size() == 2) {
8883 return list.get(1);
8884 }
8885 else {
8886 return null;
8887 }
8888 }
8889
8890
8899 public List<BlogsEntry> filterFindByG_LtD_S(long groupId, Date displayDate,
8900 int status) throws SystemException {
8901 return filterFindByG_LtD_S(groupId, displayDate, status,
8902 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
8903 }
8904
8905
8920 public List<BlogsEntry> filterFindByG_LtD_S(long groupId, Date displayDate,
8921 int status, int start, int end) throws SystemException {
8922 return filterFindByG_LtD_S(groupId, displayDate, status, start, end,
8923 null);
8924 }
8925
8926
8942 public List<BlogsEntry> filterFindByG_LtD_S(long groupId, Date displayDate,
8943 int status, int start, int end, OrderByComparator orderByComparator)
8944 throws SystemException {
8945 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
8946 return findByG_LtD_S(groupId, displayDate, status, start, end,
8947 orderByComparator);
8948 }
8949
8950 StringBundler query = null;
8951
8952 if (orderByComparator != null) {
8953 query = new StringBundler(5 +
8954 (orderByComparator.getOrderByFields().length * 3));
8955 }
8956 else {
8957 query = new StringBundler(5);
8958 }
8959
8960 if (getDB().isSupportsInlineDistinct()) {
8961 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
8962 }
8963 else {
8964 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
8965 }
8966
8967 query.append(_FINDER_COLUMN_G_LTD_S_GROUPID_2);
8968
8969 if (displayDate == null) {
8970 query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1);
8971 }
8972 else {
8973 query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2);
8974 }
8975
8976 query.append(_FINDER_COLUMN_G_LTD_S_STATUS_2);
8977
8978 if (!getDB().isSupportsInlineDistinct()) {
8979 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
8980 }
8981
8982 if (orderByComparator != null) {
8983 if (getDB().isSupportsInlineDistinct()) {
8984 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
8985 orderByComparator);
8986 }
8987 else {
8988 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
8989 orderByComparator);
8990 }
8991 }
8992
8993 else {
8994 if (getDB().isSupportsInlineDistinct()) {
8995 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
8996 }
8997 else {
8998 query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
8999 }
9000 }
9001
9002 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
9003 BlogsEntry.class.getName(),
9004 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
9005
9006 Session session = null;
9007
9008 try {
9009 session = openSession();
9010
9011 SQLQuery q = session.createSQLQuery(sql);
9012
9013 if (getDB().isSupportsInlineDistinct()) {
9014 q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
9015 }
9016 else {
9017 q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
9018 }
9019
9020 QueryPos qPos = QueryPos.getInstance(q);
9021
9022 qPos.add(groupId);
9023
9024 if (displayDate != null) {
9025 qPos.add(CalendarUtil.getTimestamp(displayDate));
9026 }
9027
9028 qPos.add(status);
9029
9030 return (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start, end);
9031 }
9032 catch (Exception e) {
9033 throw processException(e);
9034 }
9035 finally {
9036 closeSession(session);
9037 }
9038 }
9039
9040
9052 public BlogsEntry[] filterFindByG_LtD_S_PrevAndNext(long entryId,
9053 long groupId, Date displayDate, int status,
9054 OrderByComparator orderByComparator)
9055 throws NoSuchEntryException, SystemException {
9056 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
9057 return findByG_LtD_S_PrevAndNext(entryId, groupId, displayDate,
9058 status, orderByComparator);
9059 }
9060
9061 BlogsEntry blogsEntry = findByPrimaryKey(entryId);
9062
9063 Session session = null;
9064
9065 try {
9066 session = openSession();
9067
9068 BlogsEntry[] array = new BlogsEntryImpl[3];
9069
9070 array[0] = filterGetByG_LtD_S_PrevAndNext(session, blogsEntry,
9071 groupId, displayDate, status, orderByComparator, true);
9072
9073 array[1] = blogsEntry;
9074
9075 array[2] = filterGetByG_LtD_S_PrevAndNext(session, blogsEntry,
9076 groupId, displayDate, status, orderByComparator, false);
9077
9078 return array;
9079 }
9080 catch (Exception e) {
9081 throw processException(e);
9082 }
9083 finally {
9084 closeSession(session);
9085 }
9086 }
9087
9088 protected BlogsEntry filterGetByG_LtD_S_PrevAndNext(Session session,
9089 BlogsEntry blogsEntry, long groupId, Date displayDate, int status,
9090 OrderByComparator orderByComparator, boolean previous) {
9091 StringBundler query = null;
9092
9093 if (orderByComparator != null) {
9094 query = new StringBundler(6 +
9095 (orderByComparator.getOrderByFields().length * 6));
9096 }
9097 else {
9098 query = new StringBundler(3);
9099 }
9100
9101 if (getDB().isSupportsInlineDistinct()) {
9102 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
9103 }
9104 else {
9105 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
9106 }
9107
9108 query.append(_FINDER_COLUMN_G_LTD_S_GROUPID_2);
9109
9110 if (displayDate == null) {
9111 query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1);
9112 }
9113 else {
9114 query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2);
9115 }
9116
9117 query.append(_FINDER_COLUMN_G_LTD_S_STATUS_2);
9118
9119 if (!getDB().isSupportsInlineDistinct()) {
9120 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
9121 }
9122
9123 if (orderByComparator != null) {
9124 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
9125
9126 if (orderByConditionFields.length > 0) {
9127 query.append(WHERE_AND);
9128 }
9129
9130 for (int i = 0; i < orderByConditionFields.length; i++) {
9131 if (getDB().isSupportsInlineDistinct()) {
9132 query.append(_ORDER_BY_ENTITY_ALIAS);
9133 }
9134 else {
9135 query.append(_ORDER_BY_ENTITY_TABLE);
9136 }
9137
9138 query.append(orderByConditionFields[i]);
9139
9140 if ((i + 1) < orderByConditionFields.length) {
9141 if (orderByComparator.isAscending() ^ previous) {
9142 query.append(WHERE_GREATER_THAN_HAS_NEXT);
9143 }
9144 else {
9145 query.append(WHERE_LESSER_THAN_HAS_NEXT);
9146 }
9147 }
9148 else {
9149 if (orderByComparator.isAscending() ^ previous) {
9150 query.append(WHERE_GREATER_THAN);
9151 }
9152 else {
9153 query.append(WHERE_LESSER_THAN);
9154 }
9155 }
9156 }
9157
9158 query.append(ORDER_BY_CLAUSE);
9159
9160 String[] orderByFields = orderByComparator.getOrderByFields();
9161
9162 for (int i = 0; i < orderByFields.length; i++) {
9163 if (getDB().isSupportsInlineDistinct()) {
9164 query.append(_ORDER_BY_ENTITY_ALIAS);
9165 }
9166 else {
9167 query.append(_ORDER_BY_ENTITY_TABLE);
9168 }
9169
9170 query.append(orderByFields[i]);
9171
9172 if ((i + 1) < orderByFields.length) {
9173 if (orderByComparator.isAscending() ^ previous) {
9174 query.append(ORDER_BY_ASC_HAS_NEXT);
9175 }
9176 else {
9177 query.append(ORDER_BY_DESC_HAS_NEXT);
9178 }
9179 }
9180 else {
9181 if (orderByComparator.isAscending() ^ previous) {
9182 query.append(ORDER_BY_ASC);
9183 }
9184 else {
9185 query.append(ORDER_BY_DESC);
9186 }
9187 }
9188 }
9189 }
9190
9191 else {
9192 if (getDB().isSupportsInlineDistinct()) {
9193 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
9194 }
9195 else {
9196 query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
9197 }
9198 }
9199
9200 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
9201 BlogsEntry.class.getName(),
9202 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
9203
9204 SQLQuery q = session.createSQLQuery(sql);
9205
9206 q.setFirstResult(0);
9207 q.setMaxResults(2);
9208
9209 if (getDB().isSupportsInlineDistinct()) {
9210 q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
9211 }
9212 else {
9213 q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
9214 }
9215
9216 QueryPos qPos = QueryPos.getInstance(q);
9217
9218 qPos.add(groupId);
9219
9220 if (displayDate != null) {
9221 qPos.add(CalendarUtil.getTimestamp(displayDate));
9222 }
9223
9224 qPos.add(status);
9225
9226 if (orderByComparator != null) {
9227 Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
9228
9229 for (Object value : values) {
9230 qPos.add(value);
9231 }
9232 }
9233
9234 List<BlogsEntry> list = q.list();
9235
9236 if (list.size() == 2) {
9237 return list.get(1);
9238 }
9239 else {
9240 return null;
9241 }
9242 }
9243
9244
9254 public List<BlogsEntry> findByG_U_LtD_S(long groupId, long userId,
9255 Date displayDate, int status) throws SystemException {
9256 return findByG_U_LtD_S(groupId, userId, displayDate, status,
9257 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
9258 }
9259
9260
9276 public List<BlogsEntry> findByG_U_LtD_S(long groupId, long userId,
9277 Date displayDate, int status, int start, int end)
9278 throws SystemException {
9279 return findByG_U_LtD_S(groupId, userId, displayDate, status, start,
9280 end, null);
9281 }
9282
9283
9300 public List<BlogsEntry> findByG_U_LtD_S(long groupId, long userId,
9301 Date displayDate, int status, int start, int end,
9302 OrderByComparator orderByComparator) throws SystemException {
9303 FinderPath finderPath = null;
9304 Object[] finderArgs = null;
9305
9306 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_U_LTD_S;
9307 finderArgs = new Object[] {
9308 groupId, userId, displayDate, status,
9309
9310 start, end, orderByComparator
9311 };
9312
9313 List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
9314 finderArgs, this);
9315
9316 if ((list != null) && !list.isEmpty()) {
9317 for (BlogsEntry blogsEntry : list) {
9318 if ((groupId != blogsEntry.getGroupId()) ||
9319 (userId != blogsEntry.getUserId()) ||
9320 !Validator.equals(displayDate,
9321 blogsEntry.getDisplayDate()) ||
9322 (status != blogsEntry.getStatus())) {
9323 list = null;
9324
9325 break;
9326 }
9327 }
9328 }
9329
9330 if (list == null) {
9331 StringBundler query = null;
9332
9333 if (orderByComparator != null) {
9334 query = new StringBundler(6 +
9335 (orderByComparator.getOrderByFields().length * 3));
9336 }
9337 else {
9338 query = new StringBundler(6);
9339 }
9340
9341 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
9342
9343 query.append(_FINDER_COLUMN_G_U_LTD_S_GROUPID_2);
9344
9345 query.append(_FINDER_COLUMN_G_U_LTD_S_USERID_2);
9346
9347 if (displayDate == null) {
9348 query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1);
9349 }
9350 else {
9351 query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2);
9352 }
9353
9354 query.append(_FINDER_COLUMN_G_U_LTD_S_STATUS_2);
9355
9356 if (orderByComparator != null) {
9357 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
9358 orderByComparator);
9359 }
9360
9361 else {
9362 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
9363 }
9364
9365 String sql = query.toString();
9366
9367 Session session = null;
9368
9369 try {
9370 session = openSession();
9371
9372 Query q = session.createQuery(sql);
9373
9374 QueryPos qPos = QueryPos.getInstance(q);
9375
9376 qPos.add(groupId);
9377
9378 qPos.add(userId);
9379
9380 if (displayDate != null) {
9381 qPos.add(CalendarUtil.getTimestamp(displayDate));
9382 }
9383
9384 qPos.add(status);
9385
9386 list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
9387 end);
9388 }
9389 catch (Exception e) {
9390 throw processException(e);
9391 }
9392 finally {
9393 if (list == null) {
9394 FinderCacheUtil.removeResult(finderPath, finderArgs);
9395 }
9396 else {
9397 cacheResult(list);
9398
9399 FinderCacheUtil.putResult(finderPath, finderArgs, list);
9400 }
9401
9402 closeSession(session);
9403 }
9404 }
9405
9406 return list;
9407 }
9408
9409
9421 public BlogsEntry findByG_U_LtD_S_First(long groupId, long userId,
9422 Date displayDate, int status, OrderByComparator orderByComparator)
9423 throws NoSuchEntryException, SystemException {
9424 BlogsEntry blogsEntry = fetchByG_U_LtD_S_First(groupId, userId,
9425 displayDate, status, orderByComparator);
9426
9427 if (blogsEntry != null) {
9428 return blogsEntry;
9429 }
9430
9431 StringBundler msg = new StringBundler(10);
9432
9433 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
9434
9435 msg.append("groupId=");
9436 msg.append(groupId);
9437
9438 msg.append(", userId=");
9439 msg.append(userId);
9440
9441 msg.append(", displayDate=");
9442 msg.append(displayDate);
9443
9444 msg.append(", status=");
9445 msg.append(status);
9446
9447 msg.append(StringPool.CLOSE_CURLY_BRACE);
9448
9449 throw new NoSuchEntryException(msg.toString());
9450 }
9451
9452
9463 public BlogsEntry fetchByG_U_LtD_S_First(long groupId, long userId,
9464 Date displayDate, int status, OrderByComparator orderByComparator)
9465 throws SystemException {
9466 List<BlogsEntry> list = findByG_U_LtD_S(groupId, userId, displayDate,
9467 status, 0, 1, orderByComparator);
9468
9469 if (!list.isEmpty()) {
9470 return list.get(0);
9471 }
9472
9473 return null;
9474 }
9475
9476
9488 public BlogsEntry findByG_U_LtD_S_Last(long groupId, long userId,
9489 Date displayDate, int status, OrderByComparator orderByComparator)
9490 throws NoSuchEntryException, SystemException {
9491 BlogsEntry blogsEntry = fetchByG_U_LtD_S_Last(groupId, userId,
9492 displayDate, status, orderByComparator);
9493
9494 if (blogsEntry != null) {
9495 return blogsEntry;
9496 }
9497
9498 StringBundler msg = new StringBundler(10);
9499
9500 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
9501
9502 msg.append("groupId=");
9503 msg.append(groupId);
9504
9505 msg.append(", userId=");
9506 msg.append(userId);
9507
9508 msg.append(", displayDate=");
9509 msg.append(displayDate);
9510
9511 msg.append(", status=");
9512 msg.append(status);
9513
9514 msg.append(StringPool.CLOSE_CURLY_BRACE);
9515
9516 throw new NoSuchEntryException(msg.toString());
9517 }
9518
9519
9530 public BlogsEntry fetchByG_U_LtD_S_Last(long groupId, long userId,
9531 Date displayDate, int status, OrderByComparator orderByComparator)
9532 throws SystemException {
9533 int count = countByG_U_LtD_S(groupId, userId, displayDate, status);
9534
9535 List<BlogsEntry> list = findByG_U_LtD_S(groupId, userId, displayDate,
9536 status, count - 1, count, orderByComparator);
9537
9538 if (!list.isEmpty()) {
9539 return list.get(0);
9540 }
9541
9542 return null;
9543 }
9544
9545
9558 public BlogsEntry[] findByG_U_LtD_S_PrevAndNext(long entryId, long groupId,
9559 long userId, Date displayDate, int status,
9560 OrderByComparator orderByComparator)
9561 throws NoSuchEntryException, SystemException {
9562 BlogsEntry blogsEntry = findByPrimaryKey(entryId);
9563
9564 Session session = null;
9565
9566 try {
9567 session = openSession();
9568
9569 BlogsEntry[] array = new BlogsEntryImpl[3];
9570
9571 array[0] = getByG_U_LtD_S_PrevAndNext(session, blogsEntry, groupId,
9572 userId, displayDate, status, orderByComparator, true);
9573
9574 array[1] = blogsEntry;
9575
9576 array[2] = getByG_U_LtD_S_PrevAndNext(session, blogsEntry, groupId,
9577 userId, displayDate, status, orderByComparator, false);
9578
9579 return array;
9580 }
9581 catch (Exception e) {
9582 throw processException(e);
9583 }
9584 finally {
9585 closeSession(session);
9586 }
9587 }
9588
9589 protected BlogsEntry getByG_U_LtD_S_PrevAndNext(Session session,
9590 BlogsEntry blogsEntry, long groupId, long userId, Date displayDate,
9591 int status, OrderByComparator orderByComparator, boolean previous) {
9592 StringBundler query = null;
9593
9594 if (orderByComparator != null) {
9595 query = new StringBundler(6 +
9596 (orderByComparator.getOrderByFields().length * 6));
9597 }
9598 else {
9599 query = new StringBundler(3);
9600 }
9601
9602 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
9603
9604 query.append(_FINDER_COLUMN_G_U_LTD_S_GROUPID_2);
9605
9606 query.append(_FINDER_COLUMN_G_U_LTD_S_USERID_2);
9607
9608 if (displayDate == null) {
9609 query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1);
9610 }
9611 else {
9612 query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2);
9613 }
9614
9615 query.append(_FINDER_COLUMN_G_U_LTD_S_STATUS_2);
9616
9617 if (orderByComparator != null) {
9618 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
9619
9620 if (orderByConditionFields.length > 0) {
9621 query.append(WHERE_AND);
9622 }
9623
9624 for (int i = 0; i < orderByConditionFields.length; i++) {
9625 query.append(_ORDER_BY_ENTITY_ALIAS);
9626 query.append(orderByConditionFields[i]);
9627
9628 if ((i + 1) < orderByConditionFields.length) {
9629 if (orderByComparator.isAscending() ^ previous) {
9630 query.append(WHERE_GREATER_THAN_HAS_NEXT);
9631 }
9632 else {
9633 query.append(WHERE_LESSER_THAN_HAS_NEXT);
9634 }
9635 }
9636 else {
9637 if (orderByComparator.isAscending() ^ previous) {
9638 query.append(WHERE_GREATER_THAN);
9639 }
9640 else {
9641 query.append(WHERE_LESSER_THAN);
9642 }
9643 }
9644 }
9645
9646 query.append(ORDER_BY_CLAUSE);
9647
9648 String[] orderByFields = orderByComparator.getOrderByFields();
9649
9650 for (int i = 0; i < orderByFields.length; i++) {
9651 query.append(_ORDER_BY_ENTITY_ALIAS);
9652 query.append(orderByFields[i]);
9653
9654 if ((i + 1) < orderByFields.length) {
9655 if (orderByComparator.isAscending() ^ previous) {
9656 query.append(ORDER_BY_ASC_HAS_NEXT);
9657 }
9658 else {
9659 query.append(ORDER_BY_DESC_HAS_NEXT);
9660 }
9661 }
9662 else {
9663 if (orderByComparator.isAscending() ^ previous) {
9664 query.append(ORDER_BY_ASC);
9665 }
9666 else {
9667 query.append(ORDER_BY_DESC);
9668 }
9669 }
9670 }
9671 }
9672
9673 else {
9674 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
9675 }
9676
9677 String sql = query.toString();
9678
9679 Query q = session.createQuery(sql);
9680
9681 q.setFirstResult(0);
9682 q.setMaxResults(2);
9683
9684 QueryPos qPos = QueryPos.getInstance(q);
9685
9686 qPos.add(groupId);
9687
9688 qPos.add(userId);
9689
9690 if (displayDate != null) {
9691 qPos.add(CalendarUtil.getTimestamp(displayDate));
9692 }
9693
9694 qPos.add(status);
9695
9696 if (orderByComparator != null) {
9697 Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
9698
9699 for (Object value : values) {
9700 qPos.add(value);
9701 }
9702 }
9703
9704 List<BlogsEntry> list = q.list();
9705
9706 if (list.size() == 2) {
9707 return list.get(1);
9708 }
9709 else {
9710 return null;
9711 }
9712 }
9713
9714
9724 public List<BlogsEntry> filterFindByG_U_LtD_S(long groupId, long userId,
9725 Date displayDate, int status) throws SystemException {
9726 return filterFindByG_U_LtD_S(groupId, userId, displayDate, status,
9727 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
9728 }
9729
9730
9746 public List<BlogsEntry> filterFindByG_U_LtD_S(long groupId, long userId,
9747 Date displayDate, int status, int start, int end)
9748 throws SystemException {
9749 return filterFindByG_U_LtD_S(groupId, userId, displayDate, status,
9750 start, end, null);
9751 }
9752
9753
9770 public List<BlogsEntry> filterFindByG_U_LtD_S(long groupId, long userId,
9771 Date displayDate, int status, int start, int end,
9772 OrderByComparator orderByComparator) throws SystemException {
9773 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
9774 return findByG_U_LtD_S(groupId, userId, displayDate, status, start,
9775 end, orderByComparator);
9776 }
9777
9778 StringBundler query = null;
9779
9780 if (orderByComparator != null) {
9781 query = new StringBundler(6 +
9782 (orderByComparator.getOrderByFields().length * 3));
9783 }
9784 else {
9785 query = new StringBundler(6);
9786 }
9787
9788 if (getDB().isSupportsInlineDistinct()) {
9789 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
9790 }
9791 else {
9792 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
9793 }
9794
9795 query.append(_FINDER_COLUMN_G_U_LTD_S_GROUPID_2);
9796
9797 query.append(_FINDER_COLUMN_G_U_LTD_S_USERID_2);
9798
9799 if (displayDate == null) {
9800 query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1);
9801 }
9802 else {
9803 query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2);
9804 }
9805
9806 query.append(_FINDER_COLUMN_G_U_LTD_S_STATUS_2);
9807
9808 if (!getDB().isSupportsInlineDistinct()) {
9809 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
9810 }
9811
9812 if (orderByComparator != null) {
9813 if (getDB().isSupportsInlineDistinct()) {
9814 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
9815 orderByComparator);
9816 }
9817 else {
9818 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
9819 orderByComparator);
9820 }
9821 }
9822
9823 else {
9824 if (getDB().isSupportsInlineDistinct()) {
9825 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
9826 }
9827 else {
9828 query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
9829 }
9830 }
9831
9832 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
9833 BlogsEntry.class.getName(),
9834 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
9835
9836 Session session = null;
9837
9838 try {
9839 session = openSession();
9840
9841 SQLQuery q = session.createSQLQuery(sql);
9842
9843 if (getDB().isSupportsInlineDistinct()) {
9844 q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
9845 }
9846 else {
9847 q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
9848 }
9849
9850 QueryPos qPos = QueryPos.getInstance(q);
9851
9852 qPos.add(groupId);
9853
9854 qPos.add(userId);
9855
9856 if (displayDate != null) {
9857 qPos.add(CalendarUtil.getTimestamp(displayDate));
9858 }
9859
9860 qPos.add(status);
9861
9862 return (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start, end);
9863 }
9864 catch (Exception e) {
9865 throw processException(e);
9866 }
9867 finally {
9868 closeSession(session);
9869 }
9870 }
9871
9872
9885 public BlogsEntry[] filterFindByG_U_LtD_S_PrevAndNext(long entryId,
9886 long groupId, long userId, Date displayDate, int status,
9887 OrderByComparator orderByComparator)
9888 throws NoSuchEntryException, SystemException {
9889 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
9890 return findByG_U_LtD_S_PrevAndNext(entryId, groupId, userId,
9891 displayDate, status, orderByComparator);
9892 }
9893
9894 BlogsEntry blogsEntry = findByPrimaryKey(entryId);
9895
9896 Session session = null;
9897
9898 try {
9899 session = openSession();
9900
9901 BlogsEntry[] array = new BlogsEntryImpl[3];
9902
9903 array[0] = filterGetByG_U_LtD_S_PrevAndNext(session, blogsEntry,
9904 groupId, userId, displayDate, status, orderByComparator,
9905 true);
9906
9907 array[1] = blogsEntry;
9908
9909 array[2] = filterGetByG_U_LtD_S_PrevAndNext(session, blogsEntry,
9910 groupId, userId, displayDate, status, orderByComparator,
9911 false);
9912
9913 return array;
9914 }
9915 catch (Exception e) {
9916 throw processException(e);
9917 }
9918 finally {
9919 closeSession(session);
9920 }
9921 }
9922
9923 protected BlogsEntry filterGetByG_U_LtD_S_PrevAndNext(Session session,
9924 BlogsEntry blogsEntry, long groupId, long userId, Date displayDate,
9925 int status, OrderByComparator orderByComparator, boolean previous) {
9926 StringBundler query = null;
9927
9928 if (orderByComparator != null) {
9929 query = new StringBundler(6 +
9930 (orderByComparator.getOrderByFields().length * 6));
9931 }
9932 else {
9933 query = new StringBundler(3);
9934 }
9935
9936 if (getDB().isSupportsInlineDistinct()) {
9937 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
9938 }
9939 else {
9940 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
9941 }
9942
9943 query.append(_FINDER_COLUMN_G_U_LTD_S_GROUPID_2);
9944
9945 query.append(_FINDER_COLUMN_G_U_LTD_S_USERID_2);
9946
9947 if (displayDate == null) {
9948 query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1);
9949 }
9950 else {
9951 query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2);
9952 }
9953
9954 query.append(_FINDER_COLUMN_G_U_LTD_S_STATUS_2);
9955
9956 if (!getDB().isSupportsInlineDistinct()) {
9957 query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
9958 }
9959
9960 if (orderByComparator != null) {
9961 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
9962
9963 if (orderByConditionFields.length > 0) {
9964 query.append(WHERE_AND);
9965 }
9966
9967 for (int i = 0; i < orderByConditionFields.length; i++) {
9968 if (getDB().isSupportsInlineDistinct()) {
9969 query.append(_ORDER_BY_ENTITY_ALIAS);
9970 }
9971 else {
9972 query.append(_ORDER_BY_ENTITY_TABLE);
9973 }
9974
9975 query.append(orderByConditionFields[i]);
9976
9977 if ((i + 1) < orderByConditionFields.length) {
9978 if (orderByComparator.isAscending() ^ previous) {
9979 query.append(WHERE_GREATER_THAN_HAS_NEXT);
9980 }
9981 else {
9982 query.append(WHERE_LESSER_THAN_HAS_NEXT);
9983 }
9984 }
9985 else {
9986 if (orderByComparator.isAscending() ^ previous) {
9987 query.append(WHERE_GREATER_THAN);
9988 }
9989 else {
9990 query.append(WHERE_LESSER_THAN);
9991 }
9992 }
9993 }
9994
9995 query.append(ORDER_BY_CLAUSE);
9996
9997 String[] orderByFields = orderByComparator.getOrderByFields();
9998
9999 for (int i = 0; i < orderByFields.length; i++) {
10000 if (getDB().isSupportsInlineDistinct()) {
10001 query.append(_ORDER_BY_ENTITY_ALIAS);
10002 }
10003 else {
10004 query.append(_ORDER_BY_ENTITY_TABLE);
10005 }
10006
10007 query.append(orderByFields[i]);
10008
10009 if ((i + 1) < orderByFields.length) {
10010 if (orderByComparator.isAscending() ^ previous) {
10011 query.append(ORDER_BY_ASC_HAS_NEXT);
10012 }
10013 else {
10014 query.append(ORDER_BY_DESC_HAS_NEXT);
10015 }
10016 }
10017 else {
10018 if (orderByComparator.isAscending() ^ previous) {
10019 query.append(ORDER_BY_ASC);
10020 }
10021 else {
10022 query.append(ORDER_BY_DESC);
10023 }
10024 }
10025 }
10026 }
10027
10028 else {
10029 if (getDB().isSupportsInlineDistinct()) {
10030 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
10031 }
10032 else {
10033 query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
10034 }
10035 }
10036
10037 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
10038 BlogsEntry.class.getName(),
10039 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
10040
10041 SQLQuery q = session.createSQLQuery(sql);
10042
10043 q.setFirstResult(0);
10044 q.setMaxResults(2);
10045
10046 if (getDB().isSupportsInlineDistinct()) {
10047 q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
10048 }
10049 else {
10050 q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
10051 }
10052
10053 QueryPos qPos = QueryPos.getInstance(q);
10054
10055 qPos.add(groupId);
10056
10057 qPos.add(userId);
10058
10059 if (displayDate != null) {
10060 qPos.add(CalendarUtil.getTimestamp(displayDate));
10061 }
10062
10063 qPos.add(status);
10064
10065 if (orderByComparator != null) {
10066 Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
10067
10068 for (Object value : values) {
10069 qPos.add(value);
10070 }
10071 }
10072
10073 List<BlogsEntry> list = q.list();
10074
10075 if (list.size() == 2) {
10076 return list.get(1);
10077 }
10078 else {
10079 return null;
10080 }
10081 }
10082
10083
10089 public List<BlogsEntry> findAll() throws SystemException {
10090 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
10091 }
10092
10093
10105 public List<BlogsEntry> findAll(int start, int end)
10106 throws SystemException {
10107 return findAll(start, end, null);
10108 }
10109
10110
10123 public List<BlogsEntry> findAll(int start, int end,
10124 OrderByComparator orderByComparator) throws SystemException {
10125 FinderPath finderPath = null;
10126 Object[] finderArgs = new Object[] { start, end, orderByComparator };
10127
10128 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
10129 (orderByComparator == null)) {
10130 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
10131 finderArgs = FINDER_ARGS_EMPTY;
10132 }
10133 else {
10134 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
10135 finderArgs = new Object[] { start, end, orderByComparator };
10136 }
10137
10138 List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
10139 finderArgs, this);
10140
10141 if (list == null) {
10142 StringBundler query = null;
10143 String sql = null;
10144
10145 if (orderByComparator != null) {
10146 query = new StringBundler(2 +
10147 (orderByComparator.getOrderByFields().length * 3));
10148
10149 query.append(_SQL_SELECT_BLOGSENTRY);
10150
10151 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
10152 orderByComparator);
10153
10154 sql = query.toString();
10155 }
10156 else {
10157 sql = _SQL_SELECT_BLOGSENTRY.concat(BlogsEntryModelImpl.ORDER_BY_JPQL);
10158 }
10159
10160 Session session = null;
10161
10162 try {
10163 session = openSession();
10164
10165 Query q = session.createQuery(sql);
10166
10167 if (orderByComparator == null) {
10168 list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(),
10169 start, end, false);
10170
10171 Collections.sort(list);
10172 }
10173 else {
10174 list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(),
10175 start, end);
10176 }
10177 }
10178 catch (Exception e) {
10179 throw processException(e);
10180 }
10181 finally {
10182 if (list == null) {
10183 FinderCacheUtil.removeResult(finderPath, finderArgs);
10184 }
10185 else {
10186 cacheResult(list);
10187
10188 FinderCacheUtil.putResult(finderPath, finderArgs, list);
10189 }
10190
10191 closeSession(session);
10192 }
10193 }
10194
10195 return list;
10196 }
10197
10198
10204 public void removeByUuid(String uuid) throws SystemException {
10205 for (BlogsEntry blogsEntry : findByUuid(uuid)) {
10206 remove(blogsEntry);
10207 }
10208 }
10209
10210
10218 public BlogsEntry removeByUUID_G(String uuid, long groupId)
10219 throws NoSuchEntryException, SystemException {
10220 BlogsEntry blogsEntry = findByUUID_G(uuid, groupId);
10221
10222 return remove(blogsEntry);
10223 }
10224
10225
10231 public void removeByGroupId(long groupId) throws SystemException {
10232 for (BlogsEntry blogsEntry : findByGroupId(groupId)) {
10233 remove(blogsEntry);
10234 }
10235 }
10236
10237
10243 public void removeByCompanyId(long companyId) throws SystemException {
10244 for (BlogsEntry blogsEntry : findByCompanyId(companyId)) {
10245 remove(blogsEntry);
10246 }
10247 }
10248
10249
10256 public void removeByC_U(long companyId, long userId)
10257 throws SystemException {
10258 for (BlogsEntry blogsEntry : findByC_U(companyId, userId)) {
10259 remove(blogsEntry);
10260 }
10261 }
10262
10263
10270 public void removeByC_LtD(long companyId, Date displayDate)
10271 throws SystemException {
10272 for (BlogsEntry blogsEntry : findByC_LtD(companyId, displayDate)) {
10273 remove(blogsEntry);
10274 }
10275 }
10276
10277
10284 public void removeByC_S(long companyId, int status)
10285 throws SystemException {
10286 for (BlogsEntry blogsEntry : findByC_S(companyId, status)) {
10287 remove(blogsEntry);
10288 }
10289 }
10290
10291
10299 public BlogsEntry removeByG_UT(long groupId, String urlTitle)
10300 throws NoSuchEntryException, SystemException {
10301 BlogsEntry blogsEntry = findByG_UT(groupId, urlTitle);
10302
10303 return remove(blogsEntry);
10304 }
10305
10306
10313 public void removeByG_LtD(long groupId, Date displayDate)
10314 throws SystemException {
10315 for (BlogsEntry blogsEntry : findByG_LtD(groupId, displayDate)) {
10316 remove(blogsEntry);
10317 }
10318 }
10319
10320
10327 public void removeByG_S(long groupId, int status) throws SystemException {
10328 for (BlogsEntry blogsEntry : findByG_S(groupId, status)) {
10329 remove(blogsEntry);
10330 }
10331 }
10332
10333
10340 public void removeByLtD_S(Date displayDate, int status)
10341 throws SystemException {
10342 for (BlogsEntry blogsEntry : findByLtD_S(displayDate, status)) {
10343 remove(blogsEntry);
10344 }
10345 }
10346
10347
10355 public void removeByC_U_S(long companyId, long userId, int status)
10356 throws SystemException {
10357 for (BlogsEntry blogsEntry : findByC_U_S(companyId, userId, status)) {
10358 remove(blogsEntry);
10359 }
10360 }
10361
10362
10370 public void removeByC_LtD_S(long companyId, Date displayDate, int status)
10371 throws SystemException {
10372 for (BlogsEntry blogsEntry : findByC_LtD_S(companyId, displayDate,
10373 status)) {
10374 remove(blogsEntry);
10375 }
10376 }
10377
10378
10386 public void removeByG_U_LtD(long groupId, long userId, Date displayDate)
10387 throws SystemException {
10388 for (BlogsEntry blogsEntry : findByG_U_LtD(groupId, userId, displayDate)) {
10389 remove(blogsEntry);
10390 }
10391 }
10392
10393
10401 public void removeByG_U_S(long groupId, long userId, int status)
10402 throws SystemException {
10403 for (BlogsEntry blogsEntry : findByG_U_S(groupId, userId, status)) {
10404 remove(blogsEntry);
10405 }
10406 }
10407
10408
10416 public void removeByG_LtD_S(long groupId, Date displayDate, int status)
10417 throws SystemException {
10418 for (BlogsEntry blogsEntry : findByG_LtD_S(groupId, displayDate, status)) {
10419 remove(blogsEntry);
10420 }
10421 }
10422
10423
10432 public void removeByG_U_LtD_S(long groupId, long userId, Date displayDate,
10433 int status) throws SystemException {
10434 for (BlogsEntry blogsEntry : findByG_U_LtD_S(groupId, userId,
10435 displayDate, status)) {
10436 remove(blogsEntry);
10437 }
10438 }
10439
10440
10445 public void removeAll() throws SystemException {
10446 for (BlogsEntry blogsEntry : findAll()) {
10447 remove(blogsEntry);
10448 }
10449 }
10450
10451
10458 public int countByUuid(String uuid) throws SystemException {
10459 Object[] finderArgs = new Object[] { uuid };
10460
10461 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
10462 finderArgs, this);
10463
10464 if (count == null) {
10465 StringBundler query = new StringBundler(2);
10466
10467 query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
10468
10469 if (uuid == null) {
10470 query.append(_FINDER_COLUMN_UUID_UUID_1);
10471 }
10472 else {
10473 if (uuid.equals(StringPool.BLANK)) {
10474 query.append(_FINDER_COLUMN_UUID_UUID_3);
10475 }
10476 else {
10477 query.append(_FINDER_COLUMN_UUID_UUID_2);
10478 }
10479 }
10480
10481 String sql = query.toString();
10482
10483 Session session = null;
10484
10485 try {
10486 session = openSession();
10487
10488 Query q = session.createQuery(sql);
10489
10490 QueryPos qPos = QueryPos.getInstance(q);
10491
10492 if (uuid != null) {
10493 qPos.add(uuid);
10494 }
10495
10496 count = (Long)q.uniqueResult();
10497 }
10498 catch (Exception e) {
10499 throw processException(e);
10500 }
10501 finally {
10502 if (count == null) {
10503 count = Long.valueOf(0);
10504 }
10505
10506 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
10507 finderArgs, count);
10508
10509 closeSession(session);
10510 }
10511 }
10512
10513 return count.intValue();
10514 }
10515
10516
10524 public int countByUUID_G(String uuid, long groupId)
10525 throws SystemException {
10526 Object[] finderArgs = new Object[] { uuid, groupId };
10527
10528 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
10529 finderArgs, this);
10530
10531 if (count == null) {
10532 StringBundler query = new StringBundler(3);
10533
10534 query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
10535
10536 if (uuid == null) {
10537 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
10538 }
10539 else {
10540 if (uuid.equals(StringPool.BLANK)) {
10541 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
10542 }
10543 else {
10544 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
10545 }
10546 }
10547
10548 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
10549
10550 String sql = query.toString();
10551
10552 Session session = null;
10553
10554 try {
10555 session = openSession();
10556
10557 Query q = session.createQuery(sql);
10558
10559 QueryPos qPos = QueryPos.getInstance(q);
10560
10561 if (uuid != null) {
10562 qPos.add(uuid);
10563 }
10564
10565 qPos.add(groupId);
10566
10567 count = (Long)q.uniqueResult();
10568 }
10569 catch (Exception e) {
10570 throw processException(e);
10571 }
10572 finally {
10573 if (count == null) {
10574 count = Long.valueOf(0);
10575 }
10576
10577 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
10578 finderArgs, count);
10579
10580 closeSession(session);
10581 }
10582 }
10583
10584 return count.intValue();
10585 }
10586
10587
10594 public int countByGroupId(long groupId) throws SystemException {
10595 Object[] finderArgs = new Object[] { groupId };
10596
10597 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
10598 finderArgs, this);
10599
10600 if (count == null) {
10601 StringBundler query = new StringBundler(2);
10602
10603 query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
10604
10605 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
10606
10607 String sql = query.toString();
10608
10609 Session session = null;
10610
10611 try {
10612 session = openSession();
10613
10614 Query q = session.createQuery(sql);
10615
10616 QueryPos qPos = QueryPos.getInstance(q);
10617
10618 qPos.add(groupId);
10619
10620 count = (Long)q.uniqueResult();
10621 }
10622 catch (Exception e) {
10623 throw processException(e);
10624 }
10625 finally {
10626 if (count == null) {
10627 count = Long.valueOf(0);
10628 }
10629
10630 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
10631 finderArgs, count);
10632
10633 closeSession(session);
10634 }
10635 }
10636
10637 return count.intValue();
10638 }
10639
10640
10647 public int filterCountByGroupId(long groupId) throws SystemException {
10648 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
10649 return countByGroupId(groupId);
10650 }
10651
10652 StringBundler query = new StringBundler(2);
10653
10654 query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE);
10655
10656 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
10657
10658 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
10659 BlogsEntry.class.getName(),
10660 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
10661
10662 Session session = null;
10663
10664 try {
10665 session = openSession();
10666
10667 SQLQuery q = session.createSQLQuery(sql);
10668
10669 q.addScalar(COUNT_COLUMN_NAME,
10670 com.liferay.portal.kernel.dao.orm.Type.LONG);
10671
10672 QueryPos qPos = QueryPos.getInstance(q);
10673
10674 qPos.add(groupId);
10675
10676 Long count = (Long)q.uniqueResult();
10677
10678 return count.intValue();
10679 }
10680 catch (Exception e) {
10681 throw processException(e);
10682 }
10683 finally {
10684 closeSession(session);
10685 }
10686 }
10687
10688
10695 public int countByCompanyId(long companyId) throws SystemException {
10696 Object[] finderArgs = new Object[] { companyId };
10697
10698 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
10699 finderArgs, this);
10700
10701 if (count == null) {
10702 StringBundler query = new StringBundler(2);
10703
10704 query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
10705
10706 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
10707
10708 String sql = query.toString();
10709
10710 Session session = null;
10711
10712 try {
10713 session = openSession();
10714
10715 Query q = session.createQuery(sql);
10716
10717 QueryPos qPos = QueryPos.getInstance(q);
10718
10719 qPos.add(companyId);
10720
10721 count = (Long)q.uniqueResult();
10722 }
10723 catch (Exception e) {
10724 throw processException(e);
10725 }
10726 finally {
10727 if (count == null) {
10728 count = Long.valueOf(0);
10729 }
10730
10731 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
10732 finderArgs, count);
10733
10734 closeSession(session);
10735 }
10736 }
10737
10738 return count.intValue();
10739 }
10740
10741
10749 public int countByC_U(long companyId, long userId)
10750 throws SystemException {
10751 Object[] finderArgs = new Object[] { companyId, userId };
10752
10753 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_U,
10754 finderArgs, this);
10755
10756 if (count == null) {
10757 StringBundler query = new StringBundler(3);
10758
10759 query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
10760
10761 query.append(_FINDER_COLUMN_C_U_COMPANYID_2);
10762
10763 query.append(_FINDER_COLUMN_C_U_USERID_2);
10764
10765 String sql = query.toString();
10766
10767 Session session = null;
10768
10769 try {
10770 session = openSession();
10771
10772 Query q = session.createQuery(sql);
10773
10774 QueryPos qPos = QueryPos.getInstance(q);
10775
10776 qPos.add(companyId);
10777
10778 qPos.add(userId);
10779
10780 count = (Long)q.uniqueResult();
10781 }
10782 catch (Exception e) {
10783 throw processException(e);
10784 }
10785 finally {
10786 if (count == null) {
10787 count = Long.valueOf(0);
10788 }
10789
10790 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_U, finderArgs,
10791 count);
10792
10793 closeSession(session);
10794 }
10795 }
10796
10797 return count.intValue();
10798 }
10799
10800
10808 public int countByC_LtD(long companyId, Date displayDate)
10809 throws SystemException {
10810 Object[] finderArgs = new Object[] { companyId, displayDate };
10811
10812 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_C_LTD,
10813 finderArgs, this);
10814
10815 if (count == null) {
10816 StringBundler query = new StringBundler(3);
10817
10818 query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
10819
10820 query.append(_FINDER_COLUMN_C_LTD_COMPANYID_2);
10821
10822 if (displayDate == null) {
10823 query.append(_FINDER_COLUMN_C_LTD_DISPLAYDATE_1);
10824 }
10825 else {
10826 query.append(_FINDER_COLUMN_C_LTD_DISPLAYDATE_2);
10827 }
10828
10829 String sql = query.toString();
10830
10831 Session session = null;
10832
10833 try {
10834 session = openSession();
10835
10836 Query q = session.createQuery(sql);
10837
10838 QueryPos qPos = QueryPos.getInstance(q);
10839
10840 qPos.add(companyId);
10841
10842 if (displayDate != null) {
10843 qPos.add(CalendarUtil.getTimestamp(displayDate));
10844 }
10845
10846 count = (Long)q.uniqueResult();
10847 }
10848 catch (Exception e) {
10849 throw processException(e);
10850 }
10851 finally {
10852 if (count == null) {
10853 count = Long.valueOf(0);
10854 }
10855
10856 FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_C_LTD,
10857 finderArgs, count);
10858
10859 closeSession(session);
10860 }
10861 }
10862
10863 return count.intValue();
10864 }
10865
10866
10874 public int countByC_S(long companyId, int status) throws SystemException {
10875 Object[] finderArgs = new Object[] { companyId, status };
10876
10877 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_S,
10878 finderArgs, this);
10879
10880 if (count == null) {
10881 StringBundler query = new StringBundler(3);
10882
10883 query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
10884
10885 query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
10886
10887 query.append(_FINDER_COLUMN_C_S_STATUS_2);
10888
10889 String sql = query.toString();
10890
10891 Session session = null;
10892
10893 try {
10894 session = openSession();
10895
10896 Query q = session.createQuery(sql);
10897
10898 QueryPos qPos = QueryPos.getInstance(q);
10899
10900 qPos.add(companyId);
10901
10902 qPos.add(status);
10903
10904 count = (Long)q.uniqueResult();
10905 }
10906 catch (Exception e) {
10907 throw processException(e);
10908 }
10909 finally {
10910 if (count == null) {
10911 count = Long.valueOf(0);
10912 }
10913
10914 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_S, finderArgs,
10915 count);
10916
10917 closeSession(session);
10918 }
10919 }
10920
10921 return count.intValue();
10922 }
10923
10924
10932 public int countByG_UT(long groupId, String urlTitle)
10933 throws SystemException {
10934 Object[] finderArgs = new Object[] { groupId, urlTitle };
10935
10936 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_UT,
10937 finderArgs, this);
10938
10939 if (count == null) {
10940 StringBundler query = new StringBundler(3);
10941
10942 query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
10943
10944 query.append(_FINDER_COLUMN_G_UT_GROUPID_2);
10945
10946 if (urlTitle == null) {
10947 query.append(_FINDER_COLUMN_G_UT_URLTITLE_1);
10948 }
10949 else {
10950 if (urlTitle.equals(StringPool.BLANK)) {
10951 query.append(_FINDER_COLUMN_G_UT_URLTITLE_3);
10952 }
10953 else {
10954 query.append(_FINDER_COLUMN_G_UT_URLTITLE_2);
10955 }
10956 }
10957
10958 String sql = query.toString();
10959
10960 Session session = null;
10961
10962 try {
10963 session = openSession();
10964
10965 Query q = session.createQuery(sql);
10966
10967 QueryPos qPos = QueryPos.getInstance(q);
10968
10969 qPos.add(groupId);
10970
10971 if (urlTitle != null) {
10972 qPos.add(urlTitle);
10973 }
10974
10975 count = (Long)q.uniqueResult();
10976 }
10977 catch (Exception e) {
10978 throw processException(e);
10979 }
10980 finally {
10981 if (count == null) {
10982 count = Long.valueOf(0);
10983 }
10984
10985 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_UT,
10986 finderArgs, count);
10987
10988 closeSession(session);
10989 }
10990 }
10991
10992 return count.intValue();
10993 }
10994
10995
11003 public int countByG_LtD(long groupId, Date displayDate)
11004 throws SystemException {
11005 Object[] finderArgs = new Object[] { groupId, displayDate };
11006
11007 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_G_LTD,
11008 finderArgs, this);
11009
11010 if (count == null) {
11011 StringBundler query = new StringBundler(3);
11012
11013 query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
11014
11015 query.append(_FINDER_COLUMN_G_LTD_GROUPID_2);
11016
11017 if (displayDate == null) {
11018 query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_1);
11019 }
11020 else {
11021 query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_2);
11022 }
11023
11024 String sql = query.toString();
11025
11026 Session session = null;
11027
11028 try {
11029 session = openSession();
11030
11031 Query q = session.createQuery(sql);
11032
11033 QueryPos qPos = QueryPos.getInstance(q);
11034
11035 qPos.add(groupId);
11036
11037 if (displayDate != null) {
11038 qPos.add(CalendarUtil.getTimestamp(displayDate));
11039 }
11040
11041 count = (Long)q.uniqueResult();
11042 }
11043 catch (Exception e) {
11044 throw processException(e);
11045 }
11046 finally {
11047 if (count == null) {
11048 count = Long.valueOf(0);
11049 }
11050
11051 FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_G_LTD,
11052 finderArgs, count);
11053
11054 closeSession(session);
11055 }
11056 }
11057
11058 return count.intValue();
11059 }
11060
11061
11069 public int filterCountByG_LtD(long groupId, Date displayDate)
11070 throws SystemException {
11071 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
11072 return countByG_LtD(groupId, displayDate);
11073 }
11074
11075 StringBundler query = new StringBundler(3);
11076
11077 query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE);
11078
11079 query.append(_FINDER_COLUMN_G_LTD_GROUPID_2);
11080
11081 if (displayDate == null) {
11082 query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_1);
11083 }
11084 else {
11085 query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_2);
11086 }
11087
11088 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
11089 BlogsEntry.class.getName(),
11090 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
11091
11092 Session session = null;
11093
11094 try {
11095 session = openSession();
11096
11097 SQLQuery q = session.createSQLQuery(sql);
11098
11099 q.addScalar(COUNT_COLUMN_NAME,
11100 com.liferay.portal.kernel.dao.orm.Type.LONG);
11101
11102 QueryPos qPos = QueryPos.getInstance(q);
11103
11104 qPos.add(groupId);
11105
11106 if (displayDate != null) {
11107 qPos.add(CalendarUtil.getTimestamp(displayDate));
11108 }
11109
11110 Long count = (Long)q.uniqueResult();
11111
11112 return count.intValue();
11113 }
11114 catch (Exception e) {
11115 throw processException(e);
11116 }
11117 finally {
11118 closeSession(session);
11119 }
11120 }
11121
11122
11130 public int countByG_S(long groupId, int status) throws SystemException {
11131 Object[] finderArgs = new Object[] { groupId, status };
11132
11133 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_S,
11134 finderArgs, this);
11135
11136 if (count == null) {
11137 StringBundler query = new StringBundler(3);
11138
11139 query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
11140
11141 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
11142
11143 query.append(_FINDER_COLUMN_G_S_STATUS_2);
11144
11145 String sql = query.toString();
11146
11147 Session session = null;
11148
11149 try {
11150 session = openSession();
11151
11152 Query q = session.createQuery(sql);
11153
11154 QueryPos qPos = QueryPos.getInstance(q);
11155
11156 qPos.add(groupId);
11157
11158 qPos.add(status);
11159
11160 count = (Long)q.uniqueResult();
11161 }
11162 catch (Exception e) {
11163 throw processException(e);
11164 }
11165 finally {
11166 if (count == null) {
11167 count = Long.valueOf(0);
11168 }
11169
11170 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_S, finderArgs,
11171 count);
11172
11173 closeSession(session);
11174 }
11175 }
11176
11177 return count.intValue();
11178 }
11179
11180
11188 public int filterCountByG_S(long groupId, int status)
11189 throws SystemException {
11190 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
11191 return countByG_S(groupId, status);
11192 }
11193
11194 StringBundler query = new StringBundler(3);
11195
11196 query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE);
11197
11198 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
11199
11200 query.append(_FINDER_COLUMN_G_S_STATUS_2);
11201
11202 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
11203 BlogsEntry.class.getName(),
11204 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
11205
11206 Session session = null;
11207
11208 try {
11209 session = openSession();
11210
11211 SQLQuery q = session.createSQLQuery(sql);
11212
11213 q.addScalar(COUNT_COLUMN_NAME,
11214 com.liferay.portal.kernel.dao.orm.Type.LONG);
11215
11216 QueryPos qPos = QueryPos.getInstance(q);
11217
11218 qPos.add(groupId);
11219
11220 qPos.add(status);
11221
11222 Long count = (Long)q.uniqueResult();
11223
11224 return count.intValue();
11225 }
11226 catch (Exception e) {
11227 throw processException(e);
11228 }
11229 finally {
11230 closeSession(session);
11231 }
11232 }
11233
11234
11242 public int countByLtD_S(Date displayDate, int status)
11243 throws SystemException {
11244 Object[] finderArgs = new Object[] { displayDate, status };
11245
11246 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_LTD_S,
11247 finderArgs, this);
11248
11249 if (count == null) {
11250 StringBundler query = new StringBundler(3);
11251
11252 query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
11253
11254 if (displayDate == null) {
11255 query.append(_FINDER_COLUMN_LTD_S_DISPLAYDATE_1);
11256 }
11257 else {
11258 query.append(_FINDER_COLUMN_LTD_S_DISPLAYDATE_2);
11259 }
11260
11261 query.append(_FINDER_COLUMN_LTD_S_STATUS_2);
11262
11263 String sql = query.toString();
11264
11265 Session session = null;
11266
11267 try {
11268 session = openSession();
11269
11270 Query q = session.createQuery(sql);
11271
11272 QueryPos qPos = QueryPos.getInstance(q);
11273
11274 if (displayDate != null) {
11275 qPos.add(CalendarUtil.getTimestamp(displayDate));
11276 }
11277
11278 qPos.add(status);
11279
11280 count = (Long)q.uniqueResult();
11281 }
11282 catch (Exception e) {
11283 throw processException(e);
11284 }
11285 finally {
11286 if (count == null) {
11287 count = Long.valueOf(0);
11288 }
11289
11290 FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_LTD_S,
11291 finderArgs, count);
11292
11293 closeSession(session);
11294 }
11295 }
11296
11297 return count.intValue();
11298 }
11299
11300
11309 public int countByC_U_S(long companyId, long userId, int status)
11310 throws SystemException {
11311 Object[] finderArgs = new Object[] { companyId, userId, status };
11312
11313 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_U_S,
11314 finderArgs, this);
11315
11316 if (count == null) {
11317 StringBundler query = new StringBundler(4);
11318
11319 query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
11320
11321 query.append(_FINDER_COLUMN_C_U_S_COMPANYID_2);
11322
11323 query.append(_FINDER_COLUMN_C_U_S_USERID_2);
11324
11325 query.append(_FINDER_COLUMN_C_U_S_STATUS_2);
11326
11327 String sql = query.toString();
11328
11329 Session session = null;
11330
11331 try {
11332 session = openSession();
11333
11334 Query q = session.createQuery(sql);
11335
11336 QueryPos qPos = QueryPos.getInstance(q);
11337
11338 qPos.add(companyId);
11339
11340 qPos.add(userId);
11341
11342 qPos.add(status);
11343
11344 count = (Long)q.uniqueResult();
11345 }
11346 catch (Exception e) {
11347 throw processException(e);
11348 }
11349 finally {
11350 if (count == null) {
11351 count = Long.valueOf(0);
11352 }
11353
11354 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_U_S,
11355 finderArgs, count);
11356
11357 closeSession(session);
11358 }
11359 }
11360
11361 return count.intValue();
11362 }
11363
11364
11373 public int countByC_LtD_S(long companyId, Date displayDate, int status)
11374 throws SystemException {
11375 Object[] finderArgs = new Object[] { companyId, displayDate, status };
11376
11377 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_C_LTD_S,
11378 finderArgs, this);
11379
11380 if (count == null) {
11381 StringBundler query = new StringBundler(4);
11382
11383 query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
11384
11385 query.append(_FINDER_COLUMN_C_LTD_S_COMPANYID_2);
11386
11387 if (displayDate == null) {
11388 query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_1);
11389 }
11390 else {
11391 query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_2);
11392 }
11393
11394 query.append(_FINDER_COLUMN_C_LTD_S_STATUS_2);
11395
11396 String sql = query.toString();
11397
11398 Session session = null;
11399
11400 try {
11401 session = openSession();
11402
11403 Query q = session.createQuery(sql);
11404
11405 QueryPos qPos = QueryPos.getInstance(q);
11406
11407 qPos.add(companyId);
11408
11409 if (displayDate != null) {
11410 qPos.add(CalendarUtil.getTimestamp(displayDate));
11411 }
11412
11413 qPos.add(status);
11414
11415 count = (Long)q.uniqueResult();
11416 }
11417 catch (Exception e) {
11418 throw processException(e);
11419 }
11420 finally {
11421 if (count == null) {
11422 count = Long.valueOf(0);
11423 }
11424
11425 FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_C_LTD_S,
11426 finderArgs, count);
11427
11428 closeSession(session);
11429 }
11430 }
11431
11432 return count.intValue();
11433 }
11434
11435
11444 public int countByG_U_LtD(long groupId, long userId, Date displayDate)
11445 throws SystemException {
11446 Object[] finderArgs = new Object[] { groupId, userId, displayDate };
11447
11448 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_G_U_LTD,
11449 finderArgs, this);
11450
11451 if (count == null) {
11452 StringBundler query = new StringBundler(4);
11453
11454 query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
11455
11456 query.append(_FINDER_COLUMN_G_U_LTD_GROUPID_2);
11457
11458 query.append(_FINDER_COLUMN_G_U_LTD_USERID_2);
11459
11460 if (displayDate == null) {
11461 query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1);
11462 }
11463 else {
11464 query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2);
11465 }
11466
11467 String sql = query.toString();
11468
11469 Session session = null;
11470
11471 try {
11472 session = openSession();
11473
11474 Query q = session.createQuery(sql);
11475
11476 QueryPos qPos = QueryPos.getInstance(q);
11477
11478 qPos.add(groupId);
11479
11480 qPos.add(userId);
11481
11482 if (displayDate != null) {
11483 qPos.add(CalendarUtil.getTimestamp(displayDate));
11484 }
11485
11486 count = (Long)q.uniqueResult();
11487 }
11488 catch (Exception e) {
11489 throw processException(e);
11490 }
11491 finally {
11492 if (count == null) {
11493 count = Long.valueOf(0);
11494 }
11495
11496 FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_G_U_LTD,
11497 finderArgs, count);
11498
11499 closeSession(session);
11500 }
11501 }
11502
11503 return count.intValue();
11504 }
11505
11506
11515 public int filterCountByG_U_LtD(long groupId, long userId, Date displayDate)
11516 throws SystemException {
11517 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
11518 return countByG_U_LtD(groupId, userId, displayDate);
11519 }
11520
11521 StringBundler query = new StringBundler(4);
11522
11523 query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE);
11524
11525 query.append(_FINDER_COLUMN_G_U_LTD_GROUPID_2);
11526
11527 query.append(_FINDER_COLUMN_G_U_LTD_USERID_2);
11528
11529 if (displayDate == null) {
11530 query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1);
11531 }
11532 else {
11533 query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2);
11534 }
11535
11536 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
11537 BlogsEntry.class.getName(),
11538 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
11539
11540 Session session = null;
11541
11542 try {
11543 session = openSession();
11544
11545 SQLQuery q = session.createSQLQuery(sql);
11546
11547 q.addScalar(COUNT_COLUMN_NAME,
11548 com.liferay.portal.kernel.dao.orm.Type.LONG);
11549
11550 QueryPos qPos = QueryPos.getInstance(q);
11551
11552 qPos.add(groupId);
11553
11554 qPos.add(userId);
11555
11556 if (displayDate != null) {
11557 qPos.add(CalendarUtil.getTimestamp(displayDate));
11558 }
11559
11560 Long count = (Long)q.uniqueResult();
11561
11562 return count.intValue();
11563 }
11564 catch (Exception e) {
11565 throw processException(e);
11566 }
11567 finally {
11568 closeSession(session);
11569 }
11570 }
11571
11572
11581 public int countByG_U_S(long groupId, long userId, int status)
11582 throws SystemException {
11583 Object[] finderArgs = new Object[] { groupId, userId, status };
11584
11585 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U_S,
11586 finderArgs, this);
11587
11588 if (count == null) {
11589 StringBundler query = new StringBundler(4);
11590
11591 query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
11592
11593 query.append(_FINDER_COLUMN_G_U_S_GROUPID_2);
11594
11595 query.append(_FINDER_COLUMN_G_U_S_USERID_2);
11596
11597 query.append(_FINDER_COLUMN_G_U_S_STATUS_2);
11598
11599 String sql = query.toString();
11600
11601 Session session = null;
11602
11603 try {
11604 session = openSession();
11605
11606 Query q = session.createQuery(sql);
11607
11608 QueryPos qPos = QueryPos.getInstance(q);
11609
11610 qPos.add(groupId);
11611
11612 qPos.add(userId);
11613
11614 qPos.add(status);
11615
11616 count = (Long)q.uniqueResult();
11617 }
11618 catch (Exception e) {
11619 throw processException(e);
11620 }
11621 finally {
11622 if (count == null) {
11623 count = Long.valueOf(0);
11624 }
11625
11626 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U_S,
11627 finderArgs, count);
11628
11629 closeSession(session);
11630 }
11631 }
11632
11633 return count.intValue();
11634 }
11635
11636
11645 public int filterCountByG_U_S(long groupId, long userId, int status)
11646 throws SystemException {
11647 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
11648 return countByG_U_S(groupId, userId, status);
11649 }
11650
11651 StringBundler query = new StringBundler(4);
11652
11653 query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE);
11654
11655 query.append(_FINDER_COLUMN_G_U_S_GROUPID_2);
11656
11657 query.append(_FINDER_COLUMN_G_U_S_USERID_2);
11658
11659 query.append(_FINDER_COLUMN_G_U_S_STATUS_2);
11660
11661 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
11662 BlogsEntry.class.getName(),
11663 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
11664
11665 Session session = null;
11666
11667 try {
11668 session = openSession();
11669
11670 SQLQuery q = session.createSQLQuery(sql);
11671
11672 q.addScalar(COUNT_COLUMN_NAME,
11673 com.liferay.portal.kernel.dao.orm.Type.LONG);
11674
11675 QueryPos qPos = QueryPos.getInstance(q);
11676
11677 qPos.add(groupId);
11678
11679 qPos.add(userId);
11680
11681 qPos.add(status);
11682
11683 Long count = (Long)q.uniqueResult();
11684
11685 return count.intValue();
11686 }
11687 catch (Exception e) {
11688 throw processException(e);
11689 }
11690 finally {
11691 closeSession(session);
11692 }
11693 }
11694
11695
11704 public int countByG_LtD_S(long groupId, Date displayDate, int status)
11705 throws SystemException {
11706 Object[] finderArgs = new Object[] { groupId, displayDate, status };
11707
11708 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_G_LTD_S,
11709 finderArgs, this);
11710
11711 if (count == null) {
11712 StringBundler query = new StringBundler(4);
11713
11714 query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
11715
11716 query.append(_FINDER_COLUMN_G_LTD_S_GROUPID_2);
11717
11718 if (displayDate == null) {
11719 query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1);
11720 }
11721 else {
11722 query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2);
11723 }
11724
11725 query.append(_FINDER_COLUMN_G_LTD_S_STATUS_2);
11726
11727 String sql = query.toString();
11728
11729 Session session = null;
11730
11731 try {
11732 session = openSession();
11733
11734 Query q = session.createQuery(sql);
11735
11736 QueryPos qPos = QueryPos.getInstance(q);
11737
11738 qPos.add(groupId);
11739
11740 if (displayDate != null) {
11741 qPos.add(CalendarUtil.getTimestamp(displayDate));
11742 }
11743
11744 qPos.add(status);
11745
11746 count = (Long)q.uniqueResult();
11747 }
11748 catch (Exception e) {
11749 throw processException(e);
11750 }
11751 finally {
11752 if (count == null) {
11753 count = Long.valueOf(0);
11754 }
11755
11756 FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_G_LTD_S,
11757 finderArgs, count);
11758
11759 closeSession(session);
11760 }
11761 }
11762
11763 return count.intValue();
11764 }
11765
11766
11775 public int filterCountByG_LtD_S(long groupId, Date displayDate, int status)
11776 throws SystemException {
11777 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
11778 return countByG_LtD_S(groupId, displayDate, status);
11779 }
11780
11781 StringBundler query = new StringBundler(4);
11782
11783 query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE);
11784
11785 query.append(_FINDER_COLUMN_G_LTD_S_GROUPID_2);
11786
11787 if (displayDate == null) {
11788 query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1);
11789 }
11790 else {
11791 query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2);
11792 }
11793
11794 query.append(_FINDER_COLUMN_G_LTD_S_STATUS_2);
11795
11796 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
11797 BlogsEntry.class.getName(),
11798 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
11799
11800 Session session = null;
11801
11802 try {
11803 session = openSession();
11804
11805 SQLQuery q = session.createSQLQuery(sql);
11806
11807 q.addScalar(COUNT_COLUMN_NAME,
11808 com.liferay.portal.kernel.dao.orm.Type.LONG);
11809
11810 QueryPos qPos = QueryPos.getInstance(q);
11811
11812 qPos.add(groupId);
11813
11814 if (displayDate != null) {
11815 qPos.add(CalendarUtil.getTimestamp(displayDate));
11816 }
11817
11818 qPos.add(status);
11819
11820 Long count = (Long)q.uniqueResult();
11821
11822 return count.intValue();
11823 }
11824 catch (Exception e) {
11825 throw processException(e);
11826 }
11827 finally {
11828 closeSession(session);
11829 }
11830 }
11831
11832
11842 public int countByG_U_LtD_S(long groupId, long userId, Date displayDate,
11843 int status) throws SystemException {
11844 Object[] finderArgs = new Object[] { groupId, userId, displayDate, status };
11845
11846 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_G_U_LTD_S,
11847 finderArgs, this);
11848
11849 if (count == null) {
11850 StringBundler query = new StringBundler(5);
11851
11852 query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
11853
11854 query.append(_FINDER_COLUMN_G_U_LTD_S_GROUPID_2);
11855
11856 query.append(_FINDER_COLUMN_G_U_LTD_S_USERID_2);
11857
11858 if (displayDate == null) {
11859 query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1);
11860 }
11861 else {
11862 query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2);
11863 }
11864
11865 query.append(_FINDER_COLUMN_G_U_LTD_S_STATUS_2);
11866
11867 String sql = query.toString();
11868
11869 Session session = null;
11870
11871 try {
11872 session = openSession();
11873
11874 Query q = session.createQuery(sql);
11875
11876 QueryPos qPos = QueryPos.getInstance(q);
11877
11878 qPos.add(groupId);
11879
11880 qPos.add(userId);
11881
11882 if (displayDate != null) {
11883 qPos.add(CalendarUtil.getTimestamp(displayDate));
11884 }
11885
11886 qPos.add(status);
11887
11888 count = (Long)q.uniqueResult();
11889 }
11890 catch (Exception e) {
11891 throw processException(e);
11892 }
11893 finally {
11894 if (count == null) {
11895 count = Long.valueOf(0);
11896 }
11897
11898 FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_G_U_LTD_S,
11899 finderArgs, count);
11900
11901 closeSession(session);
11902 }
11903 }
11904
11905 return count.intValue();
11906 }
11907
11908
11918 public int filterCountByG_U_LtD_S(long groupId, long userId,
11919 Date displayDate, int status) throws SystemException {
11920 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
11921 return countByG_U_LtD_S(groupId, userId, displayDate, status);
11922 }
11923
11924 StringBundler query = new StringBundler(5);
11925
11926 query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE);
11927
11928 query.append(_FINDER_COLUMN_G_U_LTD_S_GROUPID_2);
11929
11930 query.append(_FINDER_COLUMN_G_U_LTD_S_USERID_2);
11931
11932 if (displayDate == null) {
11933 query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1);
11934 }
11935 else {
11936 query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2);
11937 }
11938
11939 query.append(_FINDER_COLUMN_G_U_LTD_S_STATUS_2);
11940
11941 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
11942 BlogsEntry.class.getName(),
11943 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
11944
11945 Session session = null;
11946
11947 try {
11948 session = openSession();
11949
11950 SQLQuery q = session.createSQLQuery(sql);
11951
11952 q.addScalar(COUNT_COLUMN_NAME,
11953 com.liferay.portal.kernel.dao.orm.Type.LONG);
11954
11955 QueryPos qPos = QueryPos.getInstance(q);
11956
11957 qPos.add(groupId);
11958
11959 qPos.add(userId);
11960
11961 if (displayDate != null) {
11962 qPos.add(CalendarUtil.getTimestamp(displayDate));
11963 }
11964
11965 qPos.add(status);
11966
11967 Long count = (Long)q.uniqueResult();
11968
11969 return count.intValue();
11970 }
11971 catch (Exception e) {
11972 throw processException(e);
11973 }
11974 finally {
11975 closeSession(session);
11976 }
11977 }
11978
11979
11985 public int countAll() throws SystemException {
11986 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
11987 FINDER_ARGS_EMPTY, this);
11988
11989 if (count == null) {
11990 Session session = null;
11991
11992 try {
11993 session = openSession();
11994
11995 Query q = session.createQuery(_SQL_COUNT_BLOGSENTRY);
11996
11997 count = (Long)q.uniqueResult();
11998 }
11999 catch (Exception e) {
12000 throw processException(e);
12001 }
12002 finally {
12003 if (count == null) {
12004 count = Long.valueOf(0);
12005 }
12006
12007 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
12008 FINDER_ARGS_EMPTY, count);
12009
12010 closeSession(session);
12011 }
12012 }
12013
12014 return count.intValue();
12015 }
12016
12017
12020 public void afterPropertiesSet() {
12021 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
12022 com.liferay.portal.util.PropsUtil.get(
12023 "value.object.listener.com.liferay.portlet.blogs.model.BlogsEntry")));
12024
12025 if (listenerClassNames.length > 0) {
12026 try {
12027 List<ModelListener<BlogsEntry>> listenersList = new ArrayList<ModelListener<BlogsEntry>>();
12028
12029 for (String listenerClassName : listenerClassNames) {
12030 listenersList.add((ModelListener<BlogsEntry>)InstanceFactory.newInstance(
12031 listenerClassName));
12032 }
12033
12034 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
12035 }
12036 catch (Exception e) {
12037 _log.error(e);
12038 }
12039 }
12040 }
12041
12042 public void destroy() {
12043 EntityCacheUtil.removeCache(BlogsEntryImpl.class.getName());
12044 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
12045 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
12046 }
12047
12048 @BeanReference(type = BlogsEntryPersistence.class)
12049 protected BlogsEntryPersistence blogsEntryPersistence;
12050 @BeanReference(type = BlogsStatsUserPersistence.class)
12051 protected BlogsStatsUserPersistence blogsStatsUserPersistence;
12052 @BeanReference(type = CompanyPersistence.class)
12053 protected CompanyPersistence companyPersistence;
12054 @BeanReference(type = GroupPersistence.class)
12055 protected GroupPersistence groupPersistence;
12056 @BeanReference(type = ImagePersistence.class)
12057 protected ImagePersistence imagePersistence;
12058 @BeanReference(type = OrganizationPersistence.class)
12059 protected OrganizationPersistence organizationPersistence;
12060 @BeanReference(type = PortletPreferencesPersistence.class)
12061 protected PortletPreferencesPersistence portletPreferencesPersistence;
12062 @BeanReference(type = ResourcePersistence.class)
12063 protected ResourcePersistence resourcePersistence;
12064 @BeanReference(type = SubscriptionPersistence.class)
12065 protected SubscriptionPersistence subscriptionPersistence;
12066 @BeanReference(type = UserPersistence.class)
12067 protected UserPersistence userPersistence;
12068 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
12069 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
12070 @BeanReference(type = AssetEntryPersistence.class)
12071 protected AssetEntryPersistence assetEntryPersistence;
12072 @BeanReference(type = AssetLinkPersistence.class)
12073 protected AssetLinkPersistence assetLinkPersistence;
12074 @BeanReference(type = AssetTagPersistence.class)
12075 protected AssetTagPersistence assetTagPersistence;
12076 @BeanReference(type = ExpandoValuePersistence.class)
12077 protected ExpandoValuePersistence expandoValuePersistence;
12078 @BeanReference(type = MBMessagePersistence.class)
12079 protected MBMessagePersistence mbMessagePersistence;
12080 @BeanReference(type = RatingsStatsPersistence.class)
12081 protected RatingsStatsPersistence ratingsStatsPersistence;
12082 @BeanReference(type = SocialActivityPersistence.class)
12083 protected SocialActivityPersistence socialActivityPersistence;
12084 private static final String _SQL_SELECT_BLOGSENTRY = "SELECT blogsEntry FROM BlogsEntry blogsEntry";
12085 private static final String _SQL_SELECT_BLOGSENTRY_WHERE = "SELECT blogsEntry FROM BlogsEntry blogsEntry WHERE ";
12086 private static final String _SQL_COUNT_BLOGSENTRY = "SELECT COUNT(blogsEntry) FROM BlogsEntry blogsEntry";
12087 private static final String _SQL_COUNT_BLOGSENTRY_WHERE = "SELECT COUNT(blogsEntry) FROM BlogsEntry blogsEntry WHERE ";
12088 private static final String _FINDER_COLUMN_UUID_UUID_1 = "blogsEntry.uuid IS NULL";
12089 private static final String _FINDER_COLUMN_UUID_UUID_2 = "blogsEntry.uuid = ?";
12090 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(blogsEntry.uuid IS NULL OR blogsEntry.uuid = ?)";
12091 private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "blogsEntry.uuid IS NULL AND ";
12092 private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "blogsEntry.uuid = ? AND ";
12093 private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(blogsEntry.uuid IS NULL OR blogsEntry.uuid = ?) AND ";
12094 private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "blogsEntry.groupId = ?";
12095 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "blogsEntry.groupId = ?";
12096 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "blogsEntry.companyId = ?";
12097 private static final String _FINDER_COLUMN_C_U_COMPANYID_2 = "blogsEntry.companyId = ? AND ";
12098 private static final String _FINDER_COLUMN_C_U_USERID_2 = "blogsEntry.userId = ?";
12099 private static final String _FINDER_COLUMN_C_LTD_COMPANYID_2 = "blogsEntry.companyId = ? AND ";
12100 private static final String _FINDER_COLUMN_C_LTD_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL";
12101 private static final String _FINDER_COLUMN_C_LTD_DISPLAYDATE_2 = "blogsEntry.displayDate < ?";
12102 private static final String _FINDER_COLUMN_C_S_COMPANYID_2 = "blogsEntry.companyId = ? AND ";
12103 private static final String _FINDER_COLUMN_C_S_STATUS_2 = "blogsEntry.status = ?";
12104 private static final String _FINDER_COLUMN_G_UT_GROUPID_2 = "blogsEntry.groupId = ? AND ";
12105 private static final String _FINDER_COLUMN_G_UT_URLTITLE_1 = "blogsEntry.urlTitle IS NULL";
12106 private static final String _FINDER_COLUMN_G_UT_URLTITLE_2 = "blogsEntry.urlTitle = ?";
12107 private static final String _FINDER_COLUMN_G_UT_URLTITLE_3 = "(blogsEntry.urlTitle IS NULL OR blogsEntry.urlTitle = ?)";
12108 private static final String _FINDER_COLUMN_G_LTD_GROUPID_2 = "blogsEntry.groupId = ? AND ";
12109 private static final String _FINDER_COLUMN_G_LTD_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL";
12110 private static final String _FINDER_COLUMN_G_LTD_DISPLAYDATE_2 = "blogsEntry.displayDate < ?";
12111 private static final String _FINDER_COLUMN_G_S_GROUPID_2 = "blogsEntry.groupId = ? AND ";
12112 private static final String _FINDER_COLUMN_G_S_STATUS_2 = "blogsEntry.status = ?";
12113 private static final String _FINDER_COLUMN_LTD_S_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL AND ";
12114 private static final String _FINDER_COLUMN_LTD_S_DISPLAYDATE_2 = "blogsEntry.displayDate < ? AND ";
12115 private static final String _FINDER_COLUMN_LTD_S_STATUS_2 = "blogsEntry.status = ?";
12116 private static final String _FINDER_COLUMN_C_U_S_COMPANYID_2 = "blogsEntry.companyId = ? AND ";
12117 private static final String _FINDER_COLUMN_C_U_S_USERID_2 = "blogsEntry.userId = ? AND ";
12118 private static final String _FINDER_COLUMN_C_U_S_STATUS_2 = "blogsEntry.status = ?";
12119 private static final String _FINDER_COLUMN_C_LTD_S_COMPANYID_2 = "blogsEntry.companyId = ? AND ";
12120 private static final String _FINDER_COLUMN_C_LTD_S_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL AND ";
12121 private static final String _FINDER_COLUMN_C_LTD_S_DISPLAYDATE_2 = "blogsEntry.displayDate < ? AND ";
12122 private static final String _FINDER_COLUMN_C_LTD_S_STATUS_2 = "blogsEntry.status = ?";
12123 private static final String _FINDER_COLUMN_G_U_LTD_GROUPID_2 = "blogsEntry.groupId = ? AND ";
12124 private static final String _FINDER_COLUMN_G_U_LTD_USERID_2 = "blogsEntry.userId = ? AND ";
12125 private static final String _FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL";
12126 private static final String _FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2 = "blogsEntry.displayDate < ?";
12127 private static final String _FINDER_COLUMN_G_U_S_GROUPID_2 = "blogsEntry.groupId = ? AND ";
12128 private static final String _FINDER_COLUMN_G_U_S_USERID_2 = "blogsEntry.userId = ? AND ";
12129 private static final String _FINDER_COLUMN_G_U_S_STATUS_2 = "blogsEntry.status = ?";
12130 private static final String _FINDER_COLUMN_G_LTD_S_GROUPID_2 = "blogsEntry.groupId = ? AND ";
12131 private static final String _FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL AND ";
12132 private static final String _FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2 = "blogsEntry.displayDate < ? AND ";
12133 private static final String _FINDER_COLUMN_G_LTD_S_STATUS_2 = "blogsEntry.status = ?";
12134 private static final String _FINDER_COLUMN_G_U_LTD_S_GROUPID_2 = "blogsEntry.groupId = ? AND ";
12135 private static final String _FINDER_COLUMN_G_U_LTD_S_USERID_2 = "blogsEntry.userId = ? AND ";
12136 private static final String _FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL AND ";
12137 private static final String _FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2 = "blogsEntry.displayDate < ? AND ";
12138 private static final String _FINDER_COLUMN_G_U_LTD_S_STATUS_2 = "blogsEntry.status = ?";
12139 private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "blogsEntry.entryId";
12140 private static final String _FILTER_SQL_SELECT_BLOGSENTRY_WHERE = "SELECT DISTINCT {blogsEntry.*} FROM BlogsEntry blogsEntry WHERE ";
12141 private static final String _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1 =
12142 "SELECT {BlogsEntry.*} FROM (SELECT DISTINCT blogsEntry.entryId FROM BlogsEntry blogsEntry WHERE ";
12143 private static final String _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2 =
12144 ") TEMP_TABLE INNER JOIN BlogsEntry ON TEMP_TABLE.entryId = BlogsEntry.entryId";
12145 private static final String _FILTER_SQL_COUNT_BLOGSENTRY_WHERE = "SELECT COUNT(DISTINCT blogsEntry.entryId) AS COUNT_VALUE FROM BlogsEntry blogsEntry WHERE ";
12146 private static final String _FILTER_ENTITY_ALIAS = "blogsEntry";
12147 private static final String _FILTER_ENTITY_TABLE = "BlogsEntry";
12148 private static final String _ORDER_BY_ENTITY_ALIAS = "blogsEntry.";
12149 private static final String _ORDER_BY_ENTITY_TABLE = "BlogsEntry.";
12150 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No BlogsEntry exists with the primary key ";
12151 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No BlogsEntry exists with the key {";
12152 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
12153 private static Log _log = LogFactoryUtil.getLog(BlogsEntryPersistenceImpl.class);
12154 private static BlogsEntry _nullBlogsEntry = new BlogsEntryImpl() {
12155 @Override
12156 public Object clone() {
12157 return this;
12158 }
12159
12160 @Override
12161 public CacheModel<BlogsEntry> toCacheModel() {
12162 return _nullBlogsEntryCacheModel;
12163 }
12164 };
12165
12166 private static CacheModel<BlogsEntry> _nullBlogsEntryCacheModel = new CacheModel<BlogsEntry>() {
12167 public BlogsEntry toEntityModel() {
12168 return _nullBlogsEntry;
12169 }
12170 };
12171 }